mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 15:06:32 +00:00
style(server): format the files the health lanes added or moved
Prettier on every new or moved file that was not formatted, so lint:format holds them; the files taken off the format baseline are the ones that moved or were formatted on the way.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { ZodType } from 'zod';
|
||||
import { logWarn } from '../nest/audit/audit-log.logger';
|
||||
|
||||
import type { ZodType } from 'zod';
|
||||
|
||||
/**
|
||||
* One JSON-in-TEXT column: where it lives, the shape it holds, and what a reader
|
||||
* gets when the stored text is missing or broken.
|
||||
@@ -27,8 +28,7 @@ export interface JsonColumn<T> {
|
||||
export type JsonDecodeFailure = 'empty' | 'invalid-json' | 'schema';
|
||||
|
||||
export type JsonDecodeResult<T> =
|
||||
| { ok: true; value: T; reason?: never }
|
||||
| { ok: false; value?: never; reason: JsonDecodeFailure };
|
||||
{ ok: true; value: T; reason?: never } | { ok: false; value?: never; reason: JsonDecodeFailure };
|
||||
|
||||
/**
|
||||
* Decode a stored value without a fallback, for the readers that react to a
|
||||
@@ -65,7 +65,9 @@ export function decodeJson<T>(col: JsonColumn<T>, raw: unknown, context?: string
|
||||
|
||||
/** Log a row whose JSON did not decode; for callers of {@link decodeJsonResult} that handle the failure themselves. */
|
||||
export function logJsonFailure(col: JsonColumn<unknown>, reason: JsonDecodeFailure, context?: string): void {
|
||||
logWarn(`[json] ${col.column}${context ? ` (${context})` : ''}: stored value ${reason === 'schema' ? 'has the wrong shape' : 'is not valid JSON'}, using the fallback`);
|
||||
logWarn(
|
||||
`[json] ${col.column}${context ? ` (${context})` : ''}: stored value ${reason === 'schema' ? 'has the wrong shape' : 'is not valid JSON'}, using the fallback`,
|
||||
);
|
||||
}
|
||||
|
||||
/** The text to store for a value, checked against the column's shape first (a mismatch throws: it is a bug in the writer). */
|
||||
|
||||
Reference in New Issue
Block a user