@domandigital/sentry 0.0.0-stage → 0.1.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/CHANGELOG.md +13 -0
- package/LICENSE +202 -0
- package/README.md +229 -2
- package/dist/browser.cjs +365 -0
- package/dist/browser.d.cts +25 -0
- package/dist/browser.d.ts +25 -0
- package/dist/browser.js +13 -0
- package/dist/chunk-6BR5I252.js +14 -0
- package/dist/chunk-BICH2PO4.js +339 -0
- package/dist/chunk-TD2AK75E.js +15 -0
- package/dist/chunk-ZIWYCDHF.js +14 -0
- package/dist/cli.js +236 -0
- package/dist/cloudflare.cjs +352 -0
- package/dist/cloudflare.d.cts +27 -0
- package/dist/cloudflare.d.ts +27 -0
- package/dist/cloudflare.js +9 -0
- package/dist/index.cjs +399 -0
- package/dist/index.d.cts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +50 -0
- package/dist/next.cjs +422 -0
- package/dist/next.d.cts +78 -0
- package/dist/next.d.ts +78 -0
- package/dist/next.js +63 -0
- package/dist/preset-D2peo0uv.d.cts +208 -0
- package/dist/preset-D2peo0uv.d.ts +208 -0
- package/dist/third-party-LjX9unFo.d.cts +21 -0
- package/dist/third-party-LjX9unFo.d.ts +21 -0
- package/package.json +108 -3
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
DATA_COLLECTION: () => DATA_COLLECTION,
|
|
24
|
+
DENY_URLS: () => DENY_URLS,
|
|
25
|
+
DSN_VARS: () => DSN_VARS,
|
|
26
|
+
ENVIRONMENTS: () => ENVIRONMENTS,
|
|
27
|
+
ENVIRONMENT_VARS: () => ENVIRONMENT_VARS,
|
|
28
|
+
IGNORE_ERRORS: () => IGNORE_ERRORS,
|
|
29
|
+
INGEST_HOST: () => INGEST_HOST,
|
|
30
|
+
REDACTED: () => REDACTED,
|
|
31
|
+
RELEASE_VARS: () => RELEASE_VARS,
|
|
32
|
+
SENTRY_ORG: () => SENTRY_ORG,
|
|
33
|
+
applicationKey: () => applicationKey,
|
|
34
|
+
buildPreset: () => buildPreset,
|
|
35
|
+
isThirdPartyNetworkError: () => isThirdPartyNetworkError,
|
|
36
|
+
normaliseDsn: () => normaliseDsn,
|
|
37
|
+
resolveDsn: () => resolveDsn,
|
|
38
|
+
resolveEnvironment: () => resolveEnvironment,
|
|
39
|
+
resolveRelease: () => resolveRelease,
|
|
40
|
+
scrubEvent: () => scrubEvent,
|
|
41
|
+
scrubSpan: () => scrubSpan,
|
|
42
|
+
scrubString: () => scrubString,
|
|
43
|
+
scrubValue: () => scrubValue,
|
|
44
|
+
thirdPartyFilterOptions: () => thirdPartyFilterOptions
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(index_exports);
|
|
47
|
+
|
|
48
|
+
// src/env.ts
|
|
49
|
+
var SENTRY_ORG = "domandigital";
|
|
50
|
+
var INGEST_HOST = "o4510784554991616.ingest.de.sentry.io";
|
|
51
|
+
var ENVIRONMENTS = ["production", "staging", "preview"];
|
|
52
|
+
var ENVIRONMENT_VARS = [
|
|
53
|
+
"SENTRY_ENVIRONMENT",
|
|
54
|
+
"PUBLIC_SENTRY_ENVIRONMENT",
|
|
55
|
+
"NEXT_PUBLIC_SENTRY_ENVIRONMENT",
|
|
56
|
+
// Vercel sets these itself, so a Vercel project is right without any setup.
|
|
57
|
+
"VERCEL_ENV",
|
|
58
|
+
"NEXT_PUBLIC_VERCEL_ENV"
|
|
59
|
+
];
|
|
60
|
+
var RELEASE_VARS = [
|
|
61
|
+
"SENTRY_RELEASE",
|
|
62
|
+
"PUBLIC_SENTRY_RELEASE",
|
|
63
|
+
"NEXT_PUBLIC_SENTRY_RELEASE",
|
|
64
|
+
"CF_PAGES_COMMIT_SHA",
|
|
65
|
+
"WORKERS_CI_COMMIT_SHA",
|
|
66
|
+
"VERCEL_GIT_COMMIT_SHA",
|
|
67
|
+
"NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA",
|
|
68
|
+
"GITHUB_SHA"
|
|
69
|
+
];
|
|
70
|
+
var DSN_VARS = ["SENTRY_DSN", "PUBLIC_SENTRY_DSN", "NEXT_PUBLIC_SENTRY_DSN"];
|
|
71
|
+
function text(value) {
|
|
72
|
+
if (typeof value !== "string") return void 0;
|
|
73
|
+
const trimmed = value.trim();
|
|
74
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
75
|
+
}
|
|
76
|
+
function firstOf(env, names) {
|
|
77
|
+
if (!env) return void 0;
|
|
78
|
+
for (const name of names) {
|
|
79
|
+
const value = text(env[name]);
|
|
80
|
+
if (value) return { value, from: name };
|
|
81
|
+
}
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
var ALIASES = {
|
|
85
|
+
production: "production",
|
|
86
|
+
prod: "production",
|
|
87
|
+
live: "production",
|
|
88
|
+
staging: "staging",
|
|
89
|
+
stage: "staging",
|
|
90
|
+
stg: "staging",
|
|
91
|
+
preview: "preview"
|
|
92
|
+
};
|
|
93
|
+
var LOCAL = /* @__PURE__ */ new Set(["development", "dev", "local", "test"]);
|
|
94
|
+
function resolveEnvironment(input = {}) {
|
|
95
|
+
const explicit = text(input.environment);
|
|
96
|
+
const found = explicit ? { value: explicit, from: "explicit" } : firstOf(input.env, ENVIRONMENT_VARS);
|
|
97
|
+
if (!found) return { environment: "preview", enabled: true, from: null };
|
|
98
|
+
const key = found.value.toLowerCase();
|
|
99
|
+
if (LOCAL.has(key)) return { environment: "preview", enabled: false, from: found.from };
|
|
100
|
+
return { environment: ALIASES[key] ?? "preview", enabled: true, from: found.from };
|
|
101
|
+
}
|
|
102
|
+
function resolveRelease(input = {}) {
|
|
103
|
+
return text(input.release) ?? firstOf(input.env, RELEASE_VARS)?.value;
|
|
104
|
+
}
|
|
105
|
+
var OLD_INGEST = /^(https?:\/\/[^@/]+@)(o\d+\.ingest\.de\.sentry\.io)(\/.*)$/i;
|
|
106
|
+
function normaliseDsn(dsn) {
|
|
107
|
+
const value = text(dsn);
|
|
108
|
+
if (!value) return void 0;
|
|
109
|
+
const match = OLD_INGEST.exec(value);
|
|
110
|
+
return match ? `${match[1]}${INGEST_HOST}${match[3]}` : value;
|
|
111
|
+
}
|
|
112
|
+
function resolveDsn(input = {}) {
|
|
113
|
+
return normaliseDsn(text(input.dsn) ?? firstOf(input.env, DSN_VARS)?.value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/filters.ts
|
|
117
|
+
var IGNORE_ERRORS = [
|
|
118
|
+
// In-app browsers and wallet extensions poking at objects they injected.
|
|
119
|
+
/\bethereum\b/i,
|
|
120
|
+
"__firefox__",
|
|
121
|
+
"webkit.messageHandlers",
|
|
122
|
+
"Java object is gone",
|
|
123
|
+
// Globals that tag managers, extensions and injected bars expect to exist.
|
|
124
|
+
/\b(?:googletag|jQuery|zaius|eventTracker) is not defined\b/,
|
|
125
|
+
/(?:^|[^\w$])\$ is not defined\b/,
|
|
126
|
+
/Can't find variable: (?:googletag|jQuery|zaius|eventTracker|\$)(?![\w$])/,
|
|
127
|
+
// Next.js after a deploy: an open tab posts to a server action the new build no longer has.
|
|
128
|
+
"Failed to find Server Action",
|
|
129
|
+
// The browser skipped a view transition (a second navigation, a hidden tab). Nothing broke.
|
|
130
|
+
"Skipping view transition",
|
|
131
|
+
"Transition was skipped"
|
|
132
|
+
];
|
|
133
|
+
var DENY_URLS = [
|
|
134
|
+
// Errors whose top frame is in a browser extension, or Safari's mask for one.
|
|
135
|
+
/^(?:chrome|moz|safari|safari-web|ms-browser)-extension:\/\//i,
|
|
136
|
+
/^webkit-masked-url:/i,
|
|
137
|
+
// Third-party scripts a site embeds and cannot fix.
|
|
138
|
+
/googletagmanager\.com/i,
|
|
139
|
+
/google-analytics\.com/i,
|
|
140
|
+
/googlesyndication\.com/i,
|
|
141
|
+
/connect\.facebook\.net/i,
|
|
142
|
+
/static\.hotjar\.com/i,
|
|
143
|
+
/clarity\.ms/i
|
|
144
|
+
];
|
|
145
|
+
var NETWORK_FAILURE = /^(?:Failed to fetch|Load failed|NetworkError when attempting to fetch resource\.)(?: \(([^)\s]+)\))?$/;
|
|
146
|
+
var isRec = (value) => typeof value === "object" && value !== null;
|
|
147
|
+
function bareHost(host) {
|
|
148
|
+
return host.toLowerCase().replace(/:\d+$/, "").replace(/^www\./, "");
|
|
149
|
+
}
|
|
150
|
+
function hostOf(url) {
|
|
151
|
+
if (typeof url !== "string") return void 0;
|
|
152
|
+
try {
|
|
153
|
+
return new URL(url).host;
|
|
154
|
+
} catch {
|
|
155
|
+
return void 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function sameSite(a, b) {
|
|
159
|
+
const x = bareHost(a);
|
|
160
|
+
const y = bareHost(b);
|
|
161
|
+
return x === y || x.endsWith(`.${y}`) || y.endsWith(`.${x}`);
|
|
162
|
+
}
|
|
163
|
+
function isThirdPartyNetworkError(event, hint, firstPartyHosts = []) {
|
|
164
|
+
if (!isRec(event) || !isRec(event.exception) || !Array.isArray(event.exception.values)) return false;
|
|
165
|
+
const values = event.exception.values.filter(isRec);
|
|
166
|
+
const last = values[values.length - 1];
|
|
167
|
+
if (!last || last.type !== "TypeError" || typeof last.value !== "string") return false;
|
|
168
|
+
const match = NETWORK_FAILURE.exec(last.value);
|
|
169
|
+
if (!match) return false;
|
|
170
|
+
const original = isRec(hint) && isRec(hint.originalException) ? hint.originalException : void 0;
|
|
171
|
+
const target = match[1] ?? (typeof original?.__sentry_fetch_url_host__ === "string" ? original.__sentry_fetch_url_host__ : void 0);
|
|
172
|
+
if (!target) return false;
|
|
173
|
+
const page = isRec(event.request) ? hostOf(event.request.url) : void 0;
|
|
174
|
+
const ours = [...firstPartyHosts, ...page ? [page] : []];
|
|
175
|
+
if (ours.length === 0) return false;
|
|
176
|
+
return !ours.some((host) => sameSite(host, target));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/scrub.ts
|
|
180
|
+
var import_synthetic = require("@domandigital/synthetic");
|
|
181
|
+
var REDACTED = "[REDACTED]";
|
|
182
|
+
var REDACT_KEYS = /email|token|cookie|authori[sz]ation|^auth$|password|passwd|secret|session|signature|api[-_]?key|phone/i;
|
|
183
|
+
var EMAIL = /[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi;
|
|
184
|
+
var BEARER = /bearer\s+[a-z0-9._\-~+/]+=*/gi;
|
|
185
|
+
var PHONE = /(?<![\w.+])(?:\+44\s?(?:\(0\)\s?)?|0)\d(?:[\s-]?\d){8,9}(?![\w.])/g;
|
|
186
|
+
var MAX_DEPTH = 8;
|
|
187
|
+
var MAX_ITEMS = 100;
|
|
188
|
+
function scrubString(input) {
|
|
189
|
+
return input.replace(EMAIL, "[REDACTED_EMAIL]").replace(BEARER, "Bearer [REDACTED_TOKEN]").replace(PHONE, "[REDACTED_PHONE]");
|
|
190
|
+
}
|
|
191
|
+
function scrubValue(value, depth = 0) {
|
|
192
|
+
if (depth > MAX_DEPTH) return "[TRUNCATED_DEPTH]";
|
|
193
|
+
if (value == null) return value;
|
|
194
|
+
if (typeof value === "string") return scrubString(value);
|
|
195
|
+
if (typeof value === "number" || typeof value === "boolean") return value;
|
|
196
|
+
if (typeof value === "bigint") return value.toString();
|
|
197
|
+
if (value instanceof Error) return { name: value.name, message: scrubString(value.message) };
|
|
198
|
+
if (Array.isArray(value)) return value.slice(0, MAX_ITEMS).map((item) => scrubValue(item, depth + 1));
|
|
199
|
+
if (typeof value === "object") {
|
|
200
|
+
const out = {};
|
|
201
|
+
for (const [key, item] of Object.entries(value)) {
|
|
202
|
+
out[key] = REDACT_KEYS.test(key) ? REDACTED : scrubValue(item, depth + 1);
|
|
203
|
+
}
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
return String(value);
|
|
207
|
+
}
|
|
208
|
+
var isRec2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
209
|
+
function scrubRequest(request) {
|
|
210
|
+
const out = { ...request };
|
|
211
|
+
if ("headers" in out) out.headers = scrubValue(out.headers);
|
|
212
|
+
if ("cookies" in out && out.cookies) out.cookies = REDACTED;
|
|
213
|
+
if ("data" in out) out.data = scrubValue(out.data);
|
|
214
|
+
if (typeof out.query_string === "string") out.query_string = scrubString(out.query_string);
|
|
215
|
+
else if ("query_string" in out) out.query_string = scrubValue(out.query_string);
|
|
216
|
+
if (typeof out.url === "string") out.url = scrubString(out.url);
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
219
|
+
function scrubException(exception) {
|
|
220
|
+
if (!Array.isArray(exception.values)) return exception;
|
|
221
|
+
return {
|
|
222
|
+
...exception,
|
|
223
|
+
// Only the message: stack frames, types and mechanisms are code, not customer data.
|
|
224
|
+
values: exception.values.map((v) => isRec2(v) && typeof v.value === "string" ? { ...v, value: scrubString(v.value) } : v)
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function scrubBreadcrumb(crumb) {
|
|
228
|
+
if (!isRec2(crumb)) return crumb;
|
|
229
|
+
const out = { ...crumb };
|
|
230
|
+
if (typeof out.message === "string") out.message = scrubString(out.message);
|
|
231
|
+
if ("data" in out) out.data = scrubValue(out.data);
|
|
232
|
+
return out;
|
|
233
|
+
}
|
|
234
|
+
function scrubPii(event) {
|
|
235
|
+
const out = { ...event };
|
|
236
|
+
if (isRec2(out.request)) out.request = scrubRequest(out.request);
|
|
237
|
+
for (const key of ["user", "extra", "contexts", "tags"]) {
|
|
238
|
+
if (key in out) out[key] = scrubValue(out[key]);
|
|
239
|
+
}
|
|
240
|
+
if (typeof out.message === "string") out.message = scrubString(out.message);
|
|
241
|
+
if (isRec2(out.logentry) && typeof out.logentry.message === "string") {
|
|
242
|
+
out.logentry = { ...out.logentry, message: scrubString(out.logentry.message) };
|
|
243
|
+
}
|
|
244
|
+
if (isRec2(out.exception)) out.exception = scrubException(out.exception);
|
|
245
|
+
if (Array.isArray(out.breadcrumbs)) out.breadcrumbs = out.breadcrumbs.map(scrubBreadcrumb);
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
var SPAN_REDACT_KEYS = /x-dd-synth|cookie|authori[sz]ation|token|secret|password|email|phone/i;
|
|
249
|
+
function scrubAttributes(attributes) {
|
|
250
|
+
const out = {};
|
|
251
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
252
|
+
if (SPAN_REDACT_KEYS.test(key)) out[key] = REDACTED;
|
|
253
|
+
else if (typeof value === "string") out[key] = scrubString(value);
|
|
254
|
+
else if (Array.isArray(value)) out[key] = value.map((v) => typeof v === "string" ? scrubString(v) : v);
|
|
255
|
+
else out[key] = value;
|
|
256
|
+
}
|
|
257
|
+
return out;
|
|
258
|
+
}
|
|
259
|
+
function scrubSpan(span) {
|
|
260
|
+
try {
|
|
261
|
+
const out = { ...span };
|
|
262
|
+
if (typeof out.name === "string") out.name = scrubString(out.name);
|
|
263
|
+
if (typeof out.description === "string") out.description = scrubString(out.description);
|
|
264
|
+
if (isRec2(out.attributes)) out.attributes = scrubAttributes(out.attributes);
|
|
265
|
+
if (isRec2(out.data)) out.data = scrubAttributes(out.data);
|
|
266
|
+
return out;
|
|
267
|
+
} catch {
|
|
268
|
+
return span;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function scrubEvent(event) {
|
|
272
|
+
try {
|
|
273
|
+
return (0, import_synthetic.scrubSentryEvent)(scrubPii(event));
|
|
274
|
+
} catch {
|
|
275
|
+
const { request: _request, user: _user, extra: _extra, breadcrumbs: _breadcrumbs, ...rest } = event;
|
|
276
|
+
return rest;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/preset.ts
|
|
281
|
+
var DATA_COLLECTION = {
|
|
282
|
+
userInfo: false,
|
|
283
|
+
cookies: false,
|
|
284
|
+
httpHeaders: { request: true, response: false },
|
|
285
|
+
httpBodies: [],
|
|
286
|
+
urlQueryParams: true,
|
|
287
|
+
graphQL: { document: true, variables: false },
|
|
288
|
+
genAI: { inputs: false, outputs: false },
|
|
289
|
+
databaseQueryData: false,
|
|
290
|
+
queues: false,
|
|
291
|
+
stackFrameVariables: false
|
|
292
|
+
};
|
|
293
|
+
function isThenable(value) {
|
|
294
|
+
return typeof value === "object" && value !== null && typeof value.then === "function";
|
|
295
|
+
}
|
|
296
|
+
function scrubbingHook(user, drop) {
|
|
297
|
+
return ((event, hint) => {
|
|
298
|
+
if (drop?.(event, hint)) return null;
|
|
299
|
+
const out = user ? user(event, hint) : event;
|
|
300
|
+
if (isThenable(out)) return Promise.resolve(out).then((e) => e ? scrubEvent(e) : null);
|
|
301
|
+
return out ? scrubEvent(out) : null;
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
var SCRUB_TRANSACTIONS = {
|
|
305
|
+
name: "DomanDigitalScrubTransactions",
|
|
306
|
+
processEvent: (event) => event.type === "transaction" ? scrubEvent(event) : event
|
|
307
|
+
};
|
|
308
|
+
function withScrubber(integrations) {
|
|
309
|
+
if (typeof integrations === "function") {
|
|
310
|
+
return (defaults) => [...integrations(defaults), SCRUB_TRANSACTIONS];
|
|
311
|
+
}
|
|
312
|
+
return [...Array.isArray(integrations) ? integrations : [], SCRUB_TRANSACTIONS];
|
|
313
|
+
}
|
|
314
|
+
function hasReplay(integrations) {
|
|
315
|
+
return Array.isArray(integrations) && integrations.some((i) => typeof i === "object" && i !== null && i.name === "Replay");
|
|
316
|
+
}
|
|
317
|
+
function buildPreset(input, runtime) {
|
|
318
|
+
const {
|
|
319
|
+
dsn: dsnIn,
|
|
320
|
+
env,
|
|
321
|
+
environment: environmentIn,
|
|
322
|
+
release: releaseIn,
|
|
323
|
+
firstPartyHosts = [],
|
|
324
|
+
ignoreErrors = [],
|
|
325
|
+
denyUrls = [],
|
|
326
|
+
integrations,
|
|
327
|
+
beforeSend,
|
|
328
|
+
beforeSendSpan,
|
|
329
|
+
dataCollection,
|
|
330
|
+
tracesSampleRate,
|
|
331
|
+
replaysSessionSampleRate,
|
|
332
|
+
replaysOnErrorSampleRate,
|
|
333
|
+
sendDefaultPii: _sendDefaultPii,
|
|
334
|
+
...rest
|
|
335
|
+
} = input;
|
|
336
|
+
const { environment, enabled } = resolveEnvironment({ environment: environmentIn, env });
|
|
337
|
+
const dsn = resolveDsn({ dsn: dsnIn, env });
|
|
338
|
+
const release = resolveRelease({ release: releaseIn, env });
|
|
339
|
+
const out = {
|
|
340
|
+
...rest,
|
|
341
|
+
environment,
|
|
342
|
+
dataCollection: { ...DATA_COLLECTION, ...dataCollection },
|
|
343
|
+
ignoreErrors: [...IGNORE_ERRORS, ...ignoreErrors],
|
|
344
|
+
denyUrls: [...DENY_URLS, ...denyUrls],
|
|
345
|
+
integrations: withScrubber(integrations),
|
|
346
|
+
beforeSend: scrubbingHook(
|
|
347
|
+
beforeSend,
|
|
348
|
+
runtime.browser ? (event, hint) => isThirdPartyNetworkError(event, hint, firstPartyHosts) : void 0
|
|
349
|
+
),
|
|
350
|
+
// A site's own hook replaces this one rather than being wrapped: v11 marks
|
|
351
|
+
// a static-span hook (`withStaticSpan`), and a wrapper would lose the mark.
|
|
352
|
+
beforeSendSpan: beforeSendSpan ?? scrubSpan,
|
|
353
|
+
tracesSampleRate: tracesSampleRate ?? runtime.tracesSampleRate
|
|
354
|
+
};
|
|
355
|
+
if (dsn) out.dsn = dsn;
|
|
356
|
+
if (release) out.release = release;
|
|
357
|
+
if (!enabled) out.enabled = false;
|
|
358
|
+
if (runtime.browser && hasReplay(integrations)) {
|
|
359
|
+
out.replaysSessionSampleRate = replaysSessionSampleRate ?? 0;
|
|
360
|
+
out.replaysOnErrorSampleRate = replaysOnErrorSampleRate ?? 1;
|
|
361
|
+
}
|
|
362
|
+
return out;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// src/third-party.ts
|
|
366
|
+
function applicationKey(project) {
|
|
367
|
+
return `dd-${project}`;
|
|
368
|
+
}
|
|
369
|
+
function thirdPartyFilterOptions(project) {
|
|
370
|
+
return {
|
|
371
|
+
filterKeys: [applicationKey(project)],
|
|
372
|
+
behaviour: "drop-error-if-exclusively-contains-third-party-frames"
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
376
|
+
0 && (module.exports = {
|
|
377
|
+
DATA_COLLECTION,
|
|
378
|
+
DENY_URLS,
|
|
379
|
+
DSN_VARS,
|
|
380
|
+
ENVIRONMENTS,
|
|
381
|
+
ENVIRONMENT_VARS,
|
|
382
|
+
IGNORE_ERRORS,
|
|
383
|
+
INGEST_HOST,
|
|
384
|
+
REDACTED,
|
|
385
|
+
RELEASE_VARS,
|
|
386
|
+
SENTRY_ORG,
|
|
387
|
+
applicationKey,
|
|
388
|
+
buildPreset,
|
|
389
|
+
isThirdPartyNetworkError,
|
|
390
|
+
normaliseDsn,
|
|
391
|
+
resolveDsn,
|
|
392
|
+
resolveEnvironment,
|
|
393
|
+
resolveRelease,
|
|
394
|
+
scrubEvent,
|
|
395
|
+
scrubSpan,
|
|
396
|
+
scrubString,
|
|
397
|
+
scrubValue,
|
|
398
|
+
thirdPartyFilterOptions
|
|
399
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export { B as BrowserPreset, a as BrowserPresetDefaults, D as DATA_COLLECTION, e as DSN_VARS, f as DataCollection, E as ENVIRONMENTS, g as ENVIRONMENT_VARS, h as EnvSource, I as INGEST_HOST, c as Preset, d as PresetDefaults, P as PresetInput, R as RELEASE_VARS, i as ResolvedEnvironment, j as Runtime, k as SENTRY_ORG, S as ScrubbingHook, l as SentryEnvironment, b as SpanScrubbingHook, m as buildPreset, n as normaliseDsn, r as resolveDsn, o as resolveEnvironment, p as resolveRelease } from './preset-D2peo0uv.cjs';
|
|
2
|
+
export { a as applicationKey, t as thirdPartyFilterOptions } from './third-party-LjX9unFo.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Noise every Doman Digital project drops. Each entry is here because the
|
|
6
|
+
* 2026-10-08 audit found it in more than one client's Sentry, raised by code
|
|
7
|
+
* nobody at Doman Digital wrote. Sentry matches a string as a substring of the
|
|
8
|
+
* error's `Type: message` (or of the frame URL for `denyUrls`).
|
|
9
|
+
*/
|
|
10
|
+
declare const IGNORE_ERRORS: ReadonlyArray<string | RegExp>;
|
|
11
|
+
declare const DENY_URLS: ReadonlyArray<string | RegExp>;
|
|
12
|
+
/**
|
|
13
|
+
* True for a generic `Failed to fetch` / `Load failed` whose request went to
|
|
14
|
+
* another site: an analytics beacon, a chat widget, an ad network, blocked by
|
|
15
|
+
* the visitor's own browser. The Sentry SDK appends the host it was fetching
|
|
16
|
+
* (`Failed to fetch (host)`), or leaves it on the error when
|
|
17
|
+
* `enhanceFetchErrorMessages` is `"report-only"`. A failure on the site's own
|
|
18
|
+
* host, or one whose host is unknown, is kept.
|
|
19
|
+
*/
|
|
20
|
+
declare function isThirdPartyNetworkError(event: unknown, hint?: unknown, firstPartyHosts?: readonly string[]): boolean;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The PII scrubber every project runs as `beforeSend`. Lifted from
|
|
24
|
+
* Doman-Digital `packages/shared/sentry-scrubber.ts` (and its
|
|
25
|
+
* `sanitize-telemetry.ts`), widened to the parts of an event that carried
|
|
26
|
+
* customer details in the 2026-10-08 audit, then passed through
|
|
27
|
+
* `@domandigital/synthetic`'s scrubber so `X-DD-Synth-*` never leaves either.
|
|
28
|
+
*/
|
|
29
|
+
declare const REDACTED = "[REDACTED]";
|
|
30
|
+
/** Redacts emails, bearer tokens and UK phone numbers in free text. */
|
|
31
|
+
declare function scrubString(input: string): string;
|
|
32
|
+
/** Redacts sensitive keys and strings anywhere in a value. Never mutates it. */
|
|
33
|
+
declare function scrubValue(value: unknown, depth?: number): unknown;
|
|
34
|
+
/**
|
|
35
|
+
* `beforeSendSpan`: scrubs a span's name and attributes (v11's streamed
|
|
36
|
+
* `attributes`, v10's `data`) and keeps its shape exactly, because a span
|
|
37
|
+
* cannot be dropped and the SDK sends what this returns.
|
|
38
|
+
*/
|
|
39
|
+
declare function scrubSpan<S extends object>(span: S): S;
|
|
40
|
+
/**
|
|
41
|
+
* Scrubs a whole Sentry event: request, user, extra, contexts, tags, message,
|
|
42
|
+
* exception messages and breadcrumbs, then every `X-DD-Synth-*` header.
|
|
43
|
+
* Returns a new object and never throws; if scrubbing fails it drops the
|
|
44
|
+
* request and user rather than let them through.
|
|
45
|
+
*/
|
|
46
|
+
declare function scrubEvent<T extends object>(event: T): T;
|
|
47
|
+
|
|
48
|
+
export { DENY_URLS, IGNORE_ERRORS, REDACTED, isThirdPartyNetworkError, scrubEvent, scrubSpan, scrubString, scrubValue };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export { B as BrowserPreset, a as BrowserPresetDefaults, D as DATA_COLLECTION, e as DSN_VARS, f as DataCollection, E as ENVIRONMENTS, g as ENVIRONMENT_VARS, h as EnvSource, I as INGEST_HOST, c as Preset, d as PresetDefaults, P as PresetInput, R as RELEASE_VARS, i as ResolvedEnvironment, j as Runtime, k as SENTRY_ORG, S as ScrubbingHook, l as SentryEnvironment, b as SpanScrubbingHook, m as buildPreset, n as normaliseDsn, r as resolveDsn, o as resolveEnvironment, p as resolveRelease } from './preset-D2peo0uv.js';
|
|
2
|
+
export { a as applicationKey, t as thirdPartyFilterOptions } from './third-party-LjX9unFo.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Noise every Doman Digital project drops. Each entry is here because the
|
|
6
|
+
* 2026-10-08 audit found it in more than one client's Sentry, raised by code
|
|
7
|
+
* nobody at Doman Digital wrote. Sentry matches a string as a substring of the
|
|
8
|
+
* error's `Type: message` (or of the frame URL for `denyUrls`).
|
|
9
|
+
*/
|
|
10
|
+
declare const IGNORE_ERRORS: ReadonlyArray<string | RegExp>;
|
|
11
|
+
declare const DENY_URLS: ReadonlyArray<string | RegExp>;
|
|
12
|
+
/**
|
|
13
|
+
* True for a generic `Failed to fetch` / `Load failed` whose request went to
|
|
14
|
+
* another site: an analytics beacon, a chat widget, an ad network, blocked by
|
|
15
|
+
* the visitor's own browser. The Sentry SDK appends the host it was fetching
|
|
16
|
+
* (`Failed to fetch (host)`), or leaves it on the error when
|
|
17
|
+
* `enhanceFetchErrorMessages` is `"report-only"`. A failure on the site's own
|
|
18
|
+
* host, or one whose host is unknown, is kept.
|
|
19
|
+
*/
|
|
20
|
+
declare function isThirdPartyNetworkError(event: unknown, hint?: unknown, firstPartyHosts?: readonly string[]): boolean;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The PII scrubber every project runs as `beforeSend`. Lifted from
|
|
24
|
+
* Doman-Digital `packages/shared/sentry-scrubber.ts` (and its
|
|
25
|
+
* `sanitize-telemetry.ts`), widened to the parts of an event that carried
|
|
26
|
+
* customer details in the 2026-10-08 audit, then passed through
|
|
27
|
+
* `@domandigital/synthetic`'s scrubber so `X-DD-Synth-*` never leaves either.
|
|
28
|
+
*/
|
|
29
|
+
declare const REDACTED = "[REDACTED]";
|
|
30
|
+
/** Redacts emails, bearer tokens and UK phone numbers in free text. */
|
|
31
|
+
declare function scrubString(input: string): string;
|
|
32
|
+
/** Redacts sensitive keys and strings anywhere in a value. Never mutates it. */
|
|
33
|
+
declare function scrubValue(value: unknown, depth?: number): unknown;
|
|
34
|
+
/**
|
|
35
|
+
* `beforeSendSpan`: scrubs a span's name and attributes (v11's streamed
|
|
36
|
+
* `attributes`, v10's `data`) and keeps its shape exactly, because a span
|
|
37
|
+
* cannot be dropped and the SDK sends what this returns.
|
|
38
|
+
*/
|
|
39
|
+
declare function scrubSpan<S extends object>(span: S): S;
|
|
40
|
+
/**
|
|
41
|
+
* Scrubs a whole Sentry event: request, user, extra, contexts, tags, message,
|
|
42
|
+
* exception messages and breadcrumbs, then every `X-DD-Synth-*` header.
|
|
43
|
+
* Returns a new object and never throws; if scrubbing fails it drops the
|
|
44
|
+
* request and user rather than let them through.
|
|
45
|
+
*/
|
|
46
|
+
declare function scrubEvent<T extends object>(event: T): T;
|
|
47
|
+
|
|
48
|
+
export { DENY_URLS, IGNORE_ERRORS, REDACTED, isThirdPartyNetworkError, scrubEvent, scrubSpan, scrubString, scrubValue };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applicationKey,
|
|
3
|
+
thirdPartyFilterOptions
|
|
4
|
+
} from "./chunk-TD2AK75E.js";
|
|
5
|
+
import {
|
|
6
|
+
DATA_COLLECTION,
|
|
7
|
+
DENY_URLS,
|
|
8
|
+
DSN_VARS,
|
|
9
|
+
ENVIRONMENTS,
|
|
10
|
+
ENVIRONMENT_VARS,
|
|
11
|
+
IGNORE_ERRORS,
|
|
12
|
+
INGEST_HOST,
|
|
13
|
+
REDACTED,
|
|
14
|
+
RELEASE_VARS,
|
|
15
|
+
SENTRY_ORG,
|
|
16
|
+
buildPreset,
|
|
17
|
+
isThirdPartyNetworkError,
|
|
18
|
+
normaliseDsn,
|
|
19
|
+
resolveDsn,
|
|
20
|
+
resolveEnvironment,
|
|
21
|
+
resolveRelease,
|
|
22
|
+
scrubEvent,
|
|
23
|
+
scrubSpan,
|
|
24
|
+
scrubString,
|
|
25
|
+
scrubValue
|
|
26
|
+
} from "./chunk-BICH2PO4.js";
|
|
27
|
+
export {
|
|
28
|
+
DATA_COLLECTION,
|
|
29
|
+
DENY_URLS,
|
|
30
|
+
DSN_VARS,
|
|
31
|
+
ENVIRONMENTS,
|
|
32
|
+
ENVIRONMENT_VARS,
|
|
33
|
+
IGNORE_ERRORS,
|
|
34
|
+
INGEST_HOST,
|
|
35
|
+
REDACTED,
|
|
36
|
+
RELEASE_VARS,
|
|
37
|
+
SENTRY_ORG,
|
|
38
|
+
applicationKey,
|
|
39
|
+
buildPreset,
|
|
40
|
+
isThirdPartyNetworkError,
|
|
41
|
+
normaliseDsn,
|
|
42
|
+
resolveDsn,
|
|
43
|
+
resolveEnvironment,
|
|
44
|
+
resolveRelease,
|
|
45
|
+
scrubEvent,
|
|
46
|
+
scrubSpan,
|
|
47
|
+
scrubString,
|
|
48
|
+
scrubValue,
|
|
49
|
+
thirdPartyFilterOptions
|
|
50
|
+
};
|