mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor(server): config system (#11081)
This commit is contained in:
@@ -94,7 +94,7 @@ export function parseCookies(
|
||||
export type RequestType = GqlContextType | 'event' | 'job';
|
||||
|
||||
export function genRequestId(type: RequestType) {
|
||||
return `${AFFiNE.flavor.type}:${type}:${randomUUID()}`;
|
||||
return `${env.DEPLOYMENT_TYPE}:${type}:${randomUUID()}`;
|
||||
}
|
||||
|
||||
export function getOrGenRequestId(type: RequestType) {
|
||||
|
||||
@@ -2,9 +2,7 @@ import { Readable } from 'node:stream';
|
||||
|
||||
export function ApplyType<T>(): ConstructorOf<T> {
|
||||
// @ts-expect-error used to fake the type of config
|
||||
return class Inner implements T {
|
||||
constructor() {}
|
||||
};
|
||||
return class Inner implements T {};
|
||||
}
|
||||
|
||||
export type PathType<T, Path extends string> =
|
||||
@@ -30,7 +28,7 @@ export type Join<Prefix, Suffixes> = Prefix extends string | number
|
||||
|
||||
export type LeafPaths<
|
||||
T,
|
||||
Path extends string = '',
|
||||
Prefix extends string = '',
|
||||
MaxDepth extends string = '.....',
|
||||
Depth extends string = '',
|
||||
> = Depth extends MaxDepth
|
||||
@@ -40,7 +38,9 @@ export type LeafPaths<
|
||||
[K in keyof T]-?: K extends string | number
|
||||
? T[K] extends PrimitiveType
|
||||
? K
|
||||
: Join<K, LeafPaths<T[K], Path, MaxDepth, `${Depth}.`>>
|
||||
: T[K] extends { __leaf: true }
|
||||
? K
|
||||
: Join<K, LeafPaths<T[K], Prefix, MaxDepth, `${Depth}.`>>
|
||||
: never;
|
||||
}[keyof T]
|
||||
: never;
|
||||
|
||||
Reference in New Issue
Block a user