@lensmcp/protocol-types 1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/lib/attributes.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,203 @@
1
+ import { z } from 'zod';
2
+ // ---------- render ----------
3
+ export const RenderPhaseSchema = z.enum(['mount', 'update']);
4
+ export const RenderWhySchema = z.discriminatedUnion('type', [
5
+ z.object({ type: z.literal('props'), changedKeys: z.array(z.string()) }),
6
+ z.object({ type: z.literal('react-state'), hookIndex: z.number().int() }),
7
+ z.object({ type: z.literal('context'), contextName: z.string() }),
8
+ z.object({
9
+ type: z.literal('valtio-path'),
10
+ path: z.string(),
11
+ changedKeys: z.array(z.string()),
12
+ }),
13
+ z.object({
14
+ type: z.literal('parent-render'),
15
+ parentRenderId: z.string(),
16
+ }),
17
+ z.object({
18
+ type: z.literal('hook-dep-changed'),
19
+ hookInstanceId: z.string(),
20
+ depsHashBefore: z.string(),
21
+ depsHashAfter: z.string(),
22
+ }),
23
+ z.object({ type: z.literal('force'), reason: z.string() }),
24
+ ]);
25
+ export const RenderAttrsSchema = z.object({
26
+ phase: RenderPhaseSchema,
27
+ actualDurationMs: z.number().nonnegative(),
28
+ baseDurationMs: z.number().nonnegative(),
29
+ startTime: z.number().nonnegative(),
30
+ commitTime: z.number().nonnegative(),
31
+ why: z.array(RenderWhySchema),
32
+ });
33
+ // ---------- effect-run ----------
34
+ export const EffectRunAttrsSchema = z.object({
35
+ hookInstanceId: z.string(),
36
+ depsHash: z.string(),
37
+ prevDepsHash: z.string().optional(),
38
+ durationMs: z.number().nonnegative(),
39
+ cleanupRan: z.boolean().optional(),
40
+ });
41
+ // ---------- valtio update (state-update kind) ----------
42
+ export const ValtioUpdateAttrsSchema = z.object({
43
+ storeId: z.string(),
44
+ path: z.string(),
45
+ changedKeys: z.array(z.string()),
46
+ beforeHash: z.string(),
47
+ afterHash: z.string(),
48
+ preview: z.unknown().optional(),
49
+ });
50
+ // ---------- server-request ----------
51
+ export const ServerRequestAttrsSchema = z.object({
52
+ method: z.string(),
53
+ route: z.string(),
54
+ status: z.number().int().optional(),
55
+ durationMs: z.number().nonnegative().optional(),
56
+ traceparent: z.string().optional(),
57
+ });
58
+ // ---------- loop ----------
59
+ export const LoopPatternSchema = z.enum([
60
+ 'N+1',
61
+ 'sequential-await',
62
+ 'growing-allocation',
63
+ ]);
64
+ export const LoopAttrsSchema = z.object({
65
+ iterations: z.number().int().nonnegative(),
66
+ durationMs: z.number().nonnegative(),
67
+ dbCallsInsideLoop: z.number().int().nonnegative(),
68
+ redisCallsInsideLoop: z.number().int().nonnegative(),
69
+ awaitedOperationsInsideLoop: z.number().int().nonnegative(),
70
+ slowestIterations: z
71
+ .array(z.object({
72
+ index: z.number().int().nonnegative(),
73
+ durationMs: z.number().nonnegative(),
74
+ childNodeIds: z.array(z.string()),
75
+ }))
76
+ .optional(),
77
+ patterns: z.array(LoopPatternSchema).optional(),
78
+ });
79
+ // ---------- memory ----------
80
+ export const MemoryContainerKindSchema = z.enum([
81
+ 'Map',
82
+ 'Set',
83
+ 'Array',
84
+ 'EventEmitter',
85
+ 'Queue',
86
+ 'RxSubject',
87
+ 'Timer',
88
+ 'Interval',
89
+ 'Custom',
90
+ ]);
91
+ export const MemoryOwnerAttrsSchema = z.object({
92
+ ownerInstanceId: z.string(),
93
+ containerKind: MemoryContainerKindSchema,
94
+ fieldName: z.string(),
95
+ itemCount: z.number().int().nonnegative(),
96
+ estimatedBytes: z.number().nonnegative(),
97
+ retainedBytes: z.number().nonnegative().optional(),
98
+ growthSinceStart: z.number(),
99
+ });
100
+ export const MemoryMutationOperationSchema = z.enum([
101
+ 'set',
102
+ 'push',
103
+ 'add',
104
+ 'delete',
105
+ 'clear',
106
+ 'subscribe',
107
+ 'listen',
108
+ 'schedule',
109
+ ]);
110
+ export const MemoryMutationAttrsSchema = z.object({
111
+ ownerNodeId: z.string(),
112
+ operation: MemoryMutationOperationSchema,
113
+ beforeCount: z.number().int().nonnegative(),
114
+ afterCount: z.number().int().nonnegative(),
115
+ estimatedDeltaBytes: z.number(),
116
+ keyPreview: z.string().optional(),
117
+ valueType: z.string().optional(),
118
+ });
119
+ // ---------- visual ----------
120
+ export const RectSchema = z.object({
121
+ x: z.number(),
122
+ y: z.number(),
123
+ width: z.number().nonnegative(),
124
+ height: z.number().nonnegative(),
125
+ });
126
+ export const VisualFrameCauseSchema = z.enum([
127
+ 'page-load',
128
+ 'route-change',
129
+ 'user-action',
130
+ 'react-commit',
131
+ 'state-update',
132
+ 'api-response',
133
+ 'hmr-update',
134
+ 'animation-tick',
135
+ ]);
136
+ export const VisualChangeKindSchema = z.enum([
137
+ 'computed-style',
138
+ 'layout',
139
+ 'paint-order',
140
+ ]);
141
+ export const VisualFrameAttrsSchema = z.object({
142
+ causedBy: VisualFrameCauseSchema,
143
+ viewport: RectSchema,
144
+ layoutSnapshotId: z.string(),
145
+ styleSnapshotId: z.string(),
146
+ screenshotId: z.string().optional(),
147
+ changedNodes: z.array(z.object({
148
+ uid: z.string(),
149
+ component: z.string().optional(),
150
+ change: VisualChangeKindSchema,
151
+ property: z.string().optional(),
152
+ before: z.unknown().optional(),
153
+ after: z.unknown().optional(),
154
+ })),
155
+ });
156
+ export const VisualRuleTypeSchema = z.enum([
157
+ 'grid-spacing',
158
+ 'alignment',
159
+ 'overflow',
160
+ 'text-clipping',
161
+ 'color-contrast',
162
+ 'token-usage',
163
+ 'z-index',
164
+ 'responsive',
165
+ 'custom',
166
+ ]);
167
+ export const VisualRuleTimingSchema = z.enum([
168
+ 'always',
169
+ 'after-animation',
170
+ 'stable-only',
171
+ 'during-animation',
172
+ ]);
173
+ export const VisualViolationSeveritySchema = z.enum([
174
+ 'info',
175
+ 'warning',
176
+ 'error',
177
+ ]);
178
+ export const VisualViolationAttrsSchema = z.object({
179
+ ruleId: z.string(),
180
+ ruleType: VisualRuleTypeSchema,
181
+ severity: VisualViolationSeveritySchema,
182
+ timing: VisualRuleTimingSchema,
183
+ element: z.object({
184
+ uid: z.string(),
185
+ component: z.string().optional(),
186
+ rect: RectSchema,
187
+ }),
188
+ expected: z.record(z.string(), z.unknown()),
189
+ actual: z.record(z.string(), z.unknown()),
190
+ evidence: z.object({
191
+ computedStyle: z.string().optional(),
192
+ screenshotCrop: z.string().optional(),
193
+ trace: z.string().optional(),
194
+ cssCause: z
195
+ .object({
196
+ selector: z.string(),
197
+ file: z.string().optional(),
198
+ line: z.number().int().optional(),
199
+ declaration: z.string().optional(),
200
+ })
201
+ .optional(),
202
+ }),
203
+ });
@@ -0,0 +1,66 @@
1
+ import { z } from 'zod';
2
+ export declare const FlowOriginTypeSchema: z.ZodEnum<{
3
+ "user-click": "user-click";
4
+ "user-input": "user-input";
5
+ keyboard: "keyboard";
6
+ "route-load": "route-load";
7
+ effect: "effect";
8
+ "memo-recompute": "memo-recompute";
9
+ timer: "timer";
10
+ raf: "raf";
11
+ "idle-callback": "idle-callback";
12
+ "websocket-message": "websocket-message";
13
+ "broadcast-channel": "broadcast-channel";
14
+ "post-message": "post-message";
15
+ "storage-event": "storage-event";
16
+ "service-worker-message": "service-worker-message";
17
+ "media-query-change": "media-query-change";
18
+ "visibility-change": "visibility-change";
19
+ resize: "resize";
20
+ "intersection-observer": "intersection-observer";
21
+ "mutation-observer": "mutation-observer";
22
+ "backend-response": "backend-response";
23
+ "hmr-update": "hmr-update";
24
+ }>;
25
+ export type FlowOriginType = z.infer<typeof FlowOriginTypeSchema>;
26
+ export declare const TraceContextSchema: z.ZodObject<{
27
+ sessionId: z.ZodString;
28
+ browserContextId: z.ZodOptional<z.ZodString>;
29
+ tabId: z.ZodOptional<z.ZodString>;
30
+ frameId: z.ZodOptional<z.ZodString>;
31
+ route: z.ZodOptional<z.ZodString>;
32
+ url: z.ZodOptional<z.ZodString>;
33
+ flowId: z.ZodOptional<z.ZodString>;
34
+ originType: z.ZodOptional<z.ZodEnum<{
35
+ "user-click": "user-click";
36
+ "user-input": "user-input";
37
+ keyboard: "keyboard";
38
+ "route-load": "route-load";
39
+ effect: "effect";
40
+ "memo-recompute": "memo-recompute";
41
+ timer: "timer";
42
+ raf: "raf";
43
+ "idle-callback": "idle-callback";
44
+ "websocket-message": "websocket-message";
45
+ "broadcast-channel": "broadcast-channel";
46
+ "post-message": "post-message";
47
+ "storage-event": "storage-event";
48
+ "service-worker-message": "service-worker-message";
49
+ "media-query-change": "media-query-change";
50
+ "visibility-change": "visibility-change";
51
+ resize: "resize";
52
+ "intersection-observer": "intersection-observer";
53
+ "mutation-observer": "mutation-observer";
54
+ "backend-response": "backend-response";
55
+ "hmr-update": "hmr-update";
56
+ }>>;
57
+ originNodeId: z.ZodOptional<z.ZodString>;
58
+ causedByNodeId: z.ZodOptional<z.ZodString>;
59
+ requestId: z.ZodOptional<z.ZodString>;
60
+ traceparent: z.ZodOptional<z.ZodString>;
61
+ userActionId: z.ZodOptional<z.ZodString>;
62
+ userIdHash: z.ZodOptional<z.ZodString>;
63
+ tenantIdHash: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>;
65
+ export type TraceContext = z.infer<typeof TraceContextSchema>;
66
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/lib/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;EAsB/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoB7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
package/lib/context.js ADDED
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ export const FlowOriginTypeSchema = z.enum([
3
+ 'user-click',
4
+ 'user-input',
5
+ 'keyboard',
6
+ 'route-load',
7
+ 'effect',
8
+ 'memo-recompute',
9
+ 'timer',
10
+ 'raf',
11
+ 'idle-callback',
12
+ 'websocket-message',
13
+ 'broadcast-channel',
14
+ 'post-message',
15
+ 'storage-event',
16
+ 'service-worker-message',
17
+ 'media-query-change',
18
+ 'visibility-change',
19
+ 'resize',
20
+ 'intersection-observer',
21
+ 'mutation-observer',
22
+ 'backend-response',
23
+ 'hmr-update',
24
+ ]);
25
+ export const TraceContextSchema = z.object({
26
+ sessionId: z.string(),
27
+ browserContextId: z.string().optional(),
28
+ tabId: z.string().optional(),
29
+ frameId: z.string().optional(),
30
+ route: z.string().optional(),
31
+ url: z.string().optional(),
32
+ flowId: z.string().optional(),
33
+ originType: FlowOriginTypeSchema.optional(),
34
+ originNodeId: z.string().optional(),
35
+ causedByNodeId: z.string().optional(),
36
+ requestId: z.string().optional(),
37
+ traceparent: z.string().optional(),
38
+ userActionId: z.string().optional(),
39
+ userIdHash: z.string().optional(),
40
+ tenantIdHash: z.string().optional(),
41
+ });
package/lib/edge.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ export declare const EdgeAxisSchema: z.ZodEnum<{
3
+ db: "db";
4
+ memory: "memory";
5
+ visual: "visual";
6
+ render: "render";
7
+ state: "state";
8
+ network: "network";
9
+ backend: "backend";
10
+ performance: "performance";
11
+ lifecycle: "lifecycle";
12
+ ownership: "ownership";
13
+ caused: "caused";
14
+ async: "async";
15
+ data: "data";
16
+ }>;
17
+ export type EdgeAxis = z.infer<typeof EdgeAxisSchema>;
18
+ export declare const TraceEdgeSchema: z.ZodObject<{
19
+ id: z.ZodString;
20
+ from: z.ZodString;
21
+ to: z.ZodString;
22
+ axis: z.ZodEnum<{
23
+ db: "db";
24
+ memory: "memory";
25
+ visual: "visual";
26
+ render: "render";
27
+ state: "state";
28
+ network: "network";
29
+ backend: "backend";
30
+ performance: "performance";
31
+ lifecycle: "lifecycle";
32
+ ownership: "ownership";
33
+ caused: "caused";
34
+ async: "async";
35
+ data: "data";
36
+ }>;
37
+ type: z.ZodString;
38
+ timestamp: z.ZodNumber;
39
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
+ }, z.core.$strip>;
41
+ export type TraceEdge = z.infer<typeof TraceEdgeSchema>;
42
+ //# sourceMappingURL=edge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/lib/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;EAczB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;iBAQ1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
package/lib/edge.js ADDED
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ export const EdgeAxisSchema = z.enum([
3
+ 'ownership',
4
+ 'caused',
5
+ 'async',
6
+ 'data',
7
+ 'render',
8
+ 'state',
9
+ 'network',
10
+ 'backend',
11
+ 'db',
12
+ 'visual',
13
+ 'performance',
14
+ 'memory',
15
+ 'lifecycle',
16
+ ]);
17
+ export const TraceEdgeSchema = z.object({
18
+ id: z.string(),
19
+ from: z.string(),
20
+ to: z.string(),
21
+ axis: EdgeAxisSchema,
22
+ type: z.string(),
23
+ timestamp: z.number().int().nonnegative(),
24
+ attributes: z.record(z.string(), z.unknown()).optional(),
25
+ });
package/lib/event.d.ts ADDED
@@ -0,0 +1,160 @@
1
+ import { z } from 'zod';
2
+ export declare const EventSourceSchema: z.ZodEnum<{
3
+ nx: "nx";
4
+ vite: "vite";
5
+ typescript: "typescript";
6
+ eslint: "eslint";
7
+ rollup: "rollup";
8
+ "client-runtime": "client-runtime";
9
+ chrome: "chrome";
10
+ react: "react";
11
+ valtio: "valtio";
12
+ nestjs: "nestjs";
13
+ nextjs: "nextjs";
14
+ db: "db";
15
+ redis: "redis";
16
+ queue: "queue";
17
+ memory: "memory";
18
+ visual: "visual";
19
+ perf: "perf";
20
+ security: "security";
21
+ gateway: "gateway";
22
+ external: "external";
23
+ }>;
24
+ export type EventSource = z.infer<typeof EventSourceSchema>;
25
+ export declare const EventCategorySchema: z.ZodEnum<{
26
+ db: "db";
27
+ memory: "memory";
28
+ visual: "visual";
29
+ security: "security";
30
+ build: "build";
31
+ lint: "lint";
32
+ typecheck: "typecheck";
33
+ test: "test";
34
+ runtime: "runtime";
35
+ render: "render";
36
+ trace: "trace";
37
+ state: "state";
38
+ network: "network";
39
+ backend: "backend";
40
+ performance: "performance";
41
+ deps: "deps";
42
+ cluster: "cluster";
43
+ }>;
44
+ export type EventCategory = z.infer<typeof EventCategorySchema>;
45
+ export declare const SeveritySchema: z.ZodEnum<{
46
+ error: "error";
47
+ debug: "debug";
48
+ info: "info";
49
+ warning: "warning";
50
+ fatal: "fatal";
51
+ }>;
52
+ export type Severity = z.infer<typeof SeveritySchema>;
53
+ export declare const BaseEventSchema: z.ZodObject<{
54
+ id: z.ZodString;
55
+ sessionId: z.ZodString;
56
+ timestamp: z.ZodNumber;
57
+ source: z.ZodEnum<{
58
+ nx: "nx";
59
+ vite: "vite";
60
+ typescript: "typescript";
61
+ eslint: "eslint";
62
+ rollup: "rollup";
63
+ "client-runtime": "client-runtime";
64
+ chrome: "chrome";
65
+ react: "react";
66
+ valtio: "valtio";
67
+ nestjs: "nestjs";
68
+ nextjs: "nextjs";
69
+ db: "db";
70
+ redis: "redis";
71
+ queue: "queue";
72
+ memory: "memory";
73
+ visual: "visual";
74
+ perf: "perf";
75
+ security: "security";
76
+ gateway: "gateway";
77
+ external: "external";
78
+ }>;
79
+ category: z.ZodEnum<{
80
+ db: "db";
81
+ memory: "memory";
82
+ visual: "visual";
83
+ security: "security";
84
+ build: "build";
85
+ lint: "lint";
86
+ typecheck: "typecheck";
87
+ test: "test";
88
+ runtime: "runtime";
89
+ render: "render";
90
+ trace: "trace";
91
+ state: "state";
92
+ network: "network";
93
+ backend: "backend";
94
+ performance: "performance";
95
+ deps: "deps";
96
+ cluster: "cluster";
97
+ }>;
98
+ severity: z.ZodEnum<{
99
+ error: "error";
100
+ debug: "debug";
101
+ info: "info";
102
+ warning: "warning";
103
+ fatal: "fatal";
104
+ }>;
105
+ context: z.ZodObject<{
106
+ sessionId: z.ZodString;
107
+ browserContextId: z.ZodOptional<z.ZodString>;
108
+ tabId: z.ZodOptional<z.ZodString>;
109
+ frameId: z.ZodOptional<z.ZodString>;
110
+ route: z.ZodOptional<z.ZodString>;
111
+ url: z.ZodOptional<z.ZodString>;
112
+ flowId: z.ZodOptional<z.ZodString>;
113
+ originType: z.ZodOptional<z.ZodEnum<{
114
+ "user-click": "user-click";
115
+ "user-input": "user-input";
116
+ keyboard: "keyboard";
117
+ "route-load": "route-load";
118
+ effect: "effect";
119
+ "memo-recompute": "memo-recompute";
120
+ timer: "timer";
121
+ raf: "raf";
122
+ "idle-callback": "idle-callback";
123
+ "websocket-message": "websocket-message";
124
+ "broadcast-channel": "broadcast-channel";
125
+ "post-message": "post-message";
126
+ "storage-event": "storage-event";
127
+ "service-worker-message": "service-worker-message";
128
+ "media-query-change": "media-query-change";
129
+ "visibility-change": "visibility-change";
130
+ resize: "resize";
131
+ "intersection-observer": "intersection-observer";
132
+ "mutation-observer": "mutation-observer";
133
+ "backend-response": "backend-response";
134
+ "hmr-update": "hmr-update";
135
+ }>>;
136
+ originNodeId: z.ZodOptional<z.ZodString>;
137
+ causedByNodeId: z.ZodOptional<z.ZodString>;
138
+ requestId: z.ZodOptional<z.ZodString>;
139
+ traceparent: z.ZodOptional<z.ZodString>;
140
+ userActionId: z.ZodOptional<z.ZodString>;
141
+ userIdHash: z.ZodOptional<z.ZodString>;
142
+ tenantIdHash: z.ZodOptional<z.ZodString>;
143
+ }, z.core.$strip>;
144
+ fingerprint: z.ZodString;
145
+ title: z.ZodString;
146
+ message: z.ZodOptional<z.ZodString>;
147
+ location: z.ZodOptional<z.ZodObject<{
148
+ file: z.ZodString;
149
+ line: z.ZodOptional<z.ZodNumber>;
150
+ column: z.ZodOptional<z.ZodNumber>;
151
+ symbol: z.ZodOptional<z.ZodString>;
152
+ componentName: z.ZodOptional<z.ZodString>;
153
+ hookName: z.ZodOptional<z.ZodString>;
154
+ }, z.core.$strip>>;
155
+ relatedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ relatedUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ raw: z.ZodOptional<z.ZodUnknown>;
158
+ }, z.core.$strip>;
159
+ export type BaseEvent = z.infer<typeof BaseEventSchema>;
160
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/lib/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAqB5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAkB9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,cAAc;;;;;;EAMzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
package/lib/event.js ADDED
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod';
2
+ import { SourceLocationSchema } from './source-location.js';
3
+ import { TraceContextSchema } from './context.js';
4
+ export const EventSourceSchema = z.enum([
5
+ 'nx',
6
+ 'vite',
7
+ 'typescript',
8
+ 'eslint',
9
+ 'rollup',
10
+ 'client-runtime',
11
+ 'chrome',
12
+ 'react',
13
+ 'valtio',
14
+ 'nestjs',
15
+ 'nextjs',
16
+ 'db',
17
+ 'redis',
18
+ 'queue',
19
+ 'memory',
20
+ 'visual',
21
+ 'perf',
22
+ 'security',
23
+ 'gateway',
24
+ 'external',
25
+ ]);
26
+ export const EventCategorySchema = z.enum([
27
+ 'build',
28
+ 'lint',
29
+ 'typecheck',
30
+ 'test',
31
+ 'runtime',
32
+ 'render',
33
+ 'visual',
34
+ 'trace',
35
+ 'state',
36
+ 'network',
37
+ 'backend',
38
+ 'db',
39
+ 'memory',
40
+ 'performance',
41
+ 'security',
42
+ 'deps',
43
+ 'cluster',
44
+ ]);
45
+ export const SeveritySchema = z.enum([
46
+ 'debug',
47
+ 'info',
48
+ 'warning',
49
+ 'error',
50
+ 'fatal',
51
+ ]);
52
+ export const BaseEventSchema = z.object({
53
+ id: z.string(),
54
+ sessionId: z.string(),
55
+ timestamp: z.number().int().nonnegative(),
56
+ source: EventSourceSchema,
57
+ category: EventCategorySchema,
58
+ severity: SeveritySchema,
59
+ context: TraceContextSchema,
60
+ fingerprint: z.string(),
61
+ title: z.string(),
62
+ message: z.string().optional(),
63
+ location: SourceLocationSchema.optional(),
64
+ relatedFiles: z.array(z.string()).optional(),
65
+ relatedUrls: z.array(z.string()).optional(),
66
+ raw: z.unknown().optional(),
67
+ });