@snapfail/protocol 0.0.1
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/dist/fingerprint.d.ts +3 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4220 -0
- package/dist/schemas/collect.d.ts +311 -0
- package/dist/schemas/incident.d.ts +357 -0
- package/dist/schemas/primitives.d.ts +174 -0
- package/dist/scrub.d.ts +6 -0
- package/package.json +28 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const EnvironmentSchema: z.ZodObject<{
|
|
3
|
+
mode: z.ZodEnum<["dev", "prod"]>;
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
route: z.ZodOptional<z.ZodString>;
|
|
6
|
+
buildId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
releaseHash: z.ZodOptional<z.ZodString>;
|
|
8
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
mode: "dev" | "prod";
|
|
11
|
+
url: string;
|
|
12
|
+
route?: string | undefined;
|
|
13
|
+
buildId?: string | undefined;
|
|
14
|
+
releaseHash?: string | undefined;
|
|
15
|
+
framework?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
mode: "dev" | "prod";
|
|
18
|
+
url: string;
|
|
19
|
+
route?: string | undefined;
|
|
20
|
+
buildId?: string | undefined;
|
|
21
|
+
releaseHash?: string | undefined;
|
|
22
|
+
framework?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const DeviceSchema: z.ZodObject<{
|
|
25
|
+
userAgent: z.ZodString;
|
|
26
|
+
viewport: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
width: z.ZodNumber;
|
|
28
|
+
height: z.ZodNumber;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
}, {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}>>;
|
|
36
|
+
language: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
userAgent: string;
|
|
39
|
+
viewport?: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
} | undefined;
|
|
43
|
+
language?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
userAgent: string;
|
|
46
|
+
viewport?: {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
} | undefined;
|
|
50
|
+
language?: string | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
export declare const StackFrameSchema: z.ZodObject<{
|
|
53
|
+
file: z.ZodString;
|
|
54
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
fn: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
file: string;
|
|
58
|
+
line?: number | undefined;
|
|
59
|
+
fn?: string | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
file: string;
|
|
62
|
+
line?: number | undefined;
|
|
63
|
+
fn?: string | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const NetworkEntrySchema: z.ZodObject<{
|
|
66
|
+
method: z.ZodString;
|
|
67
|
+
url: z.ZodString;
|
|
68
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
requestBodySize: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
responseBodySize: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
requestHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
73
|
+
responseHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
74
|
+
error: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
url: string;
|
|
77
|
+
method: string;
|
|
78
|
+
status?: number | undefined;
|
|
79
|
+
durationMs?: number | undefined;
|
|
80
|
+
requestBodySize?: number | undefined;
|
|
81
|
+
responseBodySize?: number | undefined;
|
|
82
|
+
requestHeaders?: Record<string, string> | undefined;
|
|
83
|
+
responseHeaders?: Record<string, string> | undefined;
|
|
84
|
+
error?: string | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
url: string;
|
|
87
|
+
method: string;
|
|
88
|
+
status?: number | undefined;
|
|
89
|
+
durationMs?: number | undefined;
|
|
90
|
+
requestBodySize?: number | undefined;
|
|
91
|
+
responseBodySize?: number | undefined;
|
|
92
|
+
requestHeaders?: Record<string, string> | undefined;
|
|
93
|
+
responseHeaders?: Record<string, string> | undefined;
|
|
94
|
+
error?: string | undefined;
|
|
95
|
+
}>;
|
|
96
|
+
export declare const ConsoleEntrySchema: z.ZodObject<{
|
|
97
|
+
level: z.ZodEnum<["log", "warn", "error"]>;
|
|
98
|
+
args: z.ZodArray<z.ZodUnknown, "many">;
|
|
99
|
+
timestamp: z.ZodNumber;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
level: "error" | "log" | "warn";
|
|
102
|
+
args: unknown[];
|
|
103
|
+
timestamp: number;
|
|
104
|
+
}, {
|
|
105
|
+
level: "error" | "log" | "warn";
|
|
106
|
+
args: unknown[];
|
|
107
|
+
timestamp: number;
|
|
108
|
+
}>;
|
|
109
|
+
export declare const StorageSnapshotSchema: z.ZodObject<{
|
|
110
|
+
localStorage: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
111
|
+
key: z.ZodString;
|
|
112
|
+
type: z.ZodString;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
type: string;
|
|
115
|
+
key: string;
|
|
116
|
+
}, {
|
|
117
|
+
type: string;
|
|
118
|
+
key: string;
|
|
119
|
+
}>, "many">>;
|
|
120
|
+
sessionStorage: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
|
+
key: z.ZodString;
|
|
122
|
+
type: z.ZodString;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
type: string;
|
|
125
|
+
key: string;
|
|
126
|
+
}, {
|
|
127
|
+
type: string;
|
|
128
|
+
key: string;
|
|
129
|
+
}>, "many">>;
|
|
130
|
+
cookies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
localStorage?: {
|
|
133
|
+
type: string;
|
|
134
|
+
key: string;
|
|
135
|
+
}[] | undefined;
|
|
136
|
+
sessionStorage?: {
|
|
137
|
+
type: string;
|
|
138
|
+
key: string;
|
|
139
|
+
}[] | undefined;
|
|
140
|
+
cookies?: string[] | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
localStorage?: {
|
|
143
|
+
type: string;
|
|
144
|
+
key: string;
|
|
145
|
+
}[] | undefined;
|
|
146
|
+
sessionStorage?: {
|
|
147
|
+
type: string;
|
|
148
|
+
key: string;
|
|
149
|
+
}[] | undefined;
|
|
150
|
+
cookies?: string[] | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
export declare const ReplayEventSchema: z.ZodObject<{
|
|
153
|
+
t: z.ZodNumber;
|
|
154
|
+
kind: z.ZodEnum<["click", "input", "scroll", "nav", "mutation", "error"]>;
|
|
155
|
+
target: z.ZodOptional<z.ZodString>;
|
|
156
|
+
summary: z.ZodString;
|
|
157
|
+
}, "strip", z.ZodTypeAny, {
|
|
158
|
+
t: number;
|
|
159
|
+
kind: "error" | "click" | "input" | "scroll" | "nav" | "mutation";
|
|
160
|
+
summary: string;
|
|
161
|
+
target?: string | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
t: number;
|
|
164
|
+
kind: "error" | "click" | "input" | "scroll" | "nav" | "mutation";
|
|
165
|
+
summary: string;
|
|
166
|
+
target?: string | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
export type Environment = z.infer<typeof EnvironmentSchema>;
|
|
169
|
+
export type Device = z.infer<typeof DeviceSchema>;
|
|
170
|
+
export type StackFrame = z.infer<typeof StackFrameSchema>;
|
|
171
|
+
export type NetworkEntry = z.infer<typeof NetworkEntrySchema>;
|
|
172
|
+
export type ConsoleEntry = z.infer<typeof ConsoleEntrySchema>;
|
|
173
|
+
export type StorageSnapshot = z.infer<typeof StorageSnapshotSchema>;
|
|
174
|
+
export type ReplayEvent = z.infer<typeof ReplayEventSchema>;
|
package/dist/scrub.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConsoleEntry, NetworkEntry } from "./schemas/primitives.ts";
|
|
2
|
+
export declare function scrubUrl(url: string): string;
|
|
3
|
+
export declare function scrubHeaders(headers: Record<string, string>): Record<string, string>;
|
|
4
|
+
export declare function scrubJsonBody(body: unknown): unknown;
|
|
5
|
+
export declare function scrubNetworkEntries(entries: NetworkEntry[]): NetworkEntry[];
|
|
6
|
+
export declare function scrubConsoleEntries(entries: ConsoleEntry[]): ConsoleEntry[];
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@snapfail/protocol",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Shared types, schemas and utilities for snapfail",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": ["dist"],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "bun build src/index.ts --outdir dist --target node --format esm --sourcemap=none && bun tsc -p tsconfig.build.json --outDir dist",
|
|
23
|
+
"prepublishOnly": "bun run build"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"zod": "^3"
|
|
27
|
+
}
|
|
28
|
+
}
|