octoparse-cli 0.1.14
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/README.md +271 -0
- package/RUNTIME_SECURITY_NOTICE.txt +41 -0
- package/SECURITY.md +24 -0
- package/dist/cli/args.js +34 -0
- package/dist/cli/help.js +214 -0
- package/dist/cli/output.js +39 -0
- package/dist/commands/auth.js +283 -0
- package/dist/commands/capabilities.js +118 -0
- package/dist/commands/cloud.js +241 -0
- package/dist/commands/data.js +220 -0
- package/dist/commands/doctor.js +73 -0
- package/dist/commands/env.js +63 -0
- package/dist/commands/local.js +251 -0
- package/dist/commands/run.js +622 -0
- package/dist/commands/runs.js +171 -0
- package/dist/commands/task.js +101 -0
- package/dist/index.js +133 -0
- package/dist/runtime/account-capabilities.js +71 -0
- package/dist/runtime/api-client.js +290 -0
- package/dist/runtime/artifacts.js +33 -0
- package/dist/runtime/auth.js +94 -0
- package/dist/runtime/bridge-hub.js +173 -0
- package/dist/runtime/client-headers.js +23 -0
- package/dist/runtime/cloud-data.js +75 -0
- package/dist/runtime/config.js +48 -0
- package/dist/runtime/data-exporter.js +267 -0
- package/dist/runtime/engine-host.js +449 -0
- package/dist/runtime/local-runs.js +92 -0
- package/dist/runtime/naming.js +13 -0
- package/dist/runtime/run-control.js +363 -0
- package/dist/runtime/run-services.js +380 -0
- package/dist/runtime/security-notice.js +78 -0
- package/dist/runtime/task-definition-provider.js +282 -0
- package/dist/types.js +4 -0
- package/examples/minimal-task.json +6 -0
- package/examples/navigate-example-task.json +6 -0
- package/node_modules/@octopus/bpmn/index.js +3 -0
- package/node_modules/@octopus/bpmn/lib/Context.js +245 -0
- package/node_modules/@octopus/bpmn/lib/Definition.js +258 -0
- package/node_modules/@octopus/bpmn/lib/Engine.js +275 -0
- package/node_modules/@octopus/bpmn/lib/PrematureStopError.js +7 -0
- package/node_modules/@octopus/bpmn/lib/activities/Activity.js +202 -0
- package/node_modules/@octopus/bpmn/lib/activities/BaseProcess.js +308 -0
- package/node_modules/@octopus/bpmn/lib/activities/BaseTask.js +145 -0
- package/node_modules/@octopus/bpmn/lib/activities/BoundaryEvent.js +12 -0
- package/node_modules/@octopus/bpmn/lib/activities/Dummy.js +10 -0
- package/node_modules/@octopus/bpmn/lib/activities/EventDefinition.js +99 -0
- package/node_modules/@octopus/bpmn/lib/activities/Flow.js +52 -0
- package/node_modules/@octopus/bpmn/lib/activities/Form.js +67 -0
- package/node_modules/@octopus/bpmn/lib/activities/InputOutput.js +53 -0
- package/node_modules/@octopus/bpmn/lib/activities/IntermediateCatchEvent.js +12 -0
- package/node_modules/@octopus/bpmn/lib/activities/MessageFlow.js +19 -0
- package/node_modules/@octopus/bpmn/lib/activities/MultiInstanceLoopCharacteristics.js +160 -0
- package/node_modules/@octopus/bpmn/lib/activities/Properties.js +27 -0
- package/node_modules/@octopus/bpmn/lib/activities/SequenceFlow.js +56 -0
- package/node_modules/@octopus/bpmn/lib/activities/ServiceConnector.js +71 -0
- package/node_modules/@octopus/bpmn/lib/context-helper.js +198 -0
- package/node_modules/@octopus/bpmn/lib/events/EndEvent.js +22 -0
- package/node_modules/@octopus/bpmn/lib/events/ErrorEvent.js +41 -0
- package/node_modules/@octopus/bpmn/lib/events/MessageEvent.js +19 -0
- package/node_modules/@octopus/bpmn/lib/events/StartEvent.js +55 -0
- package/node_modules/@octopus/bpmn/lib/events/TimerEvent.js +75 -0
- package/node_modules/@octopus/bpmn/lib/expressions.js +41 -0
- package/node_modules/@octopus/bpmn/lib/gateways/ExclusiveGateway.js +86 -0
- package/node_modules/@octopus/bpmn/lib/gateways/InclusiveGateway.js +56 -0
- package/node_modules/@octopus/bpmn/lib/gateways/ParallelGateway.js +195 -0
- package/node_modules/@octopus/bpmn/lib/getPropertyValue.js +83 -0
- package/node_modules/@octopus/bpmn/lib/index.js +6 -0
- package/node_modules/@octopus/bpmn/lib/mapper.js +55 -0
- package/node_modules/@octopus/bpmn/lib/parameter.js +119 -0
- package/node_modules/@octopus/bpmn/lib/script-helper.js +45 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ManualTask.js +31 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ReceiveTask.js +31 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ScriptTask.js +35 -0
- package/node_modules/@octopus/bpmn/lib/tasks/SendTask.js +16 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ServiceTask.js +68 -0
- package/node_modules/@octopus/bpmn/lib/tasks/SubProcess.js +17 -0
- package/node_modules/@octopus/bpmn/lib/tasks/Task.js +16 -0
- package/node_modules/@octopus/bpmn/lib/tasks/UserTask.js +47 -0
- package/node_modules/@octopus/bpmn/lib/transformer.js +13 -0
- package/node_modules/@octopus/bpmn/lib/validation.js +111 -0
- package/node_modules/@octopus/bpmn/package.json +17 -0
- package/node_modules/@octopus/bpmn/types/bpmn.d.ts +85 -0
- package/node_modules/@octopus/engine/README.md +370 -0
- package/node_modules/@octopus/engine/dist/actions/BackPreWebPageAction.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/actions/BackPreWebPageAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/BaseAction.d.ts +339 -0
- package/node_modules/@octopus/engine/dist/actions/BaseAction.js +1559 -0
- package/node_modules/@octopus/engine/dist/actions/BranchAction.d.ts +9 -0
- package/node_modules/@octopus/engine/dist/actions/BranchAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/ClickAction.d.ts +22 -0
- package/node_modules/@octopus/engine/dist/actions/ClickAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/ConditionAction.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/actions/ConditionAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/EmptyAction.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/actions/EmptyAction.js +12 -0
- package/node_modules/@octopus/engine/dist/actions/EnterCaptchaAction.d.ts +28 -0
- package/node_modules/@octopus/engine/dist/actions/EnterCaptchaAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/EnterTextAction.d.ts +20 -0
- package/node_modules/@octopus/engine/dist/actions/EnterTextAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/ExtractDataAction.d.ts +40 -0
- package/node_modules/@octopus/engine/dist/actions/ExtractDataAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/LoopAction.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/actions/LoopAction.js +526 -0
- package/node_modules/@octopus/engine/dist/actions/LoopStartAction.d.ts +47 -0
- package/node_modules/@octopus/engine/dist/actions/LoopStartAction.js +607 -0
- package/node_modules/@octopus/engine/dist/actions/MouseOverAction.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/actions/MouseOverAction.js +34 -0
- package/node_modules/@octopus/engine/dist/actions/NavigateAction.d.ts +38 -0
- package/node_modules/@octopus/engine/dist/actions/NavigateAction.js +535 -0
- package/node_modules/@octopus/engine/dist/actions/SwitchComboAction.d.ts +13 -0
- package/node_modules/@octopus/engine/dist/actions/SwitchComboAction.js +69 -0
- package/node_modules/@octopus/engine/dist/browser.d.ts +17 -0
- package/node_modules/@octopus/engine/dist/browser.js +157 -0
- package/node_modules/@octopus/engine/dist/browserProxy.d.ts +90 -0
- package/node_modules/@octopus/engine/dist/browserProxy.js +1 -0
- package/node_modules/@octopus/engine/dist/configs/BaseConfig.d.ts +20 -0
- package/node_modules/@octopus/engine/dist/configs/BaseConfig.js +88 -0
- package/node_modules/@octopus/engine/dist/configs/BranchConfig.d.ts +7 -0
- package/node_modules/@octopus/engine/dist/configs/BranchConfig.js +1 -0
- package/node_modules/@octopus/engine/dist/configs/ClickConfig.d.ts +36 -0
- package/node_modules/@octopus/engine/dist/configs/ClickConfig.js +65 -0
- package/node_modules/@octopus/engine/dist/configs/EnterCaptchaConfig.d.ts +19 -0
- package/node_modules/@octopus/engine/dist/configs/EnterCaptchaConfig.js +25 -0
- package/node_modules/@octopus/engine/dist/configs/EnterTextConfig.d.ts +24 -0
- package/node_modules/@octopus/engine/dist/configs/EnterTextConfig.js +36 -0
- package/node_modules/@octopus/engine/dist/configs/ExtractDataConfig.d.ts +12 -0
- package/node_modules/@octopus/engine/dist/configs/ExtractDataConfig.js +1 -0
- package/node_modules/@octopus/engine/dist/configs/LoopConfig.d.ts +25 -0
- package/node_modules/@octopus/engine/dist/configs/LoopConfig.js +40 -0
- package/node_modules/@octopus/engine/dist/configs/LoopStartConfig.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/configs/LoopStartConfig.js +12 -0
- package/node_modules/@octopus/engine/dist/configs/MouseOverConfig.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/configs/MouseOverConfig.js +15 -0
- package/node_modules/@octopus/engine/dist/configs/NavigateConfig.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/configs/NavigateConfig.js +121 -0
- package/node_modules/@octopus/engine/dist/configs/SwitchComboConfig.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/configs/SwitchComboConfig.js +15 -0
- package/node_modules/@octopus/engine/dist/enums/index.d.ts +419 -0
- package/node_modules/@octopus/engine/dist/enums/index.js +314 -0
- package/node_modules/@octopus/engine/dist/extension/BrowserWebSocketTransport-D_zAGZMQ.js +1 -0
- package/node_modules/@octopus/engine/dist/extension/LaunchOptions-DxvePrV4.js +6 -0
- package/node_modules/@octopus/engine/dist/extension/NodeWebSocketTransport-BTgRVB7Z.js +6 -0
- package/node_modules/@octopus/engine/dist/extension/background.js +396 -0
- package/node_modules/@octopus/engine/dist/extension/bidi-C_GIZ8Uz.js +131 -0
- package/node_modules/@octopus/engine/dist/extension/manifest.json +27 -0
- package/node_modules/@octopus/engine/dist/extension/src/content/anti-detection.js +1 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/BaseExtensionBridge.d.ts +21 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/BaseExtensionBridge.js +117 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/SessionExtensionBridge.d.ts +17 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/SessionExtensionBridge.js +29 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/index.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/index.js +5 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/types.d.ts +159 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/types.js +5 -0
- package/node_modules/@octopus/engine/dist/extensions/ublock-origin/uBlock0.chromium.tar.xz +0 -0
- package/node_modules/@octopus/engine/dist/extensions/ublock-origin-lite/uBOLite.chromium.tar.xz +0 -0
- package/node_modules/@octopus/engine/dist/index.d.ts +169 -0
- package/node_modules/@octopus/engine/dist/index.js +1 -0
- package/node_modules/@octopus/engine/dist/models/actionItem.d.ts +16 -0
- package/node_modules/@octopus/engine/dist/models/actionItem.js +15 -0
- package/node_modules/@octopus/engine/dist/models/conditionCheckArgs.d.ts +11 -0
- package/node_modules/@octopus/engine/dist/models/conditionCheckArgs.js +11 -0
- package/node_modules/@octopus/engine/dist/models/customizeCookie.d.ts +14 -0
- package/node_modules/@octopus/engine/dist/models/customizeCookie.js +6 -0
- package/node_modules/@octopus/engine/dist/models/downloadFileConfig.d.ts +17 -0
- package/node_modules/@octopus/engine/dist/models/downloadFileConfig.js +26 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundArgs.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundArgs.js +12 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundError.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundError.js +6 -0
- package/node_modules/@octopus/engine/dist/models/extractItem.d.ts +37 -0
- package/node_modules/@octopus/engine/dist/models/extractItem.js +35 -0
- package/node_modules/@octopus/engine/dist/models/extractTemplate.d.ts +11 -0
- package/node_modules/@octopus/engine/dist/models/extractTemplate.js +48 -0
- package/node_modules/@octopus/engine/dist/models/extractTextItem.d.ts +10 -0
- package/node_modules/@octopus/engine/dist/models/extractTextItem.js +17 -0
- package/node_modules/@octopus/engine/dist/models/globalConfig.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/models/globalConfig.js +1 -0
- package/node_modules/@octopus/engine/dist/models/httpHeader.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/models/httpHeader.js +10 -0
- package/node_modules/@octopus/engine/dist/models/operation.d.ts +27 -0
- package/node_modules/@octopus/engine/dist/models/operation.js +242 -0
- package/node_modules/@octopus/engine/dist/models/retryCondition.d.ts +7 -0
- package/node_modules/@octopus/engine/dist/models/retryCondition.js +10 -0
- package/node_modules/@octopus/engine/dist/models/task.d.ts +89 -0
- package/node_modules/@octopus/engine/dist/models/task.js +120 -0
- package/node_modules/@octopus/engine/dist/models/trigger.d.ts +66 -0
- package/node_modules/@octopus/engine/dist/models/trigger.js +117 -0
- package/node_modules/@octopus/engine/dist/package.json +26 -0
- package/node_modules/@octopus/engine/dist/public-types.d.ts +13 -0
- package/node_modules/@octopus/engine/dist/public-types.js +2 -0
- package/node_modules/@octopus/engine/dist/settings.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/settings.js +20 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ClickCaptchaSolver.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ClickCaptchaSolver.js +1 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/HCaptchaSolver.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/HCaptchaSolver.js +73 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ImageCaptchaSolver.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ImageCaptchaSolver.js +74 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/RecaptchaSolver.d.ts +9 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/RecaptchaSolver.js +371 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SliderCaptchaSolver.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SliderCaptchaSolver.js +184 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SlidingTrajectory.d.ts +50 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SlidingTrajectory.js +125 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/types.d.ts +68 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/types.js +34 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/utils.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/utils.js +15 -0
- package/node_modules/@octopus/engine/dist/translator/actionFactory.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/translator/actionFactory.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/activityTypeEnum.d.ts +22 -0
- package/node_modules/@octopus/engine/dist/translator/activityTypeEnum.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/backPreWebPageAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/backPreWebPageAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/baseAction.d.ts +31 -0
- package/node_modules/@octopus/engine/dist/translator/baseAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/breakActivity.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/breakActivity.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/clickAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/clickAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/completeWF.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/completeWF.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/conditionAction.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/translator/conditionAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/emptyAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/emptyAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/enterCapachaAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/enterCapachaAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/enterTextAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/enterTextAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/extractDataAction.d.ts +13 -0
- package/node_modules/@octopus/engine/dist/translator/extractDataAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/loopAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/loopAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/mouseOverAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/mouseOverAction.js +19 -0
- package/node_modules/@octopus/engine/dist/translator/navigateAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/navigateAction.js +117 -0
- package/node_modules/@octopus/engine/dist/translator/rootAction.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/translator/rootAction.js +80 -0
- package/node_modules/@octopus/engine/dist/translator/switchCombo2Action.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/switchCombo2Action.js +19 -0
- package/node_modules/@octopus/engine/dist/translator/translator.d.ts +1 -0
- package/node_modules/@octopus/engine/dist/translator/translator.js +36 -0
- package/node_modules/@octopus/engine/dist/type.d.ts +25 -0
- package/node_modules/@octopus/engine/dist/type.js +2 -0
- package/node_modules/@octopus/engine/dist/types/browser.d.ts +191 -0
- package/node_modules/@octopus/engine/dist/types/browser.js +1 -0
- package/node_modules/@octopus/engine/dist/types/browserManager.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/types/browserManager.js +1 -0
- package/node_modules/@octopus/engine/dist/types/index.d.ts +40 -0
- package/node_modules/@octopus/engine/dist/types/index.js +2 -0
- package/node_modules/@octopus/engine/dist/types/plugin.d.ts +29 -0
- package/node_modules/@octopus/engine/dist/types/plugin.js +2 -0
- package/node_modules/@octopus/engine/dist/utils/AsyncEmitter.d.ts +15 -0
- package/node_modules/@octopus/engine/dist/utils/AsyncEmitter.js +1 -0
- package/node_modules/@octopus/engine/dist/utils/DataStore.d.ts +58 -0
- package/node_modules/@octopus/engine/dist/utils/DataStore.js +1 -0
- package/node_modules/@octopus/engine/dist/utils/DateTimeFormatHelper.d.ts +22 -0
- package/node_modules/@octopus/engine/dist/utils/DateTimeFormatHelper.js +173 -0
- package/node_modules/@octopus/engine/dist/utils/FileDownloader.d.ts +108 -0
- package/node_modules/@octopus/engine/dist/utils/FileDownloader.js +1 -0
- package/node_modules/@octopus/engine/dist/utils/HttpRequester.d.ts +43 -0
- package/node_modules/@octopus/engine/dist/utils/HttpRequester.js +174 -0
- package/node_modules/@octopus/engine/dist/utils/JsonParser.d.ts +95 -0
- package/node_modules/@octopus/engine/dist/utils/JsonParser.js +439 -0
- package/node_modules/@octopus/engine/dist/utils/Operations.d.ts +27 -0
- package/node_modules/@octopus/engine/dist/utils/Operations.js +115 -0
- package/node_modules/@octopus/engine/dist/utils/index.d.ts +28 -0
- package/node_modules/@octopus/engine/dist/utils/index.js +356 -0
- package/node_modules/@octopus/engine/package.json +58 -0
- package/package.json +79 -0
- package/schemas/capabilities-v1.schema.json +234 -0
- package/schemas/detached-bootstrap-v1.schema.json +42 -0
- package/schemas/json-envelope-v1.schema.json +39 -0
- package/schemas/run-event-v1.schema.json +47 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"name": "Workflow Automation Bridge",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Bridges workflow automation commands from Node.js to page via Puppeteer ExtensionTransport",
|
|
6
|
+
"permissions": [
|
|
7
|
+
"tabs",
|
|
8
|
+
"debugger",
|
|
9
|
+
"scripting",
|
|
10
|
+
"webNavigation",
|
|
11
|
+
"alarms"
|
|
12
|
+
],
|
|
13
|
+
"host_permissions": ["<all_urls>"],
|
|
14
|
+
"background": {
|
|
15
|
+
"service_worker": "background.js",
|
|
16
|
+
"type": "module"
|
|
17
|
+
},
|
|
18
|
+
"content_scripts": [
|
|
19
|
+
{
|
|
20
|
+
"matches": ["<all_urls>"],
|
|
21
|
+
"js": ["src/content/anti-detection.js"],
|
|
22
|
+
"run_at": "document_start",
|
|
23
|
+
"all_frames": true,
|
|
24
|
+
"world": "MAIN"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
;(function(){try{const _0x13a4f1=(_0x519489,_0x5da78)=>{const _0x2bd871='function\x20'+_0x5da78+'()\x20{\x20[native\x20code]\x20}';return Object['defineProperty'](_0x519489,'toString',{'value':function(){return _0x2bd871;},'configurable':!![],'writable':!![]}),Object['defineProperty'](_0x519489['toString'],'toString',{'value':function(){return'function\x20toString()\x20{\x20[native\x20code]\x20}';},'configurable':!![],'writable':!![]}),_0x519489['prototype']&&Object['defineProperty'](_0x519489['prototype']['constructor'],'toString',{'value':function(){return _0x2bd871;},'configurable':!![],'writable':!![]}),_0x519489;};navigator['webdriver']&&Object['defineProperty'](navigator,'webdriver',{'get':()=>![]});const _0x404fb2=/cdc_[a-zA-Z0-9]+/;for(const _0x3b8910 in window){_0x404fb2['test'](_0x3b8910)&&delete window[_0x3b8910];};['$cdc_asdjflasutopfhvcZLmcfl_','$chrome_asyncScriptInfo','callPhantom','webdriver']['forEach'](_0x4f7de1=>{if(window[_0x4f7de1])delete window[_0x4f7de1];}),Object['defineProperty'](window,'chrome',{'writable':!![],'enumerable':!![],'configurable':![],'value':{'app':{'isInstalled':![],'InstallState':{'DISABLED':'disabled','INSTALLED':'installed','NOT_INSTALLED':'not_installed'},'RunningState':{'CANNOT_RUN':'cannot_run','READY_TO_RUN':'ready_to_run','RUNNING':'running'}},'runtime':{'OnInstalledReason':{'CHROME_UPDATE':'chrome_update','INSTALL':'install','SHARED_MODULE_UPDATE':'shared_module_update','UPDATE':'update'},'OnRestartRequiredReason':{'APP_UPDATE':'app_update','OS_UPDATE':'os_update','PERIODIC':'periodic'},'PlatformArch':{'ARM':'arm','ARM64':'arm64','MIPS':'mips','MIPS64':'mips64','X86_32':'x86-32','X86_64':'x86-64'},'PlatformNaclArch':{'ARM':'arm','MIPS':'mips','X86_32':'x86-32','X86_64':'x86-64'},'PlatformOs':{'ANDROID':'android','CROS':'cros','LINUX':'linux','MAC':'mac','OPENBSD':'openbsd','WIN':'win'},'RequestUpdateCheckStatus':{'NO_UPDATE':'no_update','THROTTLED':'throttled','UPDATE_AVAILABLE':'update_available'}}}});const _0x3b7525=window['RTCPeerConnection'],_0x4ce851=function _0x110916(_0x53dc7f){if(!_0x53dc7f)_0x53dc7f={};return _0x53dc7f['iceTransportPolicy']='relay',new _0x3b7525(_0x53dc7f);};_0x4ce851['prototype']=_0x3b7525['prototype'],window['RTCPeerConnection']=_0x13a4f1(_0x4ce851,'RTCPeerConnection');}catch(_0x4c3ca2){console['error']('Injection\x20Error',_0x4c3ca2);}}());
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ActionCommandEnvelope, Command, CommandResponse, DistributiveOmit, ExtensionBridgeLike, ExtensionEvent, ExtensionRuntimeConfig } from './types.js';
|
|
2
|
+
export declare abstract class BaseExtensionBridge implements ExtensionBridgeLike {
|
|
3
|
+
runtimeConfig: ExtensionRuntimeConfig;
|
|
4
|
+
/** 等待响应的指令,key = command id */
|
|
5
|
+
private pending;
|
|
6
|
+
/** URL(去 hash)→ tabId */
|
|
7
|
+
private tabRegistry;
|
|
8
|
+
/** tabId → URL(去 hash) */
|
|
9
|
+
private tabUrlRegistry;
|
|
10
|
+
private connected;
|
|
11
|
+
constructor(runtimeConfig: ExtensionRuntimeConfig);
|
|
12
|
+
protected abstract dispatchCommand(message: Command): void;
|
|
13
|
+
protected setConnected(connected: boolean): void;
|
|
14
|
+
handleIncoming(msg: CommandResponse | ExtensionEvent): void;
|
|
15
|
+
private rejectAllPending;
|
|
16
|
+
sendActionCommand(cmd: DistributiveOmit<ActionCommandEnvelope, 'id'>): Promise<CommandResponse>;
|
|
17
|
+
resolveTabId(pageUrl: string): number | undefined;
|
|
18
|
+
getTabUrl(tabId: number): string | undefined;
|
|
19
|
+
get isConnected(): boolean;
|
|
20
|
+
close(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseExtensionBridge = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const COMMAND_TIMEOUT = 15000;
|
|
6
|
+
class BaseExtensionBridge {
|
|
7
|
+
constructor(runtimeConfig) {
|
|
8
|
+
/** 等待响应的指令,key = command id */
|
|
9
|
+
this.pending = new Map();
|
|
10
|
+
/** URL(去 hash)→ tabId */
|
|
11
|
+
this.tabRegistry = new Map();
|
|
12
|
+
/** tabId → URL(去 hash) */
|
|
13
|
+
this.tabUrlRegistry = new Map();
|
|
14
|
+
this.connected = false;
|
|
15
|
+
this.runtimeConfig = runtimeConfig;
|
|
16
|
+
}
|
|
17
|
+
setConnected(connected) {
|
|
18
|
+
this.connected = connected;
|
|
19
|
+
if (!connected) {
|
|
20
|
+
this.rejectAllPending('[ExtensionBridge] Extension disconnected');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
handleIncoming(msg) {
|
|
24
|
+
if ('type' in msg) {
|
|
25
|
+
const evt = msg;
|
|
26
|
+
if (evt.type === 'tab-ready' || evt.type === 'tab-navigated') {
|
|
27
|
+
if (evt.type === 'tab-navigated') {
|
|
28
|
+
for (const [url, tabId] of this.tabRegistry) {
|
|
29
|
+
if (tabId === evt.tabId)
|
|
30
|
+
this.tabRegistry.delete(url);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const key = evt.url.split('#')[0];
|
|
34
|
+
this.tabRegistry.set(key, evt.tabId);
|
|
35
|
+
this.tabUrlRegistry.set(evt.tabId, key);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (evt.type === 'tab-removed') {
|
|
39
|
+
for (const [url, tabId] of this.tabRegistry) {
|
|
40
|
+
if (tabId === evt.tabId)
|
|
41
|
+
this.tabRegistry.delete(url);
|
|
42
|
+
}
|
|
43
|
+
this.tabUrlRegistry.delete(evt.tabId);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const res = msg;
|
|
48
|
+
const pendingItem = this.pending.get(res.id);
|
|
49
|
+
if (!pendingItem)
|
|
50
|
+
return;
|
|
51
|
+
clearTimeout(pendingItem.timer);
|
|
52
|
+
this.pending.delete(res.id);
|
|
53
|
+
if (res.success) {
|
|
54
|
+
pendingItem.resolve(res);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
pendingItem.reject(new Error(res.error));
|
|
58
|
+
}
|
|
59
|
+
rejectAllPending(message) {
|
|
60
|
+
for (const [id, pendingItem] of this.pending) {
|
|
61
|
+
clearTimeout(pendingItem.timer);
|
|
62
|
+
pendingItem.reject(new Error(message));
|
|
63
|
+
this.pending.delete(id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
sendActionCommand(cmd) {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
if (!this.isConnected) {
|
|
69
|
+
reject(new Error('[ExtensionBridge] No extension connected'));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const id = (0, crypto_1.randomUUID)();
|
|
73
|
+
const timer = setTimeout(() => {
|
|
74
|
+
this.pending.delete(id);
|
|
75
|
+
reject(new Error(`[ExtensionBridge] Command timeout: ${cmd.action}`));
|
|
76
|
+
}, COMMAND_TIMEOUT);
|
|
77
|
+
this.pending.set(id, { resolve, reject, timer });
|
|
78
|
+
this.dispatchCommand({ ...cmd, id });
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
resolveTabId(pageUrl) {
|
|
82
|
+
const exact = this.tabRegistry.get(pageUrl);
|
|
83
|
+
if (exact !== undefined)
|
|
84
|
+
return exact;
|
|
85
|
+
const noHash = pageUrl.split('#')[0];
|
|
86
|
+
const noHashMatch = this.tabRegistry.get(noHash);
|
|
87
|
+
if (noHashMatch !== undefined)
|
|
88
|
+
return noHashMatch;
|
|
89
|
+
try {
|
|
90
|
+
const targetPath = new URL(pageUrl).origin + new URL(pageUrl).pathname;
|
|
91
|
+
for (const [url, tabId] of this.tabRegistry) {
|
|
92
|
+
try {
|
|
93
|
+
const registeredPath = new URL(url).origin + new URL(url).pathname;
|
|
94
|
+
if (registeredPath === targetPath)
|
|
95
|
+
return tabId;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// ignore invalid registered URL
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// ignore invalid page URL
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
getTabUrl(tabId) {
|
|
108
|
+
return this.tabUrlRegistry.get(tabId);
|
|
109
|
+
}
|
|
110
|
+
get isConnected() {
|
|
111
|
+
return this.connected;
|
|
112
|
+
}
|
|
113
|
+
close() {
|
|
114
|
+
this.setConnected(false);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.BaseExtensionBridge = BaseExtensionBridge;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseExtensionBridge } from './BaseExtensionBridge.js';
|
|
2
|
+
import type { Command, CommandResponse, ExtensionEvent, ExtensionRuntimeConfig } from './types.js';
|
|
3
|
+
export interface SessionExtensionBridgeOptions {
|
|
4
|
+
runtimeConfig: ExtensionRuntimeConfig;
|
|
5
|
+
dispatchCommand: (sessionId: string, message: Command) => void;
|
|
6
|
+
onClose?: (sessionId: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare class SessionExtensionBridge extends BaseExtensionBridge {
|
|
9
|
+
private dispatchToHub;
|
|
10
|
+
private onCloseCallback?;
|
|
11
|
+
constructor(options: SessionExtensionBridgeOptions);
|
|
12
|
+
protected dispatchCommand(message: Command): void;
|
|
13
|
+
handleHubConnected(): void;
|
|
14
|
+
handleHubDisconnected(): void;
|
|
15
|
+
handleHubMessage(message: CommandResponse | ExtensionEvent): void;
|
|
16
|
+
close(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionExtensionBridge = void 0;
|
|
4
|
+
const BaseExtensionBridge_js_1 = require("./BaseExtensionBridge.js");
|
|
5
|
+
class SessionExtensionBridge extends BaseExtensionBridge_js_1.BaseExtensionBridge {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super(options.runtimeConfig);
|
|
8
|
+
this.dispatchToHub = options.dispatchCommand;
|
|
9
|
+
this.onCloseCallback = options.onClose;
|
|
10
|
+
}
|
|
11
|
+
dispatchCommand(message) {
|
|
12
|
+
this.dispatchToHub(this.runtimeConfig.sessionId, message);
|
|
13
|
+
}
|
|
14
|
+
handleHubConnected() {
|
|
15
|
+
this.setConnected(true);
|
|
16
|
+
}
|
|
17
|
+
handleHubDisconnected() {
|
|
18
|
+
this.setConnected(false);
|
|
19
|
+
}
|
|
20
|
+
handleHubMessage(message) {
|
|
21
|
+
this.handleIncoming(message);
|
|
22
|
+
}
|
|
23
|
+
close() {
|
|
24
|
+
var _a;
|
|
25
|
+
super.close();
|
|
26
|
+
(_a = this.onCloseCallback) === null || _a === void 0 ? void 0 : _a.call(this, this.runtimeConfig.sessionId);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.SessionExtensionBridge = SessionExtensionBridge;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { SessionExtensionBridge } from './SessionExtensionBridge';
|
|
2
|
+
export type { ActionArtifact, ActionCommandEnvelope, ActionDiagnostics, ActionErrorCode, ActionName, ClickPayload, Command, CommandResponse, DistributiveOmit, ExtractPayload, ExtensionBridgeLike, ExtensionEvent, ExtensionRegistrationAck, ExtensionRegistrationMessage, ExtensionRuntimeConfig, FrameSelector, InputPayload, ReadyCheckPayload, ScreenshotPayload, ScrollPayload, TargetSelector, WaitPolicy } from './types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionExtensionBridge = void 0;
|
|
4
|
+
var SessionExtensionBridge_1 = require("./SessionExtensionBridge");
|
|
5
|
+
Object.defineProperty(exports, "SessionExtensionBridge", { enumerable: true, get: function () { return SessionExtensionBridge_1.SessionExtensionBridge; } });
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export type ActionName = 'click' | 'input' | 'scroll' | 'screenshot' | 'ready-check' | 'extract';
|
|
2
|
+
export interface ExtensionRuntimeConfig {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
wsUrl: string;
|
|
5
|
+
}
|
|
6
|
+
export interface FrameSelector {
|
|
7
|
+
isIframe?: boolean;
|
|
8
|
+
iframeXpath?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface TargetSelector {
|
|
11
|
+
type: 'xpath';
|
|
12
|
+
xpath: string;
|
|
13
|
+
}
|
|
14
|
+
export interface WaitPolicy {
|
|
15
|
+
strategy: 'none' | 'network-idle' | 'selector' | 'url-change' | 'new-tab' | 'base-load' | 'composite';
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
selector?: string;
|
|
18
|
+
urlIncludes?: string;
|
|
19
|
+
idleTimeMs?: number;
|
|
20
|
+
concurrency?: number;
|
|
21
|
+
backgroundSafe?: boolean;
|
|
22
|
+
children?: WaitPolicy[];
|
|
23
|
+
}
|
|
24
|
+
export interface ClickPayload {
|
|
25
|
+
mode?: 'real-mouse' | 'element-click' | 'dom-click' | 'semantic-open';
|
|
26
|
+
ensureInView?: boolean;
|
|
27
|
+
scrollBlock?: 'start' | 'center' | 'end' | 'nearest';
|
|
28
|
+
requireVisible?: boolean;
|
|
29
|
+
requireUncovered?: boolean;
|
|
30
|
+
openNewWindow?: boolean;
|
|
31
|
+
openInBackground?: boolean;
|
|
32
|
+
modifier?: 'Meta' | 'Control';
|
|
33
|
+
}
|
|
34
|
+
export interface InputPayload {
|
|
35
|
+
text: string;
|
|
36
|
+
mode?: 'native-setter' | 'fill' | 'type';
|
|
37
|
+
clearBeforeInput?: boolean;
|
|
38
|
+
submit?: 'none' | 'enter' | 'form-submit';
|
|
39
|
+
dispatchEvents?: Array<'input' | 'change' | 'blur'>;
|
|
40
|
+
}
|
|
41
|
+
export interface ScrollPayload {
|
|
42
|
+
mode: 'into-view' | 'window-to' | 'window-to-bottom' | 'window-by-screen' | 'element-to-bottom' | 'element-by-screen';
|
|
43
|
+
block?: 'start' | 'center' | 'end' | 'nearest';
|
|
44
|
+
top?: number;
|
|
45
|
+
left?: number;
|
|
46
|
+
behavior?: 'auto' | 'instant';
|
|
47
|
+
}
|
|
48
|
+
export interface ScreenshotPayload {
|
|
49
|
+
format?: 'png' | 'jpeg';
|
|
50
|
+
encoding?: 'base64';
|
|
51
|
+
fullPage?: boolean;
|
|
52
|
+
captureBeyondViewport?: boolean;
|
|
53
|
+
ensureInView?: boolean;
|
|
54
|
+
quality?: number;
|
|
55
|
+
maxBytes?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface ReadyCheckPayload {
|
|
58
|
+
mode?: 'base-load' | 'selector' | 'url-change' | 'network-idle' | 'business';
|
|
59
|
+
selector?: string;
|
|
60
|
+
expectedUrlPart?: string;
|
|
61
|
+
allowRafBypass?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ExtractPayload {
|
|
64
|
+
mode: 'text' | 'html' | 'outer-html' | 'href' | 'src' | 'value' | 'attribute';
|
|
65
|
+
attributeName?: string;
|
|
66
|
+
}
|
|
67
|
+
interface BaseActionCommandEnvelope<TAction extends ActionName, TPayload> {
|
|
68
|
+
id: string;
|
|
69
|
+
action: TAction;
|
|
70
|
+
taskId?: string;
|
|
71
|
+
nodeId?: string;
|
|
72
|
+
tabId: number;
|
|
73
|
+
frame?: FrameSelector;
|
|
74
|
+
target?: TargetSelector;
|
|
75
|
+
waitPolicy?: WaitPolicy;
|
|
76
|
+
timeoutMs?: number;
|
|
77
|
+
payload: TPayload;
|
|
78
|
+
meta?: {
|
|
79
|
+
traceId?: string;
|
|
80
|
+
retryIndex?: number;
|
|
81
|
+
source?: 'workflow';
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export type ActionCommandEnvelope = BaseActionCommandEnvelope<'click', ClickPayload> | BaseActionCommandEnvelope<'input', InputPayload> | BaseActionCommandEnvelope<'scroll', ScrollPayload> | BaseActionCommandEnvelope<'screenshot', ScreenshotPayload> | BaseActionCommandEnvelope<'ready-check', ReadyCheckPayload> | BaseActionCommandEnvelope<'extract', ExtractPayload>;
|
|
85
|
+
export type Command = ActionCommandEnvelope;
|
|
86
|
+
export interface ExtensionBridgeLike {
|
|
87
|
+
runtimeConfig: ExtensionRuntimeConfig;
|
|
88
|
+
sendActionCommand(cmd: DistributiveOmit<ActionCommandEnvelope, 'id'>): Promise<CommandResponse>;
|
|
89
|
+
resolveTabId(pageUrl: string): number | undefined;
|
|
90
|
+
getTabUrl(tabId: number): string | undefined;
|
|
91
|
+
readonly isConnected: boolean;
|
|
92
|
+
close(): void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Omit 作用于联合类型时不会自动分配,导致各变体的专属字段丢失。
|
|
96
|
+
* DistributiveOmit 通过条件类型让它正确分配到每个成员。
|
|
97
|
+
*/
|
|
98
|
+
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
99
|
+
export type ActionErrorCode = 'OK' | 'NO_EXTENSION_CONNECTED' | 'TAB_NOT_FOUND' | 'FRAME_NOT_FOUND' | 'ELEMENT_NOT_FOUND' | 'ELEMENT_NOT_VISIBLE' | 'ELEMENT_NOT_INTERSECTING' | 'ELEMENT_COVERED' | 'OPEN_NEW_TAB_FAILED' | 'INPUT_FAILED' | 'SCROLL_FAILED' | 'SCREENSHOT_FAILED' | 'WAIT_TIMEOUT' | 'UNSUPPORTED_ACTION' | 'UNKNOWN_ERROR';
|
|
100
|
+
export interface ActionDiagnostics {
|
|
101
|
+
visibilityState?: string;
|
|
102
|
+
hasFocus?: boolean;
|
|
103
|
+
activeTab?: boolean;
|
|
104
|
+
scrollX?: number;
|
|
105
|
+
scrollY?: number;
|
|
106
|
+
elementVisible?: boolean;
|
|
107
|
+
elementIntersecting?: boolean;
|
|
108
|
+
elementUncovered?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface ActionArtifact {
|
|
111
|
+
type: 'screenshot';
|
|
112
|
+
mimeType: string;
|
|
113
|
+
data: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
}
|
|
116
|
+
export type CommandResponse = {
|
|
117
|
+
id: string;
|
|
118
|
+
success: true;
|
|
119
|
+
action?: ActionName;
|
|
120
|
+
code?: 'OK';
|
|
121
|
+
data?: unknown;
|
|
122
|
+
timings?: {
|
|
123
|
+
startedAt: number;
|
|
124
|
+
finishedAt: number;
|
|
125
|
+
durationMs: number;
|
|
126
|
+
};
|
|
127
|
+
diagnostics?: ActionDiagnostics;
|
|
128
|
+
artifacts?: ActionArtifact[];
|
|
129
|
+
} | {
|
|
130
|
+
id: string;
|
|
131
|
+
success: false;
|
|
132
|
+
action?: ActionName;
|
|
133
|
+
code?: Exclude<ActionErrorCode, 'OK'>;
|
|
134
|
+
error: string;
|
|
135
|
+
diagnostics?: ActionDiagnostics;
|
|
136
|
+
};
|
|
137
|
+
export type ExtensionEvent = {
|
|
138
|
+
type: 'tab-ready';
|
|
139
|
+
tabId: number;
|
|
140
|
+
url: string;
|
|
141
|
+
} | {
|
|
142
|
+
type: 'tab-navigated';
|
|
143
|
+
tabId: number;
|
|
144
|
+
url: string;
|
|
145
|
+
} | {
|
|
146
|
+
type: 'tab-removed';
|
|
147
|
+
tabId: number;
|
|
148
|
+
};
|
|
149
|
+
export interface ExtensionRegistrationMessage {
|
|
150
|
+
type: 'register';
|
|
151
|
+
sessionId: string;
|
|
152
|
+
}
|
|
153
|
+
export interface ExtensionRegistrationAck {
|
|
154
|
+
type: 'registered';
|
|
155
|
+
sessionId: string;
|
|
156
|
+
success: boolean;
|
|
157
|
+
error?: string;
|
|
158
|
+
}
|
|
159
|
+
export {};
|
|
Binary file
|
package/node_modules/@octopus/engine/dist/extensions/ublock-origin-lite/uBOLite.chromium.tar.xz
ADDED
|
Binary file
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type BaseAction from './actions/BaseAction';
|
|
2
|
+
import { cleanupChromeCache, resolveChrome } from './browser';
|
|
3
|
+
import type { ChromeInstallConfig } from './browser';
|
|
4
|
+
import { LocalCaptchaType } from './enums';
|
|
5
|
+
import { WorkflowSetting, BrokerSettings } from './settings';
|
|
6
|
+
import { ProxyMessage } from './types';
|
|
7
|
+
import { AsyncEmitter } from './utils/AsyncEmitter';
|
|
8
|
+
import type { Browser, BrowserContext } from 'puppeteer-core';
|
|
9
|
+
import type { ExtensionBridgeLike } from './extension-bridge';
|
|
10
|
+
import type { WorkflowStopEventMessage, WorkflowStoppedEventMessage } from './public-types';
|
|
11
|
+
export { SessionExtensionBridge } from './extension-bridge';
|
|
12
|
+
export type * from './public-types';
|
|
13
|
+
/** stopped 的内部 data/status 类型从唯一 public message 派生,避免额外暴露和维护。 */
|
|
14
|
+
type WorkflowStoppedEventData = WorkflowStoppedEventMessage['data'];
|
|
15
|
+
type WorkflowStopStatus = WorkflowStoppedEventData['status'];
|
|
16
|
+
export interface DownloadFileEventData {
|
|
17
|
+
url: string;
|
|
18
|
+
filePath: string;
|
|
19
|
+
fileSize: number;
|
|
20
|
+
status: 'downloading' | 'success' | 'failed';
|
|
21
|
+
fieldName: string;
|
|
22
|
+
rowUuid: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare enum WorkflowEvents {
|
|
26
|
+
Log = "log",
|
|
27
|
+
ExtraData = "extra-data",
|
|
28
|
+
PauseTask = "pause-task",
|
|
29
|
+
StopTask = "stop-task",
|
|
30
|
+
ResumeTask = "resume-task",
|
|
31
|
+
CloseBrowser = "close-browser",
|
|
32
|
+
Pause = "pause",
|
|
33
|
+
Resume = "resume",
|
|
34
|
+
Stop = "stop",
|
|
35
|
+
ErrorCloseBrowser = "error-close-browser",
|
|
36
|
+
Captcha = "captcha",
|
|
37
|
+
CaptchaToken = "captcha-token",
|
|
38
|
+
Maximized = "maximized",
|
|
39
|
+
GetProxy = "get-proxy",
|
|
40
|
+
SendProxy = "send-proxy",
|
|
41
|
+
DownloadFile = "download-file",
|
|
42
|
+
LoginOrCaptchaDetected = "login-or-captcha-detected",
|
|
43
|
+
CollectProxyLog = "collect-proxy-log",
|
|
44
|
+
/** 工作流最终结束结果事件,专门用于向外部上报完成/停止态 */
|
|
45
|
+
Stopped = "stopped"
|
|
46
|
+
}
|
|
47
|
+
export declare const WorkflowRunnerStatus: {
|
|
48
|
+
readonly Completed: "completed";
|
|
49
|
+
readonly Stopped: "stopped";
|
|
50
|
+
};
|
|
51
|
+
/** 先只把 Stopped 做成强类型映射,其他事件保持原来的宽松签名,避免扩大影响范围。 */
|
|
52
|
+
type WorkflowEventMap = {
|
|
53
|
+
[WorkflowEvents.Stopped]: [WorkflowStoppedEventMessage];
|
|
54
|
+
[WorkflowEvents.Stop]: [WorkflowStopEventMessage];
|
|
55
|
+
} & Record<Exclude<`${WorkflowEvents}`, WorkflowEvents.Stopped | WorkflowEvents.Stop>, any[]>;
|
|
56
|
+
type WorkflowEventEmitter = AsyncEmitter<WorkflowEventMap>;
|
|
57
|
+
declare class WorkflowAgent {
|
|
58
|
+
private _tasks;
|
|
59
|
+
private _workflowEvent;
|
|
60
|
+
private _extensionBridge?;
|
|
61
|
+
private _runtimeExtensionPath?;
|
|
62
|
+
xoml: string;
|
|
63
|
+
fieldNames: string[];
|
|
64
|
+
taskName?: string;
|
|
65
|
+
taskId: string;
|
|
66
|
+
browser?: Browser;
|
|
67
|
+
workflowSetting?: WorkflowSetting;
|
|
68
|
+
status: WorkflowStopStatus;
|
|
69
|
+
userAgent?: string;
|
|
70
|
+
brokerSettings?: BrokerSettings;
|
|
71
|
+
debuggerPort?: number;
|
|
72
|
+
downloadFolderPath?: string;
|
|
73
|
+
startTime: string;
|
|
74
|
+
disableImage?: boolean;
|
|
75
|
+
chromeInstallOptions?: ChromeInstallConfig;
|
|
76
|
+
_workflow: Workflow;
|
|
77
|
+
disableAD?: boolean;
|
|
78
|
+
constructor({ taskId, xml /** 未转换的 OTD 任务文件 */, xoml /** 已转换的任务文件 */, fieldNames, taskName, workflowSetting, userAgent, brokerSettings, debuggerPort, downloadFolderPath, disableImage, browserInstallConfig, extensionBridge, disableAD }: {
|
|
79
|
+
taskId: string;
|
|
80
|
+
xml: string;
|
|
81
|
+
xoml: string;
|
|
82
|
+
fieldNames: string[];
|
|
83
|
+
taskName?: string;
|
|
84
|
+
workflowSetting: WorkflowSetting;
|
|
85
|
+
userAgent: string;
|
|
86
|
+
brokerSettings: BrokerSettings;
|
|
87
|
+
debuggerPort?: number;
|
|
88
|
+
downloadFolderPath?: string;
|
|
89
|
+
disableImage?: boolean;
|
|
90
|
+
browserInstallConfig?: ChromeInstallConfig;
|
|
91
|
+
extensionBridge?: ExtensionBridgeLike;
|
|
92
|
+
disableAD?: boolean;
|
|
93
|
+
});
|
|
94
|
+
/** 显式暴露强类型事件方法,避免 bind 后丢失事件名与 payload 的推导关系。 */
|
|
95
|
+
on<E extends keyof WorkflowEventMap>(eventName: E, listener: (...args: WorkflowEventMap[E]) => void): this;
|
|
96
|
+
/** 透传到底层事件总线,同时保留事件名到参数的类型映射。 */
|
|
97
|
+
emit<E extends keyof WorkflowEventMap>(eventName: E, ...args: WorkflowEventMap[E]): boolean;
|
|
98
|
+
/** 对异步监听器做统一等待,并保留与 emit 一致的强类型签名。 */
|
|
99
|
+
emitAsync<E extends keyof WorkflowEventMap>(eventName: E, ...args: WorkflowEventMap[E]): Promise<boolean>;
|
|
100
|
+
/** WorkflowAgent 对外仍保留移除全部监听器能力,调用方式与之前一致。 */
|
|
101
|
+
removeAllListeners(): WorkflowEventEmitter;
|
|
102
|
+
private getExtensionTemplatePath;
|
|
103
|
+
private cleanupRuntimeExtension;
|
|
104
|
+
private prepareRuntimeExtension;
|
|
105
|
+
private getUnpackedPath;
|
|
106
|
+
private getUBlockArchivePath;
|
|
107
|
+
private getUBlockCacheRoot;
|
|
108
|
+
private getUBlockExtractedPath;
|
|
109
|
+
private hasValidUBlockManifest;
|
|
110
|
+
private waitForUBlockCache;
|
|
111
|
+
private getUBlockPath;
|
|
112
|
+
start({ path: chromePath, headless }: {
|
|
113
|
+
path?: string;
|
|
114
|
+
headless?: boolean;
|
|
115
|
+
sandbox?: boolean;
|
|
116
|
+
}): Promise<void>;
|
|
117
|
+
/** 停止命令只负责触发工作流停止,最终状态由工作流结束时统一结算 */
|
|
118
|
+
stop(): void;
|
|
119
|
+
/** stopTask 与 stop 一样属于控制命令,不直接代表最终结束结果 */
|
|
120
|
+
stopTask(): void;
|
|
121
|
+
pause(): void;
|
|
122
|
+
pauseTask(): void;
|
|
123
|
+
resume(): void;
|
|
124
|
+
resumeTask(): void;
|
|
125
|
+
capthcaToken(data: {
|
|
126
|
+
captchaType: LocalCaptchaType;
|
|
127
|
+
token: string;
|
|
128
|
+
}): void;
|
|
129
|
+
sendProxy(data: {
|
|
130
|
+
proxyIp: ProxyMessage;
|
|
131
|
+
}): void;
|
|
132
|
+
maximized(): void;
|
|
133
|
+
close(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Mac 平台特殊处理:监听所有页面关闭后自动退出浏览器进程
|
|
136
|
+
* 解决 Mac 上点击红色关闭按钮后,程序坞仍保留浏览器图标的问题
|
|
137
|
+
*/
|
|
138
|
+
private setupMacOSAutoQuit;
|
|
139
|
+
listenerEvent(): void;
|
|
140
|
+
}
|
|
141
|
+
interface WorkflowRunParams {
|
|
142
|
+
task: string;
|
|
143
|
+
xoml: string;
|
|
144
|
+
fieldNames: string[];
|
|
145
|
+
browserContext: BrowserContext;
|
|
146
|
+
workflowEvent: WorkflowEventEmitter;
|
|
147
|
+
workflowSetting?: WorkflowSetting;
|
|
148
|
+
userAgent?: string;
|
|
149
|
+
brokerSettings?: BrokerSettings;
|
|
150
|
+
downloadFolderPath?: string;
|
|
151
|
+
taskName?: string;
|
|
152
|
+
startTime: string;
|
|
153
|
+
headless: boolean;
|
|
154
|
+
extensionBridge?: ExtensionBridgeLike;
|
|
155
|
+
}
|
|
156
|
+
declare class Workflow {
|
|
157
|
+
taskId: string;
|
|
158
|
+
private isCompleted;
|
|
159
|
+
private isPaused;
|
|
160
|
+
private isFromClientPaused;
|
|
161
|
+
extractIndexMap: Map<string, number>;
|
|
162
|
+
currentAction: BaseAction;
|
|
163
|
+
actions: Map<string, BaseAction>;
|
|
164
|
+
isUploadRestart: boolean;
|
|
165
|
+
constructor(taskId: string);
|
|
166
|
+
run({ task, xoml, fieldNames, browserContext, workflowEvent, workflowSetting, userAgent, brokerSettings, downloadFolderPath, taskName, startTime, headless, extensionBridge }: WorkflowRunParams): void;
|
|
167
|
+
}
|
|
168
|
+
export default WorkflowAgent;
|
|
169
|
+
export { resolveChrome, cleanupChromeCache };
|