forked from ChromeDevTools/devtools-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotocol-schema.d.ts
94 lines (80 loc) · 2.37 KB
/
protocol-schema.d.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
/** Definition for protocol.json types */
export interface IProtocol {
version: Protocol.Version
domains: Protocol.Domain[]
}
export module Protocol {
export interface Version {
major: string
minor: string
}
export interface Domain {
/** Name of domain */
domain: string
/** Description of the domain */
description?: string
/** Dependencies on other domains */
dependencies?: string[]
/** Types used by the domain. */
types?: DomainType[]
/** Commands accepted by the domain */
commands?: Command[]
/** Events fired by domain */
events?: Event[]
}
export interface Command extends Event {
returns?: PropertyType[]
async?: boolean
redirect?: string
}
export interface Event {
name: string
parameters?: PropertyType[]
/** Description of the event */
description?: string
}
export interface ArrayType {
type: "array"
/** Maps to a typed array e.g string[] */
items: RefType | PrimitiveType | StringType | AnyType | ObjectType
/** Cardinality of length of array type */
minItems?: number
maxItems?: number
}
export interface ObjectType {
type: "object"
/** Properties of the type. Maps to a typed object */
properties?: PropertyType[]
}
export interface StringType {
type: "string"
/** Possible values of a string. */
enum?: string[]
}
export interface PrimitiveType {
type: "number" | "integer" | "boolean"
}
export interface AnyType {
type: "any"
}
export interface RefType {
/** Reference to a domain defined type */
$ref: string
}
export interface PropertyBaseType {
/** Name of param */
name: string
/** Is the property optional ? */
optional?: boolean
/** Description of the type */
description?: string
}
type DomainType = {
/** Name of property */
id: string
/** Description of the type */
description?: string
} & (StringType | ObjectType | ArrayType | PrimitiveType)
type ProtocolType = StringType | ObjectType | ArrayType | PrimitiveType | RefType | AnyType
type PropertyType = PropertyBaseType & ProtocolType
}