logixia 2.0.0 → 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.
- package/README.md +46 -29
- package/dist/async-context-B05ArHgM.mjs +134 -0
- package/dist/async-context-B05ArHgM.mjs.map +1 -0
- package/dist/async-context-DTQgi8f7.js +150 -0
- package/dist/async-context-DTQgi8f7.js.map +1 -0
- package/dist/{azure-monitor.transport-CHnjVRF-.mjs → azure-monitor.transport-BPbgjATu.mjs} +27 -15
- package/dist/azure-monitor.transport-BPbgjATu.mjs.map +1 -0
- package/dist/{azure-monitor.transport-Cn_3Usvu.d.ts → azure-monitor.transport-C7kYyZUW.d.mts} +3 -6
- package/dist/azure-monitor.transport-C7kYyZUW.d.mts.map +1 -0
- package/dist/{azure-monitor.transport-CrvfHd9C.js → azure-monitor.transport-CwbOLZHB.js} +32 -20
- package/dist/azure-monitor.transport-CwbOLZHB.js.map +1 -0
- package/dist/{azure-monitor.transport-D7Da4RAb.d.mts → azure-monitor.transport-DV03Z5P4.d.ts} +3 -6
- package/dist/azure-monitor.transport-DV03Z5P4.d.ts.map +1 -0
- package/dist/azure.d.mts +1 -2
- package/dist/azure.d.ts +1 -2
- package/dist/azure.js +3 -6
- package/dist/azure.mjs +1 -6
- package/dist/{batch-buffer-PGvSgbmd.mjs → batch-buffer-0fgLmIPn.mjs} +21 -7
- package/dist/batch-buffer-0fgLmIPn.mjs.map +1 -0
- package/dist/{batch-buffer-BY-mRWIK.js → batch-buffer-DT4gdXmf.js} +53 -40
- package/dist/batch-buffer-DT4gdXmf.js.map +1 -0
- package/dist/browser.d.mts +45 -25
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +45 -25
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +420 -53
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +421 -56
- package/dist/browser.mjs.map +1 -1
- package/dist/{builder-0gEzRopq.mjs → builder-D70z6kjj.mjs} +212 -104
- package/dist/builder-D70z6kjj.mjs.map +1 -0
- package/dist/{builder-D44QktIo.js → builder-M7NoaugM.js} +355 -249
- package/dist/builder-M7NoaugM.js.map +1 -0
- package/dist/cli/index.js +59 -59
- package/dist/cloudwatch.d.mts +1 -2
- package/dist/cloudwatch.d.ts +1 -2
- package/dist/cloudwatch.js +3 -7
- package/dist/cloudwatch.mjs +1 -7
- package/dist/{cloudwatch.transport-BO1ahxw-.js → cloudwatch.transport-B2wKQFF7.js} +61 -36
- package/dist/cloudwatch.transport-B2wKQFF7.js.map +1 -0
- package/dist/{cloudwatch.transport-DZ6ies7g.mjs → cloudwatch.transport-BTvYfLs9.mjs} +54 -28
- package/dist/cloudwatch.transport-BTvYfLs9.mjs.map +1 -0
- package/dist/{cloudwatch.transport-DsEq633o.d.ts → cloudwatch.transport-Bf7L4I59.d.ts} +2 -6
- package/dist/cloudwatch.transport-Bf7L4I59.d.ts.map +1 -0
- package/dist/{cloudwatch.transport-UlyZFWMn.d.mts → cloudwatch.transport-Rj4yTpRn.d.mts} +2 -6
- package/dist/cloudwatch.transport-Rj4yTpRn.d.mts.map +1 -0
- package/dist/{coerce.utils-Cu6IUTgX.mjs → coerce.utils-B_rEudCn.mjs} +3 -4
- package/dist/{coerce.utils-Cu6IUTgX.mjs.map → coerce.utils-B_rEudCn.mjs.map} +1 -1
- package/dist/{coerce.utils-B-LilukN.js → coerce.utils-C1C5sIX0.js} +8 -10
- package/dist/{coerce.utils-B-LilukN.js.map → coerce.utils-C1C5sIX0.js.map} +1 -1
- package/dist/correlation.d.mts +13 -16
- package/dist/correlation.d.mts.map +1 -1
- package/dist/correlation.d.ts +13 -16
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +58 -9
- package/dist/correlation.js.map +1 -1
- package/dist/correlation.mjs +56 -6
- package/dist/correlation.mjs.map +1 -1
- package/dist/{entry-fields-BJkuPnIg.mjs → entry-fields-CGuvT2R0.mjs} +5 -6
- package/dist/entry-fields-CGuvT2R0.mjs.map +1 -0
- package/dist/{entry-fields-BvOLFlJ4.js → entry-fields-RLd1jCoR.js} +10 -12
- package/dist/entry-fields-RLd1jCoR.js.map +1 -0
- package/dist/gcp.d.mts +1 -2
- package/dist/gcp.d.ts +1 -2
- package/dist/gcp.js +3 -7
- package/dist/gcp.mjs +1 -7
- package/dist/{gcp.transport-B7oc97sG.d.ts → gcp.transport-C5D72b1g.d.mts} +3 -6
- package/dist/gcp.transport-C5D72b1g.d.mts.map +1 -0
- package/dist/{gcp.transport-GrJurKo8.d.mts → gcp.transport-CFQfdAOK.d.ts} +3 -6
- package/dist/gcp.transport-CFQfdAOK.d.ts.map +1 -0
- package/dist/{gcp.transport-DBX5TPIy.mjs → gcp.transport-CGKopAhQ.mjs} +55 -16
- package/dist/gcp.transport-CGKopAhQ.mjs.map +1 -0
- package/dist/{gcp.transport-CHV8MGgz.js → gcp.transport-KZe9hCAR.js} +60 -22
- package/dist/gcp.transport-KZe9hCAR.js.map +1 -0
- package/dist/{index-DhIoploR.d.ts → index-DwozbmB4.d.ts} +3 -8
- package/dist/index-DwozbmB4.d.ts.map +1 -0
- package/dist/{index-3mw5gaCw.d.mts → index-xqaJtAZn.d.mts} +3 -8
- package/dist/index-xqaJtAZn.d.mts.map +1 -0
- package/dist/index.d.mts +106 -165
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +105 -164
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +164 -261
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -243
- package/dist/index.mjs.map +1 -1
- package/dist/internal-log-b0Vp4qrB.js +183 -0
- package/dist/internal-log-b0Vp4qrB.js.map +1 -0
- package/dist/internal-log-uCSd1PMc.mjs +142 -0
- package/dist/internal-log-uCSd1PMc.mjs.map +1 -0
- package/dist/{logitron-logger-UVeN-mQm.d.ts → logitron-logger-D2B75Oc7.d.ts} +116 -8
- package/dist/logitron-logger-D2B75Oc7.d.ts.map +1 -0
- package/dist/{logitron-logger-BFDSO8Io.d.mts → logitron-logger-oEd6wNhf.d.mts} +116 -8
- package/dist/logitron-logger-oEd6wNhf.d.mts.map +1 -0
- package/dist/middleware.d.mts +10 -12
- package/dist/middleware.d.mts.map +1 -1
- package/dist/middleware.d.ts +10 -12
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +16 -47
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +13 -45
- package/dist/middleware.mjs.map +1 -1
- package/dist/nest.d.mts +26 -44
- package/dist/nest.d.mts.map +1 -1
- package/dist/nest.d.ts +26 -44
- package/dist/nest.d.ts.map +1 -1
- package/dist/nest.js +116 -132
- package/dist/nest.js.map +1 -1
- package/dist/nest.mjs +59 -73
- package/dist/nest.mjs.map +1 -1
- package/dist/{trace.utils-CvXgaiQT.mjs → request-trace-C_fvIDv4.mjs} +44 -9
- package/dist/request-trace-C_fvIDv4.mjs.map +1 -0
- package/dist/{trace.utils-DpBOLDtq.js → request-trace-wTJdKp6-.js} +121 -77
- package/dist/request-trace-wTJdKp6-.js.map +1 -0
- package/dist/rolldown-runtime-D3PmRqjj.mjs +4 -0
- package/dist/{safe-stringify-DJ66tW5I.mjs → safe-stringify-BMRl3EX3.mjs} +3 -4
- package/dist/safe-stringify-BMRl3EX3.mjs.map +1 -0
- package/dist/{safe-stringify-DWo3aZp_.js → safe-stringify-DLz1Kz3o.js} +23 -25
- package/dist/safe-stringify-DLz1Kz3o.js.map +1 -0
- package/dist/{search-CNh9uVwR.d.ts → search-BH33XhuU.d.mts} +2 -22
- package/dist/search-BH33XhuU.d.mts.map +1 -0
- package/dist/{search-BFbu_oVn.mjs → search-CWMVYC-R.mjs} +22 -39
- package/dist/search-CWMVYC-R.mjs.map +1 -0
- package/dist/{search-DXANsQ2n.d.mts → search-CazwyX5Z.d.ts} +2 -22
- package/dist/search-CazwyX5Z.d.ts.map +1 -0
- package/dist/{search-C4V0OMEn.js → search-DUfWuzFP.js} +52 -69
- package/dist/search-DUfWuzFP.js.map +1 -0
- package/dist/search.d.mts +2 -4
- package/dist/search.d.ts +2 -4
- package/dist/search.js +3 -4
- package/dist/search.mjs +1 -4
- package/dist/secret-config-BegMLkYl.mjs +209 -0
- package/dist/secret-config-BegMLkYl.mjs.map +1 -0
- package/dist/secret-config-CBZBs0p1.js +271 -0
- package/dist/secret-config-CBZBs0p1.js.map +1 -0
- package/dist/{slack.transport-Bzw7sucI.mjs → slack.transport-Ce96JBDk.mjs} +212 -31
- package/dist/slack.transport-Ce96JBDk.mjs.map +1 -0
- package/dist/{slack.transport-BfJRouB2.js → slack.transport-Dlx3xvb7.js} +234 -41
- package/dist/slack.transport-Dlx3xvb7.js.map +1 -0
- package/dist/{slack.transport-BZzoXDPn.d.mts → slack.transport-DrirgDNy.d.ts} +56 -9
- package/dist/slack.transport-DrirgDNy.d.ts.map +1 -0
- package/dist/{slack.transport-CXjQYOes.d.ts → slack.transport-DxHOXlLu.d.mts} +56 -9
- package/dist/slack.transport-DxHOXlLu.d.mts.map +1 -0
- package/dist/testing.d.mts +3 -8
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.d.ts +3 -8
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +3 -4
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +2 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/{transport.manager-CXbKKdVE.js → transport.manager-DkcEOlqV.js} +164 -160
- package/dist/transport.manager-DkcEOlqV.js.map +1 -0
- package/dist/{transport.manager-BiuCAJd2.mjs → transport.manager-eZ_EeC00.mjs} +108 -99
- package/dist/transport.manager-eZ_EeC00.mjs.map +1 -0
- package/dist/{transport.types-CGoHpWQR.d.ts → transport.types-BJVL1QQl.d.mts} +1 -3
- package/dist/transport.types-BJVL1QQl.d.mts.map +1 -0
- package/dist/{transport.types-BMnurPcc.d.mts → transport.types-BJVL1QQl.d.ts} +1 -3
- package/dist/transport.types-BJVL1QQl.d.ts.map +1 -0
- package/dist/transports.d.mts +22 -36
- package/dist/transports.d.mts.map +1 -1
- package/dist/transports.d.ts +22 -36
- package/dist/transports.d.ts.map +1 -1
- package/dist/transports.js +10 -13
- package/dist/transports.mjs +7 -13
- package/dist/worker-entry.js +337 -87
- package/dist/worker.d.mts +1 -2
- package/dist/worker.d.ts +1 -2
- package/dist/worker.js +3 -4
- package/dist/worker.mjs +1 -4
- package/dist/{worker.transport-CdzSZJmw.d.ts → worker.transport-BuPwBi3d.d.ts} +2 -6
- package/dist/worker.transport-BuPwBi3d.d.ts.map +1 -0
- package/dist/{worker.transport-BdPxu3PN.js → worker.transport-C6GNl_r2.js} +44 -14
- package/dist/worker.transport-C6GNl_r2.js.map +1 -0
- package/dist/{worker.transport-lPxO2MVL.mjs → worker.transport-DLVA4y2e.mjs} +39 -9
- package/dist/worker.transport-DLVA4y2e.mjs.map +1 -0
- package/dist/{worker.transport-JvGPog3C.d.mts → worker.transport-hJay1wxA.d.mts} +2 -6
- package/dist/worker.transport-hJay1wxA.d.mts.map +1 -0
- package/package.json +19 -11
- package/dist/async-context-BzJrbfQs.mjs +0 -72
- package/dist/async-context-BzJrbfQs.mjs.map +0 -1
- package/dist/async-context-DyQQYq3I.js +0 -92
- package/dist/async-context-DyQQYq3I.js.map +0 -1
- package/dist/azure-monitor.transport-CHnjVRF-.mjs.map +0 -1
- package/dist/azure-monitor.transport-Cn_3Usvu.d.ts.map +0 -1
- package/dist/azure-monitor.transport-CrvfHd9C.js.map +0 -1
- package/dist/azure-monitor.transport-D7Da4RAb.d.mts.map +0 -1
- package/dist/batch-buffer-BY-mRWIK.js.map +0 -1
- package/dist/batch-buffer-PGvSgbmd.mjs.map +0 -1
- package/dist/builder-0gEzRopq.mjs.map +0 -1
- package/dist/builder-D44QktIo.js.map +0 -1
- package/dist/chunk-DLSkYcPk.mjs +0 -7
- package/dist/chunk-nOFOJqeH.js +0 -30
- package/dist/cloudwatch.transport-BO1ahxw-.js.map +0 -1
- package/dist/cloudwatch.transport-DZ6ies7g.mjs.map +0 -1
- package/dist/cloudwatch.transport-DsEq633o.d.ts.map +0 -1
- package/dist/cloudwatch.transport-UlyZFWMn.d.mts.map +0 -1
- package/dist/entry-fields-BJkuPnIg.mjs.map +0 -1
- package/dist/entry-fields-BvOLFlJ4.js.map +0 -1
- package/dist/gcp.transport-B7oc97sG.d.ts.map +0 -1
- package/dist/gcp.transport-CHV8MGgz.js.map +0 -1
- package/dist/gcp.transport-DBX5TPIy.mjs.map +0 -1
- package/dist/gcp.transport-GrJurKo8.d.mts.map +0 -1
- package/dist/index-3mw5gaCw.d.mts.map +0 -1
- package/dist/index-DhIoploR.d.ts.map +0 -1
- package/dist/internal-log-BUJYMZbE.js +0 -70
- package/dist/internal-log-BUJYMZbE.js.map +0 -1
- package/dist/internal-log-Cm8SOWSV.mjs +0 -52
- package/dist/internal-log-Cm8SOWSV.mjs.map +0 -1
- package/dist/logitron-logger-BFDSO8Io.d.mts.map +0 -1
- package/dist/logitron-logger-UVeN-mQm.d.ts.map +0 -1
- package/dist/safe-stringify-DJ66tW5I.mjs.map +0 -1
- package/dist/safe-stringify-DWo3aZp_.js.map +0 -1
- package/dist/search-BFbu_oVn.mjs.map +0 -1
- package/dist/search-C4V0OMEn.js.map +0 -1
- package/dist/search-CNh9uVwR.d.ts.map +0 -1
- package/dist/search-DXANsQ2n.d.mts.map +0 -1
- package/dist/slack.transport-BZzoXDPn.d.mts.map +0 -1
- package/dist/slack.transport-BfJRouB2.js.map +0 -1
- package/dist/slack.transport-Bzw7sucI.mjs.map +0 -1
- package/dist/slack.transport-CXjQYOes.d.ts.map +0 -1
- package/dist/trace.utils-CvXgaiQT.mjs.map +0 -1
- package/dist/trace.utils-DpBOLDtq.js.map +0 -1
- package/dist/transport.manager-BiuCAJd2.mjs.map +0 -1
- package/dist/transport.manager-CXbKKdVE.js.map +0 -1
- package/dist/transport.types-BMnurPcc.d.mts.map +0 -1
- package/dist/transport.types-CGoHpWQR.d.ts.map +0 -1
- package/dist/worker.transport-BdPxu3PN.js.map +0 -1
- package/dist/worker.transport-CdzSZJmw.d.ts.map +0 -1
- package/dist/worker.transport-JvGPog3C.d.mts.map +0 -1
- package/dist/worker.transport-lPxO2MVL.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const require_secret_config = require("./secret-config-CBZBs0p1.js");
|
|
2
|
+
const require_internal_log = require("./internal-log-b0Vp4qrB.js");
|
|
3
|
+
const require_safe_stringify = require("./safe-stringify-DLz1Kz3o.js");
|
|
4
|
+
const require_batch_buffer = require("./batch-buffer-DT4gdXmf.js");
|
|
5
|
+
// src/transports/azure-monitor.transport.ts
|
|
6
6
|
/**
|
|
7
7
|
* Azure AD tenant IDs are either a GUID or a verified domain (e.g. `contoso.onmicrosoft.com`).
|
|
8
8
|
* This pattern is deliberately permissive on structure but strict on character
|
|
@@ -32,6 +32,7 @@ var AzureMonitorTransport = class {
|
|
|
32
32
|
this.flushTimer = null;
|
|
33
33
|
this.accessToken = null;
|
|
34
34
|
this.tokenExpiry = 0;
|
|
35
|
+
require_secret_config.protectSecrets(this, ["clientSecret", "accessToken"]);
|
|
35
36
|
this.endpoint = config.endpoint.replace(/\/$/, "");
|
|
36
37
|
this.ruleId = config.ruleId;
|
|
37
38
|
this.streamName = config.streamName;
|
|
@@ -41,12 +42,13 @@ var AzureMonitorTransport = class {
|
|
|
41
42
|
this.batchSize = config.batchSize ?? 200;
|
|
42
43
|
this.flushInterval = config.flushIntervalMs ?? 5e3;
|
|
43
44
|
this.level = config.level;
|
|
44
|
-
this.requestTimeoutMs = config.requestTimeoutMs ??
|
|
45
|
+
this.requestTimeoutMs = config.requestTimeoutMs ?? 1e4;
|
|
45
46
|
this.buffer = new require_batch_buffer.BatchBuffer({
|
|
46
47
|
name: "AzureMonitorTransport",
|
|
47
48
|
batchSize: this.batchSize,
|
|
48
|
-
maxBufferSize: config.maxBufferSize ??
|
|
49
|
-
send: (entries) => this.sendEntries(entries)
|
|
49
|
+
maxBufferSize: config.maxBufferSize ?? 1e4,
|
|
50
|
+
send: (entries) => this.sendEntries(entries),
|
|
51
|
+
secrets: () => this.secretValues()
|
|
50
52
|
});
|
|
51
53
|
this.flushTimer = setInterval(() => {
|
|
52
54
|
this.flush().catch(() => {});
|
|
@@ -83,6 +85,14 @@ var AzureMonitorTransport = class {
|
|
|
83
85
|
Properties: require_safe_stringify.stringifyForLog(entry.data ?? {})
|
|
84
86
|
};
|
|
85
87
|
}
|
|
88
|
+
secretValues(token) {
|
|
89
|
+
return [
|
|
90
|
+
this.clientSecret,
|
|
91
|
+
this.accessToken ?? void 0,
|
|
92
|
+
token,
|
|
93
|
+
...require_secret_config.urlSecrets(this.endpoint)
|
|
94
|
+
];
|
|
95
|
+
}
|
|
86
96
|
async getAccessToken() {
|
|
87
97
|
if (this.accessToken && Date.now() < this.tokenExpiry) return this.accessToken;
|
|
88
98
|
if (!this.tenantId || !this.clientId || !this.clientSecret) {
|
|
@@ -107,7 +117,8 @@ var AzureMonitorTransport = class {
|
|
|
107
117
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
108
118
|
body,
|
|
109
119
|
timeoutMs: this.requestTimeoutMs,
|
|
110
|
-
label: "Azure token request"
|
|
120
|
+
label: "Azure token request",
|
|
121
|
+
secrets: () => this.secretValues()
|
|
111
122
|
});
|
|
112
123
|
const parsed = JSON.parse(res.body);
|
|
113
124
|
if (!parsed.access_token) return null;
|
|
@@ -122,12 +133,13 @@ var AzureMonitorTransport = class {
|
|
|
122
133
|
async sendEntries(entries) {
|
|
123
134
|
const token = await this.getAccessToken();
|
|
124
135
|
if (!token) throw new Error("AzureMonitorTransport: no access token available");
|
|
125
|
-
const
|
|
136
|
+
const records = entries.map((e) => this.toAzureRecord(e));
|
|
137
|
+
const body = require_safe_stringify.stringifyForLog(records);
|
|
126
138
|
let reqUrl;
|
|
127
139
|
try {
|
|
128
140
|
reqUrl = new URL(`dataCollectionRules/${encodeURIComponent(this.ruleId)}/streams/${encodeURIComponent(this.streamName)}?api-version=2023-01-01`, this.endpoint.endsWith("/") ? this.endpoint : `${this.endpoint}/`);
|
|
129
141
|
} catch (error) {
|
|
130
|
-
require_internal_log.internalError(`AzureMonitorTransport: invalid endpoint "${this.endpoint}"`, error);
|
|
142
|
+
require_internal_log.internalError(`AzureMonitorTransport: invalid endpoint "${require_secret_config.scrubSecrets(this.endpoint, require_secret_config.urlSecrets(this.endpoint))}"`, require_secret_config.scrubError(error, require_secret_config.urlSecrets(this.endpoint)));
|
|
131
143
|
return;
|
|
132
144
|
}
|
|
133
145
|
if (reqUrl.protocol !== "https:") {
|
|
@@ -142,16 +154,16 @@ var AzureMonitorTransport = class {
|
|
|
142
154
|
},
|
|
143
155
|
body,
|
|
144
156
|
timeoutMs: this.requestTimeoutMs,
|
|
145
|
-
label: "Azure Monitor API"
|
|
157
|
+
label: "Azure Monitor API",
|
|
158
|
+
secrets: () => this.secretValues(token)
|
|
146
159
|
});
|
|
147
160
|
}
|
|
148
161
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return AzureMonitorTransport;
|
|
155
|
-
}
|
|
162
|
+
Object.defineProperty(exports, "AzureMonitorTransport", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function() {
|
|
165
|
+
return AzureMonitorTransport;
|
|
166
|
+
}
|
|
156
167
|
});
|
|
157
|
-
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=azure-monitor.transport-CwbOLZHB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-monitor.transport-CwbOLZHB.js","names":["BatchBuffer","stringifyForLog","urlSecrets","httpRequest","scrubSecrets","scrubError"],"sources":["../src/transports/azure-monitor.transport.ts"],"sourcesContent":["/**\n * logixia — Azure Monitor / Application Insights transport\n *\n * Sends log entries to Azure Monitor via the Data Collection Rules (DCR) API\n * using the Logs Ingestion API (the modern replacement for the legacy HTTP\n * Data Collector API).\n *\n * Maps logixia levels to Application Insights severity levels:\n * verbose → 0, debug → 1, info → 1, warn → 2, error → 3, critical → 4\n *\n * @example\n * ```ts\n * import { AzureMonitorTransport } from 'logixia';\n *\n * const logger = createLogger({\n * transports: {\n * azure: new AzureMonitorTransport({\n * // Logs Ingestion API endpoint (from your DCR)\n * endpoint: 'https://<dce>.ingest.monitor.azure.com',\n * ruleId: 'dcr-xxxxxxxxxxxxxxxx',\n * streamName: 'Custom-LogixiaLogs',\n * // Client credentials (or managed identity via no-credential mode)\n * tenantId: process.env.AZURE_TENANT_ID,\n * clientId: process.env.AZURE_CLIENT_ID,\n * clientSecret: process.env.AZURE_CLIENT_SECRET,\n * }),\n * },\n * });\n * ```\n */\n\nimport type { IAsyncTransport, TransportLogEntry } from '../types/transport.types';\nimport { internalError, internalWarn } from '../utils/internal-log';\nimport { stringifyForLog } from '../utils/safe-stringify';\nimport {\n BatchBuffer,\n DEFAULT_MAX_BUFFER_SIZE,\n DEFAULT_REQUEST_TIMEOUT_MS,\n httpRequest,\n} from './batch-buffer';\nimport { protectSecrets, scrubError, scrubSecrets, urlSecrets } from './secret-config';\n\n/**\n * Azure AD tenant IDs are either a GUID or a verified domain (e.g. `contoso.onmicrosoft.com`).\n * This pattern is deliberately permissive on structure but strict on character\n * set — it rejects the breakout characters (`/`, `@`, `:`, `?`, `#`, whitespace)\n * that would let a hostile config smuggle a different host, path, or query into\n * the OAuth token URL.\n */\nconst AZURE_TENANT_RE = /^[a-z0-9][a-z0-9.-]{1,253}$/i;\n\nexport interface AzureMonitorTransportConfig {\n /** DCE (Data Collection Endpoint) URL, e.g. `https://<name>.ingest.monitor.azure.com`. */\n endpoint: string;\n /** Data Collection Rule immutable ID (from Azure portal). */\n ruleId: string;\n /** Stream name defined in the DCR, e.g. `'Custom-LogixiaLogs_CL'`. */\n streamName: string;\n /** Azure AD tenant ID for OAuth2 client-credentials flow. */\n tenantId?: string;\n /** Azure AD app (service principal) client ID. */\n clientId?: string;\n /** Azure AD app client secret. */\n clientSecret?: string;\n /** Number of entries to batch. @default 200 */\n batchSize?: number;\n /** Flush interval in ms. @default 5000 */\n flushIntervalMs?: number;\n /** Abort a request that has not finished after this many ms. @default 10000 */\n requestTimeoutMs?: number;\n /** Max buffered entries; the oldest are dropped past this. @default 10000 */\n maxBufferSize?: number;\n level?: string;\n}\n\nconst SEVERITY_MAP: Record<string, number> = {\n verbose: 0,\n trace: 0,\n debug: 1,\n info: 1,\n log: 1,\n warn: 2,\n warning: 2,\n error: 3,\n critical: 4,\n fatal: 4,\n};\n\n/**\n * Azure Monitor Logs Ingestion transport.\n */\nexport class AzureMonitorTransport implements IAsyncTransport {\n public readonly name = 'azure-monitor';\n public readonly batchSize: number;\n public readonly flushInterval: number;\n public readonly level: string | undefined;\n\n private readonly buffer: BatchBuffer<TransportLogEntry>;\n private readonly requestTimeoutMs: number;\n private flushTimer: NodeJS.Timeout | null = null;\n private accessToken: string | null = null;\n private tokenExpiry = 0;\n\n private readonly endpoint: string;\n private readonly ruleId: string;\n private readonly streamName: string;\n private readonly tenantId: string | undefined;\n private readonly clientId: string | undefined;\n private readonly clientSecret: string | undefined;\n\n constructor(config: AzureMonitorTransportConfig) {\n protectSecrets(this, ['clientSecret', 'accessToken']);\n this.endpoint = config.endpoint.replace(/\\/$/, '');\n this.ruleId = config.ruleId;\n this.streamName = config.streamName;\n this.tenantId = config.tenantId ?? process.env['AZURE_TENANT_ID'];\n this.clientId = config.clientId ?? process.env['AZURE_CLIENT_ID'];\n this.clientSecret = config.clientSecret ?? process.env['AZURE_CLIENT_SECRET'];\n this.batchSize = config.batchSize ?? 200;\n this.flushInterval = config.flushIntervalMs ?? 5000;\n this.level = config.level;\n this.requestTimeoutMs = config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n this.buffer = new BatchBuffer<TransportLogEntry>({\n name: 'AzureMonitorTransport',\n batchSize: this.batchSize,\n maxBufferSize: config.maxBufferSize ?? DEFAULT_MAX_BUFFER_SIZE,\n send: (entries) => this.sendEntries(entries),\n secrets: () => this.secretValues(),\n });\n\n this.flushTimer = setInterval(() => {\n this.flush().catch(() => {});\n }, this.flushInterval);\n if (this.flushTimer.unref) this.flushTimer.unref();\n }\n\n write(entry: TransportLogEntry): void {\n this.buffer.push(entry);\n this.buffer.flushIfFull();\n }\n\n flush(): Promise<void> {\n return this.buffer.flush();\n }\n\n /**\n * Flush remaining entries and stop the interval timer on shutdown. Without\n * this the manager's close() skipped the transport (close was undefined) and\n * buffered entries were lost on deploy. Waits for any in-flight send first.\n */\n async close(): Promise<void> {\n if (this.flushTimer) {\n clearInterval(this.flushTimer);\n this.flushTimer = null;\n }\n await this.buffer.close();\n }\n\n private toAzureRecord(entry: TransportLogEntry): Record<string, unknown> {\n return {\n TimeGenerated: entry.timestamp ?? new Date().toISOString(),\n SeverityLevel: SEVERITY_MAP[entry.level.toLowerCase()] ?? 1,\n Message: entry.message,\n AppName: entry.appName,\n Context: entry.context ?? '',\n TraceId: entry.traceId ?? '',\n Properties: stringifyForLog(entry.data ?? {}),\n };\n }\n\n private secretValues(token?: string): (string | undefined)[] {\n return [this.clientSecret, this.accessToken ?? undefined, token, ...urlSecrets(this.endpoint)];\n }\n\n private async getAccessToken(): Promise<string | null> {\n if (this.accessToken && Date.now() < this.tokenExpiry) return this.accessToken;\n\n if (!this.tenantId || !this.clientId || !this.clientSecret) {\n internalWarn(\n 'AzureMonitorTransport: missing credentials — set tenantId, clientId, clientSecret'\n );\n return null;\n }\n\n const body = new URLSearchParams({\n grant_type: 'client_credentials',\n client_id: this.clientId,\n client_secret: this.clientSecret,\n scope: 'https://monitor.azure.com/.default',\n }).toString();\n\n const tenantId = this.tenantId;\n if (!AZURE_TENANT_RE.test(tenantId)) {\n internalWarn(\n `AzureMonitorTransport: refusing to request token — tenantId \"${tenantId}\" is not a valid GUID or domain`\n );\n return null;\n }\n\n const reqUrl = new URL(\n `https://login.microsoftonline.com/${encodeURIComponent(tenantId)}/oauth2/v2.0/token`\n );\n try {\n const res = await httpRequest({\n url: reqUrl,\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n body,\n timeoutMs: this.requestTimeoutMs,\n label: 'Azure token request',\n secrets: () => this.secretValues(),\n });\n const parsed = JSON.parse(res.body) as { access_token?: string; expires_in?: number };\n if (!parsed.access_token) return null;\n this.accessToken = parsed.access_token;\n this.tokenExpiry = Date.now() + (parsed.expires_in ?? 3600) * 1000 - 60_000;\n return this.accessToken;\n } catch (err) {\n internalError('AzureMonitorTransport token request failed', err);\n return null;\n }\n }\n\n private async sendEntries(entries: TransportLogEntry[]): Promise<void> {\n const token = await this.getAccessToken();\n if (!token) throw new Error('AzureMonitorTransport: no access token available');\n\n const records = entries.map((e) => this.toAzureRecord(e));\n const body = stringifyForLog(records);\n let reqUrl: URL;\n try {\n // Build from the user-configured DCE endpoint; encodeURIComponent-ing the\n // ruleId/streamName stops a hostile config from smuggling extra path\n // segments or query params into the request.\n reqUrl = new URL(\n `dataCollectionRules/${encodeURIComponent(this.ruleId)}/streams/${encodeURIComponent(this.streamName)}?api-version=2023-01-01`,\n this.endpoint.endsWith('/') ? this.endpoint : `${this.endpoint}/`\n );\n } catch (error) {\n internalError(\n `AzureMonitorTransport: invalid endpoint \"${scrubSecrets(this.endpoint, urlSecrets(this.endpoint))}\"`,\n scrubError(error, urlSecrets(this.endpoint))\n );\n return;\n }\n if (reqUrl.protocol !== 'https:') {\n internalError(`AzureMonitorTransport: endpoint must use https (got ${reqUrl.protocol})`);\n return;\n }\n\n await httpRequest({\n url: reqUrl,\n headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },\n body,\n timeoutMs: this.requestTimeoutMs,\n label: 'Azure Monitor API',\n secrets: () => this.secretValues(token),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiDA,MAAM,kBAAkB;AA0BxB,MAAM,eAAuC;CAC3C,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,KAAK;CACL,MAAM;CACN,SAAS;CACT,OAAO;CACP,UAAU;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;GAC/D,OAAO;EACT;CACF;CAEA,MAAc,YAAY,SAA6C;EACrE,MAAM,QAAQ,MAAM,KAAK,eAAe;EACxC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,kDAAkD;EAE9E,MAAM,UAAU,QAAQ,KAAK,MAAM,KAAK,cAAc,CAAC,CAAC;EACxD,MAAM,OAAOF,uBAAAA,gBAAgB,OAAO;EACpC,IAAI;EACJ,IAAI;GAIF,SAAS,IAAI,IACX,uBAAuB,mBAAmB,KAAK,MAAM,EAAE,WAAW,mBAAmB,KAAK,UAAU,EAAE,0BACtG,KAAK,SAAS,SAAS,GAAG,IAAI,KAAK,WAAW,GAAG,KAAK,SAAS,EACjE;EACF,SAAS,OAAO;GACd,qBAAA,cACE,4CAA4CG,sBAAAA,aAAa,KAAK,UAAUF,sBAAAA,WAAW,KAAK,QAAQ,CAAC,EAAE,IACnGG,sBAAAA,WAAW,OAAOH,sBAAAA,WAAW,KAAK,QAAQ,CAAC,CAC7C;GACA;EACF;EACA,IAAI,OAAO,aAAa,UAAU;GAChC,qBAAA,cAAc,uDAAuD,OAAO,SAAS,EAAE;GACvF;EACF;EAEA,MAAMC,qBAAAA,YAAY;GAChB,KAAK;GACL,SAAS;IAAE,eAAe,UAAU;IAAS,gBAAgB;GAAmB;GAChF;GACA,WAAW,KAAK;GAChB,OAAO;GACP,eAAe,KAAK,aAAa,KAAK;EACxC,CAAC;CACH;AACF"}
|
package/dist/{azure-monitor.transport-D7Da4RAb.d.mts → azure-monitor.transport-DV03Z5P4.d.ts}
RENAMED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { p as TransportLogEntry, s as IAsyncTransport } from "./transport.types-
|
|
2
|
-
|
|
3
|
-
//#region src/transports/azure-monitor.transport.d.ts
|
|
4
|
-
|
|
1
|
+
import { p as TransportLogEntry, s as IAsyncTransport } from "./transport.types-BJVL1QQl.js";
|
|
5
2
|
interface AzureMonitorTransportConfig {
|
|
6
3
|
/** DCE (Data Collection Endpoint) URL, e.g. `https://<name>.ingest.monitor.azure.com`. */
|
|
7
4
|
endpoint: string;
|
|
@@ -54,9 +51,9 @@ declare class AzureMonitorTransport implements IAsyncTransport {
|
|
|
54
51
|
*/
|
|
55
52
|
close(): Promise<void>;
|
|
56
53
|
private toAzureRecord;
|
|
54
|
+
private secretValues;
|
|
57
55
|
private getAccessToken;
|
|
58
56
|
private sendEntries;
|
|
59
57
|
}
|
|
60
|
-
//#endregion
|
|
61
58
|
export { AzureMonitorTransportConfig as n, AzureMonitorTransport as t };
|
|
62
|
-
//# sourceMappingURL=azure-monitor.transport-
|
|
59
|
+
//# sourceMappingURL=azure-monitor.transport-DV03Z5P4.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-monitor.transport-DV03Z5P4.d.ts","names":[],"sources":["../src/transports/azure-monitor.transport.ts"],"mappings":";UAmDiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;;;;;cAmBW,iCAAiC;WAC5B;WACA;WACA;WACA;mBAEC;mBACA;UACT;UACA;UACA;mBAES;mBACA;mBACA;mBACA;mBACA;mBACA;EAEL,YAAA,QAAQ;EA0BpB,MAAM,OAAO;EAKb,SAAS;;;;;;EASH,SAAS;UAQP;UAYA;UAIM;UAgDA"}
|
package/dist/azure.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./transport
|
|
2
|
-
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-D7Da4RAb.mjs";
|
|
1
|
+
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-C7kYyZUW.mjs";
|
|
3
2
|
export { AzureMonitorTransport, AzureMonitorTransportConfig };
|
package/dist/azure.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./transport
|
|
2
|
-
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-Cn_3Usvu.js";
|
|
1
|
+
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-DV03Z5P4.js";
|
|
3
2
|
export { AzureMonitorTransport, AzureMonitorTransportConfig };
|
package/dist/azure.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
require(
|
|
3
|
-
|
|
4
|
-
const require_azure_monitor_transport = require('./azure-monitor.transport-CrvfHd9C.js');
|
|
5
|
-
|
|
6
|
-
exports.AzureMonitorTransport = require_azure_monitor_transport.AzureMonitorTransport;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_azure_monitor_transport = require("./azure-monitor.transport-CwbOLZHB.js");
|
|
3
|
+
exports.AzureMonitorTransport = require_azure_monitor_transport.AzureMonitorTransport;
|
package/dist/azure.mjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import "./safe-stringify-DJ66tW5I.mjs";
|
|
3
|
-
import "./batch-buffer-PGvSgbmd.mjs";
|
|
4
|
-
import { t as AzureMonitorTransport } from "./azure-monitor.transport-CHnjVRF-.mjs";
|
|
5
|
-
|
|
6
|
-
export { AzureMonitorTransport };
|
|
1
|
+
export { t as AzureMonitorTransport } from "./azure-monitor.transport-BPbgjATu.mjs";
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { r as internalWarn, t as internalError } from "./internal-log-
|
|
1
|
+
import { r as internalWarn, t as internalError } from "./internal-log-uCSd1PMc.mjs";
|
|
2
|
+
import { a as scrubbing, r as scrubError } from "./secret-config-BegMLkYl.mjs";
|
|
2
3
|
import * as http from "node:http";
|
|
3
4
|
import * as https from "node:https";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
// src/transports/batch-buffer.ts
|
|
6
|
+
/**
|
|
7
|
+
* Shared batching core for the network transports (OTLP, CloudWatch, GCP, Azure).
|
|
8
|
+
*
|
|
9
|
+
* - one send in flight at a time; flush() and close() join it instead of
|
|
10
|
+
* racing it, so close() cannot return while a request is still on the wire
|
|
11
|
+
* - a failed batch goes back to the front in its original order
|
|
12
|
+
* - 4xx responses other than 429 drop the batch with a warning instead of
|
|
13
|
+
* retrying a request the server will never accept
|
|
14
|
+
* - the buffer is capped; when full the oldest entries are dropped
|
|
15
|
+
*/
|
|
6
16
|
const DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
|
|
7
17
|
const DEFAULT_MAX_BUFFER_SIZE = 1e4;
|
|
8
18
|
const WARN_INTERVAL_MS = 1e4;
|
|
@@ -22,6 +32,9 @@ function isPermanentHttpError(err) {
|
|
|
22
32
|
}
|
|
23
33
|
/** One request with a hard timeout. Rejects with HttpError on any non-2xx status. */
|
|
24
34
|
function httpRequest(opts) {
|
|
35
|
+
return sendRequest(opts).catch(scrubbing(opts.secrets ?? (() => [])));
|
|
36
|
+
}
|
|
37
|
+
function sendRequest(opts) {
|
|
25
38
|
const { url, method = "POST", headers = {}, body, timeoutMs, label } = opts;
|
|
26
39
|
const transport = url.protocol === "http:" ? http : https;
|
|
27
40
|
return new Promise((resolve, reject) => {
|
|
@@ -99,6 +112,8 @@ var BatchBuffer = class {
|
|
|
99
112
|
await this.opts.send(batch);
|
|
100
113
|
this.failures = 0;
|
|
101
114
|
} catch (err) {
|
|
115
|
+
var _this$opts$secrets, _this$opts;
|
|
116
|
+
scrubError(err, ((_this$opts$secrets = (_this$opts = this.opts).secrets) === null || _this$opts$secrets === void 0 ? void 0 : _this$opts$secrets.call(_this$opts)) ?? []);
|
|
102
117
|
if (!(this.opts.shouldRetry ? this.opts.shouldRetry(err) : !isPermanentHttpError(err))) {
|
|
103
118
|
internalWarn(`${this.opts.name}: dropping ${batch.length} entr${batch.length === 1 ? "y" : "ies"} the server rejected (${err instanceof Error ? err.message : String(err)})`);
|
|
104
119
|
continue;
|
|
@@ -113,7 +128,7 @@ var BatchBuffer = class {
|
|
|
113
128
|
}
|
|
114
129
|
}
|
|
115
130
|
enforceCap() {
|
|
116
|
-
const max = this.opts.maxBufferSize ??
|
|
131
|
+
const max = this.opts.maxBufferSize ?? 1e4;
|
|
117
132
|
const excess = this.items.length - max;
|
|
118
133
|
if (excess <= 0) return;
|
|
119
134
|
this.items.splice(0, excess);
|
|
@@ -126,7 +141,6 @@ var BatchBuffer = class {
|
|
|
126
141
|
}
|
|
127
142
|
}
|
|
128
143
|
};
|
|
129
|
-
|
|
130
|
-
//#endregion
|
|
131
144
|
export { httpRequest as a, HttpError as i, DEFAULT_MAX_BUFFER_SIZE as n, isPermanentHttpError as o, DEFAULT_REQUEST_TIMEOUT_MS as r, BatchBuffer as t };
|
|
132
|
-
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=batch-buffer-0fgLmIPn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-buffer-0fgLmIPn.mjs","names":[],"sources":["../src/transports/batch-buffer.ts"],"sourcesContent":["/**\n * Shared batching core for the network transports (OTLP, CloudWatch, GCP, Azure).\n *\n * - one send in flight at a time; flush() and close() join it instead of\n * racing it, so close() cannot return while a request is still on the wire\n * - a failed batch goes back to the front in its original order\n * - 4xx responses other than 429 drop the batch with a warning instead of\n * retrying a request the server will never accept\n * - the buffer is capped; when full the oldest entries are dropped\n */\n\nimport * as http from 'node:http';\nimport * as https from 'node:https';\n\nimport { internalError, internalWarn } from '../utils/internal-log';\nimport { scrubbing, scrubError } from './secret-config';\n\nexport const DEFAULT_REQUEST_TIMEOUT_MS = 10_000;\nexport const DEFAULT_MAX_BUFFER_SIZE = 10_000;\nconst WARN_INTERVAL_MS = 10_000;\nconst MAX_ERROR_BODY = 500;\nconst MAX_BACKOFF_MS = 30_000;\n\nexport class HttpError extends Error {\n constructor(\n public readonly status: number,\n public readonly body: string,\n label: string\n ) {\n const detail = body ? `: ${body.slice(0, MAX_ERROR_BODY)}` : '';\n super(`${label} returned HTTP ${status}${detail}`);\n this.name = 'HttpError';\n }\n}\n\nexport function isPermanentHttpError(err: unknown): boolean {\n return err instanceof HttpError && err.status >= 400 && err.status < 500 && err.status !== 429;\n}\n\nexport interface HttpRequestOptions {\n url: URL;\n method?: string;\n headers?: Record<string, string>;\n body?: string;\n timeoutMs: number;\n label: string;\n /** Secret values to scrub from any error this request raises. URL userinfo is always scrubbed. */\n secrets?: () => (string | undefined)[];\n}\n\nexport interface HttpResult {\n status: number;\n body: string;\n}\n\n/** One request with a hard timeout. Rejects with HttpError on any non-2xx status. */\nexport function httpRequest(opts: HttpRequestOptions): Promise<HttpResult> {\n return sendRequest(opts).catch(scrubbing(opts.secrets ?? (() => [])));\n}\n\nfunction sendRequest(opts: HttpRequestOptions): Promise<HttpResult> {\n const { url, method = 'POST', headers = {}, body, timeoutMs, label } = opts;\n const transport = url.protocol === 'http:' ? http : https;\n return new Promise<HttpResult>((resolve, reject) => {\n const req = transport.request(\n {\n protocol: url.protocol,\n hostname: url.hostname,\n port: url.port || undefined,\n path: `${url.pathname}${url.search}`,\n method,\n headers:\n body === undefined ? headers : { ...headers, 'Content-Length': Buffer.byteLength(body) },\n },\n (res) => {\n let raw = '';\n res.on('data', (c: Buffer) => (raw += c.toString()));\n res.on('end', () => {\n const status = res.statusCode ?? 0;\n if (status >= 200 && status < 300) resolve({ status, body: raw });\n else reject(new HttpError(status, raw, label));\n });\n res.on('error', reject);\n }\n );\n req.setTimeout(timeoutMs, () => {\n req.destroy(new Error(`${label} timed out after ${timeoutMs}ms`));\n });\n req.on('error', reject);\n if (body !== undefined) req.write(body);\n req.end();\n });\n}\n\nexport interface BatchBufferOptions<T> {\n name: string;\n batchSize: number;\n maxBufferSize?: number;\n send: (items: T[]) => Promise<void>;\n /** Secret values to scrub from send errors before they are stored or logged. */\n secrets?: () => (string | undefined)[];\n /** Overrides the default drop-on-4xx rule. Return true to keep and retry the batch. */\n shouldRetry?: (err: unknown) => boolean;\n}\n\nexport class BatchBuffer<T> {\n private items: T[] = [];\n private inFlight: Promise<void> | undefined;\n private dropped = 0;\n private lastDropWarn = 0;\n private failures = 0;\n private retryAfter = 0;\n\n constructor(private readonly opts: BatchBufferOptions<T>) {}\n\n get length(): number {\n return this.items.length;\n }\n\n get batchSize(): number {\n return this.opts.batchSize;\n }\n\n push(item: T): void {\n this.items.push(item);\n this.enforceCap();\n }\n\n /** Threshold flush for write(): skipped while a send is running or the endpoint is backing off. */\n flushIfFull(): void {\n if (this.items.length < this.opts.batchSize || this.inFlight || Date.now() < this.retryAfter) {\n return;\n }\n this.flush().catch(() => {});\n }\n\n flush(): Promise<void> {\n if (!this.inFlight) {\n this.inFlight = this.drain().finally(() => {\n this.inFlight = undefined;\n });\n }\n return this.inFlight;\n }\n\n /** Flush up to `attempts` times, then report whatever is still undelivered. */\n async close(attempts = 3): Promise<void> {\n await this.inFlight;\n for (let i = 0; i < attempts && this.items.length > 0; i += 1) {\n await this.flush();\n }\n if (this.items.length > 0) {\n internalError(\n `${this.opts.name} closing with ${this.items.length} undelivered entr${this.items.length === 1 ? 'y' : 'ies'}`\n );\n }\n }\n\n private async drain(): Promise<void> {\n while (this.items.length > 0) {\n const batch = this.items.splice(0, this.opts.batchSize);\n try {\n await this.opts.send(batch);\n this.failures = 0;\n } catch (err) {\n scrubError(err, this.opts.secrets?.() ?? []);\n const retry = this.opts.shouldRetry\n ? this.opts.shouldRetry(err)\n : !isPermanentHttpError(err);\n if (!retry) {\n internalWarn(\n `${this.opts.name}: dropping ${batch.length} entr${batch.length === 1 ? 'y' : 'ies'} the server rejected (${err instanceof Error ? err.message : String(err)})`\n );\n continue;\n }\n internalError(`${this.opts.name} flush error`, err);\n this.items.unshift(...batch);\n this.enforceCap();\n this.failures += 1;\n this.retryAfter = Date.now() + Math.min(MAX_BACKOFF_MS, 1000 * 2 ** (this.failures - 1));\n return;\n }\n }\n }\n\n private enforceCap(): void {\n const max = this.opts.maxBufferSize ?? DEFAULT_MAX_BUFFER_SIZE;\n const excess = this.items.length - max;\n if (excess <= 0) return;\n this.items.splice(0, excess);\n this.dropped += excess;\n const now = Date.now();\n if (now - this.lastDropWarn >= WARN_INTERVAL_MS) {\n internalWarn(\n `${this.opts.name}: buffer full (${max}), dropped ${this.dropped} oldest entr${this.dropped === 1 ? 'y' : 'ies'}`\n );\n this.dropped = 0;\n this.lastDropWarn = now;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,6BAA6B;AAC1C,MAAa,0BAA0B;AACvC,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAEvB,IAAa,YAAb,cAA+B,MAAM;CACnC,YACE,QACA,MACA,OACA;EACA,MAAM,SAAS,OAAO,KAAK,KAAK,MAAM,GAAG,cAAc,MAAM;EAC7D,MAAM,GAAG,MAAM,iBAAiB,SAAS,QAAQ;EALjC,KAAA,SAAA;EACA,KAAA,OAAA;EAKhB,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,qBAAqB,KAAuB;CAC1D,OAAO,eAAe,aAAa,IAAI,UAAU,OAAO,IAAI,SAAS,OAAO,IAAI,WAAW;AAC7F;;AAmBA,SAAgB,YAAY,MAA+C;CACzE,OAAO,YAAY,IAAI,CAAC,CAAC,MAAM,UAAU,KAAK,kBAAkB,CAAC,EAAE,CAAC;AACtE;AAEA,SAAS,YAAY,MAA+C;CAClE,MAAM,EAAE,KAAK,SAAS,QAAQ,UAAU,CAAC,GAAG,MAAM,WAAW,UAAU;CACvE,MAAM,YAAY,IAAI,aAAa,UAAU,OAAO;CACpD,OAAO,IAAI,SAAqB,SAAS,WAAW;EAClD,MAAM,MAAM,UAAU,QACpB;GACE,UAAU,IAAI;GACd,UAAU,IAAI;GACd,MAAM,IAAI,QAAQ,KAAA;GAClB,MAAM,GAAG,IAAI,WAAW,IAAI;GAC5B;GACA,SACE,SAAS,KAAA,IAAY,UAAU;IAAE,GAAG;IAAS,kBAAkB,OAAO,WAAW,IAAI;GAAE;EAC3F,IACC,QAAQ;GACP,IAAI,MAAM;GACV,IAAI,GAAG,SAAS,MAAe,OAAO,EAAE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AG,KAAK,KAAK,KAAK,iBAAiB,IAAI,aAAa,KAAK,QAAQ,cAAc,KAAK,YAAY,IAAI,MAAM,OAC5G;GACA,KAAK,UAAU;GACf,KAAK,eAAe;EACtB;CACF;AACF"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_internal_log = require(
|
|
1
|
+
const require_secret_config = require("./secret-config-CBZBs0p1.js");
|
|
2
|
+
const require_internal_log = require("./internal-log-b0Vp4qrB.js");
|
|
3
3
|
let node_http = require("node:http");
|
|
4
|
-
node_http =
|
|
4
|
+
node_http = require_secret_config.__toESM(node_http);
|
|
5
5
|
let node_https = require("node:https");
|
|
6
|
-
node_https =
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
node_https = require_secret_config.__toESM(node_https);
|
|
7
|
+
// src/transports/batch-buffer.ts
|
|
8
|
+
/**
|
|
9
|
+
* Shared batching core for the network transports (OTLP, CloudWatch, GCP, Azure).
|
|
10
|
+
*
|
|
11
|
+
* - one send in flight at a time; flush() and close() join it instead of
|
|
12
|
+
* racing it, so close() cannot return while a request is still on the wire
|
|
13
|
+
* - a failed batch goes back to the front in its original order
|
|
14
|
+
* - 4xx responses other than 429 drop the batch with a warning instead of
|
|
15
|
+
* retrying a request the server will never accept
|
|
16
|
+
* - the buffer is capped; when full the oldest entries are dropped
|
|
17
|
+
*/
|
|
9
18
|
const DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
|
|
10
19
|
const DEFAULT_MAX_BUFFER_SIZE = 1e4;
|
|
11
20
|
const WARN_INTERVAL_MS = 1e4;
|
|
@@ -25,6 +34,9 @@ function isPermanentHttpError(err) {
|
|
|
25
34
|
}
|
|
26
35
|
/** One request with a hard timeout. Rejects with HttpError on any non-2xx status. */
|
|
27
36
|
function httpRequest(opts) {
|
|
37
|
+
return sendRequest(opts).catch(require_secret_config.scrubbing(opts.secrets ?? (() => [])));
|
|
38
|
+
}
|
|
39
|
+
function sendRequest(opts) {
|
|
28
40
|
const { url, method = "POST", headers = {}, body, timeoutMs, label } = opts;
|
|
29
41
|
const transport = url.protocol === "http:" ? node_http : node_https;
|
|
30
42
|
return new Promise((resolve, reject) => {
|
|
@@ -102,6 +114,8 @@ var BatchBuffer = class {
|
|
|
102
114
|
await this.opts.send(batch);
|
|
103
115
|
this.failures = 0;
|
|
104
116
|
} catch (err) {
|
|
117
|
+
var _this$opts$secrets, _this$opts;
|
|
118
|
+
require_secret_config.scrubError(err, ((_this$opts$secrets = (_this$opts = this.opts).secrets) === null || _this$opts$secrets === void 0 ? void 0 : _this$opts$secrets.call(_this$opts)) ?? []);
|
|
105
119
|
if (!(this.opts.shouldRetry ? this.opts.shouldRetry(err) : !isPermanentHttpError(err))) {
|
|
106
120
|
require_internal_log.internalWarn(`${this.opts.name}: dropping ${batch.length} entr${batch.length === 1 ? "y" : "ies"} the server rejected (${err instanceof Error ? err.message : String(err)})`);
|
|
107
121
|
continue;
|
|
@@ -116,7 +130,7 @@ var BatchBuffer = class {
|
|
|
116
130
|
}
|
|
117
131
|
}
|
|
118
132
|
enforceCap() {
|
|
119
|
-
const max = this.opts.maxBufferSize ??
|
|
133
|
+
const max = this.opts.maxBufferSize ?? 1e4;
|
|
120
134
|
const excess = this.items.length - max;
|
|
121
135
|
if (excess <= 0) return;
|
|
122
136
|
this.items.splice(0, excess);
|
|
@@ -129,42 +143,41 @@ var BatchBuffer = class {
|
|
|
129
143
|
}
|
|
130
144
|
}
|
|
131
145
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return BatchBuffer;
|
|
138
|
-
}
|
|
146
|
+
Object.defineProperty(exports, "BatchBuffer", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function() {
|
|
149
|
+
return BatchBuffer;
|
|
150
|
+
}
|
|
139
151
|
});
|
|
140
|
-
Object.defineProperty(exports,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
152
|
+
Object.defineProperty(exports, "DEFAULT_MAX_BUFFER_SIZE", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function() {
|
|
155
|
+
return DEFAULT_MAX_BUFFER_SIZE;
|
|
156
|
+
}
|
|
145
157
|
});
|
|
146
|
-
Object.defineProperty(exports,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
Object.defineProperty(exports, "DEFAULT_REQUEST_TIMEOUT_MS", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: function() {
|
|
161
|
+
return DEFAULT_REQUEST_TIMEOUT_MS;
|
|
162
|
+
}
|
|
151
163
|
});
|
|
152
|
-
Object.defineProperty(exports,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
Object.defineProperty(exports, "HttpError", {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function() {
|
|
167
|
+
return HttpError;
|
|
168
|
+
}
|
|
157
169
|
});
|
|
158
|
-
Object.defineProperty(exports,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
170
|
+
Object.defineProperty(exports, "httpRequest", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function() {
|
|
173
|
+
return httpRequest;
|
|
174
|
+
}
|
|
163
175
|
});
|
|
164
|
-
Object.defineProperty(exports,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
176
|
+
Object.defineProperty(exports, "isPermanentHttpError", {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function() {
|
|
179
|
+
return isPermanentHttpError;
|
|
180
|
+
}
|
|
169
181
|
});
|
|
170
|
-
|
|
182
|
+
|
|
183
|
+
//# sourceMappingURL=batch-buffer-DT4gdXmf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-buffer-DT4gdXmf.js","names":["scrubbing","http","https"],"sources":["../src/transports/batch-buffer.ts"],"sourcesContent":["/**\n * Shared batching core for the network transports (OTLP, CloudWatch, GCP, Azure).\n *\n * - one send in flight at a time; flush() and close() join it instead of\n * racing it, so close() cannot return while a request is still on the wire\n * - a failed batch goes back to the front in its original order\n * - 4xx responses other than 429 drop the batch with a warning instead of\n * retrying a request the server will never accept\n * - the buffer is capped; when full the oldest entries are dropped\n */\n\nimport * as http from 'node:http';\nimport * as https from 'node:https';\n\nimport { internalError, internalWarn } from '../utils/internal-log';\nimport { scrubbing, scrubError } from './secret-config';\n\nexport const DEFAULT_REQUEST_TIMEOUT_MS = 10_000;\nexport const DEFAULT_MAX_BUFFER_SIZE = 10_000;\nconst WARN_INTERVAL_MS = 10_000;\nconst MAX_ERROR_BODY = 500;\nconst MAX_BACKOFF_MS = 30_000;\n\nexport class HttpError extends Error {\n constructor(\n public readonly status: number,\n public readonly body: string,\n label: string\n ) {\n const detail = body ? `: ${body.slice(0, MAX_ERROR_BODY)}` : '';\n super(`${label} returned HTTP ${status}${detail}`);\n this.name = 'HttpError';\n }\n}\n\nexport function isPermanentHttpError(err: unknown): boolean {\n return err instanceof HttpError && err.status >= 400 && err.status < 500 && err.status !== 429;\n}\n\nexport interface HttpRequestOptions {\n url: URL;\n method?: string;\n headers?: Record<string, string>;\n body?: string;\n timeoutMs: number;\n label: string;\n /** Secret values to scrub from any error this request raises. URL userinfo is always scrubbed. */\n secrets?: () => (string | undefined)[];\n}\n\nexport interface HttpResult {\n status: number;\n body: string;\n}\n\n/** One request with a hard timeout. Rejects with HttpError on any non-2xx status. */\nexport function httpRequest(opts: HttpRequestOptions): Promise<HttpResult> {\n return sendRequest(opts).catch(scrubbing(opts.secrets ?? (() => [])));\n}\n\nfunction sendRequest(opts: HttpRequestOptions): Promise<HttpResult> {\n const { url, method = 'POST', headers = {}, body, timeoutMs, label } = opts;\n const transport = url.protocol === 'http:' ? http : https;\n return new Promise<HttpResult>((resolve, reject) => {\n const req = transport.request(\n {\n protocol: url.protocol,\n hostname: url.hostname,\n port: url.port || undefined,\n path: `${url.pathname}${url.search}`,\n method,\n headers:\n body === undefined ? headers : { ...headers, 'Content-Length': Buffer.byteLength(body) },\n },\n (res) => {\n let raw = '';\n res.on('data', (c: Buffer) => (raw += c.toString()));\n res.on('end', () => {\n const status = res.statusCode ?? 0;\n if (status >= 200 && status < 300) resolve({ status, body: raw });\n else reject(new HttpError(status, raw, label));\n });\n res.on('error', reject);\n }\n );\n req.setTimeout(timeoutMs, () => {\n req.destroy(new Error(`${label} timed out after ${timeoutMs}ms`));\n });\n req.on('error', reject);\n if (body !== undefined) req.write(body);\n req.end();\n });\n}\n\nexport interface BatchBufferOptions<T> {\n name: string;\n batchSize: number;\n maxBufferSize?: number;\n send: (items: T[]) => Promise<void>;\n /** Secret values to scrub from send errors before they are stored or logged. */\n secrets?: () => (string | undefined)[];\n /** Overrides the default drop-on-4xx rule. Return true to keep and retry the batch. */\n shouldRetry?: (err: unknown) => boolean;\n}\n\nexport class BatchBuffer<T> {\n private items: T[] = [];\n private inFlight: Promise<void> | undefined;\n private dropped = 0;\n private lastDropWarn = 0;\n private failures = 0;\n private retryAfter = 0;\n\n constructor(private readonly opts: BatchBufferOptions<T>) {}\n\n get length(): number {\n return this.items.length;\n }\n\n get batchSize(): number {\n return this.opts.batchSize;\n }\n\n push(item: T): void {\n this.items.push(item);\n this.enforceCap();\n }\n\n /** Threshold flush for write(): skipped while a send is running or the endpoint is backing off. */\n flushIfFull(): void {\n if (this.items.length < this.opts.batchSize || this.inFlight || Date.now() < this.retryAfter) {\n return;\n }\n this.flush().catch(() => {});\n }\n\n flush(): Promise<void> {\n if (!this.inFlight) {\n this.inFlight = this.drain().finally(() => {\n this.inFlight = undefined;\n });\n }\n return this.inFlight;\n }\n\n /** Flush up to `attempts` times, then report whatever is still undelivered. */\n async close(attempts = 3): Promise<void> {\n await this.inFlight;\n for (let i = 0; i < attempts && this.items.length > 0; i += 1) {\n await this.flush();\n }\n if (this.items.length > 0) {\n internalError(\n `${this.opts.name} closing with ${this.items.length} undelivered entr${this.items.length === 1 ? 'y' : 'ies'}`\n );\n }\n }\n\n private async drain(): Promise<void> {\n while (this.items.length > 0) {\n const batch = this.items.splice(0, this.opts.batchSize);\n try {\n await this.opts.send(batch);\n this.failures = 0;\n } catch (err) {\n scrubError(err, this.opts.secrets?.() ?? []);\n const retry = this.opts.shouldRetry\n ? this.opts.shouldRetry(err)\n : !isPermanentHttpError(err);\n if (!retry) {\n internalWarn(\n `${this.opts.name}: dropping ${batch.length} entr${batch.length === 1 ? 'y' : 'ies'} the server rejected (${err instanceof Error ? err.message : String(err)})`\n );\n continue;\n }\n internalError(`${this.opts.name} flush error`, err);\n this.items.unshift(...batch);\n this.enforceCap();\n this.failures += 1;\n this.retryAfter = Date.now() + Math.min(MAX_BACKOFF_MS, 1000 * 2 ** (this.failures - 1));\n return;\n }\n }\n }\n\n private enforceCap(): void {\n const max = this.opts.maxBufferSize ?? DEFAULT_MAX_BUFFER_SIZE;\n const excess = this.items.length - max;\n if (excess <= 0) return;\n this.items.splice(0, excess);\n this.dropped += excess;\n const now = Date.now();\n if (now - this.lastDropWarn >= WARN_INTERVAL_MS) {\n internalWarn(\n `${this.opts.name}: buffer full (${max}), dropped ${this.dropped} oldest entr${this.dropped === 1 ? 'y' : 'ies'}`\n );\n this.dropped = 0;\n this.lastDropWarn = now;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,6BAA6B;AAC1C,MAAa,0BAA0B;AACvC,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAEvB,IAAa,YAAb,cAA+B,MAAM;CACnC,YACE,QACA,MACA,OACA;EACA,MAAM,SAAS,OAAO,KAAK,KAAK,MAAM,GAAG,cAAc,MAAM;EAC7D,MAAM,GAAG,MAAM,iBAAiB,SAAS,QAAQ;EALjC,KAAA,SAAA;EACA,KAAA,OAAA;EAKhB,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,qBAAqB,KAAuB;CAC1D,OAAO,eAAe,aAAa,IAAI,UAAU,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AC,qBAAqB,GAAG,IACjB;KACV,qBAAA,aACE,GAAG,KAAK,KAAK,KAAK,aAAa,MAAM,OAAO,OAAO,MAAM,WAAW,IAAI,MAAM,MAAM,wBAAwB,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,EAAE,EAC/J;KACA;IACF;IACA,qBAAA,cAAc,GAAG,KAAK,KAAK,KAAK,eAAe,GAAG;IAClD,KAAK,MAAM,QAAQ,GAAG,KAAK;IAC3B,KAAK,WAAW;IAChB,KAAK,YAAY;IACjB,KAAK,aAAa,KAAK,IAAI,IAAI,KAAK,IAAI,gBAAgB,MAAO,MAAM,KAAK,WAAW,EAAE;IACvF;GACF;EACF;CACF;CAEA,aAA2B;EACzB,MAAM,MAAM,KAAK,KAAK,iBAAA;EACtB,MAAM,SAAS,KAAK,MAAM,SAAS;EACnC,IAAI,UAAU,GAAG;EACjB,KAAK,MAAM,OAAO,GAAG,MAAM;EAC3B,KAAK,WAAW;EAChB,MAAM,MAAM,KAAK,IAAI;EACrB,IAAI,MAAM,KAAK,gBAAgB,kBAAkB;GAC/C,qBAAA,aACE,GAAG,KAAK,KAAK,KAAK,iBAAiB,IAAI,aAAa,KAAK,QAAQ,cAAc,KAAK,YAAY,IAAI,MAAM,OAC5G;GACA,KAAK,UAAU;GACf,KAAK,eAAe;EACtB;CACF;AACF"}
|
package/dist/browser.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/utils/otel.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* logixia — OpenTelemetry auto trace-log correlation
|
|
4
3
|
*
|
|
@@ -75,7 +74,7 @@ interface OtelBridgeOptions {
|
|
|
75
74
|
* - No active span exists (root context)
|
|
76
75
|
* - The span context is invalid (all-zeros)
|
|
77
76
|
*/
|
|
78
|
-
declare function getActiveOtelContext(opts?: OtelBridgeOptions): OtelSpanContext | undefined;
|
|
77
|
+
export declare function getActiveOtelContext(opts?: OtelBridgeOptions): OtelSpanContext | undefined;
|
|
79
78
|
/**
|
|
80
79
|
* Returns a metadata object with OTel context fields ready to merge into a log call,
|
|
81
80
|
* using the configured field names.
|
|
@@ -90,7 +89,7 @@ declare function getActiveOtelContext(opts?: OtelBridgeOptions): OtelSpanContext
|
|
|
90
89
|
* });
|
|
91
90
|
* ```
|
|
92
91
|
*/
|
|
93
|
-
declare function getOtelMetaFields(opts?: OtelBridgeOptions): Record<string, unknown>;
|
|
92
|
+
export declare function getOtelMetaFields(opts?: OtelBridgeOptions): Record<string, unknown>;
|
|
94
93
|
/**
|
|
95
94
|
* Initialise the global OTel bridge.
|
|
96
95
|
*
|
|
@@ -104,13 +103,11 @@ declare function getOtelMetaFields(opts?: OtelBridgeOptions): Record<string, unk
|
|
|
104
103
|
* initOtelBridge();
|
|
105
104
|
* ```
|
|
106
105
|
*/
|
|
107
|
-
declare function initOtelBridge(opts?: OtelBridgeOptions): void;
|
|
106
|
+
export declare function initOtelBridge(opts?: OtelBridgeOptions): void;
|
|
108
107
|
/**
|
|
109
108
|
* Disable the OTel bridge (useful for tests).
|
|
110
109
|
*/
|
|
111
|
-
declare function disableOtelBridge(): void;
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/utils/typed-logger.d.ts
|
|
110
|
+
export declare function disableOtelBridge(): void;
|
|
114
111
|
/**
|
|
115
112
|
* logixia — TypeScript typed log fields
|
|
116
113
|
*
|
|
@@ -159,7 +156,7 @@ interface LogFieldDef {
|
|
|
159
156
|
/** Custom validator — return a string to emit it as a warning message. */
|
|
160
157
|
validate?: (value: unknown) => string | undefined;
|
|
161
158
|
}
|
|
162
|
-
type LogSchema<TFields extends Record<string, unknown>> = { [K in keyof TFields]: LogFieldDef };
|
|
159
|
+
type LogSchema<TFields extends Record<string, unknown>> = { [K in keyof TFields]: LogFieldDef; };
|
|
163
160
|
interface CompiledSchema<TFields extends Record<string, unknown>> {
|
|
164
161
|
readonly fields: LogSchema<TFields>;
|
|
165
162
|
/**
|
|
@@ -175,7 +172,7 @@ interface CompiledSchema<TFields extends Record<string, unknown>> {
|
|
|
175
172
|
* Call this once at module initialisation and pass it to `createTypedLogger`.
|
|
176
173
|
* In development, every log call is validated against the schema.
|
|
177
174
|
*/
|
|
178
|
-
declare function defineLogSchema<TFields extends Record<string, unknown>>(fields: LogSchema<TFields>): CompiledSchema<TFields>;
|
|
175
|
+
export declare function defineLogSchema<TFields extends Record<string, unknown>>(fields: LogSchema<TFields>): CompiledSchema<TFields>;
|
|
179
176
|
/** IBaseLogger-compatible subset used by TypedLogger */
|
|
180
177
|
interface LoggerLike {
|
|
181
178
|
error(message: string | Error, data?: Record<string, unknown>): Promise<void>;
|
|
@@ -208,9 +205,7 @@ interface TypedLogger<TFields extends Record<string, unknown>> {
|
|
|
208
205
|
* @param logger Any object that implements `IBaseLogger` (e.g. the result of `createLogger()`)
|
|
209
206
|
* @param schema Optional schema for dev-time validation. Created with `defineLogSchema()`.
|
|
210
207
|
*/
|
|
211
|
-
declare function createTypedLogger<TFields extends Record<string, unknown>>(logger: LoggerLike, schema?: CompiledSchema<TFields>): TypedLogger<TFields>;
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/browser.d.ts
|
|
208
|
+
export declare function createTypedLogger<TFields extends Record<string, unknown>>(logger: LoggerLike, schema?: CompiledSchema<TFields>): TypedLogger<TFields>;
|
|
214
209
|
/**
|
|
215
210
|
* logixia — Browser / Edge Runtime entry point
|
|
216
211
|
*
|
|
@@ -246,8 +241,8 @@ declare function createTypedLogger<TFields extends Record<string, unknown>>(logg
|
|
|
246
241
|
* });
|
|
247
242
|
* ```
|
|
248
243
|
*/
|
|
249
|
-
type BrowserLogLevel = 'verbose' | 'debug' | 'info' | 'warn' | 'error' | 'critical';
|
|
250
|
-
interface BrowserLogEntry {
|
|
244
|
+
export type BrowserLogLevel = 'verbose' | 'debug' | 'info' | 'warn' | 'error' | 'critical';
|
|
245
|
+
export interface BrowserLogEntry {
|
|
251
246
|
timestamp: string;
|
|
252
247
|
level: BrowserLogLevel;
|
|
253
248
|
appName: string;
|
|
@@ -256,7 +251,7 @@ interface BrowserLogEntry {
|
|
|
256
251
|
traceId?: string;
|
|
257
252
|
context?: string;
|
|
258
253
|
}
|
|
259
|
-
interface BrowserLoggerConfig {
|
|
254
|
+
export interface BrowserLoggerConfig {
|
|
260
255
|
/** Application name shown in every log entry. @default 'App' */
|
|
261
256
|
appName?: string;
|
|
262
257
|
/** Minimum log level to emit. @default 'info' */
|
|
@@ -277,7 +272,7 @@ interface BrowserLoggerConfig {
|
|
|
277
272
|
/** Static context fields merged into every log entry. */
|
|
278
273
|
context?: Record<string, unknown>;
|
|
279
274
|
}
|
|
280
|
-
interface IBrowserTransport {
|
|
275
|
+
export interface IBrowserTransport {
|
|
281
276
|
name: string;
|
|
282
277
|
level?: BrowserLogLevel;
|
|
283
278
|
write(entry: BrowserLogEntry): void;
|
|
@@ -293,7 +288,7 @@ interface IBrowserTransport {
|
|
|
293
288
|
* In JSON mode:
|
|
294
289
|
* - Emits compact JSON strings via `console.log` / `console.error`
|
|
295
290
|
*/
|
|
296
|
-
declare class BrowserConsoleTransport implements IBrowserTransport {
|
|
291
|
+
export declare class BrowserConsoleTransport implements IBrowserTransport {
|
|
297
292
|
readonly name = "browser-console";
|
|
298
293
|
readonly level?: BrowserLogLevel;
|
|
299
294
|
private readonly json;
|
|
@@ -323,7 +318,7 @@ declare class BrowserConsoleTransport implements IBrowserTransport {
|
|
|
323
318
|
* });
|
|
324
319
|
* ```
|
|
325
320
|
*/
|
|
326
|
-
declare class BrowserRemoteTransport implements IBrowserTransport {
|
|
321
|
+
export declare class BrowserRemoteTransport implements IBrowserTransport {
|
|
327
322
|
readonly name = "browser-remote";
|
|
328
323
|
readonly level?: BrowserLogLevel;
|
|
329
324
|
private readonly url;
|
|
@@ -337,6 +332,12 @@ declare class BrowserRemoteTransport implements IBrowserTransport {
|
|
|
337
332
|
private lastFlushError;
|
|
338
333
|
private timer;
|
|
339
334
|
private droppedEntries;
|
|
335
|
+
private readonly silent;
|
|
336
|
+
private readonly onError;
|
|
337
|
+
private reporting;
|
|
338
|
+
private failureReported;
|
|
339
|
+
private lastReportAt;
|
|
340
|
+
private lastRecoveryAt;
|
|
340
341
|
constructor(options: {
|
|
341
342
|
/** Endpoint URL to POST batched log entries to. */
|
|
342
343
|
url: string;
|
|
@@ -356,6 +357,20 @@ declare class BrowserRemoteTransport implements IBrowserTransport {
|
|
|
356
357
|
*/
|
|
357
358
|
maxBufferSize?: number;
|
|
358
359
|
level?: BrowserLogLevel;
|
|
360
|
+
/**
|
|
361
|
+
* Suppress the console report of failed flushes (`onError` still fires).
|
|
362
|
+
* Defaults to `true` in real browser pages (so end users' consoles stay
|
|
363
|
+
* clean) and `false` elsewhere (edge runtimes, SSR, Node). Reports are
|
|
364
|
+
* throttled to one per minute and never include the URL or error text.
|
|
365
|
+
*/
|
|
366
|
+
silent?: boolean;
|
|
367
|
+
/**
|
|
368
|
+
* Called on every failed flush (network error or non-OK HTTP status) with the
|
|
369
|
+
* raw error. Runs inside the transport's re-entrancy guard: entries written
|
|
370
|
+
* to this transport from inside the callback are dropped (and counted in
|
|
371
|
+
* `dropped`). Route failures somewhere else.
|
|
372
|
+
*/
|
|
373
|
+
onError?: (error: unknown) => void;
|
|
359
374
|
});
|
|
360
375
|
/**
|
|
361
376
|
* Number of entries dropped without delivery — either because the buffer
|
|
@@ -363,14 +378,20 @@ declare class BrowserRemoteTransport implements IBrowserTransport {
|
|
|
363
378
|
* non-retryable HTTP status (a 4xx other than 429).
|
|
364
379
|
*/
|
|
365
380
|
get dropped(): number;
|
|
366
|
-
/** Number of flush attempts that failed
|
|
381
|
+
/** Number of flush attempts that failed (network error or non-OK HTTP status). */
|
|
367
382
|
get failedFlushes(): number;
|
|
368
|
-
/**
|
|
383
|
+
/**
|
|
384
|
+
* The most recent failure from a flush, if any: the raw fetch error (which on
|
|
385
|
+
* some runtimes embeds the request URL, so do not log it blindly) or an
|
|
386
|
+
* `Error` carrying only the HTTP status.
|
|
387
|
+
*/
|
|
369
388
|
get lastError(): unknown;
|
|
370
389
|
write(entry: BrowserLogEntry): void;
|
|
371
390
|
flush(): Promise<void>;
|
|
372
391
|
private send;
|
|
373
392
|
private recordFailure;
|
|
393
|
+
private reportRecovery;
|
|
394
|
+
private guarded;
|
|
374
395
|
private scheduleFlush;
|
|
375
396
|
/**
|
|
376
397
|
* Stop the flush timer and flush remaining entries. Without the final flush,
|
|
@@ -385,7 +406,7 @@ declare class BrowserRemoteTransport implements IBrowserTransport {
|
|
|
385
406
|
* Unlike the Node.js `LogixiaLogger`, this implementation has **zero**
|
|
386
407
|
* Node.js dependencies. It can be bundled for any runtime.
|
|
387
408
|
*/
|
|
388
|
-
declare class BrowserLogger {
|
|
409
|
+
export declare class BrowserLogger {
|
|
389
410
|
private readonly config;
|
|
390
411
|
private readonly transports;
|
|
391
412
|
constructor(config?: BrowserLoggerConfig);
|
|
@@ -420,7 +441,7 @@ declare class BrowserLogger {
|
|
|
420
441
|
* logger.info('Cart updated', { itemCount: 3, total: 49.99 });
|
|
421
442
|
* ```
|
|
422
443
|
*/
|
|
423
|
-
declare function createBrowserLogger(config?: BrowserLoggerConfig): BrowserLogger;
|
|
444
|
+
export declare function createBrowserLogger(config?: BrowserLoggerConfig): BrowserLogger;
|
|
424
445
|
/**
|
|
425
446
|
* Default browser logger instance (singleton, console transport, info level).
|
|
426
447
|
*
|
|
@@ -430,7 +451,6 @@ declare function createBrowserLogger(config?: BrowserLoggerConfig): BrowserLogge
|
|
|
430
451
|
* browserLogger.info('Hello from browser');
|
|
431
452
|
* ```
|
|
432
453
|
*/
|
|
433
|
-
declare const browserLogger: BrowserLogger;
|
|
434
|
-
|
|
435
|
-
export { BrowserConsoleTransport, BrowserLogEntry, BrowserLogLevel, BrowserLogger, BrowserLoggerConfig, BrowserRemoteTransport, type CompiledSchema, IBrowserTransport, type LogFieldDef, type LogFieldType, type LogSchema, type LoggerLike, type OtelBridgeOptions, type OtelSpanContext, type TypedLogger, browserLogger, createBrowserLogger, createTypedLogger, defineLogSchema, disableOtelBridge, getActiveOtelContext, getOtelMetaFields, initOtelBridge };
|
|
454
|
+
export declare const browserLogger: BrowserLogger;
|
|
455
|
+
export type { CompiledSchema, LogFieldDef, LogFieldType, LogSchema, LoggerLike, OtelBridgeOptions, OtelSpanContext, TypedLogger };
|
|
436
456
|
//# sourceMappingURL=browser.d.mts.map
|