chromium-bidi 0.4.2 → 0.4.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/LICENSE +1 -1
- package/README.md +199 -69
- package/lib/cjs/bidiMapper/BidiServer.d.ts +40 -0
- package/lib/cjs/bidiMapper/BidiServer.js +89 -0
- package/lib/cjs/bidiMapper/BidiServer.js.map +1 -0
- package/lib/cjs/bidiMapper/BidiTransport.d.ts +22 -0
- package/lib/cjs/bidiMapper/BidiTransport.js +19 -0
- package/lib/cjs/bidiMapper/BidiTransport.js.map +1 -0
- package/lib/cjs/bidiMapper/CdpConnection.d.ts +32 -0
- package/lib/cjs/bidiMapper/CdpConnection.js +19 -0
- package/lib/cjs/bidiMapper/CdpConnection.js.map +1 -0
- package/lib/cjs/bidiMapper/CommandProcessor.d.ts +46 -0
- package/lib/cjs/bidiMapper/CommandProcessor.js +136 -0
- package/lib/cjs/bidiMapper/CommandProcessor.js.map +1 -0
- package/lib/cjs/bidiMapper/OutgoingBidiMessage.d.ts +25 -0
- package/lib/cjs/bidiMapper/OutgoingBidiMessage.js +42 -0
- package/lib/cjs/bidiMapper/OutgoingBidiMessage.js.map +1 -0
- package/lib/cjs/bidiMapper/bidiMapper.d.ts +25 -0
- package/lib/cjs/bidiMapper/bidiMapper.js +24 -0
- package/lib/cjs/bidiMapper/bidiMapper.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.d.ts +43 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js +375 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.d.ts +47 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js +238 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.d.ts +26 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js +50 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/events/EventManager.d.ts +32 -0
- package/lib/cjs/bidiMapper/domains/events/EventManager.js +167 -0
- package/lib/cjs/bidiMapper/domains/events/EventManager.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.d.ts +25 -0
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.js +128 -0
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.spec.d.ts +16 -0
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.spec.js +175 -0
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.spec.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper.d.ts +23 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper.js +176 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper_getRemoteValuesText.spec.d.ts +17 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper_getRemoteValuesText.spec.js +65 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper_getRemoteValuesText.spec.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper_logMessageFormatter.spec.d.ts +17 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper_logMessageFormatter.spec.js +378 -0
- package/lib/cjs/bidiMapper/domains/log/logHelper_logMessageFormatter.spec.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/log/logManager.d.ts +8 -0
- package/lib/cjs/bidiMapper/domains/log/logManager.js +136 -0
- package/lib/cjs/bidiMapper/domains/log/logManager.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/script/realm.d.ts +56 -0
- package/lib/cjs/bidiMapper/domains/script/realm.js +185 -0
- package/lib/cjs/bidiMapper/domains/script/realm.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/script/realmStorage.d.ts +38 -0
- package/lib/cjs/bidiMapper/domains/script/realmStorage.js +72 -0
- package/lib/cjs/bidiMapper/domains/script/realmStorage.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.d.ts +41 -0
- package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js +365 -0
- package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js.map +1 -0
- package/lib/cjs/bidiMapper/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/bidiServer/bidiServerRunner.d.ts +29 -0
- package/{src/.build → lib/cjs}/bidiServer/bidiServerRunner.js +61 -52
- package/lib/cjs/bidiServer/bidiServerRunner.js.map +1 -0
- package/lib/cjs/bidiServer/index.d.ts +17 -0
- package/{src/.build → lib/cjs}/bidiServer/index.js +35 -18
- package/lib/cjs/bidiServer/index.js.map +1 -0
- package/lib/cjs/bidiServer/mapperReader.d.ts +17 -0
- package/{src/.build → lib/cjs}/bidiServer/mapperReader.js +1 -1
- package/lib/cjs/bidiServer/mapperReader.js.map +1 -0
- package/lib/cjs/bidiServer/mapperServer.d.ts +32 -0
- package/{src/.build → lib/cjs}/bidiServer/mapperServer.js +39 -37
- package/lib/cjs/bidiServer/mapperServer.js.map +1 -0
- package/lib/cjs/bidiServer/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/bidiTab/bidiTab.d.ts +30 -0
- package/lib/cjs/bidiTab/bidiTab.js +248 -0
- package/lib/cjs/bidiTab/bidiTab.js.map +1 -0
- package/lib/cjs/bidiTab/mapperTabPage.d.ts +19 -0
- package/lib/cjs/bidiTab/mapperTabPage.js +74 -0
- package/lib/cjs/bidiTab/mapperTabPage.js.map +1 -0
- package/lib/cjs/bidiTab/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/cdp/cdpClient.d.ts +41 -0
- package/lib/cjs/cdp/cdpClient.js +50 -0
- package/lib/cjs/cdp/cdpClient.js.map +1 -0
- package/lib/cjs/cdp/cdpClient.spec.d.ts +17 -0
- package/{src/.build/bidiServer → lib/cjs}/cdp/cdpClient.spec.js +31 -31
- package/lib/cjs/cdp/cdpClient.spec.js.map +1 -0
- package/lib/cjs/cdp/cdpConnection.d.ts +42 -0
- package/{src/.build/bidiServer → lib/cjs}/cdp/cdpConnection.js +36 -35
- package/lib/cjs/cdp/cdpConnection.js.map +1 -0
- package/lib/cjs/cdp/cdpConnection.spec.d.ts +17 -0
- package/{src/.build/bidiServer → lib/cjs}/cdp/cdpConnection.spec.js +23 -23
- package/lib/cjs/cdp/cdpConnection.spec.js.map +1 -0
- package/lib/cjs/cdp/cdpMessage.d.ts +28 -0
- package/{src/.build/bidiServer → lib/cjs}/cdp/cdpMessage.js +0 -0
- package/lib/cjs/cdp/cdpMessage.js.map +1 -0
- package/lib/cjs/cdp/index.d.ts +19 -0
- package/{src/.build/bidiServer → lib/cjs}/cdp/index.js +7 -5
- package/lib/cjs/cdp/index.js.map +1 -0
- package/lib/cjs/cdp/stubTransport.spec.d.ts +28 -0
- package/{src/.build/bidiServer/tests → lib/cjs/cdp}/stubTransport.spec.js +2 -2
- package/lib/cjs/cdp/stubTransport.spec.js.map +1 -0
- package/lib/cjs/cdp/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/cdp/websocketTransport.d.ts +26 -0
- package/{src/.build/bidiServer → lib/cjs}/cdp/websocketTransport.js +11 -11
- package/lib/cjs/cdp/websocketTransport.js.map +1 -0
- package/lib/cjs/protocol/protocol.d.ts +518 -0
- package/lib/cjs/protocol/protocol.js +101 -0
- package/lib/cjs/protocol/protocol.js.map +1 -0
- package/lib/cjs/protocol/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/protocol-parser/protocol-parser.d.ts +765 -0
- package/lib/cjs/protocol-parser/protocol-parser.js +385 -0
- package/lib/cjs/protocol-parser/protocol-parser.js.map +1 -0
- package/lib/cjs/protocol-parser/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/utils/EventEmitter.d.ts +51 -0
- package/lib/cjs/utils/EventEmitter.js +59 -0
- package/lib/cjs/utils/EventEmitter.js.map +1 -0
- package/lib/cjs/utils/EventEmitter.spec.d.ts +16 -0
- package/lib/cjs/utils/EventEmitter.spec.js +109 -0
- package/lib/cjs/utils/EventEmitter.spec.js.map +1 -0
- package/lib/cjs/utils/buffer.d.ts +29 -0
- package/lib/cjs/utils/buffer.js +49 -0
- package/lib/cjs/utils/buffer.js.map +1 -0
- package/lib/cjs/utils/buffer.spec.d.ts +17 -0
- package/lib/cjs/utils/buffer.spec.js +68 -0
- package/lib/cjs/utils/buffer.spec.js.map +1 -0
- package/lib/cjs/utils/deferred.d.ts +27 -0
- package/lib/cjs/utils/deferred.js +54 -0
- package/lib/cjs/utils/deferred.js.map +1 -0
- package/lib/cjs/utils/idWrapper.d.ts +24 -0
- package/lib/cjs/utils/idWrapper.js +34 -0
- package/lib/cjs/utils/idWrapper.js.map +1 -0
- package/lib/cjs/utils/idWrapper.spec.d.ts +17 -0
- package/lib/cjs/utils/idWrapper.spec.js +53 -0
- package/lib/cjs/utils/idWrapper.spec.js.map +1 -0
- package/lib/cjs/utils/log.d.ts +23 -0
- package/lib/cjs/utils/log.js +27 -0
- package/lib/cjs/utils/log.js.map +1 -0
- package/lib/cjs/utils/processingQueue.d.ts +22 -0
- package/lib/cjs/utils/processingQueue.js +60 -0
- package/lib/cjs/utils/processingQueue.js.map +1 -0
- package/lib/cjs/utils/processingQueue.spec.d.ts +17 -0
- package/lib/cjs/utils/processingQueue.spec.js +105 -0
- package/lib/cjs/utils/processingQueue.spec.js.map +1 -0
- package/lib/cjs/utils/transport.d.ts +25 -0
- package/{src/.build/bidiServer → lib/cjs}/utils/transport.js +0 -0
- package/lib/cjs/utils/transport.js.map +1 -0
- package/lib/cjs/utils/tsconfig.tsbuildinfo +1 -0
- package/lib/iife/mapperTab.js +21 -0
- package/lib/iife/mapperTab.js.map +1 -0
- package/package.json +60 -45
- package/src/.build/bidiMapper/mapper.js +0 -26110
- package/src/.build/bidiMapper/mapper.js.map +0 -1
- package/src/.build/bidiServer/bidiServerRunner.js.map +0 -1
- package/src/.build/bidiServer/cdp/cdpClient.js +0 -122
- package/src/.build/bidiServer/cdp/cdpClient.js.map +0 -1
- package/src/.build/bidiServer/cdp/cdpClient.spec.js.map +0 -1
- package/src/.build/bidiServer/cdp/cdpConnection.js.map +0 -1
- package/src/.build/bidiServer/cdp/cdpConnection.spec.js.map +0 -1
- package/src/.build/bidiServer/cdp/cdpMessage.js.map +0 -1
- package/src/.build/bidiServer/cdp/index.js.map +0 -1
- package/src/.build/bidiServer/cdp/websocketTransport.js.map +0 -1
- package/src/.build/bidiServer/index.js.map +0 -1
- package/src/.build/bidiServer/mapperReader.js.map +0 -1
- package/src/.build/bidiServer/mapperServer.js.map +0 -1
- package/src/.build/bidiServer/tests/stubTransport.spec.js.map +0 -1
- package/src/.build/bidiServer/utils/log.js +0 -44
- package/src/.build/bidiServer/utils/log.js.map +0 -1
- package/src/.build/bidiServer/utils/transport.js.map +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2021 Google LLC.
|
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.CommandProcessor = void 0;
|
|
20
|
+
const protocol_js_1 = require("../protocol/protocol.js");
|
|
21
|
+
const browsingContextProcessor_js_1 = require("./domains/context/browsingContextProcessor.js");
|
|
22
|
+
const EventEmitter_js_1 = require("../utils/EventEmitter.js");
|
|
23
|
+
const OutgoingBidiMessage_js_1 = require("./OutgoingBidiMessage.js");
|
|
24
|
+
class BidiNoOpParser {
|
|
25
|
+
parseGetRealmsParams(params) {
|
|
26
|
+
return params;
|
|
27
|
+
}
|
|
28
|
+
parseCallFunctionParams(params) {
|
|
29
|
+
return params;
|
|
30
|
+
}
|
|
31
|
+
parseEvaluateParams(params) {
|
|
32
|
+
return params;
|
|
33
|
+
}
|
|
34
|
+
parseDisownParams(params) {
|
|
35
|
+
return params;
|
|
36
|
+
}
|
|
37
|
+
parseSendCommandParams(params) {
|
|
38
|
+
return params;
|
|
39
|
+
}
|
|
40
|
+
parseGetSessionParams(params) {
|
|
41
|
+
return params;
|
|
42
|
+
}
|
|
43
|
+
parseNavigateParams(params) {
|
|
44
|
+
return params;
|
|
45
|
+
}
|
|
46
|
+
parseGetTreeParams(params) {
|
|
47
|
+
return params;
|
|
48
|
+
}
|
|
49
|
+
parseSubscribeParams(params) {
|
|
50
|
+
return params;
|
|
51
|
+
}
|
|
52
|
+
parseCreateParams(params) {
|
|
53
|
+
return params;
|
|
54
|
+
}
|
|
55
|
+
parseCloseParams(params) {
|
|
56
|
+
return params;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
|
60
|
+
#contextProcessor;
|
|
61
|
+
#eventManager;
|
|
62
|
+
#parser;
|
|
63
|
+
constructor(realmStorage, cdpConnection, eventManager, selfTargetId, parser = new BidiNoOpParser(), browsingContextStorage, logger) {
|
|
64
|
+
super();
|
|
65
|
+
this.#eventManager = eventManager;
|
|
66
|
+
this.#contextProcessor = new browsingContextProcessor_js_1.BrowsingContextProcessor(realmStorage, cdpConnection, selfTargetId, eventManager, browsingContextStorage, logger);
|
|
67
|
+
this.#parser = parser;
|
|
68
|
+
}
|
|
69
|
+
// noinspection JSMethodCanBeStatic,JSUnusedLocalSymbols
|
|
70
|
+
async #process_session_status() {
|
|
71
|
+
return { result: { ready: false, message: 'already connected' } };
|
|
72
|
+
}
|
|
73
|
+
async #process_session_subscribe(params, channel) {
|
|
74
|
+
await this.#eventManager.subscribe(params.events, params.contexts ?? [null], channel);
|
|
75
|
+
return { result: {} };
|
|
76
|
+
}
|
|
77
|
+
async #process_session_unsubscribe(params, channel) {
|
|
78
|
+
await this.#eventManager.unsubscribe(params.events, params.contexts ?? [null], channel);
|
|
79
|
+
return { result: {} };
|
|
80
|
+
}
|
|
81
|
+
async #processCommand(commandData) {
|
|
82
|
+
switch (commandData.method) {
|
|
83
|
+
case 'session.status':
|
|
84
|
+
return await this.#process_session_status();
|
|
85
|
+
case 'session.subscribe':
|
|
86
|
+
return await this.#process_session_subscribe(this.#parser.parseSubscribeParams(commandData.params), commandData.channel ?? null);
|
|
87
|
+
case 'session.unsubscribe':
|
|
88
|
+
return await this.#process_session_unsubscribe(this.#parser.parseSubscribeParams(commandData.params), commandData.channel ?? null);
|
|
89
|
+
case 'browsingContext.create':
|
|
90
|
+
return await this.#contextProcessor.process_browsingContext_create(this.#parser.parseCreateParams(commandData.params));
|
|
91
|
+
case 'browsingContext.close':
|
|
92
|
+
return await this.#contextProcessor.process_browsingContext_close(this.#parser.parseCloseParams(commandData.params));
|
|
93
|
+
case 'browsingContext.getTree':
|
|
94
|
+
return await this.#contextProcessor.process_browsingContext_getTree(this.#parser.parseGetTreeParams(commandData.params));
|
|
95
|
+
case 'browsingContext.navigate':
|
|
96
|
+
return await this.#contextProcessor.process_browsingContext_navigate(this.#parser.parseNavigateParams(commandData.params));
|
|
97
|
+
case 'script.getRealms':
|
|
98
|
+
return this.#contextProcessor.process_script_getRealms(this.#parser.parseGetRealmsParams(commandData.params));
|
|
99
|
+
case 'script.callFunction':
|
|
100
|
+
return await this.#contextProcessor.process_script_callFunction(this.#parser.parseCallFunctionParams(commandData.params));
|
|
101
|
+
case 'script.evaluate':
|
|
102
|
+
return await this.#contextProcessor.process_script_evaluate(this.#parser.parseEvaluateParams(commandData.params));
|
|
103
|
+
case 'script.disown':
|
|
104
|
+
return await this.#contextProcessor.process_script_disown(this.#parser.parseDisownParams(commandData.params));
|
|
105
|
+
case 'cdp.sendCommand':
|
|
106
|
+
return await this.#contextProcessor.process_cdp_sendCommand(this.#parser.parseSendCommandParams(commandData.params));
|
|
107
|
+
case 'cdp.getSession':
|
|
108
|
+
return await this.#contextProcessor.process_cdp_getSession(this.#parser.parseGetSessionParams(commandData.params));
|
|
109
|
+
default:
|
|
110
|
+
throw new protocol_js_1.Message.UnknownCommandException(`Unknown command '${commandData.method}'.`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
processCommand = async (command) => {
|
|
114
|
+
try {
|
|
115
|
+
const result = await this.#processCommand(command);
|
|
116
|
+
const response = {
|
|
117
|
+
id: command.id,
|
|
118
|
+
...result,
|
|
119
|
+
};
|
|
120
|
+
this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(response, command.channel ?? null));
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
if (e instanceof protocol_js_1.Message.ErrorResponseClass) {
|
|
124
|
+
const errorResponse = e;
|
|
125
|
+
this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(errorResponse.toErrorResponse(command.id), command.channel ?? null));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const error = e;
|
|
129
|
+
console.error(error);
|
|
130
|
+
this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(new protocol_js_1.Message.UnknownException(error.message).toErrorResponse(command.id), command.channel ?? null));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
exports.CommandProcessor = CommandProcessor;
|
|
136
|
+
//# sourceMappingURL=CommandProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandProcessor.js","sourceRoot":"","sources":["../../../src/bidiMapper/CommandProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yDAMiC;AACjC,+FAAuF;AAGvF,8DAAsD;AAGtD,qEAA6D;AAqB7D,MAAM,cAAc;IAClB,oBAAoB,CAAC,MAAc;QACjC,OAAO,MAAoC,CAAC;IAC9C,CAAC;IACD,uBAAuB,CAAC,MAAc;QACpC,OAAO,MAAuC,CAAC;IACjD,CAAC;IACD,mBAAmB,CAAC,MAAc;QAChC,OAAO,MAAmC,CAAC;IAC7C,CAAC;IACD,iBAAiB,CAAC,MAAc;QAC9B,OAAO,MAAiC,CAAC;IAC3C,CAAC;IACD,sBAAsB,CAAC,MAAc;QACnC,OAAO,MAA+B,CAAC;IACzC,CAAC;IACD,qBAAqB,CAAC,MAAc;QAClC,OAAO,MAA8B,CAAC;IACxC,CAAC;IACD,mBAAmB,CAAC,MAAc;QAChC,OAAO,MAA4C,CAAC;IACtD,CAAC;IACD,kBAAkB,CAAC,MAAc;QAC/B,OAAO,MAA2C,CAAC;IACrD,CAAC;IACD,oBAAoB,CAAC,MAAc;QACjC,OAAO,MAAqC,CAAC;IAC/C,CAAC;IACD,iBAAiB,CAAC,MAAc;QAC9B,OAAO,MAA0C,CAAC;IACpD,CAAC;IACD,gBAAgB,CAAC,MAAc;QAC7B,OAAO,MAAyC,CAAC;IACnD,CAAC;CACF;AAED,MAAa,gBAAiB,SAAQ,8BAAoC;IACxE,iBAAiB,CAA2B;IAC5C,aAAa,CAAgB;IAC7B,OAAO,CAAa;IAEpB,YACE,YAA0B,EAC1B,aAA4B,EAC5B,YAA2B,EAC3B,YAAoB,EACpB,SAAqB,IAAI,cAAc,EAAE,EACzC,sBAA8C,EAC9C,MAAiB;QAEjB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,IAAI,s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AAC,CAAC;gBACrB,IAAI,CAAC,IAAI,CACP,UAAU,EACV,4CAAmB,CAAC,cAAc,CAChC,IAAI,qBAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,eAAe,CACzD,OAAO,CAAC,EAAE,CACX,EACD,OAAO,CAAC,OAAO,IAAI,IAAI,CACxB,CACF,CAAC;aACH;SACF;IACH,CAAC,CAAC;CACH;AAnKD,4CAmKC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2021 Google LLC.
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { Message } from '../protocol/protocol.js';
|
|
18
|
+
export declare class OutgoingBidiMessage {
|
|
19
|
+
#private;
|
|
20
|
+
private constructor();
|
|
21
|
+
static createFromPromise(messagePromise: Promise<Message.OutgoingMessage>, channel: string | null): Promise<OutgoingBidiMessage>;
|
|
22
|
+
static createResolved(message: Message.OutgoingMessage, channel: string | null): Promise<OutgoingBidiMessage>;
|
|
23
|
+
get message(): Message.OutgoingMessage;
|
|
24
|
+
get channel(): string | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2021 Google LLC.
|
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.OutgoingBidiMessage = void 0;
|
|
20
|
+
class OutgoingBidiMessage {
|
|
21
|
+
#message;
|
|
22
|
+
#channel;
|
|
23
|
+
constructor(message, channel) {
|
|
24
|
+
this.#message = message;
|
|
25
|
+
this.#channel = channel;
|
|
26
|
+
}
|
|
27
|
+
static async createFromPromise(messagePromise, channel) {
|
|
28
|
+
const message = await messagePromise;
|
|
29
|
+
return new OutgoingBidiMessage(message, channel);
|
|
30
|
+
}
|
|
31
|
+
static createResolved(message, channel) {
|
|
32
|
+
return Promise.resolve(new OutgoingBidiMessage(message, channel));
|
|
33
|
+
}
|
|
34
|
+
get message() {
|
|
35
|
+
return this.#message;
|
|
36
|
+
}
|
|
37
|
+
get channel() {
|
|
38
|
+
return this.#channel;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.OutgoingBidiMessage = OutgoingBidiMessage;
|
|
42
|
+
//# sourceMappingURL=OutgoingBidiMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutgoingBidiMessage.js","sourceRoot":"","sources":["../../../src/bidiMapper/OutgoingBidiMessage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,MAAa,mBAAmB;IACrB,QAAQ,CAA0B;IAClC,QAAQ,CAAgB;IAEjC,YACE,OAAgC,EAChC,OAAsB;QAEtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAC5B,cAAgD,EAChD,OAAsB;QAEtB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC;QACrC,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,cAAc,CACnB,OAAgC,EAChC,OAAsB;QAEtB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAlCD,kDAkCC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2022 Google LLC.
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The entry point to the BiDi Mapper namespace.
|
|
19
|
+
* Other modules should only access exports defined in this file.
|
|
20
|
+
* TODO: eslint rule for this.
|
|
21
|
+
*/
|
|
22
|
+
export { CdpConnection, CdpClient } from './CdpConnection.js';
|
|
23
|
+
export { BidiServer } from './BidiServer.js';
|
|
24
|
+
export { BidiTransport } from './BidiTransport.js';
|
|
25
|
+
export { EventEmitter } from '../utils/EventEmitter.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2022 Google LLC.
|
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.EventEmitter = exports.BidiServer = void 0;
|
|
20
|
+
var BidiServer_js_1 = require("./BidiServer.js");
|
|
21
|
+
Object.defineProperty(exports, "BidiServer", { enumerable: true, get: function () { return BidiServer_js_1.BidiServer; } });
|
|
22
|
+
var EventEmitter_js_1 = require("../utils/EventEmitter.js");
|
|
23
|
+
Object.defineProperty(exports, "EventEmitter", { enumerable: true, get: function () { return EventEmitter_js_1.EventEmitter; } });
|
|
24
|
+
//# sourceMappingURL=bidiMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bidiMapper.js","sourceRoot":"","sources":["../../../src/bidiMapper/bidiMapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AASH,iDAA2C;AAAnC,2GAAA,UAAU,OAAA;AAElB,4DAAsD;AAA9C,+GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2022 Google LLC.
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { BrowsingContext } from '../../../protocol/protocol.js';
|
|
18
|
+
import { BrowsingContextStorage } from './browsingContextStorage.js';
|
|
19
|
+
import { CdpClient } from '../../CdpConnection.js';
|
|
20
|
+
import { IEventManager } from '../events/EventManager.js';
|
|
21
|
+
import { Realm } from '../script/realm.js';
|
|
22
|
+
import { RealmStorage } from '../script/realmStorage.js';
|
|
23
|
+
export declare class BrowsingContextImpl {
|
|
24
|
+
#private;
|
|
25
|
+
private constructor();
|
|
26
|
+
static createFrameContext(realmStorage: RealmStorage, contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage): Promise<void>;
|
|
27
|
+
static createTargetContext(realmStorage: RealmStorage, contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, cdpBrowserContextId: string | null, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage): Promise<void>;
|
|
28
|
+
get cdpBrowserContextId(): string | null;
|
|
29
|
+
get navigableId(): string | null;
|
|
30
|
+
convertFrameToTargetContext(cdpClient: CdpClient, cdpSessionId: string): void;
|
|
31
|
+
delete(): Promise<void>;
|
|
32
|
+
get contextId(): string;
|
|
33
|
+
get parentId(): string | null;
|
|
34
|
+
get cdpSessionId(): string;
|
|
35
|
+
get children(): BrowsingContextImpl[];
|
|
36
|
+
get url(): string;
|
|
37
|
+
addChild(child: BrowsingContextImpl): void;
|
|
38
|
+
awaitLoaded(): Promise<void>;
|
|
39
|
+
awaitUnblocked(): Promise<void>;
|
|
40
|
+
serializeToBidiValue(maxDepth?: number, addParentFiled?: boolean): BrowsingContext.Info;
|
|
41
|
+
navigate(url: string, wait: BrowsingContext.ReadinessState): Promise<BrowsingContext.NavigateResult>;
|
|
42
|
+
getOrCreateSandbox(sandbox: string | undefined): Promise<Realm>;
|
|
43
|
+
}
|