@logwolf/client-js 1.1.0 → 1.1.1
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/dist/logwolf-client.js
CHANGED
|
@@ -84,8 +84,9 @@ class Logwolf {
|
|
|
84
84
|
flushPromise = null;
|
|
85
85
|
constructor(config) {
|
|
86
86
|
this.config = LogwolfConfigSchema.parse(config);
|
|
87
|
-
//
|
|
88
|
-
|
|
87
|
+
// Normalize to a trailing slash so relative paths append correctly.
|
|
88
|
+
const raw = this.config.url;
|
|
89
|
+
this.baseUrl = new URL(raw.endsWith('/') ? raw : raw + '/');
|
|
89
90
|
}
|
|
90
91
|
// --- Private: helpers ---
|
|
91
92
|
shouldCapture(event) {
|
|
@@ -137,7 +138,7 @@ class Logwolf {
|
|
|
137
138
|
*/
|
|
138
139
|
async create(event) {
|
|
139
140
|
event.stop();
|
|
140
|
-
const url = new URL('
|
|
141
|
+
const url = new URL('logs', this.baseUrl);
|
|
141
142
|
const res = await this.fetchWithTimeout(url, {
|
|
142
143
|
method: 'POST',
|
|
143
144
|
headers: this.getHeaders(),
|
|
@@ -149,7 +150,7 @@ class Logwolf {
|
|
|
149
150
|
}
|
|
150
151
|
async getAll(p) {
|
|
151
152
|
const params = p ? PaginationSchema.encode(p) : '';
|
|
152
|
-
const url = new URL('
|
|
153
|
+
const url = new URL('logs?' + params, this.baseUrl);
|
|
153
154
|
const res = await this.fetchWithTimeout(url, { method: 'GET', headers: this.getHeaders() })
|
|
154
155
|
.then((r) => r.json())
|
|
155
156
|
.then((r) => this.handleResponse(r));
|
|
@@ -159,7 +160,7 @@ class Logwolf {
|
|
|
159
160
|
return this.getAll().then((r) => r.find((i) => i.id === id));
|
|
160
161
|
}
|
|
161
162
|
async delete(dto) {
|
|
162
|
-
const url = new URL('
|
|
163
|
+
const url = new URL('logs', this.baseUrl);
|
|
163
164
|
const res = await this.fetchWithTimeout(url, {
|
|
164
165
|
method: 'DELETE',
|
|
165
166
|
headers: this.getHeaders(),
|
|
@@ -236,7 +237,7 @@ class Logwolf {
|
|
|
236
237
|
return this.flushPromise;
|
|
237
238
|
}
|
|
238
239
|
async sendBatchWithRetry(batch) {
|
|
239
|
-
const url = new URL('
|
|
240
|
+
const url = new URL('logs/batch', this.baseUrl);
|
|
240
241
|
const body = JSON.stringify(batch.map((ev) => ev.toObject()));
|
|
241
242
|
let lastError;
|
|
242
243
|
for (let attempt = 0; attempt <= this.config.retryDelaysMs.length; attempt++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logwolf-client.js","sources":["lib/schema.js","lib/client.js","lib/event.js"],"sourcesContent":["import z from 'zod';\nexport const LogwolfEventSeveritySchema = z.enum(['info', 'warning', 'error', 'critical']);\nexport const LogwolfEventDataSchema = z.codec(z.string(), z.record(z.string(), z.any()), {\n decode: (jsonString, ctx) => {\n try {\n return JSON.parse(jsonString);\n }\n catch (err) {\n ctx.issues.push({\n code: 'invalid_format',\n format: 'json',\n input: jsonString,\n message: err.message,\n });\n return z.NEVER;\n }\n },\n encode: (value) => JSON.stringify(value),\n});\nexport const LogwolfDatetimeSchema = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n});\nexport const LogwolfEventSchema = z.object({\n id: z.string(),\n name: z.string(),\n severity: LogwolfEventSeveritySchema,\n tags: z.array(z.string()),\n data: LogwolfEventDataSchema,\n duration: z.int().optional(),\n created_at: LogwolfDatetimeSchema,\n updated_at: LogwolfDatetimeSchema,\n});\nexport const CreateLogwolfEventDTOSchema = LogwolfEventSchema.pick({\n name: true,\n severity: true,\n tags: true,\n data: true,\n duration: true,\n});\nexport const DeleteLogwolfEventDTOSchema = LogwolfEventSchema.pick({ id: true });\nexport const LogwolfConfigSchema = z.object({\n url: z.url(),\n apiKey: z.string().startsWith('lw_').min(10),\n sampleRate: z.number().positive().lte(1).optional(),\n errorSampleRate: z.number().positive().lte(1).optional(),\n // Batching options\n flushIntervalMs: z.number().positive(),\n maxBatchSize: z.number().positive(),\n maxQueueSize: z.number().positive(),\n retryDelaysMs: z.number().gte(0).array(),\n requestTimeoutMs: z.number().positive(),\n onDropped: z.function({ input: [z.any().array(), z.string()] }).optional(),\n});\nexport const LogwolfEventDTOSchema = LogwolfEventSchema.pick({\n name: true,\n severity: true,\n tags: true,\n data: true,\n}).partial({\n data: true,\n});\nexport const PaginationSchema = z.codec(z.instanceof(URLSearchParams), z.object({\n page: z.number().positive(),\n pageSize: z.number().positive(),\n}), {\n encode: (v) => {\n return new URLSearchParams({ page: '' + v.page, pageSize: '' + v.pageSize });\n },\n decode: (v) => {\n const page = v.get('page') ?? '0';\n const pageSize = v.get('pageSize') ?? '0';\n return { page: parseInt(page), pageSize: parseInt(pageSize) };\n },\n});\n//# sourceMappingURL=schema.js.map","import z from 'zod';\nimport { DeleteLogwolfEventDTOSchema, LogwolfConfigSchema, LogwolfEventSchema, PaginationSchema, } from './schema';\nexport class Logwolf {\n config;\n baseUrl;\n // Queue holds stopped LogwolfEvent instances ready to be flushed.\n queue = [];\n flushTimer = null;\n flushPromise = null;\n constructor(config) {\n this.config = LogwolfConfigSchema.parse(config);\n // Pre-compute base URL once to avoid repeated allocations per request.\n this.baseUrl = new URL(this.config.url);\n }\n // --- Private: helpers ---\n shouldCapture(event) {\n switch (event.severity) {\n case 'error':\n return this.config.errorSampleRate === undefined || event.random >= 1 - this.config.errorSampleRate;\n case 'critical':\n return true;\n default:\n return this.config.sampleRate === undefined || event.random >= 1 - this.config.sampleRate;\n }\n }\n getHeaders() {\n return {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${this.config.apiKey}`,\n };\n }\n handleResponse(r) {\n if (r.error)\n throw new Error(r.message);\n return r.data;\n }\n sleep(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n async fetchWithTimeout(url, init) {\n const controller = new AbortController();\n const id = setTimeout(() => controller.abort(), this.config.requestTimeoutMs);\n return fetch(url, { ...init, signal: controller.signal }).finally(() => clearTimeout(id));\n }\n // --- Public API ---\n /**\n * Enqueues an event for batched delivery. Respects sampleRate and\n * errorSampleRate. Returns true if the event was accepted into the queue,\n * false if it was dropped (either by sampling or queue cap).\n *\n * capture() is synchronous and returns immediately — delivery happens in\n * the background. Call flush() before process exit to drain the queue.\n */\n capture(event) {\n if (!this.shouldCapture(event))\n return false;\n return this.enqueue(event);\n }\n /**\n * Sends an event immediately, bypassing sampling and the queue.\n * Awaitable — resolves when the server has accepted the event.\n */\n async create(event) {\n event.stop();\n const url = new URL('/logs', this.baseUrl);\n const res = await this.fetchWithTimeout(url, {\n method: 'POST',\n headers: this.getHeaders(),\n body: JSON.stringify(event.toObject()),\n })\n .then((r) => r.json())\n .then((r) => this.handleResponse(r));\n return res;\n }\n async getAll(p) {\n const params = p ? PaginationSchema.encode(p) : '';\n const url = new URL('/logs?' + params, this.baseUrl);\n const res = await this.fetchWithTimeout(url, { method: 'GET', headers: this.getHeaders() })\n .then((r) => r.json())\n .then((r) => this.handleResponse(r));\n return z.array(LogwolfEventSchema).parse(res);\n }\n async getOne(id) {\n return this.getAll().then((r) => r.find((i) => i.id === id));\n }\n async delete(dto) {\n const url = new URL('/logs', this.baseUrl);\n const res = await this.fetchWithTimeout(url, {\n method: 'DELETE',\n headers: this.getHeaders(),\n body: JSON.stringify(DeleteLogwolfEventDTOSchema.parse(dto)),\n })\n .then((r) => r.json())\n .then((r) => this.handleResponse(r));\n return res;\n }\n /**\n * Flushes all queued events immediately. Call this before process exit\n * or page unload to avoid losing buffered events.\n *\n * If a background flush is already in progress, waits for it to complete\n * before flushing any remaining events — so all enqueued events are sent.\n */\n async flush() {\n if (this.flushPromise)\n await this.flushPromise;\n if (this.queue.length > 0)\n await this.flushQueue();\n }\n /**\n * Clears the flush interval and prevents further background flushing.\n * Call this to allow Node.js to exit cleanly, or in test teardown.\n * Any queued events that haven't been flushed will be lost — call\n * flush() first if you need to drain the queue.\n */\n destroy() {\n if (this.flushTimer !== null) {\n clearInterval(this.flushTimer);\n this.flushTimer = null;\n }\n }\n // --- Private: queue management ---\n enqueue(event) {\n // Stop the stopwatch at enqueue time — this is the correct moment.\n event.stop();\n // Enforce the queue cap: drop the oldest event to make room.\n if (this.queue.length >= this.config.maxQueueSize) {\n const dropped = this.queue.splice(0, 1);\n this.config.onDropped?.(dropped, 'queue_full');\n }\n this.queue.push(event);\n // Start the flush timer lazily on first enqueue.\n if (this.flushTimer === null) {\n this.flushTimer = setInterval(() => {\n this.flushQueue().catch(() => {\n // Errors are handled inside flushQueue; this prevents\n // unhandled promise rejection from the interval callback.\n });\n }, this.config.flushIntervalMs);\n }\n // Flush immediately if the batch size threshold is reached.\n if (this.queue.length >= this.config.maxBatchSize) {\n this.flushQueue().catch(() => { });\n }\n return true;\n }\n flushQueue() {\n if (this.flushPromise !== null || this.queue.length === 0)\n return Promise.resolve();\n // Drain the queue into a local batch atomically. Any events captured\n // during the flush go into the next batch.\n const batch = this.queue.splice(0, this.queue.length);\n this.flushPromise = this.sendBatchWithRetry(batch)\n .catch(() => {\n // All retries exhausted — notify caller via onDropped.\n this.config.onDropped?.(batch, 'send_failed');\n })\n .finally(() => {\n this.flushPromise = null;\n });\n return this.flushPromise;\n }\n async sendBatchWithRetry(batch) {\n const url = new URL('/logs/batch', this.baseUrl);\n const body = JSON.stringify(batch.map((ev) => ev.toObject()));\n let lastError;\n for (let attempt = 0; attempt <= this.config.retryDelaysMs.length; attempt++) {\n try {\n const response = await this.fetchWithTimeout(url, {\n method: 'POST',\n headers: this.getHeaders(),\n body,\n });\n // 401/403 — bad key, do not retry, surface immediately.\n if (response.status === 401 || response.status === 403) {\n this.config.onDropped?.(batch, `auth_error_${response.status}`);\n return;\n }\n if (response.ok)\n return;\n // Non-2xx that isn't an auth error — retry.\n lastError = new Error(`Server returned ${response.status}`);\n }\n catch (err) {\n // Network error — retry.\n lastError = err;\n }\n // Wait before the next attempt, unless this was the last one.\n if (attempt < this.config.retryDelaysMs.length) {\n await this.sleep(this.config.retryDelaysMs[attempt]);\n }\n }\n throw lastError;\n }\n}\n//# sourceMappingURL=client.js.map","import { CreateLogwolfEventDTOSchema } from './schema';\nexport class LogwolfEvent {\n random = Math.random();\n start = performance.now();\n createdAt = new Date();\n name;\n severity;\n tags;\n data = {};\n _duration = null;\n constructor(props) {\n this.name = props.name;\n this.severity = props.severity;\n this.tags = props.tags;\n if (props.data) {\n this.data = props.data;\n }\n }\n /**\n * Stops the stopwatch. Duration is frozen from construction to this call.\n * Called automatically by `capture()` and `create()` — you only need to\n * call this manually if you want to stop the clock before those methods.\n *\n * Calling `stop()` more than once is a no-op; the first call wins.\n */\n stop() {\n if (this._duration === null) {\n this._duration = Math.floor(performance.now() - this.start);\n }\n }\n setName(n) {\n this.name = n;\n }\n setSeverity(s) {\n this.severity = s;\n }\n set(key, value) {\n this.data[key] = value;\n }\n get(key) {\n return this.data[key];\n }\n addTag(t) {\n this.tags.push(t);\n }\n toObject() {\n const duration = this._duration ?? Math.floor(performance.now() - this.start);\n const encoded = CreateLogwolfEventDTOSchema.encode({\n name: this.name,\n severity: this.severity,\n tags: Array.from(new Set(this.tags)),\n data: this.data,\n duration: duration,\n });\n return encoded;\n }\n}\n//# sourceMappingURL=event.js.map"],"names":[],"mappings":";;AACY,MAAC,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC;AAC7E,MAAC,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE;AACzF,IAAI,MAAM,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK;AACjC,QAAQ,IAAI;AACZ,YAAY,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;AACzC,QAAQ;AACR,QAAQ,OAAO,GAAG,EAAE;AACpB,YAAY,GAA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AAM,QAAQ,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;AACrF,QAAQ,MAAM,OAAO,GAAG,2BAA2B,CAAC,MAAM,CAAC;AAC3D,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,YAAY,QAAQ,EAAE,IAAI,CAAC,QAAQ;AACnC,YAAY,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChD,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,YAAY,QAAQ,EAAE,QAAQ;AAC9B,SAAS,CAAC;AACV,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"logwolf-client.js","sources":["lib/schema.js","lib/client.js","lib/event.js"],"sourcesContent":["import z from 'zod';\nexport const LogwolfEventSeveritySchema = z.enum(['info', 'warning', 'error', 'critical']);\nexport const LogwolfEventDataSchema = z.codec(z.string(), z.record(z.string(), z.any()), {\n decode: (jsonString, ctx) => {\n try {\n return JSON.parse(jsonString);\n }\n catch (err) {\n ctx.issues.push({\n code: 'invalid_format',\n format: 'json',\n input: jsonString,\n message: err.message,\n });\n return z.NEVER;\n }\n },\n encode: (value) => JSON.stringify(value),\n});\nexport const LogwolfDatetimeSchema = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n});\nexport const LogwolfEventSchema = z.object({\n id: z.string(),\n name: z.string(),\n severity: LogwolfEventSeveritySchema,\n tags: z.array(z.string()),\n data: LogwolfEventDataSchema,\n duration: z.int().optional(),\n created_at: LogwolfDatetimeSchema,\n updated_at: LogwolfDatetimeSchema,\n});\nexport const CreateLogwolfEventDTOSchema = LogwolfEventSchema.pick({\n name: true,\n severity: true,\n tags: true,\n data: true,\n duration: true,\n});\nexport const DeleteLogwolfEventDTOSchema = LogwolfEventSchema.pick({ id: true });\nexport const LogwolfConfigSchema = z.object({\n url: z.url(),\n apiKey: z.string().startsWith('lw_').min(10),\n sampleRate: z.number().positive().lte(1).optional(),\n errorSampleRate: z.number().positive().lte(1).optional(),\n // Batching options\n flushIntervalMs: z.number().positive(),\n maxBatchSize: z.number().positive(),\n maxQueueSize: z.number().positive(),\n retryDelaysMs: z.number().gte(0).array(),\n requestTimeoutMs: z.number().positive(),\n onDropped: z.function({ input: [z.any().array(), z.string()] }).optional(),\n});\nexport const LogwolfEventDTOSchema = LogwolfEventSchema.pick({\n name: true,\n severity: true,\n tags: true,\n data: true,\n}).partial({\n data: true,\n});\nexport const PaginationSchema = z.codec(z.instanceof(URLSearchParams), z.object({\n page: z.number().positive(),\n pageSize: z.number().positive(),\n}), {\n encode: (v) => {\n return new URLSearchParams({ page: '' + v.page, pageSize: '' + v.pageSize });\n },\n decode: (v) => {\n const page = v.get('page') ?? '0';\n const pageSize = v.get('pageSize') ?? '0';\n return { page: parseInt(page), pageSize: parseInt(pageSize) };\n },\n});\n//# sourceMappingURL=schema.js.map","import z from 'zod';\nimport { DeleteLogwolfEventDTOSchema, LogwolfConfigSchema, LogwolfEventSchema, PaginationSchema, } from './schema';\nexport class Logwolf {\n config;\n baseUrl;\n // Queue holds stopped LogwolfEvent instances ready to be flushed.\n queue = [];\n flushTimer = null;\n flushPromise = null;\n constructor(config) {\n this.config = LogwolfConfigSchema.parse(config);\n // Normalize to a trailing slash so relative paths append correctly.\n const raw = this.config.url;\n this.baseUrl = new URL(raw.endsWith('/') ? raw : raw + '/');\n }\n // --- Private: helpers ---\n shouldCapture(event) {\n switch (event.severity) {\n case 'error':\n return this.config.errorSampleRate === undefined || event.random >= 1 - this.config.errorSampleRate;\n case 'critical':\n return true;\n default:\n return this.config.sampleRate === undefined || event.random >= 1 - this.config.sampleRate;\n }\n }\n getHeaders() {\n return {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${this.config.apiKey}`,\n };\n }\n handleResponse(r) {\n if (r.error)\n throw new Error(r.message);\n return r.data;\n }\n sleep(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n async fetchWithTimeout(url, init) {\n const controller = new AbortController();\n const id = setTimeout(() => controller.abort(), this.config.requestTimeoutMs);\n return fetch(url, { ...init, signal: controller.signal }).finally(() => clearTimeout(id));\n }\n // --- Public API ---\n /**\n * Enqueues an event for batched delivery. Respects sampleRate and\n * errorSampleRate. Returns true if the event was accepted into the queue,\n * false if it was dropped (either by sampling or queue cap).\n *\n * capture() is synchronous and returns immediately — delivery happens in\n * the background. Call flush() before process exit to drain the queue.\n */\n capture(event) {\n if (!this.shouldCapture(event))\n return false;\n return this.enqueue(event);\n }\n /**\n * Sends an event immediately, bypassing sampling and the queue.\n * Awaitable — resolves when the server has accepted the event.\n */\n async create(event) {\n event.stop();\n const url = new URL('logs', this.baseUrl);\n const res = await this.fetchWithTimeout(url, {\n method: 'POST',\n headers: this.getHeaders(),\n body: JSON.stringify(event.toObject()),\n })\n .then((r) => r.json())\n .then((r) => this.handleResponse(r));\n return res;\n }\n async getAll(p) {\n const params = p ? PaginationSchema.encode(p) : '';\n const url = new URL('logs?' + params, this.baseUrl);\n const res = await this.fetchWithTimeout(url, { method: 'GET', headers: this.getHeaders() })\n .then((r) => r.json())\n .then((r) => this.handleResponse(r));\n return z.array(LogwolfEventSchema).parse(res);\n }\n async getOne(id) {\n return this.getAll().then((r) => r.find((i) => i.id === id));\n }\n async delete(dto) {\n const url = new URL('logs', this.baseUrl);\n const res = await this.fetchWithTimeout(url, {\n method: 'DELETE',\n headers: this.getHeaders(),\n body: JSON.stringify(DeleteLogwolfEventDTOSchema.parse(dto)),\n })\n .then((r) => r.json())\n .then((r) => this.handleResponse(r));\n return res;\n }\n /**\n * Flushes all queued events immediately. Call this before process exit\n * or page unload to avoid losing buffered events.\n *\n * If a background flush is already in progress, waits for it to complete\n * before flushing any remaining events — so all enqueued events are sent.\n */\n async flush() {\n if (this.flushPromise)\n await this.flushPromise;\n if (this.queue.length > 0)\n await this.flushQueue();\n }\n /**\n * Clears the flush interval and prevents further background flushing.\n * Call this to allow Node.js to exit cleanly, or in test teardown.\n * Any queued events that haven't been flushed will be lost — call\n * flush() first if you need to drain the queue.\n */\n destroy() {\n if (this.flushTimer !== null) {\n clearInterval(this.flushTimer);\n this.flushTimer = null;\n }\n }\n // --- Private: queue management ---\n enqueue(event) {\n // Stop the stopwatch at enqueue time — this is the correct moment.\n event.stop();\n // Enforce the queue cap: drop the oldest event to make room.\n if (this.queue.length >= this.config.maxQueueSize) {\n const dropped = this.queue.splice(0, 1);\n this.config.onDropped?.(dropped, 'queue_full');\n }\n this.queue.push(event);\n // Start the flush timer lazily on first enqueue.\n if (this.flushTimer === null) {\n this.flushTimer = setInterval(() => {\n this.flushQueue().catch(() => {\n // Errors are handled inside flushQueue; this prevents\n // unhandled promise rejection from the interval callback.\n });\n }, this.config.flushIntervalMs);\n }\n // Flush immediately if the batch size threshold is reached.\n if (this.queue.length >= this.config.maxBatchSize) {\n this.flushQueue().catch(() => { });\n }\n return true;\n }\n flushQueue() {\n if (this.flushPromise !== null || this.queue.length === 0)\n return Promise.resolve();\n // Drain the queue into a local batch atomically. Any events captured\n // during the flush go into the next batch.\n const batch = this.queue.splice(0, this.queue.length);\n this.flushPromise = this.sendBatchWithRetry(batch)\n .catch(() => {\n // All retries exhausted — notify caller via onDropped.\n this.config.onDropped?.(batch, 'send_failed');\n })\n .finally(() => {\n this.flushPromise = null;\n });\n return this.flushPromise;\n }\n async sendBatchWithRetry(batch) {\n const url = new URL('logs/batch', this.baseUrl);\n const body = JSON.stringify(batch.map((ev) => ev.toObject()));\n let lastError;\n for (let attempt = 0; attempt <= this.config.retryDelaysMs.length; attempt++) {\n try {\n const response = await this.fetchWithTimeout(url, {\n method: 'POST',\n headers: this.getHeaders(),\n body,\n });\n // 401/403 — bad key, do not retry, surface immediately.\n if (response.status === 401 || response.status === 403) {\n this.config.onDropped?.(batch, `auth_error_${response.status}`);\n return;\n }\n if (response.ok)\n return;\n // Non-2xx that isn't an auth error — retry.\n lastError = new Error(`Server returned ${response.status}`);\n }\n catch (err) {\n // Network error — retry.\n lastError = err;\n }\n // Wait before the next attempt, unless this was the last one.\n if (attempt < this.config.retryDelaysMs.length) {\n await this.sleep(this.config.retryDelaysMs[attempt]);\n }\n }\n throw lastError;\n }\n}\n//# sourceMappingURL=client.js.map","import { CreateLogwolfEventDTOSchema } from './schema';\nexport class LogwolfEvent {\n random = Math.random();\n start = performance.now();\n createdAt = new Date();\n name;\n severity;\n tags;\n data = {};\n _duration = null;\n constructor(props) {\n this.name = props.name;\n this.severity = props.severity;\n this.tags = props.tags;\n if (props.data) {\n this.data = props.data;\n }\n }\n /**\n * Stops the stopwatch. Duration is frozen from construction to this call.\n * Called automatically by `capture()` and `create()` — you only need to\n * call this manually if you want to stop the clock before those methods.\n *\n * Calling `stop()` more than once is a no-op; the first call wins.\n */\n stop() {\n if (this._duration === null) {\n this._duration = Math.floor(performance.now() - this.start);\n }\n }\n setName(n) {\n this.name = n;\n }\n setSeverity(s) {\n this.severity = s;\n }\n set(key, value) {\n this.data[key] = value;\n }\n get(key) {\n return this.data[key];\n }\n addTag(t) {\n this.tags.push(t);\n }\n toObject() {\n const duration = this._duration ?? Math.floor(performance.now() - this.start);\n const encoded = CreateLogwolfEventDTOSchema.encode({\n name: this.name,\n severity: this.severity,\n tags: Array.from(new Set(this.tags)),\n data: this.data,\n duration: duration,\n });\n return encoded;\n }\n}\n//# sourceMappingURL=event.js.map"],"names":[],"mappings":";;AACY,MAAC,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC;AAC7E,MAAC,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,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