add repo-wide typechecking
Some checks are pending
CI / Validate (push) Waiting to run

This commit is contained in:
dirtydishes 2026-05-29 02:19:30 -04:00
parent 85ad7f7387
commit e9e2723c28
30 changed files with 380 additions and 44 deletions

View file

@ -1,10 +1,13 @@
import {
connect,
consumerOpts,
DiscardPolicy,
type ConsumerOptsBuilder,
type JetStreamClient,
type JetStreamManager,
type NatsConnection,
RetentionPolicy,
StorageType,
type StreamConfig,
type StreamUpdateConfig,
JSONCodec,
@ -182,17 +185,18 @@ export const buildStreamConfig = (
subject: string,
streamClass: StreamRetentionClass,
env: Record<string, string | undefined> = process.env
): StreamConfig => ({
name,
subjects: [subject],
retention: "limits",
storage: "file",
discard: "old",
max_msgs_per_subject: -1,
max_msgs: -1,
...resolveStreamRetention(streamClass, env),
num_replicas: 1
});
): StreamConfig =>
({
name,
subjects: [subject],
retention: RetentionPolicy.Limits,
storage: StorageType.File,
discard: DiscardPolicy.Old,
max_msgs_per_subject: -1,
max_msgs: -1,
...resolveStreamRetention(streamClass, env),
num_replicas: 1
}) as StreamConfig;
export const buildKnownStreamConfig = (
name: string,

View file

@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": []
"types": ["bun"]
},
"include": ["src/**/*.ts"]
}

View file

@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": []
"types": ["bun"]
},
"include": ["src/**/*.ts"]
}

View file

@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": []
"types": ["bun"]
},
"include": ["src/**/*.ts"]
}

View file

@ -14,6 +14,8 @@ export type EquityPrintJoinRecord = {
join_quality_json: string;
};
type JsonPrimitiveRecord = Record<string, string | number | boolean>;
export const equityPrintJoinsTableDDL = (): string => {
return `
CREATE TABLE IF NOT EXISTS ${EQUITY_PRINT_JOINS_TABLE} (
@ -46,11 +48,11 @@ export const toEquityPrintJoinRecord = (join: EquityPrintJoin): EquityPrintJoinR
};
};
const safeJson = (value: string, fallback: Record<string, unknown>): Record<string, unknown> => {
const safeJson = (value: string, fallback: JsonPrimitiveRecord): JsonPrimitiveRecord => {
try {
const parsed = JSON.parse(value);
if (parsed && typeof parsed === "object") {
return parsed as Record<string, unknown>;
return parsed as JsonPrimitiveRecord;
}
} catch {
// ignore

View file

@ -13,6 +13,8 @@ export type FlowPacketRecord = {
join_quality_json: string;
};
type JsonPrimitiveRecord = Record<string, string | number | boolean>;
export const flowPacketsTableDDL = (): string => {
return `
CREATE TABLE IF NOT EXISTS ${FLOW_PACKETS_TABLE} (
@ -43,11 +45,11 @@ export const toFlowPacketRecord = (packet: FlowPacket): FlowPacketRecord => {
};
};
const safeJson = (value: string, fallback: Record<string, unknown>): Record<string, unknown> => {
const safeJson = (value: string, fallback: JsonPrimitiveRecord): JsonPrimitiveRecord => {
try {
const parsed = JSON.parse(value);
if (parsed && typeof parsed === "object") {
return parsed as Record<string, unknown>;
return parsed as JsonPrimitiveRecord;
}
} catch {
// ignore

View file

@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": []
"types": ["bun"]
},
"include": ["src/**/*.ts", "tests/**/*.ts"]
}

View file

@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": []
"types": ["bun"]
},
"include": ["src/**/*.ts"]
}