-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.ts
97 lines (80 loc) · 1.88 KB
/
common.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { Readable } from "stream"
import { FormData } from "undici"
import { IAny, ObjectValues } from "./util.js"
export type KeyValue = {
key: string
value: string
}
export type Identity = {
id: string
organization_id: string
name: string
}
export type BaseError = {
status: number
code: string
message: string
}
export type UnexpectedError = Omit<BaseError, "status"> & {
details: IAny[]
}
export type ErrorField = {
field: string
description: string
}
export type ValidationError = BaseError & {
fields: ErrorField[]
}
export type BaseEventDateTimes = {
created_at: string
updated_at: string
}
export type EventDateTimes = BaseEventDateTimes & {
started_at: string
succeeded_at: string
paused_at: string
resumed_at: string
terminated_at: string
}
export type QueryParams = {
limit?: number
offset?: number
}
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
export type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
export type ReqBody = string | Buffer | Uint8Array | Readable | null | FormData
export type ReqOptions = {
path: string
method: HttpMethod
body?: ReqBody,
headers?: string[] | IncomingHttpHeaders
}
export type ResponseListItem = QueryParams & {
count: number
}
export type LogsReponse = {
result: LogEntry
error: UnexpectedError
}
export type LogEntry = {
msg: string
created_at: string
labels: object
}
export type PublicUser = {
id: string
email: string
name: string
avatar_url: string
github_id: string
github_user: string
}
export type Plan = ObjectValues<typeof PLANS>
export const PLANS = {
HOBBY: "hobby",
STARTER: "starter",
STARTUP: "startup",
BUSINESS: "business",
ENTERPRISE: "enterprise",
INTERNAL: "internal"
} as const