easytouch-linux 1.0.7 → 1.0.18
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.txt +201 -0
- package/README.md +33 -314
- package/SKILL.md +366 -0
- package/bin/arm64/et +0 -0
- package/bin/et.js +60 -0
- package/bin/x64/et +0 -0
- package/package.json +19 -37
- package/.playwright/node/LICENSE +0 -2607
- package/.playwright/node/linux-x64/node +0 -0
- package/.playwright/package/README.md +0 -3
- package/.playwright/package/ThirdPartyNotices.txt +0 -1602
- package/.playwright/package/api.json +0 -1
- package/.playwright/package/bin/install_media_pack.ps1 +0 -5
- package/.playwright/package/bin/reinstall_chrome_beta_linux.sh +0 -42
- package/.playwright/package/bin/reinstall_chrome_beta_mac.sh +0 -13
- package/.playwright/package/bin/reinstall_chrome_beta_win.ps1 +0 -24
- package/.playwright/package/bin/reinstall_chrome_stable_linux.sh +0 -42
- package/.playwright/package/bin/reinstall_chrome_stable_mac.sh +0 -12
- package/.playwright/package/bin/reinstall_chrome_stable_win.ps1 +0 -24
- package/.playwright/package/bin/reinstall_msedge_beta_linux.sh +0 -48
- package/.playwright/package/bin/reinstall_msedge_beta_mac.sh +0 -11
- package/.playwright/package/bin/reinstall_msedge_beta_win.ps1 +0 -23
- package/.playwright/package/bin/reinstall_msedge_dev_linux.sh +0 -48
- package/.playwright/package/bin/reinstall_msedge_dev_mac.sh +0 -11
- package/.playwright/package/bin/reinstall_msedge_dev_win.ps1 +0 -23
- package/.playwright/package/bin/reinstall_msedge_stable_linux.sh +0 -48
- package/.playwright/package/bin/reinstall_msedge_stable_mac.sh +0 -11
- package/.playwright/package/bin/reinstall_msedge_stable_win.ps1 +0 -24
- package/.playwright/package/browsers.json +0 -66
- package/.playwright/package/cli.js +0 -18
- package/.playwright/package/index.d.ts +0 -17
- package/.playwright/package/index.js +0 -33
- package/.playwright/package/index.mjs +0 -28
- package/.playwright/package/lib/androidServerImpl.js +0 -69
- package/.playwright/package/lib/browserServerImpl.js +0 -92
- package/.playwright/package/lib/cli/driver.js +0 -95
- package/.playwright/package/lib/cli/program.js +0 -583
- package/.playwright/package/lib/cli/programWithTestStub.js +0 -67
- package/.playwright/package/lib/client/accessibility.js +0 -50
- package/.playwright/package/lib/client/android.js +0 -473
- package/.playwright/package/lib/client/api.js +0 -285
- package/.playwright/package/lib/client/artifact.js +0 -79
- package/.playwright/package/lib/client/browser.js +0 -145
- package/.playwright/package/lib/client/browserContext.js +0 -559
- package/.playwright/package/lib/client/browserType.js +0 -241
- package/.playwright/package/lib/client/cdpSession.js +0 -53
- package/.playwright/package/lib/client/channelOwner.js +0 -215
- package/.playwright/package/lib/client/clientHelper.js +0 -57
- package/.playwright/package/lib/client/clientInstrumentation.js +0 -52
- package/.playwright/package/lib/client/clock.js +0 -68
- package/.playwright/package/lib/client/connection.js +0 -333
- package/.playwright/package/lib/client/consoleMessage.js +0 -55
- package/.playwright/package/lib/client/coverage.js +0 -41
- package/.playwright/package/lib/client/dialog.js +0 -57
- package/.playwright/package/lib/client/download.js +0 -62
- package/.playwright/package/lib/client/electron.js +0 -135
- package/.playwright/package/lib/client/elementHandle.js +0 -321
- package/.playwright/package/lib/client/errors.js +0 -77
- package/.playwright/package/lib/client/eventEmitter.js +0 -314
- package/.playwright/package/lib/client/events.js +0 -94
- package/.playwright/package/lib/client/fetch.js +0 -391
- package/.playwright/package/lib/client/fileChooser.js +0 -45
- package/.playwright/package/lib/client/frame.js +0 -504
- package/.playwright/package/lib/client/harRouter.js +0 -99
- package/.playwright/package/lib/client/input.js +0 -111
- package/.playwright/package/lib/client/jsHandle.js +0 -121
- package/.playwright/package/lib/client/jsonPipe.js +0 -35
- package/.playwright/package/lib/client/localUtils.js +0 -36
- package/.playwright/package/lib/client/locator.js +0 -448
- package/.playwright/package/lib/client/network.js +0 -769
- package/.playwright/package/lib/client/page.js +0 -748
- package/.playwright/package/lib/client/playwright.js +0 -80
- package/.playwright/package/lib/client/selectors.js +0 -67
- package/.playwright/package/lib/client/stream.js +0 -54
- package/.playwright/package/lib/client/tracing.js +0 -147
- package/.playwright/package/lib/client/types.js +0 -24
- package/.playwright/package/lib/client/video.js +0 -51
- package/.playwright/package/lib/client/waiter.js +0 -162
- package/.playwright/package/lib/client/webError.js +0 -37
- package/.playwright/package/lib/client/worker.js +0 -71
- package/.playwright/package/lib/client/writableStream.js +0 -54
- package/.playwright/package/lib/common/socksProxy.js +0 -569
- package/.playwright/package/lib/common/timeoutSettings.js +0 -73
- package/.playwright/package/lib/common/types.js +0 -5
- package/.playwright/package/lib/generated/clockSource.js +0 -7
- package/.playwright/package/lib/generated/consoleApiSource.js +0 -7
- package/.playwright/package/lib/generated/injectedScriptSource.js +0 -7
- package/.playwright/package/lib/generated/pollingRecorderSource.js +0 -7
- package/.playwright/package/lib/generated/utilityScriptSource.js +0 -7
- package/.playwright/package/lib/generated/webSocketMockSource.js +0 -7
- package/.playwright/package/lib/image_tools/colorUtils.js +0 -98
- package/.playwright/package/lib/image_tools/compare.js +0 -108
- package/.playwright/package/lib/image_tools/imageChannel.js +0 -70
- package/.playwright/package/lib/image_tools/stats.js +0 -102
- package/.playwright/package/lib/inProcessFactory.js +0 -56
- package/.playwright/package/lib/inprocess.js +0 -20
- package/.playwright/package/lib/outofprocess.js +0 -67
- package/.playwright/package/lib/protocol/debug.js +0 -27
- package/.playwright/package/lib/protocol/serializers.js +0 -173
- package/.playwright/package/lib/protocol/transport.js +0 -82
- package/.playwright/package/lib/protocol/validator.js +0 -2780
- package/.playwright/package/lib/protocol/validatorPrimitives.js +0 -139
- package/.playwright/package/lib/remote/playwrightConnection.js +0 -275
- package/.playwright/package/lib/remote/playwrightServer.js +0 -111
- package/.playwright/package/lib/server/accessibility.js +0 -62
- package/.playwright/package/lib/server/android/android.js +0 -441
- package/.playwright/package/lib/server/android/backendAdb.js +0 -172
- package/.playwright/package/lib/server/artifact.js +0 -104
- package/.playwright/package/lib/server/bidi/bidiBrowser.js +0 -314
- package/.playwright/package/lib/server/bidi/bidiChromium.js +0 -124
- package/.playwright/package/lib/server/bidi/bidiConnection.js +0 -204
- package/.playwright/package/lib/server/bidi/bidiExecutionContext.js +0 -175
- package/.playwright/package/lib/server/bidi/bidiFirefox.js +0 -104
- package/.playwright/package/lib/server/bidi/bidiInput.js +0 -160
- package/.playwright/package/lib/server/bidi/bidiNetworkManager.js +0 -337
- package/.playwright/package/lib/server/bidi/bidiOverCdp.js +0 -103
- package/.playwright/package/lib/server/bidi/bidiPage.js +0 -518
- package/.playwright/package/lib/server/bidi/bidiPdf.js +0 -140
- package/.playwright/package/lib/server/bidi/third_party/bidiDeserializer.js +0 -93
- package/.playwright/package/lib/server/bidi/third_party/bidiKeyboard.js +0 -240
- package/.playwright/package/lib/server/bidi/third_party/bidiProtocol.js +0 -139
- package/.playwright/package/lib/server/bidi/third_party/bidiSerializer.js +0 -144
- package/.playwright/package/lib/server/bidi/third_party/firefoxPrefs.js +0 -221
- package/.playwright/package/lib/server/browser.js +0 -148
- package/.playwright/package/lib/server/browserContext.js +0 -675
- package/.playwright/package/lib/server/browserType.js +0 -338
- package/.playwright/package/lib/server/chromium/appIcon.png +0 -0
- package/.playwright/package/lib/server/chromium/chromium.js +0 -354
- package/.playwright/package/lib/server/chromium/chromiumSwitches.js +0 -46
- package/.playwright/package/lib/server/chromium/crAccessibility.js +0 -237
- package/.playwright/package/lib/server/chromium/crBrowser.js +0 -516
- package/.playwright/package/lib/server/chromium/crConnection.js +0 -228
- package/.playwright/package/lib/server/chromium/crCoverage.js +0 -246
- package/.playwright/package/lib/server/chromium/crDevTools.js +0 -104
- package/.playwright/package/lib/server/chromium/crDragDrop.js +0 -143
- package/.playwright/package/lib/server/chromium/crExecutionContext.js +0 -132
- package/.playwright/package/lib/server/chromium/crInput.js +0 -182
- package/.playwright/package/lib/server/chromium/crNetworkManager.js +0 -767
- package/.playwright/package/lib/server/chromium/crPage.js +0 -1122
- package/.playwright/package/lib/server/chromium/crPdf.js +0 -153
- package/.playwright/package/lib/server/chromium/crProtocolHelper.js +0 -133
- package/.playwright/package/lib/server/chromium/crServiceWorker.js +0 -112
- package/.playwright/package/lib/server/chromium/defaultFontFamilies.js +0 -145
- package/.playwright/package/lib/server/chromium/videoRecorder.js +0 -155
- package/.playwright/package/lib/server/clock.js +0 -125
- package/.playwright/package/lib/server/codegen/csharp.js +0 -304
- package/.playwright/package/lib/server/codegen/java.js +0 -243
- package/.playwright/package/lib/server/codegen/javascript.js +0 -253
- package/.playwright/package/lib/server/codegen/jsonl.js +0 -47
- package/.playwright/package/lib/server/codegen/language.js +0 -88
- package/.playwright/package/lib/server/codegen/languages.js +0 -30
- package/.playwright/package/lib/server/codegen/python.js +0 -262
- package/.playwright/package/lib/server/codegen/types.js +0 -5
- package/.playwright/package/lib/server/console.js +0 -57
- package/.playwright/package/lib/server/cookieStore.js +0 -185
- package/.playwright/package/lib/server/debugController.js +0 -212
- package/.playwright/package/lib/server/debugger.js +0 -132
- package/.playwright/package/lib/server/deviceDescriptors.js +0 -26
- package/.playwright/package/lib/server/deviceDescriptorsSource.json +0 -1669
- package/.playwright/package/lib/server/dialog.js +0 -71
- package/.playwright/package/lib/server/dispatchers/androidDispatcher.js +0 -204
- package/.playwright/package/lib/server/dispatchers/artifactDispatcher.js +0 -118
- package/.playwright/package/lib/server/dispatchers/browserContextDispatcher.js +0 -357
- package/.playwright/package/lib/server/dispatchers/browserDispatcher.js +0 -170
- package/.playwright/package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
- package/.playwright/package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -48
- package/.playwright/package/lib/server/dispatchers/debugControllerDispatcher.js +0 -105
- package/.playwright/package/lib/server/dispatchers/dialogDispatcher.js +0 -44
- package/.playwright/package/lib/server/dispatchers/dispatcher.js +0 -395
- package/.playwright/package/lib/server/dispatchers/electronDispatcher.js +0 -93
- package/.playwright/package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -228
- package/.playwright/package/lib/server/dispatchers/frameDispatcher.js +0 -294
- package/.playwright/package/lib/server/dispatchers/jsHandleDispatcher.js +0 -97
- package/.playwright/package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -59
- package/.playwright/package/lib/server/dispatchers/localUtilsDispatcher.js +0 -413
- package/.playwright/package/lib/server/dispatchers/networkDispatchers.js +0 -221
- package/.playwright/package/lib/server/dispatchers/pageDispatcher.js +0 -367
- package/.playwright/package/lib/server/dispatchers/playwrightDispatcher.js +0 -107
- package/.playwright/package/lib/server/dispatchers/selectorsDispatcher.js +0 -36
- package/.playwright/package/lib/server/dispatchers/streamDispatcher.js +0 -62
- package/.playwright/package/lib/server/dispatchers/tracingDispatcher.js +0 -64
- package/.playwright/package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -188
- package/.playwright/package/lib/server/dispatchers/writableStreamDispatcher.js +0 -58
- package/.playwright/package/lib/server/dom.js +0 -893
- package/.playwright/package/lib/server/download.js +0 -60
- package/.playwright/package/lib/server/electron/electron.js +0 -296
- package/.playwright/package/lib/server/electron/loader.js +0 -57
- package/.playwright/package/lib/server/errors.js +0 -68
- package/.playwright/package/lib/server/fetch.js +0 -663
- package/.playwright/package/lib/server/fileChooser.js +0 -42
- package/.playwright/package/lib/server/fileUploadUtils.js +0 -75
- package/.playwright/package/lib/server/firefox/ffAccessibility.js +0 -216
- package/.playwright/package/lib/server/firefox/ffBrowser.js +0 -462
- package/.playwright/package/lib/server/firefox/ffConnection.js +0 -168
- package/.playwright/package/lib/server/firefox/ffExecutionContext.js +0 -123
- package/.playwright/package/lib/server/firefox/ffInput.js +0 -161
- package/.playwright/package/lib/server/firefox/ffNetworkManager.js +0 -233
- package/.playwright/package/lib/server/firefox/ffPage.js +0 -544
- package/.playwright/package/lib/server/firefox/firefox.js +0 -99
- package/.playwright/package/lib/server/formData.js +0 -75
- package/.playwright/package/lib/server/frameSelectors.js +0 -171
- package/.playwright/package/lib/server/frames.js +0 -1663
- package/.playwright/package/lib/server/har/harRecorder.js +0 -139
- package/.playwright/package/lib/server/har/harTracer.js +0 -542
- package/.playwright/package/lib/server/helper.js +0 -103
- package/.playwright/package/lib/server/index.js +0 -108
- package/.playwright/package/lib/server/input.js +0 -309
- package/.playwright/package/lib/server/instrumentation.js +0 -70
- package/.playwright/package/lib/server/isomorphic/utilityScriptSerializers.js +0 -226
- package/.playwright/package/lib/server/javascript.js +0 -293
- package/.playwright/package/lib/server/launchApp.js +0 -91
- package/.playwright/package/lib/server/macEditingCommands.js +0 -139
- package/.playwright/package/lib/server/network.js +0 -617
- package/.playwright/package/lib/server/page.js +0 -863
- package/.playwright/package/lib/server/pipeTransport.js +0 -85
- package/.playwright/package/lib/server/playwright.js +0 -88
- package/.playwright/package/lib/server/progress.js +0 -99
- package/.playwright/package/lib/server/protocolError.js +0 -49
- package/.playwright/package/lib/server/recorder/chat.js +0 -177
- package/.playwright/package/lib/server/recorder/contextRecorder.js +0 -290
- package/.playwright/package/lib/server/recorder/recorderApp.js +0 -187
- package/.playwright/package/lib/server/recorder/recorderCollection.js +0 -104
- package/.playwright/package/lib/server/recorder/recorderFrontend.js +0 -5
- package/.playwright/package/lib/server/recorder/recorderRunner.js +0 -159
- package/.playwright/package/lib/server/recorder/recorderUtils.js +0 -89
- package/.playwright/package/lib/server/recorder/throttledFile.js +0 -46
- package/.playwright/package/lib/server/recorder.js +0 -367
- package/.playwright/package/lib/server/registry/browserFetcher.js +0 -168
- package/.playwright/package/lib/server/registry/dependencies.js +0 -322
- package/.playwright/package/lib/server/registry/index.js +0 -1165
- package/.playwright/package/lib/server/registry/nativeDeps.js +0 -496
- package/.playwright/package/lib/server/registry/oopDownloadBrowserMain.js +0 -138
- package/.playwright/package/lib/server/screenshotter.js +0 -348
- package/.playwright/package/lib/server/selectors.js +0 -73
- package/.playwright/package/lib/server/socksClientCertificatesInterceptor.js +0 -340
- package/.playwright/package/lib/server/socksInterceptor.js +0 -100
- package/.playwright/package/lib/server/trace/recorder/snapshotter.js +0 -161
- package/.playwright/package/lib/server/trace/recorder/snapshotterInjected.js +0 -518
- package/.playwright/package/lib/server/trace/recorder/tracing.js +0 -596
- package/.playwright/package/lib/server/trace/test/inMemorySnapshotter.js +0 -93
- package/.playwright/package/lib/server/trace/viewer/traceViewer.js +0 -219
- package/.playwright/package/lib/server/transport.js +0 -192
- package/.playwright/package/lib/server/types.js +0 -24
- package/.playwright/package/lib/server/usKeyboardLayout.js +0 -555
- package/.playwright/package/lib/server/webkit/webkit.js +0 -87
- package/.playwright/package/lib/server/webkit/wkAccessibility.js +0 -194
- package/.playwright/package/lib/server/webkit/wkBrowser.js +0 -329
- package/.playwright/package/lib/server/webkit/wkConnection.js +0 -173
- package/.playwright/package/lib/server/webkit/wkExecutionContext.js +0 -131
- package/.playwright/package/lib/server/webkit/wkInput.js +0 -179
- package/.playwright/package/lib/server/webkit/wkInterceptableRequest.js +0 -162
- package/.playwright/package/lib/server/webkit/wkPage.js +0 -1207
- package/.playwright/package/lib/server/webkit/wkProvisionalPage.js +0 -94
- package/.playwright/package/lib/server/webkit/wkWorkers.js +0 -104
- package/.playwright/package/lib/third_party/pixelmatch.js +0 -255
- package/.playwright/package/lib/utils/ascii.js +0 -31
- package/.playwright/package/lib/utils/comparators.js +0 -159
- package/.playwright/package/lib/utils/crypto.js +0 -171
- package/.playwright/package/lib/utils/debug.js +0 -46
- package/.playwright/package/lib/utils/debugLogger.js +0 -93
- package/.playwright/package/lib/utils/env.js +0 -49
- package/.playwright/package/lib/utils/eventsHelper.js +0 -38
- package/.playwright/package/lib/utils/expectUtils.js +0 -33
- package/.playwright/package/lib/utils/fileUtils.js +0 -205
- package/.playwright/package/lib/utils/happy-eyeballs.js +0 -194
- package/.playwright/package/lib/utils/headers.js +0 -52
- package/.playwright/package/lib/utils/hostPlatform.js +0 -145
- package/.playwright/package/lib/utils/httpServer.js +0 -233
- package/.playwright/package/lib/utils/index.js +0 -368
- package/.playwright/package/lib/utils/isomorphic/ariaSnapshot.js +0 -391
- package/.playwright/package/lib/utils/isomorphic/cssParser.js +0 -250
- package/.playwright/package/lib/utils/isomorphic/cssTokenizer.js +0 -979
- package/.playwright/package/lib/utils/isomorphic/locatorGenerators.js +0 -660
- package/.playwright/package/lib/utils/isomorphic/locatorParser.js +0 -185
- package/.playwright/package/lib/utils/isomorphic/locatorUtils.js +0 -62
- package/.playwright/package/lib/utils/isomorphic/mimeType.js +0 -29
- package/.playwright/package/lib/utils/isomorphic/selectorParser.js +0 -397
- package/.playwright/package/lib/utils/isomorphic/stringUtils.js +0 -169
- package/.playwright/package/lib/utils/isomorphic/traceUtils.js +0 -39
- package/.playwright/package/lib/utils/isomorphic/urlMatch.js +0 -122
- package/.playwright/package/lib/utils/linuxUtils.js +0 -78
- package/.playwright/package/lib/utils/manualPromise.js +0 -109
- package/.playwright/package/lib/utils/multimap.js +0 -75
- package/.playwright/package/lib/utils/network.js +0 -160
- package/.playwright/package/lib/utils/processLauncher.js +0 -248
- package/.playwright/package/lib/utils/profiler.js +0 -53
- package/.playwright/package/lib/utils/rtti.js +0 -44
- package/.playwright/package/lib/utils/semaphore.js +0 -51
- package/.playwright/package/lib/utils/sequence.js +0 -64
- package/.playwright/package/lib/utils/spawnAsync.js +0 -45
- package/.playwright/package/lib/utils/stackTrace.js +0 -134
- package/.playwright/package/lib/utils/task.js +0 -58
- package/.playwright/package/lib/utils/time.js +0 -37
- package/.playwright/package/lib/utils/timeoutRunner.js +0 -66
- package/.playwright/package/lib/utils/traceUtils.js +0 -44
- package/.playwright/package/lib/utils/userAgent.js +0 -105
- package/.playwright/package/lib/utils/wsServer.js +0 -128
- package/.playwright/package/lib/utils/zipFile.js +0 -75
- package/.playwright/package/lib/utils/zones.js +0 -69
- package/.playwright/package/lib/utilsBundle.js +0 -81
- package/.playwright/package/lib/utilsBundleImpl/index.js +0 -210
- package/.playwright/package/lib/utilsBundleImpl/xdg-open +0 -1066
- package/.playwright/package/lib/vite/htmlReport/index.html +0 -69
- package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
- package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-k-61wZCK.js +0 -24
- package/.playwright/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/.playwright/package/lib/vite/recorder/assets/index-B70BEW3b.js +0 -184
- package/.playwright/package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
- package/.playwright/package/lib/vite/recorder/index.html +0 -29
- package/.playwright/package/lib/vite/recorder/playwright-logo.svg +0 -9
- package/.playwright/package/lib/vite/traceViewer/assets/codeMirrorModule-CyuxU5C-.js +0 -24
- package/.playwright/package/lib/vite/traceViewer/assets/defaultSettingsView-5nVJRt0A.js +0 -243
- package/.playwright/package/lib/vite/traceViewer/assets/xtermModule-c-SNdYZy.js +0 -9
- package/.playwright/package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/.playwright/package/lib/vite/traceViewer/defaultSettingsView.2xeEXCXv.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/index.html +0 -43
- package/.playwright/package/lib/vite/traceViewer/index.qVn2ZnpC.js +0 -2
- package/.playwright/package/lib/vite/traceViewer/playwright-logo.svg +0 -9
- package/.playwright/package/lib/vite/traceViewer/snapshot.html +0 -21
- package/.playwright/package/lib/vite/traceViewer/sw.bundle.js +0 -3
- package/.playwright/package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/uiMode.html +0 -17
- package/.playwright/package/lib/vite/traceViewer/uiMode.m4IPRPOd.js +0 -5
- package/.playwright/package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
- package/.playwright/package/lib/zipBundle.js +0 -25
- package/.playwright/package/lib/zipBundleImpl.js +0 -5
- package/.playwright/package/package.json +0 -44
- package/.playwright/package/protocol.yml +0 -3758
- package/.playwright/package/types/protocol.d.ts +0 -21868
- package/.playwright/package/types/structs.d.ts +0 -45
- package/.playwright/package/types/types.d.ts +0 -22663
- package/et +0 -0
- package/install.js +0 -19
- package/playwright.ps1 +0 -7
- package/scripts/playwright-bridge.js +0 -560
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PipeTransport = void 0;
|
|
7
|
-
var _utils = require("../utils");
|
|
8
|
-
var _debugLogger = require("../utils/debugLogger");
|
|
9
|
-
/**
|
|
10
|
-
* Copyright 2018 Google Inc. All rights reserved.
|
|
11
|
-
* Modifications copyright (c) Microsoft Corporation.
|
|
12
|
-
*
|
|
13
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
-
* you may not use this file except in compliance with the License.
|
|
15
|
-
* You may obtain a copy of the License at
|
|
16
|
-
*
|
|
17
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
-
* See the License for the specific language governing permissions and
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
class PipeTransport {
|
|
27
|
-
constructor(pipeWrite, pipeRead) {
|
|
28
|
-
this._pipeRead = void 0;
|
|
29
|
-
this._pipeWrite = void 0;
|
|
30
|
-
this._pendingBuffers = [];
|
|
31
|
-
this._waitForNextTask = (0, _utils.makeWaitForNextTask)();
|
|
32
|
-
this._closed = false;
|
|
33
|
-
this._onclose = void 0;
|
|
34
|
-
this.onmessage = void 0;
|
|
35
|
-
this._pipeRead = pipeRead;
|
|
36
|
-
this._pipeWrite = pipeWrite;
|
|
37
|
-
pipeRead.on('data', buffer => this._dispatch(buffer));
|
|
38
|
-
pipeRead.on('close', () => {
|
|
39
|
-
this._closed = true;
|
|
40
|
-
if (this._onclose) this._onclose.call(null);
|
|
41
|
-
});
|
|
42
|
-
pipeRead.on('error', e => _debugLogger.debugLogger.log('error', e));
|
|
43
|
-
pipeWrite.on('error', e => _debugLogger.debugLogger.log('error', e));
|
|
44
|
-
this.onmessage = undefined;
|
|
45
|
-
}
|
|
46
|
-
get onclose() {
|
|
47
|
-
return this._onclose;
|
|
48
|
-
}
|
|
49
|
-
set onclose(onclose) {
|
|
50
|
-
this._onclose = onclose;
|
|
51
|
-
if (onclose && !this._pipeRead.readable) onclose();
|
|
52
|
-
}
|
|
53
|
-
send(message) {
|
|
54
|
-
if (this._closed) throw new Error('Pipe has been closed');
|
|
55
|
-
this._pipeWrite.write(JSON.stringify(message));
|
|
56
|
-
this._pipeWrite.write('\0');
|
|
57
|
-
}
|
|
58
|
-
close() {
|
|
59
|
-
throw new Error('unimplemented');
|
|
60
|
-
}
|
|
61
|
-
_dispatch(buffer) {
|
|
62
|
-
let end = buffer.indexOf('\0');
|
|
63
|
-
if (end === -1) {
|
|
64
|
-
this._pendingBuffers.push(buffer);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this._pendingBuffers.push(buffer.slice(0, end));
|
|
68
|
-
const message = Buffer.concat(this._pendingBuffers).toString();
|
|
69
|
-
this._waitForNextTask(() => {
|
|
70
|
-
if (this.onmessage) this.onmessage.call(null, JSON.parse(message));
|
|
71
|
-
});
|
|
72
|
-
let start = end + 1;
|
|
73
|
-
end = buffer.indexOf('\0', start);
|
|
74
|
-
while (end !== -1) {
|
|
75
|
-
const message = buffer.toString(undefined, start, end);
|
|
76
|
-
this._waitForNextTask(() => {
|
|
77
|
-
if (this.onmessage) this.onmessage.call(null, JSON.parse(message));
|
|
78
|
-
});
|
|
79
|
-
start = end + 1;
|
|
80
|
-
end = buffer.indexOf('\0', start);
|
|
81
|
-
}
|
|
82
|
-
this._pendingBuffers = [buffer.slice(start)];
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.PipeTransport = PipeTransport;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Playwright = void 0;
|
|
7
|
-
exports.createPlaywright = createPlaywright;
|
|
8
|
-
var _android = require("./android/android");
|
|
9
|
-
var _backendAdb = require("./android/backendAdb");
|
|
10
|
-
var _chromium = require("./chromium/chromium");
|
|
11
|
-
var _electron = require("./electron/electron");
|
|
12
|
-
var _firefox = require("./firefox/firefox");
|
|
13
|
-
var _selectors = require("./selectors");
|
|
14
|
-
var _webkit = require("./webkit/webkit");
|
|
15
|
-
var _instrumentation = require("./instrumentation");
|
|
16
|
-
var _utils = require("../utils");
|
|
17
|
-
var _debugController = require("./debugController");
|
|
18
|
-
var _bidiChromium = require("./bidi/bidiChromium");
|
|
19
|
-
var _bidiFirefox = require("./bidi/bidiFirefox");
|
|
20
|
-
/**
|
|
21
|
-
* Copyright (c) Microsoft Corporation.
|
|
22
|
-
*
|
|
23
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24
|
-
* you may not use this file except in compliance with the License.
|
|
25
|
-
* You may obtain a copy of the License at
|
|
26
|
-
*
|
|
27
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
-
*
|
|
29
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
-
* See the License for the specific language governing permissions and
|
|
33
|
-
* limitations under the License.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
class Playwright extends _instrumentation.SdkObject {
|
|
37
|
-
constructor(options) {
|
|
38
|
-
super({
|
|
39
|
-
attribution: {},
|
|
40
|
-
instrumentation: (0, _instrumentation.createInstrumentation)()
|
|
41
|
-
}, undefined, 'Playwright');
|
|
42
|
-
this.selectors = void 0;
|
|
43
|
-
this.chromium = void 0;
|
|
44
|
-
this.android = void 0;
|
|
45
|
-
this.electron = void 0;
|
|
46
|
-
this.firefox = void 0;
|
|
47
|
-
this.webkit = void 0;
|
|
48
|
-
this.bidiChromium = void 0;
|
|
49
|
-
this.bidiFirefox = void 0;
|
|
50
|
-
this.options = void 0;
|
|
51
|
-
this.debugController = void 0;
|
|
52
|
-
this._allPages = new Set();
|
|
53
|
-
this._allBrowsers = new Set();
|
|
54
|
-
this.options = options;
|
|
55
|
-
this.attribution.playwright = this;
|
|
56
|
-
this.instrumentation.addListener({
|
|
57
|
-
onBrowserOpen: browser => this._allBrowsers.add(browser),
|
|
58
|
-
onBrowserClose: browser => this._allBrowsers.delete(browser),
|
|
59
|
-
onPageOpen: page => this._allPages.add(page),
|
|
60
|
-
onPageClose: page => this._allPages.delete(page),
|
|
61
|
-
onCallLog: (sdkObject, metadata, logName, message) => {
|
|
62
|
-
_utils.debugLogger.log(logName, message);
|
|
63
|
-
}
|
|
64
|
-
}, null);
|
|
65
|
-
this.chromium = new _chromium.Chromium(this);
|
|
66
|
-
this.bidiChromium = new _bidiChromium.BidiChromium(this);
|
|
67
|
-
this.bidiFirefox = new _bidiFirefox.BidiFirefox(this);
|
|
68
|
-
this.firefox = new _firefox.Firefox(this);
|
|
69
|
-
this.webkit = new _webkit.WebKit(this);
|
|
70
|
-
this.electron = new _electron.Electron(this);
|
|
71
|
-
this.android = new _android.Android(this, new _backendAdb.AdbBackend());
|
|
72
|
-
this.selectors = new _selectors.Selectors();
|
|
73
|
-
this.debugController = new _debugController.DebugController(this);
|
|
74
|
-
}
|
|
75
|
-
async hideHighlight() {
|
|
76
|
-
await Promise.all([...this._allPages].map(p => p.hideHighlight().catch(() => {})));
|
|
77
|
-
}
|
|
78
|
-
allBrowsers() {
|
|
79
|
-
return [...this._allBrowsers];
|
|
80
|
-
}
|
|
81
|
-
allPages() {
|
|
82
|
-
return [...this._allPages];
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.Playwright = Playwright;
|
|
86
|
-
function createPlaywright(options) {
|
|
87
|
-
return new Playwright(options);
|
|
88
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ProgressController = void 0;
|
|
7
|
-
var _errors = require("./errors");
|
|
8
|
-
var _utils = require("../utils");
|
|
9
|
-
var _manualPromise = require("../utils/manualPromise");
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) Microsoft Corporation.
|
|
12
|
-
*
|
|
13
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
-
* you may not use this file except in compliance with the License.
|
|
15
|
-
* You may obtain a copy of the License at
|
|
16
|
-
*
|
|
17
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
-
* See the License for the specific language governing permissions and
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
class ProgressController {
|
|
27
|
-
constructor(metadata, sdkObject) {
|
|
28
|
-
this._forceAbortPromise = new _manualPromise.ManualPromise();
|
|
29
|
-
// Cleanups to be run only in the case of abort.
|
|
30
|
-
this._cleanups = [];
|
|
31
|
-
this._logName = 'api';
|
|
32
|
-
this._state = 'before';
|
|
33
|
-
this._deadline = 0;
|
|
34
|
-
this._timeout = 0;
|
|
35
|
-
this.metadata = void 0;
|
|
36
|
-
this.instrumentation = void 0;
|
|
37
|
-
this.sdkObject = void 0;
|
|
38
|
-
this.metadata = metadata;
|
|
39
|
-
this.sdkObject = sdkObject;
|
|
40
|
-
this.instrumentation = sdkObject.instrumentation;
|
|
41
|
-
this._forceAbortPromise.catch(e => null); // Prevent unhandled promise rejection.
|
|
42
|
-
}
|
|
43
|
-
setLogName(logName) {
|
|
44
|
-
this._logName = logName;
|
|
45
|
-
}
|
|
46
|
-
abort(error) {
|
|
47
|
-
this._forceAbortPromise.reject(error);
|
|
48
|
-
}
|
|
49
|
-
async run(task, timeout) {
|
|
50
|
-
var _this$sdkObject$attri;
|
|
51
|
-
if (timeout) {
|
|
52
|
-
this._timeout = timeout;
|
|
53
|
-
this._deadline = timeout ? (0, _utils.monotonicTime)() + timeout : 0;
|
|
54
|
-
}
|
|
55
|
-
(0, _utils.assert)(this._state === 'before');
|
|
56
|
-
this._state = 'running';
|
|
57
|
-
(_this$sdkObject$attri = this.sdkObject.attribution.context) === null || _this$sdkObject$attri === void 0 || _this$sdkObject$attri._activeProgressControllers.add(this);
|
|
58
|
-
const progress = {
|
|
59
|
-
log: message => {
|
|
60
|
-
if (this._state === 'running') this.metadata.log.push(message);
|
|
61
|
-
// Note: we might be sending logs after progress has finished, for example browser logs.
|
|
62
|
-
this.instrumentation.onCallLog(this.sdkObject, this.metadata, this._logName, message);
|
|
63
|
-
},
|
|
64
|
-
timeUntilDeadline: () => this._deadline ? this._deadline - (0, _utils.monotonicTime)() : 2147483647,
|
|
65
|
-
// 2^31-1 safe setTimeout in Node.
|
|
66
|
-
isRunning: () => this._state === 'running',
|
|
67
|
-
cleanupWhenAborted: cleanup => {
|
|
68
|
-
if (this._state === 'running') this._cleanups.push(cleanup);else runCleanup(cleanup);
|
|
69
|
-
},
|
|
70
|
-
throwIfAborted: () => {
|
|
71
|
-
if (this._state === 'aborted') throw new AbortedError();
|
|
72
|
-
},
|
|
73
|
-
metadata: this.metadata
|
|
74
|
-
};
|
|
75
|
-
const timeoutError = new _errors.TimeoutError(`Timeout ${this._timeout}ms exceeded.`);
|
|
76
|
-
const timer = setTimeout(() => this._forceAbortPromise.reject(timeoutError), progress.timeUntilDeadline());
|
|
77
|
-
try {
|
|
78
|
-
const promise = task(progress);
|
|
79
|
-
const result = await Promise.race([promise, this._forceAbortPromise]);
|
|
80
|
-
this._state = 'finished';
|
|
81
|
-
return result;
|
|
82
|
-
} catch (e) {
|
|
83
|
-
this._state = 'aborted';
|
|
84
|
-
await Promise.all(this._cleanups.splice(0).map(runCleanup));
|
|
85
|
-
throw e;
|
|
86
|
-
} finally {
|
|
87
|
-
var _this$sdkObject$attri2;
|
|
88
|
-
(_this$sdkObject$attri2 = this.sdkObject.attribution.context) === null || _this$sdkObject$attri2 === void 0 || _this$sdkObject$attri2._activeProgressControllers.delete(this);
|
|
89
|
-
clearTimeout(timer);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.ProgressController = ProgressController;
|
|
94
|
-
async function runCleanup(cleanup) {
|
|
95
|
-
try {
|
|
96
|
-
await cleanup();
|
|
97
|
-
} catch (e) {}
|
|
98
|
-
}
|
|
99
|
-
class AbortedError extends Error {}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ProtocolError = void 0;
|
|
7
|
-
exports.isProtocolError = isProtocolError;
|
|
8
|
-
exports.isSessionClosedError = isSessionClosedError;
|
|
9
|
-
var _stackTrace = require("../utils/stackTrace");
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) Microsoft Corporation.
|
|
12
|
-
*
|
|
13
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
-
* you may not use this file except in compliance with the License.
|
|
15
|
-
* You may obtain a copy of the License at
|
|
16
|
-
*
|
|
17
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
-
* See the License for the specific language governing permissions and
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
class ProtocolError extends Error {
|
|
27
|
-
constructor(type, method, logs) {
|
|
28
|
-
super();
|
|
29
|
-
this.type = void 0;
|
|
30
|
-
this.method = void 0;
|
|
31
|
-
this.logs = void 0;
|
|
32
|
-
this.type = type;
|
|
33
|
-
this.method = method;
|
|
34
|
-
this.logs = logs;
|
|
35
|
-
}
|
|
36
|
-
setMessage(message) {
|
|
37
|
-
(0, _stackTrace.rewriteErrorMessage)(this, `Protocol error (${this.method}): ${message}`);
|
|
38
|
-
}
|
|
39
|
-
browserLogMessage() {
|
|
40
|
-
return this.logs ? '\nBrowser logs:\n' + this.logs : '';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.ProtocolError = ProtocolError;
|
|
44
|
-
function isProtocolError(e) {
|
|
45
|
-
return e instanceof ProtocolError;
|
|
46
|
-
}
|
|
47
|
-
function isSessionClosedError(e) {
|
|
48
|
-
return e instanceof ProtocolError && (e.type === 'closed' || e.type === 'crashed');
|
|
49
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Chat = void 0;
|
|
7
|
-
exports.asString = asString;
|
|
8
|
-
var _transport = require("../transport");
|
|
9
|
-
/**
|
|
10
|
-
* Copyright (c) Microsoft Corporation.
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
class Chat {
|
|
26
|
-
constructor(wsEndpoint) {
|
|
27
|
-
this._history = [];
|
|
28
|
-
this._connectionPromise = void 0;
|
|
29
|
-
this._chatSinks = new Map();
|
|
30
|
-
this._wsEndpoint = void 0;
|
|
31
|
-
this._wsEndpoint = wsEndpoint;
|
|
32
|
-
}
|
|
33
|
-
clearHistory() {
|
|
34
|
-
this._history = [];
|
|
35
|
-
}
|
|
36
|
-
async post(prompt) {
|
|
37
|
-
await this._append('user', prompt);
|
|
38
|
-
let text = await asString(await this._post());
|
|
39
|
-
if (text.startsWith('```json') && text.endsWith('```')) text = text.substring('```json'.length, text.length - '```'.length);
|
|
40
|
-
for (let i = 0; i < 3; ++i) {
|
|
41
|
-
try {
|
|
42
|
-
return JSON.parse(text);
|
|
43
|
-
} catch (e) {
|
|
44
|
-
await this._append('user', String(e));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
throw new Error('Failed to parse response: ' + text);
|
|
48
|
-
}
|
|
49
|
-
async _append(user, content) {
|
|
50
|
-
this._history.push({
|
|
51
|
-
user,
|
|
52
|
-
content
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
async _connection() {
|
|
56
|
-
if (!this._connectionPromise) {
|
|
57
|
-
this._connectionPromise = _transport.WebSocketTransport.connect(undefined, this._wsEndpoint).then(transport => {
|
|
58
|
-
return new Connection(transport, (method, params) => this._dispatchEvent(method, params), () => {});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return this._connectionPromise;
|
|
62
|
-
}
|
|
63
|
-
_dispatchEvent(method, params) {
|
|
64
|
-
if (method === 'chatChunk') {
|
|
65
|
-
const {
|
|
66
|
-
chatId,
|
|
67
|
-
chunk
|
|
68
|
-
} = params;
|
|
69
|
-
const chunkSink = this._chatSinks.get(chatId);
|
|
70
|
-
chunkSink(chunk);
|
|
71
|
-
if (!chunk) this._chatSinks.delete(chatId);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async _post() {
|
|
75
|
-
const connection = await this._connection();
|
|
76
|
-
const result = await connection.send('chat', {
|
|
77
|
-
history: this._history
|
|
78
|
-
});
|
|
79
|
-
const {
|
|
80
|
-
chatId
|
|
81
|
-
} = result;
|
|
82
|
-
const {
|
|
83
|
-
iterable,
|
|
84
|
-
addChunk
|
|
85
|
-
} = iterablePump();
|
|
86
|
-
this._chatSinks.set(chatId, addChunk);
|
|
87
|
-
return iterable;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.Chat = Chat;
|
|
91
|
-
async function asString(stream) {
|
|
92
|
-
let result = '';
|
|
93
|
-
for await (const chunk of stream) result += chunk;
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
function iterablePump() {
|
|
97
|
-
let controller;
|
|
98
|
-
const stream = new ReadableStream({
|
|
99
|
-
start: c => controller = c
|
|
100
|
-
});
|
|
101
|
-
const iterable = async function* () {
|
|
102
|
-
const reader = stream.getReader();
|
|
103
|
-
while (true) {
|
|
104
|
-
const {
|
|
105
|
-
done,
|
|
106
|
-
value
|
|
107
|
-
} = await reader.read();
|
|
108
|
-
if (done) break;
|
|
109
|
-
yield value;
|
|
110
|
-
}
|
|
111
|
-
}();
|
|
112
|
-
return {
|
|
113
|
-
iterable,
|
|
114
|
-
addChunk: chunk => {
|
|
115
|
-
if (chunk) controller.enqueue(chunk);else controller.close();
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
class Connection {
|
|
120
|
-
constructor(transport, onEvent, onClose) {
|
|
121
|
-
this._transport = void 0;
|
|
122
|
-
this._lastId = 0;
|
|
123
|
-
this._closed = false;
|
|
124
|
-
this._pending = new Map();
|
|
125
|
-
this._onEvent = void 0;
|
|
126
|
-
this._onClose = void 0;
|
|
127
|
-
this._transport = transport;
|
|
128
|
-
this._onEvent = onEvent;
|
|
129
|
-
this._onClose = onClose;
|
|
130
|
-
this._transport.onmessage = this._dispatchMessage.bind(this);
|
|
131
|
-
this._transport.onclose = this._close.bind(this);
|
|
132
|
-
}
|
|
133
|
-
send(method, params) {
|
|
134
|
-
const id = this._lastId++;
|
|
135
|
-
const message = {
|
|
136
|
-
id,
|
|
137
|
-
method,
|
|
138
|
-
params
|
|
139
|
-
};
|
|
140
|
-
this._transport.send(message);
|
|
141
|
-
return new Promise((resolve, reject) => {
|
|
142
|
-
this._pending.set(id, {
|
|
143
|
-
resolve,
|
|
144
|
-
reject
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
_dispatchMessage(message) {
|
|
149
|
-
if (message.id === undefined) {
|
|
150
|
-
this._onEvent(message.method, message.params);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const callback = this._pending.get(message.id);
|
|
154
|
-
this._pending.delete(message.id);
|
|
155
|
-
if (!callback) return;
|
|
156
|
-
if (message.error) {
|
|
157
|
-
callback.reject(new Error(message.error.message));
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
callback.resolve(message.result);
|
|
161
|
-
}
|
|
162
|
-
_close() {
|
|
163
|
-
this._closed = true;
|
|
164
|
-
this._transport.onmessage = undefined;
|
|
165
|
-
this._transport.onclose = undefined;
|
|
166
|
-
for (const {
|
|
167
|
-
reject
|
|
168
|
-
} of this._pending.values()) reject(new Error('Connection closed'));
|
|
169
|
-
this._onClose();
|
|
170
|
-
}
|
|
171
|
-
isClosed() {
|
|
172
|
-
return this._closed;
|
|
173
|
-
}
|
|
174
|
-
close() {
|
|
175
|
-
if (!this._closed) this._transport.close();
|
|
176
|
-
}
|
|
177
|
-
}
|