mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Initial Typescript models.
This commit is contained in:
parent
04e9f06e93
commit
0aaba8cbd1
74 changed files with 1144 additions and 768 deletions
8
interface/api/auth.d.ts
vendored
Normal file
8
interface/api/auth.d.ts
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export interface Auth {
|
||||
user: {
|
||||
id: string;
|
||||
username: string;
|
||||
isAdmin: boolean;
|
||||
};
|
||||
shareToken: string;
|
||||
}
|
||||
73
interface/api/models.d.ts
vendored
Normal file
73
interface/api/models.d.ts
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
export interface User {
|
||||
id: string;
|
||||
username: string;
|
||||
isAdmin: boolean;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
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 Empty {}
|
||||
|
||||
export interface WebsiteActive {
|
||||
x: number;
|
||||
}
|
||||
|
||||
export interface WebsiteEventDataMetric {
|
||||
[key: string]: 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;
|
||||
}
|
||||
14
interface/api/nextApi.d.ts
vendored
Normal file
14
interface/api/nextApi.d.ts
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { NextApiRequest } from 'next';
|
||||
import { Auth } from './auth';
|
||||
|
||||
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;
|
||||
}
|
||||
5
interface/auth.d.ts
vendored
5
interface/auth.d.ts
vendored
|
|
@ -1,5 +0,0 @@
|
|||
export interface Auth {
|
||||
id: number;
|
||||
email?: string;
|
||||
teams?: string[];
|
||||
}
|
||||
22
interface/base.d.ts
vendored
22
interface/base.d.ts
vendored
|
|
@ -1,22 +0,0 @@
|
|||
import { NextApiRequest } from 'next';
|
||||
import { Auth } from './auth';
|
||||
|
||||
export interface NextApiRequestQueryBody<TQuery, TBody> extends NextApiRequest {
|
||||
auth: Auth;
|
||||
query: TQuery;
|
||||
body: TBody;
|
||||
}
|
||||
|
||||
export interface NextApiRequestQuery<TQuery> extends NextApiRequest {
|
||||
auth: Auth;
|
||||
query: TQuery;
|
||||
}
|
||||
|
||||
export interface NextApiRequestBody<TBody> extends NextApiRequest {
|
||||
auth: Auth;
|
||||
body: TBody;
|
||||
}
|
||||
|
||||
export interface ObjectAny {
|
||||
[key: string]: any;
|
||||
}
|
||||
7
interface/enum.d.ts
vendored
Normal file
7
interface/enum.d.ts
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
export namespace UmamiApi {
|
||||
enum EventType {
|
||||
Pageview = 1,
|
||||
Event = 2,
|
||||
}
|
||||
}
|
||||
22
interface/index.d.ts
vendored
22
interface/index.d.ts
vendored
|
|
@ -1,22 +0,0 @@
|
|||
import { NextApiRequest } from 'next';
|
||||
import { Auth } from './auth';
|
||||
|
||||
export interface NextApiRequestQueryBody<TQuery, TBody> extends NextApiRequest {
|
||||
auth: Auth;
|
||||
query: TQuery;
|
||||
body: TBody;
|
||||
}
|
||||
|
||||
export interface NextApiRequestQuery<TQuery> extends NextApiRequest {
|
||||
auth: Auth;
|
||||
query: TQuery;
|
||||
}
|
||||
|
||||
export interface NextApiRequestBody<TBody> extends NextApiRequest {
|
||||
auth: Auth;
|
||||
body: TBody;
|
||||
}
|
||||
|
||||
export interface ObjectAny {
|
||||
[key: string]: any;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue