mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
99 lines
1.7 KiB
TypeScript
99 lines
1.7 KiB
TypeScript
import { NextApiRequest } from 'next';
|
|
import { ROLES } from './constants';
|
|
|
|
type ObjectValues<T> = T[keyof T];
|
|
|
|
export type Roles = ObjectValues<typeof ROLES>;
|
|
|
|
export interface Auth {
|
|
user?: {
|
|
id: string;
|
|
username: string;
|
|
role: string;
|
|
isAdmin: boolean;
|
|
};
|
|
shareToken?: {
|
|
websiteId: string;
|
|
};
|
|
}
|
|
|
|
export interface NextApiRequestQueryBody<TQuery = any, TBody = any> extends NextApiRequest {
|
|
auth?: Auth;
|
|
query: TQuery & { [key: string]: string | string[] };
|
|
body: TBody;
|
|
headers: any;
|
|
}
|
|
|
|
export interface NextApiRequestAuth extends NextApiRequest {
|
|
auth?: Auth;
|
|
headers: any;
|
|
}
|
|
|
|
export interface User {
|
|
id: string;
|
|
username: string;
|
|
password?: string;
|
|
createdAt?: Date;
|
|
}
|
|
|
|
export interface Website {
|
|
id: string;
|
|
userId: string;
|
|
revId: number;
|
|
name: string;
|
|
domain: string;
|
|
shareId: string;
|
|
createdAt: Date;
|
|
}
|
|
|
|
export interface Share {
|
|
id: string;
|
|
token: string;
|
|
}
|
|
|
|
export interface WebsiteActive {
|
|
x: number;
|
|
}
|
|
|
|
export interface WebsiteMetric {
|
|
x: string;
|
|
y: number;
|
|
}
|
|
|
|
export interface WebsiteEventMetric {
|
|
x: string;
|
|
t: string;
|
|
y: number;
|
|
}
|
|
|
|
export interface WebsitePageviews {
|
|
pageviews: {
|
|
t: string;
|
|
y: number;
|
|
};
|
|
sessions: {
|
|
t: string;
|
|
y: number;
|
|
};
|
|
}
|
|
|
|
export interface WebsiteStats {
|
|
pageviews: { value: number; change: number };
|
|
uniques: { value: number; change: number };
|
|
bounces: { value: number; change: number };
|
|
totalTime: { value: number; change: number };
|
|
}
|
|
|
|
export interface RealtimeInit {
|
|
websites: Website[];
|
|
token: string;
|
|
data: RealtimeUpdate;
|
|
}
|
|
|
|
export interface RealtimeUpdate {
|
|
pageviews: any[];
|
|
sessions: any[];
|
|
events: any[];
|
|
timestamp: number;
|
|
}
|