@oconde/radar 0.1.0 → 0.2.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.
@@ -1,5 +1,9 @@
1
1
  declare const PROTOCOL_VERSION = 1;
2
2
  declare const INGEST_PATH = "/api/v1/events";
3
+ declare const CHECKIN_PATH = "/api/v1/checkins/";
4
+ declare const RELEASES_PATH = "/api/v1/releases/";
5
+ declare const CHECKIN_SLUG: RegExp;
6
+ declare const CHECKIN_STATUSES: readonly ["in_progress", "ok", "error"];
3
7
  declare const LIMITS: {
4
8
  readonly batchBytes: 1000000;
5
9
  readonly batchEvents: 500;
@@ -16,6 +20,7 @@ declare const LIMITS: {
16
20
  readonly depth: 6;
17
21
  readonly arrayItems: 50;
18
22
  readonly requestIdLength: 128;
23
+ readonly checkInIdLength: 64;
19
24
  };
20
25
  type LogLevel = 'debug' | 'info' | 'warn' | 'error';
21
26
  type EventBatch = {
@@ -100,12 +105,32 @@ type IngestResponse = {
100
105
  accepted: number;
101
106
  dropped: number;
102
107
  };
103
- type IngestErrorCode = 'invalid_key' | 'account_disabled' | 'payload_too_large' | 'invalid_batch' | 'quota_exceeded' | 'rate_limited';
108
+ type IngestErrorCode = 'invalid_key' | 'account_disabled' | 'payload_too_large' | 'invalid_batch' | 'quota_exceeded' | 'rate_limited' | 'unknown_monitor' | 'invalid_checkin';
104
109
  type IngestError = {
105
110
  error: {
106
111
  code: IngestErrorCode;
107
112
  message: string;
108
113
  };
109
114
  };
115
+ type CheckInStatus = (typeof CHECKIN_STATUSES)[number];
116
+ type CheckInPayload = {
117
+ status: CheckInStatus;
118
+ checkInId?: string;
119
+ durationMs?: number;
120
+ environment?: string;
121
+ release?: string;
122
+ };
123
+ type ReleaseSummary = {
124
+ release: string;
125
+ firstSeen: string | null;
126
+ newIssues: number;
127
+ events: number;
128
+ issues: {
129
+ title: string;
130
+ culprit: string | null;
131
+ count: number;
132
+ url: string;
133
+ }[];
134
+ };
110
135
 
111
- export { type ErrorEvent, type EventBatch, type ExceptionInfo, INGEST_PATH, type IngestError, type IngestErrorCode, type IngestResponse, LIMITS, type LogEvent, type LogLevel, PROTOCOL_VERSION, type RadarEvent, type RequestInfo, type RuntimeInfo, type StackFrame, type UserInfo };
136
+ export { CHECKIN_PATH, CHECKIN_SLUG, CHECKIN_STATUSES, type CheckInPayload, type CheckInStatus, type ErrorEvent, type EventBatch, type ExceptionInfo, INGEST_PATH, type IngestError, type IngestErrorCode, type IngestResponse, LIMITS, type LogEvent, type LogLevel, PROTOCOL_VERSION, RELEASES_PATH, type RadarEvent, type ReleaseSummary, type RequestInfo, type RuntimeInfo, type StackFrame, type UserInfo };
@@ -1,6 +1,10 @@
1
1
  // src/protocol/index.ts
2
2
  var PROTOCOL_VERSION = 1;
3
3
  var INGEST_PATH = "/api/v1/events";
4
+ var CHECKIN_PATH = "/api/v1/checkins/";
5
+ var RELEASES_PATH = "/api/v1/releases/";
6
+ var CHECKIN_SLUG = /^[a-z0-9][a-z0-9-]{0,63}$/;
7
+ var CHECKIN_STATUSES = ["in_progress", "ok", "error"];
4
8
  var LIMITS = {
5
9
  batchBytes: 1e6,
6
10
  batchEvents: 500,
@@ -16,11 +20,16 @@ var LIMITS = {
16
20
  causeDepth: 5,
17
21
  depth: 6,
18
22
  arrayItems: 50,
19
- requestIdLength: 128
23
+ requestIdLength: 128,
24
+ checkInIdLength: 64
20
25
  };
21
26
  export {
27
+ CHECKIN_PATH,
28
+ CHECKIN_SLUG,
29
+ CHECKIN_STATUSES,
22
30
  INGEST_PATH,
23
31
  LIMITS,
24
- PROTOCOL_VERSION
32
+ PROTOCOL_VERSION,
33
+ RELEASES_PATH
25
34
  };
26
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/protocol/index.ts"],"sourcesContent":["export const PROTOCOL_VERSION = 1;\n\nexport const INGEST_PATH = '/api/v1/events';\n\nexport const LIMITS = {\n batchBytes: 1_000_000,\n batchEvents: 500,\n messageLength: 2000,\n stringLength: 2000,\n attrsBytes: 16_384,\n bodyBytes: 16_384,\n headers: 50,\n frames: 50,\n contextFrames: 10,\n contextLines: 5,\n contextLineLength: 300,\n causeDepth: 5,\n depth: 6,\n arrayItems: 50,\n requestIdLength: 128,\n} as const;\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nexport type EventBatch = {\n v: 1;\n sdk: { name: string; version: string };\n environment?: string;\n release?: string;\n dropped?: number;\n events: RadarEvent[];\n};\n\nexport type RadarEvent = LogEvent | ErrorEvent;\n\nexport type LogEvent = {\n type: 'log';\n ts: number;\n level: LogLevel;\n message: string;\n requestId?: string;\n attrs?: Record<string, unknown>;\n request?: RequestInfo;\n user?: UserInfo;\n};\n\nexport type ErrorEvent = {\n type: 'error';\n ts: number;\n level: 'error' | 'fatal';\n handled: boolean;\n requestId?: string;\n exception: ExceptionInfo;\n request?: RequestInfo;\n user?: UserInfo;\n runtime?: RuntimeInfo;\n attrs?: Record<string, unknown>;\n};\n\nexport type ExceptionInfo = {\n type: string;\n message: string;\n frames: StackFrame[];\n cause?: ExceptionInfo;\n};\n\nexport type StackFrame = {\n fn?: string;\n file: string;\n line?: number;\n col?: number;\n inApp: boolean;\n context?: { pre: string[]; line: string; post: string[] };\n};\n\nexport type RequestInfo = {\n method: string;\n url: string;\n route?: string;\n params?: Record<string, string>;\n query?: Record<string, unknown>;\n headers?: Record<string, string>;\n body?: unknown;\n ip?: string;\n userAgent?: string;\n status?: number;\n durationMs?: number;\n};\n\nexport type UserInfo = { id?: string; email?: string; name?: string };\n\nexport type RuntimeInfo = {\n name: 'node';\n version: string;\n host?: string;\n pid?: number;\n memoryMb?: number;\n uptimeS?: number;\n};\n\nexport type IngestResponse = { accepted: number; dropped: number };\n\nexport type IngestErrorCode =\n | 'invalid_key'\n | 'account_disabled'\n | 'payload_too_large'\n | 'invalid_batch'\n | 'quota_exceeded'\n | 'rate_limited';\n\nexport type IngestError = { error: { code: IngestErrorCode; message: string } };\n"],"mappings":";AAAO,IAAM,mBAAmB;AAEzB,IAAM,cAAc;AAEpB,IAAM,SAAS;AAAA,EACpB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,iBAAiB;AACnB;","names":[]}
1
+ {"version":3,"sources":["../../src/protocol/index.ts"],"sourcesContent":["export const PROTOCOL_VERSION = 1;\n\nexport const INGEST_PATH = '/api/v1/events';\n\nexport const CHECKIN_PATH = '/api/v1/checkins/';\n\nexport const RELEASES_PATH = '/api/v1/releases/';\n\nexport const CHECKIN_SLUG = /^[a-z0-9][a-z0-9-]{0,63}$/;\n\nexport const CHECKIN_STATUSES = ['in_progress', 'ok', 'error'] as const;\n\nexport const LIMITS = {\n batchBytes: 1_000_000,\n batchEvents: 500,\n messageLength: 2000,\n stringLength: 2000,\n attrsBytes: 16_384,\n bodyBytes: 16_384,\n headers: 50,\n frames: 50,\n contextFrames: 10,\n contextLines: 5,\n contextLineLength: 300,\n causeDepth: 5,\n depth: 6,\n arrayItems: 50,\n requestIdLength: 128,\n checkInIdLength: 64,\n} as const;\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nexport type EventBatch = {\n v: 1;\n sdk: { name: string; version: string };\n environment?: string;\n release?: string;\n dropped?: number;\n events: RadarEvent[];\n};\n\nexport type RadarEvent = LogEvent | ErrorEvent;\n\nexport type LogEvent = {\n type: 'log';\n ts: number;\n level: LogLevel;\n message: string;\n requestId?: string;\n attrs?: Record<string, unknown>;\n request?: RequestInfo;\n user?: UserInfo;\n};\n\nexport type ErrorEvent = {\n type: 'error';\n ts: number;\n level: 'error' | 'fatal';\n handled: boolean;\n requestId?: string;\n exception: ExceptionInfo;\n request?: RequestInfo;\n user?: UserInfo;\n runtime?: RuntimeInfo;\n attrs?: Record<string, unknown>;\n};\n\nexport type ExceptionInfo = {\n type: string;\n message: string;\n frames: StackFrame[];\n cause?: ExceptionInfo;\n};\n\nexport type StackFrame = {\n fn?: string;\n file: string;\n line?: number;\n col?: number;\n inApp: boolean;\n context?: { pre: string[]; line: string; post: string[] };\n};\n\nexport type RequestInfo = {\n method: string;\n url: string;\n route?: string;\n params?: Record<string, string>;\n query?: Record<string, unknown>;\n headers?: Record<string, string>;\n body?: unknown;\n ip?: string;\n userAgent?: string;\n status?: number;\n durationMs?: number;\n};\n\nexport type UserInfo = { id?: string; email?: string; name?: string };\n\nexport type RuntimeInfo = {\n name: 'node';\n version: string;\n host?: string;\n pid?: number;\n memoryMb?: number;\n uptimeS?: number;\n};\n\nexport type IngestResponse = { accepted: number; dropped: number };\n\nexport type IngestErrorCode =\n | 'invalid_key'\n | 'account_disabled'\n | 'payload_too_large'\n | 'invalid_batch'\n | 'quota_exceeded'\n | 'rate_limited'\n | 'unknown_monitor'\n | 'invalid_checkin';\n\nexport type IngestError = { error: { code: IngestErrorCode; message: string } };\n\nexport type CheckInStatus = (typeof CHECKIN_STATUSES)[number];\n\nexport type CheckInPayload = {\n status: CheckInStatus;\n checkInId?: string;\n durationMs?: number;\n environment?: string;\n release?: string;\n};\n\nexport type ReleaseSummary = {\n release: string;\n firstSeen: string | null;\n newIssues: number;\n events: number;\n issues: { title: string; culprit: string | null; count: number; url: string }[];\n};\n"],"mappings":";AAAO,IAAM,mBAAmB;AAEzB,IAAM,cAAc;AAEpB,IAAM,eAAe;AAErB,IAAM,gBAAgB;AAEtB,IAAM,eAAe;AAErB,IAAM,mBAAmB,CAAC,eAAe,MAAM,OAAO;AAEtD,IAAM,SAAS;AAAA,EACpB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}