mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-18 17:04:53 +00:00
Configure lefthook formatter checks (#231)
* Add lefthook formatter checks * Fix SDK mode hydration * Stabilize SDK mode integration test
This commit is contained in:
parent
0471214d65
commit
d2346bafb3
282 changed files with 5840 additions and 8399 deletions
|
|
@ -32,9 +32,7 @@ export function defaultFrontendErrorLogPath(startDirectory: string = process.cwd
|
|||
return resolve(root, DEFAULT_RELATIVE_LOG_PATH);
|
||||
}
|
||||
|
||||
export function createFrontendErrorCollectorRouter(
|
||||
options: FrontendErrorCollectorRouterOptions = {}
|
||||
): Hono {
|
||||
export function createFrontendErrorCollectorRouter(options: FrontendErrorCollectorRouterOptions = {}): Hono {
|
||||
const logFilePath = options.logFilePath ?? defaultFrontendErrorLogPath();
|
||||
const reporter = trimText(options.reporter, 128) ?? DEFAULT_REPORTER;
|
||||
let ensureLogPathPromise: Promise<void> | null = null;
|
||||
|
|
@ -46,7 +44,7 @@ export function createFrontendErrorCollectorRouter(
|
|||
ok: true,
|
||||
logFilePath,
|
||||
reporter,
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
app.post("/events", async (c) => {
|
||||
|
|
@ -78,7 +76,7 @@ export function createFrontendErrorCollectorRouter(
|
|||
userAgent: userAgent ?? null,
|
||||
clientIp: clientIp ?? null,
|
||||
receivedAt,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +94,7 @@ export function createFrontendErrorCollectorRouter(
|
|||
ok: true,
|
||||
accepted: normalizedEvents.length,
|
||||
},
|
||||
202
|
||||
202,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -260,16 +258,8 @@ function readClientIp(forwardedFor: string | undefined): string | null {
|
|||
return trimText(first, 64) ?? null;
|
||||
}
|
||||
|
||||
function isAllowedContextValue(
|
||||
value: unknown
|
||||
): value is string | number | boolean | null | undefined {
|
||||
return (
|
||||
value === null ||
|
||||
value === undefined ||
|
||||
typeof value === "string" ||
|
||||
typeof value === "number" ||
|
||||
typeof value === "boolean"
|
||||
);
|
||||
function isAllowedContextValue(value: unknown): value is string | number | boolean | null | undefined {
|
||||
return value === null || value === undefined || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue