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.
Files changed (278) hide show
  1. package/README.md +271 -0
  2. package/RUNTIME_SECURITY_NOTICE.txt +41 -0
  3. package/SECURITY.md +24 -0
  4. package/dist/cli/args.js +34 -0
  5. package/dist/cli/help.js +214 -0
  6. package/dist/cli/output.js +39 -0
  7. package/dist/commands/auth.js +283 -0
  8. package/dist/commands/capabilities.js +118 -0
  9. package/dist/commands/cloud.js +241 -0
  10. package/dist/commands/data.js +220 -0
  11. package/dist/commands/doctor.js +73 -0
  12. package/dist/commands/env.js +63 -0
  13. package/dist/commands/local.js +251 -0
  14. package/dist/commands/run.js +622 -0
  15. package/dist/commands/runs.js +171 -0
  16. package/dist/commands/task.js +101 -0
  17. package/dist/index.js +133 -0
  18. package/dist/runtime/account-capabilities.js +71 -0
  19. package/dist/runtime/api-client.js +290 -0
  20. package/dist/runtime/artifacts.js +33 -0
  21. package/dist/runtime/auth.js +94 -0
  22. package/dist/runtime/bridge-hub.js +173 -0
  23. package/dist/runtime/client-headers.js +23 -0
  24. package/dist/runtime/cloud-data.js +75 -0
  25. package/dist/runtime/config.js +48 -0
  26. package/dist/runtime/data-exporter.js +267 -0
  27. package/dist/runtime/engine-host.js +449 -0
  28. package/dist/runtime/local-runs.js +92 -0
  29. package/dist/runtime/naming.js +13 -0
  30. package/dist/runtime/run-control.js +363 -0
  31. package/dist/runtime/run-services.js +380 -0
  32. package/dist/runtime/security-notice.js +78 -0
  33. package/dist/runtime/task-definition-provider.js +282 -0
  34. package/dist/types.js +4 -0
  35. package/examples/minimal-task.json +6 -0
  36. package/examples/navigate-example-task.json +6 -0
  37. package/node_modules/@octopus/bpmn/index.js +3 -0
  38. package/node_modules/@octopus/bpmn/lib/Context.js +245 -0
  39. package/node_modules/@octopus/bpmn/lib/Definition.js +258 -0
  40. package/node_modules/@octopus/bpmn/lib/Engine.js +275 -0
  41. package/node_modules/@octopus/bpmn/lib/PrematureStopError.js +7 -0
  42. package/node_modules/@octopus/bpmn/lib/activities/Activity.js +202 -0
  43. package/node_modules/@octopus/bpmn/lib/activities/BaseProcess.js +308 -0
  44. package/node_modules/@octopus/bpmn/lib/activities/BaseTask.js +145 -0
  45. package/node_modules/@octopus/bpmn/lib/activities/BoundaryEvent.js +12 -0
  46. package/node_modules/@octopus/bpmn/lib/activities/Dummy.js +10 -0
  47. package/node_modules/@octopus/bpmn/lib/activities/EventDefinition.js +99 -0
  48. package/node_modules/@octopus/bpmn/lib/activities/Flow.js +52 -0
  49. package/node_modules/@octopus/bpmn/lib/activities/Form.js +67 -0
  50. package/node_modules/@octopus/bpmn/lib/activities/InputOutput.js +53 -0
  51. package/node_modules/@octopus/bpmn/lib/activities/IntermediateCatchEvent.js +12 -0
  52. package/node_modules/@octopus/bpmn/lib/activities/MessageFlow.js +19 -0
  53. package/node_modules/@octopus/bpmn/lib/activities/MultiInstanceLoopCharacteristics.js +160 -0
  54. package/node_modules/@octopus/bpmn/lib/activities/Properties.js +27 -0
  55. package/node_modules/@octopus/bpmn/lib/activities/SequenceFlow.js +56 -0
  56. package/node_modules/@octopus/bpmn/lib/activities/ServiceConnector.js +71 -0
  57. package/node_modules/@octopus/bpmn/lib/context-helper.js +198 -0
  58. package/node_modules/@octopus/bpmn/lib/events/EndEvent.js +22 -0
  59. package/node_modules/@octopus/bpmn/lib/events/ErrorEvent.js +41 -0
  60. package/node_modules/@octopus/bpmn/lib/events/MessageEvent.js +19 -0
  61. package/node_modules/@octopus/bpmn/lib/events/StartEvent.js +55 -0
  62. package/node_modules/@octopus/bpmn/lib/events/TimerEvent.js +75 -0
  63. package/node_modules/@octopus/bpmn/lib/expressions.js +41 -0
  64. package/node_modules/@octopus/bpmn/lib/gateways/ExclusiveGateway.js +86 -0
  65. package/node_modules/@octopus/bpmn/lib/gateways/InclusiveGateway.js +56 -0
  66. package/node_modules/@octopus/bpmn/lib/gateways/ParallelGateway.js +195 -0
  67. package/node_modules/@octopus/bpmn/lib/getPropertyValue.js +83 -0
  68. package/node_modules/@octopus/bpmn/lib/index.js +6 -0
  69. package/node_modules/@octopus/bpmn/lib/mapper.js +55 -0
  70. package/node_modules/@octopus/bpmn/lib/parameter.js +119 -0
  71. package/node_modules/@octopus/bpmn/lib/script-helper.js +45 -0
  72. package/node_modules/@octopus/bpmn/lib/tasks/ManualTask.js +31 -0
  73. package/node_modules/@octopus/bpmn/lib/tasks/ReceiveTask.js +31 -0
  74. package/node_modules/@octopus/bpmn/lib/tasks/ScriptTask.js +35 -0
  75. package/node_modules/@octopus/bpmn/lib/tasks/SendTask.js +16 -0
  76. package/node_modules/@octopus/bpmn/lib/tasks/ServiceTask.js +68 -0
  77. package/node_modules/@octopus/bpmn/lib/tasks/SubProcess.js +17 -0
  78. package/node_modules/@octopus/bpmn/lib/tasks/Task.js +16 -0
  79. package/node_modules/@octopus/bpmn/lib/tasks/UserTask.js +47 -0
  80. package/node_modules/@octopus/bpmn/lib/transformer.js +13 -0
  81. package/node_modules/@octopus/bpmn/lib/validation.js +111 -0
  82. package/node_modules/@octopus/bpmn/package.json +17 -0
  83. package/node_modules/@octopus/bpmn/types/bpmn.d.ts +85 -0
  84. package/node_modules/@octopus/engine/README.md +370 -0
  85. package/node_modules/@octopus/engine/dist/actions/BackPreWebPageAction.d.ts +4 -0
  86. package/node_modules/@octopus/engine/dist/actions/BackPreWebPageAction.js +1 -0
  87. package/node_modules/@octopus/engine/dist/actions/BaseAction.d.ts +339 -0
  88. package/node_modules/@octopus/engine/dist/actions/BaseAction.js +1559 -0
  89. package/node_modules/@octopus/engine/dist/actions/BranchAction.d.ts +9 -0
  90. package/node_modules/@octopus/engine/dist/actions/BranchAction.js +1 -0
  91. package/node_modules/@octopus/engine/dist/actions/ClickAction.d.ts +22 -0
  92. package/node_modules/@octopus/engine/dist/actions/ClickAction.js +1 -0
  93. package/node_modules/@octopus/engine/dist/actions/ConditionAction.d.ts +4 -0
  94. package/node_modules/@octopus/engine/dist/actions/ConditionAction.js +1 -0
  95. package/node_modules/@octopus/engine/dist/actions/EmptyAction.d.ts +4 -0
  96. package/node_modules/@octopus/engine/dist/actions/EmptyAction.js +12 -0
  97. package/node_modules/@octopus/engine/dist/actions/EnterCaptchaAction.d.ts +28 -0
  98. package/node_modules/@octopus/engine/dist/actions/EnterCaptchaAction.js +1 -0
  99. package/node_modules/@octopus/engine/dist/actions/EnterTextAction.d.ts +20 -0
  100. package/node_modules/@octopus/engine/dist/actions/EnterTextAction.js +1 -0
  101. package/node_modules/@octopus/engine/dist/actions/ExtractDataAction.d.ts +40 -0
  102. package/node_modules/@octopus/engine/dist/actions/ExtractDataAction.js +1 -0
  103. package/node_modules/@octopus/engine/dist/actions/LoopAction.d.ts +41 -0
  104. package/node_modules/@octopus/engine/dist/actions/LoopAction.js +526 -0
  105. package/node_modules/@octopus/engine/dist/actions/LoopStartAction.d.ts +47 -0
  106. package/node_modules/@octopus/engine/dist/actions/LoopStartAction.js +607 -0
  107. package/node_modules/@octopus/engine/dist/actions/MouseOverAction.d.ts +8 -0
  108. package/node_modules/@octopus/engine/dist/actions/MouseOverAction.js +34 -0
  109. package/node_modules/@octopus/engine/dist/actions/NavigateAction.d.ts +38 -0
  110. package/node_modules/@octopus/engine/dist/actions/NavigateAction.js +535 -0
  111. package/node_modules/@octopus/engine/dist/actions/SwitchComboAction.d.ts +13 -0
  112. package/node_modules/@octopus/engine/dist/actions/SwitchComboAction.js +69 -0
  113. package/node_modules/@octopus/engine/dist/browser.d.ts +17 -0
  114. package/node_modules/@octopus/engine/dist/browser.js +157 -0
  115. package/node_modules/@octopus/engine/dist/browserProxy.d.ts +90 -0
  116. package/node_modules/@octopus/engine/dist/browserProxy.js +1 -0
  117. package/node_modules/@octopus/engine/dist/configs/BaseConfig.d.ts +20 -0
  118. package/node_modules/@octopus/engine/dist/configs/BaseConfig.js +88 -0
  119. package/node_modules/@octopus/engine/dist/configs/BranchConfig.d.ts +7 -0
  120. package/node_modules/@octopus/engine/dist/configs/BranchConfig.js +1 -0
  121. package/node_modules/@octopus/engine/dist/configs/ClickConfig.d.ts +36 -0
  122. package/node_modules/@octopus/engine/dist/configs/ClickConfig.js +65 -0
  123. package/node_modules/@octopus/engine/dist/configs/EnterCaptchaConfig.d.ts +19 -0
  124. package/node_modules/@octopus/engine/dist/configs/EnterCaptchaConfig.js +25 -0
  125. package/node_modules/@octopus/engine/dist/configs/EnterTextConfig.d.ts +24 -0
  126. package/node_modules/@octopus/engine/dist/configs/EnterTextConfig.js +36 -0
  127. package/node_modules/@octopus/engine/dist/configs/ExtractDataConfig.d.ts +12 -0
  128. package/node_modules/@octopus/engine/dist/configs/ExtractDataConfig.js +1 -0
  129. package/node_modules/@octopus/engine/dist/configs/LoopConfig.d.ts +25 -0
  130. package/node_modules/@octopus/engine/dist/configs/LoopConfig.js +40 -0
  131. package/node_modules/@octopus/engine/dist/configs/LoopStartConfig.d.ts +4 -0
  132. package/node_modules/@octopus/engine/dist/configs/LoopStartConfig.js +12 -0
  133. package/node_modules/@octopus/engine/dist/configs/MouseOverConfig.d.ts +8 -0
  134. package/node_modules/@octopus/engine/dist/configs/MouseOverConfig.js +15 -0
  135. package/node_modules/@octopus/engine/dist/configs/NavigateConfig.d.ts +41 -0
  136. package/node_modules/@octopus/engine/dist/configs/NavigateConfig.js +121 -0
  137. package/node_modules/@octopus/engine/dist/configs/SwitchComboConfig.d.ts +8 -0
  138. package/node_modules/@octopus/engine/dist/configs/SwitchComboConfig.js +15 -0
  139. package/node_modules/@octopus/engine/dist/enums/index.d.ts +419 -0
  140. package/node_modules/@octopus/engine/dist/enums/index.js +314 -0
  141. package/node_modules/@octopus/engine/dist/extension/BrowserWebSocketTransport-D_zAGZMQ.js +1 -0
  142. package/node_modules/@octopus/engine/dist/extension/LaunchOptions-DxvePrV4.js +6 -0
  143. package/node_modules/@octopus/engine/dist/extension/NodeWebSocketTransport-BTgRVB7Z.js +6 -0
  144. package/node_modules/@octopus/engine/dist/extension/background.js +396 -0
  145. package/node_modules/@octopus/engine/dist/extension/bidi-C_GIZ8Uz.js +131 -0
  146. package/node_modules/@octopus/engine/dist/extension/manifest.json +27 -0
  147. package/node_modules/@octopus/engine/dist/extension/src/content/anti-detection.js +1 -0
  148. package/node_modules/@octopus/engine/dist/extension-bridge/BaseExtensionBridge.d.ts +21 -0
  149. package/node_modules/@octopus/engine/dist/extension-bridge/BaseExtensionBridge.js +117 -0
  150. package/node_modules/@octopus/engine/dist/extension-bridge/SessionExtensionBridge.d.ts +17 -0
  151. package/node_modules/@octopus/engine/dist/extension-bridge/SessionExtensionBridge.js +29 -0
  152. package/node_modules/@octopus/engine/dist/extension-bridge/index.d.ts +2 -0
  153. package/node_modules/@octopus/engine/dist/extension-bridge/index.js +5 -0
  154. package/node_modules/@octopus/engine/dist/extension-bridge/types.d.ts +159 -0
  155. package/node_modules/@octopus/engine/dist/extension-bridge/types.js +5 -0
  156. package/node_modules/@octopus/engine/dist/extensions/ublock-origin/uBlock0.chromium.tar.xz +0 -0
  157. package/node_modules/@octopus/engine/dist/extensions/ublock-origin-lite/uBOLite.chromium.tar.xz +0 -0
  158. package/node_modules/@octopus/engine/dist/index.d.ts +169 -0
  159. package/node_modules/@octopus/engine/dist/index.js +1 -0
  160. package/node_modules/@octopus/engine/dist/models/actionItem.d.ts +16 -0
  161. package/node_modules/@octopus/engine/dist/models/actionItem.js +15 -0
  162. package/node_modules/@octopus/engine/dist/models/conditionCheckArgs.d.ts +11 -0
  163. package/node_modules/@octopus/engine/dist/models/conditionCheckArgs.js +11 -0
  164. package/node_modules/@octopus/engine/dist/models/customizeCookie.d.ts +14 -0
  165. package/node_modules/@octopus/engine/dist/models/customizeCookie.js +6 -0
  166. package/node_modules/@octopus/engine/dist/models/downloadFileConfig.d.ts +17 -0
  167. package/node_modules/@octopus/engine/dist/models/downloadFileConfig.js +26 -0
  168. package/node_modules/@octopus/engine/dist/models/elementNotFoundArgs.d.ts +8 -0
  169. package/node_modules/@octopus/engine/dist/models/elementNotFoundArgs.js +12 -0
  170. package/node_modules/@octopus/engine/dist/models/elementNotFoundError.d.ts +2 -0
  171. package/node_modules/@octopus/engine/dist/models/elementNotFoundError.js +6 -0
  172. package/node_modules/@octopus/engine/dist/models/extractItem.d.ts +37 -0
  173. package/node_modules/@octopus/engine/dist/models/extractItem.js +35 -0
  174. package/node_modules/@octopus/engine/dist/models/extractTemplate.d.ts +11 -0
  175. package/node_modules/@octopus/engine/dist/models/extractTemplate.js +48 -0
  176. package/node_modules/@octopus/engine/dist/models/extractTextItem.d.ts +10 -0
  177. package/node_modules/@octopus/engine/dist/models/extractTextItem.js +17 -0
  178. package/node_modules/@octopus/engine/dist/models/globalConfig.d.ts +5 -0
  179. package/node_modules/@octopus/engine/dist/models/globalConfig.js +1 -0
  180. package/node_modules/@octopus/engine/dist/models/httpHeader.d.ts +4 -0
  181. package/node_modules/@octopus/engine/dist/models/httpHeader.js +10 -0
  182. package/node_modules/@octopus/engine/dist/models/operation.d.ts +27 -0
  183. package/node_modules/@octopus/engine/dist/models/operation.js +242 -0
  184. package/node_modules/@octopus/engine/dist/models/retryCondition.d.ts +7 -0
  185. package/node_modules/@octopus/engine/dist/models/retryCondition.js +10 -0
  186. package/node_modules/@octopus/engine/dist/models/task.d.ts +89 -0
  187. package/node_modules/@octopus/engine/dist/models/task.js +120 -0
  188. package/node_modules/@octopus/engine/dist/models/trigger.d.ts +66 -0
  189. package/node_modules/@octopus/engine/dist/models/trigger.js +117 -0
  190. package/node_modules/@octopus/engine/dist/package.json +26 -0
  191. package/node_modules/@octopus/engine/dist/public-types.d.ts +13 -0
  192. package/node_modules/@octopus/engine/dist/public-types.js +2 -0
  193. package/node_modules/@octopus/engine/dist/settings.d.ts +41 -0
  194. package/node_modules/@octopus/engine/dist/settings.js +20 -0
  195. package/node_modules/@octopus/engine/dist/solvers/captcha/ClickCaptchaSolver.d.ts +6 -0
  196. package/node_modules/@octopus/engine/dist/solvers/captcha/ClickCaptchaSolver.js +1 -0
  197. package/node_modules/@octopus/engine/dist/solvers/captcha/HCaptchaSolver.d.ts +4 -0
  198. package/node_modules/@octopus/engine/dist/solvers/captcha/HCaptchaSolver.js +73 -0
  199. package/node_modules/@octopus/engine/dist/solvers/captcha/ImageCaptchaSolver.d.ts +2 -0
  200. package/node_modules/@octopus/engine/dist/solvers/captcha/ImageCaptchaSolver.js +74 -0
  201. package/node_modules/@octopus/engine/dist/solvers/captcha/RecaptchaSolver.d.ts +9 -0
  202. package/node_modules/@octopus/engine/dist/solvers/captcha/RecaptchaSolver.js +371 -0
  203. package/node_modules/@octopus/engine/dist/solvers/captcha/SliderCaptchaSolver.d.ts +6 -0
  204. package/node_modules/@octopus/engine/dist/solvers/captcha/SliderCaptchaSolver.js +184 -0
  205. package/node_modules/@octopus/engine/dist/solvers/captcha/SlidingTrajectory.d.ts +50 -0
  206. package/node_modules/@octopus/engine/dist/solvers/captcha/SlidingTrajectory.js +125 -0
  207. package/node_modules/@octopus/engine/dist/solvers/captcha/types.d.ts +68 -0
  208. package/node_modules/@octopus/engine/dist/solvers/captcha/types.js +34 -0
  209. package/node_modules/@octopus/engine/dist/solvers/captcha/utils.d.ts +2 -0
  210. package/node_modules/@octopus/engine/dist/solvers/captcha/utils.js +15 -0
  211. package/node_modules/@octopus/engine/dist/translator/actionFactory.d.ts +6 -0
  212. package/node_modules/@octopus/engine/dist/translator/actionFactory.js +1 -0
  213. package/node_modules/@octopus/engine/dist/translator/activityTypeEnum.d.ts +22 -0
  214. package/node_modules/@octopus/engine/dist/translator/activityTypeEnum.js +1 -0
  215. package/node_modules/@octopus/engine/dist/translator/backPreWebPageAction.d.ts +5 -0
  216. package/node_modules/@octopus/engine/dist/translator/backPreWebPageAction.js +1 -0
  217. package/node_modules/@octopus/engine/dist/translator/baseAction.d.ts +31 -0
  218. package/node_modules/@octopus/engine/dist/translator/baseAction.js +1 -0
  219. package/node_modules/@octopus/engine/dist/translator/breakActivity.d.ts +5 -0
  220. package/node_modules/@octopus/engine/dist/translator/breakActivity.js +1 -0
  221. package/node_modules/@octopus/engine/dist/translator/clickAction.d.ts +5 -0
  222. package/node_modules/@octopus/engine/dist/translator/clickAction.js +1 -0
  223. package/node_modules/@octopus/engine/dist/translator/completeWF.d.ts +5 -0
  224. package/node_modules/@octopus/engine/dist/translator/completeWF.js +1 -0
  225. package/node_modules/@octopus/engine/dist/translator/conditionAction.d.ts +6 -0
  226. package/node_modules/@octopus/engine/dist/translator/conditionAction.js +1 -0
  227. package/node_modules/@octopus/engine/dist/translator/emptyAction.d.ts +5 -0
  228. package/node_modules/@octopus/engine/dist/translator/emptyAction.js +1 -0
  229. package/node_modules/@octopus/engine/dist/translator/enterCapachaAction.d.ts +5 -0
  230. package/node_modules/@octopus/engine/dist/translator/enterCapachaAction.js +1 -0
  231. package/node_modules/@octopus/engine/dist/translator/enterTextAction.d.ts +5 -0
  232. package/node_modules/@octopus/engine/dist/translator/enterTextAction.js +1 -0
  233. package/node_modules/@octopus/engine/dist/translator/extractDataAction.d.ts +13 -0
  234. package/node_modules/@octopus/engine/dist/translator/extractDataAction.js +1 -0
  235. package/node_modules/@octopus/engine/dist/translator/loopAction.d.ts +5 -0
  236. package/node_modules/@octopus/engine/dist/translator/loopAction.js +1 -0
  237. package/node_modules/@octopus/engine/dist/translator/mouseOverAction.d.ts +5 -0
  238. package/node_modules/@octopus/engine/dist/translator/mouseOverAction.js +19 -0
  239. package/node_modules/@octopus/engine/dist/translator/navigateAction.d.ts +5 -0
  240. package/node_modules/@octopus/engine/dist/translator/navigateAction.js +117 -0
  241. package/node_modules/@octopus/engine/dist/translator/rootAction.d.ts +6 -0
  242. package/node_modules/@octopus/engine/dist/translator/rootAction.js +80 -0
  243. package/node_modules/@octopus/engine/dist/translator/switchCombo2Action.d.ts +5 -0
  244. package/node_modules/@octopus/engine/dist/translator/switchCombo2Action.js +19 -0
  245. package/node_modules/@octopus/engine/dist/translator/translator.d.ts +1 -0
  246. package/node_modules/@octopus/engine/dist/translator/translator.js +36 -0
  247. package/node_modules/@octopus/engine/dist/type.d.ts +25 -0
  248. package/node_modules/@octopus/engine/dist/type.js +2 -0
  249. package/node_modules/@octopus/engine/dist/types/browser.d.ts +191 -0
  250. package/node_modules/@octopus/engine/dist/types/browser.js +1 -0
  251. package/node_modules/@octopus/engine/dist/types/browserManager.d.ts +41 -0
  252. package/node_modules/@octopus/engine/dist/types/browserManager.js +1 -0
  253. package/node_modules/@octopus/engine/dist/types/index.d.ts +40 -0
  254. package/node_modules/@octopus/engine/dist/types/index.js +2 -0
  255. package/node_modules/@octopus/engine/dist/types/plugin.d.ts +29 -0
  256. package/node_modules/@octopus/engine/dist/types/plugin.js +2 -0
  257. package/node_modules/@octopus/engine/dist/utils/AsyncEmitter.d.ts +15 -0
  258. package/node_modules/@octopus/engine/dist/utils/AsyncEmitter.js +1 -0
  259. package/node_modules/@octopus/engine/dist/utils/DataStore.d.ts +58 -0
  260. package/node_modules/@octopus/engine/dist/utils/DataStore.js +1 -0
  261. package/node_modules/@octopus/engine/dist/utils/DateTimeFormatHelper.d.ts +22 -0
  262. package/node_modules/@octopus/engine/dist/utils/DateTimeFormatHelper.js +173 -0
  263. package/node_modules/@octopus/engine/dist/utils/FileDownloader.d.ts +108 -0
  264. package/node_modules/@octopus/engine/dist/utils/FileDownloader.js +1 -0
  265. package/node_modules/@octopus/engine/dist/utils/HttpRequester.d.ts +43 -0
  266. package/node_modules/@octopus/engine/dist/utils/HttpRequester.js +174 -0
  267. package/node_modules/@octopus/engine/dist/utils/JsonParser.d.ts +95 -0
  268. package/node_modules/@octopus/engine/dist/utils/JsonParser.js +439 -0
  269. package/node_modules/@octopus/engine/dist/utils/Operations.d.ts +27 -0
  270. package/node_modules/@octopus/engine/dist/utils/Operations.js +115 -0
  271. package/node_modules/@octopus/engine/dist/utils/index.d.ts +28 -0
  272. package/node_modules/@octopus/engine/dist/utils/index.js +356 -0
  273. package/node_modules/@octopus/engine/package.json +58 -0
  274. package/package.json +79 -0
  275. package/schemas/capabilities-v1.schema.json +234 -0
  276. package/schemas/detached-bootstrap-v1.schema.json +42 -0
  277. package/schemas/json-envelope-v1.schema.json +39 -0
  278. package/schemas/run-event-v1.schema.json +47 -0
@@ -0,0 +1,356 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.repairURL = exports.transformDate = exports.random = exports.hashCode = exports.executeJavaScriptInWorker = exports.correctUrl = exports.isNullOrEmpty = exports.getGlobalCookie = exports.generateExtractIndexMap = exports.sleep = exports.parseXMLToObj = exports.parseXML = void 0;
7
+ const moment_1 = __importDefault(require("moment"));
8
+ const xmldom_1 = require("xmldom");
9
+ const fast_xml_parser_1 = require("fast-xml-parser");
10
+ const worker_threads_1 = require("worker_threads");
11
+ const fs_1 = require("fs");
12
+ const sax_1 = __importDefault(require("sax"));
13
+ const parser = new fast_xml_parser_1.XMLParser();
14
+ const parseXML = (xml, cb) => {
15
+ let data, er;
16
+ try {
17
+ data = parser.parse(xml);
18
+ }
19
+ catch (e) {
20
+ er = e;
21
+ }
22
+ finally {
23
+ cb(er, data);
24
+ }
25
+ };
26
+ exports.parseXML = parseXML;
27
+ /** 解析 XML 转为对象 */
28
+ const parseXMLToObj = (xml) => {
29
+ const result = { data: {}, isAppend: false };
30
+ try {
31
+ const doc = new xmldom_1.DOMParser().parseFromString(xml);
32
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
33
+ for (let i = 0; i < doc.documentElement.childNodes.length; i++) {
34
+ const element = doc.documentElement.childNodes[i];
35
+ if (element.nodeType === 1) {
36
+ /** @issues 这里去获取真实的标签名,因为之前工作流生成 XML 时非法字符被去掉了 */
37
+ const realName = element.getAttribute('realName');
38
+ const localName = realName || element.localName;
39
+ const isAppend = element.getAttribute('IsAppend') === 'true';
40
+ if (isAppend) {
41
+ result.isAppend = true;
42
+ }
43
+ let value = element.textContent;
44
+ /** 同一行内同名字段勾选了 [同一字段多行合并] 开关时,勾选的字段合并前一个同名字段内容 */
45
+ if (isAppend && result.data[localName]) {
46
+ value = `${result.data[localName].value}\r\n${element.textContent}`;
47
+ }
48
+ result.data[localName] = { value, isAppend };
49
+ }
50
+ }
51
+ }
52
+ catch (error) {
53
+ console.error(error);
54
+ }
55
+ return result;
56
+ };
57
+ exports.parseXMLToObj = parseXMLToObj;
58
+ const sleep = (delay) => new Promise((resole) => setTimeout(resole, delay));
59
+ exports.sleep = sleep;
60
+ /** 获取步骤的唯一标识 */
61
+ const getActionID = (node) => {
62
+ let id = node.getAttribute('Name');
63
+ if (!id) {
64
+ for (let i = 0; i < node.attributes.length; i++) {
65
+ const { name, value } = node.attributes[i];
66
+ if (name.includes(':Name')) {
67
+ id = value;
68
+ break;
69
+ }
70
+ }
71
+ }
72
+ return id;
73
+ };
74
+ /** 判断节点是否为分支步骤 */
75
+ const isCondition = (node) => node && node.tagName && node.tagName.indexOf('ConditionAction') != -1;
76
+ /** 判断节点是否为条件步骤 */
77
+ const isBranch = (node) => node && node.tagName && node.tagName.indexOf('BranchAction') != -1;
78
+ /** 节点递归往上去找是否包含在条件分支中 */
79
+ const deepFindParentBranch = (node) => {
80
+ let branch = node.parentNode;
81
+ while (branch && branch.nodeType === 1 && branch.tagName && branch.tagName.indexOf('BranchAction') === -1) {
82
+ branch = branch.parentNode;
83
+ }
84
+ return branch;
85
+ };
86
+ const deepFindBranch = (list, branchID) => {
87
+ for (const item of list) {
88
+ if (item.branchs) {
89
+ for (const branch of item.branchs) {
90
+ if (branch.branchID === branchID)
91
+ return branch;
92
+ if (branch.list) {
93
+ const _branch = deepFindBranch(branch.list, branchID);
94
+ if (_branch)
95
+ return _branch;
96
+ }
97
+ }
98
+ }
99
+ }
100
+ };
101
+ const deepFindCondition = (list, conditionID) => {
102
+ for (const item of list) {
103
+ if (item.conditionID === conditionID)
104
+ return item;
105
+ if (item.branchs) {
106
+ for (const branch of item.branchs) {
107
+ if (branch.list) {
108
+ const condition = deepFindCondition(branch.list, conditionID);
109
+ if (condition)
110
+ return condition;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ };
116
+ /** 生成任务流程的全部【提取步骤】的序号映射表 */
117
+ const generateExtractIndexMap = (xml) => {
118
+ const list = [];
119
+ const extractIndexMap = new Map();
120
+ const document = new xmldom_1.DOMParser().parseFromString(xml, 'text/xml');
121
+ const parseNode = (childNodes) => {
122
+ for (let i = 0; i < childNodes.length; i++) {
123
+ const node = childNodes[i];
124
+ if (node.nodeType === 1) {
125
+ switch (node.localName) {
126
+ case 'ConditionAction':
127
+ {
128
+ const conditionID = getActionID(node);
129
+ const parentBranch = deepFindParentBranch(node);
130
+ if (parentBranch && parentBranch.localName === 'BranchAction') {
131
+ const parentBranchID = getActionID(parentBranch);
132
+ const branch = deepFindBranch(list, parentBranchID);
133
+ branch.list.push({ conditionID, branchs: [] });
134
+ }
135
+ else {
136
+ list.push({ conditionID, branchs: [] });
137
+ }
138
+ }
139
+ break;
140
+ case 'BranchAction':
141
+ {
142
+ const branchID = getActionID(node);
143
+ const conditionID = getActionID(node.parentNode);
144
+ const condition = deepFindCondition(list, conditionID);
145
+ condition.branchs.push({ branchID, list: [] });
146
+ }
147
+ break;
148
+ case 'ExtractDataAction':
149
+ {
150
+ const extractID = getActionID(node);
151
+ const parentBranch = deepFindParentBranch(node);
152
+ if (parentBranch && parentBranch.localName === 'BranchAction') {
153
+ const parentBranchID = getActionID(parentBranch);
154
+ const branch = deepFindBranch(list, parentBranchID);
155
+ branch.list.push({ extractID });
156
+ }
157
+ else {
158
+ list.push({ extractID });
159
+ }
160
+ }
161
+ break;
162
+ }
163
+ parseNode(node.childNodes);
164
+ }
165
+ }
166
+ };
167
+ parseNode(document.childNodes);
168
+ const parseList = (list, index) => {
169
+ list.forEach(({ extractID, branchs }, i) => extractID ? extractIndexMap.set(extractID, index + i) : branchs.forEach(({ list }) => parseList(list, index + i)));
170
+ };
171
+ parseList(list, 0);
172
+ return extractIndexMap;
173
+ };
174
+ exports.generateExtractIndexMap = generateExtractIndexMap;
175
+ const getGlobalCookie = (xml) => {
176
+ const globalCookieConfig = { globalCookie: '', isSetGlobalCookie: false };
177
+ const parser = sax_1.default.parser(true, { trim: true }); // strict=true 启用严格模式
178
+ parser.onopentag = (node) => {
179
+ if (node.name.includes('RootAction')) {
180
+ globalCookieConfig.globalCookie = node.attributes['globalCookie'] || '';
181
+ globalCookieConfig.isSetGlobalCookie = node.attributes['isSetGlobalCookie'] === 'true';
182
+ }
183
+ };
184
+ parser.onerror = (err) => {
185
+ console.error('XML parsing failed:', err);
186
+ parser.resume();
187
+ };
188
+ try {
189
+ parser.write(xml).close();
190
+ }
191
+ catch (e) {
192
+ console.error('XML processing failed:', e);
193
+ }
194
+ return globalCookieConfig;
195
+ };
196
+ exports.getGlobalCookie = getGlobalCookie;
197
+ const isNullOrEmpty = (value) => {
198
+ return !(typeof value === 'string' && value.length > 0);
199
+ };
200
+ exports.isNullOrEmpty = isNullOrEmpty;
201
+ const correctUrl = (url) => {
202
+ const regExp = /^https?:\/\//;
203
+ if (!regExp.test(url)) {
204
+ url = `http://${url}`;
205
+ }
206
+ return url;
207
+ };
208
+ exports.correctUrl = correctUrl;
209
+ /**
210
+ * 在 Worker 线程中执行耗时的 JavaScript 代码,可以设置超时时间自动结束
211
+ * PS:这个功能目前主要给执行正则表达式时使用,因为 string.replace() 等方法是同步执行,当执行一些用户输入的不可预期的正则表达式时会卡死的当前 UI 线程
212
+ * @see https://skieer.feishu.cn/docs/doccncVezuTFcky9wboyAkCPLuc?sidebarOpen=1
213
+ * @param code 需要执行的代码
214
+ * @param timeout 超时时间,默认为 10s
215
+ */
216
+ const executeJavaScriptInWorker = (code, timeout = 10000) => {
217
+ return new Promise((resolve, reject) => {
218
+ // 创建 Worker
219
+ const worker = new worker_threads_1.Worker(`
220
+ const { parentPort } = require('worker_threads');
221
+ parentPort.on('message', (code) => {
222
+ try {
223
+ const result = eval(code);
224
+ parentPort.postMessage(result);
225
+ } catch (error) {
226
+ parentPort.postMessage({ error: error.message });
227
+ }
228
+ });
229
+ `, { eval: true });
230
+ // 设置超时
231
+ const timer = setTimeout(() => {
232
+ worker.terminate();
233
+ reject(new Error('execute javascript code timeout in worker'));
234
+ }, timeout);
235
+ // 处理 Worker 返回的结果
236
+ worker.on('message', (result) => {
237
+ clearTimeout(timer);
238
+ worker.terminate();
239
+ if (result && result.error) {
240
+ reject(new Error(result.error));
241
+ }
242
+ else {
243
+ resolve(result);
244
+ }
245
+ });
246
+ // 处理 Worker 错误
247
+ worker.on('error', (error) => {
248
+ clearTimeout(timer);
249
+ worker.terminate();
250
+ reject(error);
251
+ });
252
+ // 发送代码到 Worker
253
+ worker.postMessage(code);
254
+ });
255
+ };
256
+ exports.executeJavaScriptInWorker = executeJavaScriptInWorker;
257
+ const hashCode = (str) => {
258
+ let hash = 0;
259
+ for (let i = 0; i < str.length; i++) {
260
+ const character = str.charCodeAt(i);
261
+ hash = (hash << 5) - hash + character;
262
+ hash = hash & hash; // Convert to 32bit integer
263
+ }
264
+ return hash;
265
+ };
266
+ exports.hashCode = hashCode;
267
+ const random = (min, max) => {
268
+ if (min >= max)
269
+ return min;
270
+ const range = max - min;
271
+ const rand = Math.random();
272
+ return min + Math.round(rand * range);
273
+ };
274
+ exports.random = random;
275
+ /** 转换时间描述文本为标准时间对象 */
276
+ const transformDate = (input) => {
277
+ if (['刚刚', '几秒前', 'just now', 'now', 'Now', 'Gerade', 'Jetzt'].includes(input)) {
278
+ return new Date();
279
+ }
280
+ if (['Today', 'TODAY', 'Heute'].includes(input)) {
281
+ return (0, moment_1.default)((0, moment_1.default)().format('YYYY-MM-DD')).toDate();
282
+ }
283
+ if (['昨天', 'Yesterday', 'Gestern'].includes(input)) {
284
+ return (0, moment_1.default)((0, moment_1.default)().format('YYYY-MM-DD')).subtract(1, 'd').toDate();
285
+ }
286
+ if (['前天'].includes(input)) {
287
+ return (0, moment_1.default)((0, moment_1.default)().format('YYYY-MM-DD')).subtract(2, 'd').toDate();
288
+ }
289
+ const yesterdayDateRegex = /(?<=^昨天\s*)(\d+:\d+)$/;
290
+ const yesterdayDateResult = input.match(yesterdayDateRegex);
291
+ if (yesterdayDateResult) {
292
+ return (0, moment_1.default)((0, moment_1.default)(yesterdayDateResult[0], 'HH:mm')).subtract(1, 'd').toDate();
293
+ }
294
+ const threedayDateRegex = /(?<=^前天\s*)(\d+:\d+)$/;
295
+ const threedayDateDateResult = input.match(threedayDateRegex);
296
+ if (threedayDateDateResult) {
297
+ return (0, moment_1.default)((0, moment_1.default)(threedayDateDateResult[0], 'HH:mm')).subtract(2, 'd').toDate();
298
+ }
299
+ const secondRegex = /^(\d+)(?=\s*秒前$|\s*seconds? ago$|\s*s$)|(?<=^hace\s*|^vor\s*|^Il y a\s*)(\d+)(?=\s*segundos?$|\s*Sekunden?$|\s*secondes?$)/i;
300
+ const secondResult = input.match(secondRegex);
301
+ if (secondResult) {
302
+ const x = parseInt(secondResult[0]);
303
+ return (0, moment_1.default)().subtract(x, 's').toDate();
304
+ }
305
+ const minuteRegex = /^(\d+)(?=\s*分钟前$|\s*分前$|\s*minutes? ago$|\s*m$|\s*Min\.$)|(?<=^hace\s*|^vor\s*|^Il y a\s*)(\d+)(?=\s*minutos?$|\s*Minuten?$|\s*minutes?$)/i;
306
+ const minuteResult = input.match(minuteRegex);
307
+ if (minuteResult) {
308
+ const x = parseInt(minuteResult[0]);
309
+ return (0, moment_1.default)().subtract(x, 'm').toDate();
310
+ }
311
+ const hourRegex = /^(\d+)(?=\s*小时前$|\s*時間前$|\s*hours? ago$|\s*h$|\s*Std\.$)|(?<=^hace\s*|^vor\s*|^Il y a\s*)(\d+)(?=\s*horas?$|\s*Stunden?$|\s*heures?$)/i;
312
+ const hourResult = input.match(hourRegex);
313
+ if (hourResult) {
314
+ const x = parseInt(hourResult[0]);
315
+ return (0, moment_1.default)().subtract(x, 'h').toDate();
316
+ }
317
+ const dayRegex = /^(\d+)(?=\s*天前$|\s*日前$|\s*days? ago$|\s*d$|\s*Tage?$)|(?<=^hace\s*|^vor\s*|^Il y a\s*)(\d+)(?=\s*días?$|\s*Tag(en)?$|\s*jours?$)/i;
318
+ const dayResult = input.match(dayRegex);
319
+ if (dayResult) {
320
+ const x = parseInt(dayResult[0]);
321
+ return (0, moment_1.default)().subtract(x, 'd').toDate();
322
+ }
323
+ const weekRegex = /^(\d+)(?=\s*周前$|\s*週間前$|\s*weeks? ago$|\s*w$|\s*Wochen?$)|(?<=^hace\s*|^vor\s*|^Il y a\s*)(\d+)(?=\s*semanas?$|\s*Wochen?$|\s*semaines?$)/i;
324
+ const weekResult = input.match(weekRegex);
325
+ if (weekResult) {
326
+ const x = parseInt(weekResult[0]);
327
+ return (0, moment_1.default)().subtract(x, 'w').toDate();
328
+ }
329
+ const monthRegex = /^(\d+)(?=\s*个月前$|\s*か月前$|\s*months? ago$|\s*mo$|\s*Monate?$)|(?<=^hace\s*|^vor\s*|^Il y a\s*)(\d+)(?=\s*mes(es)?$|\s*Monat(en)?$|\s*mois$)/i;
330
+ const monthResult = input.match(monthRegex);
331
+ if (monthResult) {
332
+ const x = parseInt(monthResult[0]);
333
+ return (0, moment_1.default)().subtract(x, 'M').toDate();
334
+ }
335
+ const yearRegex = /^(\d+)(?=\s*年前$|\s*years? ago$|\s*y$)|(?<=^hace\s*|^vor\s*|^Il y a\s*)(\d+)(?=\s*años?$|\s*Jahr(en)?$|\s*ans?$)/i;
336
+ const yearResult = input.match(yearRegex);
337
+ if (yearResult) {
338
+ const x = parseInt(yearResult[0]);
339
+ return (0, moment_1.default)().subtract(x, 'y').toDate();
340
+ }
341
+ };
342
+ exports.transformDate = transformDate;
343
+ const repairURL = (url) => {
344
+ /** 先判断是否是本地路径 */
345
+ if ((0, fs_1.existsSync)(url)) {
346
+ url = `file://${url}`;
347
+ }
348
+ else {
349
+ const regExp = /^(http:\/\/|https:\/\/|ftp:\/\/|file:\/\/)/i;
350
+ if (!regExp.test(url)) {
351
+ url = `http://${url}`;
352
+ }
353
+ }
354
+ return url;
355
+ };
356
+ exports.repairURL = repairURL;
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@octopus/engine",
3
+ "productName": "octoparse-engine",
4
+ "version": "1.0.21",
5
+ "description": "run octoparse in real browser",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": "./dist/index.js",
11
+ "./transformer": "./dist/translator/translator.js",
12
+ "./enums": "./dist/enums/index.js",
13
+ "./browser": "./dist/browser.js",
14
+ "./type": "./dist/type.js",
15
+ "./settings": "./dist/settings.js"
16
+ },
17
+ "typesVersions": {
18
+ "*": {
19
+ "transformer": [
20
+ "./dist/translator/translator.d.ts"
21
+ ],
22
+ "enums": [
23
+ "./dist/enums/index.d.ts"
24
+ ],
25
+ "browser": [
26
+ "./dist/browser.d.ts"
27
+ ],
28
+ "type": [
29
+ "./dist/type.d.ts"
30
+ ],
31
+ "settings": [
32
+ "./dist/settings.d.ts"
33
+ ]
34
+ }
35
+ },
36
+ "scripts": {
37
+ "lint": "eslint --ext .ts,.tsx .",
38
+ "clean": "rimraf dist tsconfig.tsbuildinfo",
39
+ "build": "tsc -b --force && node ./build.mjs dist && node ./obfuscate.mjs",
40
+ "build:dev": "tsc -b --force && node ./build.mjs dist",
41
+ "pub": "pnpm build & npm publish --registry http://101.34.117.214:4873 --no-git-checks"
42
+ },
43
+ "files": [
44
+ "dist"
45
+ ],
46
+ "devDependencies": {
47
+ "@types/node": "22.9.0",
48
+ "@types/ws": "8.5.14",
49
+ "@types/xmldom": "0.1.34",
50
+ "glob": "11.0.3",
51
+ "javascript-obfuscator": "4.1.1",
52
+ "typescript": "catalog:"
53
+ },
54
+ "keywords": [],
55
+ "author": "octo",
56
+ "license": "MIT",
57
+ "dependencies": {}
58
+ }
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "octoparse-cli",
3
+ "version": "0.1.14",
4
+ "description": "Standalone Octoparse engine CLI that runs local extraction without the Electron client.",
5
+ "private": false,
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/octoparse/octoparse-cli.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/octoparse/octoparse-cli/issues"
13
+ },
14
+ "homepage": "https://github.com/octoparse/octoparse-cli#readme",
15
+ "files": [
16
+ "dist",
17
+ "schemas",
18
+ "examples",
19
+ "README.md",
20
+ "SECURITY.md",
21
+ "RUNTIME_SECURITY_NOTICE.txt"
22
+ ],
23
+ "bin": {
24
+ "octoparse": "dist/index.js"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "dev": "tsx src/index.ts",
29
+ "prepack": "node scripts/prepare-engine-bundle.mjs",
30
+ "release": "node scripts/release.mjs",
31
+ "start": "node dist/index.js",
32
+ "test": "npm run build && node --test --test-concurrency=1 test/*.test.mjs",
33
+ "typecheck": "tsc --noEmit"
34
+ },
35
+ "engines": {
36
+ "node": ">=20"
37
+ },
38
+ "dependencies": {
39
+ "@octopus/bpmn": "1.0.4",
40
+ "@octopus/engine": "1.0.21",
41
+ "@puppeteer/browsers": "2.8.0",
42
+ "@types/lodash": "^4.14.0",
43
+ "@types/lodash-es": "4.17.12",
44
+ "async": "^2.6.4",
45
+ "axios": "1.15.0",
46
+ "bpmn-moddle": "^0.14.1",
47
+ "debug": "^2.6.9",
48
+ "fast-xml-parser": "4.5.0",
49
+ "iconv-lite": "0.6.3",
50
+ "iso8601-duration": "^1.3.0",
51
+ "jsonpath-plus": "10.3.0",
52
+ "lodash": "4.17.21",
53
+ "lodash-es": "4.17.21",
54
+ "moment": "2.30.1",
55
+ "puppeteer-core": "24.39.1",
56
+ "puppeteer-extra": "3.3.6",
57
+ "puppeteer-extra-plugin-block-resources": "2.4.3",
58
+ "puppeteer-proxy": "1.0.3",
59
+ "rebrowser-puppeteer-core": "24.8.1",
60
+ "sax": "1.4.1",
61
+ "setimmediate": "1.0.5",
62
+ "uuid": "10.0.0",
63
+ "ws": "^8.18.3",
64
+ "xml2js": "0.4.23",
65
+ "xmlbuilder": "15.1.1",
66
+ "xmldom": "0.6.0",
67
+ "xpath": "0.0.34"
68
+ },
69
+ "bundledDependencies": [
70
+ "@octopus/bpmn",
71
+ "@octopus/engine"
72
+ ],
73
+ "devDependencies": {
74
+ "@types/node": "^20.0.0",
75
+ "@types/ws": "^8.5.14",
76
+ "tsx": "^4.0.0",
77
+ "typescript": "^5.0.0"
78
+ }
79
+ }