Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
736c369164 | ||
|
|
f2d6563273 |
No files matched your search
@@ -1,5 +1,3 @@
|
|||||||
import { hashKey } from "@tanstack/query-core";
|
|
||||||
|
|
||||||
export function objectKeys<O extends object>(obj: O): (keyof O)[] {
|
export function objectKeys<O extends object>(obj: O): (keyof O)[] {
|
||||||
return Object.keys(obj) as (keyof O)[];
|
return Object.keys(obj) as (keyof O)[];
|
||||||
}
|
}
|
||||||
@@ -11,5 +9,18 @@ type Entries<T> = {
|
|||||||
export const objectEntries = <T extends object>(obj: T) => Object.entries(obj) as Entries<T>;
|
export const objectEntries = <T extends object>(obj: T) => Object.entries(obj) as Entries<T>;
|
||||||
|
|
||||||
export const hashObjectBase64 = (obj: object) => {
|
export const hashObjectBase64 = (obj: object) => {
|
||||||
return Buffer.from(hashKey([obj])).toString("base64");
|
const json = JSON.stringify([obj], (_, val) =>
|
||||||
|
typeof val === "object" && val !== null && !Array.isArray(val)
|
||||||
|
? Object.keys(val)
|
||||||
|
.toSorted()
|
||||||
|
.reduce(
|
||||||
|
(acc, key) => {
|
||||||
|
acc[key] = (val as Record<string, unknown>)[key];
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{} as Record<string, unknown>,
|
||||||
|
)
|
||||||
|
: val,
|
||||||
|
);
|
||||||
|
return Buffer.from(json).toString("base64");
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import Transport from "winston-transport";
|
import winston from "winston";
|
||||||
|
|
||||||
import type { RedisClient } from "../../redis/client";
|
import type { RedisClient } from "../../redis/client";
|
||||||
import { createRedisClient } from "../../redis/client";
|
import { createRedisClient } from "../../redis/client";
|
||||||
@@ -7,11 +7,7 @@ import { createRedisClient } from "../../redis/client";
|
|||||||
const messageSymbol = Symbol.for("message");
|
const messageSymbol = Symbol.for("message");
|
||||||
const levelSymbol = Symbol.for("level");
|
const levelSymbol = Symbol.for("level");
|
||||||
|
|
||||||
//
|
export class RedisTransport extends winston.Transport {
|
||||||
// Inherit from `winston-transport` so you can take advantage
|
|
||||||
// of the base functionality and `.exceptions.handle()`.
|
|
||||||
//
|
|
||||||
export class RedisTransport extends Transport {
|
|
||||||
private redis: RedisClient | null = null;
|
private redis: RedisClient | null = null;
|
||||||
public static readonly publishChannel = "pubSub:logging";
|
public static readonly publishChannel = "pubSub:logging";
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,6 @@ catalog:
|
|||||||
zod-validation-error: ^5.0.0
|
zod-validation-error: ^5.0.0
|
||||||
catalogMode: strict
|
catalogMode: strict
|
||||||
enableGlobalVirtualStore: true
|
enableGlobalVirtualStore: true
|
||||||
nodeLinker: hoisted
|
|
||||||
strictPeerDependencies: false
|
strictPeerDependencies: false
|
||||||
engineStrict: true
|
engineStrict: true
|
||||||
verifyDepsBeforeRun: warn
|
verifyDepsBeforeRun: warn
|
||||||
|
|||||||
Reference in new issue
Block a user