@api-client/core 0.3.12 → 0.4.2

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 (347) hide show
  1. package/build/browser.d.ts +10 -8
  2. package/build/browser.js +11 -7
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +12 -11
  5. package/build/index.js +9 -9
  6. package/build/index.js.map +1 -1
  7. package/build/src/data/JmesparthReader.d.ts +1 -1
  8. package/build/src/data/JmesparthReader.js +1 -1
  9. package/build/src/events/models/ProjectEvents.d.ts +1 -1
  10. package/build/src/events/models/ProjectEvents.js +1 -2
  11. package/build/src/events/models/ProjectEvents.js.map +1 -1
  12. package/build/src/lib/transformers/PayloadSerializer.d.ts +2 -2
  13. package/build/src/lib/transformers/PayloadSerializer.js +3 -3
  14. package/build/src/lib/transformers/PayloadSerializer.js.map +1 -1
  15. package/build/src/mocking/ProjectMock.d.ts +1 -1
  16. package/build/src/mocking/lib/Request.d.ts +2 -2
  17. package/build/src/mocking/lib/Request.js +3 -2
  18. package/build/src/mocking/lib/Request.js.map +1 -1
  19. package/build/src/mocking/lib/Response.d.ts +6 -6
  20. package/build/src/mocking/lib/Response.js +6 -6
  21. package/build/src/mocking/lib/Response.js.map +1 -1
  22. package/build/src/mocking/lib/User.js +3 -0
  23. package/build/src/mocking/lib/User.js.map +1 -1
  24. package/build/src/models/AuthorizationData.d.ts +2 -2
  25. package/build/src/models/AuthorizationData.js +2 -2
  26. package/build/src/models/ClientCertificate.d.ts +1 -1
  27. package/build/src/models/Environment.d.ts +3 -3
  28. package/build/src/models/Environment.js +3 -3
  29. package/build/src/models/Environment.js.map +1 -1
  30. package/build/src/models/ErrorResponse.d.ts +1 -1
  31. package/build/src/models/ErrorResponse.js +1 -1
  32. package/build/src/models/HostRule.d.ts +4 -4
  33. package/build/src/models/HostRule.js +4 -4
  34. package/build/src/models/HostRule.js.map +1 -1
  35. package/build/src/models/HttpHistory.d.ts +30 -1
  36. package/build/src/models/HttpHistory.js +1 -1
  37. package/build/src/models/HttpHistory.js.map +1 -1
  38. package/build/src/models/HttpProject.d.ts +41 -6
  39. package/build/src/models/HttpProject.js +52 -4
  40. package/build/src/models/HttpProject.js.map +1 -1
  41. package/build/src/models/HttpProjectListItem.d.ts +1 -1
  42. package/build/src/models/HttpProjectListItem.js +1 -1
  43. package/build/src/models/HttpProjectListItem.js.map +1 -1
  44. package/build/src/models/HttpRequest.d.ts +2 -2
  45. package/build/src/models/HttpRequest.js +2 -2
  46. package/build/src/models/HttpRequest.js.map +1 -1
  47. package/build/src/models/HttpResponse.d.ts +2 -2
  48. package/build/src/models/HttpResponse.js +3 -3
  49. package/build/src/models/HttpResponse.js.map +1 -1
  50. package/build/src/models/License.d.ts +3 -3
  51. package/build/src/models/License.js +3 -3
  52. package/build/src/models/License.js.map +1 -1
  53. package/build/src/models/ProjectFolder.d.ts +2 -2
  54. package/build/src/models/ProjectFolder.js +3 -3
  55. package/build/src/models/ProjectFolder.js.map +1 -1
  56. package/build/src/models/ProjectItem.d.ts +1 -1
  57. package/build/src/models/ProjectItem.js +2 -2
  58. package/build/src/models/ProjectItem.js.map +1 -1
  59. package/build/src/models/ProjectRequest.d.ts +2 -2
  60. package/build/src/models/ProjectRequest.js +1 -1
  61. package/build/src/models/ProjectRequest.js.map +1 -1
  62. package/build/src/models/ProjectSchema.d.ts +2 -2
  63. package/build/src/models/ProjectSchema.js +1 -1
  64. package/build/src/models/ProjectSchema.js.map +1 -1
  65. package/build/src/models/Property.d.ts +4 -4
  66. package/build/src/models/Property.js +4 -4
  67. package/build/src/models/Property.js.map +1 -1
  68. package/build/src/models/Provider.d.ts +3 -3
  69. package/build/src/models/Provider.js +3 -3
  70. package/build/src/models/Provider.js.map +1 -1
  71. package/build/src/models/Request.d.ts +2 -2
  72. package/build/src/models/Request.js +3 -3
  73. package/build/src/models/Request.js.map +1 -1
  74. package/build/src/models/RequestActions.d.ts +2 -4
  75. package/build/src/models/RequestActions.js +2 -4
  76. package/build/src/models/RequestActions.js.map +1 -1
  77. package/build/src/models/RequestAuthorization.d.ts +3 -5
  78. package/build/src/models/RequestAuthorization.js +2 -4
  79. package/build/src/models/RequestAuthorization.js.map +1 -1
  80. package/build/src/models/RequestConfig.d.ts +3 -5
  81. package/build/src/models/RequestConfig.js +1 -3
  82. package/build/src/models/RequestConfig.js.map +1 -1
  83. package/build/src/models/RequestLog.d.ts +14 -8
  84. package/build/src/models/RequestLog.js +18 -7
  85. package/build/src/models/RequestLog.js.map +1 -1
  86. package/build/src/models/RequestTime.d.ts +4 -6
  87. package/build/src/models/RequestTime.js +2 -4
  88. package/build/src/models/RequestTime.js.map +1 -1
  89. package/build/src/models/RequestUiMeta.d.ts +5 -5
  90. package/build/src/models/RequestUiMeta.js +2 -2
  91. package/build/src/models/RequestUiMeta.js.map +1 -1
  92. package/build/src/models/RequestsSize.d.ts +1 -3
  93. package/build/src/models/RequestsSize.js +1 -3
  94. package/build/src/models/RequestsSize.js.map +1 -1
  95. package/build/src/models/{ArcResponse.d.ts → Response.d.ts} +7 -9
  96. package/build/src/models/{ArcResponse.js → Response.js} +4 -6
  97. package/build/src/models/Response.js.map +1 -0
  98. package/build/src/models/ResponseAuthorization.d.ts +3 -3
  99. package/build/src/models/ResponseAuthorization.js +3 -3
  100. package/build/src/models/ResponseAuthorization.js.map +1 -1
  101. package/build/src/models/ResponseRedirect.d.ts +3 -5
  102. package/build/src/models/ResponseRedirect.js +1 -3
  103. package/build/src/models/ResponseRedirect.js.map +1 -1
  104. package/build/src/models/RevisionInfo.d.ts +1 -1
  105. package/build/src/models/RevisionInfo.js +1 -1
  106. package/build/src/models/RevisionInfo.js.map +1 -1
  107. package/build/src/models/SentRequest.d.ts +2 -4
  108. package/build/src/models/SentRequest.js +1 -3
  109. package/build/src/models/SentRequest.js.map +1 -1
  110. package/build/src/models/Server.d.ts +3 -3
  111. package/build/src/models/Server.js +3 -3
  112. package/build/src/models/Server.js.map +1 -1
  113. package/build/src/models/Thing.d.ts +3 -3
  114. package/build/src/models/Thing.js +3 -3
  115. package/build/src/models/Thing.js.map +1 -1
  116. package/build/src/models/Url.d.ts +2 -4
  117. package/build/src/models/Url.js +2 -4
  118. package/build/src/models/Url.js.map +1 -1
  119. package/build/src/models/User.d.ts +2 -1
  120. package/build/src/models/User.js +1 -1
  121. package/build/src/models/User.js.map +1 -1
  122. package/build/src/models/WebApi.d.ts +1 -1
  123. package/build/src/models/WebApi.js +1 -1
  124. package/build/src/models/WebApi.js.map +1 -1
  125. package/build/src/models/WebApiIndex.d.ts +1 -1
  126. package/build/src/models/WebApiIndex.js +1 -1
  127. package/build/src/models/WebApiIndex.js.map +1 -1
  128. package/build/src/models/Workspace.d.ts +4 -4
  129. package/build/src/models/Workspace.js +4 -4
  130. package/build/src/models/Workspace.js.map +1 -1
  131. package/build/src/models/actions/Action.d.ts +2 -2
  132. package/build/src/models/actions/Action.js +1 -1
  133. package/build/src/models/actions/Action.js.map +1 -1
  134. package/build/src/models/actions/Condition.d.ts +2 -2
  135. package/build/src/models/actions/Condition.js +1 -1
  136. package/build/src/models/actions/Condition.js.map +1 -1
  137. package/build/src/models/actions/RunnableAction.d.ts +1 -1
  138. package/build/src/models/actions/RunnableAction.js +1 -1
  139. package/build/src/models/actions/RunnableAction.js.map +1 -1
  140. package/build/src/models/actions/runnable/DeleteCookieAction.d.ts +2 -2
  141. package/build/src/models/actions/runnable/DeleteCookieAction.js +1 -1
  142. package/build/src/models/actions/runnable/DeleteCookieAction.js.map +1 -1
  143. package/build/src/models/actions/runnable/SetCookieAction.d.ts +2 -2
  144. package/build/src/models/actions/runnable/SetCookieAction.js +1 -1
  145. package/build/src/models/actions/runnable/SetCookieAction.js.map +1 -1
  146. package/build/src/models/actions/runnable/SetVariableAction.d.ts +2 -2
  147. package/build/src/models/actions/runnable/SetVariableAction.js +1 -1
  148. package/build/src/models/actions/runnable/SetVariableAction.js.map +1 -1
  149. package/build/src/models/transformers/ImportUtils.d.ts +1 -1
  150. package/build/src/models/transformers/ImportUtils.js +1 -1
  151. package/build/src/models/transformers/PostmanBackupTransformer.js +2 -1
  152. package/build/src/models/transformers/PostmanBackupTransformer.js.map +1 -1
  153. package/build/src/models/transformers/PostmanV21Transformer.js +2 -1
  154. package/build/src/models/transformers/PostmanV21Transformer.js.map +1 -1
  155. package/build/src/models/transformers/PostmanV2Transformer.js +2 -1
  156. package/build/src/models/transformers/PostmanV2Transformer.js.map +1 -1
  157. package/build/src/runtime/actions/RunnableCondition.d.ts +6 -7
  158. package/build/src/runtime/actions/RunnableCondition.js +4 -5
  159. package/build/src/runtime/actions/RunnableCondition.js.map +1 -1
  160. package/build/src/runtime/http-engine/{ArcEngine.d.ts → CoreEngine.d.ts} +3 -3
  161. package/build/src/runtime/http-engine/{ArcEngine.js → CoreEngine.js} +8 -8
  162. package/build/src/runtime/http-engine/CoreEngine.js.map +1 -0
  163. package/build/src/runtime/http-engine/HttpEngine.d.ts +3 -3
  164. package/build/src/runtime/http-engine/HttpEngine.js +3 -20
  165. package/build/src/runtime/http-engine/HttpEngine.js.map +1 -1
  166. package/build/src/runtime/modules/BasicAuthCache.js +2 -5
  167. package/build/src/runtime/modules/BasicAuthCache.js.map +1 -1
  168. package/build/src/runtime/modules/RequestCookies.d.ts +1 -1
  169. package/build/src/runtime/modules/RequestCookies.js +3 -2
  170. package/build/src/runtime/modules/RequestCookies.js.map +1 -1
  171. package/build/src/runtime/node/InteropInterfaces.d.ts +115 -0
  172. package/build/src/runtime/node/InteropInterfaces.js +2 -0
  173. package/build/src/runtime/node/InteropInterfaces.js.map +1 -0
  174. package/build/src/runtime/node/ProjectParallelRunner.d.ts +2 -7
  175. package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
  176. package/build/src/runtime/node/ProjectRequestRunner.d.ts +17 -49
  177. package/build/src/runtime/node/ProjectRequestRunner.js +39 -10
  178. package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
  179. package/build/src/runtime/node/ProjectRunner.d.ts +1 -59
  180. package/build/src/runtime/node/ProjectRunner.js.map +1 -1
  181. package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
  182. package/build/src/runtime/node/RequestFactory.d.ts +1 -1
  183. package/build/src/runtime/node/RequestFactory.js +3 -3
  184. package/build/src/runtime/node/RequestFactory.js.map +1 -1
  185. package/build/src/runtime/reporters/ProjectRunCliReporter.js.map +1 -1
  186. package/build/src/runtime/reporters/Reporter.js.map +1 -1
  187. package/build/src/runtime/store/AuthSdk.d.ts +28 -0
  188. package/build/src/runtime/store/AuthSdk.js +123 -0
  189. package/build/src/runtime/store/AuthSdk.js.map +1 -0
  190. package/build/src/runtime/store/BackendSdk.d.ts +8 -0
  191. package/build/src/runtime/store/BackendSdk.js +25 -0
  192. package/build/src/runtime/store/BackendSdk.js.map +1 -0
  193. package/build/src/runtime/store/HistorySdk.d.ts +48 -0
  194. package/build/src/runtime/store/HistorySdk.js +142 -0
  195. package/build/src/runtime/store/HistorySdk.js.map +1 -0
  196. package/build/src/runtime/store/Http.d.ts +14 -0
  197. package/build/src/runtime/store/Http.js +4 -0
  198. package/build/src/runtime/store/Http.js.map +1 -0
  199. package/build/src/runtime/store/HttpNode.d.ts +16 -0
  200. package/build/src/runtime/store/HttpNode.js +95 -0
  201. package/build/src/runtime/store/HttpNode.js.map +1 -0
  202. package/build/src/runtime/store/HttpWeb.d.ts +15 -0
  203. package/build/src/runtime/store/HttpWeb.js +83 -0
  204. package/build/src/runtime/store/HttpWeb.js.map +1 -0
  205. package/build/src/runtime/store/ProjectsSdk.d.ts +43 -0
  206. package/build/src/runtime/store/ProjectsSdk.js +144 -0
  207. package/build/src/runtime/store/ProjectsSdk.js.map +1 -0
  208. package/build/src/runtime/store/RouteBuilder.d.ts +42 -0
  209. package/build/src/runtime/store/RouteBuilder.js +75 -0
  210. package/build/src/runtime/store/RouteBuilder.js.map +1 -0
  211. package/build/src/runtime/store/Sdk.d.ts +79 -0
  212. package/build/src/runtime/store/Sdk.js +117 -0
  213. package/build/src/runtime/store/Sdk.js.map +1 -0
  214. package/build/src/runtime/store/SdkBase.d.ts +45 -0
  215. package/build/src/runtime/store/SdkBase.js +40 -0
  216. package/build/src/runtime/store/SdkBase.js.map +1 -0
  217. package/build/src/runtime/store/SpacesSdk.d.ts +50 -0
  218. package/build/src/runtime/store/SpacesSdk.js +185 -0
  219. package/build/src/runtime/store/SpacesSdk.js.map +1 -0
  220. package/build/src/runtime/store/StoreSdkNode.d.ts +10 -0
  221. package/build/src/runtime/store/StoreSdkNode.js +11 -0
  222. package/build/src/runtime/store/StoreSdkNode.js.map +1 -0
  223. package/build/src/runtime/store/StoreSdkWeb.d.ts +10 -0
  224. package/build/src/runtime/store/StoreSdkWeb.js +11 -0
  225. package/build/src/runtime/store/StoreSdkWeb.js.map +1 -0
  226. package/build/src/runtime/store/UsersSdk.d.ts +18 -0
  227. package/build/src/runtime/store/UsersSdk.js +88 -0
  228. package/build/src/runtime/store/UsersSdk.js.map +1 -0
  229. package/build/src/runtime/store/WsClient.d.ts +24 -0
  230. package/build/src/runtime/store/WsClient.js +4 -0
  231. package/build/src/runtime/store/WsClient.js.map +1 -0
  232. package/build/src/runtime/store/WsClientNode.d.ts +24 -0
  233. package/build/src/runtime/store/WsClientNode.js +66 -0
  234. package/build/src/runtime/store/WsClientNode.js.map +1 -0
  235. package/build/src/runtime/store/WsClientWeb.d.ts +23 -0
  236. package/build/src/runtime/store/WsClientWeb.js +73 -0
  237. package/build/src/runtime/store/WsClientWeb.js.map +1 -0
  238. package/package.json +6 -8
  239. package/readme.md +5 -5
  240. package/src/data/JmesparthReader.ts +1 -1
  241. package/src/events/models/ProjectEvents.ts +2 -2
  242. package/src/events/readme.md +1 -1
  243. package/src/lib/transformers/PayloadSerializer.ts +3 -3
  244. package/src/mocking/ProjectMock.ts +1 -1
  245. package/src/mocking/lib/Request.ts +5 -5
  246. package/src/mocking/lib/Response.ts +10 -10
  247. package/src/mocking/lib/User.ts +2 -1
  248. package/src/models/AuthorizationData.ts +2 -2
  249. package/src/models/ClientCertificate.ts +1 -1
  250. package/src/models/Environment.ts +4 -4
  251. package/src/models/ErrorResponse.ts +1 -1
  252. package/src/models/HostRule.ts +5 -5
  253. package/src/models/HttpHistory.ts +31 -1
  254. package/src/models/HttpProject.ts +87 -7
  255. package/src/models/HttpProjectListItem.ts +1 -1
  256. package/src/models/HttpRequest.ts +2 -2
  257. package/src/models/HttpResponse.ts +3 -3
  258. package/src/models/License.ts +4 -4
  259. package/src/models/ProjectFolder.ts +3 -3
  260. package/src/models/ProjectItem.ts +2 -2
  261. package/src/models/ProjectRequest.ts +2 -2
  262. package/src/models/ProjectSchema.ts +2 -2
  263. package/src/models/Property.ts +5 -5
  264. package/src/models/Provider.ts +4 -4
  265. package/src/models/README.md +2 -2
  266. package/src/models/Request.ts +4 -4
  267. package/src/models/RequestActions.ts +2 -4
  268. package/src/models/RequestAuthorization.ts +3 -5
  269. package/src/models/RequestConfig.ts +3 -5
  270. package/src/models/RequestLog.ts +25 -11
  271. package/src/models/RequestTime.ts +4 -6
  272. package/src/models/RequestUiMeta.ts +5 -5
  273. package/src/models/RequestsSize.ts +1 -3
  274. package/src/models/{ArcResponse.ts → Response.ts} +12 -14
  275. package/src/models/ResponseAuthorization.ts +4 -4
  276. package/src/models/ResponseRedirect.ts +3 -5
  277. package/src/models/RevisionInfo.ts +1 -1
  278. package/src/models/SentRequest.ts +2 -4
  279. package/src/models/Server.ts +4 -4
  280. package/src/models/Thing.ts +4 -4
  281. package/src/models/Url.ts +2 -4
  282. package/src/models/User.ts +2 -1
  283. package/src/models/WebApi.ts +1 -1
  284. package/src/models/WebApiIndex.ts +1 -1
  285. package/src/models/Workspace.ts +5 -5
  286. package/src/models/actions/Action.ts +2 -2
  287. package/src/models/actions/Condition.ts +2 -2
  288. package/src/models/actions/RunnableAction.ts +1 -1
  289. package/src/models/actions/runnable/DeleteCookieAction.ts +2 -2
  290. package/src/models/actions/runnable/SetCookieAction.ts +2 -2
  291. package/src/models/actions/runnable/SetVariableAction.ts +2 -2
  292. package/src/models/transformers/ImportUtils.ts +1 -1
  293. package/src/models/transformers/PostmanBackupTransformer.ts +2 -1
  294. package/src/models/transformers/PostmanV21Transformer.ts +2 -1
  295. package/src/models/transformers/PostmanV2Transformer.ts +2 -1
  296. package/src/runtime/actions/RunnableCondition.ts +6 -7
  297. package/src/runtime/http-engine/{ArcEngine.ts → CoreEngine.ts} +7 -7
  298. package/src/runtime/http-engine/HttpEngine.ts +5 -24
  299. package/src/runtime/modules/BasicAuthCache.ts +2 -6
  300. package/src/runtime/modules/RequestCookies.ts +6 -5
  301. package/src/runtime/node/InteropInterfaces.ts +121 -0
  302. package/src/runtime/node/ProjectParallelRunner.ts +2 -9
  303. package/src/runtime/node/ProjectRequestRunner.ts +42 -61
  304. package/src/runtime/node/ProjectRunner.ts +1 -60
  305. package/src/runtime/node/ProjectRunnerWorker.ts +2 -1
  306. package/src/runtime/node/RequestFactory.ts +3 -3
  307. package/src/runtime/reporters/ProjectRunCliReporter.ts +2 -2
  308. package/src/runtime/reporters/Reporter.ts +4 -4
  309. package/src/runtime/store/AuthSdk.ts +126 -0
  310. package/src/runtime/store/BackendSdk.ts +25 -0
  311. package/src/runtime/store/HistorySdk.ts +157 -0
  312. package/src/runtime/store/Http.ts +18 -0
  313. package/src/runtime/store/HttpNode.ts +100 -0
  314. package/src/runtime/store/HttpWeb.ts +89 -0
  315. package/src/runtime/store/ProjectsSdk.ts +147 -0
  316. package/src/runtime/store/RouteBuilder.ts +89 -0
  317. package/src/runtime/store/Sdk.ts +131 -0
  318. package/src/runtime/store/SdkBase.ts +72 -0
  319. package/src/runtime/store/SpacesSdk.ts +190 -0
  320. package/src/runtime/store/StoreSdkNode.ts +13 -0
  321. package/src/runtime/store/StoreSdkWeb.ts +13 -0
  322. package/src/runtime/store/UsersSdk.ts +89 -0
  323. package/src/runtime/store/WsClient.ts +28 -0
  324. package/src/runtime/store/WsClientNode.ts +68 -0
  325. package/src/runtime/store/WsClientWeb.ts +75 -0
  326. package/build/src/models/ArcResponse.js.map +0 -1
  327. package/build/src/models/HistoryIndex.d.ts +0 -43
  328. package/build/src/models/HistoryIndex.js +0 -53
  329. package/build/src/models/HistoryIndex.js.map +0 -1
  330. package/build/src/models/HistoryRequest.d.ts +0 -13
  331. package/build/src/models/HistoryRequest.js +0 -25
  332. package/build/src/models/HistoryRequest.js.map +0 -1
  333. package/build/src/runtime/http-engine/ArcEngine.js.map +0 -1
  334. package/build/src/runtime/http-engine/NodeEngine.d.ts +0 -154
  335. package/build/src/runtime/http-engine/NodeEngine.js +0 -766
  336. package/build/src/runtime/http-engine/NodeEngine.js.map +0 -1
  337. package/build/src/runtime/http-engine/NodeEngineDirect.d.ts +0 -113
  338. package/build/src/runtime/http-engine/NodeEngineDirect.js +0 -449
  339. package/build/src/runtime/http-engine/NodeEngineDirect.js.map +0 -1
  340. package/build/src/runtime/store/StoreSdk.d.ts +0 -279
  341. package/build/src/runtime/store/StoreSdk.js +0 -840
  342. package/build/src/runtime/store/StoreSdk.js.map +0 -1
  343. package/src/models/HistoryIndex.ts +0 -76
  344. package/src/models/HistoryRequest.ts +0 -28
  345. package/src/runtime/http-engine/NodeEngine.ts +0 -792
  346. package/src/runtime/http-engine/NodeEngineDirect.ts +0 -482
  347. package/src/runtime/store/StoreSdk.ts +0 -895
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WsClient.js","sourceRoot":"","sources":["../../../../src/runtime/store/WsClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,OAAgB,QAAS,SAAQ,OAAO;CAwB7C"}
@@ -0,0 +1,24 @@
1
+ import WebSocket from 'ws';
2
+ import { WsClient } from './WsClient.js';
3
+ export declare class WsClientNode extends WsClient {
4
+ /**
5
+ * Creates a WS client with optional token
6
+ * @param addr The ws:// address
7
+ * @param token Optional token to add.
8
+ */
9
+ getClient(addr: string, token?: string | undefined): WebSocket;
10
+ /**
11
+ * Connect to the WS server
12
+ *
13
+ * @param client The client to wait for connection.
14
+ */
15
+ connect(client: WebSocket): Promise<void>;
16
+ /**
17
+ * Disconnects from the WS server.
18
+ */
19
+ disconnect(client: WebSocket): Promise<void>;
20
+ /**
21
+ * The combination of `getClient()` and `connect()`.
22
+ */
23
+ createAndConnect(addr: string, token?: string): Promise<WebSocket>;
24
+ }
@@ -0,0 +1,66 @@
1
+ import WebSocket from 'ws';
2
+ import { WsClient } from './WsClient.js';
3
+ export class WsClientNode extends WsClient {
4
+ /**
5
+ * Creates a WS client with optional token
6
+ * @param addr The ws:// address
7
+ * @param token Optional token to add.
8
+ */
9
+ getClient(addr, token = this.sdk.token) {
10
+ let url = addr;
11
+ if (token) {
12
+ url += url.includes('?') ? '&' : '?';
13
+ url += 'token=';
14
+ url += token;
15
+ }
16
+ if (url.startsWith('http:')) {
17
+ url = `ws:${url.substring(5)}`;
18
+ }
19
+ else if (url.startsWith('https:')) {
20
+ url = `wss:${url.substring(6)}`;
21
+ }
22
+ return new WebSocket(url);
23
+ }
24
+ /**
25
+ * Connect to the WS server
26
+ *
27
+ * @param client The client to wait for connection.
28
+ */
29
+ connect(client) {
30
+ return new Promise((resolve, reject) => {
31
+ client.once('open', () => {
32
+ client.removeAllListeners('error');
33
+ resolve();
34
+ });
35
+ client.once('error', (err) => {
36
+ client.removeAllListeners('open');
37
+ reject(err);
38
+ });
39
+ });
40
+ }
41
+ /**
42
+ * Disconnects from the WS server.
43
+ */
44
+ disconnect(client) {
45
+ return new Promise((resolve, reject) => {
46
+ client.once('close', () => {
47
+ client.removeAllListeners('error');
48
+ resolve();
49
+ });
50
+ client.once('error', (err) => {
51
+ client.removeAllListeners('close');
52
+ reject(err);
53
+ });
54
+ client.close();
55
+ });
56
+ }
57
+ /**
58
+ * The combination of `getClient()` and `connect()`.
59
+ */
60
+ async createAndConnect(addr, token) {
61
+ const client = this.getClient(addr, token);
62
+ await this.connect(client);
63
+ return client;
64
+ }
65
+ }
66
+ //# sourceMappingURL=WsClientNode.js.map
@@ -0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M,CAAC,CAAC;gBAClC,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,MAAiB;QAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;gBACxB,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;gBACnC,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC3B,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;gBACnC,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,IAAY,EAAE,KAAc;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ import { WsClient } from './WsClient.js';
2
+ export declare class WsClientWeb extends WsClient {
3
+ /**
4
+ * Creates a WS client with optional token
5
+ * @param addr The ws:// address
6
+ * @param token Optional token to add.
7
+ */
8
+ getClient(addr: string, token?: string | undefined): WebSocket;
9
+ /**
10
+ * Connect to the WS server
11
+ *
12
+ * @param client The client to wait for connection.
13
+ */
14
+ connect(client: WebSocket): Promise<void>;
15
+ /**
16
+ * Disconnects from the WS server.
17
+ */
18
+ disconnect(client: WebSocket): Promise<void>;
19
+ /**
20
+ * The combination of `getClient()` and `connect()`.
21
+ */
22
+ createAndConnect(addr: string, token?: string): Promise<WebSocket>;
23
+ }
@@ -0,0 +1,73 @@
1
+ import { WsClient } from './WsClient.js';
2
+ export class WsClientWeb extends WsClient {
3
+ /**
4
+ * Creates a WS client with optional token
5
+ * @param addr The ws:// address
6
+ * @param token Optional token to add.
7
+ */
8
+ getClient(addr, token = this.sdk.token) {
9
+ let url = addr;
10
+ if (token) {
11
+ url += url.includes('?') ? '&' : '?';
12
+ url += 'token=';
13
+ url += token;
14
+ }
15
+ if (url.startsWith('http:')) {
16
+ url = `ws:${url.substring(5)}`;
17
+ }
18
+ else if (url.startsWith('https:')) {
19
+ url = `wss:${url.substring(6)}`;
20
+ }
21
+ return new WebSocket(url);
22
+ }
23
+ /**
24
+ * Connect to the WS server
25
+ *
26
+ * @param client The client to wait for connection.
27
+ */
28
+ connect(client) {
29
+ return new Promise((resolve, reject) => {
30
+ function opened() {
31
+ client.removeEventListener('open', opened);
32
+ client.removeEventListener('error', errored);
33
+ resolve();
34
+ }
35
+ function errored() {
36
+ client.removeEventListener('open', opened);
37
+ client.removeEventListener('error', errored);
38
+ reject(new Error(`Unable to connect to: ${client.url}`));
39
+ }
40
+ client.addEventListener('open', opened);
41
+ client.addEventListener('error', errored);
42
+ });
43
+ }
44
+ /**
45
+ * Disconnects from the WS server.
46
+ */
47
+ disconnect(client) {
48
+ return new Promise((resolve, reject) => {
49
+ function closed() {
50
+ client.removeEventListener('close', closed);
51
+ client.removeEventListener('error', errored);
52
+ resolve();
53
+ }
54
+ function errored() {
55
+ client.removeEventListener('close', closed);
56
+ client.removeEventListener('error', errored);
57
+ reject(new Error(`Unable to connect to: ${client.url}`));
58
+ }
59
+ client.addEventListener('close', closed);
60
+ client.addEventListener('error', errored);
61
+ client.close();
62
+ });
63
+ }
64
+ /**
65
+ * The combination of `getClient()` and `connect()`.
66
+ */
67
+ async createAndConnect(addr, token) {
68
+ const client = this.getClient(addr, token);
69
+ await this.connect(client);
70
+ return client;
71
+ }
72
+ }
73
+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CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
- "description": "The ARC core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.3.12",
3
+ "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
+ "version": "0.4.2",
5
5
  "license": "Apache-2.0",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "bugs": {
22
22
  "url": "https://github.com/api-client/core/issues",
23
- "email": "arc@mulesoft.com"
23
+ "email": "pawel.psztyc@gmail.com"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@commitlint/cli": "^16.2.1",
@@ -56,6 +56,7 @@
56
56
  "mocha": "^9.1.3",
57
57
  "shrink-ray-current": "^4.1.3",
58
58
  "sinon": "^13.0.1",
59
+ "source-map-support": "^0.5.21",
59
60
  "ssl-root-cas": "^1.3.1",
60
61
  "ts-node": "^10.4.0",
61
62
  "typescript": "^4.4.4"
@@ -68,10 +69,7 @@
68
69
  "tsc:watch": "tsc --watch",
69
70
  "test:browser": "wtr --playwright --browsers chromium firefox webkit --coverage",
70
71
  "test:browser:watch": "wtr --watch --playwright --browsers chromium",
71
- "test:mocha": "mocha --require test/http-server-fixture.js",
72
- "test:mocha:watch": "mocha --watch --require test/http-server-fixture.js",
73
- "test:mocha:watch2": "node scripts/test-node-watch.js",
74
- "test:mocha:watch3": "mocha --watch --recursive --parallel --require test/http-server-fixture.js",
72
+ "test:mocha": "npm run build-ts && mocha",
75
73
  "test": "npm run test:mocha && npm run test:browser"
76
74
  },
77
75
  "husky": {
@@ -86,8 +84,8 @@
86
84
  },
87
85
  "dependencies": {
88
86
  "@metrichor/jmespath": "^0.3.1",
89
- "@pawel-up/jexl": "^3.0.0",
90
87
  "@pawel-up/data-mock": "^0.1.7",
88
+ "@pawel-up/jexl": "^3.0.0",
91
89
  "@xmldom/xmldom": "^0.8.1",
92
90
  "console-table-printer": "^2.10.0",
93
91
  "form-data": "^4.0.0",
package/readme.md CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  The core library of the API Client application. This build on top of the experience of Advanced REST Client.
4
4
 
5
- Contains the core models, events, and logic related to ARC. This replaces the `events`, `lib`, and parts of `base` libraries.
5
+ Contains the core models, events, and logic related to API Client.
6
6
 
7
7
  ## Purpose
8
8
 
9
- The core library provides the libraries that ARC and related projects are re-using under the hood.
9
+ The core library provides the libraries that API Client and related projects are re-using under the hood.
10
10
 
11
11
  The library is structured as follows:
12
12
 
13
- - models - the data model libraries providing the data schema definition for ARC and related projects and the common logic to manipulate the data
13
+ - models - the data model libraries providing the data schema definition for API Client and related projects and the common logic to manipulate the data
14
14
  - runtime - the executable part of the library; contains classes that executes an HTTP request, runs a series of requests defined in a project, etc
15
- - utilities - helper libraries that can be shared across the ARC ecosystem
15
+ - utilities - helper libraries that can be shared across the API Client ecosystem
16
16
 
17
17
  ## What it isn't
18
18
 
@@ -36,7 +36,7 @@ These libraries can be used, among others, to:
36
36
 
37
37
  ## Community driven
38
38
 
39
- The entire ARC project is community driven. We build tools for API developers to make them successful without investing into very expensive enterprise solutions. We are happy to hear from you. If your ideas can benefit the community we will implement them. That's on us. But you are welcome to clone the project, build your idea, and send us a PR. We will accept it if it won't influence the stability of the project and it's safe to marge with the main branch.
39
+ The entire API Client project is community driven. We build tools for API developers to make them successful without investing into very expensive enterprise solutions. We are happy to hear from you. If your ideas can benefit the community we will implement them. That's on us. But you are welcome to clone the project, build your idea, and send us a PR. We will accept it if it won't influence the stability of the project and it's safe to marge with the main branch.
40
40
 
41
41
  ## Documentation
42
42
 
@@ -5,7 +5,7 @@ import { DataReader } from './DataReader.js';
5
5
  * Reads the value from a JSON document using the the JmesPath notation.
6
6
  * See https://jmespath.org/
7
7
  *
8
- * Note, after consideration this implementation is not used with ARC projects to extract
8
+ * Note, after consideration this implementation is not used with API Client projects to extract
9
9
  * request data. Instead, we use `JsonReader` that converts the JSON to XML so the same
10
10
  * XPath can be used for both JSON and XML.
11
11
  */
@@ -198,7 +198,7 @@ class ProjectEnvironmentEvents {
198
198
  }
199
199
 
200
200
  /**
201
- * ARC's HTTP project events.
201
+ * API Client's HTTP project events.
202
202
  *
203
203
  * Note, `id`s refers to datastore ids but `key`s are internal identifiers inside the project.
204
204
  * Whenever id is used it refers to the store's ids. When `key` is used it is the id of the project or any of its components.
@@ -328,4 +328,4 @@ export class ProjectEvents {
328
328
  static get Environment(): typeof ProjectEnvironmentEvents {
329
329
  return ProjectEnvironmentEvents;
330
330
  }
331
- };
331
+ }
@@ -1,6 +1,6 @@
1
1
  # Events
2
2
 
3
- This package contains a definition of events used by the ARC ecosystem to communicate with context providers.
3
+ This package contains a definition of events used by the API Client ecosystem to communicate with context providers.
4
4
 
5
5
  ## Context provider
6
6
 
@@ -188,7 +188,7 @@ export class PayloadSerializer {
188
188
  enabled: true,
189
189
  };
190
190
  if (file.name === 'blob') {
191
- // ARC adds the "blob" filename when the content type is set on the editor.
191
+ // API Client adds the "blob" filename when the content type is set on the editor.
192
192
  // otherwise it wouldn't be possible to set the content type value.
193
193
  part.type = file.type;
194
194
  } else {
@@ -297,9 +297,9 @@ export class PayloadSerializer {
297
297
  }
298
298
 
299
299
  /**
300
- * Deserializes FormData from ARC data model.
300
+ * Deserializes FormData from API Client data model.
301
301
  *
302
- * @param {IMultipartBody[]} model ARC model for multipart.
302
+ * @param parts API Client model for multipart.
303
303
  * @return {FormData} Restored form data
304
304
  */
305
305
  static deserializeFormData(parts: IMultipartBody[]): FormData {
@@ -5,7 +5,7 @@ import { User } from './lib/User.js';
5
5
  import { History } from './lib/History.js';
6
6
 
7
7
  export { IRequestLogInit } from './lib/Request.js';
8
- export { IArcResponseInit } from './lib/Response.js';
8
+ export { IResponseInit } from './lib/Response.js';
9
9
  export { ISpaceUserInit, IUserInit } from './lib/User.js';
10
10
  export { IHttpHistoryInit, IHttpHistoryListInit } from './lib/History.js';
11
11
 
@@ -3,12 +3,12 @@ import { Http, Types, Lorem, Time, DataMockInit, HttpRequestInit } from '@pawel-
3
3
  import { IHttpRequest, Kind as HttpRequestKind } from '../../models/HttpRequest.js';
4
4
  import { IRequest, Kind as RequestKind } from '../../models/Request.js';
5
5
  import { ISentRequest } from '../../models/SentRequest.js';
6
- import { IRequestLog } from '../../models/RequestLog.js';
7
- import { IArcResponseInit, Response } from './Response.js';
6
+ import { IRequestLog, Kind as RequestLogKind } from '../../models/RequestLog.js';
7
+ import { IResponseInit, Response } from './Response.js';
8
8
 
9
9
  export interface IRequestLogInit {
10
10
  request?: HttpRequestInit;
11
- response?: IArcResponseInit;
11
+ response?: IResponseInit;
12
12
  /**
13
13
  * When set it ignores size information
14
14
  */
@@ -66,13 +66,13 @@ export class Request {
66
66
 
67
67
  log(init: IRequestLogInit = {}): IRequestLog {
68
68
  const result: IRequestLog = {
69
- kind: 'ARC#ResponseLog',
69
+ kind: RequestLogKind,
70
70
  };
71
71
  if (!init.noRequest) {
72
72
  result.request = this.sentRequest(init.request);
73
73
  }
74
74
  if (!init.noResponse) {
75
- result.response = this.response.arcResponse(init.response);
75
+ result.response = this.response.response(init.response);
76
76
  }
77
77
  if (init.redirects) {
78
78
  result.redirects = this.response.redirects();
@@ -1,10 +1,10 @@
1
1
  import { Http, Har, Types, Lorem, Time, DataMockInit, HttpResponseInit, HarTimingInit, Internet } from '@pawel-up/data-mock';
2
2
  import { IHttpResponse, Kind as HttpResponseKind } from '../../models/HttpResponse.js';
3
- import { IArcResponse, Kind as ArcResponseKind } from '../../models/ArcResponse.js';
3
+ import { IResponse, Kind as ResponseKind } from '../../models/Response.js';
4
4
  import { IRequestsSize } from '../../models/RequestsSize.js';
5
5
  import { IResponseRedirect, Kind as ResponseRedirectKind } from '../../models/ResponseRedirect.js';
6
6
 
7
- export interface IArcResponseInit extends HttpResponseInit, HarTimingInit {
7
+ export interface IResponseInit extends HttpResponseInit, HarTimingInit {
8
8
  /**
9
9
  * When set it does not generate a response payload.
10
10
  */
@@ -36,7 +36,7 @@ export class Response {
36
36
  this.internet = new Internet(init);
37
37
  }
38
38
 
39
- response(init: IArcResponseInit = {}): IHttpResponse {
39
+ httpResponse(init: IResponseInit = {}): IHttpResponse {
40
40
  const ct = init.noBody ? undefined : this.http.headers.contentType();
41
41
  const body = init.noBody ? undefined : this.http.payload.payload(ct);
42
42
  const headers = this.http.headers.headers('response', { mime: ct });
@@ -56,12 +56,12 @@ export class Response {
56
56
  return result;
57
57
  }
58
58
 
59
- arcResponse(init: IArcResponseInit={}): IArcResponse {
60
- const base = this.response(init);
59
+ response(init: IResponseInit={}): IResponse {
60
+ const base = this.httpResponse(init);
61
61
  const length = this.types.number({ min: 10, max: 4000 });
62
- const result: IArcResponse = {
62
+ const result: IResponse = {
63
63
  ...base,
64
- kind: ArcResponseKind,
64
+ kind: ResponseKind,
65
65
  loadingTime: length,
66
66
  };
67
67
  if (init.timings) {
@@ -78,7 +78,7 @@ export class Response {
78
78
  return result;
79
79
  }
80
80
 
81
- redirect(init?: IArcResponseInit): IResponseRedirect {
81
+ redirect(init?: IResponseInit): IResponseRedirect {
82
82
  const start = this.time.timestamp();
83
83
  const end = this.time.timestamp({ min: start + 1 })
84
84
  const info: IResponseRedirect = {
@@ -86,12 +86,12 @@ export class Response {
86
86
  startTime: start,
87
87
  endTime: end,
88
88
  url: this.internet.uri(),
89
- response: this.response({ ...init, statusGroup: 3}),
89
+ response: this.httpResponse({ ...init, statusGroup: 3}),
90
90
  };
91
91
  return info;
92
92
  }
93
93
 
94
- redirects(size=1, init?: IArcResponseInit): IResponseRedirect[] {
94
+ redirects(size=1, init?: IResponseInit): IResponseRedirect[] {
95
95
  const result: IResponseRedirect[] = [];
96
96
  for (let i = 0; i < size; i++) {
97
97
  result.push(this.redirect(init));
@@ -1,6 +1,6 @@
1
1
  import { Internet, Types, DataMockInit, Person, Random } from '@pawel-up/data-mock';
2
2
  // import { randomValue } from '@pawel-up/data-mock/src/lib/Http.js';
3
- import { IUser, ISpaceUser, AccessControlLevel } from '../../models/User.js';
3
+ import { IUser, ISpaceUser, AccessControlLevel, Kind as UserKind } from '../../models/User.js';
4
4
 
5
5
 
6
6
  export interface IUserInit {
@@ -31,6 +31,7 @@ export class User {
31
31
 
32
32
  user(init: IUserInit = {}): IUser {
33
33
  const result: IUser = {
34
+ kind: UserKind,
34
35
  key: this.types.uuid(),
35
36
  name: this.person.name(),
36
37
  }
@@ -6,7 +6,7 @@ export interface IAuthorizationData {
6
6
 
7
7
 
8
8
  /**
9
- * Represents an auth data stored in ARC's data store to be retrieved
9
+ * Represents an auth data stored in API Client's data store to be retrieved
10
10
  * when the response status is 401.
11
11
  *
12
12
  * Each entry represent a Basic or NTLM authorization.
@@ -34,7 +34,7 @@ export class AuthorizationData {
34
34
  /**
35
35
  * Creates a new provider clearing anything that is so far defined.
36
36
  *
37
- * Note, this throws an error when the provider is not an ARC provider object.
37
+ * Note, this throws an error when the provider is not an API Client provider object.
38
38
  */
39
39
  new(init: IAuthorizationData): void {
40
40
  const { username, password, domain } = init;
@@ -61,7 +61,7 @@ export interface ICertificateIndex {
61
61
  }
62
62
 
63
63
  /**
64
- * A base client certificate object used in ARC to create / list objects.
64
+ * A base client certificate object used in API Client to create / list objects.
65
65
  * This is not a data entity but rather something used to outside of a context of a data store.
66
66
  */
67
67
  export interface IClientCertificate extends IRequestCertificate, ICertificateIndex {
@@ -16,7 +16,7 @@ export interface IEnvironmentCloneOptions {
16
16
  * A project environment definition.
17
17
  */
18
18
  export interface IEnvironment {
19
- kind: 'ARC#Environment';
19
+ kind: typeof Kind;
20
20
  /**
21
21
  * The identifier of the environment.
22
22
  */
@@ -47,7 +47,7 @@ export interface IEnvironment {
47
47
  security?: unknown;
48
48
  }
49
49
 
50
- export const Kind = 'ARC#Environment';
50
+ export const Kind = 'Core#Environment';
51
51
 
52
52
  /**
53
53
  * An environment is applied to a project or a folder.
@@ -145,11 +145,11 @@ export class Environment {
145
145
  /**
146
146
  * Creates a new environment clearing anything that is so far defined.
147
147
  *
148
- * Note, this throws an error when the environment is not an ARC environment.
148
+ * Note, this throws an error when the environment is not an environment.
149
149
  */
150
150
  new(init: IEnvironment): void {
151
151
  if (!Environment.isEnvironment(init)) {
152
- throw new Error(`Not an ARC environment.`);
152
+ throw new Error(`Not an environment.`);
153
153
  }
154
154
  const { key=v4(), variables, info, server, encapsulated=false, security } = init;
155
155
  this.kind = Kind;
@@ -86,7 +86,7 @@ export class ErrorResponse extends HttpResponse {
86
86
  /**
87
87
  * Creates a new request clearing anything that is so far defined.
88
88
  *
89
- * Note, this throws an error when the object is not an ARC request.
89
+ * Note, this throws an error when the object is not an API Client request.
90
90
  */
91
91
  new(init: IErrorResponse): void {
92
92
  super.new(init);
@@ -1,7 +1,7 @@
1
- export const Kind = 'ARC#HostRule';
1
+ export const Kind = 'Core#HostRule';
2
2
 
3
3
  /**
4
- * ARC host rule definition.
4
+ * API Client host rule definition.
5
5
  */
6
6
  export interface IHostRule {
7
7
  kind?: typeof Kind;
@@ -74,11 +74,11 @@ export class HostRule {
74
74
  /**
75
75
  * Creates a new thing clearing anything that is so far defined.
76
76
  *
77
- * Note, this throws an error when the server is not an ARC thing.
77
+ * Note, this throws an error when the server is not an API Client thing.
78
78
  */
79
79
  new(init: IHostRule): void {
80
80
  if (!HostRule.isHostRule(init)) {
81
- throw new Error(`Not an ARC HostRule.`);
81
+ throw new Error(`Not a HostRule.`);
82
82
  }
83
83
  const { from='', to='', enabled, comment } = init;
84
84
  this.kind = Kind;
@@ -138,7 +138,7 @@ export class HostRule {
138
138
  /**
139
139
  * Evaluates hosts rule and applies it to the `url`.
140
140
  * @param {string} url The URL to evaluate
141
- * @param {HostRule} rule ARC rule definition
141
+ * @param {HostRule} rule The host rule definition
142
142
  * @return {string} Processed url.
143
143
  */
144
144
  static evaluateRule(url: string, rule: HostRule): string | undefined {
@@ -1,6 +1,6 @@
1
1
  import { IRequestLog, RequestLog, Kind as RequestLogKind } from './RequestLog.js';
2
2
 
3
- export const Kind = 'ARC#HttpHistory';
3
+ export const Kind = 'Core#HttpHistory';
4
4
  export const createdSymbol = Symbol('created');
5
5
  export const midnightSymbol = Symbol('midnight');
6
6
 
@@ -48,6 +48,36 @@ export interface IHttpHistory {
48
48
  midnight?: number;
49
49
  }
50
50
 
51
+ /**
52
+ * An interface used when adding a history in bulk.
53
+ * The store creates a history object propagating meta values defined here
54
+ * onto the history objects.
55
+ * Because of that, bulk operation can only be performed when the requests are made in similar
56
+ * context (app, space, project).
57
+ */
58
+ export interface IHttpHistoryBulkAdd {
59
+ /**
60
+ * Optional user space id. Must be set when the originating request belongs to a user space.
61
+ */
62
+ space?: string;
63
+ /**
64
+ * Optional project id. Must be set when the originating request belongs to a user space.
65
+ */
66
+ project?: string;
67
+ /**
68
+ * Optional application id. Must be set when the application that created this record does not use the concept of a user space.
69
+ */
70
+ app?: string;
71
+ /**
72
+ * The optional request id in the project that generated this log.
73
+ */
74
+ request?: string;
75
+ /**
76
+ * The list of request logs.
77
+ */
78
+ log: IRequestLog[];
79
+ }
80
+
51
81
  /**
52
82
  * An HTTP history is an object containing an information of a request and response
53
83
  * made with the application.