-
-
Notifications
You must be signed in to change notification settings - Fork 425
Expand file tree
/
Copy pathtypes.ts
More file actions
69 lines (62 loc) · 1.41 KB
/
types.ts
File metadata and controls
69 lines (62 loc) · 1.41 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
export interface ConnectorConfig {
port: number
host: string
}
export interface ConnectorSession {
token: string
connectedAt: number
npmUser: string | null
/** Base64 data URL of the user's avatar */
avatar: string | null
}
export type OperationType =
| 'org:add-user'
| 'org:rm-user'
| 'org:set-role'
| 'team:create'
| 'team:destroy'
| 'team:add-user'
| 'team:rm-user'
| 'access:grant'
| 'access:revoke'
| 'owner:add'
| 'owner:rm'
| 'package:init'
| 'package:deprecate'
export type OperationStatus =
| 'pending'
| 'approved'
| 'running'
| 'completed'
| 'failed'
| 'cancelled'
export interface OperationResult {
stdout: string
stderr: string
exitCode: number
/** True if the operation failed due to missing/invalid OTP */
requiresOtp?: boolean
/** True if the operation failed due to authentication failure (not logged in or token expired) */
authFailure?: boolean
}
export interface PendingOperation {
id: string
type: OperationType
params: Record<string, string>
description: string
command: string
status: OperationStatus
createdAt: number
result?: OperationResult
/** ID of operation this depends on (must complete successfully first) */
dependsOn?: string
}
export interface ConnectorState {
session: ConnectorSession
operations: PendingOperation[]
}
export interface ApiResponse<T = unknown> {
success: boolean
data?: T
error?: string
}