-
Notifications
You must be signed in to change notification settings - Fork 19
/
schema.js
41 lines (36 loc) · 1.02 KB
/
schema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict';
const z = require('zod');
const levels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'];
const sentryClientSchema = z.object({
configureScope: z.function().args(z.function()),
Scope: z.any(),
Handlers: z.object({
parseRequest: z.function().args(z.function(), z.function()),
}),
withScope: z.function().args(z.function()),
captureException: z.function(),
}).passthrough();
const sentryOptionsSchema = z.object({
dsn: z.string().url().or(z.boolean()).nullable(),
}).passthrough();
module.exports = z.object({
baseUri: z.string().url().optional(),
trackUser: z.boolean().default(true),
scope: z.object({
tags: z.array(z.object({
name: z.string(),
value: z.any(),
})),
level: z.enum(levels).optional(),
extra: z.object().optional(),
}).optional(),
client: z.union([
sentryOptionsSchema,
sentryClientSchema,
]),
catchLogErrors: z.union([
z.boolean(),
z.array(z.string()),
]).default(false),
useDomainPerRequest: z.boolean().default(false),
});