@api-client/core 0.6.30 → 0.7.1

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 (324) hide show
  1. package/build/browser.d.ts +6 -14
  2. package/build/browser.js +11 -16
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +8 -20
  5. package/build/index.js +13 -25
  6. package/build/index.js.map +1 -1
  7. package/build/src/amf/ApiSchemaValues.d.ts +2 -0
  8. package/build/src/amf/ApiSchemaValues.js +29 -23
  9. package/build/src/amf/ApiSchemaValues.js.map +1 -1
  10. package/build/src/authorization/lib/Utils.d.ts +1 -1
  11. package/build/src/cookies/CookieJar.d.ts +23 -0
  12. package/build/src/cookies/CookieJar.js +3 -0
  13. package/build/src/cookies/CookieJar.js.map +1 -0
  14. package/build/src/cookies/CookieParser.d.ts +67 -0
  15. package/build/src/cookies/CookieParser.js +316 -0
  16. package/build/src/cookies/CookieParser.js.map +1 -0
  17. package/build/src/cookies/InMemoryCookieJar.d.ts +12 -0
  18. package/build/src/cookies/InMemoryCookieJar.js +68 -0
  19. package/build/src/cookies/InMemoryCookieJar.js.map +1 -0
  20. package/build/src/cookies/Punycode.d.ts +12 -0
  21. package/build/src/cookies/Punycode.js +124 -0
  22. package/build/src/cookies/Punycode.js.map +1 -0
  23. package/build/src/data/RequestDataExtractor.d.ts +8 -7
  24. package/build/src/data/RequestDataExtractor.js +8 -10
  25. package/build/src/data/RequestDataExtractor.js.map +1 -1
  26. package/build/src/events/CustomEvent.js +5 -0
  27. package/build/src/events/CustomEvent.js.map +1 -1
  28. package/build/src/events/EventTypes.d.ts +43 -43
  29. package/build/src/events/amf/AmfEventTypes.d.ts +4 -4
  30. package/build/src/events/authorization/AuthorizationEventTypes.d.ts +4 -4
  31. package/build/src/events/cookies/CookieEventTypes.d.ts +9 -9
  32. package/build/src/events/encryption/EncryptionEventTypes.d.ts +2 -2
  33. package/build/src/events/environment/EnvironmentEventTypes.d.ts +1 -1
  34. package/build/src/events/models/ModelEventTypes.d.ts +7 -7
  35. package/build/src/events/process/ProcessEventTypes.d.ts +3 -3
  36. package/build/src/events/reporting/ReportingEventTypes.d.ts +1 -1
  37. package/build/src/events/telemetry/TelemetryEventTypes.d.ts +6 -6
  38. package/build/src/events/transport/TransportEventTypes.d.ts +6 -6
  39. package/build/src/events/transport/TransportEvents.d.ts +2 -2
  40. package/build/src/mocking/ProjectMock.d.ts +3 -2
  41. package/build/src/mocking/ProjectMock.js +3 -3
  42. package/build/src/mocking/ProjectMock.js.map +1 -1
  43. package/build/src/mocking/lib/App.d.ts +36 -0
  44. package/build/src/mocking/lib/App.js +70 -0
  45. package/build/src/mocking/lib/App.js.map +1 -0
  46. package/build/src/models/{arc/ArcProject.d.ts → AppProject.d.ts} +296 -134
  47. package/build/src/models/{arc/ArcProject.js → AppProject.js} +436 -79
  48. package/build/src/models/AppProject.js.map +1 -0
  49. package/build/src/models/AppRequest.d.ts +69 -0
  50. package/build/src/models/{arc/ArcHttpRequest.js → AppRequest.js} +53 -17
  51. package/build/src/models/AppRequest.js.map +1 -0
  52. package/build/src/models/ClientCertificate.d.ts +2 -2
  53. package/build/src/models/Environment.d.ts +8 -1
  54. package/build/src/models/Environment.js +21 -0
  55. package/build/src/models/Environment.js.map +1 -1
  56. package/build/src/models/HostRule.d.ts +2 -2
  57. package/build/src/models/HttpCookie.d.ts +63 -12
  58. package/build/src/models/HttpCookie.js +178 -44
  59. package/build/src/models/HttpCookie.js.map +1 -1
  60. package/build/src/models/HttpHistory.d.ts +8 -3
  61. package/build/src/models/HttpHistory.js +3 -3
  62. package/build/src/models/HttpHistory.js.map +1 -1
  63. package/build/src/models/HttpProject.d.ts +34 -1
  64. package/build/src/models/HttpProject.js +104 -8
  65. package/build/src/models/HttpProject.js.map +1 -1
  66. package/build/src/models/ProjectFolder.d.ts +2 -0
  67. package/build/src/models/ProjectFolder.js +14 -0
  68. package/build/src/models/ProjectFolder.js.map +1 -1
  69. package/build/src/models/ProjectItem.d.ts +2 -0
  70. package/build/src/models/ProjectItem.js +20 -0
  71. package/build/src/models/ProjectItem.js.map +1 -1
  72. package/build/src/models/ProjectParent.js.map +1 -1
  73. package/build/src/models/ProjectRequest.d.ts +3 -2
  74. package/build/src/models/ProjectRequest.js.map +1 -1
  75. package/build/src/models/Property.d.ts +2 -2
  76. package/build/src/models/Property.js +2 -2
  77. package/build/src/models/Property.js.map +1 -1
  78. package/build/src/models/Request.d.ts +16 -8
  79. package/build/src/models/Request.js +20 -15
  80. package/build/src/models/Request.js.map +1 -1
  81. package/build/src/models/RequestAuthorization.js.map +1 -1
  82. package/build/src/models/RequestUiMeta.d.ts +0 -14
  83. package/build/src/models/RequestUiMeta.js +1 -10
  84. package/build/src/models/RequestUiMeta.js.map +1 -1
  85. package/build/src/models/Server.d.ts +1 -2
  86. package/build/src/models/Server.js.map +1 -1
  87. package/build/src/models/http-actions/HttpActions.d.ts +256 -0
  88. package/build/src/models/http-actions/HttpActions.js +46 -0
  89. package/build/src/models/http-actions/HttpActions.js.map +1 -0
  90. package/build/src/models/http-actions/LegacyTranslator.d.ts +17 -0
  91. package/build/src/models/http-actions/LegacyTranslator.js +222 -0
  92. package/build/src/models/http-actions/LegacyTranslator.js.map +1 -0
  93. package/build/src/models/store/Backend.d.ts +136 -1
  94. package/build/src/models/store/File.d.ts +1 -1
  95. package/build/src/models/store/File.js +2 -0
  96. package/build/src/models/store/File.js.map +1 -1
  97. package/build/src/models/store/User.d.ts +3 -3
  98. package/build/src/runtime/http-engine/CoreEngine.d.ts +2 -0
  99. package/build/src/runtime/http-engine/CoreEngine.js +1 -0
  100. package/build/src/runtime/http-engine/CoreEngine.js.map +1 -1
  101. package/build/src/runtime/http-engine/HttpEngine.d.ts +13 -0
  102. package/build/src/runtime/http-engine/HttpEngine.js +39 -31
  103. package/build/src/runtime/http-engine/HttpEngine.js.map +1 -1
  104. package/build/src/runtime/{actions/ConditionRunner.d.ts → http-runner/ConditionCheck.d.ts} +2 -2
  105. package/build/src/runtime/{actions/ConditionRunner.js → http-runner/ConditionCheck.js} +2 -2
  106. package/build/src/runtime/http-runner/ConditionCheck.js.map +1 -0
  107. package/build/src/runtime/http-runner/HttpFlowRunner.d.ts +62 -0
  108. package/build/src/runtime/http-runner/HttpFlowRunner.js +217 -0
  109. package/build/src/runtime/http-runner/HttpFlowRunner.js.map +1 -0
  110. package/build/src/runtime/{node/RequestFactory.d.ts → http-runner/HttpRequestRunner.d.ts} +40 -54
  111. package/build/src/runtime/http-runner/HttpRequestRunner.js +316 -0
  112. package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -0
  113. package/build/src/runtime/http-runner/HttpRuntimeEnvironment.d.ts +25 -0
  114. package/build/src/runtime/http-runner/HttpRuntimeEnvironment.js +2 -0
  115. package/build/src/runtime/http-runner/HttpRuntimeEnvironment.js.map +1 -0
  116. package/build/src/runtime/http-runner/RequestAuthorizationProcessor.d.ts +56 -0
  117. package/build/src/runtime/http-runner/RequestAuthorizationProcessor.js +143 -0
  118. package/build/src/runtime/http-runner/RequestAuthorizationProcessor.js.map +1 -0
  119. package/build/src/runtime/http-runner/RequestCookiesProcessor.d.ts +24 -0
  120. package/build/src/runtime/http-runner/RequestCookiesProcessor.js +65 -0
  121. package/build/src/runtime/http-runner/RequestCookiesProcessor.js.map +1 -0
  122. package/build/src/runtime/node/InteropInterfaces.d.ts +21 -6
  123. package/build/src/runtime/node/ProjectParallelRunner.js +3 -1
  124. package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
  125. package/build/src/runtime/node/ProjectRequestRunner.d.ts +24 -10
  126. package/build/src/runtime/node/ProjectRequestRunner.js +116 -45
  127. package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
  128. package/build/src/runtime/node/ProjectRunner.d.ts +5 -7
  129. package/build/src/runtime/node/ProjectRunner.js +30 -14
  130. package/build/src/runtime/node/ProjectRunner.js.map +1 -1
  131. package/build/src/runtime/node/ProjectRunnerWorker.js +3 -0
  132. package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
  133. package/build/src/runtime/reporters/Reporter.d.ts +5 -0
  134. package/build/src/runtime/reporters/Reporter.js.map +1 -1
  135. package/build/src/runtime/store/AppSdk.d.ts +185 -0
  136. package/build/src/runtime/store/AppSdk.js +704 -0
  137. package/build/src/runtime/store/AppSdk.js.map +1 -0
  138. package/build/src/runtime/store/FilesSdk.js +4 -4
  139. package/build/src/runtime/store/FilesSdk.js.map +1 -1
  140. package/build/src/runtime/store/HistorySdk.js +2 -2
  141. package/build/src/runtime/store/HistorySdk.js.map +1 -1
  142. package/build/src/runtime/store/RouteBuilder.d.ts +17 -2
  143. package/build/src/runtime/store/RouteBuilder.js +60 -3
  144. package/build/src/runtime/store/RouteBuilder.js.map +1 -1
  145. package/build/src/runtime/store/Sdk.d.ts +5 -0
  146. package/build/src/runtime/store/Sdk.js +5 -0
  147. package/build/src/runtime/store/Sdk.js.map +1 -1
  148. package/build/src/runtime/store/SharedSdk.js +1 -1
  149. package/build/src/runtime/store/SharedSdk.js.map +1 -1
  150. package/build/src/runtime/store/UsersSdk.js +1 -1
  151. package/build/src/runtime/store/UsersSdk.js.map +1 -1
  152. package/package.json +2 -2
  153. package/src/amf/ApiSchemaValues.ts +41 -33
  154. package/src/cookies/CookieJar.ts +26 -0
  155. package/src/cookies/CookieParser.ts +327 -0
  156. package/src/cookies/InMemoryCookieJar.ts +70 -0
  157. package/src/cookies/Punycode.ts +133 -0
  158. package/src/data/RequestDataExtractor.ts +14 -15
  159. package/src/events/CustomEvent.ts +4 -0
  160. package/src/mocking/ProjectMock.ts +4 -3
  161. package/src/mocking/lib/App.ts +101 -0
  162. package/src/models/{arc/ArcProject.ts → AppProject.ts} +671 -225
  163. package/src/models/AppRequest.ts +176 -0
  164. package/src/models/ClientCertificate.ts +2 -2
  165. package/src/models/Environment.ts +24 -2
  166. package/src/models/HostRule.ts +2 -2
  167. package/src/models/HttpCookie.ts +210 -48
  168. package/src/models/HttpHistory.ts +12 -5
  169. package/src/models/HttpProject.ts +113 -10
  170. package/src/models/ProjectFolder.ts +16 -0
  171. package/src/models/ProjectItem.ts +18 -0
  172. package/src/models/ProjectParent.ts +4 -1
  173. package/src/models/ProjectRequest.ts +4 -3
  174. package/src/models/Property.ts +4 -4
  175. package/src/models/Request.ts +29 -19
  176. package/src/models/RequestAuthorization.ts +4 -4
  177. package/src/models/RequestUiMeta.ts +1 -21
  178. package/src/models/Server.ts +1 -2
  179. package/src/models/http-actions/HttpActions.ts +270 -0
  180. package/src/models/http-actions/LegacyTranslator.ts +223 -0
  181. package/src/models/store/Backend.ts +148 -2
  182. package/src/models/store/File.ts +3 -1
  183. package/src/models/store/User.ts +3 -3
  184. package/src/runtime/http-engine/CoreEngine.ts +3 -2
  185. package/src/runtime/http-engine/HttpEngine.ts +48 -30
  186. package/src/runtime/{actions/ConditionRunner.ts → http-runner/ConditionCheck.ts} +3 -3
  187. package/src/runtime/http-runner/HttpFlowRunner.ts +232 -0
  188. package/src/runtime/http-runner/HttpRequestRunner.ts +353 -0
  189. package/src/runtime/http-runner/HttpRuntimeEnvironment.ts +27 -0
  190. package/src/runtime/http-runner/RequestAuthorizationProcessor.ts +144 -0
  191. package/src/runtime/http-runner/RequestCookiesProcessor.ts +74 -0
  192. package/src/runtime/node/InteropInterfaces.ts +24 -6
  193. package/src/runtime/node/ProjectParallelRunner.ts +4 -2
  194. package/src/runtime/node/ProjectRequestRunner.ts +130 -60
  195. package/src/runtime/node/ProjectRunner.ts +37 -22
  196. package/src/runtime/node/ProjectRunnerWorker.ts +3 -0
  197. package/src/runtime/reporters/Reporter.ts +5 -0
  198. package/src/runtime/store/AppSdk.ts +709 -0
  199. package/src/runtime/store/FilesSdk.ts +4 -4
  200. package/src/runtime/store/HistorySdk.ts +2 -2
  201. package/src/runtime/store/RouteBuilder.ts +75 -3
  202. package/src/runtime/store/Sdk.ts +6 -0
  203. package/src/runtime/store/SharedSdk.ts +1 -1
  204. package/src/runtime/store/UsersSdk.ts +1 -1
  205. package/build/src/lib/cookies/Cookie.d.ts +0 -123
  206. package/build/src/lib/cookies/Cookie.js +0 -257
  207. package/build/src/lib/cookies/Cookie.js.map +0 -1
  208. package/build/src/lib/cookies/Cookies.d.ts +0 -90
  209. package/build/src/lib/cookies/Cookies.js +0 -310
  210. package/build/src/lib/cookies/Cookies.js.map +0 -1
  211. package/build/src/lib/cookies/Utils.d.ts +0 -47
  212. package/build/src/lib/cookies/Utils.js +0 -163
  213. package/build/src/lib/cookies/Utils.js.map +0 -1
  214. package/build/src/mocking/lib/Arc.d.ts +0 -10
  215. package/build/src/mocking/lib/Arc.js +0 -31
  216. package/build/src/mocking/lib/Arc.js.map +0 -1
  217. package/build/src/models/RequestActions.d.ts +0 -65
  218. package/build/src/models/RequestActions.js +0 -114
  219. package/build/src/models/RequestActions.js.map +0 -1
  220. package/build/src/models/actions/Action.d.ts +0 -75
  221. package/build/src/models/actions/Action.js +0 -188
  222. package/build/src/models/actions/Action.js.map +0 -1
  223. package/build/src/models/actions/ActionView.d.ts +0 -15
  224. package/build/src/models/actions/ActionView.js +0 -33
  225. package/build/src/models/actions/ActionView.js.map +0 -1
  226. package/build/src/models/actions/Condition.d.ts +0 -81
  227. package/build/src/models/actions/Condition.js +0 -185
  228. package/build/src/models/actions/Condition.js.map +0 -1
  229. package/build/src/models/actions/ConditionView.d.ts +0 -17
  230. package/build/src/models/actions/ConditionView.js +0 -34
  231. package/build/src/models/actions/ConditionView.js.map +0 -1
  232. package/build/src/models/actions/Enums.d.ts +0 -26
  233. package/build/src/models/actions/Enums.js +0 -31
  234. package/build/src/models/actions/Enums.js.map +0 -1
  235. package/build/src/models/actions/RunnableAction.d.ts +0 -59
  236. package/build/src/models/actions/RunnableAction.js +0 -106
  237. package/build/src/models/actions/RunnableAction.js.map +0 -1
  238. package/build/src/models/actions/runnable/DeleteCookieAction.d.ts +0 -44
  239. package/build/src/models/actions/runnable/DeleteCookieAction.js +0 -92
  240. package/build/src/models/actions/runnable/DeleteCookieAction.js.map +0 -1
  241. package/build/src/models/actions/runnable/Runnable.d.ts +0 -8
  242. package/build/src/models/actions/runnable/Runnable.js +0 -4
  243. package/build/src/models/actions/runnable/Runnable.js.map +0 -1
  244. package/build/src/models/actions/runnable/SetCookieAction.d.ts +0 -87
  245. package/build/src/models/actions/runnable/SetCookieAction.js +0 -176
  246. package/build/src/models/actions/runnable/SetCookieAction.js.map +0 -1
  247. package/build/src/models/actions/runnable/SetVariableAction.d.ts +0 -31
  248. package/build/src/models/actions/runnable/SetVariableAction.js +0 -63
  249. package/build/src/models/actions/runnable/SetVariableAction.js.map +0 -1
  250. package/build/src/models/actions/runnable/index.d.ts +0 -7
  251. package/build/src/models/actions/runnable/index.js +0 -2
  252. package/build/src/models/actions/runnable/index.js.map +0 -1
  253. package/build/src/models/arc/ArcHttpRequest.d.ts +0 -40
  254. package/build/src/models/arc/ArcHttpRequest.js.map +0 -1
  255. package/build/src/models/arc/ArcProject.js.map +0 -1
  256. package/build/src/runtime/actions/ActionRunner.d.ts +0 -17
  257. package/build/src/runtime/actions/ActionRunner.js +0 -74
  258. package/build/src/runtime/actions/ActionRunner.js.map +0 -1
  259. package/build/src/runtime/actions/ConditionRunner.js.map +0 -1
  260. package/build/src/runtime/actions/RunnableCondition.d.ts +0 -27
  261. package/build/src/runtime/actions/RunnableCondition.js +0 -50
  262. package/build/src/runtime/actions/RunnableCondition.js.map +0 -1
  263. package/build/src/runtime/actions/runnable/ActionRunnable.d.ts +0 -13
  264. package/build/src/runtime/actions/runnable/ActionRunnable.js +0 -13
  265. package/build/src/runtime/actions/runnable/ActionRunnable.js.map +0 -1
  266. package/build/src/runtime/actions/runnable/DeleteCookieRunnable.d.ts +0 -7
  267. package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js +0 -36
  268. package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js.map +0 -1
  269. package/build/src/runtime/actions/runnable/SetCookieRunnable.d.ts +0 -10
  270. package/build/src/runtime/actions/runnable/SetCookieRunnable.js +0 -89
  271. package/build/src/runtime/actions/runnable/SetCookieRunnable.js.map +0 -1
  272. package/build/src/runtime/actions/runnable/SetVariableRunnable.d.ts +0 -10
  273. package/build/src/runtime/actions/runnable/SetVariableRunnable.js +0 -49
  274. package/build/src/runtime/actions/runnable/SetVariableRunnable.js.map +0 -1
  275. package/build/src/runtime/modules/BasicAuthCache.d.ts +0 -39
  276. package/build/src/runtime/modules/BasicAuthCache.js +0 -122
  277. package/build/src/runtime/modules/BasicAuthCache.js.map +0 -1
  278. package/build/src/runtime/modules/ExecutionResponse.d.ts +0 -4
  279. package/build/src/runtime/modules/ExecutionResponse.js +0 -6
  280. package/build/src/runtime/modules/ExecutionResponse.js.map +0 -1
  281. package/build/src/runtime/modules/ModulesRegistry.d.ts +0 -93
  282. package/build/src/runtime/modules/ModulesRegistry.js +0 -69
  283. package/build/src/runtime/modules/ModulesRegistry.js.map +0 -1
  284. package/build/src/runtime/modules/RequestAuthorization.d.ts +0 -6
  285. package/build/src/runtime/modules/RequestAuthorization.js +0 -110
  286. package/build/src/runtime/modules/RequestAuthorization.js.map +0 -1
  287. package/build/src/runtime/modules/RequestCookies.d.ts +0 -17
  288. package/build/src/runtime/modules/RequestCookies.js +0 -134
  289. package/build/src/runtime/modules/RequestCookies.js.map +0 -1
  290. package/build/src/runtime/node/RequestFactory.js +0 -406
  291. package/build/src/runtime/node/RequestFactory.js.map +0 -1
  292. package/build/src/runtime/node/VariablesStore.d.ts +0 -9
  293. package/build/src/runtime/node/VariablesStore.js +0 -19
  294. package/build/src/runtime/node/VariablesStore.js.map +0 -1
  295. package/src/lib/cookies/Cookie.ts +0 -312
  296. package/src/lib/cookies/Cookies.ts +0 -326
  297. package/src/lib/cookies/Utils.ts +0 -168
  298. package/src/mocking/lib/Arc.ts +0 -34
  299. package/src/models/RequestActions.ts +0 -161
  300. package/src/models/actions/Action.ts +0 -213
  301. package/src/models/actions/ActionView.ts +0 -40
  302. package/src/models/actions/Condition.ts +0 -207
  303. package/src/models/actions/ConditionView.ts +0 -42
  304. package/src/models/actions/Enums.ts +0 -29
  305. package/src/models/actions/RunnableAction.ts +0 -144
  306. package/src/models/actions/runnable/DeleteCookieAction.ts +0 -113
  307. package/src/models/actions/runnable/Runnable.ts +0 -9
  308. package/src/models/actions/runnable/SetCookieAction.ts +0 -216
  309. package/src/models/actions/runnable/SetVariableAction.ts +0 -81
  310. package/src/models/arc/ArcHttpRequest.ts +0 -129
  311. package/src/models/arc/readme.md +0 -3
  312. package/src/runtime/actions/ActionRunner.ts +0 -83
  313. package/src/runtime/actions/RunnableCondition.ts +0 -56
  314. package/src/runtime/actions/runnable/ActionRunnable.ts +0 -19
  315. package/src/runtime/actions/runnable/DeleteCookieRunnable.ts +0 -39
  316. package/src/runtime/actions/runnable/SetCookieRunnable.ts +0 -92
  317. package/src/runtime/actions/runnable/SetVariableRunnable.ts +0 -53
  318. package/src/runtime/modules/BasicAuthCache.ts +0 -129
  319. package/src/runtime/modules/ExecutionResponse.ts +0 -4
  320. package/src/runtime/modules/ModulesRegistry.ts +0 -136
  321. package/src/runtime/modules/RequestAuthorization.ts +0 -106
  322. package/src/runtime/modules/RequestCookies.ts +0 -146
  323. package/src/runtime/node/RequestFactory.ts +0 -432
  324. package/src/runtime/node/VariablesStore.ts +0 -25
@@ -2,39 +2,31 @@ import { IRequest } from '../../models/Request.js';
2
2
  import { IHttpRequest } from '../../models/HttpRequest.js';
3
3
  import { IRequestConfig } from '../../models/RequestConfig.js';
4
4
  import { IRequestAuthorization } from '../../models/RequestAuthorization.js';
5
- import { IRequestActions } from '../../models/RequestActions.js';
6
- import { HttpCertificate } from '../../models/ClientCertificate.js';
7
5
  import { IRequestLog } from '../../models/RequestLog.js';
8
6
  import { VariablesProcessor } from '../variables/VariablesProcessor.js';
9
- import { IRunnableAction } from '../../models/actions/RunnableAction.js';
7
+ import { IHttpActionFlow } from '../../models/http-actions/HttpActions.js';
10
8
  import { HttpEngineOptions } from '../http-engine/HttpEngine.js';
11
- import { ExecutionContext, RegistryPermission } from '../modules/ModulesRegistry.js';
12
9
  import { Logger } from '../../lib/logging/Logger.js';
10
+ import { CookieJar } from '../../cookies/CookieJar.js';
11
+ import { ISentRequest } from "../../models/SentRequest.js";
12
+ import { IResponse } from "../../models/Response.js";
13
+ import { IErrorResponse } from "../../models/ErrorResponse.js";
14
+ import { HttpCertificate } from '../../models/ClientCertificate.js';
13
15
  /**
14
- * The main class to make HTTP requests in the API Client.
15
- * This factory includes all logic components to perform the entire HTTP request lifecycle. This includes:
16
- *
17
- * - variables evaluation on the request object
18
- * - running request actions
19
- * - running request modules
20
- * - choosing the execution engine
21
- * - performing the request
22
- * - running response actions
23
- * - running response modules
24
- * - reporting the response
16
+ * A class that takes a single HttpRequest definition and executes it.
25
17
  *
26
- * This class may not be used when not necessary but the logic should take care of the items listed above.
18
+ * This class does the following (in order):
27
19
  *
28
- * This class splits the `IRequest` object into it's components and use them when defined.
29
- * This way it is possible to use the factory only with the `IHttpRequest` interface.
20
+ * - applies variables
21
+ * - applies authorization configuration
22
+ * - applies cookies
23
+ * - runs request actions
24
+ * - transports the request
25
+ * - processes response and redirect cookies
26
+ * - runs response actions
27
+ * - reports the request log
30
28
  */
31
- export declare class RequestFactory {
32
- /**
33
- * The main events bus.
34
- * This target is used to dispatch the events on.
35
- * The runtime should handle the events and proxy them to the corresponding context store.
36
- */
37
- eventTarget: EventTarget;
29
+ export declare class HttpRequestRunner {
38
30
  /**
39
31
  * Request processing configuration.
40
32
  */
@@ -46,11 +38,7 @@ export declare class RequestFactory {
46
38
  /**
47
39
  * Actions to be performed when the request is executed.
48
40
  */
49
- actions?: IRequestActions;
50
- /**
51
- * The list of certificates to use with the request.
52
- */
53
- certificates?: HttpCertificate[];
41
+ flows?: IHttpActionFlow[];
54
42
  /**
55
43
  * The cumulative list of all variables to be applied to the request and other properties.
56
44
  * The variables must be already processed for variables in values (evaluated).
@@ -71,19 +59,18 @@ export declare class RequestFactory {
71
59
  */
72
60
  signal?: AbortSignal;
73
61
  /**
74
- * Creates an instance from the IRequest object with setting the corresponding variables.
75
- * @param eventTarget The main events bus.
76
- * This target is used to dispatch the events on.
77
- * The runtime should handle the events and proxy them to the corresponding context store.
78
- * @param request The request object to use.
62
+ * An instance of a cookie jar (store) to put/read cookies.
79
63
  */
80
- static fromRequest(eventTarget: EventTarget, request: IRequest): RequestFactory;
64
+ cookies?: CookieJar;
81
65
  /**
82
- * @param eventTarget The main events bus.
83
- * This target is used to dispatch the events on.
84
- * The runtime should handle the events and proxy them to the corresponding context store.
66
+ * Certificates to send with the request.
85
67
  */
86
- constructor(eventTarget: EventTarget);
68
+ certificates?: HttpCertificate[];
69
+ /**
70
+ * Creates an instance from the IRequest object with setting the corresponding variables.
71
+ * @param request The request object to use.
72
+ */
73
+ static fromRequest(request: IRequest): HttpRequestRunner;
87
74
  /**
88
75
  * Runs the request and all tasks around the HTTp request execution like gathering
89
76
  * environment information, running actions, and HTTP modules.
@@ -100,10 +87,6 @@ export declare class RequestFactory {
100
87
  * @returns the authorization data processed by the variables processor.
101
88
  */
102
89
  readAuthorization(): Promise<IRequestAuthorization[] | undefined>;
103
- /**
104
- * @returns the actions for the passed type processed by the variables processor.
105
- */
106
- readActions(type: keyof IRequestActions): Promise<IRunnableAction[] | undefined>;
107
90
  /**
108
91
  * Prepares the request object before making the HTTP request
109
92
  * and runs actions and modules.
@@ -116,18 +99,23 @@ export declare class RequestFactory {
116
99
  * Runs the request through the variables processor.
117
100
  * @returns A copy of the passed request with possibly changed values.
118
101
  */
119
- processRequestVariables(request: IHttpRequest): Promise<IHttpRequest>;
102
+ applyVariables(request: IHttpRequest): Promise<IHttpRequest>;
103
+ applyAuthorization(request: IHttpRequest): Promise<IHttpRequest>;
104
+ applyCookies(request: IHttpRequest): Promise<IHttpRequest>;
120
105
  /**
121
106
  * Executes the request actions and modules.
122
107
  */
123
- processRequestLogic(request: IHttpRequest): Promise<void>;
108
+ runRequestFlows(request: IHttpRequest): Promise<void>;
124
109
  /**
125
- * Runs each action one by one.
126
- * @param request The request object associated with actions
127
- * @param actions The list of actions to execute.
110
+ * Executes the request actions and modules.
111
+ */
112
+ runResponseFlows(request: ISentRequest, response: IResponse | IErrorResponse): Promise<void>;
113
+ /**
114
+ * Reads and evaluates action flows.
115
+ *
116
+ * @param trigger The trigger name to read the flows for.
128
117
  */
129
- processRequestActions(request: IHttpRequest, actions: IRunnableAction[]): Promise<void>;
130
- processRequestModules(request: IHttpRequest): Promise<void>;
118
+ protected readFlows(trigger: 'request' | 'response'): Promise<IHttpActionFlow[]>;
131
119
  /**
132
120
  * Prepares the HTTP engine configuration and executes the request,
133
121
  * @param request The request to execute.
@@ -139,7 +127,5 @@ export declare class RequestFactory {
139
127
  */
140
128
  prepareEngineConfig(): Promise<HttpEngineOptions>;
141
129
  processResponse(log: IRequestLog): Promise<void>;
142
- processResponseActions(log: IRequestLog): Promise<void>;
143
- processResponseModules(log: IRequestLog): Promise<void>;
144
- buildExecutionContext(permissions: RegistryPermission[]): Promise<ExecutionContext>;
130
+ get sessionCookies(): boolean;
145
131
  }
@@ -0,0 +1,316 @@
1
+ import { VariablesProcessor } from '../variables/VariablesProcessor.js';
2
+ import { CoreEngine } from '../http-engine/CoreEngine.js';
3
+ import { RequestAuthorizationProcessor } from './RequestAuthorizationProcessor.js';
4
+ import { RequestCookiesProcessor } from './RequestCookiesProcessor.js';
5
+ import { HttpFlowRunner } from './HttpFlowRunner.js';
6
+ /**
7
+ * A class that takes a single HttpRequest definition and executes it.
8
+ *
9
+ * This class does the following (in order):
10
+ *
11
+ * - applies variables
12
+ * - applies authorization configuration
13
+ * - applies cookies
14
+ * - runs request actions
15
+ * - transports the request
16
+ * - processes response and redirect cookies
17
+ * - runs response actions
18
+ * - reports the request log
19
+ */
20
+ export class HttpRequestRunner {
21
+ /**
22
+ * Request processing configuration.
23
+ */
24
+ config;
25
+ /**
26
+ * Request authorization configuration
27
+ */
28
+ authorization;
29
+ /**
30
+ * Actions to be performed when the request is executed.
31
+ */
32
+ flows;
33
+ /**
34
+ * The cumulative list of all variables to be applied to the request and other properties.
35
+ * The variables must be already processed for variables in values (evaluated).
36
+ *
37
+ * These variables are passed by reference. Changes made anywhere to the variables will result
38
+ * with updating this list.
39
+ */
40
+ variables;
41
+ /**
42
+ * The variables processor instance.
43
+ */
44
+ variablesProcessor = new VariablesProcessor();
45
+ logger;
46
+ /**
47
+ * The abort signal to set on this request.
48
+ * Aborts the request when the signal fires.
49
+ * @type {(AbortSignal | undefined)}
50
+ */
51
+ signal;
52
+ /**
53
+ * An instance of a cookie jar (store) to put/read cookies.
54
+ */
55
+ cookies;
56
+ /**
57
+ * Certificates to send with the request.
58
+ */
59
+ certificates;
60
+ /**
61
+ * Creates an instance from the IRequest object with setting the corresponding variables.
62
+ * @param request The request object to use.
63
+ */
64
+ static fromRequest(request) {
65
+ const instance = new HttpRequestRunner();
66
+ instance.flows = request.flows;
67
+ instance.authorization = request.authorization;
68
+ instance.config = request.config;
69
+ return instance;
70
+ }
71
+ /**
72
+ * Runs the request and all tasks around the HTTp request execution like gathering
73
+ * environment information, running actions, and HTTP modules.
74
+ *
75
+ * @param request The request object to execute.
76
+ * @returns The execution log.
77
+ */
78
+ async run(request) {
79
+ const requestCopy = await this.processRequest(request);
80
+ const result = await this.executeRequest(requestCopy);
81
+ await this.processResponse(result);
82
+ return result;
83
+ }
84
+ /**
85
+ * @returns the configuration processed by the variables processor.
86
+ */
87
+ async readConfig() {
88
+ const { config, variables, variablesProcessor } = this;
89
+ if (!config) {
90
+ return undefined;
91
+ }
92
+ if (!variables) {
93
+ return config;
94
+ }
95
+ return variablesProcessor.evaluateVariablesWithContext(config, variables);
96
+ }
97
+ /**
98
+ * @returns the authorization data processed by the variables processor.
99
+ */
100
+ async readAuthorization() {
101
+ const { variables, authorization, variablesProcessor } = this;
102
+ if (!Array.isArray(authorization) || !authorization.length) {
103
+ return undefined;
104
+ }
105
+ if (!variables) {
106
+ return authorization;
107
+ }
108
+ const ps = authorization.filter(i => i.enabled !== false).map(async (item) => {
109
+ const copy = await variablesProcessor.evaluateVariablesWithContext(item, variables);
110
+ if (copy.config) {
111
+ copy.config = await variablesProcessor.evaluateVariablesWithContext(copy.config, variables);
112
+ }
113
+ return copy;
114
+ });
115
+ const result = await Promise.all(ps);
116
+ return result;
117
+ }
118
+ /**
119
+ * Prepares the request object before making the HTTP request
120
+ * and runs actions and modules.
121
+ *
122
+ * @param request The request to execute.
123
+ * @returns the copy of the request object.
124
+ */
125
+ async processRequest(request) {
126
+ let copy = await this.applyVariables(request);
127
+ copy = await this.applyAuthorization(copy);
128
+ copy = await this.applyCookies(copy);
129
+ await this.runRequestFlows(copy);
130
+ return copy;
131
+ }
132
+ /**
133
+ * Runs the request through the variables processor.
134
+ * @returns A copy of the passed request with possibly changed values.
135
+ */
136
+ async applyVariables(request) {
137
+ const { variables, variablesProcessor } = this;
138
+ let copy = { ...request };
139
+ if (variables) {
140
+ copy = await variablesProcessor.evaluateVariablesWithContext(copy, variables);
141
+ }
142
+ return copy;
143
+ }
144
+ async applyAuthorization(request) {
145
+ const auth = await this.readAuthorization();
146
+ RequestAuthorizationProcessor.setAuthorization(request, auth);
147
+ return request;
148
+ }
149
+ async applyCookies(request) {
150
+ const { cookies } = this;
151
+ if (!cookies || !this.sessionCookies) {
152
+ return request;
153
+ }
154
+ const list = await cookies.listCookies(request.url);
155
+ RequestCookiesProcessor.request(request, list);
156
+ return request;
157
+ }
158
+ /**
159
+ * Executes the request actions and modules.
160
+ */
161
+ async runRequestFlows(request) {
162
+ const flows = await this.readFlows('request');
163
+ const runner = new HttpFlowRunner();
164
+ runner.cookies = this.cookies;
165
+ runner.variables = this.variables;
166
+ await runner.request(request, flows);
167
+ }
168
+ /**
169
+ * Executes the request actions and modules.
170
+ */
171
+ async runResponseFlows(request, response) {
172
+ const flows = await this.readFlows('response');
173
+ const runner = new HttpFlowRunner();
174
+ runner.cookies = this.cookies;
175
+ runner.variables = this.variables;
176
+ await runner.response(request, response, flows);
177
+ }
178
+ /**
179
+ * Reads and evaluates action flows.
180
+ *
181
+ * @param trigger The trigger name to read the flows for.
182
+ */
183
+ async readFlows(trigger) {
184
+ const result = [];
185
+ const { flows, variables = {}, variablesProcessor } = this;
186
+ if (!Array.isArray(flows) || !flows.length) {
187
+ return result;
188
+ }
189
+ for (const flow of flows) {
190
+ if (flow.trigger !== trigger) {
191
+ continue;
192
+ }
193
+ if (!Array.isArray(flow.actions) || !flow.actions.length) {
194
+ continue;
195
+ }
196
+ const copy = { ...flow };
197
+ const actions = copy.actions.map(async (action) => {
198
+ const actionCopy = { ...action };
199
+ if (actionCopy.condition) {
200
+ actionCopy.condition = await variablesProcessor.evaluateVariablesWithContext(actionCopy.condition, variables);
201
+ }
202
+ if (Array.isArray(actionCopy.steps) && actionCopy.steps.length) {
203
+ const stepsPromises = actionCopy.steps.map((step) => variablesProcessor.evaluateVariablesWithContext(step, variables));
204
+ actionCopy.steps = await Promise.all(stepsPromises);
205
+ }
206
+ return actionCopy;
207
+ });
208
+ copy.actions = await Promise.all(actions);
209
+ result.push(copy);
210
+ }
211
+ return result;
212
+ }
213
+ /**
214
+ * Prepares the HTTP engine configuration and executes the request,
215
+ * @param request The request to execute.
216
+ * @returns The execution log.
217
+ */
218
+ async executeRequest(request) {
219
+ const opts = await this.prepareEngineConfig();
220
+ const engine = new CoreEngine(request, opts);
221
+ return engine.send();
222
+ }
223
+ /**
224
+ * Creates a configuration options for the HTTP engine.
225
+ */
226
+ async prepareEngineConfig() {
227
+ const { logger, signal } = this;
228
+ const auth = await this.readAuthorization();
229
+ const config = await this.readConfig();
230
+ const cert = RequestAuthorizationProcessor.readCertificate(auth);
231
+ const opts = {};
232
+ if (cert) {
233
+ opts.certificates = [cert];
234
+ }
235
+ if (this.certificates) {
236
+ if (!opts.certificates) {
237
+ opts.certificates = [];
238
+ }
239
+ opts.certificates = opts.certificates.concat(this.certificates);
240
+ }
241
+ if (Array.isArray(auth)) {
242
+ opts.authorization = auth;
243
+ }
244
+ if (logger) {
245
+ opts.logger = logger;
246
+ }
247
+ if (signal) {
248
+ opts.signal = signal;
249
+ }
250
+ if (!config || config.enabled === false) {
251
+ return opts;
252
+ }
253
+ if (typeof config.timeout === 'number') {
254
+ opts.timeout = config.timeout;
255
+ }
256
+ if (typeof config.sentMessageLimit === 'number') {
257
+ opts.sentMessageLimit = config.sentMessageLimit;
258
+ }
259
+ if (typeof config.followRedirects === 'boolean') {
260
+ opts.followRedirects = config.followRedirects;
261
+ }
262
+ if (typeof config.defaultHeaders === 'boolean') {
263
+ opts.defaultHeaders = config.defaultHeaders;
264
+ }
265
+ if (typeof config.validateCertificates === 'boolean') {
266
+ opts.validateCertificates = config.validateCertificates;
267
+ }
268
+ if (config.defaultUserAgent) {
269
+ opts.defaultUserAgent = config.defaultUserAgent;
270
+ }
271
+ if (config.defaultAccept) {
272
+ opts.defaultAccept = config.defaultAccept;
273
+ }
274
+ if (config.proxy) {
275
+ opts.proxy = config.proxy;
276
+ }
277
+ if (config.proxyUsername) {
278
+ opts.proxyUsername = config.proxyUsername;
279
+ }
280
+ if (config.proxyPassword) {
281
+ opts.proxyPassword = config.proxyPassword;
282
+ }
283
+ if (Array.isArray(config.hosts)) {
284
+ opts.hosts = config.hosts;
285
+ }
286
+ return opts;
287
+ }
288
+ async processResponse(log) {
289
+ const { request, response } = log;
290
+ if (!request || !response) {
291
+ return;
292
+ }
293
+ if (this.cookies && this.sessionCookies) {
294
+ const cookies = RequestCookiesProcessor.response(log);
295
+ if (cookies) {
296
+ const ps = Object.keys(cookies).map((url) => {
297
+ const items = cookies[url];
298
+ this.cookies?.setCookies(url, items);
299
+ });
300
+ await Promise.allSettled(ps);
301
+ }
302
+ }
303
+ await this.runResponseFlows(request, response);
304
+ }
305
+ get sessionCookies() {
306
+ const { config } = this;
307
+ if (!config) {
308
+ return true;
309
+ }
310
+ if (config.enabled === false) {
311
+ return true;
312
+ }
313
+ return !config.ignoreSessionCookies;
314
+ }
315
+ }
316
+ //# sourceMappingURL=HttpRequestRunner.js.map
@@ -0,0 +1 @@
1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CAAC,CAAC;YACtD,IAAI,OAAO,EAAE;gBACX,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;oBAC3B,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBACvC,CAAC,CAAC,CAAC;gBACH,MAAM,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;aAC9B;SACF;QACD,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,cAAc;QAChB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE;YAC5B,OAAO,IAAI,CAAC;SACb;QACD,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC;IACtC,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import { CookieJar } from "../../cookies/CookieJar";
2
+ /**
3
+ * The request(s) execution environment.
4
+ * An environment is applied to each request in the iteration (if running a project request)
5
+ * or to the HTTP request (when running a single request).
6
+ *
7
+ * In the iteration mode, the environment is shared across all requests in the iteration.
8
+ * After that the environment is discarded and re-created for the next iteration.
9
+ *
10
+ * Cookies, depending on the implementation, most likely are shared across all iterations.
11
+ * This is why the implementation must to make sure it is safe to run the cookie functions
12
+ * in the parallel mode of a project runner.
13
+ */
14
+ export interface IHttpRuntimeEnvironment {
15
+ /**
16
+ * The computed environment variables to use with this request or iteration.
17
+ * Variables can be changed but this change is not persistent. After each iteration
18
+ * the environment is restored it its default values.
19
+ */
20
+ variables: Record<string, string>;
21
+ /**
22
+ * An instance of a cookie jar (store) to put/read cookies.
23
+ */
24
+ cookies: CookieJar;
25
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=HttpRuntimeEnvironment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpRuntimeEnvironment.js","sourceRoot":"","sources":["../../../../src/runtime/http-runner/HttpRuntimeEnvironment.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ import { IHttpRequest } from '../../models/HttpRequest.js';
2
+ import { IRequestAuthorization } from '../../models/RequestAuthorization.js';
3
+ import { IBearerAuthorization, IBasicAuthorization, IOidcAuthorization, IOAuth2Authorization } from '../../models/Authorization.js';
4
+ import { HttpCertificate } from '../../models/ClientCertificate.js';
5
+ /**
6
+ * Applies authorization data to the HttpRequest from
7
+ * request authorization configuration.
8
+ */
9
+ export declare class RequestAuthorizationProcessor {
10
+ /**
11
+ * Applies the auth data from the authorization config.
12
+ *
13
+ * Note, this mutates the original request. Make a copy of you don't want to change
14
+ * the values in the source request.
15
+ *
16
+ * Note, this does not process client certificates. Use the `#readCertificates()` method to
17
+ * get a certificate to use with the HTTP request,
18
+ *
19
+ * @param request The request to apply the authorization to.
20
+ * @returns The same request (a reference)
21
+ */
22
+ static setAuthorization(request: IHttpRequest, authorization?: IRequestAuthorization[]): IHttpRequest;
23
+ /**
24
+ * Reads the client certificate from the authorization configuration.
25
+ *
26
+ * @param authorization The HTTP request authorization configuration.
27
+ * @returns The certificate to use with the HTTP request or undefined when not configured.
28
+ */
29
+ static readCertificate(authorization?: IRequestAuthorization[]): HttpCertificate | undefined;
30
+ /**
31
+ * Injects basic auth header into the request headers.
32
+ */
33
+ protected static processBasicAuth(request: IHttpRequest, config: IBasicAuthorization): void;
34
+ /**
35
+ * Injects oauth 2 auth header into the request headers.
36
+ */
37
+ protected static processOAuth2(request: IHttpRequest, config: IOAuth2Authorization): void;
38
+ /**
39
+ * Injects OpenID Connect auth header into the request headers.
40
+ */
41
+ protected static processOpenId(request: IHttpRequest, config: IOidcAuthorization): void;
42
+ /**
43
+ * Injects bearer auth header into the request headers.
44
+ */
45
+ protected static processBearer(request: IHttpRequest, config: IBearerAuthorization): void;
46
+ /**
47
+ * Applies the basic authorization data to the request.
48
+ *
49
+ * If the header value have changed then it fires `request-headers-changed` custom event.
50
+ * It sets computed value of the readers to the event's detail object.
51
+ *
52
+ * @param request The event's detail object. Changes made here will be propagated to the event.
53
+ * @param data The authorization data to apply.
54
+ */
55
+ protected static applyRequestBasicAuthData(request: IHttpRequest, data: IBasicAuthorization): void;
56
+ }