@mgamadeus/ddd-web 0.15.0 → 0.16.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.
- package/.claude/skills/ddd-web-specialist/SKILL.md +13 -4
- package/.claude/skills/ddd-web-specialist/references/consumer.md +93 -0
- package/.claude/skills/ddd-web-specialist/references/maintaining.md +4 -0
- package/CHANGELOG.md +23 -0
- package/README.md +50 -2
- package/dist/chunk-GVRMHMNO.js +623 -0
- package/dist/chunk-GVRMHMNO.js.map +1 -0
- package/dist/chunk-JAYJB2EF.js +61 -0
- package/dist/chunk-JAYJB2EF.js.map +1 -0
- package/dist/index-C0Auocn8.d.ts +196 -0
- package/dist/issues/browser/index.d.ts +123 -0
- package/dist/issues/browser/index.js +221 -0
- package/dist/issues/browser/index.js.map +1 -0
- package/dist/issues/index.d.ts +69 -0
- package/dist/issues/index.js +64 -0
- package/dist/issues/index.js.map +1 -0
- package/dist/issues/node/index.d.ts +68 -0
- package/dist/issues/node/index.js +72 -0
- package/dist/issues/node/index.js.map +1 -0
- package/dist/issues/wire/index.d.ts +1 -0
- package/dist/issues/wire/index.js +13 -0
- package/dist/issues/wire/index.js.map +1 -0
- package/dist/reporter-BZoRQgsR.d.ts +214 -0
- package/dist/route-pattern-KPafYJmY.d.ts +31 -0
- package/package.json +18 -2
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import {
|
|
2
|
+
consoleBreadcrumb,
|
|
3
|
+
createFetchIssuesTransport,
|
|
4
|
+
createIssuesReporter,
|
|
5
|
+
createIssuesRouteTracker,
|
|
6
|
+
fetchBreadcrumb,
|
|
7
|
+
uiBreadcrumb
|
|
8
|
+
} from "../../chunk-GVRMHMNO.js";
|
|
9
|
+
import {
|
|
10
|
+
DDD_ISSUES_REPORT_PATH
|
|
11
|
+
} from "../../chunk-JAYJB2EF.js";
|
|
12
|
+
|
|
13
|
+
// src/issues/browser/index.ts
|
|
14
|
+
var readBrowserWindow = () => {
|
|
15
|
+
const candidate = globalThis;
|
|
16
|
+
return typeof candidate.addEventListener === "function" && typeof candidate.fetch === "function" ? candidate : null;
|
|
17
|
+
};
|
|
18
|
+
var unwrappedFetchByWindow = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
var readUnwrappedFetch = (browserWindow) => unwrappedFetchByWindow.get(browserWindow) ?? browserWindow.fetch.bind(browserWindow);
|
|
20
|
+
var DDD_ISSUES_TAB_ID_STORAGE_KEY = "ddd-issues-tab-id";
|
|
21
|
+
var readOrCreateIssuesTabId = (storageKey = DDD_ISSUES_TAB_ID_STORAGE_KEY, browserWindow = readBrowserWindow()) => {
|
|
22
|
+
try {
|
|
23
|
+
const storage = browserWindow?.sessionStorage;
|
|
24
|
+
if (!storage) return null;
|
|
25
|
+
const existingTabId = storage.getItem(storageKey);
|
|
26
|
+
if (existingTabId) return existingTabId;
|
|
27
|
+
const tabId = browserWindow?.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
28
|
+
storage.setItem(storageKey, tabId);
|
|
29
|
+
return tabId;
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var createBeaconIssuesTransport = (options = {}) => {
|
|
35
|
+
const fallback = options.fallback ?? createFetchIssuesTransport();
|
|
36
|
+
return async (request) => {
|
|
37
|
+
const browserWindow = options.browserWindow === void 0 ? readBrowserWindow() : options.browserWindow;
|
|
38
|
+
const sendBeacon = browserWindow?.navigator?.sendBeacon;
|
|
39
|
+
const hasHeadersBeyondContentType = Object.keys(request.headers).some(
|
|
40
|
+
(headerName) => !["content-type", "accept"].includes(headerName.toLowerCase())
|
|
41
|
+
);
|
|
42
|
+
if (request.unloading && typeof sendBeacon === "function" && !hasHeadersBeyondContentType) {
|
|
43
|
+
try {
|
|
44
|
+
const isQueued = sendBeacon.call(
|
|
45
|
+
browserWindow?.navigator,
|
|
46
|
+
request.url,
|
|
47
|
+
new Blob([request.body], { type: "text/plain;charset=UTF-8" })
|
|
48
|
+
);
|
|
49
|
+
if (isQueued) return { status: 202 };
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return fallback(request);
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
var createBrowserIssuesReporter = (options) => {
|
|
57
|
+
const browserWindow = options.browserWindow ?? readBrowserWindow();
|
|
58
|
+
if (!browserWindow) return null;
|
|
59
|
+
const tabId = options.tabIdStorageKey === null ? null : readOrCreateIssuesTabId(options.tabIdStorageKey ?? DDD_ISSUES_TAB_ID_STORAGE_KEY, browserWindow);
|
|
60
|
+
const configuredEndpoint = options.endpoint ?? DDD_ISSUES_REPORT_PATH;
|
|
61
|
+
const resolveEndpoint = () => {
|
|
62
|
+
const endpoint = typeof configuredEndpoint === "function" ? configuredEndpoint() : configuredEndpoint;
|
|
63
|
+
if (!endpoint) return null;
|
|
64
|
+
const origin2 = browserWindow.location?.origin;
|
|
65
|
+
return endpoint.startsWith("/") && !endpoint.startsWith("//") && origin2 ? `${origin2}${endpoint}` : endpoint;
|
|
66
|
+
};
|
|
67
|
+
const origin = browserWindow.location?.origin;
|
|
68
|
+
const isInAppFile = (file) => (origin ? file.startsWith(`${origin}/`) : false) || file.startsWith("/");
|
|
69
|
+
const { endpoint: _endpoint, release, locale, transport, tabIdStorageKey: _tabIdStorageKey, browserWindow: _browserWindow, ...reporterOptions } = options;
|
|
70
|
+
return createIssuesReporter({
|
|
71
|
+
isInAppFile,
|
|
72
|
+
isAutomated: () => browserWindow.navigator?.webdriver === true,
|
|
73
|
+
...reporterOptions,
|
|
74
|
+
runtime: "browser",
|
|
75
|
+
endpoint: resolveEndpoint,
|
|
76
|
+
context: () => ({
|
|
77
|
+
release: release?.() ?? null,
|
|
78
|
+
tabId,
|
|
79
|
+
// The backend reads a browser's user agent from the request header.
|
|
80
|
+
userAgent: null,
|
|
81
|
+
viewportWidth: browserWindow.innerWidth ?? null,
|
|
82
|
+
viewportHeight: browserWindow.innerHeight ?? null,
|
|
83
|
+
locale: (locale ? locale() : browserWindow.navigator?.language) || null
|
|
84
|
+
}),
|
|
85
|
+
transport: transport ?? createBeaconIssuesTransport({
|
|
86
|
+
browserWindow,
|
|
87
|
+
fallback: createFetchIssuesTransport({
|
|
88
|
+
fetch: () => readUnwrappedFetch(browserWindow)
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
var describeConsoleArgument = (value) => {
|
|
94
|
+
if (typeof value === "string") return value;
|
|
95
|
+
if (value instanceof Error) return `${value.name}: ${value.message}`;
|
|
96
|
+
try {
|
|
97
|
+
return JSON.stringify(value) ?? String(value);
|
|
98
|
+
} catch {
|
|
99
|
+
return String(value);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var isElementLike = (value) => typeof value === "object" && value !== null && typeof value.closest === "function" && typeof value.getAttribute === "function" && typeof value.tagName === "string";
|
|
103
|
+
var describeIssuesClickTarget = (target) => {
|
|
104
|
+
if (!isElementLike(target)) return null;
|
|
105
|
+
const withAction = target.closest("[data-issues-action]");
|
|
106
|
+
if (withAction) return withAction.getAttribute("data-issues-action");
|
|
107
|
+
const interactive = target.closest("button, a, [role], input, select, textarea, label") ?? target;
|
|
108
|
+
const role = interactive.getAttribute("role");
|
|
109
|
+
return `${interactive.tagName.toLowerCase()}${role ? `[role=${role}]` : ""}`;
|
|
110
|
+
};
|
|
111
|
+
var describeRequest = (input, init) => {
|
|
112
|
+
if (typeof input === "object" && input !== null && "url" in input && typeof input.url === "string") {
|
|
113
|
+
const request = input;
|
|
114
|
+
return { method: init?.method ?? request.method ?? "GET", url: request.url };
|
|
115
|
+
}
|
|
116
|
+
return { method: init?.method ?? "GET", url: String(input) };
|
|
117
|
+
};
|
|
118
|
+
var isAbortError = (error) => typeof error === "object" && error !== null && error.name === "AbortError";
|
|
119
|
+
var installBrowserIssueCapture = (reporter, options = {}) => {
|
|
120
|
+
const browserWindow = options.browserWindow ?? readBrowserWindow();
|
|
121
|
+
if (!browserWindow || unwrappedFetchByWindow.has(browserWindow)) return () => void 0;
|
|
122
|
+
const now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
123
|
+
const isIgnoredRequestUrl = options.isIgnoredRequestUrl ?? ((url) => url.includes(DDD_ISSUES_REPORT_PATH));
|
|
124
|
+
const uninstallSteps = [];
|
|
125
|
+
const listen = (type, listener, listenerOptions) => {
|
|
126
|
+
browserWindow.addEventListener(type, listener, listenerOptions);
|
|
127
|
+
uninstallSteps.push(() => browserWindow.removeEventListener(type, listener, listenerOptions));
|
|
128
|
+
};
|
|
129
|
+
listen("error", (event) => {
|
|
130
|
+
const errorEvent = event;
|
|
131
|
+
const error = errorEvent.error ?? Object.assign(new Error(errorEvent.message || "Script error."), {
|
|
132
|
+
stack: errorEvent.filename ? `Error: ${errorEvent.message}
|
|
133
|
+
at ${errorEvent.filename}:${errorEvent.lineno}:${errorEvent.colno}` : void 0
|
|
134
|
+
});
|
|
135
|
+
reporter.captureError(error, "error");
|
|
136
|
+
});
|
|
137
|
+
listen("unhandledrejection", (event) => {
|
|
138
|
+
reporter.captureError(event.reason, "unhandledrejection");
|
|
139
|
+
});
|
|
140
|
+
if (options.captureClicks !== false) {
|
|
141
|
+
listen(
|
|
142
|
+
"click",
|
|
143
|
+
(event) => {
|
|
144
|
+
const action = describeIssuesClickTarget(event.target);
|
|
145
|
+
if (action) reporter.addBreadcrumb(uiBreadcrumb(now(), action));
|
|
146
|
+
},
|
|
147
|
+
{ capture: true, passive: true }
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
const originalFetch = browserWindow.fetch;
|
|
151
|
+
unwrappedFetchByWindow.set(browserWindow, originalFetch.bind(browserWindow));
|
|
152
|
+
uninstallSteps.push(() => unwrappedFetchByWindow.delete(browserWindow));
|
|
153
|
+
if (options.captureFetch !== false) {
|
|
154
|
+
const wrappedFetch = async (input, init) => {
|
|
155
|
+
const { method, url } = describeRequest(input, init);
|
|
156
|
+
try {
|
|
157
|
+
const response = await originalFetch.call(browserWindow, input, init);
|
|
158
|
+
if (response.status >= 400 && !isIgnoredRequestUrl(url)) {
|
|
159
|
+
reporter.addBreadcrumb(fetchBreadcrumb(now(), method, url, response.status));
|
|
160
|
+
}
|
|
161
|
+
return response;
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (!isAbortError(error) && !isIgnoredRequestUrl(url)) {
|
|
164
|
+
reporter.addBreadcrumb(fetchBreadcrumb(now(), method, url, "network-error"));
|
|
165
|
+
}
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
browserWindow.fetch = wrappedFetch;
|
|
170
|
+
uninstallSteps.push(() => {
|
|
171
|
+
if (browserWindow.fetch === wrappedFetch) browserWindow.fetch = originalFetch;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const browserConsole = browserWindow.console ?? globalThis.console;
|
|
175
|
+
if (options.captureConsoleErrors !== false && browserConsole) {
|
|
176
|
+
const originalConsoleError = browserConsole.error;
|
|
177
|
+
const wrappedConsoleError = (...args) => {
|
|
178
|
+
reporter.addBreadcrumb(consoleBreadcrumb(now(), describeConsoleArgument(args[0])));
|
|
179
|
+
originalConsoleError.apply(browserConsole, args);
|
|
180
|
+
};
|
|
181
|
+
browserConsole.error = wrappedConsoleError;
|
|
182
|
+
uninstallSteps.push(() => {
|
|
183
|
+
if (browserConsole.error === wrappedConsoleError) browserConsole.error = originalConsoleError;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const flushOnLeave = () => void reporter.flush({ unloading: true });
|
|
187
|
+
listen("pagehide", flushOnLeave);
|
|
188
|
+
const browserDocument = browserWindow.document;
|
|
189
|
+
if (browserDocument) {
|
|
190
|
+
const flushWhenHidden = () => {
|
|
191
|
+
if (browserDocument.visibilityState === "hidden") flushOnLeave();
|
|
192
|
+
};
|
|
193
|
+
browserDocument.addEventListener("visibilitychange", flushWhenHidden);
|
|
194
|
+
uninstallSteps.push(() => browserDocument.removeEventListener("visibilitychange", flushWhenHidden));
|
|
195
|
+
}
|
|
196
|
+
return () => {
|
|
197
|
+
for (const uninstallStep of uninstallSteps.splice(0).reverse()) uninstallStep();
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
var createBrowserIssuesRouteTracker = (reporter, browserWindow = readBrowserWindow()) => {
|
|
201
|
+
const routeTracker = createIssuesRouteTracker(reporter);
|
|
202
|
+
return {
|
|
203
|
+
trackRoute: (pathname, params) => routeTracker.trackRoute(pathname, params, browserWindow?.location?.href ?? pathname)
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
var captureRenderError = (reporter, error, options = {}) => {
|
|
207
|
+
const digest = typeof error === "object" && error !== null ? error.digest : void 0;
|
|
208
|
+
if (digest && !options.reportServerDigests) return;
|
|
209
|
+
reporter?.captureError(error, "react-render");
|
|
210
|
+
};
|
|
211
|
+
export {
|
|
212
|
+
DDD_ISSUES_TAB_ID_STORAGE_KEY,
|
|
213
|
+
captureRenderError,
|
|
214
|
+
createBeaconIssuesTransport,
|
|
215
|
+
createBrowserIssuesReporter,
|
|
216
|
+
createBrowserIssuesRouteTracker,
|
|
217
|
+
describeIssuesClickTarget,
|
|
218
|
+
installBrowserIssueCapture,
|
|
219
|
+
readOrCreateIssuesTabId
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/issues/browser/index.ts"],"sourcesContent":["/**\n * `@mgamadeus/ddd-web/issues/browser` — the browser adapter of the issues reporter: a reporter with the page's\n * context and a keepalive / beacon transport, the global capture points (uncaught errors, unhandled rejections,\n * breadcrumbs from failed requests, `console.error` and clicks, flush on `pagehide`), a route tracker and render-error\n * reporting for error boundaries. No framework: a Next.js, Vite or any other app calls these from its own entry points.\n */\nimport {\n consoleBreadcrumb,\n createFetchIssuesTransport,\n createIssuesReporter,\n createIssuesRouteTracker,\n fetchBreadcrumb,\n uiBreadcrumb,\n type IssuesFetchFunction,\n type IssuesReporter,\n type IssuesReporterOptions,\n type IssuesRouteParams,\n type IssuesTransport,\n} from '../index';\nimport { DDD_ISSUES_REPORT_PATH, type DddClientIssueEvent, type DddClientIssuesReportRequestBody } from '../wire';\n\ntype BrowserEventListener = (event: Event) => void;\n\n/** The part of `window` the adapter uses; a test passes a fake (an `EventTarget` with `fetch`). */\nexport interface IssuesBrowserWindow {\n addEventListener: (type: string, listener: BrowserEventListener, options?: boolean | AddEventListenerOptions) => void;\n removeEventListener: (type: string, listener: BrowserEventListener, options?: boolean | EventListenerOptions) => void;\n fetch: typeof fetch;\n document?: {\n visibilityState: string;\n addEventListener: (type: string, listener: BrowserEventListener) => void;\n removeEventListener: (type: string, listener: BrowserEventListener) => void;\n };\n location?: { href: string; origin: string };\n navigator?: { webdriver?: boolean; language?: string; sendBeacon?: (url: string, data?: BodyInit | null) => boolean };\n innerWidth?: number;\n innerHeight?: number;\n sessionStorage?: Pick<Storage, 'getItem' | 'setItem'>;\n crypto?: { randomUUID?: () => string };\n console?: { error: (...args: unknown[]) => void };\n}\n\nconst readBrowserWindow = (): IssuesBrowserWindow | null => {\n const candidate = globalThis as unknown as Partial<IssuesBrowserWindow>;\n return typeof candidate.addEventListener === 'function' && typeof candidate.fetch === 'function'\n ? (candidate as IssuesBrowserWindow)\n : null;\n};\n\n/** The `fetch` from before {@link installBrowserIssueCapture} wrapped it, per window: the reporter's own requests leave no breadcrumbs. */\nconst unwrappedFetchByWindow = new WeakMap<object, typeof fetch>();\n\nconst readUnwrappedFetch = (browserWindow: IssuesBrowserWindow): typeof fetch =>\n unwrappedFetchByWindow.get(browserWindow) ?? browserWindow.fetch.bind(browserWindow);\n\n/** Default key of the per-tab id in `sessionStorage`. */\nexport const DDD_ISSUES_TAB_ID_STORAGE_KEY = 'ddd-issues-tab-id';\n\n/**\n * The id of this tab, kept in `sessionStorage`: tells one user's repeats from many users, never a person. Null when\n * storage is blocked (private mode, a sandboxed frame).\n */\nexport const readOrCreateIssuesTabId = (\n storageKey: string = DDD_ISSUES_TAB_ID_STORAGE_KEY,\n browserWindow: IssuesBrowserWindow | null = readBrowserWindow(),\n): string | null => {\n try {\n const storage = browserWindow?.sessionStorage;\n if (!storage) return null;\n const existingTabId = storage.getItem(storageKey);\n if (existingTabId) return existingTabId;\n const tabId =\n browserWindow?.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n storage.setItem(storageKey, tabId);\n return tabId;\n } catch {\n return null;\n }\n};\n\nexport interface BeaconIssuesTransportOptions {\n /** Sends whatever the beacon does not: every request that is not unloading, or carries headers a beacon cannot. */\n fallback?: IssuesTransport;\n browserWindow?: IssuesBrowserWindow | null;\n}\n\n/**\n * Sends an unloading request (`flush({ unloading: true })`) with `navigator.sendBeacon` (as `text/plain`, no CORS preflight; the backend reads the\n * JSON body regardless of its type) and everything else with the fallback (default: `fetch` with keepalive). A beacon\n * carries no headers: a request with `Authorization` or a server token always goes through the fallback, so the\n * account attribution is never lost. A queued beacon answers 202.\n */\nexport const createBeaconIssuesTransport = (options: BeaconIssuesTransportOptions = {}): IssuesTransport => {\n const fallback = options.fallback ?? createFetchIssuesTransport();\n return async (request) => {\n const browserWindow = options.browserWindow === undefined ? readBrowserWindow() : options.browserWindow;\n const sendBeacon = browserWindow?.navigator?.sendBeacon;\n const hasHeadersBeyondContentType = Object.keys(request.headers).some(\n (headerName) => !['content-type', 'accept'].includes(headerName.toLowerCase()),\n );\n if (request.unloading && typeof sendBeacon === 'function' && !hasHeadersBeyondContentType) {\n try {\n const isQueued = sendBeacon.call(\n browserWindow?.navigator,\n request.url,\n new Blob([request.body], { type: 'text/plain;charset=UTF-8' }),\n );\n if (isQueued) return { status: 202 };\n } catch {\n // Fall through to the fallback.\n }\n }\n return fallback(request);\n };\n};\n\ntype BrowserReporterBaseOptions = Omit<\n IssuesReporterOptions<DddClientIssueEvent, DddClientIssuesReportRequestBody>,\n 'runtime' | 'endpoint' | 'transport' | 'context' | 'serverToken' | 'serverTokenHeader'\n>;\n\nexport interface BrowserIssuesReporterOptions extends BrowserReporterBaseOptions {\n /**\n * The ingest endpoint: a full URL, a path of this origin, or a function read at send time. Default\n * {@link DDD_ISSUES_REPORT_PATH} on this origin.\n */\n endpoint?: string | (() => string | null);\n /** The release the backend files the error under (and looks its source maps up by). Read at send time. */\n release?: () => string | null | undefined;\n /** Default `navigator.language`. */\n locale?: () => string | null | undefined;\n /** Default: beacon on unload, `fetch` (keepalive, no cookies) otherwise, with the fetch from before the capture wrapped it. */\n transport?: IssuesTransport;\n /** `sessionStorage` key of the tab id; null = no tab id. Default {@link DDD_ISSUES_TAB_ID_STORAGE_KEY}. */\n tabIdStorageKey?: string | null;\n browserWindow?: IssuesBrowserWindow;\n}\n\n/**\n * A reporter for the page: runtime `browser`, session caps, viewport / locale / tab id as context, in-app files =\n * this origin's scripts, nothing reported under automation (`navigator.webdriver`). Null outside a browser (SSR).\n */\nexport const createBrowserIssuesReporter = (options: BrowserIssuesReporterOptions): IssuesReporter | null => {\n const browserWindow = options.browserWindow ?? readBrowserWindow();\n if (!browserWindow) return null;\n const tabId =\n options.tabIdStorageKey === null\n ? null\n : readOrCreateIssuesTabId(options.tabIdStorageKey ?? DDD_ISSUES_TAB_ID_STORAGE_KEY, browserWindow);\n const configuredEndpoint = options.endpoint ?? DDD_ISSUES_REPORT_PATH;\n const resolveEndpoint = (): string | null => {\n const endpoint = typeof configuredEndpoint === 'function' ? configuredEndpoint() : configuredEndpoint;\n if (!endpoint) return null;\n const origin = browserWindow.location?.origin;\n return endpoint.startsWith('/') && !endpoint.startsWith('//') && origin ? `${origin}${endpoint}` : endpoint;\n };\n const origin = browserWindow.location?.origin;\n const isInAppFile = (file: string): boolean => (origin ? file.startsWith(`${origin}/`) : false) || file.startsWith('/');\n\n const { endpoint: _endpoint, release, locale, transport, tabIdStorageKey: _tabIdStorageKey, browserWindow: _browserWindow, ...reporterOptions } =\n options;\n return createIssuesReporter({\n isInAppFile,\n isAutomated: () => browserWindow.navigator?.webdriver === true,\n ...reporterOptions,\n runtime: 'browser',\n endpoint: resolveEndpoint,\n context: () => ({\n release: release?.() ?? null,\n tabId,\n // The backend reads a browser's user agent from the request header.\n userAgent: null,\n viewportWidth: browserWindow.innerWidth ?? null,\n viewportHeight: browserWindow.innerHeight ?? null,\n locale: (locale ? locale() : browserWindow.navigator?.language) || null,\n }),\n transport:\n transport ??\n createBeaconIssuesTransport({\n browserWindow,\n fallback: createFetchIssuesTransport({\n fetch: () => readUnwrappedFetch(browserWindow) as unknown as IssuesFetchFunction,\n }),\n }),\n });\n};\n\nexport interface BrowserIssueCaptureOptions {\n browserWindow?: IssuesBrowserWindow;\n /** Breadcrumb per failed request (status ≥ 400 or no answer). Default true. */\n captureFetch?: boolean;\n /** Breadcrumb per `console.error` (its first argument). Default true. */\n captureConsoleErrors?: boolean;\n /** Breadcrumb per click (`data-issues-action`, else tag and role; never text). Default true. */\n captureClicks?: boolean;\n /** Requests that leave no breadcrumb. Default: URLs containing {@link DDD_ISSUES_REPORT_PATH}. */\n isIgnoredRequestUrl?: (url: string) => boolean;\n now?: () => string;\n}\n\nconst describeConsoleArgument = (value: unknown): string => {\n if (typeof value === 'string') return value;\n if (value instanceof Error) return `${value.name}: ${value.message}`;\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n};\n\ninterface ElementLike {\n tagName: string;\n getAttribute: (name: string) => string | null;\n closest: (selector: string) => ElementLike | null;\n}\n\nconst isElementLike = (value: unknown): value is ElementLike =>\n typeof value === 'object' &&\n value !== null &&\n typeof (value as ElementLike).closest === 'function' &&\n typeof (value as ElementLike).getAttribute === 'function' &&\n typeof (value as ElementLike).tagName === 'string';\n\n/** `data-issues-action` of the clicked element or an ancestor, else its tag and role — never text. */\nexport const describeIssuesClickTarget = (target: unknown): string | null => {\n if (!isElementLike(target)) return null;\n const withAction = target.closest('[data-issues-action]');\n if (withAction) return withAction.getAttribute('data-issues-action');\n const interactive = target.closest('button, a, [role], input, select, textarea, label') ?? target;\n const role = interactive.getAttribute('role');\n return `${interactive.tagName.toLowerCase()}${role ? `[role=${role}]` : ''}`;\n};\n\nconst describeRequest = (input: unknown, init?: RequestInit): { method: string; url: string } => {\n if (typeof input === 'object' && input !== null && 'url' in input && typeof (input as Request).url === 'string') {\n const request = input as Request;\n return { method: init?.method ?? request.method ?? 'GET', url: request.url };\n }\n return { method: init?.method ?? 'GET', url: String(input) };\n};\n\nconst isAbortError = (error: unknown): boolean =>\n typeof error === 'object' && error !== null && (error as { name?: unknown }).name === 'AbortError';\n\n/**\n * Installs the browser capture points once per window (before hydration, e.g. in the client instrumentation file):\n * - uncaught errors (`error`) and unhandled rejections → reported;\n * - failed requests, `console.error` and clicks → breadcrumbs only, never reports of their own;\n * - `pagehide` / tab hidden → flush with keepalive.\n * Render crashes come from the app's error boundaries ({@link captureRenderError}). Returns the uninstall function.\n */\nexport const installBrowserIssueCapture = (\n reporter: IssuesReporter,\n options: BrowserIssueCaptureOptions = {},\n): (() => void) => {\n const browserWindow = options.browserWindow ?? readBrowserWindow();\n if (!browserWindow || unwrappedFetchByWindow.has(browserWindow)) return () => undefined;\n const now = options.now ?? (() => new Date().toISOString());\n const isIgnoredRequestUrl = options.isIgnoredRequestUrl ?? ((url: string) => url.includes(DDD_ISSUES_REPORT_PATH));\n const uninstallSteps: (() => void)[] = [];\n\n const listen = (type: string, listener: BrowserEventListener, listenerOptions?: AddEventListenerOptions) => {\n browserWindow.addEventListener(type, listener, listenerOptions);\n uninstallSteps.push(() => browserWindow.removeEventListener(type, listener, listenerOptions));\n };\n\n listen('error', (event) => {\n const errorEvent = event as ErrorEvent;\n // A script error without an Error object (cross-origin, old browsers): the position comes from the event.\n const error =\n errorEvent.error ??\n Object.assign(new Error(errorEvent.message || 'Script error.'), {\n stack: errorEvent.filename\n ? `Error: ${errorEvent.message}\\n at ${errorEvent.filename}:${errorEvent.lineno}:${errorEvent.colno}`\n : undefined,\n });\n reporter.captureError(error, 'error');\n });\n\n listen('unhandledrejection', (event) => {\n reporter.captureError((event as PromiseRejectionEvent).reason, 'unhandledrejection');\n });\n\n if (options.captureClicks !== false) {\n listen(\n 'click',\n (event) => {\n const action = describeIssuesClickTarget(event.target);\n if (action) reporter.addBreadcrumb(uiBreadcrumb(now(), action));\n },\n { capture: true, passive: true },\n );\n }\n\n const originalFetch = browserWindow.fetch;\n unwrappedFetchByWindow.set(browserWindow, originalFetch.bind(browserWindow));\n uninstallSteps.push(() => unwrappedFetchByWindow.delete(browserWindow));\n if (options.captureFetch !== false) {\n const wrappedFetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {\n const { method, url } = describeRequest(input, init);\n try {\n const response = await originalFetch.call(browserWindow, input, init);\n if (response.status >= 400 && !isIgnoredRequestUrl(url)) {\n reporter.addBreadcrumb(fetchBreadcrumb(now(), method, url, response.status));\n }\n return response;\n } catch (error) {\n if (!isAbortError(error) && !isIgnoredRequestUrl(url)) {\n reporter.addBreadcrumb(fetchBreadcrumb(now(), method, url, 'network-error'));\n }\n throw error;\n }\n };\n browserWindow.fetch = wrappedFetch as typeof fetch;\n uninstallSteps.push(() => {\n if (browserWindow.fetch === wrappedFetch) browserWindow.fetch = originalFetch;\n });\n }\n\n const browserConsole = browserWindow.console ?? (globalThis as { console?: { error: (...args: unknown[]) => void } }).console;\n if (options.captureConsoleErrors !== false && browserConsole) {\n const originalConsoleError = browserConsole.error;\n const wrappedConsoleError = (...args: unknown[]) => {\n reporter.addBreadcrumb(consoleBreadcrumb(now(), describeConsoleArgument(args[0])));\n originalConsoleError.apply(browserConsole, args);\n };\n browserConsole.error = wrappedConsoleError;\n uninstallSteps.push(() => {\n if (browserConsole.error === wrappedConsoleError) browserConsole.error = originalConsoleError;\n });\n }\n\n const flushOnLeave = () => void reporter.flush({ unloading: true });\n listen('pagehide', flushOnLeave);\n const browserDocument = browserWindow.document;\n if (browserDocument) {\n const flushWhenHidden = () => {\n if (browserDocument.visibilityState === 'hidden') flushOnLeave();\n };\n browserDocument.addEventListener('visibilitychange', flushWhenHidden);\n uninstallSteps.push(() => browserDocument.removeEventListener('visibilitychange', flushWhenHidden));\n }\n\n return () => {\n for (const uninstallStep of uninstallSteps.splice(0).reverse()) uninstallStep();\n };\n};\n\n/**\n * Route tracking for a browser router: call `trackRoute(pathname, params)` on every route change (e.g. from an\n * effect on the router's path and params). The URL is the page's `location.href`, redacted by the reporter.\n */\nexport const createBrowserIssuesRouteTracker = (\n reporter: IssuesReporter,\n browserWindow: IssuesBrowserWindow | null = readBrowserWindow(),\n): { trackRoute: (pathname: string, params?: IssuesRouteParams | null) => string } => {\n const routeTracker = createIssuesRouteTracker(reporter);\n return {\n trackRoute: (pathname, params) => routeTracker.trackRoute(pathname, params, browserWindow?.location?.href ?? pathname),\n };\n};\n\n/**\n * A render crash caught by an error boundary. An error with a `digest` was thrown on the SERVER (React server\n * components): the browser only gets a placeholder message and the server's reporter has the real one, so it is not\n * reported twice unless `reportServerDigests` is set.\n */\nexport const captureRenderError = (\n reporter: IssuesReporter | null | undefined,\n error: unknown,\n options: { reportServerDigests?: boolean } = {},\n): void => {\n const digest = typeof error === 'object' && error !== null ? (error as { digest?: unknown }).digest : undefined;\n if (digest && !options.reportServerDigests) return;\n reporter?.captureError(error, 'react-render');\n};\n"],"mappings":";;;;;;;;;;;;;AA0CA,IAAM,oBAAoB,MAAkC;AAC1D,QAAM,YAAY;AAClB,SAAO,OAAO,UAAU,qBAAqB,cAAc,OAAO,UAAU,UAAU,aACjF,YACD;AACN;AAGA,IAAM,yBAAyB,oBAAI,QAA8B;AAEjE,IAAM,qBAAqB,CAAC,kBAC1B,uBAAuB,IAAI,aAAa,KAAK,cAAc,MAAM,KAAK,aAAa;AAG9E,IAAM,gCAAgC;AAMtC,IAAM,0BAA0B,CACrC,aAAqB,+BACrB,gBAA4C,kBAAkB,MAC5C;AAClB,MAAI;AACF,UAAM,UAAU,eAAe;AAC/B,QAAI,CAAC,QAAS,QAAO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QAAQ;AACtD,SAAO;AAAA,IACL,YAAY,CAAC,UAAU,WAAW,aAAa,WAAW,UAAU,QAAQ,eAAe,UAAU,QAAQ,QAAQ;AAAA,EACvH;AACF;AAOO,IAAM,qBAAqB,CAChC,UACA,OACA,UAA6C,CAAC,MACrC;AACT,QAAM,SAAS,OAAO,UAAU,YAAY,UAAU,OAAQ,MAA+B,SAAS;AACtG,MAAI,UAAU,CAAC,QAAQ,oBAAqB;AAC5C,YAAU,aAAa,OAAO,cAAc;AAC9C;","names":["origin"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { b as IssuesRedactor } from '../reporter-BZoRQgsR.js';
|
|
2
|
+
export { D as DDD_ISSUES_SERVER_TOKEN_HEADER, c as DEFAULT_ISSUES_TOKEN_PATH_SEGMENTS, d as ISSUES_LIMITS, e as ISSUES_REDACTION_RULES, f as ISSUE_DROP_RULES, g as InAppFileTest, h as IssueDropCandidate, i as IssueDropRule, j as IssuesClock, k as IssuesContextValues, l as IssuesLimits, m as IssuesLimitsOverrides, n as IssuesRateLimitMode, o as IssuesRedactionRule, p as IssuesRedactorOptions, a as IssuesReporter, I as IssuesReporterOptions, q as IssuesSessionLimits, r as IssuesWindowedLimits, N as NormalizedError, s as createIssuesRedactor, t as createIssuesReporter, u as createPlatformIssuesClock, v as findIssueDropRule, w as isForeignFile, x as mergeIssuesLimits, y as normalizeError, z as parseStack, A as redactText, B as redactUrl, C as truncate, E as utf8ByteLength } from '../reporter-BZoRQgsR.js';
|
|
3
|
+
import { C as CapturedBreadcrumb, b as CapturedFrame, I as IssuesTransport } from '../index-C0Auocn8.js';
|
|
4
|
+
export { B as BreadcrumbCategory, c as CaptureExtra, d as CapturedIssueContext, e as CapturedIssueEvent, f as CapturedTag, g as IssueKind, h as IssueLevel, i as IssuesRuntime, j as IssuesTransportRequest, k as IssuesTransportResponse, l as IssuesWireAdapter } from '../index-C0Auocn8.js';
|
|
5
|
+
export { I as IssuesRouteParams, a as IssuesRouteTarget, b as IssuesRouteTracker, c as buildRoutePattern, d as createIssuesRouteTracker } from '../route-pattern-KPafYJmY.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* What happened before an error, newest last. Builders only: every string is capped and redacted here, so a caller
|
|
9
|
+
* cannot add an unredacted URL (the reporter applies its own redactor again on add). Never bodies, never input values,
|
|
10
|
+
* never the visible text of a clicked element.
|
|
11
|
+
*/
|
|
12
|
+
interface BreadcrumbTrail {
|
|
13
|
+
add: (breadcrumb: CapturedBreadcrumb) => void;
|
|
14
|
+
/** A copy, oldest first */
|
|
15
|
+
snapshot: () => CapturedBreadcrumb[];
|
|
16
|
+
}
|
|
17
|
+
/** Keeps the newest `limit` breadcrumbs. */
|
|
18
|
+
declare const createBreadcrumbTrail: (limit?: number) => BreadcrumbTrail;
|
|
19
|
+
/** Caps and redacts every string of a breadcrumb. */
|
|
20
|
+
declare const sanitizeBreadcrumb: (breadcrumb: CapturedBreadcrumb, redactor?: IssuesRedactor) => CapturedBreadcrumb;
|
|
21
|
+
type BreadcrumbFields = Partial<Pick<CapturedBreadcrumb, 'url' | 'from' | 'to' | 'status'>>;
|
|
22
|
+
/** A route change; `from` / `to` are route patterns or paths. */
|
|
23
|
+
declare const navigationBreadcrumb: (at: string, from: string | null, to: string) => CapturedBreadcrumb;
|
|
24
|
+
/** A failed request: status ≥ 400, or `network-error` when it never got an answer. */
|
|
25
|
+
declare const fetchBreadcrumb: (at: string, method: string, url: string, outcome: number | "network-error") => CapturedBreadcrumb;
|
|
26
|
+
/** `console.error`: its first argument only. */
|
|
27
|
+
declare const consoleBreadcrumb: (at: string, message: string) => CapturedBreadcrumb;
|
|
28
|
+
/**
|
|
29
|
+
* A click: the element's `data-issues-action` id, else its tag and role. Never its text or `aria-label`, which can
|
|
30
|
+
* hold an e-mail or a name.
|
|
31
|
+
*/
|
|
32
|
+
declare const uiBreadcrumb: (at: string, action: string) => CapturedBreadcrumb;
|
|
33
|
+
/** Anything else the app wants on the trail. */
|
|
34
|
+
declare const customBreadcrumb: (at: string, message: string, fields?: BreadcrumbFields) => CapturedBreadcrumb;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The CLIENT's de-duplication key: `name | normalised message | top frame file:function`. Only for folding repeats on
|
|
38
|
+
* one device (sent as `clientFingerprint`, informational); the backend builds the group and issue hashes itself
|
|
39
|
+
* (mgamadeus/ddd `ClientIssuesFingerprintBuilder`) and never trusts this one.
|
|
40
|
+
*/
|
|
41
|
+
/** URLs, UUIDs, hex ids and numbers become placeholders, so `order 41 failed` and `order 42 failed` are one key. */
|
|
42
|
+
declare const normaliseIssueMessage: (message: string) => string;
|
|
43
|
+
/** The top frame is the innermost in-app frame, else the innermost frame. */
|
|
44
|
+
declare const buildClientFingerprint: (name: string, message: string, frames: readonly CapturedFrame[]) => string;
|
|
45
|
+
|
|
46
|
+
/** The part of the Fetch API the transport uses (browser, Node 18+, React Native). */
|
|
47
|
+
type IssuesFetchFunction = (url: string, init: {
|
|
48
|
+
method: string;
|
|
49
|
+
headers: Record<string, string>;
|
|
50
|
+
body: string;
|
|
51
|
+
keepalive?: boolean;
|
|
52
|
+
credentials?: 'omit' | 'same-origin' | 'include';
|
|
53
|
+
signal?: unknown;
|
|
54
|
+
}) => Promise<{
|
|
55
|
+
status: number;
|
|
56
|
+
}>;
|
|
57
|
+
interface FetchIssuesTransportOptions {
|
|
58
|
+
/** Read at send time; default the global `fetch` as it is then. */
|
|
59
|
+
fetch?: () => IssuesFetchFunction | undefined;
|
|
60
|
+
/** Default `omit`: the report carries a bearer when there is a session, never cookies. */
|
|
61
|
+
credentials?: 'omit' | 'same-origin' | 'include';
|
|
62
|
+
/** Aborts a request that takes longer (where `AbortSignal.timeout` exists); default none. */
|
|
63
|
+
timeoutMs?: number;
|
|
64
|
+
}
|
|
65
|
+
/** POSTs with `fetch`. Rejects on a network error, like `fetch` itself. Touches no global before the first send. */
|
|
66
|
+
declare const createFetchIssuesTransport: (options?: FetchIssuesTransportOptions) => IssuesTransport;
|
|
67
|
+
|
|
68
|
+
export { CapturedBreadcrumb, CapturedFrame, IssuesRedactor, IssuesTransport, buildClientFingerprint, consoleBreadcrumb, createBreadcrumbTrail, createFetchIssuesTransport, customBreadcrumb, fetchBreadcrumb, navigationBreadcrumb, normaliseIssueMessage, sanitizeBreadcrumb, uiBreadcrumb };
|
|
69
|
+
export type { BreadcrumbTrail, FetchIssuesTransportOptions, IssuesFetchFunction };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DDD_ISSUES_SERVER_TOKEN_HEADER,
|
|
3
|
+
DEFAULT_ISSUES_TOKEN_PATH_SEGMENTS,
|
|
4
|
+
ISSUES_LIMITS,
|
|
5
|
+
ISSUES_REDACTION_RULES,
|
|
6
|
+
ISSUE_DROP_RULES,
|
|
7
|
+
buildClientFingerprint,
|
|
8
|
+
buildRoutePattern,
|
|
9
|
+
consoleBreadcrumb,
|
|
10
|
+
createBreadcrumbTrail,
|
|
11
|
+
createFetchIssuesTransport,
|
|
12
|
+
createIssuesRedactor,
|
|
13
|
+
createIssuesReporter,
|
|
14
|
+
createIssuesRouteTracker,
|
|
15
|
+
createPlatformIssuesClock,
|
|
16
|
+
customBreadcrumb,
|
|
17
|
+
fetchBreadcrumb,
|
|
18
|
+
findIssueDropRule,
|
|
19
|
+
isForeignFile,
|
|
20
|
+
mergeIssuesLimits,
|
|
21
|
+
navigationBreadcrumb,
|
|
22
|
+
normaliseIssueMessage,
|
|
23
|
+
normalizeError,
|
|
24
|
+
parseStack,
|
|
25
|
+
redactText,
|
|
26
|
+
redactUrl,
|
|
27
|
+
sanitizeBreadcrumb,
|
|
28
|
+
truncate,
|
|
29
|
+
uiBreadcrumb,
|
|
30
|
+
utf8ByteLength
|
|
31
|
+
} from "../chunk-GVRMHMNO.js";
|
|
32
|
+
import "../chunk-JAYJB2EF.js";
|
|
33
|
+
export {
|
|
34
|
+
DDD_ISSUES_SERVER_TOKEN_HEADER,
|
|
35
|
+
DEFAULT_ISSUES_TOKEN_PATH_SEGMENTS,
|
|
36
|
+
ISSUES_LIMITS,
|
|
37
|
+
ISSUES_REDACTION_RULES,
|
|
38
|
+
ISSUE_DROP_RULES,
|
|
39
|
+
buildClientFingerprint,
|
|
40
|
+
buildRoutePattern,
|
|
41
|
+
consoleBreadcrumb,
|
|
42
|
+
createBreadcrumbTrail,
|
|
43
|
+
createFetchIssuesTransport,
|
|
44
|
+
createIssuesRedactor,
|
|
45
|
+
createIssuesReporter,
|
|
46
|
+
createIssuesRouteTracker,
|
|
47
|
+
createPlatformIssuesClock,
|
|
48
|
+
customBreadcrumb,
|
|
49
|
+
fetchBreadcrumb,
|
|
50
|
+
findIssueDropRule,
|
|
51
|
+
isForeignFile,
|
|
52
|
+
mergeIssuesLimits,
|
|
53
|
+
navigationBreadcrumb,
|
|
54
|
+
normaliseIssueMessage,
|
|
55
|
+
normalizeError,
|
|
56
|
+
parseStack,
|
|
57
|
+
redactText,
|
|
58
|
+
redactUrl,
|
|
59
|
+
sanitizeBreadcrumb,
|
|
60
|
+
truncate,
|
|
61
|
+
uiBreadcrumb,
|
|
62
|
+
utf8ByteLength
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IssuesTransport } from '../index.js';
|
|
2
|
+
import { DddClientIssueEvent, DddClientIssuesReportRequestBody } from '../wire/index.js';
|
|
3
|
+
import { IssuesReporterOptions, IssuesReporter } from '../index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `@mgamadeus/ddd-web/issues/node` — the server adapter of the issues reporter, for a client app's own Node server
|
|
7
|
+
* (an SSR server, a BFF): windowed caps and backoff, the shared server token (the backend files the reports as
|
|
8
|
+
* WEB_SERVER), a request-error handler in the shape of a framework's `onRequestError` hook, and opt-in process hooks.
|
|
9
|
+
* Uses the global `fetch` (Node 18+) and reads `process` only when called — no `node:` import.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
type NodeReporterBaseOptions = Omit<IssuesReporterOptions<DddClientIssueEvent, DddClientIssuesReportRequestBody>, 'runtime' | 'endpoint' | 'transport' | 'context'>;
|
|
13
|
+
interface NodeIssuesReporterOptions extends NodeReporterBaseOptions {
|
|
14
|
+
/**
|
|
15
|
+
* The API origin (`https://api.example.com`, a cluster-internal URL) — the report goes to
|
|
16
|
+
* `<apiBaseUrl><reportPath>` — or a function returning the full endpoint URL. Null / empty = nothing is sent.
|
|
17
|
+
*/
|
|
18
|
+
apiBaseUrl?: string | null | (() => string | null | undefined);
|
|
19
|
+
/** Default {@link DDD_ISSUES_REPORT_PATH} */
|
|
20
|
+
reportPath?: string;
|
|
21
|
+
/** The release the backend files the error under (and looks the server's source maps up by). */
|
|
22
|
+
release?: () => string | null | undefined;
|
|
23
|
+
/** Default `fetch` with a 10 s timeout. */
|
|
24
|
+
transport?: IssuesTransport;
|
|
25
|
+
/** Default 10 000 */
|
|
26
|
+
requestTimeoutMs?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A reporter for a Node server: runtime `node`, windowed caps, no breadcrumbs, user agent `Node.js <version>`, in-app
|
|
30
|
+
* files = everything outside `node_modules` and `node:` built-ins. Without `serverToken` the backend files the reports
|
|
31
|
+
* as a browser's (WEB) — or drops them, when the application requires the token for server reports.
|
|
32
|
+
*/
|
|
33
|
+
declare const createNodeIssuesReporter: (options: NodeIssuesReporterOptions) => IssuesReporter;
|
|
34
|
+
/** The request of a server-side error, as frameworks hand it to their request-error hook. */
|
|
35
|
+
interface ServerIssueRequest {
|
|
36
|
+
path: string;
|
|
37
|
+
method: string;
|
|
38
|
+
}
|
|
39
|
+
/** Where in the server the error happened (fields of a framework's request-error context; all optional). */
|
|
40
|
+
interface ServerIssueRequestContext {
|
|
41
|
+
/** The route PATTERN (`/books/[bookId]`), never the URL */
|
|
42
|
+
routePath?: string | null;
|
|
43
|
+
routerKind?: string;
|
|
44
|
+
routeType?: string;
|
|
45
|
+
renderSource?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A request-error handler `(error, request, context) => void`, structurally compatible with a framework's
|
|
49
|
+
* `onRequestError` hook (Next.js `instrumentation.ts`). Reports kind `server-request` with the route pattern, the
|
|
50
|
+
* redacted path and the method; the error's `digest` goes in as a tag (an error boundary in the browser sees the same
|
|
51
|
+
* digest and does not report it again). `getReporter` may return null (not configured).
|
|
52
|
+
*/
|
|
53
|
+
declare const createServerRequestErrorHandler: (getReporter: () => IssuesReporter | null | undefined) => (error: unknown, request: ServerIssueRequest, context?: ServerIssueRequestContext) => void;
|
|
54
|
+
interface NodeIssueCaptureOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Also report unhandled promise rejections. Off by default: a listener for `unhandledRejection` changes Node's
|
|
57
|
+
* default behaviour (the process no longer exits on one). Turn it on only where that is wanted.
|
|
58
|
+
*/
|
|
59
|
+
unhandledRejections?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Process hooks: uncaught exceptions are reported through `uncaughtExceptionMonitor` (observes only, Node's crash
|
|
63
|
+
* behaviour is unchanged; the queue is flushed right away), `beforeExit` flushes. Returns the uninstall function.
|
|
64
|
+
*/
|
|
65
|
+
declare const installNodeIssueCapture: (reporter: IssuesReporter, options?: NodeIssueCaptureOptions) => (() => void);
|
|
66
|
+
|
|
67
|
+
export { createNodeIssuesReporter, createServerRequestErrorHandler, installNodeIssueCapture };
|
|
68
|
+
export type { NodeIssueCaptureOptions, NodeIssuesReporterOptions, ServerIssueRequest, ServerIssueRequestContext };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFetchIssuesTransport,
|
|
3
|
+
createIssuesReporter,
|
|
4
|
+
redactUrl
|
|
5
|
+
} from "../../chunk-GVRMHMNO.js";
|
|
6
|
+
import {
|
|
7
|
+
DDD_ISSUES_REPORT_PATH
|
|
8
|
+
} from "../../chunk-JAYJB2EF.js";
|
|
9
|
+
|
|
10
|
+
// src/issues/node/index.ts
|
|
11
|
+
var readNodeProcess = () => globalThis.process ?? null;
|
|
12
|
+
var createNodeIssuesReporter = (options) => {
|
|
13
|
+
const { apiBaseUrl, reportPath, release, transport, requestTimeoutMs, ...reporterOptions } = options;
|
|
14
|
+
const resolveEndpoint = () => {
|
|
15
|
+
if (typeof apiBaseUrl === "function") return apiBaseUrl() || null;
|
|
16
|
+
if (!apiBaseUrl) return null;
|
|
17
|
+
return `${apiBaseUrl.replace(/\/+$/, "")}${reportPath ?? DDD_ISSUES_REPORT_PATH}`;
|
|
18
|
+
};
|
|
19
|
+
return createIssuesReporter({
|
|
20
|
+
isInAppFile: (file) => !file.includes("/node_modules/"),
|
|
21
|
+
...reporterOptions,
|
|
22
|
+
runtime: "node",
|
|
23
|
+
endpoint: resolveEndpoint,
|
|
24
|
+
context: () => {
|
|
25
|
+
const nodeVersion = readNodeProcess()?.version;
|
|
26
|
+
return { release: release?.() ?? null, userAgent: nodeVersion ? `Node.js ${nodeVersion}` : null };
|
|
27
|
+
},
|
|
28
|
+
transport: transport ?? createFetchIssuesTransport({ timeoutMs: requestTimeoutMs ?? 1e4 })
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var createServerRequestErrorHandler = (getReporter) => (error, request, context = {}) => {
|
|
32
|
+
try {
|
|
33
|
+
getReporter()?.captureError(error, "server-request", {
|
|
34
|
+
routePattern: context.routePath || null,
|
|
35
|
+
url: redactUrl(request.path),
|
|
36
|
+
requestMethod: request.method,
|
|
37
|
+
tags: {
|
|
38
|
+
digest: error?.digest,
|
|
39
|
+
routerKind: context.routerKind,
|
|
40
|
+
routeType: context.routeType,
|
|
41
|
+
renderSource: context.renderSource
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var installNodeIssueCapture = (reporter, options = {}) => {
|
|
48
|
+
const nodeProcess = readNodeProcess();
|
|
49
|
+
if (!nodeProcess?.on) return () => void 0;
|
|
50
|
+
const uninstallSteps = [];
|
|
51
|
+
const listen = (event, listener) => {
|
|
52
|
+
nodeProcess.on?.(event, listener);
|
|
53
|
+
uninstallSteps.push(() => nodeProcess.off?.(event, listener));
|
|
54
|
+
};
|
|
55
|
+
listen("uncaughtExceptionMonitor", (error) => {
|
|
56
|
+
reporter.captureError(error, "error");
|
|
57
|
+
void reporter.flush();
|
|
58
|
+
});
|
|
59
|
+
listen("beforeExit", () => void reporter.flush());
|
|
60
|
+
if (options.unhandledRejections) {
|
|
61
|
+
listen("unhandledRejection", (reason) => reporter.captureError(reason, "unhandledrejection"));
|
|
62
|
+
}
|
|
63
|
+
return () => {
|
|
64
|
+
for (const uninstallStep of uninstallSteps.splice(0).reverse()) uninstallStep();
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
createNodeIssuesReporter,
|
|
69
|
+
createServerRequestErrorHandler,
|
|
70
|
+
installNodeIssueCapture
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/issues/node/index.ts"],"sourcesContent":["/**\n * `@mgamadeus/ddd-web/issues/node` — the server adapter of the issues reporter, for a client app's own Node server\n * (an SSR server, a BFF): windowed caps and backoff, the shared server token (the backend files the reports as\n * WEB_SERVER), a request-error handler in the shape of a framework's `onRequestError` hook, and opt-in process hooks.\n * Uses the global `fetch` (Node 18+) and reads `process` only when called — no `node:` import.\n */\nimport {\n createFetchIssuesTransport,\n createIssuesReporter,\n redactUrl,\n type IssuesReporter,\n type IssuesReporterOptions,\n type IssuesTransport,\n} from '../index';\nimport type { DddClientIssueEvent, DddClientIssuesReportRequestBody } from '../wire';\nimport { DDD_ISSUES_REPORT_PATH } from '../wire';\n\ninterface NodeProcessLike {\n version?: string;\n on?: (event: string, listener: (...args: unknown[]) => void) => unknown;\n off?: (event: string, listener: (...args: unknown[]) => void) => unknown;\n}\n\nconst readNodeProcess = (): NodeProcessLike | null =>\n ((globalThis as { process?: NodeProcessLike }).process as NodeProcessLike | undefined) ?? null;\n\ntype NodeReporterBaseOptions = Omit<\n IssuesReporterOptions<DddClientIssueEvent, DddClientIssuesReportRequestBody>,\n 'runtime' | 'endpoint' | 'transport' | 'context'\n>;\n\nexport interface NodeIssuesReporterOptions extends NodeReporterBaseOptions {\n /**\n * The API origin (`https://api.example.com`, a cluster-internal URL) — the report goes to\n * `<apiBaseUrl><reportPath>` — or a function returning the full endpoint URL. Null / empty = nothing is sent.\n */\n apiBaseUrl?: string | null | (() => string | null | undefined);\n /** Default {@link DDD_ISSUES_REPORT_PATH} */\n reportPath?: string;\n /** The release the backend files the error under (and looks the server's source maps up by). */\n release?: () => string | null | undefined;\n /** Default `fetch` with a 10 s timeout. */\n transport?: IssuesTransport;\n /** Default 10 000 */\n requestTimeoutMs?: number;\n}\n\n/**\n * A reporter for a Node server: runtime `node`, windowed caps, no breadcrumbs, user agent `Node.js <version>`, in-app\n * files = everything outside `node_modules` and `node:` built-ins. Without `serverToken` the backend files the reports\n * as a browser's (WEB) — or drops them, when the application requires the token for server reports.\n */\nexport const createNodeIssuesReporter = (options: NodeIssuesReporterOptions): IssuesReporter => {\n const { apiBaseUrl, reportPath, release, transport, requestTimeoutMs, ...reporterOptions } = options;\n const resolveEndpoint = (): string | null => {\n if (typeof apiBaseUrl === 'function') return apiBaseUrl() || null;\n if (!apiBaseUrl) return null;\n return `${apiBaseUrl.replace(/\\/+$/, '')}${reportPath ?? DDD_ISSUES_REPORT_PATH}`;\n };\n return createIssuesReporter({\n isInAppFile: (file) => !file.includes('/node_modules/'),\n ...reporterOptions,\n runtime: 'node',\n endpoint: resolveEndpoint,\n context: () => {\n const nodeVersion = readNodeProcess()?.version;\n return { release: release?.() ?? null, userAgent: nodeVersion ? `Node.js ${nodeVersion}` : null };\n },\n transport: transport ?? createFetchIssuesTransport({ timeoutMs: requestTimeoutMs ?? 10_000 }),\n });\n};\n\n/** The request of a server-side error, as frameworks hand it to their request-error hook. */\nexport interface ServerIssueRequest {\n path: string;\n method: string;\n}\n\n/** Where in the server the error happened (fields of a framework's request-error context; all optional). */\nexport interface ServerIssueRequestContext {\n /** The route PATTERN (`/books/[bookId]`), never the URL */\n routePath?: string | null;\n routerKind?: string;\n routeType?: string;\n renderSource?: string;\n}\n\n/**\n * A request-error handler `(error, request, context) => void`, structurally compatible with a framework's\n * `onRequestError` hook (Next.js `instrumentation.ts`). Reports kind `server-request` with the route pattern, the\n * redacted path and the method; the error's `digest` goes in as a tag (an error boundary in the browser sees the same\n * digest and does not report it again). `getReporter` may return null (not configured).\n */\nexport const createServerRequestErrorHandler =\n (getReporter: () => IssuesReporter | null | undefined) =>\n (error: unknown, request: ServerIssueRequest, context: ServerIssueRequestContext = {}): void => {\n try {\n getReporter()?.captureError(error, 'server-request', {\n routePattern: context.routePath || null,\n url: redactUrl(request.path),\n requestMethod: request.method,\n tags: {\n digest: (error as { digest?: string } | null)?.digest,\n routerKind: context.routerKind,\n routeType: context.routeType,\n renderSource: context.renderSource,\n },\n });\n } catch {\n // Never into the framework.\n }\n };\n\nexport interface NodeIssueCaptureOptions {\n /**\n * Also report unhandled promise rejections. Off by default: a listener for `unhandledRejection` changes Node's\n * default behaviour (the process no longer exits on one). Turn it on only where that is wanted.\n */\n unhandledRejections?: boolean;\n}\n\n/**\n * Process hooks: uncaught exceptions are reported through `uncaughtExceptionMonitor` (observes only, Node's crash\n * behaviour is unchanged; the queue is flushed right away), `beforeExit` flushes. Returns the uninstall function.\n */\nexport const installNodeIssueCapture = (\n reporter: IssuesReporter,\n options: NodeIssueCaptureOptions = {},\n): (() => void) => {\n const nodeProcess = readNodeProcess();\n if (!nodeProcess?.on) return () => undefined;\n const uninstallSteps: (() => void)[] = [];\n const listen = (event: string, listener: (...args: unknown[]) => void) => {\n nodeProcess.on?.(event, listener);\n uninstallSteps.push(() => nodeProcess.off?.(event, listener));\n };\n\n listen('uncaughtExceptionMonitor', (error) => {\n reporter.captureError(error, 'error');\n void reporter.flush();\n });\n listen('beforeExit', () => void reporter.flush());\n if (options.unhandledRejections) {\n listen('unhandledRejection', (reason) => reporter.captureError(reason, 'unhandledrejection'));\n }\n\n return () => {\n for (const uninstallStep of uninstallSteps.splice(0).reverse()) uninstallStep();\n };\n};\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,kBAAkB,MACpB,WAA6C,WAA2C;AA4BrF,IAAM,2BAA2B,CAAC,YAAuD;AAC9F,QAAM,EAAE,YAAY,YAAY,SAAS,WAAW,kBAAkB,GAAG,gBAAgB,IAAI;AAC7F,QAAM,kBAAkB,MAAqB;AAC3C,QAAI,OAAO,eAAe,WAAY,QAAO,WAAW,KAAK;AAC7D,QAAI,CAAC,WAAY,QAAO;AACxB,WAAO,GAAG,WAAW,QAAQ,QAAQ,EAAE,CAAC,GAAG,cAAc,sBAAsB;AAAA,EACjF;AACA,SAAO,qBAAqB;AAAA,IAC1B,aAAa,CAAC,SAAS,CAAC,KAAK,SAAS,gBAAgB;AAAA,IACtD,GAAG;AAAA,IACH,SAAS;AAAA,IACT,UAAU;AAAA,IACV,SAAS,MAAM;AACb,YAAM,cAAc,gBAAgB,GAAG;AACvC,aAAO,EAAE,SAAS,UAAU,KAAK,MAAM,WAAW,cAAc,WAAW,WAAW,KAAK,KAAK;AAAA,IAClG;AAAA,IACA,WAAW,aAAa,2BAA2B,EAAE,WAAW,oBAAoB,IAAO,CAAC;AAAA,EAC9F,CAAC;AACH;AAuBO,IAAM,kCACX,CAAC,gBACD,CAAC,OAAgB,SAA6B,UAAqC,CAAC,MAAY;AAC9F,MAAI;AACF,gBAAY,GAAG,aAAa,OAAO,kBAAkB;AAAA,MACnD,cAAc,QAAQ,aAAa;AAAA,MACnC,KAAK,UAAU,QAAQ,IAAI;AAAA,MAC3B,eAAe,QAAQ;AAAA,MACvB,MAAM;AAAA,QACJ,QAAS,OAAsC;AAAA,QAC/C,YAAY,QAAQ;AAAA,QACpB,WAAW,QAAQ;AAAA,QACnB,cAAc,QAAQ;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,EACH,QAAQ;AAAA,EAER;AACF;AAcK,IAAM,0BAA0B,CACrC,UACA,UAAmC,CAAC,MACnB;AACjB,QAAM,cAAc,gBAAgB;AACpC,MAAI,CAAC,aAAa,GAAI,QAAO,MAAM;AACnC,QAAM,iBAAiC,CAAC;AACxC,QAAM,SAAS,CAAC,OAAe,aAA2C;AACxE,gBAAY,KAAK,OAAO,QAAQ;AAChC,mBAAe,KAAK,MAAM,YAAY,MAAM,OAAO,QAAQ,CAAC;AAAA,EAC9D;AAEA,SAAO,4BAA4B,CAAC,UAAU;AAC5C,aAAS,aAAa,OAAO,OAAO;AACpC,SAAK,SAAS,MAAM;AAAA,EACtB,CAAC;AACD,SAAO,cAAc,MAAM,KAAK,SAAS,MAAM,CAAC;AAChD,MAAI,QAAQ,qBAAqB;AAC/B,WAAO,sBAAsB,CAAC,WAAW,SAAS,aAAa,QAAQ,oBAAoB,CAAC;AAAA,EAC9F;AAEA,SAAO,MAAM;AACX,eAAW,iBAAiB,eAAe,OAAO,CAAC,EAAE,QAAQ,EAAG,eAAc;AAAA,EAChF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { m as DDD_ISSUES_REPORT_PATH, n as DddClientIssueBreadcrumb, o as DddClientIssueContext, p as DddClientIssueDropReason, D as DddClientIssueEvent, q as DddClientIssueFrame, r as DddClientIssueIngestResult, s as DddClientIssueReport, t as DddClientIssueSet, u as DddClientIssueTag, a as DddClientIssuesReportRequestBody, v as dddIssuesWireAdapter, w as toDddClientIssueContext, x as toDddClientIssueEvent } from '../../index-C0Auocn8.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DDD_ISSUES_REPORT_PATH,
|
|
3
|
+
dddIssuesWireAdapter,
|
|
4
|
+
toDddClientIssueContext,
|
|
5
|
+
toDddClientIssueEvent
|
|
6
|
+
} from "../../chunk-JAYJB2EF.js";
|
|
7
|
+
export {
|
|
8
|
+
DDD_ISSUES_REPORT_PATH,
|
|
9
|
+
dddIssuesWireAdapter,
|
|
10
|
+
toDddClientIssueContext,
|
|
11
|
+
toDddClientIssueEvent
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|