migrate to typescript

This commit is contained in:
MaysWind
2024-12-29 14:24:37 +08:00
parent b638a73e4d
commit 2560a70e5e
171 changed files with 3402 additions and 2557 deletions
+31
View File
@@ -0,0 +1,31 @@
export const CliUserAgent: string = 'ezbookkeeping Cli';
export interface TokenInfoResponse {
readonly tokenId: string;
readonly tokenType: number;
readonly userAgent: string;
readonly lastSeen: number;
readonly isCurrent: boolean;
}
export class SessionInfo {
public readonly tokenId: string;
public readonly isCurrent: boolean;
public readonly deviceType: string;
public readonly deviceInfo: string;
public readonly createdByCli: boolean;
public readonly lastSeen: number;
private constructor(tokenId: string, isCurrent: boolean, deviceType: string, deviceInfo: string, createdByCli: boolean, lastSeen: number) {
this.tokenId = tokenId;
this.isCurrent = isCurrent;
this.deviceType = deviceType;
this.deviceInfo = deviceInfo;
this.createdByCli = createdByCli;
this.lastSeen = lastSeen;
}
public static of(tokenId: string, isCurrent: boolean, deviceType: string, deviceInfo: string, createdByCli: boolean, lastSeen: number): SessionInfo {
return new SessionInfo(tokenId, isCurrent, deviceType, deviceInfo, createdByCli, lastSeen);
}
}