@logwolf/client-js 1.1.0 → 2.0.0
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/CHANGELOG.md +22 -0
- package/README.md +38 -1
- package/dist/logwolf-client.d.ts +16 -1
- package/dist/logwolf-client.js +31 -10
- package/dist/logwolf-client.js.map +1 -1
- package/package.json +55 -54
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
Needs a Logwolf server with `GET /logs/:id`: the multi-tenancy release or later. Against an older server, `getOne` always resolves to `undefined`.
|
|
6
|
+
|
|
7
|
+
### Breaking
|
|
8
|
+
|
|
9
|
+
- **`getOne(id)` asks the server for that event** (`GET /logs/:id`) instead of fetching the latest page and searching it. It now finds an event of any age; it used to miss anything older than the newest 20. It resolves to `undefined` when the key's project has no event with that id, and throws on any other failure, as the other methods do. It needs a key with the `read` scope.
|
|
10
|
+
- **`getAll()` refuses a page the server would.** `pageSize` must be a whole number up to `MAX_PAGE_SIZE` (100) and `page` one up to `MAX_PAGE` (1,000,000). Anything else throws a `ZodError` before a request is made. A fractional or oversized `pageSize` used to be sent as it was.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `MAX_PAGE_SIZE` and `MAX_PAGE`, exported.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `getAll()`'s response was typed as the DOM's `Event[]` before parsing.
|
|
19
|
+
|
|
20
|
+
## 1.1.1
|
|
21
|
+
|
|
22
|
+
- Handle base URLs with a path (`https://example.com/api`).
|
package/README.md
CHANGED
|
@@ -1 +1,38 @@
|
|
|
1
|
-
# logwolf
|
|
1
|
+
# @logwolf/client-js
|
|
2
|
+
|
|
3
|
+
The JavaScript client for [Logwolf](https://github.com/jpricardo/logwolf), a self-hosted logging platform. It captures events in the browser or in Node, samples them, and delivers them to your Logwolf instance in batches, with retries.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @logwolf/client-js
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import Logwolf, { LogwolfEvent } from '@logwolf/client-js';
|
|
13
|
+
|
|
14
|
+
const logwolf = new Logwolf({
|
|
15
|
+
url: 'https://logs.your-domain.com/api/',
|
|
16
|
+
apiKey: process.env.LOGWOLF_API_KEY!, // an lw_ key from the dashboard's Keys page
|
|
17
|
+
flushIntervalMs: 5000,
|
|
18
|
+
maxBatchSize: 20,
|
|
19
|
+
maxQueueSize: 500,
|
|
20
|
+
retryDelaysMs: [1000, 3000, 10000],
|
|
21
|
+
requestTimeoutMs: 10000,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const event = new LogwolfEvent({ name: 'checkout.completed', severity: 'info', tags: ['payments'] });
|
|
25
|
+
event.set('orderId', 'ord_123');
|
|
26
|
+
logwolf.capture(event); // returns at once; delivery is batched in the background
|
|
27
|
+
|
|
28
|
+
await logwolf.flush(); // before the process exits, so nothing queued is lost
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`capture()` is synchronous and never throws: events are queued and sent in batches. `create()` sends one event now and awaits the server. `getAll()`, `getOne()` and `delete()` read and delete events; they need a key with the `read` or `delete` scope, which a key only has if it was created with them.
|
|
32
|
+
|
|
33
|
+
Severity is one of `info`, `warning`, `error` or `critical`.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
- [SDK reference](https://github.com/jpricardo/logwolf/blob/main/docs/sdk/js.md): every option and method.
|
|
38
|
+
- [Changelog](https://github.com/jpricardo/logwolf/blob/main/logwolf-client/js/CHANGELOG.md): 2.0.0 changed `getOne` and `getAll`'s pagination, and needs a recent Logwolf server.
|
package/dist/logwolf-client.d.ts
CHANGED
|
@@ -75,6 +75,10 @@ declare const LogwolfEventDTOSchema: z.ZodObject<{
|
|
|
75
75
|
tags: z.ZodArray<z.ZodString>;
|
|
76
76
|
}, z.core.$strip>;
|
|
77
77
|
type LogwolfEventDTO = z.infer<typeof LogwolfEventDTOSchema>;
|
|
78
|
+
/** The largest page the server serves; it answers 400 to more. */
|
|
79
|
+
declare const MAX_PAGE_SIZE = 100;
|
|
80
|
+
/** The deepest page the server serves. */
|
|
81
|
+
declare const MAX_PAGE = 1000000;
|
|
78
82
|
declare const PaginationSchema: z.ZodCodec<z.ZodCustom<URLSearchParams, URLSearchParams>, z.ZodObject<{
|
|
79
83
|
page: z.ZodNumber;
|
|
80
84
|
pageSize: z.ZodNumber;
|
|
@@ -139,7 +143,18 @@ declare class Logwolf {
|
|
|
139
143
|
* Awaitable — resolves when the server has accepted the event.
|
|
140
144
|
*/
|
|
141
145
|
create(event: LogwolfEvent): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Fetches one page of events, newest first: the first 20 without
|
|
148
|
+
* `pagination`. `pageSize` can be at most {@link MAX_PAGE_SIZE}; a page
|
|
149
|
+
* outside the bounds throws before any request is made.
|
|
150
|
+
*/
|
|
142
151
|
getAll(p?: Pagination): Promise<LogwolfEventData[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Fetches one event by id, or `undefined` if the key's project has no event
|
|
154
|
+
* with that id. It asks the server for that event alone (`GET /logs/:id`),
|
|
155
|
+
* so it finds any event, not only the latest page; that route needs a
|
|
156
|
+
* Logwolf server that has it.
|
|
157
|
+
*/
|
|
143
158
|
getOne(id: string): Promise<LogwolfEventData | undefined>;
|
|
144
159
|
delete(dto: DeleteLogwolfEventDTO): Promise<void>;
|
|
145
160
|
/**
|
|
@@ -162,5 +177,5 @@ declare class Logwolf {
|
|
|
162
177
|
private sendBatchWithRetry;
|
|
163
178
|
}
|
|
164
179
|
|
|
165
|
-
export { CreateLogwolfEventDTOSchema, DeleteLogwolfEventDTOSchema, Logwolf, LogwolfConfigSchema, LogwolfDatetimeSchema, LogwolfEvent, LogwolfEventDTOSchema, LogwolfEventDataSchema, LogwolfEventSchema, LogwolfEventSeveritySchema, PaginationSchema, Logwolf as default };
|
|
180
|
+
export { CreateLogwolfEventDTOSchema, DeleteLogwolfEventDTOSchema, Logwolf, LogwolfConfigSchema, LogwolfDatetimeSchema, LogwolfEvent, LogwolfEventDTOSchema, LogwolfEventDataSchema, LogwolfEventSchema, LogwolfEventSeveritySchema, MAX_PAGE, MAX_PAGE_SIZE, PaginationSchema, Logwolf as default };
|
|
166
181
|
export type { CreateLogwolfEventDTO, DeleteLogwolfEventDTO, LogwolfApiResponse, LogwolfConfig, LogwolfEventDTO, LogwolfEventData, Pagination, Severity };
|
package/dist/logwolf-client.js
CHANGED
|
@@ -61,9 +61,13 @@ const LogwolfEventDTOSchema = LogwolfEventSchema.pick({
|
|
|
61
61
|
}).partial({
|
|
62
62
|
data: true,
|
|
63
63
|
});
|
|
64
|
+
/** The largest page the server serves; it answers 400 to more. */
|
|
65
|
+
const MAX_PAGE_SIZE = 100;
|
|
66
|
+
/** The deepest page the server serves. */
|
|
67
|
+
const MAX_PAGE = 1_000_000;
|
|
64
68
|
const PaginationSchema = z.codec(z.instanceof(URLSearchParams), z.object({
|
|
65
|
-
page: z.number().positive(),
|
|
66
|
-
pageSize: z.number().positive(),
|
|
69
|
+
page: z.number().int().positive().max(MAX_PAGE),
|
|
70
|
+
pageSize: z.number().int().positive().max(MAX_PAGE_SIZE),
|
|
67
71
|
}), {
|
|
68
72
|
encode: (v) => {
|
|
69
73
|
return new URLSearchParams({ page: '' + v.page, pageSize: '' + v.pageSize });
|
|
@@ -84,8 +88,9 @@ class Logwolf {
|
|
|
84
88
|
flushPromise = null;
|
|
85
89
|
constructor(config) {
|
|
86
90
|
this.config = LogwolfConfigSchema.parse(config);
|
|
87
|
-
//
|
|
88
|
-
|
|
91
|
+
// Normalize to a trailing slash so relative paths append correctly.
|
|
92
|
+
const raw = this.config.url;
|
|
93
|
+
this.baseUrl = new URL(raw.endsWith('/') ? raw : raw + '/');
|
|
89
94
|
}
|
|
90
95
|
// --- Private: helpers ---
|
|
91
96
|
shouldCapture(event) {
|
|
@@ -137,7 +142,7 @@ class Logwolf {
|
|
|
137
142
|
*/
|
|
138
143
|
async create(event) {
|
|
139
144
|
event.stop();
|
|
140
|
-
const url = new URL('
|
|
145
|
+
const url = new URL('logs', this.baseUrl);
|
|
141
146
|
const res = await this.fetchWithTimeout(url, {
|
|
142
147
|
method: 'POST',
|
|
143
148
|
headers: this.getHeaders(),
|
|
@@ -147,19 +152,35 @@ class Logwolf {
|
|
|
147
152
|
.then((r) => this.handleResponse(r));
|
|
148
153
|
return res;
|
|
149
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Fetches one page of events, newest first: the first 20 without
|
|
157
|
+
* `pagination`. `pageSize` can be at most {@link MAX_PAGE_SIZE}; a page
|
|
158
|
+
* outside the bounds throws before any request is made.
|
|
159
|
+
*/
|
|
150
160
|
async getAll(p) {
|
|
151
161
|
const params = p ? PaginationSchema.encode(p) : '';
|
|
152
|
-
const url = new URL('
|
|
162
|
+
const url = new URL('logs?' + params, this.baseUrl);
|
|
153
163
|
const res = await this.fetchWithTimeout(url, { method: 'GET', headers: this.getHeaders() })
|
|
154
164
|
.then((r) => r.json())
|
|
155
165
|
.then((r) => this.handleResponse(r));
|
|
156
166
|
return z.array(LogwolfEventSchema).parse(res);
|
|
157
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Fetches one event by id, or `undefined` if the key's project has no event
|
|
170
|
+
* with that id. It asks the server for that event alone (`GET /logs/:id`),
|
|
171
|
+
* so it finds any event, not only the latest page; that route needs a
|
|
172
|
+
* Logwolf server that has it.
|
|
173
|
+
*/
|
|
158
174
|
async getOne(id) {
|
|
159
|
-
|
|
175
|
+
const url = new URL(`logs/${encodeURIComponent(id)}`, this.baseUrl);
|
|
176
|
+
const response = await this.fetchWithTimeout(url, { method: 'GET', headers: this.getHeaders() });
|
|
177
|
+
if (response.status === 404)
|
|
178
|
+
return undefined;
|
|
179
|
+
const body = (await response.json());
|
|
180
|
+
return LogwolfEventSchema.parse(this.handleResponse(body));
|
|
160
181
|
}
|
|
161
182
|
async delete(dto) {
|
|
162
|
-
const url = new URL('
|
|
183
|
+
const url = new URL('logs', this.baseUrl);
|
|
163
184
|
const res = await this.fetchWithTimeout(url, {
|
|
164
185
|
method: 'DELETE',
|
|
165
186
|
headers: this.getHeaders(),
|
|
@@ -236,7 +257,7 @@ class Logwolf {
|
|
|
236
257
|
return this.flushPromise;
|
|
237
258
|
}
|
|
238
259
|
async sendBatchWithRetry(batch) {
|
|
239
|
-
const url = new URL('
|
|
260
|
+
const url = new URL('logs/batch', this.baseUrl);
|
|
240
261
|
const body = JSON.stringify(batch.map((ev) => ev.toObject()));
|
|
241
262
|
let lastError;
|
|
242
263
|
for (let attempt = 0; attempt <= this.config.retryDelaysMs.length; attempt++) {
|
|
@@ -326,5 +347,5 @@ class LogwolfEvent {
|
|
|
326
347
|
}
|
|
327
348
|
}
|
|
328
349
|
|
|
329
|
-
export { CreateLogwolfEventDTOSchema, DeleteLogwolfEventDTOSchema, Logwolf, LogwolfConfigSchema, LogwolfDatetimeSchema, LogwolfEvent, LogwolfEventDTOSchema, LogwolfEventDataSchema, LogwolfEventSchema, LogwolfEventSeveritySchema, PaginationSchema, Logwolf as default };
|
|
350
|
+
export { CreateLogwolfEventDTOSchema, DeleteLogwolfEventDTOSchema, Logwolf, LogwolfConfigSchema, LogwolfDatetimeSchema, LogwolfEvent, LogwolfEventDTOSchema, LogwolfEventDataSchema, LogwolfEventSchema, LogwolfEventSeveritySchema, MAX_PAGE, MAX_PAGE_SIZE, PaginationSchema, Logwolf as default };
|
|
330
351
|
//# sourceMappingURL=logwolf-client.js.map
|
|
@@ -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,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;AAC5B,gBAAgB,IAAI,EAAE,gBAAgB;AACtC,gBAAgB,MAAM,EAAE,MAAM;AAC9B,gBAAgB,KAAK,EAAE,UAAU;AACjC,gBAAgB,OAAO,EAAE,GAAG,CAAC,OAAO;AACpC,aAAa,CAAC;AACd,YAAY,OAAO,CAAC,CAAC,KAAK;AAC1B,QAAQ;AACR,IAAI,CAAC;AACL,IAAI,MAAM,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC5C,CAAC;AACW,MAAC,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EA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AO,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});\n/** The largest page the server serves; it answers 400 to more. */\nexport const MAX_PAGE_SIZE = 100;\n/** The deepest page the server serves. */\nexport const MAX_PAGE = 1_000_000;\nexport const PaginationSchema = z.codec(z.instanceof(URLSearchParams), z.object({\n page: z.number().int().positive().max(MAX_PAGE),\n pageSize: z.number().int().positive().max(MAX_PAGE_SIZE),\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 /**\n * Fetches one page of events, newest first: the first 20 without\n * `pagination`. `pageSize` can be at most {@link MAX_PAGE_SIZE}; a page\n * outside the bounds throws before any request is made.\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 /**\n * Fetches one event by id, or `undefined` if the key's project has no event\n * with that id. It asks the server for that event alone (`GET /logs/:id`),\n * so it finds any event, not only the latest page; that route needs a\n * Logwolf server that has it.\n */\n async getOne(id) {\n const url = new URL(`logs/${encodeURIComponent(id)}`, this.baseUrl);\n const response = await this.fetchWithTimeout(url, { method: 'GET', headers: this.getHeaders() });\n if (response.status === 404)\n return undefined;\n const body = (await response.json());\n return LogwolfEventSchema.parse(this.handleResponse(body));\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,G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I,CAAC,CAAC;AAChD,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,YAAY,QAAQ,EAAE,QAAQ;AAC9B,SAAS,CAAC;AACV,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@logwolf/client-js",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "JavaScript client for Logwolf",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"logwolf"
|
|
7
|
-
],
|
|
8
|
-
"homepage": "https://github.com/jpricardo/logwolf#readme",
|
|
9
|
-
"bugs": {
|
|
10
|
-
"url": "https://github.com/jpricardo/logwolf/issues"
|
|
11
|
-
},
|
|
12
|
-
"license": "ISC",
|
|
13
|
-
"author": "jpricardo",
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/jpricardo/logwolf.git"
|
|
17
|
-
},
|
|
18
|
-
"directories": {
|
|
19
|
-
"lib": "lib"
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"./dist/logwolf-client.d.ts",
|
|
23
|
-
"./dist/logwolf-client.js",
|
|
24
|
-
"./dist/logwolf-client.js.map"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"lint
|
|
36
|
-
"
|
|
37
|
-
"format
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"rollup
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@logwolf/client-js",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "JavaScript client for Logwolf",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"logwolf"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/jpricardo/logwolf#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/jpricardo/logwolf/issues"
|
|
11
|
+
},
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"author": "jpricardo",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/jpricardo/logwolf.git"
|
|
17
|
+
},
|
|
18
|
+
"directories": {
|
|
19
|
+
"lib": "lib"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"./dist/logwolf-client.d.ts",
|
|
23
|
+
"./dist/logwolf-client.js",
|
|
24
|
+
"./dist/logwolf-client.js.map",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "./dist/logwolf-client.js",
|
|
29
|
+
"types": "./dist/logwolf-client.d.ts",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc && rollup -c",
|
|
32
|
+
"test": "vitest",
|
|
33
|
+
"coverage": "vitest run --coverage",
|
|
34
|
+
"prepublishOnly": "npm run build",
|
|
35
|
+
"lint": "oxlint",
|
|
36
|
+
"lint:fix": "oxlint --fix",
|
|
37
|
+
"format": "oxfmt",
|
|
38
|
+
"format:check": "oxfmt --check"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"zod": "^4.3.6"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@rollup/plugin-typescript": "12.3.0",
|
|
45
|
+
"@types/node": "24",
|
|
46
|
+
"@vitest/coverage-v8": "4.1.4",
|
|
47
|
+
"oxfmt": "0.45.0",
|
|
48
|
+
"oxlint": "1.60.0",
|
|
49
|
+
"rollup": "4.60.1",
|
|
50
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
51
|
+
"tslib": "^2.8.1",
|
|
52
|
+
"typescript": "6.0.3",
|
|
53
|
+
"vitest": "4.1.4"
|
|
54
|
+
}
|
|
55
|
+
}
|