@ihyeon/browser-error-log-protocol 0.2.23 → 0.2.24
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.ko.md +3 -2
- package/README.md +3 -2
- package/ai/manifest.json +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -10,7 +10,7 @@ Browser Error Log SDK·수집기·뷰어를 위한 버전이 있는 TypeScript
|
|
|
10
10
|
npm install @ihyeon/browser-error-log-protocol
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
게시 패키지 대신 로컬 소스 tarball을 사용하려면 Node.js 24에서 `npm ci`, `npm run check:package`를 실행하고 `output/packages/ihyeon-browser-error-log-protocol-0.2.
|
|
13
|
+
게시 패키지 대신 로컬 소스 tarball을 사용하려면 Node.js 24에서 `npm ci`, `npm run check:package`를 실행하고 `output/packages/ihyeon-browser-error-log-protocol-0.2.24.tgz`를 절대 경로로 설치합니다. [SDK 가이드](https://github.com/hyeonse-swing/browser-error-log/blob/main/docs/ko/personal-sdk.md)를 참고하세요.
|
|
14
14
|
|
|
15
15
|
## 이벤트·조회 계약
|
|
16
16
|
|
|
@@ -33,7 +33,8 @@ function makeBatch(events: ErrorEventRecord[]): EventBatch {
|
|
|
33
33
|
- `ErrorEventRecord`는 프로젝트·환경·릴리스·이벤트 ID·발생 시각·종류·메시지·페이지·런타임과 선택적인 스택·네트워크·context를 담는 v1 이벤트입니다.
|
|
34
34
|
- `EventBatch`는 `{ schemaVersion: 1, events: [...] }`로 이벤트를 묶어 전송합니다.
|
|
35
35
|
- `getEventReference(event)`는 조회나 인수인계에 쓸 `project`와 `eventId`를 추려 `EventReference`로 반환합니다.
|
|
36
|
-
- `
|
|
36
|
+
- `formatEventReference(value)`는 `project`와 `eventId`만 포함한 복사용 JSON 문자열을 만듭니다. 유효하지 않은 참조는 `undefined`를 반환합니다.
|
|
37
|
+
- `parseEventReference(value)`는 조회 객체나 붙여 넣은 JSON 문자열 한 겹에서 조회 필드를 읽습니다. `project`와 `eventId`가 모두 비어 있지 않은 문자열이면 두 필드의 원래 값을 반환하고, 누락되거나 유효하지 않으면 `undefined`를 반환합니다. JSON 문자열을 다시 감싼 문자열은 재귀적으로 읽지 않습니다.
|
|
37
38
|
- `EventFilter`는 프로젝트·환경·종류·텍스트 검색·기간·커서·건수 제한을 지원합니다.
|
|
38
39
|
- `EventPage`는 `events`와 선택적인 `nextCursor`를 반환합니다.
|
|
39
40
|
- `EventDataSource`는 뷰어용 `listEvents(filter, signal?)`, `getEvent(project, eventId, signal?)`을 정의합니다.
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Install directly when implementing your own collector or viewer; `@ihyeon/browse
|
|
|
10
10
|
npm install @ihyeon/browser-error-log-protocol
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
For local source-checkout development, use Node.js 24, `npm ci`, and `npm run check:package`, then install `output/packages/ihyeon-browser-error-log-protocol-0.2.
|
|
13
|
+
For local source-checkout development, use Node.js 24, `npm ci`, and `npm run check:package`, then install `output/packages/ihyeon-browser-error-log-protocol-0.2.24.tgz` by absolute path. See the [SDK guide](https://github.com/hyeonse-swing/browser-error-log/blob/main/docs/personal-sdk.md).
|
|
14
14
|
|
|
15
15
|
## Event and query contracts
|
|
16
16
|
|
|
@@ -33,7 +33,8 @@ function makeBatch(events: ErrorEventRecord[]): EventBatch {
|
|
|
33
33
|
- `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.
|
|
34
34
|
- `EventBatch` wraps events as `{ schemaVersion: 1, events: [...] }` for ingestion.
|
|
35
35
|
- `getEventReference(event)` copies `project` and `eventId` into an `EventReference` for lookup or handoff.
|
|
36
|
-
- `
|
|
36
|
+
- `formatEventReference(value)` creates copyable JSON containing only `project` and `eventId`. Invalid references return `undefined`.
|
|
37
|
+
- `parseEventReference(value)` reads a lookup object or one pasted JSON string. It returns only the original `project` and `eventId` strings when both are nonblank, or `undefined` when lookup fields are missing or invalid. A string containing JSON text as another string is not decoded again.
|
|
37
38
|
- `EventFilter` supports project, environment, type, text query, time range, cursor, and limit.
|
|
38
39
|
- `EventPage` returns `events` and an optional `nextCursor`.
|
|
39
40
|
- `EventDataSource` exposes `listEvents(filter, signal?)` and `getEvent(project, eventId, signal?)` for the viewer.
|
package/ai/manifest.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of g(e))!u.call(r,n)&&n!==t&&i(r,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return r};var d=r=>f(i({},"__esModule",{value:!0}),r);var R={};p(R,{BREADCRUMB_LIMITS:()=>s,EVENT_LABELS:()=>b,SCHEMA_VERSION:()=>m,SDK_VERSION:()=>y,formatEventReference:()=>E,getEventReference:()=>v,isBreadcrumbTrail:()=>l,parseEventReference:()=>a});module.exports=d(R);var m=1,y="0.2.24",s={count:20,bytes:12e3,category:40,message:256,dataKeys:6,dataKey:80,dataString:200};function l(r){try{if(!Array.isArray(r)||r.length>s.count)return!1;for(let e of r){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>!["occurredAt","category","message","data"].includes(t))||typeof e.occurredAt!="string"||!Number.isFinite(Date.parse(e.occurredAt))||new Date(e.occurredAt).toISOString()!==e.occurredAt||typeof e.category!="string"||!e.category.trim()||e.category.length>s.category||typeof e.message!="string"||!e.message.trim()||e.message.length>s.message)return!1;if(e.data!==void 0){if(!e.data||typeof e.data!="object"||Array.isArray(e.data))return!1;let t=Object.entries(e.data);if(t.length>s.dataKeys||t.some(([o,n])=>o.length>s.dataKey||!(n===null||typeof n=="boolean"||typeof n=="string"&&n.length<=s.dataString||typeof n=="number"&&Number.isFinite(n))))return!1}}return new TextEncoder().encode(JSON.stringify(r)).length<=s.bytes}catch{return!1}}function v({project:r,eventId:e}){return{project:r,eventId:e}}function a(r){try{let e=typeof r=="string"?JSON.parse(r):r;if(!e||typeof e!="object"||Array.isArray(e))return;let t=Object.getOwnPropertyDescriptor(e,"project")?.value,o=Object.getOwnPropertyDescriptor(e,"eventId")?.value;return typeof t!="string"||!t.trim()||typeof o!="string"||!o.trim()?void 0:{project:t,eventId:o}}catch{return}}function E(r){let e=a(r);return e?JSON.stringify(e):void 0}var b={javascript:"JavaScript",promise:"Promise",react:"React",console:"Console",http:"HTTP error",network:"Network failure",resource:"Resource failure",manual:"Manual"};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export const SCHEMA_VERSION = 1 as const;\nexport const SDK_VERSION = '0.2.
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,EAAA,iBAAAC,EAAA,mBAAAC,EAAA,gBAAAC,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,wBAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["index_exports", "__export", "BREADCRUMB_LIMITS", "EVENT_LABELS", "SCHEMA_VERSION", "SDK_VERSION", "getEventReference", "isBreadcrumbTrail", "parseEventReference", "__toCommonJS", "value", "item", "key", "entries", "field", "project", "eventId"]
|
|
4
|
+
"sourcesContent": ["export const SCHEMA_VERSION = 1 as const;\nexport const SDK_VERSION = '0.2.24';\n\nexport type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'resource' | 'manual';\nexport type Runtime = 'browser' | 'webview-ios' | 'webview-android' | 'unknown';\n\nexport const BREADCRUMB_LIMITS = {\n count: 20, bytes: 12_000, category: 40, message: 256,\n dataKeys: 6, dataKey: 80, dataString: 200,\n} as const;\n\nexport interface Breadcrumb {\n occurredAt: string;\n category: string;\n message: string;\n data?: Record<string, string | number | boolean | null>;\n}\n\n/** Validates the bounded, canonical UTC breadcrumb representation on the wire. */\nexport function isBreadcrumbTrail(value: unknown): value is Breadcrumb[] {\n try {\n if (!Array.isArray(value) || value.length > BREADCRUMB_LIMITS.count) return false;\n for (const item of value) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) return false;\n if (Object.keys(item).some(key => !['occurredAt', 'category', 'message', 'data'].includes(key))) return false;\n if (typeof item.occurredAt !== 'string' || !Number.isFinite(Date.parse(item.occurredAt)) ||\n new Date(item.occurredAt).toISOString() !== item.occurredAt) return false;\n if (typeof item.category !== 'string' || !item.category.trim() || item.category.length > BREADCRUMB_LIMITS.category ||\n typeof item.message !== 'string' || !item.message.trim() || item.message.length > BREADCRUMB_LIMITS.message) return false;\n if (item.data !== undefined) {\n if (!item.data || typeof item.data !== 'object' || Array.isArray(item.data)) return false;\n const entries = Object.entries(item.data);\n if (entries.length > BREADCRUMB_LIMITS.dataKeys || entries.some(([key, field]) =>\n key.length > BREADCRUMB_LIMITS.dataKey || !(field === null || typeof field === 'boolean' ||\n (typeof field === 'string' && field.length <= BREADCRUMB_LIMITS.dataString) ||\n (typeof field === 'number' && Number.isFinite(field))))) return false;\n }\n }\n return new TextEncoder().encode(JSON.stringify(value)).length <= BREADCRUMB_LIMITS.bytes;\n } catch { return false; }\n}\n\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 breadcrumbs?: Breadcrumb[];\n network?: { method: string; url: string; status?: number; durationMs: number };\n}\n\n/** Fields used together to look up a stored event within its project. */\nexport type EventReference = Pick<ErrorEventRecord, 'project' | 'eventId'>;\n\nexport function getEventReference({ project, eventId }: EventReference): EventReference {\n return { project, eventId };\n}\n\n/** Read lookup fields from a JSON object or a single pasted JSON string. */\nexport function parseEventReference(value: unknown): EventReference | undefined {\n try {\n const input: unknown = typeof value === 'string' ? JSON.parse(value) : value;\n if (!input || typeof input !== 'object' || Array.isArray(input)) return undefined;\n const project = Object.getOwnPropertyDescriptor(input, 'project')?.value;\n const eventId = Object.getOwnPropertyDescriptor(input, 'eventId')?.value;\n if (typeof project !== 'string' || !project.trim() || typeof eventId !== 'string' || !eventId.trim()) return undefined;\n return { project, eventId };\n } catch {\n return undefined;\n }\n}\n\n/** Serialize only the two lookup fields for a support handoff. */\nexport function formatEventReference(value: unknown): string | undefined {\n const reference = parseEventReference(value);\n return reference ? JSON.stringify(reference) : undefined;\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', resource: 'Resource failure', manual: 'Manual',\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,EAAA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AU,UAAYA,EAAM,QAAUb,EAAkB,YAC/D,OAAOa,GAAU,UAAY,OAAO,SAASA,CAAK,EAAG,EAAG,MAAO,EACtE,CACF,CACA,OAAO,IAAI,YAAY,EAAE,OAAO,KAAK,UAAUJ,CAAK,CAAC,EAAE,QAAUT,EAAkB,KACrF,MAAQ,CAAE,MAAO,EAAO,CAC1B,CA8BO,SAASK,EAAkB,CAAE,QAAAS,EAAS,QAAAC,CAAQ,EAAmC,CACtF,MAAO,CAAE,QAAAD,EAAS,QAAAC,CAAQ,CAC5B,CAGO,SAASR,EAAoBE,EAA4C,CAC9E,GAAI,CACF,IAAMO,EAAiB,OAAOP,GAAU,SAAW,KAAK,MAAMA,CAAK,EAAIA,EACvE,GAAI,CAACO,GAAS,OAAOA,GAAU,UAAY,MAAM,QAAQA,CAAK,EAAG,OACjE,IAAMF,EAAU,OAAO,yBAAyBE,EAAO,SAAS,GAAG,MAC7DD,EAAU,OAAO,yBAAyBC,EAAO,SAAS,GAAG,MACnE,OAAI,OAAOF,GAAY,UAAY,CAACA,EAAQ,KAAK,GAAK,OAAOC,GAAY,UAAY,CAACA,EAAQ,KAAK,EAAG,OAC/F,CAAE,QAAAD,EAAS,QAAAC,CAAQ,CAC5B,MAAQ,CACN,MACF,CACF,CAGO,SAASX,EAAqBK,EAAoC,CACvE,IAAMQ,EAAYV,EAAoBE,CAAK,EAC3C,OAAOQ,EAAY,KAAK,UAAUA,CAAS,EAAI,MACjD,CAmBO,IAAMhB,EAA0C,CACrD,WAAY,aAAc,QAAS,UAAW,MAAO,QAAS,QAAS,UACvE,KAAM,aAAc,QAAS,kBAAmB,SAAU,mBAAoB,OAAQ,QACxF",
|
|
6
|
+
"names": ["index_exports", "__export", "BREADCRUMB_LIMITS", "EVENT_LABELS", "SCHEMA_VERSION", "SDK_VERSION", "formatEventReference", "getEventReference", "isBreadcrumbTrail", "parseEventReference", "__toCommonJS", "value", "item", "key", "entries", "field", "project", "eventId", "input", "reference"]
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const SCHEMA_VERSION: 1;
|
|
2
|
-
export declare const SDK_VERSION = "0.2.
|
|
2
|
+
export declare const SDK_VERSION = "0.2.24";
|
|
3
3
|
export type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'resource' | 'manual';
|
|
4
4
|
export type Runtime = 'browser' | 'webview-ios' | 'webview-android' | 'unknown';
|
|
5
5
|
export declare const BREADCRUMB_LIMITS: {
|
|
@@ -51,8 +51,10 @@ export interface ErrorEventRecord {
|
|
|
51
51
|
/** Fields used together to look up a stored event within its project. */
|
|
52
52
|
export type EventReference = Pick<ErrorEventRecord, 'project' | 'eventId'>;
|
|
53
53
|
export declare function getEventReference({ project, eventId }: EventReference): EventReference;
|
|
54
|
-
/** Read lookup fields from a
|
|
54
|
+
/** Read lookup fields from a JSON object or a single pasted JSON string. */
|
|
55
55
|
export declare function parseEventReference(value: unknown): EventReference | undefined;
|
|
56
|
+
/** Serialize only the two lookup fields for a support handoff. */
|
|
57
|
+
export declare function formatEventReference(value: unknown): string | undefined;
|
|
56
58
|
export interface EventBatch {
|
|
57
59
|
schemaVersion: 1;
|
|
58
60
|
events: ErrorEventRecord[];
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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,WAAW,CAAC;AAEpC,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AACpH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAEhF,eAAO,MAAM,iBAAiB;aAC5B,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AAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAW9E;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGvE;AAED,MAAM,WAAW,UAAU;IAAG,aAAa,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,gBAAgB,EAAE,CAAA;CAAE;AAC5E,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,SAAS;IAAG,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;AAC9E,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CACpG;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAGlD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=1,c="0.2.24",n={count:20,bytes:12e3,category:40,message:256,dataKeys:6,dataKey:80,dataString:200};function g(r){try{if(!Array.isArray(r)||r.length>n.count)return!1;for(let e of r){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>!["occurredAt","category","message","data"].includes(t))||typeof e.occurredAt!="string"||!Number.isFinite(Date.parse(e.occurredAt))||new Date(e.occurredAt).toISOString()!==e.occurredAt||typeof e.category!="string"||!e.category.trim()||e.category.length>n.category||typeof e.message!="string"||!e.message.trim()||e.message.length>n.message)return!1;if(e.data!==void 0){if(!e.data||typeof e.data!="object"||Array.isArray(e.data))return!1;let t=Object.entries(e.data);if(t.length>n.dataKeys||t.some(([s,o])=>s.length>n.dataKey||!(o===null||typeof o=="boolean"||typeof o=="string"&&o.length<=n.dataString||typeof o=="number"&&Number.isFinite(o))))return!1}}return new TextEncoder().encode(JSON.stringify(r)).length<=n.bytes}catch{return!1}}function u({project:r,eventId:e}){return{project:r,eventId:e}}function i(r){try{let e=typeof r=="string"?JSON.parse(r):r;if(!e||typeof e!="object"||Array.isArray(e))return;let t=Object.getOwnPropertyDescriptor(e,"project")?.value,s=Object.getOwnPropertyDescriptor(e,"eventId")?.value;return typeof t!="string"||!t.trim()||typeof s!="string"||!s.trim()?void 0:{project:t,eventId:s}}catch{return}}function p(r){let e=i(r);return e?JSON.stringify(e):void 0}var f={javascript:"JavaScript",promise:"Promise",react:"React",console:"Console",http:"HTTP error",network:"Network failure",resource:"Resource failure",manual:"Manual"};export{n as BREADCRUMB_LIMITS,f as EVENT_LABELS,a as SCHEMA_VERSION,c as SDK_VERSION,p as formatEventReference,u as getEventReference,g as isBreadcrumbTrail,i as parseEventReference};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export const SCHEMA_VERSION = 1 as const;\nexport const SDK_VERSION = '0.2.
|
|
5
|
-
"mappings": "AAAO,IAAMA,EAAiB,EACjBC,EAAc,SAKdC,EAAoB,CAC/B,MAAO,GAAI,MAAO,K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,MAAQ,CAAE,MAAO,EAAO,CAC1B,CA8BO,SAASO,EAAkB,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAmC,CACtF,MAAO,CAAE,QAAAD,EAAS,QAAAC,CAAQ,CAC5B,CAGO,SAASC,EAAoBR,EAA4C,CAC9E,GAAI,CACF,GAAI,
|
|
6
|
-
"names": ["SCHEMA_VERSION", "SDK_VERSION", "BREADCRUMB_LIMITS", "isBreadcrumbTrail", "value", "item", "key", "entries", "field", "getEventReference", "project", "eventId", "parseEventReference", "EVENT_LABELS"]
|
|
4
|
+
"sourcesContent": ["export const SCHEMA_VERSION = 1 as const;\nexport const SDK_VERSION = '0.2.24';\n\nexport type EventType = 'javascript' | 'promise' | 'react' | 'console' | 'http' | 'network' | 'resource' | 'manual';\nexport type Runtime = 'browser' | 'webview-ios' | 'webview-android' | 'unknown';\n\nexport const BREADCRUMB_LIMITS = {\n count: 20, bytes: 12_000, category: 40, message: 256,\n dataKeys: 6, dataKey: 80, dataString: 200,\n} as const;\n\nexport interface Breadcrumb {\n occurredAt: string;\n category: string;\n message: string;\n data?: Record<string, string | number | boolean | null>;\n}\n\n/** Validates the bounded, canonical UTC breadcrumb representation on the wire. */\nexport function isBreadcrumbTrail(value: unknown): value is Breadcrumb[] {\n try {\n if (!Array.isArray(value) || value.length > BREADCRUMB_LIMITS.count) return false;\n for (const item of value) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) return false;\n if (Object.keys(item).some(key => !['occurredAt', 'category', 'message', 'data'].includes(key))) return false;\n if (typeof item.occurredAt !== 'string' || !Number.isFinite(Date.parse(item.occurredAt)) ||\n new Date(item.occurredAt).toISOString() !== item.occurredAt) return false;\n if (typeof item.category !== 'string' || !item.category.trim() || item.category.length > BREADCRUMB_LIMITS.category ||\n typeof item.message !== 'string' || !item.message.trim() || item.message.length > BREADCRUMB_LIMITS.message) return false;\n if (item.data !== undefined) {\n if (!item.data || typeof item.data !== 'object' || Array.isArray(item.data)) return false;\n const entries = Object.entries(item.data);\n if (entries.length > BREADCRUMB_LIMITS.dataKeys || entries.some(([key, field]) =>\n key.length > BREADCRUMB_LIMITS.dataKey || !(field === null || typeof field === 'boolean' ||\n (typeof field === 'string' && field.length <= BREADCRUMB_LIMITS.dataString) ||\n (typeof field === 'number' && Number.isFinite(field))))) return false;\n }\n }\n return new TextEncoder().encode(JSON.stringify(value)).length <= BREADCRUMB_LIMITS.bytes;\n } catch { return false; }\n}\n\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 breadcrumbs?: Breadcrumb[];\n network?: { method: string; url: string; status?: number; durationMs: number };\n}\n\n/** Fields used together to look up a stored event within its project. */\nexport type EventReference = Pick<ErrorEventRecord, 'project' | 'eventId'>;\n\nexport function getEventReference({ project, eventId }: EventReference): EventReference {\n return { project, eventId };\n}\n\n/** Read lookup fields from a JSON object or a single pasted JSON string. */\nexport function parseEventReference(value: unknown): EventReference | undefined {\n try {\n const input: unknown = typeof value === 'string' ? JSON.parse(value) : value;\n if (!input || typeof input !== 'object' || Array.isArray(input)) return undefined;\n const project = Object.getOwnPropertyDescriptor(input, 'project')?.value;\n const eventId = Object.getOwnPropertyDescriptor(input, 'eventId')?.value;\n if (typeof project !== 'string' || !project.trim() || typeof eventId !== 'string' || !eventId.trim()) return undefined;\n return { project, eventId };\n } catch {\n return undefined;\n }\n}\n\n/** Serialize only the two lookup fields for a support handoff. */\nexport function formatEventReference(value: unknown): string | undefined {\n const reference = parseEventReference(value);\n return reference ? JSON.stringify(reference) : undefined;\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', resource: 'Resource failure', manual: 'Manual',\n};\n"],
|
|
5
|
+
"mappings": "AAAO,IAAMA,EAAiB,EACjBC,EAAc,SAKdC,EAAoB,CAC/B,MAAO,GAAI,MAAO,KAAQ,SAAU,GAAI,QAAS,IACjD,SAAU,EAAG,QAAS,GAAI,WAAY,GACxC,EAUO,SAASC,EAAkBC,EAAuC,CACvE,GAAI,CACF,GAAI,CAAC,MAAM,QAAQA,CAAK,GAAKA,EAAM,OAASF,EAAkB,MAAO,MAAO,GAC5E,QAAWG,KAAQD,EAAO,CAKxB,GAJI,CAACC,GAAQ,OAAOA,GAAS,UAAY,MAAM,QAAQA,CAAI,GACvD,OAAO,KAAKA,CAAI,EAAE,KAAKC,GAAO,CAAC,CAAC,aAAc,WAAY,UAAW,MAAM,EAAE,SAASA,CAAG,CAAC,GAC1F,OAAOD,EAAK,YAAe,UAAY,CAAC,OAAO,SAAS,KAAK,MAAMA,EAAK,UAAU,CAAC,GACnF,IAAI,KAAKA,EAAK,UAAU,EAAE,YAAY,IAAMA,EAAK,YACjD,OAAOA,EAAK,UAAa,UAAY,CAACA,EAAK,SAAS,KAAK,GAAKA,EAAK,SAAS,OAASH,EAAkB,UACvG,OAAOG,EAAK,SAAY,UAAY,CAACA,EAAK,QAAQ,KAAK,GAAKA,EAAK,QAAQ,OAASH,EAAkB,QAAS,MAAO,GACxH,GAAIG,EAAK,OAAS,OAAW,CAC3B,GAAI,CAACA,EAAK,MAAQ,OAAOA,EAAK,MAAS,UAAY,MAAM,Q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kBAAmB,SAAU,mBAAoB,OAAQ,QACxF",
|
|
6
|
+
"names": ["SCHEMA_VERSION", "SDK_VERSION", "BREADCRUMB_LIMITS", "isBreadcrumbTrail", "value", "item", "key", "entries", "field", "getEventReference", "project", "eventId", "parseEventReference", "input", "formatEventReference", "reference", "EVENT_LABELS"]
|
|
7
7
|
}
|