browser-error-log-protocol 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +43 -2
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/package.json +36 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hyeonse Im
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# browser-error-log-protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Versioned TypeScript contracts for Browser Error Log SDKs, collectors, and viewers. Use them when connecting the SDK to your own backend or implementing a viewer data source.
|
|
4
|
+
|
|
5
|
+
Install directly when implementing your own collector or viewer; `browser-error-log` also brings this package in as a dependency:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install browser-error-log-protocol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For local source-checkout tarballs before publication, use Node.js 24, `npm ci`, and `npm run check:package`, then install `output/packages/browser-error-log-protocol-0.1.0.tgz` by absolute path. See the [SDK guide](https://github.com/hyeonse-swing/browser-error-log/blob/main/docs/personal-sdk.md).
|
|
12
|
+
|
|
13
|
+
## Event and query contracts
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
SCHEMA_VERSION,
|
|
18
|
+
EVENT_LABELS,
|
|
19
|
+
type ErrorEventRecord,
|
|
20
|
+
type EventBatch,
|
|
21
|
+
type EventFilter,
|
|
22
|
+
type EventPage,
|
|
23
|
+
type EventDataSource,
|
|
24
|
+
} from 'browser-error-log-protocol';
|
|
25
|
+
|
|
26
|
+
function makeBatch(events: ErrorEventRecord[]): EventBatch {
|
|
27
|
+
return { schemaVersion: SCHEMA_VERSION, events };
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- `ErrorEventRecord` describes a v1 event, including project, environment, release, event ID, occurrence time, type, message, page, runtime, and optional stack, network, and custom context fields.
|
|
32
|
+
- `EventBatch` wraps events as `{ schemaVersion: 1, events: [...] }` for ingestion.
|
|
33
|
+
- `EventFilter` supports project, environment, type, text query, time range, cursor, and limit.
|
|
34
|
+
- `EventPage` returns `events` and an optional `nextCursor`.
|
|
35
|
+
- `EventDataSource` exposes `listEvents(filter, signal?)` and `getEvent(project, eventId, signal?)` for the viewer.
|
|
36
|
+
- `EVENT_LABELS` provides English display labels. The underlying event type identifiers stay unchanged.
|
|
37
|
+
|
|
38
|
+
These are types and constants, not a runtime validator, database, or HTTP server. Treat all incoming data as untrusted and validate it at your collector. Scope deduplication and event lookup by `(project, eventId)`; different projects may use the same event ID. Use ISO timestamps and distinguish client-supplied `occurredAt` from server-owned `receivedAt`.
|
|
39
|
+
|
|
40
|
+
The [integration contract](https://github.com/hyeonse-swing/browser-error-log/blob/main/docs/integration.md) describes the HTTP API; `examples/micro-server` implements a small self-hosted collector with persistent SQLite or log-only JSONL storage. The in-memory development collector is only a demo.
|
|
41
|
+
|
|
42
|
+
## Hosting and costs
|
|
43
|
+
|
|
44
|
+
Infrastructure is not included. Hosting, servers, databases, storage, bandwidth, domains, backups, and third-party services are selected and paid for by each operator. Any charges are billed independently by their providers, not by this project or its maintainers.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var g=(r,e)=>{for(var n in e)s(r,n,{get:e[n],enumerable:!0})},p=(r,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!c.call(r,t)&&t!==n&&s(r,t,{get:()=>e[t],enumerable:!(o=i(e,t))||o.enumerable});return r};var v=r=>p(s({},"__esModule",{value:!0}),r);var l={};g(l,{EVENT_LABELS:()=>u,SCHEMA_VERSION:()=>m,SDK_VERSION:()=>E});module.exports=v(l);var m=1,E="0.1.0",u={javascript:"JavaScript",promise:"Promise",react:"React",console:"Console",http:"HTTP error",network:"Network failure",manual:"Manual"};
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export const SCHEMA_VERSION = 1 as const;\nexport const SDK_VERSION = '0.1.0';\n\nexport type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'manual';\nexport type Runtime = 'browser' | 'webview-ios' | 'webview-android' | 'unknown';\nexport interface ErrorEventRecord {\n schemaVersion: 1;\n eventId: string;\n project: string;\n environment: string;\n release: string;\n sdkVersion: string;\n occurredAt: string;\n receivedAt?: string;\n viewId: string;\n sequence: number;\n elapsedMs: number;\n type: EventType;\n message: string;\n name?: string;\n stack?: string;\n componentStack?: string;\n page: string;\n runtime: Runtime;\n browser?: string;\n context?: Record<string, string | number | boolean | null>;\n network?: { method: string; url: string; status?: number; durationMs: number };\n}\n\nexport interface EventBatch { schemaVersion: 1; events: ErrorEventRecord[] }\nexport interface EventFilter {\n project?: string;\n environment?: string;\n type?: EventType;\n query?: string;\n from?: string;\n to?: string;\n cursor?: string;\n limit?: number;\n}\nexport interface EventPage { events: ErrorEventRecord[]; nextCursor?: string }\nexport interface EventDataSource {\n listEvents(filter: EventFilter, signal?: AbortSignal): Promise<EventPage>;\n getEvent(project: string, eventId: string, signal?: AbortSignal): Promise<ErrorEventRecord | null>;\n}\n\nexport const EVENT_LABELS: Record<EventType, string> = {\n javascript: 'JavaScript', promise: 'Promise', react: 'React', console: 'Console',\n http: 'HTTP error', network: 'Network failure', manual: 'Manual',\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,mBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAL,GAAO,IAAMG,EAAiB,EACjBC,EAAc,QA6CdF,EAA0C,CACrD,WAAY,aAAc,QAAS,UAAW,MAAO,QAAS,QAAS,UACvE,KAAM,aAAc,QAAS,kBAAmB,OAAQ,QAC1D",
|
|
6
|
+
"names": ["index_exports", "__export", "EVENT_LABELS", "SCHEMA_VERSION", "SDK_VERSION", "__toCommonJS"]
|
|
7
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const SCHEMA_VERSION: 1;
|
|
2
|
+
export declare const SDK_VERSION = "0.1.0";
|
|
3
|
+
export type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'manual';
|
|
4
|
+
export type Runtime = 'browser' | 'webview-ios' | 'webview-android' | 'unknown';
|
|
5
|
+
export interface ErrorEventRecord {
|
|
6
|
+
schemaVersion: 1;
|
|
7
|
+
eventId: string;
|
|
8
|
+
project: string;
|
|
9
|
+
environment: string;
|
|
10
|
+
release: string;
|
|
11
|
+
sdkVersion: string;
|
|
12
|
+
occurredAt: string;
|
|
13
|
+
receivedAt?: string;
|
|
14
|
+
viewId: string;
|
|
15
|
+
sequence: number;
|
|
16
|
+
elapsedMs: number;
|
|
17
|
+
type: EventType;
|
|
18
|
+
message: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
stack?: string;
|
|
21
|
+
componentStack?: string;
|
|
22
|
+
page: string;
|
|
23
|
+
runtime: Runtime;
|
|
24
|
+
browser?: string;
|
|
25
|
+
context?: Record<string, string | number | boolean | null>;
|
|
26
|
+
network?: {
|
|
27
|
+
method: string;
|
|
28
|
+
url: string;
|
|
29
|
+
status?: number;
|
|
30
|
+
durationMs: number;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface EventBatch {
|
|
34
|
+
schemaVersion: 1;
|
|
35
|
+
events: ErrorEventRecord[];
|
|
36
|
+
}
|
|
37
|
+
export interface EventFilter {
|
|
38
|
+
project?: string;
|
|
39
|
+
environment?: string;
|
|
40
|
+
type?: EventType;
|
|
41
|
+
query?: string;
|
|
42
|
+
from?: string;
|
|
43
|
+
to?: string;
|
|
44
|
+
cursor?: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface EventPage {
|
|
48
|
+
events: ErrorEventRecord[];
|
|
49
|
+
nextCursor?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface EventDataSource {
|
|
52
|
+
listEvents(filter: EventFilter, signal?: AbortSignal): Promise<EventPage>;
|
|
53
|
+
getEvent(project: string, eventId: string, signal?: AbortSignal): Promise<ErrorEventRecord | null>;
|
|
54
|
+
}
|
|
55
|
+
export declare const EVENT_LABELS: Record<EventType, string>;
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/protocol/src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,EAAG,CAAU,CAAC;AACzC,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AACvG,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAChF,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,C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.0';\n\nexport type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'manual';\nexport type Runtime = 'browser' | 'webview-ios' | 'webview-android' | 'unknown';\nexport interface ErrorEventRecord {\n schemaVersion: 1;\n eventId: string;\n project: string;\n environment: string;\n release: string;\n sdkVersion: string;\n occurredAt: string;\n receivedAt?: string;\n viewId: string;\n sequence: number;\n elapsedMs: number;\n type: EventType;\n message: string;\n name?: string;\n stack?: string;\n componentStack?: string;\n page: string;\n runtime: Runtime;\n browser?: string;\n context?: Record<string, string | number | boolean | null>;\n network?: { method: string; url: string; status?: number; durationMs: number };\n}\n\nexport interface EventBatch { schemaVersion: 1; events: ErrorEventRecord[] }\nexport interface EventFilter {\n project?: string;\n environment?: string;\n type?: EventType;\n query?: string;\n from?: string;\n to?: string;\n cursor?: string;\n limit?: number;\n}\nexport interface EventPage { events: ErrorEventRecord[]; nextCursor?: string }\nexport interface EventDataSource {\n listEvents(filter: EventFilter, signal?: AbortSignal): Promise<EventPage>;\n getEvent(project: string, eventId: string, signal?: AbortSignal): Promise<ErrorEventRecord | null>;\n}\n\nexport const EVENT_LABELS: Record<EventType, string> = {\n javascript: 'JavaScript', promise: 'Promise', react: 'React', console: 'Console',\n http: 'HTTP error', network: 'Network failure', manual: 'Manual',\n};\n"],
|
|
5
|
+
"mappings": "AAAO,IAAMA,EAAiB,EACjBC,EAAc,QA6CdC,EAA0C,CACrD,WAAY,aAAc,QAAS,UAAW,MAAO,QAAS,QAAS,UACvE,KAAM,aAAc,QAAS,kBAAmB,OAAQ,QAC1D",
|
|
6
|
+
"names": ["SCHEMA_VERSION", "SDK_VERSION", "EVENT_LABELS"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-error-log-protocol",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Versioned event and query contracts for Browser Error Log collectors and viewers.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"error-monitoring",
|
|
7
|
+
"self-hosted",
|
|
8
|
+
"typescript",
|
|
9
|
+
"protocol"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public",
|
|
14
|
+
"registry": "https://registry.npmjs.org/"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/hyeonse-swing/browser-error-log.git",
|
|
32
|
+
"directory": "packages/protocol"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/hyeonse-swing/browser-error-log#readme",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/hyeonse-swing/browser-error-log/issues"
|
|
37
|
+
}
|
|
38
|
+
}
|