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.
- package/.github/dependabot.yml +39 -0
- package/.github/workflows/ci.yml +45 -0
- package/.github/workflows/publish.yml +29 -0
- package/.github/workflows/release-please.yml +21 -0
- package/.gitmodules +6 -0
- package/.prettierrc.cjs +4 -0
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +23 -0
- package/LICENSE +1 -1
- package/README.md +32 -2
- package/out/gen/main.d.ts +1650 -1559
- package/out/gen/main.js +2 -2
- package/out/gen/permissions.d.ts +19 -19
- package/out/gen/permissions.js +2 -2
- package/out/index.d.ts +162 -162
- package/out/index.js +34 -18
- package/package.json +18 -5
- package/release-please-config.json +6 -0
- package/src/gen/main.ts +2175 -0
- package/src/gen/permissions.ts +27 -0
- package/src/index.ts +5 -5
- package/test-d/webdriver-bidi-protocol.test-d.ts +14 -14
- package/tools/build.sh +10 -13
|
@@ -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
|
|
8
|
-
import * as BidiPermissions from
|
|
7
|
+
import * as Bidi from './gen/main.js';
|
|
8
|
+
import * as BidiPermissions from './gen/permissions.js';
|
|
9
9
|
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
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 {
|
|
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][
|
|
14
|
-
): {
|
|
15
|
-
throw new Error(
|
|
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:
|
|
20
|
+
method: 'browser.close',
|
|
21
21
|
params: {},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
sendCommandMultipleArgs(
|
|
24
|
+
sendCommandMultipleArgs('browser.close', {});
|
|
25
25
|
|
|
26
26
|
sendCommand({
|
|
27
27
|
id: 1,
|
|
28
|
-
method:
|
|
28
|
+
method: 'browsingContext.print',
|
|
29
29
|
params: {
|
|
30
|
-
context:
|
|
30
|
+
context: '',
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
sendCommandMultipleArgs(
|
|
34
|
+
sendCommandMultipleArgs('browsingContext.print', {context: ''});
|
|
35
35
|
|
|
36
36
|
handleEvent({
|
|
37
|
-
type:
|
|
38
|
-
method:
|
|
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
|
|
11
|
-
git clone https://github.com/w3c/permissions.git src/gen/permissions
|
|
10
|
+
git submodule update --init
|
|
12
11
|
|
|
13
|
-
(cd
|
|
14
|
-
(cd
|
|
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
|
|
17
|
-
cddlconv
|
|
15
|
+
cddlconv specs/webdriver-bidi/all.cddl > src/gen/main.ts
|
|
16
|
+
cddlconv specs/permissions/all.cddl > src/gen/permissions.ts
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
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
|