aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-inspector-protocol/src/protocol/schema.d.ts
blob: a92bea54688132067cd5137e821af66c61d5915e (plain) (blame)
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
// Represents the schema of the protocol.json file.

export type Protocol = {
  readonly name: string;
  readonly version: {
    readonly major: number;
    readonly minor: number;
  };
  readonly domains: readonly Domain[];
};

export type Domain = {
  readonly domain: string;
  readonly dependencies?: readonly string[];
  readonly types: readonly Property[];
  readonly commands?: readonly Command[];
  readonly events?: readonly Event[];
};

export type Command = {
  readonly name: string;
  readonly description?: string;
  readonly parameters?: readonly Property[];
  readonly returns?: readonly Property[];
};

export type Event = {
  readonly name: string;
  readonly description?: string;
  readonly parameters: readonly Property[];
};

export type Property = {
  readonly id?: string;
  readonly name?: string;
  readonly description?: string;
  readonly optional?: boolean;
} & (
  | {
      readonly type: "array";
      readonly items?: Property;
    }
  | {
      readonly type: "object";
      readonly properties?: readonly Property[];
    }
  | {
      readonly type: "string";
      readonly enum?: readonly string[];
    }
  | {
      readonly type: "boolean" | "number" | "integer";
    }
  | {
      readonly type: undefined;
      readonly $ref: string;
    }
);