-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathstore.ts
More file actions
53 lines (48 loc) · 1.58 KB
/
Copy pathstore.ts
File metadata and controls
53 lines (48 loc) · 1.58 KB
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
// Maximum number of tail frames kept in the buffer before the oldest are dropped.
export const MAX_EVENTS = 500;
// A single compact event frame as delivered on the `console.tail.<projectId>` channel.
// No document body is ever sent — only metadata. Scope keys are type-specific.
export type TailFrame = {
event: string;
type: string;
action: string;
userId?: string;
timestamp: string;
resourceId?: string;
databaseId?: string;
collectionId?: string;
bucketId?: string;
functionId?: string;
teamId?: string;
};
// The `console.tail.stats` payload, emitted when sampling drops events under load.
export type TailStats = {
$type: string;
delivered: number;
dropped: number;
};
export const typeOptions: { value: string; label: string }[] = [
{ value: '', label: 'All types' },
{ value: 'databases', label: 'Databases' },
{ value: 'buckets', label: 'Storage' },
{ value: 'functions', label: 'Functions' },
{ value: 'teams', label: 'Teams' },
{ value: 'users', label: 'Users' }
];
export const actionOptions: { value: string; label: string }[] = [
{ value: '', label: 'All actions' },
{ value: 'create', label: 'Create' },
{ value: 'update', label: 'Update' },
{ value: 'delete', label: 'Delete' }
];
// Returns the most relevant scope id for a frame, for display in the Resource column.
export function frameScopeId(frame: TailFrame): string {
return (
frame.databaseId ??
frame.bucketId ??
frame.functionId ??
frame.teamId ??
frame.resourceId ??
''
);
}