webdriver-bidi-protocol 0.0.1 → 0.0.4

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.
@@ -0,0 +1,27 @@
1
+ export type PermissionsCommand = Permissions.SetPermission;
2
+ export namespace Permissions {
3
+ export type PermissionDescriptor = {
4
+ name: string;
5
+ };
6
+ }
7
+ export namespace Permissions {
8
+ export const enum PermissionState {
9
+ Granted = 'granted',
10
+ Denied = 'denied',
11
+ Prompt = 'prompt',
12
+ }
13
+ }
14
+ export namespace Permissions {
15
+ export type SetPermission = {
16
+ method: 'permissions.setPermission';
17
+ params: Permissions.SetPermissionParameters;
18
+ };
19
+ }
20
+ export namespace Permissions {
21
+ export type SetPermissionParameters = {
22
+ descriptor: Permissions.PermissionDescriptor;
23
+ state: Permissions.PermissionState;
24
+ origin: string;
25
+ userContext?: string;
26
+ };
27
+ }
package/src/index.ts CHANGED
@@ -4,11 +4,11 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import * as Bidi from "./gen/main.js";
8
- import * as BidiPermissions from "./gen/permissions.js";
7
+ import * as Bidi from './gen/main.js';
8
+ import * as BidiPermissions from './gen/permissions.js';
9
9
 
10
- export * from "./gen/main.js";
11
- export * from "./gen/permissions.js";
10
+ export * from './gen/main.js';
11
+ export * from './gen/permissions.js';
12
12
 
13
13
  export type Command = Bidi.Command | BidiPermissions.Permissions.SetPermission;
14
14
  export type Event = Bidi.Event;
@@ -181,4 +181,4 @@ export interface Commands {
181
181
  params: Bidi.Network.ProvideResponseParameters;
182
182
  returnType: Bidi.EmptyResult;
183
183
  };
184
- }
184
+ }
@@ -4,43 +4,43 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { Event, Command, Commands } from "..";
7
+ import {Event, Command, Commands} from '..';
8
8
 
9
9
  function sendCommand(command: Command) {}
10
10
  function handleEvent(event: Event) {}
11
11
  function sendCommandMultipleArgs<T extends keyof Commands>(
12
12
  method: T,
13
- params: Commands[T]["params"],
14
- ): { result: Commands[T]["returnType"] } {
15
- throw new Error("Not implemented");
13
+ params: Commands[T]['params']
14
+ ): {result: Commands[T]['returnType']} {
15
+ throw new Error('Not implemented');
16
16
  }
17
17
 
18
18
  sendCommand({
19
19
  id: 1,
20
- method: "browser.close",
20
+ method: 'browser.close',
21
21
  params: {},
22
22
  });
23
23
 
24
- sendCommandMultipleArgs("browser.close", {});
24
+ sendCommandMultipleArgs('browser.close', {});
25
25
 
26
26
  sendCommand({
27
27
  id: 1,
28
- method: "browsingContext.print",
28
+ method: 'browsingContext.print',
29
29
  params: {
30
- context: "",
30
+ context: '',
31
31
  },
32
32
  });
33
33
 
34
- sendCommandMultipleArgs("browsingContext.print", { context: "" });
34
+ sendCommandMultipleArgs('browsingContext.print', {context: ''});
35
35
 
36
36
  handleEvent({
37
- type: "event",
38
- method: "browsingContext.contextCreated",
37
+ type: 'event',
38
+ method: 'browsingContext.contextCreated',
39
39
  params: {
40
40
  children: [],
41
- context: "",
42
- url: "",
43
- userContext: "",
41
+ context: '',
42
+ url: '',
43
+ userContext: '',
44
44
  originalOpener: null,
45
45
  },
46
46
  });
package/tools/build.sh CHANGED
@@ -4,23 +4,20 @@
4
4
  # Copyright 2024 Google Inc.
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
- rm -rf src/gen
7
+ rm -rf src/gen && mkdir src/gen
8
8
  rm -rf out
9
9
 
10
- git clone https://github.com/w3c/webdriver-bidi.git src/gen/webdriver-bidi
11
- git clone https://github.com/w3c/permissions.git src/gen/permissions
10
+ git submodule update --init
12
11
 
13
- (cd src/gen/webdriver-bidi && scripts/cddl/generate.js)
14
- (cd src/gen/permissions && ../webdriver-bidi/scripts/cddl/generate.js index.html)
12
+ (cd specs/webdriver-bidi && scripts/cddl/generate.js)
13
+ (cd specs/permissions && ../webdriver-bidi/scripts/cddl/generate.js index.html)
15
14
 
16
- cddlconv src/gen/webdriver-bidi/all.cddl > src/gen/main.ts
17
- cddlconv src/gen/permissions/all.cddl > src/gen/permissions.ts
15
+ cddlconv specs/webdriver-bidi/all.cddl > src/gen/main.ts
16
+ cddlconv specs/permissions/all.cddl > src/gen/permissions.ts
18
17
 
19
- rm -rf src/gen/permissions
20
- rm -rf src/gen/webdriver-bidi
21
-
22
- npx prettier -w src/**/*.ts
23
- npx prettier -w test-d/**/*.ts
18
+ (cd specs/webdriver-bidi && git reset --hard HEAD && git clean -fd)
19
+ (cd specs/permissions && git reset --hard HEAD && git clean -fd)
24
20
 
25
21
  npx tsc -p tsconfig.json
26
- npx tsd
22
+ npx tsd
23
+ npm run format