appium-remote-debugger 11.4.1 → 11.5.0
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/CHANGELOG.md +12 -0
- package/build/lib/mixins/connect.d.ts +53 -56
- package/build/lib/mixins/connect.d.ts.map +1 -1
- package/build/lib/mixins/connect.js +72 -96
- package/build/lib/mixins/connect.js.map +1 -1
- package/build/lib/mixins/cookies.d.ts +22 -0
- package/build/lib/mixins/cookies.d.ts.map +1 -0
- package/build/lib/mixins/cookies.js +48 -0
- package/build/lib/mixins/cookies.js.map +1 -0
- package/build/lib/mixins/events.d.ts +17 -2
- package/build/lib/mixins/events.d.ts.map +1 -1
- package/build/lib/mixins/events.js +29 -2
- package/build/lib/mixins/events.js.map +1 -1
- package/build/lib/mixins/execute.d.ts +5 -12
- package/build/lib/mixins/execute.d.ts.map +1 -1
- package/build/lib/mixins/execute.js +18 -30
- package/build/lib/mixins/execute.js.map +1 -1
- package/build/lib/mixins/message-handlers.d.ts +13 -23
- package/build/lib/mixins/message-handlers.d.ts.map +1 -1
- package/build/lib/mixins/message-handlers.js +56 -27
- package/build/lib/mixins/message-handlers.js.map +1 -1
- package/build/lib/mixins/misc.d.ts +51 -0
- package/build/lib/mixins/misc.d.ts.map +1 -0
- package/build/lib/mixins/misc.js +132 -0
- package/build/lib/mixins/misc.js.map +1 -0
- package/build/lib/mixins/navigate.d.ts +20 -29
- package/build/lib/mixins/navigate.d.ts.map +1 -1
- package/build/lib/mixins/navigate.js +25 -23
- package/build/lib/mixins/navigate.js.map +1 -1
- package/build/lib/mixins/screenshot.d.ts +13 -0
- package/build/lib/mixins/screenshot.d.ts.map +1 -0
- package/build/lib/mixins/screenshot.js +31 -0
- package/build/lib/mixins/screenshot.js.map +1 -0
- package/build/lib/remote-debugger-real-device.d.ts +16 -2
- package/build/lib/remote-debugger-real-device.d.ts.map +1 -1
- package/build/lib/remote-debugger-real-device.js +11 -1
- package/build/lib/remote-debugger-real-device.js.map +1 -1
- package/build/lib/remote-debugger.d.ts +155 -174
- package/build/lib/remote-debugger.d.ts.map +1 -1
- package/build/lib/remote-debugger.js +149 -210
- package/build/lib/remote-debugger.js.map +1 -1
- package/build/lib/rpc/rpc-client.d.ts +14 -13
- package/build/lib/rpc/rpc-client.d.ts.map +1 -1
- package/build/lib/rpc/rpc-client.js +8 -6
- package/build/lib/rpc/rpc-client.js.map +1 -1
- package/build/lib/utils.d.ts +20 -16
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +33 -25
- package/build/lib/utils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/mixins/connect.js +77 -111
- package/lib/mixins/cookies.js +45 -0
- package/lib/mixins/events.js +25 -1
- package/lib/mixins/execute.js +18 -39
- package/lib/mixins/message-handlers.js +67 -36
- package/lib/mixins/misc.js +128 -0
- package/lib/mixins/navigate.js +26 -30
- package/lib/mixins/screenshot.js +34 -0
- package/lib/remote-debugger-real-device.js +14 -1
- package/lib/remote-debugger.js +138 -302
- package/lib/rpc/rpc-client.js +9 -7
- package/lib/utils.js +42 -38
- package/package.json +1 -1
- package/build/lib/mixins/index.d.ts +0 -5
- package/build/lib/mixins/index.d.ts.map +0 -1
- package/build/lib/mixins/index.js +0 -16
- package/build/lib/mixins/index.js.map +0 -1
- package/lib/mixins/index.js +0 -14
|
@@ -1,61 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
29
|
+
exports.RemoteDebugger = exports.RPC_RESPONSE_TIMEOUT_MS = exports.REMOTE_DEBUGGER_PORT = void 0;
|
|
7
30
|
const events_1 = require("events");
|
|
8
31
|
const logger_1 = __importDefault(require("./logger"));
|
|
9
32
|
const rpc_1 = require("./rpc");
|
|
10
33
|
const utils_1 = require("./utils");
|
|
11
|
-
const
|
|
34
|
+
const connectMixins = __importStar(require("./mixins/connect"));
|
|
35
|
+
const executeMixins = __importStar(require("./mixins/execute"));
|
|
36
|
+
const messageHandlerMixins = __importStar(require("./mixins/message-handlers"));
|
|
37
|
+
const navigationMixins = __importStar(require("./mixins/navigate"));
|
|
38
|
+
const cookieMixins = __importStar(require("./mixins/cookies"));
|
|
39
|
+
const screenshotMixins = __importStar(require("./mixins/screenshot"));
|
|
40
|
+
const eventMixins = __importStar(require("./mixins/events"));
|
|
41
|
+
const miscellaneousMixins = __importStar(require("./mixins/misc"));
|
|
12
42
|
const lodash_1 = __importDefault(require("lodash"));
|
|
13
|
-
const bluebird_1 = __importDefault(require("bluebird"));
|
|
14
|
-
const path_1 = __importDefault(require("path"));
|
|
15
43
|
const async_lock_1 = __importDefault(require("async-lock"));
|
|
16
|
-
|
|
17
|
-
exports.REMOTE_DEBUGGER_PORT = REMOTE_DEBUGGER_PORT;
|
|
18
|
-
const SAFARI_BUNDLE_ID = 'com.apple.mobilesafari';
|
|
44
|
+
exports.REMOTE_DEBUGGER_PORT = 27753;
|
|
19
45
|
/* How many milliseconds to wait for webkit to return a response before timing out */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const GARBAGE_COLLECT_TIMEOUT = 5000;
|
|
46
|
+
exports.RPC_RESPONSE_TIMEOUT_MS = 5000;
|
|
47
|
+
const PAGE_READY_TIMEOUT_MS = 5000;
|
|
48
|
+
const { version: MODULE_VERSION } = (0, utils_1.getModuleProperties)();
|
|
24
49
|
class RemoteDebugger extends events_1.EventEmitter {
|
|
25
|
-
/**
|
|
26
|
-
* @typedef {Object} RemoteDebuggerOptions
|
|
27
|
-
* @property {string} [bundleId] id of the app being connected to
|
|
28
|
-
* @property {string[]} [additionalBundleIds=[]] array of possible bundle
|
|
29
|
-
* ids that the inspector could return
|
|
30
|
-
* @property {string} [platformVersion] version of iOS
|
|
31
|
-
* @property {boolean} [isSafari=true]
|
|
32
|
-
* @property {boolean} [includeSafari=false]
|
|
33
|
-
* @property {boolean} [useNewSafari=false] for web inspector, whether this is a new Safari instance
|
|
34
|
-
* @property {number} [pageLoadMs] the time, in ms, that should be waited for page loading
|
|
35
|
-
* @property {string} [host] the remote debugger's host address
|
|
36
|
-
* @property {number} [port=REMOTE_DEBUGGER_PORT] the remote debugger port through which to communicate
|
|
37
|
-
* @property {string} [socketPath]
|
|
38
|
-
* @property {number} [pageReadyTimeout=PAGE_READY_TIMEOUT]
|
|
39
|
-
* @property {string} [remoteDebugProxy]
|
|
40
|
-
* @property {boolean} [garbageCollectOnExecute=false]
|
|
41
|
-
* @property {boolean} [logFullResponse=false]
|
|
42
|
-
* @property {boolean} [logAllCommunication=false] log plists sent and received from Web Inspector
|
|
43
|
-
* @property {boolean} [logAllCommunicationHexDump=false] log communication from Web Inspector as hex dump
|
|
44
|
-
* @property {number} [webInspectorMaxFrameLength] The maximum size in bytes of a single data
|
|
45
|
-
* frame in the device communication protocol
|
|
46
|
-
* @property {number} [socketChunkSize] size, in bytes, of chunks of data sent to
|
|
47
|
-
* Web Inspector (real device only)
|
|
48
|
-
* @property {boolean} [fullPageInitialization]
|
|
49
|
-
* @property {string} [pageLoadStrategy]
|
|
50
|
-
*/
|
|
51
50
|
/**
|
|
52
51
|
* @param {RemoteDebuggerOptions} opts
|
|
53
52
|
*/
|
|
54
53
|
constructor(opts = {}) {
|
|
55
54
|
super();
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
// methods
|
|
56
|
+
this.setConnectionKey = connectMixins.setConnectionKey;
|
|
57
|
+
this.disconnect = connectMixins.disconnect;
|
|
58
|
+
this.searchForApp = connectMixins.searchForApp;
|
|
59
|
+
this.searchForPage = connectMixins.searchForPage;
|
|
60
|
+
this.checkPageIsReady = navigationMixins.checkPageIsReady;
|
|
61
|
+
this.cancelPageLoad = navigationMixins.cancelPageLoad;
|
|
62
|
+
this.waitForDom = navigationMixins.waitForDom;
|
|
63
|
+
this.execute = executeMixins.execute;
|
|
64
|
+
this.executeAtom = executeMixins.executeAtom;
|
|
65
|
+
this.executeAtomAsync = executeMixins.executeAtomAsync;
|
|
66
|
+
this.isPageLoadingCompleted = navigationMixins.isPageLoadingCompleted;
|
|
67
|
+
this.selectApp = connectMixins.selectApp;
|
|
68
|
+
this.connect = connectMixins.connect;
|
|
69
|
+
this.selectPage = connectMixins.selectPage;
|
|
70
|
+
this.navToUrl = navigationMixins.navToUrl;
|
|
71
|
+
this.getCookies = cookieMixins.getCookies;
|
|
72
|
+
this.setCookie = cookieMixins.setCookie;
|
|
73
|
+
this.deleteCookie = cookieMixins.deleteCookie;
|
|
74
|
+
this.captureScreenshot = screenshotMixins.captureScreenshot;
|
|
75
|
+
this.addClientEventListener = eventMixins.addClientEventListener;
|
|
76
|
+
this.removeClientEventListener = eventMixins.removeClientEventListener;
|
|
77
|
+
this.launchSafari = miscellaneousMixins.launchSafari;
|
|
78
|
+
this.startTimeline = miscellaneousMixins.startTimeline;
|
|
79
|
+
this.stopTimeline = miscellaneousMixins.stopTimeline;
|
|
80
|
+
this.startConsole = miscellaneousMixins.startConsole;
|
|
81
|
+
this.stopConsole = miscellaneousMixins.stopConsole;
|
|
82
|
+
this.startNetwork = miscellaneousMixins.startNetwork;
|
|
83
|
+
this.stopNetwork = miscellaneousMixins.stopNetwork;
|
|
84
|
+
this.overrideUserAgent = miscellaneousMixins.overrideUserAgent;
|
|
85
|
+
this.garbageCollect = miscellaneousMixins.garbageCollect;
|
|
86
|
+
// Callbacks
|
|
87
|
+
this.onPageChange = messageHandlerMixins.onPageChange;
|
|
88
|
+
this.onConnectedApplicationList = messageHandlerMixins.onConnectedApplicationList;
|
|
89
|
+
this.onAppConnect = messageHandlerMixins.onAppConnect;
|
|
90
|
+
this.onAppDisconnect = messageHandlerMixins.onAppDisconnect;
|
|
91
|
+
this.onAppUpdate = messageHandlerMixins.onAppUpdate;
|
|
92
|
+
this.onConnectedDriverList = messageHandlerMixins.onConnectedDriverList;
|
|
93
|
+
this.onCurrentState = messageHandlerMixins.onCurrentState;
|
|
94
|
+
this.frameDetached = navigationMixins.frameDetached;
|
|
95
|
+
// @ts-ignore This is OK
|
|
96
|
+
this._log = opts.log ?? logger_1.default;
|
|
97
|
+
this.log.info(`Remote Debugger version ${MODULE_VERSION}`);
|
|
98
|
+
const { bundleId, additionalBundleIds = [], platformVersion, isSafari = true, includeSafari = false, useNewSafari = false, pageLoadMs, host, port = exports.REMOTE_DEBUGGER_PORT, socketPath, pageReadyTimeout = PAGE_READY_TIMEOUT_MS, remoteDebugProxy, garbageCollectOnExecute = false, logFullResponse = false, logAllCommunication = false, logAllCommunicationHexDump = false, webInspectorMaxFrameLength, socketChunkSize, fullPageInitialization, pageLoadStrategy, } = opts;
|
|
59
99
|
this.bundleId = bundleId;
|
|
60
100
|
this.additionalBundleIds = additionalBundleIds;
|
|
61
101
|
this.platformVersion = platformVersion;
|
|
@@ -63,7 +103,7 @@ class RemoteDebugger extends events_1.EventEmitter {
|
|
|
63
103
|
this.includeSafari = includeSafari;
|
|
64
104
|
this.useNewSafari = useNewSafari;
|
|
65
105
|
this.pageLoadMs = pageLoadMs;
|
|
66
|
-
|
|
106
|
+
this.log.debug(`useNewSafari --> ${this.useNewSafari}`);
|
|
67
107
|
this.garbageCollectOnExecute = garbageCollectOnExecute;
|
|
68
108
|
this.host = host;
|
|
69
109
|
this.port = port;
|
|
@@ -80,6 +120,28 @@ class RemoteDebugger extends events_1.EventEmitter {
|
|
|
80
120
|
this.pageLoadStrategy = pageLoadStrategy;
|
|
81
121
|
this._lock = new async_lock_1.default();
|
|
82
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* @returns {import('@appium/types').AppiumLogger}
|
|
125
|
+
*/
|
|
126
|
+
get log() {
|
|
127
|
+
return this._log;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @param {boolean} [checkConnected=false]
|
|
131
|
+
* @returns {import('./rpc/rpc-client').RpcClient}
|
|
132
|
+
*/
|
|
133
|
+
requireRpcClient(checkConnected = false) {
|
|
134
|
+
if (!this.rpcClient) {
|
|
135
|
+
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
136
|
+
}
|
|
137
|
+
if (checkConnected && !this.rpcClient.isConnected) {
|
|
138
|
+
throw new Error('Remote debugger is not connected');
|
|
139
|
+
}
|
|
140
|
+
return this.rpcClient;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @returns {void}
|
|
144
|
+
*/
|
|
83
145
|
setup() {
|
|
84
146
|
// app handling configuration
|
|
85
147
|
this.appDict = {};
|
|
@@ -91,8 +153,11 @@ class RemoteDebugger extends events_1.EventEmitter {
|
|
|
91
153
|
this.rpcClient = null;
|
|
92
154
|
this._clientEventListeners = {};
|
|
93
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* @returns {void}
|
|
158
|
+
*/
|
|
94
159
|
teardown() {
|
|
95
|
-
|
|
160
|
+
this.log.debug('Cleaning up listeners');
|
|
96
161
|
this.appDict = {};
|
|
97
162
|
this.appIdKey = null;
|
|
98
163
|
this.pageIdKey = null;
|
|
@@ -101,6 +166,9 @@ class RemoteDebugger extends events_1.EventEmitter {
|
|
|
101
166
|
this.removeAllListeners(RemoteDebugger.EVENT_PAGE_CHANGE);
|
|
102
167
|
this.removeAllListeners(RemoteDebugger.EVENT_DISCONNECT);
|
|
103
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* @returns {void}
|
|
171
|
+
*/
|
|
104
172
|
initRpcClient() {
|
|
105
173
|
this.rpcClient = new rpc_1.RpcClientSimulator({
|
|
106
174
|
bundleId: this.bundleId,
|
|
@@ -116,190 +184,61 @@ class RemoteDebugger extends events_1.EventEmitter {
|
|
|
116
184
|
webInspectorMaxFrameLength: this.webInspectorMaxFrameLength,
|
|
117
185
|
});
|
|
118
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* @returns {boolean}
|
|
189
|
+
*/
|
|
119
190
|
get isConnected() {
|
|
120
191
|
return !!this.rpcClient?.isConnected;
|
|
121
192
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
125
|
-
}
|
|
126
|
-
await this.rpcClient.send('launchApplication', {
|
|
127
|
-
bundleId: SAFARI_BUNDLE_ID
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
async startTimeline(fn) {
|
|
131
|
-
if (!this.rpcClient) {
|
|
132
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
133
|
-
}
|
|
134
|
-
logger_1.default.debug('Starting to record the timeline');
|
|
135
|
-
this.rpcClient.on('Timeline.eventRecorded', fn);
|
|
136
|
-
return await this.rpcClient.send('Timeline.start', {
|
|
137
|
-
appIdKey: this.appIdKey,
|
|
138
|
-
pageIdKey: this.pageIdKey,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
async stopTimeline() {
|
|
142
|
-
if (!this.rpcClient) {
|
|
143
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
144
|
-
}
|
|
145
|
-
logger_1.default.debug('Stopping to record the timeline');
|
|
146
|
-
await this.rpcClient.send('Timeline.stop', {
|
|
147
|
-
appIdKey: this.appIdKey,
|
|
148
|
-
pageIdKey: this.pageIdKey,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
/*
|
|
152
|
-
* Keep track of the client event listeners so they can be removed
|
|
193
|
+
/**
|
|
194
|
+
* @param {boolean} allow
|
|
153
195
|
*/
|
|
154
|
-
addClientEventListener(eventName, listener) {
|
|
155
|
-
if (!this.rpcClient) {
|
|
156
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
157
|
-
}
|
|
158
|
-
this._clientEventListeners[eventName] = this._clientEventListeners[eventName] || [];
|
|
159
|
-
this._clientEventListeners[eventName].push(listener);
|
|
160
|
-
this.rpcClient.on(eventName, listener);
|
|
161
|
-
}
|
|
162
|
-
removeClientEventListener(eventName) {
|
|
163
|
-
if (!this.rpcClient) {
|
|
164
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
165
|
-
}
|
|
166
|
-
for (const listener of (this._clientEventListeners[eventName] || [])) {
|
|
167
|
-
this.rpcClient.off(eventName, listener);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
startConsole(listener) {
|
|
171
|
-
logger_1.default.debug('Starting to listen for JavaScript console');
|
|
172
|
-
this.addClientEventListener('Console.messageAdded', listener);
|
|
173
|
-
this.addClientEventListener('Console.messageRepeatCountUpdated', listener);
|
|
174
|
-
}
|
|
175
|
-
stopConsole() {
|
|
176
|
-
logger_1.default.debug('Stopping to listen for JavaScript console');
|
|
177
|
-
this.removeClientEventListener('Console.messageAdded');
|
|
178
|
-
this.removeClientEventListener('Console.messageRepeatCountUpdated');
|
|
179
|
-
}
|
|
180
|
-
startNetwork(listener) {
|
|
181
|
-
logger_1.default.debug('Starting to listen for network events');
|
|
182
|
-
this.addClientEventListener('NetworkEvent', listener);
|
|
183
|
-
}
|
|
184
|
-
stopNetwork() {
|
|
185
|
-
logger_1.default.debug('Stopping to listen for network events');
|
|
186
|
-
this.removeClientEventListener('NetworkEvent');
|
|
187
|
-
}
|
|
188
196
|
set allowNavigationWithoutReload(allow) {
|
|
189
197
|
this._allowNavigationWithoutReload = allow;
|
|
190
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* @returns {boolean}
|
|
201
|
+
*/
|
|
191
202
|
get allowNavigationWithoutReload() {
|
|
192
|
-
return this._allowNavigationWithoutReload;
|
|
193
|
-
}
|
|
194
|
-
// Potentially this does not work for mobile safari
|
|
195
|
-
async overrideUserAgent(value) {
|
|
196
|
-
logger_1.default.debug('Setting overrideUserAgent');
|
|
197
|
-
if (!this.rpcClient) {
|
|
198
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
199
|
-
}
|
|
200
|
-
return await this.rpcClient.send('Page.overrideUserAgent', {
|
|
201
|
-
appIdKey: this.appIdKey,
|
|
202
|
-
pageIdKey: this.pageIdKey,
|
|
203
|
-
value
|
|
204
|
-
});
|
|
203
|
+
return !!this._allowNavigationWithoutReload;
|
|
205
204
|
}
|
|
206
205
|
/**
|
|
207
|
-
*
|
|
208
|
-
* @param {{rect?: import('@appium/types').Rect|null, coordinateSystem?: "Viewport"|"Page"}} [opts={rect: null, coordinateSystem: 'Viewport'}]
|
|
209
|
-
* if rect is null capture the whole coordinate system else capture the rect in the given coordinateSystem
|
|
210
|
-
* @returns {Promise<string>} a base64 encoded string of the screenshot
|
|
206
|
+
* @returns {string[]}
|
|
211
207
|
*/
|
|
212
|
-
async captureScreenshot(opts) {
|
|
213
|
-
const { rect = null, coordinateSystem = 'Viewport' } = opts ?? {};
|
|
214
|
-
logger_1.default.debug('Capturing screenshot');
|
|
215
|
-
if (!this.rpcClient) {
|
|
216
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
217
|
-
}
|
|
218
|
-
const arect = rect ?? /** @type {import('@appium/types').Rect} */ (await this.executeAtom('execute_script', ['return {x: 0, y: 0, width: window.innerWidth, height: window.innerHeight}', []]));
|
|
219
|
-
const response = await this.rpcClient.send('Page.snapshotRect', {
|
|
220
|
-
...arect,
|
|
221
|
-
appIdKey: this.appIdKey,
|
|
222
|
-
pageIdKey: this.pageIdKey,
|
|
223
|
-
coordinateSystem,
|
|
224
|
-
});
|
|
225
|
-
if (response.error) {
|
|
226
|
-
throw new Error(response.error);
|
|
227
|
-
}
|
|
228
|
-
return response.dataURL.replace(/^data:image\/png;base64,/, '');
|
|
229
|
-
}
|
|
230
|
-
async getCookies() {
|
|
231
|
-
logger_1.default.debug('Getting cookies');
|
|
232
|
-
if (!this.rpcClient) {
|
|
233
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
234
|
-
}
|
|
235
|
-
return await this.rpcClient.send('Page.getCookies', {
|
|
236
|
-
appIdKey: this.appIdKey,
|
|
237
|
-
pageIdKey: this.pageIdKey
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
async setCookie(cookie) {
|
|
241
|
-
logger_1.default.debug('Setting cookie');
|
|
242
|
-
if (!this.rpcClient) {
|
|
243
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
244
|
-
}
|
|
245
|
-
return await this.rpcClient.send('Page.setCookie', {
|
|
246
|
-
appIdKey: this.appIdKey,
|
|
247
|
-
pageIdKey: this.pageIdKey,
|
|
248
|
-
cookie
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
async deleteCookie(cookieName, url) {
|
|
252
|
-
logger_1.default.debug(`Deleting cookie '${cookieName}' on '${url}'`);
|
|
253
|
-
if (!this.rpcClient) {
|
|
254
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
255
|
-
}
|
|
256
|
-
return await this.rpcClient.send('Page.deleteCookie', {
|
|
257
|
-
appIdKey: this.appIdKey,
|
|
258
|
-
pageIdKey: this.pageIdKey,
|
|
259
|
-
cookieName,
|
|
260
|
-
url,
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
async garbageCollect(timeoutMs = GARBAGE_COLLECT_TIMEOUT) {
|
|
264
|
-
logger_1.default.debug(`Garbage collecting with ${timeoutMs}ms timeout`);
|
|
265
|
-
if (!this.rpcClient) {
|
|
266
|
-
throw new Error(`rpcClient is undefined. Has 'initRpcClient' been called before?`);
|
|
267
|
-
}
|
|
268
|
-
try {
|
|
269
|
-
(0, utils_1.checkParams)({ appIdKey: this.appIdKey, pageIdKey: this.pageIdKey });
|
|
270
|
-
}
|
|
271
|
-
catch (err) {
|
|
272
|
-
logger_1.default.debug(`Unable to collect garbage at this time`);
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
await bluebird_1.default.resolve(this.rpcClient.send('Heap.gc', {
|
|
276
|
-
appIdKey: this.appIdKey,
|
|
277
|
-
pageIdKey: this.pageIdKey,
|
|
278
|
-
})).timeout(timeoutMs)
|
|
279
|
-
.then(function gcSuccess() {
|
|
280
|
-
logger_1.default.debug(`Garbage collection successful`);
|
|
281
|
-
}).catch(function gcError(err) {
|
|
282
|
-
if (err instanceof bluebird_1.default.TimeoutError) {
|
|
283
|
-
logger_1.default.debug(`Garbage collection timed out after ${timeoutMs}ms`);
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
logger_1.default.debug(`Unable to collect garbage: ${err.message}`);
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
async useAppDictLock(fn) {
|
|
291
|
-
return await this._lock.acquire('appDict', fn);
|
|
292
|
-
}
|
|
293
208
|
get skippedApps() {
|
|
294
|
-
return this._skippedApps
|
|
209
|
+
return this._skippedApps ?? [];
|
|
295
210
|
}
|
|
296
211
|
}
|
|
297
212
|
exports.RemoteDebugger = RemoteDebugger;
|
|
298
|
-
for (const [name,
|
|
299
|
-
RemoteDebugger.prototype[name] = fn;
|
|
300
|
-
}
|
|
301
|
-
for (const [name, event] of lodash_1.default.toPairs(mixins_1.events)) {
|
|
213
|
+
for (const [name, event] of lodash_1.default.toPairs(eventMixins.events)) {
|
|
302
214
|
RemoteDebugger[name] = event;
|
|
303
215
|
}
|
|
304
216
|
exports.default = RemoteDebugger;
|
|
217
|
+
/**
|
|
218
|
+
* @typedef {Object} RemoteDebuggerOptions
|
|
219
|
+
* @property {string} [bundleId] id of the app being connected to
|
|
220
|
+
* @property {string[]} [additionalBundleIds=[]] array of possible bundle
|
|
221
|
+
* ids that the inspector could return
|
|
222
|
+
* @property {string} [platformVersion] version of iOS
|
|
223
|
+
* @property {boolean} [isSafari=true]
|
|
224
|
+
* @property {boolean} [includeSafari=false]
|
|
225
|
+
* @property {boolean} [useNewSafari=false] for web inspector, whether this is a new Safari instance
|
|
226
|
+
* @property {number} [pageLoadMs] the time, in ms, that should be waited for page loading
|
|
227
|
+
* @property {string} [host] the remote debugger's host address
|
|
228
|
+
* @property {number} [port=REMOTE_DEBUGGER_PORT] the remote debugger port through which to communicate
|
|
229
|
+
* @property {string} [socketPath]
|
|
230
|
+
* @property {number} [pageReadyTimeout=PAGE_READY_TIMEOUT]
|
|
231
|
+
* @property {string} [remoteDebugProxy]
|
|
232
|
+
* @property {boolean} [garbageCollectOnExecute=false]
|
|
233
|
+
* @property {boolean} [logFullResponse=false]
|
|
234
|
+
* @property {boolean} [logAllCommunication=false] log plists sent and received from Web Inspector
|
|
235
|
+
* @property {boolean} [logAllCommunicationHexDump=false] log communication from Web Inspector as hex dump
|
|
236
|
+
* @property {number} [webInspectorMaxFrameLength] The maximum size in bytes of a single data
|
|
237
|
+
* frame in the device communication protocol
|
|
238
|
+
* @property {number} [socketChunkSize] size, in bytes, of chunks of data sent to
|
|
239
|
+
* Web Inspector (real device only)
|
|
240
|
+
* @property {boolean} [fullPageInitialization]
|
|
241
|
+
* @property {string} [pageLoadStrategy]
|
|
242
|
+
* @property {import('@appium/types').AppiumLogger} [log]
|
|
243
|
+
*/
|
|
305
244
|
//# sourceMappingURL=remote-debugger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-debugger.js","sourceRoot":"","sources":["../../lib/remote-debugger.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote-debugger.js","sourceRoot":"","sources":["../../lib/remote-debugger.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAsC;AACtC,sDAAkC;AAClC,+BAA2C;AAC3C,mCAA8C;AAC9C,gEAAkD;AAClD,gEAAkD;AAClD,gFAAkE;AAClE,oEAAsD;AACtD,+DAAiD;AACjD,sEAAwD;AACxD,6DAA+C;AAC/C,mEAAqD;AACrD,oDAAuB;AACvB,4DAAmC;AAEtB,QAAA,oBAAoB,GAAG,KAAK,CAAC;AAC1C,qFAAqF;AACxE,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAC5C,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,IAAA,2BAAmB,GAAE,CAAC;AAG1D,MAAa,cAAe,SAAQ,qBAAY;IA+E9C;;OAEG;IACH,YAAa,IAAI,GAAG,EAAE;QACpB,KAAK,EAAE,CAAC;QA9CV,UAAU;QACV,qBAAgB,GAAG,aAAa,CAAC,gBAAgB,CAAC;QAClD,eAAU,GAAG,aAAa,CAAC,UAAU,CAAC;QACtC,iBAAY,GAAG,aAAa,CAAC,YAAY,CAAC;QAC1C,kBAAa,GAAG,aAAa,CAAC,aAAa,CAAC;QAC5C,qBAAgB,GAAG,gBAAgB,CAAC,gBAAgB,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C,mBAAmB;YAC7C,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;YAC3D,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;SAC5D,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACb,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,4BAA4B,CAAE,KAAK;QACrC,IAAI,CAAC,6BAA6B,GAAG,KAAK,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,IAAI,4BAA4B;QAC9B,OAAO,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;IACjC,CAAC;CACF;AApPD,wCAoPC;AAED,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,gBAAC,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1D,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;AAC/B,CAAC;AAED,kBAAe,cAAc,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class RpcClient {
|
|
2
2
|
constructor(opts?: {});
|
|
3
3
|
/** @type {RpcMessageHandler|undefined} */
|
|
4
4
|
messageHandler: RpcMessageHandler | undefined;
|
|
@@ -39,11 +39,11 @@ export default class RpcClient {
|
|
|
39
39
|
/**
|
|
40
40
|
*
|
|
41
41
|
* @param {string} appIdKey
|
|
42
|
-
* @param {string} pageIdKey
|
|
42
|
+
* @param {string|number} pageIdKey
|
|
43
43
|
* @param {boolean} [force]
|
|
44
44
|
* @returns {Promise<void>}
|
|
45
45
|
*/
|
|
46
|
-
waitForTarget(appIdKey: string, pageIdKey: string, force?: boolean | undefined): Promise<void>;
|
|
46
|
+
waitForTarget(appIdKey: string, pageIdKey: string | number, force?: boolean | undefined): Promise<void>;
|
|
47
47
|
/**
|
|
48
48
|
*
|
|
49
49
|
* @param {string} command
|
|
@@ -91,34 +91,34 @@ export default class RpcClient {
|
|
|
91
91
|
removeTarget(err: Error | null, app: string, targetInfo: Record<string, any>): void;
|
|
92
92
|
/**
|
|
93
93
|
* @param {string} appIdKey
|
|
94
|
-
* @param {string} pageIdKey
|
|
94
|
+
* @param {string|number} pageIdKey
|
|
95
95
|
* @returns {any}
|
|
96
96
|
*/
|
|
97
|
-
getTarget(appIdKey: string, pageIdKey: string): any;
|
|
97
|
+
getTarget(appIdKey: string, pageIdKey: string | number): any;
|
|
98
98
|
/**
|
|
99
99
|
* @param {string} appIdKey
|
|
100
|
-
* @param {string} pageIdKey
|
|
100
|
+
* @param {string|number} pageIdKey
|
|
101
101
|
* @returns {Promise<void>}
|
|
102
102
|
*/
|
|
103
|
-
selectPage(appIdKey: string, pageIdKey: string): Promise<void>;
|
|
104
|
-
/** @type {[string, string]} */
|
|
105
|
-
pendingTargetNotification: [string, string] | undefined;
|
|
103
|
+
selectPage(appIdKey: string, pageIdKey: string | number): Promise<void>;
|
|
104
|
+
/** @type {[string, string|number]} */
|
|
105
|
+
pendingTargetNotification: [string, string | number] | undefined;
|
|
106
106
|
/**
|
|
107
107
|
* Perform the minimal initialization to get the Web Inspector working
|
|
108
108
|
* @param {string} appIdKey
|
|
109
|
-
* @param {string} pageIdKey
|
|
109
|
+
* @param {string|number} pageIdKey
|
|
110
110
|
* @returns {Promise<void>}
|
|
111
111
|
*/
|
|
112
|
-
initializePage(appIdKey: string, pageIdKey: string): Promise<void>;
|
|
112
|
+
initializePage(appIdKey: string, pageIdKey: string | number): Promise<void>;
|
|
113
113
|
/**
|
|
114
114
|
* Mimic every step that Desktop Safari Develop tools uses to initialize a
|
|
115
115
|
* Web Inspector session
|
|
116
116
|
*
|
|
117
117
|
* @param {string} appIdKey
|
|
118
|
-
* @param {string} pageIdKey
|
|
118
|
+
* @param {string|number} pageIdKey
|
|
119
119
|
* @returns {Promise<void>}
|
|
120
120
|
*/
|
|
121
|
-
initializePageFull(appIdKey: string, pageIdKey: string): Promise<void>;
|
|
121
|
+
initializePageFull(appIdKey: string, pageIdKey: string | number): Promise<void>;
|
|
122
122
|
/**
|
|
123
123
|
*
|
|
124
124
|
* @param {string} appIdKey
|
|
@@ -139,6 +139,7 @@ export default class RpcClient {
|
|
|
139
139
|
*/
|
|
140
140
|
onScriptParsed(err: Error | null, scriptInfo: Record<string, any>): void;
|
|
141
141
|
}
|
|
142
|
+
export default RpcClient;
|
|
142
143
|
import RpcMessageHandler from './rpc-message-handler';
|
|
143
144
|
import RemoteMessages from './remote-messages';
|
|
144
145
|
import { EventEmitter } from 'node:events';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../lib/rpc/rpc-client.js"],"names":[],"mappings":"AA+BA;IAUE,uBAyCC;IAlDD,0CAA0C;IAC1C,gBADW,iBAAiB,GAAC,SAAS,CACvB;IAEf,uCAAuC;IACvC,gBADW,cAAc,GAAC,SAAS,CACpB;IAEf,sBAAsB;IACtB,WADW,OAAO,CACR;IAGR,aAAkB;IAClB,+BAAwD;IAcxD,cAAwB;IAmD1B,oCAEC;IAND,2BAEC;IA9CC,eAA2B;IAC3B,iBAA6B;IAC7B,cAAc;IAEd,UAAgB;IAEhB,yBAA8C;IAC9C,gCAA4D;IAC5D,qBAAsC;IACtC,gCAA4D;IAE5D,4BAAoD;IAEpD,cAAwB;IACxB,qBAAsC;IAEtC,iBAAmB;IAEnB,4CAA8C;IAwDhD,sCAsBC;IAED,yBAEC;IA5ED,sBAEC;IAED,uBAEC;IAED,kBAEC;IAMD,wDAEC;IAND,oCAEC;IAcD,iDAEC;IAED,oCAIC;IAED,sCAIC;IAED,qCAIC;IAIC,oBAAmC;IA0BrC;;;;;;OAMG;IACH,wBALW,MAAM,aACN,MAAM,
|
|
1
|
+
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../lib/rpc/rpc-client.js"],"names":[],"mappings":"AA+BA;IAUE,uBAyCC;IAlDD,0CAA0C;IAC1C,gBADW,iBAAiB,GAAC,SAAS,CACvB;IAEf,uCAAuC;IACvC,gBADW,cAAc,GAAC,SAAS,CACpB;IAEf,sBAAsB;IACtB,WADW,OAAO,CACR;IAGR,aAAkB;IAClB,+BAAwD;IAcxD,cAAwB;IAmD1B,oCAEC;IAND,2BAEC;IA9CC,eAA2B;IAC3B,iBAA6B;IAC7B,cAAc;IAEd,UAAgB;IAEhB,yBAA8C;IAC9C,gCAA4D;IAC5D,qBAAsC;IACtC,gCAA4D;IAE5D,4BAAoD;IAEpD,cAAwB;IACxB,qBAAsC;IAEtC,iBAAmB;IAEnB,4CAA8C;IAwDhD,sCAsBC;IAED,yBAEC;IA5ED,sBAEC;IAED,uBAEC;IAED,kBAEC;IAMD,wDAEC;IAND,oCAEC;IAcD,iDAEC;IAED,oCAIC;IAED,sCAIC;IAED,qCAIC;IAIC,oBAAmC;IA0BrC;;;;;;OAMG;IACH,wBALW,MAAM,aACN,MAAM,GAAC,MAAM,gCAEX,OAAO,CAAC,IAAI,CAAC,CAwBzB;IAED;;;;;;OAMG;IACH,cALW,MAAM,kFAGJ,OAAO,CAAC,GAAG,CAAC,CAgCxB;IAED;;;;;;OAMG;IACH,sBALW,MAAM,SACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,0CAEjB,OAAO,CAAC,GAAG,CAAC,CAuGxB;IAED,yBAEC;IAED,4BAEC;IAGD,yCAEC;IAED,yBAEC;IAED;;;;;;OAMG;IACH,eALW,KAAK,OAAC,OACN,MAAM,cACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,IAAI,CA0BhB;IAED;;;;;;;OAOG;IACH,kBANW,KAAK,OAAC,OACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,IAAI,CAahB;IAED;;;;;;OAMG;IACH,kBALW,KAAK,OAAC,OACN,MAAM,cACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,IAAI,CAmDhB;IAED;;;;OAIG;IACH,oBAJW,MAAM,aACN,MAAM,GAAC,MAAM,GACX,GAAG,CAIf;IAED;;;;OAIG;IACH,qBAJW,MAAM,aACN,MAAM,GAAC,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAoCzB;IAjCC,sCAAsC;IACtC,iEAAsD;IAkCxD;;;;;OAKG;IACH,yBAJW,MAAM,aACN,MAAM,GAAC,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAkBzB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,aACN,MAAM,GAAC,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CA+DzB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAkDlD;IAED;;;;OAIG;IACH,+BAHW,KAAK,OAAC,WACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAO7B;IAED,2BAGC;IAED;;;;OAIG;IACH,oBAHW,KAAK,OAAC,cACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAK7B;CACF;;8BAprB6B,uBAAuB;2BAL1B,mBAAmB;6BAOjB,aAAa"}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RpcClient = void 0;
|
|
6
7
|
const remote_messages_1 = __importDefault(require("./remote-messages"));
|
|
7
8
|
const asyncbox_1 = require("asyncbox");
|
|
8
9
|
const logger_1 = __importDefault(require("../logger"));
|
|
@@ -118,7 +119,7 @@ class RpcClient {
|
|
|
118
119
|
/**
|
|
119
120
|
*
|
|
120
121
|
* @param {string} appIdKey
|
|
121
|
-
* @param {string} pageIdKey
|
|
122
|
+
* @param {string|number} pageIdKey
|
|
122
123
|
* @param {boolean} [force]
|
|
123
124
|
* @returns {Promise<void>}
|
|
124
125
|
*/
|
|
@@ -407,7 +408,7 @@ class RpcClient {
|
|
|
407
408
|
}
|
|
408
409
|
/**
|
|
409
410
|
* @param {string} appIdKey
|
|
410
|
-
* @param {string} pageIdKey
|
|
411
|
+
* @param {string|number} pageIdKey
|
|
411
412
|
* @returns {any}
|
|
412
413
|
*/
|
|
413
414
|
getTarget(appIdKey, pageIdKey) {
|
|
@@ -415,11 +416,11 @@ class RpcClient {
|
|
|
415
416
|
}
|
|
416
417
|
/**
|
|
417
418
|
* @param {string} appIdKey
|
|
418
|
-
* @param {string} pageIdKey
|
|
419
|
+
* @param {string|number} pageIdKey
|
|
419
420
|
* @returns {Promise<void>}
|
|
420
421
|
*/
|
|
421
422
|
async selectPage(appIdKey, pageIdKey) {
|
|
422
|
-
/** @type {[string, string]} */
|
|
423
|
+
/** @type {[string, string|number]} */
|
|
423
424
|
this.pendingTargetNotification = [appIdKey, pageIdKey];
|
|
424
425
|
this.shouldCheckForTarget = false;
|
|
425
426
|
// go through the steps that the Desktop Safari system
|
|
@@ -450,7 +451,7 @@ class RpcClient {
|
|
|
450
451
|
/**
|
|
451
452
|
* Perform the minimal initialization to get the Web Inspector working
|
|
452
453
|
* @param {string} appIdKey
|
|
453
|
-
* @param {string} pageIdKey
|
|
454
|
+
* @param {string|number} pageIdKey
|
|
454
455
|
* @returns {Promise<void>}
|
|
455
456
|
*/
|
|
456
457
|
async initializePage(appIdKey, pageIdKey) {
|
|
@@ -473,7 +474,7 @@ class RpcClient {
|
|
|
473
474
|
* Web Inspector session
|
|
474
475
|
*
|
|
475
476
|
* @param {string} appIdKey
|
|
476
|
-
* @param {string} pageIdKey
|
|
477
|
+
* @param {string|number} pageIdKey
|
|
477
478
|
* @returns {Promise<void>}
|
|
478
479
|
*/
|
|
479
480
|
async initializePageFull(appIdKey, pageIdKey) {
|
|
@@ -611,5 +612,6 @@ class RpcClient {
|
|
|
611
612
|
logger_1.default.debug(`Script parsed: ${JSON.stringify(scriptInfo)}`);
|
|
612
613
|
}
|
|
613
614
|
}
|
|
615
|
+
exports.RpcClient = RpcClient;
|
|
614
616
|
exports.default = RpcClient;
|
|
615
617
|
//# sourceMappingURL=rpc-client.js.map
|