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,198 @@
1
+ 'use strict';
2
+
3
+ const pub = {};
4
+
5
+ pub.getDefinitionId = function(moddleContext) {
6
+ return moddleContext.rootHandler.element.id;
7
+ };
8
+
9
+ pub.getProcesses = function(moddleContext) {
10
+ return moddleContext.rootHandler.element.rootElements.filter((e) => e.$type === 'bpmn:Process');
11
+ };
12
+
13
+ pub.getExecutableProcessId = function(moddleContext) {
14
+ const executable = moddleContext.rootHandler.element.rootElements.find((e) => e.$type === 'bpmn:Process' && e.isExecutable);
15
+ return executable && executable.id;
16
+ };
17
+
18
+ pub.getOutboundSequenceFlows = function(moddleContext, activityId) {
19
+ return moddleContext.references.filter((r) => r.property === 'bpmn:sourceRef' && r.id === activityId);
20
+ };
21
+
22
+ pub.hasInboundSequenceFlows = function(moddleContext, activityId) {
23
+ return moddleContext.references.some((r) => r.property === 'bpmn:targetRef' && r.id === activityId);
24
+ };
25
+
26
+ pub.getInboundSequenceFlows = function(moddleContext, activityId) {
27
+ return moddleContext.references.filter((r) => r.property === 'bpmn:targetRef' && r.id === activityId);
28
+ };
29
+
30
+ pub.getSequenceFlowTargetId = function(moddleContext, sequenceFlowId) {
31
+ const target = moddleContext.references.find((r) => r.property === 'bpmn:targetRef' && r.element.id === sequenceFlowId);
32
+ return target && target.id;
33
+ };
34
+
35
+ pub.isDefaultSequenceFlow = function(moddleContext, sequenceFlowId) {
36
+ return moddleContext.references.some((r) => r.property === 'bpmn:default' && r.id === sequenceFlowId);
37
+ };
38
+
39
+ pub.getTargetProcess = function(moddleContext, targetId) {
40
+ const elements = moddleContext.rootHandler.element.rootElements;
41
+ return elements.find((e) => e.$type === 'bpmn:Process' && e.flowElements.some((f) => f.id === targetId));
42
+ };
43
+
44
+ pub.getActivityIO = function(moddleContext, activityId) {
45
+ const activity = moddleContext.elementsById[activityId];
46
+ if (!activity.extensionElements || !activity.extensionElements.values) return;
47
+ const element = activity.extensionElements.values.find((v) => v.$type === 'camunda:InputOutput');
48
+ return element;
49
+ };
50
+
51
+ pub.getActivityProperties = function(moddleContext, activityId) {
52
+ const activity = moddleContext.elementsById[activityId];
53
+ if (!activity) return;
54
+ if (!activity.extensionElements) return;
55
+
56
+ const properties = activity.extensionElements.values.find((e) => e.$type.toLowerCase() === 'camunda:properties');
57
+ if (!properties || !properties.values) return;
58
+
59
+ return properties;
60
+ };
61
+
62
+ pub.getActivityFormData = function(activity) {
63
+ let element;
64
+ if (activity.extensionElements && activity.extensionElements.values) {
65
+ element = activity.extensionElements.values.find((v) => v.$type === 'camunda:FormData');
66
+ }
67
+ if (!element && activity.formKey) {
68
+ return {formKey: activity.formKey};
69
+ }
70
+
71
+ return element;
72
+ };
73
+
74
+ pub.getAllOutboundSequenceFlows = function(moddleContext, scopeActivityId) {
75
+ const scope = moddleContext.elementsById[scopeActivityId];
76
+ const outbound = moddleContext.references.filter((r) => {
77
+ if (r.property !== 'bpmn:sourceRef') return false;
78
+ switch (r.element.$type) {
79
+ case 'bpmn:MessageFlow':
80
+ case 'bpmn:SequenceFlow':
81
+ break;
82
+ default:
83
+ return false;
84
+ }
85
+
86
+ const sourceId = r.id;
87
+ return scope.flowElements.some((e) => e.id === sourceId);
88
+ });
89
+
90
+ return outbound;
91
+ };
92
+
93
+ pub.getChildOutputNames = function(moddleContext, taskId) {
94
+ const contextElement = moddleContext.elementsById[taskId];
95
+ if (!contextElement.dataOutputAssociations) return [];
96
+
97
+ return contextElement.dataOutputAssociations.map((association) => {
98
+ return pub.getDataObjectFromAssociation(moddleContext, association.id);
99
+ });
100
+ };
101
+
102
+ pub.getDataObjectFromAssociation = function(moddleContext, associationId) {
103
+ const association = moddleContext.references.find((r) => r.element.$type === 'bpmn:DataOutputAssociation' && r.element.id === associationId && r.property === 'bpmn:targetRef');
104
+ if (!association) return null;
105
+
106
+ const potentialRef = moddleContext.elementsById[association.id];
107
+ if (potentialRef.$type === 'bpmn:DataObject') return potentialRef;
108
+
109
+ return pub.getDataObjectFromRef(moddleContext, potentialRef.id);
110
+ };
111
+
112
+ pub.getDataObjectFromRef = function(moddleContext, refId) {
113
+ const ref = moddleContext.references.find((r) => r.element.$type === 'bpmn:DataObjectReference' && r.element.id === refId && r.property === 'bpmn:dataObjectRef');
114
+ if (!ref) return null;
115
+
116
+ return moddleContext.elementsById[ref.id];
117
+ };
118
+
119
+ pub.isTerminationElement = function(element) {
120
+ if (!element) return false;
121
+ if (!element.eventDefinitions) return false;
122
+ return element.eventDefinitions.some((e) => e.$type === 'bpmn:TerminateEventDefinition');
123
+ };
124
+
125
+ pub.getActivities = function(moddleContext, scopeActivityId) {
126
+ const elements = [];
127
+ const scope = moddleContext.elementsById[scopeActivityId];
128
+
129
+ if (!scope.flowElements) return elements;
130
+
131
+ Object.keys(moddleContext.elementsById).forEach((key) => {
132
+ if (!scope.flowElements.some((e) => e.id === key)) return;
133
+
134
+ const element = moddleContext.elementsById[key];
135
+ switch (element.$type) {
136
+ case 'bpmn:SequenceFlow':
137
+ case 'bpmn:Definitions':
138
+ break;
139
+ default:
140
+ elements.push(element);
141
+ }
142
+ });
143
+
144
+ return elements;
145
+ };
146
+
147
+ pub.getBoundaryEvents = function(moddleContext, scopeId) {
148
+ return moddleContext.references.filter((r) => r.property === 'bpmn:attachedToRef' && r.id === scopeId);
149
+ };
150
+
151
+ pub.getAttachedToActivity = function(moddleContext, eventId) {
152
+ return moddleContext.references.find((r) => r.property === 'bpmn:attachedToRef' && r.element.id === eventId);
153
+ };
154
+
155
+ pub.hasAttachedErrorEvent = function(moddleContext, activityId) {
156
+ const boundaryEvents = pub.getBoundaryEvents(moddleContext, activityId);
157
+ return boundaryEvents.some((e) => e.element.eventDefinitions.some((d) => d.$type === 'bpmn:ErrorEventDefinition'));
158
+ };
159
+
160
+ pub.getElementService = function(element) {
161
+ if (!element) return;
162
+ if (!element.extensionElements) return;
163
+
164
+ const connector = element.extensionElements.values.find((e) => e.$type === 'camunda:Connector');
165
+ if (connector) {
166
+ return {
167
+ connector: connector
168
+ };
169
+ }
170
+
171
+ const properties = element.extensionElements.values.find((e) => e.$type.toLowerCase() === 'camunda:properties');
172
+ if (!properties) return;
173
+ const property = (properties.values || properties.$children).find((c) => c.name === 'service');
174
+ if (!property) return;
175
+
176
+ return {
177
+ name: property.value
178
+ };
179
+ };
180
+
181
+ pub.cloneContext = (context) => {
182
+ const clonedContext = {
183
+ rootHandler: {
184
+ element: JSON.parse(JSON.stringify(context.rootHandler.element))
185
+ },
186
+ elementsById: JSON.parse(JSON.stringify(context.elementsById)),
187
+ references: JSON.parse(JSON.stringify(context.references)),
188
+ warnings: context.warnings.slice()
189
+ };
190
+ return clonedContext;
191
+ };
192
+
193
+ pub.getActivityErrorEventDefinition = function(activity) {
194
+ if (!activity || !activity.eventDefinitions) return;
195
+ return activity.eventDefinitions.find((ed) => ed.$type === 'bpmn:ErrorEventDefinition');
196
+ };
197
+
198
+ module.exports = pub;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const contextHelper = require('../context-helper');
4
+ const Activity = require('../activities/Activity');
5
+
6
+ const internals = {};
7
+
8
+ module.exports = internals.Event = function() {
9
+ Activity.apply(this, arguments);
10
+ this.isEnd = true;
11
+ this.taken = false;
12
+ this.terminate = contextHelper.isTerminationElement(this.activity);
13
+ };
14
+
15
+ internals.Event.prototype = Object.create(Activity.prototype);
16
+
17
+ internals.Event.prototype.run = function() {
18
+ Activity.prototype.run.call(this);
19
+ this.taken = true;
20
+ this.emit('end', this);
21
+ this.leave();
22
+ };
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ const EventDefinition = require('../activities/EventDefinition');
4
+
5
+ const internals = {};
6
+
7
+ module.exports = internals.ErrorEventDefinition = function() {
8
+ EventDefinition.apply(this, arguments);
9
+ this.saveToVariables = false;
10
+ this.eventDefinition = this.parentContext.getErrorEventDefinition(this.activity);
11
+ };
12
+
13
+ internals.ErrorEventDefinition.prototype = Object.create(EventDefinition.prototype);
14
+
15
+ internals.ErrorEventDefinition.prototype.onAttachedError = function(err, sourceActivity) {
16
+ if (sourceActivity) {
17
+ this._debug(`<${this.id}> error from <${sourceActivity.id}> caught:`, err.message);
18
+ }
19
+
20
+ const output = getErrorCodeAndMessage.call(this, err);
21
+
22
+ EventDefinition.prototype.complete.call(this, output);
23
+ };
24
+
25
+ function getErrorCodeAndMessage(err) {
26
+ const result = {};
27
+
28
+ if (err.message && this.eventDefinition.errorMessageVariable) {
29
+ this.saveToVariables = true;
30
+ result[this.eventDefinition.errorMessageVariable] = err.message;
31
+ }
32
+
33
+ if (err.code && this.eventDefinition.errorCodeVariable) {
34
+ this.saveToVariables = true;
35
+ result[this.eventDefinition.errorCodeVariable] = err.code;
36
+ }
37
+
38
+ if (!this.saveToVariables) return;
39
+
40
+ return result;
41
+ }
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const EventDefinition = require('../activities/EventDefinition');
4
+
5
+ const internals = {};
6
+
7
+ module.exports = internals.MessageEvent = function() {
8
+ EventDefinition.apply(this, arguments);
9
+ };
10
+
11
+ internals.MessageEvent.prototype = Object.create(EventDefinition.prototype);
12
+
13
+ internals.MessageEvent.prototype.signal = function(message) {
14
+ this.message = message;
15
+ this.taken = true;
16
+
17
+ this._debug(`<${this.id}>`, 'signaled');
18
+ this.complete(message);
19
+ };
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ const Activity = require('../activities/Activity');
4
+
5
+ const internals = {};
6
+
7
+ module.exports = internals.StartEvent = function(activity, parent) {
8
+ Activity.call(this, activity, parent);
9
+ this.isStart = true;
10
+ this.isStartEvent = true;
11
+ this.form = this.parentContext.getActivityForm(activity);
12
+ this.saveToVariables = !!this.form;
13
+ };
14
+
15
+ internals.StartEvent.prototype = Object.create(Activity.prototype);
16
+
17
+ internals.StartEvent.prototype.run = function() {
18
+ this.enter();
19
+ this.emit('start', this);
20
+
21
+ if (this.form) {
22
+ this.form.init();
23
+ this.waiting = true;
24
+ return this.emit('wait', this);
25
+ }
26
+
27
+ this.emit('end', this);
28
+ this.takeAllOutbound();
29
+ };
30
+
31
+ internals.StartEvent.prototype.signal = function(input) {
32
+ if (!this.waiting) {
33
+ return this.emit('error', Error(`<${this.id}> is not waiting`), this);
34
+ }
35
+
36
+ this.waiting = false;
37
+
38
+ this._debug(`<${this.id}>`, 'signaled', input);
39
+ this.complete(input);
40
+ };
41
+
42
+ internals.StartEvent.prototype.complete = function(output) {
43
+ const ioOutput = this.getOutput(output);
44
+ this.emit('end', this, ioOutput);
45
+ this.takeAllOutbound(ioOutput);
46
+ };
47
+
48
+ internals.StartEvent.prototype.getState = function() {
49
+ const state = Activity.prototype.getState.call(this);
50
+ if (this.waiting) state.waiting = this.waiting;
51
+ if (this.form) {
52
+ state.form = this.form.getState();
53
+ }
54
+ return state;
55
+ };
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ const EventDefinition = require('../activities/EventDefinition');
4
+ const expressions = require('../expressions');
5
+ const iso8601duration = require('iso8601-duration');
6
+
7
+ const internals = {};
8
+
9
+ module.exports = internals.TimerEvent = function() {
10
+ EventDefinition.apply(this, arguments);
11
+ this.duration = this.eventDefinition.timeDuration.body;
12
+ this._debug(`<${this.id}>`, `timeout ${this.duration}`);
13
+ };
14
+
15
+ internals.TimerEvent.prototype = Object.create(EventDefinition.prototype);
16
+
17
+ internals.TimerEvent.prototype.run = function() {
18
+ delete this.stoppedAt;
19
+ this.startedAt = new Date();
20
+
21
+ this.timeout = this.hasOwnProperty('timeout') ? this.timeout : resolveDuration.call(this, this.duration);
22
+ this._debug(`<${this.id}>`, `run for duration ${this.timeout}ms`);
23
+
24
+ this.timer = setTimeout(() => {
25
+ this._debug(`<${this.id}>`, 'timed out');
26
+ delete this.timeout;
27
+ this.complete();
28
+ }, this.timeout);
29
+ this.emit('start', this);
30
+ EventDefinition.prototype.run.call(this);
31
+ };
32
+
33
+ internals.TimerEvent.prototype.discard = function() {
34
+ this._debug(`<${this.id}>`, `cancel timeout ${this.timeout}ms`);
35
+ clearTimeout(this.timer);
36
+ delete this.timer;
37
+ EventDefinition.prototype.discard.call(this);
38
+ };
39
+
40
+ internals.TimerEvent.prototype.onAttachedEnd = function(activity) {
41
+ this._debug(`<${this.id}>`, `activity <${activity.id}> ended`);
42
+ if (this.cancelActivity) this.discard();
43
+ };
44
+
45
+ internals.TimerEvent.prototype.resume = function(state) {
46
+ if (state.hasOwnProperty('timeout')) {
47
+ this._debug(`<${this.id}>`, `resume from ${state.timeout}ms`);
48
+ this.timeout = state.timeout;
49
+ }
50
+ };
51
+
52
+ internals.TimerEvent.prototype.deactivate = function() {
53
+ EventDefinition.prototype.deactivate.apply(this, arguments);
54
+ this.stoppedAt = new Date();
55
+ if (this.timer) {
56
+ clearTimeout(this.timer);
57
+ }
58
+ };
59
+
60
+ internals.TimerEvent.prototype.getState = function() {
61
+ const state = EventDefinition.prototype.getState.apply(this, arguments);
62
+ if (!this.entered) return state;
63
+
64
+ const stoppedAt = this.stoppedAt || new Date();
65
+
66
+ return Object.assign(state, {
67
+ timeout: this.timeout - (stoppedAt - this.startedAt),
68
+ attachedToId: this.attachedTo.id
69
+ });
70
+ };
71
+
72
+ function resolveDuration(duration) {
73
+ duration = expressions(duration, this.parentContext.getFrozenVariablesAndServices());
74
+ return iso8601duration.toSeconds(iso8601duration.parse(duration)) * 1000;
75
+ }
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ const getPropertyValue = require('./getPropertyValue');
4
+
5
+ const isExpressionPattern = /^\${(.+?)}$/;
6
+ const expressionPattern = /\${(.+?)}/;
7
+
8
+ function resolveExpressions(templatedString, context) {
9
+ let result = templatedString;
10
+ while (expressionPattern.test(result)) {
11
+ const expressionMatch = result.match(expressionPattern);
12
+ const innerProperty = expressionMatch[1];
13
+
14
+ if (innerProperty === 'true') {
15
+ return true;
16
+ } else if (innerProperty === 'false') {
17
+ return false;
18
+ }
19
+
20
+ const contextValue = getPropertyValue(context, innerProperty);
21
+
22
+ if (expressionMatch.input === expressionMatch[0]) {
23
+ return contextValue;
24
+ }
25
+
26
+ result = result.replace(expressionMatch[0], contextValue === undefined ? '' : contextValue);
27
+ }
28
+ return result;
29
+ }
30
+
31
+ resolveExpressions.isExpression = function(text) {
32
+ if (!text) return false;
33
+ return isExpressionPattern.test(text);
34
+ };
35
+
36
+ resolveExpressions.hasExpression = function(text) {
37
+ if (!text) return false;
38
+ return expressionPattern.test(text);
39
+ };
40
+
41
+ module.exports = resolveExpressions;
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ const Activity = require('../activities/Activity');
4
+
5
+ function ExclusiveGateway() {
6
+ Activity.apply(this, arguments);
7
+ }
8
+
9
+ ExclusiveGateway.prototype = Object.create(Activity.prototype);
10
+
11
+ ExclusiveGateway.prototype.run = function() {
12
+ Activity.prototype.run.call(this);
13
+
14
+ const input = this.getInput();
15
+ this.emit('start', this);
16
+ // 增加一个wait事件 为了可以执行前等待
17
+ if(this.type === 'bpmn:ExclusiveGateway'){
18
+ this.waiting = true;
19
+ this.emit('wait', this);
20
+ }else{
21
+ this.emit('end', this, this.getOutput(input));
22
+ this.taken = true;
23
+
24
+ takeAll.call(this, this.outbound, input);
25
+ }
26
+
27
+ };
28
+ // signal 来继续执行后面的方法
29
+ ExclusiveGateway.prototype.signal = function(childId, input) {
30
+ this._debug(`<${this.id}>`, `signal <${childId}>`);
31
+
32
+ if(this.waiting){
33
+ this.waiting = false;
34
+ this.emit('end', this, this.getOutput(input));
35
+ this.taken = true;
36
+
37
+ takeAll.call(this, this.outbound, input);
38
+ }
39
+ }
40
+
41
+ async function takeAll(outbound, input) {
42
+ this._debug(`<${this.id}>`, `take ${outbound.length} sequence flows`);
43
+
44
+ const defaultFlow = outbound.find((flow) => flow.isDefault);
45
+ const conditionalFlows = outbound.filter((flow) => !flow.isDefault);
46
+
47
+ let takenFlow;
48
+ const discardFlows = [];
49
+
50
+ for (let i = 0; i < conditionalFlows.length; i++) {
51
+ const sequenceFlow = conditionalFlows[i];
52
+ if (!takenFlow) {
53
+ let conditionRes;
54
+ let conditionResObj = sequenceFlow.evaluateCondition(input);
55
+ if(conditionResObj.then){
56
+ conditionRes = await conditionResObj;
57
+ }else{
58
+ conditionRes = conditionResObj;
59
+ }
60
+ if(conditionRes){
61
+ takenFlow = sequenceFlow;
62
+ }else{
63
+ discardFlows.push(sequenceFlow);
64
+ }
65
+ } else {
66
+ discardFlows.push(sequenceFlow);
67
+ }
68
+ }
69
+
70
+ if (!takenFlow && defaultFlow) {
71
+ this._debug(`<${this.id}> take default flow <${defaultFlow.id}>`);
72
+ defaultFlow.take();
73
+ conditionalFlows.forEach((flow) => flow.discard());
74
+ } else if (takenFlow) {
75
+ if (defaultFlow) discardFlows.push(defaultFlow);
76
+ this._debug(`<${this.id}> take conditional flow <${takenFlow.id}>`);
77
+ takenFlow.take();
78
+ discardFlows.forEach((flow) => flow.discard());
79
+ } else {
80
+ return this.emit('error', new Error(`No conditional flow was taken from <${this.id}>`), this);
81
+ }
82
+
83
+ this.leave();
84
+ }
85
+
86
+ module.exports = ExclusiveGateway;
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ const Activity = require('../activities/Activity');
4
+
5
+ function InclusiveGateway() {
6
+ Activity.apply(this, arguments);
7
+ }
8
+
9
+ InclusiveGateway.prototype = Object.create(Activity.prototype);
10
+
11
+ InclusiveGateway.prototype.run = function() {
12
+ Activity.prototype.run.call(this);
13
+
14
+ this._debug(`<${this.id}>`, 'run');
15
+ this.emit('start', this);
16
+ takeAll.call(this, this.outbound, this.parentContext.variables);
17
+ };
18
+
19
+ function takeAll(outbound) {
20
+ this._debug(`<${this.id}>`, `take ${outbound.length} sequence flows`);
21
+ const input = this.getInput();
22
+
23
+ const defaultFlow = outbound.find((flow) => flow.isDefault);
24
+ const conditionalFlows = outbound.filter((flow) => !flow.isDefault);
25
+
26
+ const takenFlows = [];
27
+ const discardFlows = [];
28
+
29
+ for (let i = 0; i < conditionalFlows.length; i++) {
30
+ const sequenceFlow = conditionalFlows[i];
31
+ if (sequenceFlow.evaluateCondition(input)) {
32
+ takenFlows.push(sequenceFlow);
33
+ } else {
34
+ discardFlows.push(sequenceFlow);
35
+ }
36
+ }
37
+
38
+ if (!takenFlows.length && defaultFlow) {
39
+ this._debug(`<${this.id}> take default flow <${defaultFlow.id}>`);
40
+ defaultFlow.take();
41
+ conditionalFlows.forEach((flow) => flow.discard());
42
+ } else if (takenFlows.length) {
43
+ if (defaultFlow) discardFlows.push(defaultFlow);
44
+ takenFlows.forEach((flow) => {
45
+ this._debug(`<${this.id}> take conditional flow <${flow.id}>`);
46
+ flow.take();
47
+ });
48
+ discardFlows.forEach((flow) => flow.discard());
49
+ } else {
50
+ return this.emit('error', new Error(`No conditional flow was taken from <${this.id}>`), this);
51
+ }
52
+
53
+ this.leave();
54
+ }
55
+
56
+ module.exports = InclusiveGateway;