@srating-io/types 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/audit_gui.d.ts +48 -0
- package/dist/api/dashboard.d.ts +136 -0
- package/dist/audit.d.ts +88 -0
- package/dist/auth.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AuditGui } from '../audit.ts';
|
|
2
|
+
export type listOrderBy = 'last_seen' | 'occurrences' | 'date_of_entry';
|
|
3
|
+
export type listArguments = {
|
|
4
|
+
/** 0 or 1. Left out means both, which is what the "all" filter sends. */
|
|
5
|
+
resolved?: number;
|
|
6
|
+
release?: string;
|
|
7
|
+
source?: string;
|
|
8
|
+
route?: string;
|
|
9
|
+
/** Matched against `name` and `message`. */
|
|
10
|
+
search?: string;
|
|
11
|
+
order_by?: listOrderBy;
|
|
12
|
+
order?: 'asc' | 'desc';
|
|
13
|
+
limit?: number;
|
|
14
|
+
offset?: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* `rows` is an array rather than the id-keyed map the generic `read` returns. `audit_gui_id` is an
|
|
18
|
+
* integer, and an object with integer-like keys is iterated in numeric order by every javascript
|
|
19
|
+
* engine -- which would silently throw away the sort the caller asked for.
|
|
20
|
+
*
|
|
21
|
+
* `release` and `source` are the distinct values present in the table, for populating the filters.
|
|
22
|
+
*/
|
|
23
|
+
export type listResults = {
|
|
24
|
+
error: string;
|
|
25
|
+
} | {
|
|
26
|
+
rows: AuditGui[];
|
|
27
|
+
total: number;
|
|
28
|
+
release: string[];
|
|
29
|
+
source: string[];
|
|
30
|
+
};
|
|
31
|
+
export type detailArguments = {
|
|
32
|
+
audit_gui_id: number | string;
|
|
33
|
+
};
|
|
34
|
+
export type detailResults = {
|
|
35
|
+
error: string;
|
|
36
|
+
} | {
|
|
37
|
+
row: AuditGui | null;
|
|
38
|
+
};
|
|
39
|
+
export type resolveArguments = {
|
|
40
|
+
audit_gui_id: number | string;
|
|
41
|
+
resolved: number | string;
|
|
42
|
+
};
|
|
43
|
+
export type resolveResults = {
|
|
44
|
+
error: string;
|
|
45
|
+
} | {
|
|
46
|
+
audit_gui_id: number;
|
|
47
|
+
resolved: number;
|
|
48
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { AuditApi, AuditError } from '../audit.ts';
|
|
2
|
+
import { Pricings } from '../payments.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Every endpoint on this class is admin only and answers `{ error }` to everyone else, so each
|
|
5
|
+
* result is a union with the refusal rather than an optional-everything object.
|
|
6
|
+
*/
|
|
7
|
+
export type overviewResults = {
|
|
8
|
+
error: string;
|
|
9
|
+
} | {
|
|
10
|
+
audit_gui: {
|
|
11
|
+
unresolved: number;
|
|
12
|
+
/** Summed `occurrences` over the unresolved rows -- how much the open bugs are actually firing. */
|
|
13
|
+
occurrences: number;
|
|
14
|
+
last_24h: number;
|
|
15
|
+
};
|
|
16
|
+
audit_error: {
|
|
17
|
+
last_24h: number;
|
|
18
|
+
last_7d: number;
|
|
19
|
+
};
|
|
20
|
+
audit_api: {
|
|
21
|
+
last_24h: number;
|
|
22
|
+
};
|
|
23
|
+
subscription: {
|
|
24
|
+
active: number;
|
|
25
|
+
type_x_active: {
|
|
26
|
+
[type: string]: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
user: {
|
|
30
|
+
total: number;
|
|
31
|
+
last_7d: number;
|
|
32
|
+
};
|
|
33
|
+
payment_router: {
|
|
34
|
+
unhandled: number;
|
|
35
|
+
};
|
|
36
|
+
api_key: {
|
|
37
|
+
total: number;
|
|
38
|
+
/** Keys at or past 80% of their `usage_limit`. */
|
|
39
|
+
near_limit: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A subscription with the few joined columns the dashboard shows beside it. Not the whole `user`
|
|
44
|
+
* row -- `username` is the only part worth seeing in a list, and the rest of that table has no
|
|
45
|
+
* business being shipped here.
|
|
46
|
+
*/
|
|
47
|
+
export interface RevenueSubscription {
|
|
48
|
+
subscription_id: string;
|
|
49
|
+
user_id: string | null;
|
|
50
|
+
username: string | null;
|
|
51
|
+
pricing_id: string | null;
|
|
52
|
+
pricing_name: string | null;
|
|
53
|
+
pricing_type: string | null;
|
|
54
|
+
stripe_subscription: string | null;
|
|
55
|
+
date_of_entry: string;
|
|
56
|
+
renewed: string | null;
|
|
57
|
+
expires: string | null;
|
|
58
|
+
}
|
|
59
|
+
export type revenueResults = {
|
|
60
|
+
error: string;
|
|
61
|
+
} | {
|
|
62
|
+
pricing: Pricings;
|
|
63
|
+
type_x_active: {
|
|
64
|
+
[type: string]: number;
|
|
65
|
+
};
|
|
66
|
+
pricing_id_x_active: {
|
|
67
|
+
[pricing_id: string]: number;
|
|
68
|
+
};
|
|
69
|
+
/** Active subscriptions whose `expires` falls inside the next 30 days. */
|
|
70
|
+
renewals: RevenueSubscription[];
|
|
71
|
+
/** Active subscriptions on a `trial` plan. */
|
|
72
|
+
trials: RevenueSubscription[];
|
|
73
|
+
/** Subscriptions created per day over the trailing window, as `Y-m-d` keys. */
|
|
74
|
+
date_x_created: {
|
|
75
|
+
[date: string]: number;
|
|
76
|
+
};
|
|
77
|
+
unhandled_payment_routers: number;
|
|
78
|
+
};
|
|
79
|
+
export interface ApiErrorCount {
|
|
80
|
+
class: string | null;
|
|
81
|
+
function: string | null;
|
|
82
|
+
total: number;
|
|
83
|
+
}
|
|
84
|
+
export type apiTrafficArguments = {
|
|
85
|
+
/**
|
|
86
|
+
* How far back to look. Bounded server side, because `audit_api` is the largest table in the
|
|
87
|
+
* database and `date_of_entry` is the only index on it.
|
|
88
|
+
*/
|
|
89
|
+
days?: number;
|
|
90
|
+
};
|
|
91
|
+
export type apiTrafficResults = {
|
|
92
|
+
error: string;
|
|
93
|
+
} | {
|
|
94
|
+
days: number;
|
|
95
|
+
date_x_requests: {
|
|
96
|
+
[date: string]: number;
|
|
97
|
+
};
|
|
98
|
+
api_key_id_x_requests: {
|
|
99
|
+
[api_key_id: string]: number;
|
|
100
|
+
};
|
|
101
|
+
class_x_requests: {
|
|
102
|
+
[class_name: string]: number;
|
|
103
|
+
};
|
|
104
|
+
recent_requests: AuditApi[];
|
|
105
|
+
date_x_errors: {
|
|
106
|
+
[date: string]: number;
|
|
107
|
+
};
|
|
108
|
+
error_counts: ApiErrorCount[];
|
|
109
|
+
recent_errors: AuditError[];
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* An api key as the dashboard sees it. The `key` column itself is deliberately absent: it is the
|
|
113
|
+
* credential, and nothing on this page needs it to answer "who is near their limit".
|
|
114
|
+
*/
|
|
115
|
+
export interface DashboardApiKey {
|
|
116
|
+
api_key_id: number;
|
|
117
|
+
user_id: string | null;
|
|
118
|
+
username: string | null;
|
|
119
|
+
subscription_id: string | null;
|
|
120
|
+
pricing_name: string | null;
|
|
121
|
+
pricing_type: string | null;
|
|
122
|
+
usage: number | null;
|
|
123
|
+
usage_limit: number | null;
|
|
124
|
+
read: number;
|
|
125
|
+
write: number;
|
|
126
|
+
hidden_access: number;
|
|
127
|
+
rate_limiter: number;
|
|
128
|
+
expires: string | null;
|
|
129
|
+
last_reset: string | null;
|
|
130
|
+
deleted: number;
|
|
131
|
+
}
|
|
132
|
+
export type apiKeysResults = {
|
|
133
|
+
error: string;
|
|
134
|
+
} | {
|
|
135
|
+
rows: DashboardApiKey[];
|
|
136
|
+
};
|
package/dist/audit.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One row per distinct bug rather than per occurrence: `fingerprint` is derived server side, so a
|
|
3
|
+
* repeat bumps `occurrences` instead of inserting.
|
|
4
|
+
*
|
|
5
|
+
* `stack`, `state` and `json_context` are large and are only sent by `audit_gui.detail` -- the list
|
|
6
|
+
* endpoint leaves them out, which is why they are optional here.
|
|
7
|
+
*/
|
|
8
|
+
export interface AuditGui {
|
|
9
|
+
audit_gui_id: number;
|
|
10
|
+
fingerprint: string;
|
|
11
|
+
release: string;
|
|
12
|
+
source: string;
|
|
13
|
+
name: string | null;
|
|
14
|
+
message: string | null;
|
|
15
|
+
digest: string | null;
|
|
16
|
+
route: string | null;
|
|
17
|
+
stack?: string | null;
|
|
18
|
+
state?: string | null;
|
|
19
|
+
json_context?: string | null;
|
|
20
|
+
occurrences: number;
|
|
21
|
+
date_of_entry: string;
|
|
22
|
+
last_seen: string;
|
|
23
|
+
resolved: number;
|
|
24
|
+
deleted: number;
|
|
25
|
+
}
|
|
26
|
+
export type AuditGuis = {
|
|
27
|
+
[audit_gui_id: number]: AuditGui;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* One row per request to the public api. Written only when the caller presented an api key, so
|
|
31
|
+
* nothing the gui does lands here.
|
|
32
|
+
*/
|
|
33
|
+
export interface AuditApi {
|
|
34
|
+
audit_api_id: number;
|
|
35
|
+
api_key_id: number | null;
|
|
36
|
+
class: string | null;
|
|
37
|
+
function: string | null;
|
|
38
|
+
arguments: string | null;
|
|
39
|
+
date_of_entry: string;
|
|
40
|
+
deleted: number;
|
|
41
|
+
}
|
|
42
|
+
export type AuditApis = {
|
|
43
|
+
[audit_api_id: number]: AuditApi;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A failure inside the api, one row per occurrence -- unlike `audit_gui` these are not grouped.
|
|
47
|
+
*/
|
|
48
|
+
export interface AuditError {
|
|
49
|
+
audit_error_id: number;
|
|
50
|
+
api_key_id: number | null;
|
|
51
|
+
class: string | null;
|
|
52
|
+
function: string | null;
|
|
53
|
+
arguments: string | null;
|
|
54
|
+
error: string | null;
|
|
55
|
+
date_of_entry: string;
|
|
56
|
+
deleted: number;
|
|
57
|
+
}
|
|
58
|
+
export type AuditErrors = {
|
|
59
|
+
[audit_error_id: number]: AuditError;
|
|
60
|
+
};
|
|
61
|
+
export interface AuditCreated {
|
|
62
|
+
audit_created_id: number;
|
|
63
|
+
api_key_id: number | null;
|
|
64
|
+
table: string | null;
|
|
65
|
+
id: string | null;
|
|
66
|
+
date_of_entry: string;
|
|
67
|
+
deleted: number;
|
|
68
|
+
}
|
|
69
|
+
export type AuditCreateds = {
|
|
70
|
+
[audit_created_id: number]: AuditCreated;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* One row per *column* changed by a generic update, not one per update.
|
|
74
|
+
*/
|
|
75
|
+
export interface AuditUpdated {
|
|
76
|
+
audit_updated_id: number;
|
|
77
|
+
api_key_id: number | null;
|
|
78
|
+
table: string | null;
|
|
79
|
+
id: string | null;
|
|
80
|
+
column: string | null;
|
|
81
|
+
old_value: string | null;
|
|
82
|
+
new_value: string | null;
|
|
83
|
+
date_of_entry: string;
|
|
84
|
+
deleted: number;
|
|
85
|
+
}
|
|
86
|
+
export type AuditUpdateds = {
|
|
87
|
+
[audit_updated_id: number]: AuditUpdated;
|
|
88
|
+
};
|
package/dist/auth.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * as ApiKey from './api/api_key.ts';
|
|
2
|
+
export * as AuditGui from './api/audit_gui.ts';
|
|
2
3
|
export * as Billing from './api/billing.ts';
|
|
3
4
|
export * as Boxscore from './api/boxscore.ts';
|
|
4
5
|
export * as CoachStatisticRanking from './api/coach_statistic_ranking.ts';
|
|
5
6
|
export * as Conference from './api/conference.ts';
|
|
6
7
|
export * as ConferencePlayerStatisticRanking from './api/conference_player_statistic_ranking.ts';
|
|
7
8
|
export * as ConferenceStatisticRanking from './api/conference_statistic_ranking.ts';
|
|
9
|
+
export * as Dashboard from './api/dashboard.ts';
|
|
8
10
|
export * as FantasyBracketSlot from './api/fantasy_bracket_slot.ts';
|
|
9
11
|
export * as FantasyDraftOrder from './api/fantasy_draft_order.ts';
|
|
10
12
|
export * as FantasyEntry from './api/fantasy_entry.ts';
|
|
@@ -30,6 +32,7 @@ export * as StatisticRanking from './api/statistic_ranking.ts';
|
|
|
30
32
|
export * as Team from './api/team.ts';
|
|
31
33
|
export * as User from './api/user.ts';
|
|
32
34
|
export * as UserPaymentToken from './api/user_payment_token.ts';
|
|
35
|
+
export * as Audit from './audit.ts';
|
|
33
36
|
export * as Auth from './auth.ts';
|
|
34
37
|
export * as Basketball from './basketball.ts';
|
|
35
38
|
export * as Fantasy from './fantasy.ts';
|