@de./sdk 1.0.4 → 2.0.0

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 (383) hide show
  1. package/dist/allend/Access.d.ts +39 -3
  2. package/dist/allend/Access.js +147 -114
  3. package/dist/allend/Access.js.map +1 -1
  4. package/dist/allend/Agent/consolidation.d.ts +16 -0
  5. package/dist/allend/Agent/consolidation.js +38 -0
  6. package/dist/allend/Agent/consolidation.js.map +1 -0
  7. package/dist/allend/Agent/delivery.d.ts +11 -0
  8. package/dist/allend/Agent/delivery.js +43 -0
  9. package/dist/allend/Agent/delivery.js.map +1 -0
  10. package/dist/allend/Agent/dispatch.d.ts +8 -0
  11. package/dist/allend/Agent/dispatch.js +24 -0
  12. package/dist/allend/Agent/dispatch.js.map +1 -0
  13. package/dist/allend/Agent/index.d.ts +49 -0
  14. package/dist/allend/Agent/index.js +74 -0
  15. package/dist/allend/Agent/index.js.map +1 -0
  16. package/dist/allend/Agent/navigation.d.ts +8 -0
  17. package/dist/allend/Agent/navigation.js +25 -0
  18. package/dist/allend/Agent/navigation.js.map +1 -0
  19. package/dist/allend/Agent/origin.d.ts +9 -0
  20. package/dist/allend/Agent/origin.js +31 -0
  21. package/dist/allend/Agent/origin.js.map +1 -0
  22. package/dist/allend/Agent/reallocation.d.ts +7 -0
  23. package/dist/allend/Agent/reallocation.js +17 -0
  24. package/dist/allend/Agent/reallocation.js.map +1 -0
  25. package/dist/allend/Agent/realtime.d.ts +36 -0
  26. package/dist/allend/Agent/realtime.js +111 -0
  27. package/dist/allend/Agent/realtime.js.map +1 -0
  28. package/dist/allend/Agent/rides.d.ts +12 -0
  29. package/dist/allend/Agent/rides.js +51 -0
  30. package/dist/allend/Agent/rides.js.map +1 -0
  31. package/dist/allend/Agent/shipping.d.ts +11 -0
  32. package/dist/allend/Agent/shipping.js +43 -0
  33. package/dist/allend/Agent/shipping.js.map +1 -0
  34. package/dist/allend/CSP/analytics.d.ts +12 -0
  35. package/dist/allend/CSP/analytics.js +51 -0
  36. package/dist/allend/CSP/analytics.js.map +1 -0
  37. package/dist/allend/CSP/index.d.ts +25 -0
  38. package/dist/allend/CSP/index.js +43 -0
  39. package/dist/allend/CSP/index.js.map +1 -0
  40. package/dist/allend/CSP/inventory.d.ts +16 -0
  41. package/dist/allend/CSP/inventory.js +78 -0
  42. package/dist/allend/CSP/inventory.js.map +1 -0
  43. package/dist/allend/CSP/orders.d.ts +19 -0
  44. package/dist/allend/CSP/orders.js +97 -0
  45. package/dist/allend/CSP/orders.js.map +1 -0
  46. package/dist/allend/CSP/webhooks.d.ts +13 -0
  47. package/dist/allend/CSP/webhooks.js +56 -0
  48. package/dist/allend/CSP/webhooks.js.map +1 -0
  49. package/dist/allend/Customer/index.d.ts +27 -0
  50. package/dist/allend/Customer/index.js +39 -0
  51. package/dist/allend/Customer/index.js.map +1 -0
  52. package/dist/allend/Customer/intents.d.ts +12 -0
  53. package/dist/allend/Customer/intents.js +55 -0
  54. package/dist/allend/Customer/intents.js.map +1 -0
  55. package/dist/allend/Customer/orders.d.ts +11 -0
  56. package/dist/allend/Customer/orders.js +43 -0
  57. package/dist/allend/Customer/orders.js.map +1 -0
  58. package/dist/allend/Customer/rides.d.ts +12 -0
  59. package/dist/allend/Customer/rides.js +50 -0
  60. package/dist/allend/Customer/rides.js.map +1 -0
  61. package/dist/allend/DEV/developers.d.ts +11 -0
  62. package/dist/allend/DEV/developers.js +35 -0
  63. package/dist/allend/DEV/developers.js.map +1 -0
  64. package/dist/allend/DEV/index.d.ts +19 -0
  65. package/dist/allend/DEV/index.js +37 -0
  66. package/dist/allend/DEV/index.js.map +1 -0
  67. package/dist/allend/IoTClient.js +29 -35
  68. package/dist/allend/IoTClient.js.map +1 -1
  69. package/dist/allend/IoTSP/backend.d.ts +29 -0
  70. package/dist/allend/IoTSP/backend.js +75 -0
  71. package/dist/allend/IoTSP/backend.js.map +1 -0
  72. package/dist/allend/IoTSP/devices.d.ts +14 -0
  73. package/dist/allend/IoTSP/devices.js +61 -0
  74. package/dist/allend/IoTSP/devices.js.map +1 -0
  75. package/dist/allend/IoTSP/index.d.ts +28 -0
  76. package/dist/allend/IoTSP/index.js +84 -0
  77. package/dist/allend/IoTSP/index.js.map +1 -0
  78. package/dist/allend/IoTSP/rules.d.ts +17 -0
  79. package/dist/allend/IoTSP/rules.js +81 -0
  80. package/dist/allend/IoTSP/rules.js.map +1 -0
  81. package/dist/allend/IoTSP/topics.d.ts +17 -0
  82. package/dist/allend/IoTSP/topics.js +81 -0
  83. package/dist/allend/IoTSP/topics.js.map +1 -0
  84. package/dist/allend/LSP/agents.d.ts +20 -0
  85. package/dist/allend/LSP/agents.js +89 -0
  86. package/dist/allend/LSP/agents.js.map +1 -0
  87. package/dist/allend/LSP/carriers.d.ts +54 -0
  88. package/dist/allend/LSP/carriers.js +315 -0
  89. package/dist/allend/LSP/carriers.js.map +1 -0
  90. package/dist/allend/LSP/coverage.d.ts +44 -0
  91. package/dist/allend/LSP/coverage.js +135 -0
  92. package/dist/allend/LSP/coverage.js.map +1 -0
  93. package/dist/allend/LSP/fleets.d.ts +66 -0
  94. package/dist/allend/LSP/fleets.js +381 -0
  95. package/dist/allend/LSP/fleets.js.map +1 -0
  96. package/dist/allend/LSP/hubs.d.ts +39 -0
  97. package/dist/allend/LSP/hubs.js +186 -0
  98. package/dist/allend/LSP/hubs.js.map +1 -0
  99. package/dist/allend/LSP/index.d.ts +37 -0
  100. package/dist/allend/LSP/index.js +55 -0
  101. package/dist/allend/LSP/index.js.map +1 -0
  102. package/dist/allend/LSP/inventory.d.ts +13 -0
  103. package/dist/allend/LSP/inventory.js +56 -0
  104. package/dist/allend/LSP/inventory.js.map +1 -0
  105. package/dist/allend/LSP/operations.d.ts +47 -0
  106. package/dist/allend/LSP/operations.js +156 -0
  107. package/dist/allend/LSP/operations.js.map +1 -0
  108. package/dist/allend/LSP/orders.d.ts +69 -0
  109. package/dist/allend/LSP/orders.js +303 -0
  110. package/dist/allend/LSP/orders.js.map +1 -0
  111. package/dist/allend/LSP/pods.d.ts +26 -0
  112. package/dist/allend/LSP/pods.js +137 -0
  113. package/dist/allend/LSP/pods.js.map +1 -0
  114. package/dist/allend/LSP/pricing.d.ts +35 -0
  115. package/dist/allend/LSP/pricing.js +151 -0
  116. package/dist/allend/LSP/pricing.js.map +1 -0
  117. package/dist/allend/LSP/psl.d.ts +15 -0
  118. package/dist/allend/LSP/psl.js +68 -0
  119. package/dist/allend/LSP/psl.js.map +1 -0
  120. package/dist/allend/LSP/warehouses.d.ts +23 -0
  121. package/dist/allend/LSP/warehouses.js +94 -0
  122. package/dist/allend/LSP/warehouses.js.map +1 -0
  123. package/dist/allend/MSI/Controls.d.ts +9 -5
  124. package/dist/allend/MSI/Controls.js +269 -297
  125. package/dist/allend/MSI/Controls.js.map +1 -1
  126. package/dist/allend/MSI/Handles.d.ts +5 -4
  127. package/dist/allend/MSI/Handles.js +136 -233
  128. package/dist/allend/MSI/Handles.js.map +1 -1
  129. package/dist/allend/MSI/Plugins.d.ts +2 -2
  130. package/dist/allend/MSI/Plugins.js +12 -15
  131. package/dist/allend/MSI/Plugins.js.map +1 -1
  132. package/dist/allend/MSI/index.d.ts +4 -3
  133. package/dist/allend/MSI/index.js +123 -87
  134. package/dist/allend/MSI/index.js.map +1 -1
  135. package/dist/allend/MSI/native.d.ts +32 -0
  136. package/dist/allend/MSI/native.js +246 -0
  137. package/dist/allend/MSI/native.js.map +1 -0
  138. package/dist/allend/MSI/token.d.ts +12 -0
  139. package/dist/allend/MSI/token.js +21 -0
  140. package/dist/allend/MSI/token.js.map +1 -0
  141. package/dist/allend/OTPAuth/index.d.ts +77 -0
  142. package/dist/allend/OTPAuth/index.js +69 -0
  143. package/dist/allend/OTPAuth/index.js.map +1 -0
  144. package/dist/allend/Pipelines/analytics.d.ts +8 -0
  145. package/dist/allend/Pipelines/analytics.js +24 -0
  146. package/dist/allend/Pipelines/analytics.js.map +1 -0
  147. package/dist/allend/Pipelines/escalations.d.ts +8 -0
  148. package/dist/allend/Pipelines/escalations.js +25 -0
  149. package/dist/allend/Pipelines/escalations.js.map +1 -0
  150. package/dist/allend/Pipelines/executions.d.ts +11 -0
  151. package/dist/allend/Pipelines/executions.js +44 -0
  152. package/dist/allend/Pipelines/executions.js.map +1 -0
  153. package/dist/allend/Pipelines/index.d.ts +42 -0
  154. package/dist/allend/Pipelines/index.js +88 -0
  155. package/dist/allend/Pipelines/index.js.map +1 -0
  156. package/dist/allend/Pipelines/interventions.d.ts +8 -0
  157. package/dist/allend/Pipelines/interventions.js +25 -0
  158. package/dist/allend/Pipelines/interventions.js.map +1 -0
  159. package/dist/allend/Pipelines/monitor.d.ts +9 -0
  160. package/dist/allend/Pipelines/monitor.js +30 -0
  161. package/dist/allend/Pipelines/monitor.js.map +1 -0
  162. package/dist/allend/Pipelines/queries.d.ts +8 -0
  163. package/dist/allend/Pipelines/queries.js +25 -0
  164. package/dist/allend/Pipelines/queries.js.map +1 -0
  165. package/dist/allend/Pipelines/templates.d.ts +11 -0
  166. package/dist/allend/Pipelines/templates.js +46 -0
  167. package/dist/allend/Pipelines/templates.js.map +1 -0
  168. package/dist/allend/Pipelines/utils.d.ts +0 -0
  169. package/dist/allend/Pipelines/utils.js +2 -0
  170. package/dist/allend/Pipelines/utils.js.map +1 -0
  171. package/dist/allend/Pipelines/webhooks.d.ts +9 -0
  172. package/dist/allend/Pipelines/webhooks.js +35 -0
  173. package/dist/allend/Pipelines/webhooks.js.map +1 -0
  174. package/dist/allend/Pipelines/workers.d.ts +11 -0
  175. package/dist/allend/Pipelines/workers.js +45 -0
  176. package/dist/allend/Pipelines/workers.js.map +1 -0
  177. package/dist/allend/Queries/capacity.d.ts +11 -0
  178. package/dist/allend/Queries/capacity.js +44 -0
  179. package/dist/allend/Queries/capacity.js.map +1 -0
  180. package/dist/allend/Queries/discovery.d.ts +11 -0
  181. package/dist/allend/Queries/discovery.js +45 -0
  182. package/dist/allend/Queries/discovery.js.map +1 -0
  183. package/dist/allend/Queries/index.d.ts +27 -0
  184. package/dist/allend/Queries/index.js +40 -0
  185. package/dist/allend/Queries/index.js.map +1 -0
  186. package/dist/allend/Queries/matching.d.ts +7 -0
  187. package/dist/allend/Queries/matching.js +18 -0
  188. package/dist/allend/Queries/matching.js.map +1 -0
  189. package/dist/allend/Queries/performance.d.ts +9 -0
  190. package/dist/allend/Queries/performance.js +31 -0
  191. package/dist/allend/Queries/performance.js.map +1 -0
  192. package/dist/allend/Queries/pricing.d.ts +11 -0
  193. package/dist/allend/Queries/pricing.js +43 -0
  194. package/dist/allend/Queries/pricing.js.map +1 -0
  195. package/dist/allend/{DClient/Event.d.ts → Realtime/index.d.ts} +2 -6
  196. package/dist/allend/Realtime/index.js +62 -0
  197. package/dist/allend/Realtime/index.js.map +1 -0
  198. package/dist/allend/Shared/account.d.ts +10 -0
  199. package/dist/allend/Shared/account.js +22 -0
  200. package/dist/allend/Shared/account.js.map +1 -0
  201. package/dist/allend/Shared/buckets.d.ts +21 -0
  202. package/dist/allend/Shared/buckets.js +95 -0
  203. package/dist/allend/Shared/buckets.js.map +1 -0
  204. package/dist/allend/Shared/context.d.ts +14 -0
  205. package/dist/allend/Shared/context.js +33 -0
  206. package/dist/allend/Shared/context.js.map +1 -0
  207. package/dist/allend/Shared/faqs.d.ts +20 -0
  208. package/dist/allend/Shared/faqs.js +87 -0
  209. package/dist/allend/Shared/faqs.js.map +1 -0
  210. package/dist/allend/Shared/invitation.d.ts +42 -0
  211. package/dist/allend/Shared/invitation.js +40 -0
  212. package/dist/allend/Shared/invitation.js.map +1 -0
  213. package/dist/allend/Shared/operators.d.ts +39 -0
  214. package/dist/allend/Shared/operators.js +37 -0
  215. package/dist/allend/Shared/operators.js.map +1 -0
  216. package/dist/allend/Shared/users.d.ts +11 -0
  217. package/dist/allend/Shared/users.js +29 -0
  218. package/dist/allend/Shared/users.js.map +1 -0
  219. package/dist/allend/Tracking/index.d.ts +17 -0
  220. package/dist/allend/Tracking/index.js +39 -0
  221. package/dist/allend/Tracking/index.js.map +1 -0
  222. package/dist/allend/Utilities/common.d.ts +12 -0
  223. package/dist/allend/Utilities/common.js +53 -0
  224. package/dist/allend/Utilities/common.js.map +1 -0
  225. package/dist/allend/Utilities/fares.d.ts +10 -0
  226. package/dist/allend/Utilities/fares.js +39 -0
  227. package/dist/allend/Utilities/fares.js.map +1 -0
  228. package/dist/allend/Utilities/index.d.ts +23 -0
  229. package/dist/allend/Utilities/index.js +36 -0
  230. package/dist/allend/Utilities/index.js.map +1 -0
  231. package/dist/allend/Utilities/nearby.d.ts +9 -0
  232. package/dist/allend/Utilities/nearby.js +32 -0
  233. package/dist/allend/Utilities/nearby.js.map +1 -0
  234. package/dist/allend/Workflows/Client.d.ts +17 -0
  235. package/dist/allend/Workflows/Client.js +50 -0
  236. package/dist/allend/Workflows/Client.js.map +1 -0
  237. package/dist/allend/Workflows/Delivery.d.ts +36 -0
  238. package/dist/allend/Workflows/Delivery.js +16 -0
  239. package/dist/allend/Workflows/Delivery.js.map +1 -0
  240. package/dist/allend/Workflows/index.d.ts +11 -0
  241. package/dist/allend/Workflows/index.js +25 -0
  242. package/dist/allend/Workflows/index.js.map +1 -0
  243. package/dist/allend/Workspace/index.d.ts +162 -0
  244. package/dist/allend/Workspace/index.js +220 -0
  245. package/dist/allend/Workspace/index.js.map +1 -0
  246. package/dist/allend/index.d.ts +8 -5
  247. package/dist/allend/index.js +15 -8
  248. package/dist/allend/index.js.map +1 -1
  249. package/dist/backend/Auth.d.ts +28 -4
  250. package/dist/backend/Auth.js +125 -245
  251. package/dist/backend/Auth.js.map +1 -1
  252. package/dist/baseUrl.d.ts +56 -0
  253. package/dist/baseUrl.js +72 -4
  254. package/dist/baseUrl.js.map +1 -1
  255. package/dist/core.d.ts +88 -0
  256. package/dist/core.js +121 -0
  257. package/dist/core.js.map +1 -0
  258. package/dist/error.d.ts +17 -0
  259. package/dist/error.js +26 -0
  260. package/dist/error.js.map +1 -0
  261. package/dist/index.d.ts +30 -12
  262. package/dist/index.js +38 -14
  263. package/dist/index.js.map +1 -1
  264. package/dist/react-native.d.ts +30 -0
  265. package/dist/react-native.js +55 -0
  266. package/dist/react-native.js.map +1 -0
  267. package/dist/types/access.d.ts +64 -7
  268. package/dist/types/auth.d.ts +17 -17
  269. package/dist/types/channel.d.ts +45 -0
  270. package/dist/types/index.d.ts +379 -237
  271. package/dist/utils/index.d.ts +25 -0
  272. package/dist/utils/index.js +11 -1
  273. package/dist/utils/index.js.map +1 -1
  274. package/dist/utils/stream.js +25 -26
  275. package/dist/utils/stream.js.map +1 -1
  276. package/package.json +38 -18
  277. package/src/allend/Access.ts +143 -13
  278. package/src/allend/Agent/consolidation.ts +43 -0
  279. package/src/allend/Agent/delivery.ts +51 -0
  280. package/src/allend/Agent/dispatch.ts +27 -0
  281. package/src/allend/Agent/index.ts +113 -0
  282. package/src/allend/Agent/navigation.ts +27 -0
  283. package/src/allend/Agent/origin.ts +36 -0
  284. package/src/allend/Agent/reallocation.ts +16 -0
  285. package/src/allend/Agent/realtime.ts +140 -0
  286. package/src/allend/Agent/rides.ts +61 -0
  287. package/src/allend/Agent/shipping.ts +51 -0
  288. package/src/allend/CSP/analytics.ts +61 -0
  289. package/src/allend/CSP/index.ts +57 -0
  290. package/src/allend/CSP/inventory.ts +96 -0
  291. package/src/allend/CSP/orders.ts +121 -0
  292. package/src/allend/CSP/webhooks.ts +68 -0
  293. package/src/allend/Customer/index.ts +56 -0
  294. package/src/allend/Customer/intents.ts +66 -0
  295. package/src/allend/Customer/orders.ts +51 -0
  296. package/src/allend/Customer/rides.ts +60 -0
  297. package/src/allend/DEV/developers.ts +42 -0
  298. package/src/allend/DEV/index.ts +48 -0
  299. package/src/allend/IoTSP/backend.ts +103 -0
  300. package/src/allend/IoTSP/devices.ts +74 -0
  301. package/src/allend/IoTSP/index.ts +69 -0
  302. package/src/allend/IoTSP/rules.ts +99 -0
  303. package/src/allend/IoTSP/topics.ts +99 -0
  304. package/src/allend/LSP/agents.ts +115 -0
  305. package/src/allend/LSP/carriers.ts +408 -0
  306. package/src/allend/LSP/coverage.ts +212 -0
  307. package/src/allend/LSP/fleets.ts +505 -0
  308. package/src/allend/LSP/hubs.ts +245 -0
  309. package/src/allend/LSP/index.ts +75 -0
  310. package/src/allend/LSP/inventory.ts +65 -0
  311. package/src/allend/LSP/operations.ts +202 -0
  312. package/src/allend/LSP/orders.ts +397 -0
  313. package/src/allend/LSP/pods.ts +176 -0
  314. package/src/allend/LSP/pricing.ts +192 -0
  315. package/src/allend/LSP/psl.ts +81 -0
  316. package/src/allend/LSP/warehouses.ts +118 -0
  317. package/src/allend/MSI/Controls.ts +109 -90
  318. package/src/allend/MSI/Handles.ts +24 -15
  319. package/src/allend/MSI/Plugins.ts +3 -3
  320. package/src/allend/MSI/index.ts +85 -16
  321. package/src/allend/MSI/native.tsx +314 -0
  322. package/src/allend/MSI/token.ts +20 -0
  323. package/src/allend/OTPAuth/index.ts +130 -0
  324. package/src/allend/Pipelines/analytics.ts +25 -0
  325. package/src/allend/Pipelines/escalations.ts +26 -0
  326. package/src/allend/Pipelines/executions.ts +51 -0
  327. package/src/allend/Pipelines/index.ts +125 -0
  328. package/src/allend/Pipelines/interventions.ts +27 -0
  329. package/src/allend/Pipelines/monitor.ts +33 -0
  330. package/src/allend/Pipelines/queries.ts +27 -0
  331. package/src/allend/Pipelines/templates.ts +51 -0
  332. package/src/allend/Pipelines/utils.ts +0 -0
  333. package/src/allend/Pipelines/webhooks.ts +36 -0
  334. package/src/allend/Pipelines/workers.ts +49 -0
  335. package/src/allend/Queries/capacity.ts +51 -0
  336. package/src/allend/Queries/discovery.ts +53 -0
  337. package/src/allend/Queries/index.ts +58 -0
  338. package/src/allend/Queries/matching.ts +16 -0
  339. package/src/allend/Queries/performance.ts +35 -0
  340. package/src/allend/Queries/pricing.ts +51 -0
  341. package/src/allend/{DClient/Event.ts → Realtime/index.ts} +23 -22
  342. package/src/allend/Shared/account.ts +24 -0
  343. package/src/allend/Shared/buckets.ts +117 -0
  344. package/src/allend/Shared/context.ts +36 -0
  345. package/src/allend/Shared/faqs.ts +106 -0
  346. package/src/allend/Shared/invitation.ts +77 -0
  347. package/src/allend/Shared/operators.ts +84 -0
  348. package/src/allend/Shared/users.ts +32 -0
  349. package/src/allend/Tracking/index.ts +48 -0
  350. package/src/allend/Utilities/common.ts +63 -0
  351. package/src/allend/Utilities/fares.ts +45 -0
  352. package/src/allend/Utilities/index.ts +52 -0
  353. package/src/allend/Utilities/nearby.ts +36 -0
  354. package/src/allend/{DClient → Workflows}/Client.ts +12 -22
  355. package/src/allend/Workflows/Delivery.ts +94 -0
  356. package/src/allend/Workflows/index.ts +31 -0
  357. package/src/allend/Workspace/index.ts +302 -0
  358. package/src/allend/index.ts +23 -10
  359. package/src/backend/Auth.ts +68 -35
  360. package/src/baseUrl.ts +81 -7
  361. package/src/core.ts +145 -0
  362. package/src/error.ts +27 -0
  363. package/src/index.ts +25 -17
  364. package/src/react-native.ts +43 -0
  365. package/src/types/access.d.ts +64 -7
  366. package/src/types/auth.d.ts +17 -17
  367. package/src/types/channel.d.ts +45 -0
  368. package/src/types/index.d.ts +379 -237
  369. package/src/utils/index.ts +33 -1
  370. package/dist/allend/DAuth/index.d.ts +0 -20
  371. package/dist/allend/DAuth/index.js +0 -92
  372. package/dist/allend/DAuth/index.js.map +0 -1
  373. package/dist/allend/DClient/Client.d.ts +0 -10
  374. package/dist/allend/DClient/Client.js +0 -144
  375. package/dist/allend/DClient/Client.js.map +0 -1
  376. package/dist/allend/DClient/Event.js +0 -100
  377. package/dist/allend/DClient/Event.js.map +0 -1
  378. package/dist/allend/DClient/Order.d.ts +0 -49
  379. package/dist/allend/DClient/Order.js +0 -601
  380. package/dist/allend/DClient/Order.js.map +0 -1
  381. package/dist/bundle.js +0 -1
  382. package/src/allend/DAuth/index.ts +0 -39
  383. package/src/allend/DClient/Order.ts +0 -452
@@ -5,11 +5,32 @@ import IOF from 'iframe.io'
5
5
  import Handles from './Handles'
6
6
  import Controls from './Controls'
7
7
  import Plugins, { type Plugin } from './Plugins'
8
+ import resolveAccessToken from './token'
8
9
 
9
10
  const
10
11
  SANDBOX_RULES = ['allow-scripts', 'allow-same-origin'],
11
12
  REQUIRED_FEATURES = ['geolocation'],
12
- REGISTERED_PLUGINS: Record<string, Plugin<any>> = {}
13
+ REGISTERED_PLUGINS: Record<string, Plugin<any>> = {},
14
+
15
+ // How long to wait for the gateway to embed, connect and bind
16
+ LOAD_TIMEOUT = 30000,
17
+
18
+ /**
19
+ * Events the gateway is allowed to send us. Anything else is dropped by the
20
+ * transport before it reaches a listener.
21
+ */
22
+ ALLOWED_INCOMING_EVENTS = [
23
+ 'error',
24
+ 'ready',
25
+ 'pick:location',
26
+ 'current:location',
27
+ 'current:location:error',
28
+ 'live:location:start',
29
+ 'live:location:update',
30
+ 'live:location:end',
31
+ 'route',
32
+ 'navigation:direction'
33
+ ]
13
34
 
14
35
  export interface MSIInterface {
15
36
  controls: Controls,
@@ -22,6 +43,7 @@ export default class MSI extends EventEmitter {
22
43
  private baseURL: string
23
44
  private isConnected: boolean
24
45
  private options: MapOptions
46
+ private element: string
25
47
  private chn?: IOF
26
48
 
27
49
  /**
@@ -33,11 +55,23 @@ export default class MSI extends EventEmitter {
33
55
  super()
34
56
 
35
57
  this.options = options
36
- if( !this.options.accessToken )
37
- throw new Error('Invalid Access Token')
58
+
59
+ /**
60
+ * `element` is optional on MapOptions because the React Native entry
61
+ * renders a component instead, but the web entry cannot mount without it.
62
+ */
63
+ if( !this.options.element )
64
+ throw new Error('Undefined HTML Element Container')
65
+
66
+ this.element = this.options.element
67
+
68
+ // Throws when neither `accessToken` nor `getAccessToken` yields a token
69
+ resolveAccessToken( this.options )
38
70
 
39
71
  this.isDev = this.options.env == 'dev' || false
40
- this.baseURL = this.isDev ? 'http://localhost:4800' : 'https://msi.dedot.io'
72
+ this.baseURL = this.isDev
73
+ ? `http://${this.options.devHostname || 'localhost'}:4800`
74
+ : 'https://msi.dedot.io'
41
75
 
42
76
  this.isConnected = false
43
77
  }
@@ -53,12 +87,28 @@ export default class MSI extends EventEmitter {
53
87
  // Remove all previous listeners when iframe reloaded
54
88
  this.chn && this.chn.removeListeners()
55
89
 
56
- this.chn = new IOF({ type: 'WINDOW' })
90
+ this.chn = new IOF({
91
+ type: 'WINDOW',
92
+ allowedIncomingEvents: ALLOWED_INCOMING_EVENTS,
93
+ maxMessagesPerSecond: 100,
94
+ connectionTimeout: 10000
95
+ })
57
96
  this.chn.initiate( iframe.contentWindow as Window, this.baseURL )
58
97
 
59
98
  this.chn
60
99
  .once('connect', () => {
61
- this.chn?.emit('bind', { ...this.options, origin: window.origin }, ( error: string | boolean ) => {
100
+ /**
101
+ * Resolve the token at bind time rather than reusing the one captured at
102
+ * construction, so a host supplying `getAccessToken` reconnects with a
103
+ * fresh token after a reload.
104
+ */
105
+ const { getAccessToken, ...config } = this.options
106
+
107
+ this.chn?.emit('bind', {
108
+ ...config,
109
+ accessToken: resolveAccessToken( this.options ),
110
+ origin: window.origin
111
+ }, ( error: string | boolean ) => {
62
112
  if( error )
63
113
  return this.emit('error', new Error( error as string ) )
64
114
 
@@ -67,7 +117,6 @@ export default class MSI extends EventEmitter {
67
117
  })
68
118
  .on('error', ( error: Error | string ) => this.emit('error', typeof error == 'object' ? error : new Error( error ) ) )
69
119
  .on('ready', () => {
70
- console.log('Ready by ready-event')
71
120
  this.emit('ready')
72
121
  this.emit('loaded', this.chn )
73
122
  })
@@ -79,8 +128,8 @@ export default class MSI extends EventEmitter {
79
128
  * an iframe.
80
129
  */
81
130
  private render(){
82
- const container = document.getElementById( this.options.element )
83
- if( !container ) throw new Error(`HTML Element Container <#${this.options.element}> Not Found`)
131
+ const container = document.getElementById( this.element )
132
+ if( !container ) throw new Error(`HTML Element Container <#${this.element}> Not Found`)
84
133
 
85
134
  container.innerHTML = `<iframe id="de-sdk:map"
86
135
  src="${this.baseURL}"
@@ -99,20 +148,31 @@ export default class MSI extends EventEmitter {
99
148
  }
100
149
 
101
150
  /**
102
- * Handle gateway embedding network error
151
+ * Surface a failure that happened while embedding the gateway
103
152
  */
104
- private networkError(){
153
+ private embedError( error: Error ){
105
154
  this.isConnected = false
106
- this.emit('error', new Error('Internet network problem') )
155
+ this.emit('error', error )
107
156
  }
108
157
 
109
158
  /**
110
159
  * Initiate embedding of gateway into current UI by
111
160
  * check network and remote gateway availability.
112
161
  */
113
- load(): Promise<MSIInterface> {
162
+ load( timeout: number = LOAD_TIMEOUT ): Promise<MSIInterface> {
114
163
  return new Promise( ( resolve, reject ) => {
164
+ /**
165
+ * Without this the promise stays pending forever whenever the iframe
166
+ * never loads or the host never completes `bind`.
167
+ */
168
+ const timer = setTimeout( () => {
169
+ this.isConnected = false
170
+ reject( new Error('MSI gateway load timeout') )
171
+ }, timeout )
172
+
115
173
  const initializeAPI = ( chn: IOF ) => {
174
+ clearTimeout( timer )
175
+
116
176
  const
117
177
  /**
118
178
  * Manual controls of the map remotely
@@ -133,12 +193,21 @@ export default class MSI extends EventEmitter {
133
193
 
134
194
  this
135
195
  .once('loaded', initializeAPI )
136
- .once('error', reject )
196
+ .once('error', ( error: Error ) => {
197
+ clearTimeout( timer )
198
+ reject( error )
199
+ } )
137
200
 
138
201
  window
139
202
  .fetch( this.baseURL, { mode: 'no-cors' })
140
- .then( this.render.bind( this ) )
141
- .catch( this.networkError.bind( this ) )
203
+ // Only a genuine reachability failure is a network problem
204
+ .catch( () => { throw new Error('Internet network problem') } )
205
+ /**
206
+ * Kept in a separate step so a `render` failure (Eg. a missing container
207
+ * element) reports itself rather than being relabelled a network error.
208
+ */
209
+ .then( () => this.render() )
210
+ .catch( this.embedError.bind( this ) )
142
211
  } )
143
212
  }
144
213
 
@@ -0,0 +1,314 @@
1
+ import type { MapOptions } from '../../types'
2
+
3
+ import React, { useRef, useEffect, useState, useCallback, forwardRef, useImperativeHandle } from 'react'
4
+ import { View, StyleSheet, AppState, type AppStateStatus, Platform } from 'react-native'
5
+ import { WebView } from 'react-native-webview'
6
+ import WIO from 'webview.io'
7
+ import Handles from './Handles'
8
+ import Controls from './Controls'
9
+ import Plugins, { type Plugin } from './Plugins'
10
+ import resolveAccessToken from './token'
11
+
12
+ export interface MSIInterface {
13
+ controls: Controls
14
+ handles: Handles
15
+ plugins: Plugins
16
+ }
17
+
18
+ const
19
+ REGISTERED_PLUGINS: Record<string, Plugin<any>> = {},
20
+
21
+ // Time allowed for the gateway to acknowledge `bind`
22
+ BIND_TIMEOUT = 10000,
23
+
24
+ /**
25
+ * Events the gateway is allowed to send us. Anything else is dropped by the
26
+ * transport before it reaches a listener.
27
+ *
28
+ * Kept identical to the web entry: the gateway speaks one protocol, and the
29
+ * two entries differ only in transport.
30
+ */
31
+ ALLOWED_INCOMING_EVENTS = [
32
+ 'error',
33
+ 'ready',
34
+ 'pick:location',
35
+ 'current:location',
36
+ 'current:location:error',
37
+ 'live:location:start',
38
+ 'live:location:update',
39
+ 'live:location:end',
40
+ 'route',
41
+ 'navigation:direction'
42
+ ]
43
+
44
+ /**
45
+ * Forward the WebView's console into the React Native log.
46
+ *
47
+ * Injected only in dev: in production it turns every gateway log into a bridge
48
+ * message, which is pure overhead on the very traffic the map depends on.
49
+ */
50
+ function injectedConsole(): string {
51
+ return `
52
+ (function(){
53
+ var forward = function( level ){
54
+ var original = console[ level ]
55
+ console[ level ] = function(){
56
+ var args = Array.prototype.slice.call( arguments )
57
+ try {
58
+ window.ReactNativeWebView.postMessage( JSON.stringify({
59
+ type: '__console',
60
+ level: level,
61
+ message: args.map( String ).join(' ')
62
+ }) )
63
+ }
64
+ catch( error ){}
65
+
66
+ original.apply( console, args )
67
+ }
68
+ }
69
+
70
+ forward('log')
71
+ forward('warn')
72
+ forward('error')
73
+ })();
74
+ `
75
+ }
76
+
77
+ /**
78
+ * Resolve the gateway host for the running platform.
79
+ *
80
+ * A native app cannot reach the developer's machine on `localhost`: the Android
81
+ * emulator maps the host to 10.0.2.2, and a physical device needs the LAN
82
+ * address, supplied as `devHostname`.
83
+ */
84
+ function gatewayURL({ env, devHostname }: MapOptions ): string {
85
+ if( env !== 'dev' ) return 'https://msi.dedot.io'
86
+
87
+ const host = devHostname
88
+ || Platform.select({ android: '10.0.2.2', default: 'localhost' })
89
+
90
+ return `http://${host}:4800`
91
+ }
92
+
93
+ export interface MSIProps extends MapOptions {
94
+ onReady?: () => void
95
+ onError?: ( error: Error ) => void
96
+ onLoaded?: ( msi: MSIInterface ) => void
97
+ style?: any
98
+ }
99
+
100
+ export interface MSIRef extends Partial<MSIInterface> {
101
+ isReady: () => boolean
102
+ retry: () => void
103
+ }
104
+
105
+ /**
106
+ * MSI gateway for React Native.
107
+ *
108
+ * Mirrors the web entry: same Controls/Handles/Plugins surface, same protocol,
109
+ * same event allowlist -- only the transport and the mounting differ.
110
+ */
111
+ export default forwardRef<MSIRef, MSIProps>( ( props, ref ) => {
112
+ const
113
+ webViewRef = useRef<WebView>( null ),
114
+ wioRef = useRef<WIO | null>( null ),
115
+ apiRef = useRef<MSIInterface | null>( null ),
116
+ isInitializedRef = useRef( false ),
117
+
118
+ [ isConnected, setIsConnected ] = useState( false ),
119
+ [ isReady, setIsReady ] = useState( false ),
120
+
121
+ baseURL = gatewayURL( props ),
122
+
123
+ /**
124
+ * Report an error once, in Error form, whatever shape the transport used.
125
+ */
126
+ reportError = useCallback( ( error: any ) => {
127
+ const normalized = error instanceof Error
128
+ ? error
129
+ : new Error( typeof error === 'string' ? error : error?.error || 'Unknown MSI error')
130
+
131
+ props.onError?.( normalized )
132
+ }, [ props.onError ] ),
133
+
134
+ initializeConnection = useCallback( () => {
135
+ if( !wioRef.current || !webViewRef.current ) return
136
+ wioRef.current.initiate( webViewRef, baseURL )
137
+ }, [ baseURL ] )
138
+
139
+ // Expose the control surface to the host
140
+ useImperativeHandle( ref, () => ({
141
+ get controls(){ return apiRef.current?.controls },
142
+ get handles(){ return apiRef.current?.handles },
143
+ get plugins(){ return apiRef.current?.plugins },
144
+ isReady: () => isConnected && isReady,
145
+ retry: () => {
146
+ isInitializedRef.current = false
147
+ initializeConnection()
148
+ }
149
+ }), [ isConnected, isReady, initializeConnection ] )
150
+
151
+ useEffect( () => {
152
+ const wio = wioRef.current = new WIO({
153
+ type: 'WEBVIEW',
154
+ debug: props.env === 'dev',
155
+ allowedIncomingEvents: ALLOWED_INCOMING_EVENTS,
156
+ maxMessagesPerSecond: 100,
157
+ connectionTimeout: 15000,
158
+ connectionPingInterval: 2000,
159
+ maxConnectionAttempts: 5,
160
+ autoReconnect: true,
161
+ heartbeatInterval: 30000
162
+ })
163
+
164
+ wio
165
+ .on('connect', async () => {
166
+ try {
167
+ /**
168
+ * Resolve the token here rather than at mount, so a reconnect after a
169
+ * backgrounded app or a dropped bridge binds with a current token.
170
+ */
171
+ const { getAccessToken, onReady, onError, onLoaded, style, ...config } = props
172
+
173
+ await wio.emitAsync('bind', {
174
+ ...config,
175
+ accessToken: resolveAccessToken( props ),
176
+ origin: 'react-native'
177
+ }, BIND_TIMEOUT )
178
+
179
+ setIsConnected( true )
180
+ }
181
+ catch( error ){ reportError( error ) }
182
+ })
183
+ .on('ready', () => {
184
+ setIsReady( true )
185
+ props.onReady?.()
186
+ })
187
+ .on('disconnect', () => {
188
+ setIsConnected( false )
189
+ setIsReady( false )
190
+ })
191
+ .on('reconnecting', () => {
192
+ setIsConnected( false )
193
+ setIsReady( false )
194
+ })
195
+ .on('connect_timeout', ({ attempts }: any ) => reportError( new Error(`Failed to connect after ${attempts} attempts`) ) )
196
+ .on('reconnection_failed', ({ attempts }: any ) => reportError( new Error(`Reconnection failed after ${attempts} attempts`) ) )
197
+ .on('error', ( error: any ) => {
198
+ // Rate limiting is throttling, not a failure of the map
199
+ if( error?.type === 'RATE_LIMIT_EXCEEDED' ) return
200
+ reportError( error )
201
+ })
202
+
203
+ /**
204
+ * Pause gateway work while backgrounded, and re-establish the bridge on
205
+ * resume -- iOS in particular tears down the WebView's socket.
206
+ */
207
+ const subscription = AppState.addEventListener('change', ( state: AppStateStatus ) => {
208
+ if( state === 'background' ){
209
+ wio.emit('app:background')
210
+ return
211
+ }
212
+
213
+ if( state === 'active' ){
214
+ wio.emit('app:foreground')
215
+ !wio.isConnected() && initializeConnection()
216
+ }
217
+ })
218
+
219
+ return () => {
220
+ subscription.remove()
221
+ wio.disconnect()
222
+
223
+ apiRef.current = null
224
+ isInitializedRef.current = false
225
+ }
226
+ }, [] )
227
+
228
+ // Build the control surface once the bridge is both connected and ready
229
+ useEffect( () => {
230
+ if( isInitializedRef.current || !wioRef.current || !isConnected || !isReady ) return
231
+
232
+ const
233
+ chn = wioRef.current,
234
+ controls = new Controls( chn, props ),
235
+ handles = new Handles( chn, controls, props ),
236
+ plugins = new Plugins( chn, handles, controls, props )
237
+
238
+ plugins.mount( REGISTERED_PLUGINS )
239
+
240
+ apiRef.current = { controls, handles, plugins }
241
+ isInitializedRef.current = true
242
+
243
+ props.onLoaded?.( apiRef.current )
244
+ }, [ isConnected, isReady ] )
245
+
246
+ const onMessage = ( event: any ) => {
247
+ // Console forwarding rides the same bridge; peel it off before WIO sees it
248
+ try {
249
+ const data = JSON.parse( event.nativeEvent.data )
250
+ if( data?.type === '__console' ){
251
+ const message = `[MSI gateway] ${data.message}`
252
+
253
+ switch( data.level ){
254
+ case 'error': console.error( message ); break
255
+ case 'warn': console.warn( message ); break
256
+ default: console.debug( message )
257
+ }
258
+
259
+ return
260
+ }
261
+ }
262
+ catch( error ){
263
+ // Not console traffic -- fall through to the transport
264
+ }
265
+
266
+ wioRef.current?.handleMessage( event )
267
+ }
268
+
269
+ return (
270
+ <View style={[ styles.container, props.style ]}>
271
+ <WebView
272
+ ref={webViewRef}
273
+ source={{ uri: baseURL }}
274
+ style={styles.webview}
275
+ injectedJavaScript={`
276
+ ${props.env === 'dev' ? injectedConsole() : ''}
277
+ ${new WIO({ type: 'WEBVIEW' }).getInjectedJavaScript()}
278
+ `}
279
+ javaScriptEnabled
280
+ domStorageEnabled
281
+ geolocationEnabled
282
+ allowsInlineMediaPlayback
283
+ cacheEnabled={props.env !== 'dev'}
284
+ incognito={props.env === 'dev'}
285
+ androidLayerType="hardware"
286
+ allowsBackForwardNavigationGestures={false}
287
+ bounces={false}
288
+ scrollEnabled={false}
289
+ originWhitelist={[ baseURL ]}
290
+ onMessage={onMessage}
291
+ onLoadEnd={initializeConnection}
292
+ onError={( { nativeEvent }: any ) => reportError( new Error( nativeEvent?.description || 'WebView error') )}
293
+ />
294
+ </View>
295
+ )
296
+ } )
297
+
298
+ /**
299
+ * Register a plugin to be mounted on every MSI instance.
300
+ */
301
+ export function plugin<T>( name: string, fn: Plugin<T> ){
302
+ REGISTERED_PLUGINS[ name ] = fn
303
+ }
304
+
305
+ const styles = StyleSheet.create({
306
+ container: {
307
+ flex: 1,
308
+ backgroundColor: '#f0f0f0'
309
+ },
310
+ webview: {
311
+ flex: 1,
312
+ backgroundColor: 'transparent'
313
+ }
314
+ })
@@ -0,0 +1,20 @@
1
+ import type { MapOptions } from '../../types'
2
+
3
+ /**
4
+ * Resolve the access token to bind the gateway with.
5
+ *
6
+ * `getAccessToken` wins when supplied, and is deliberately called at every bind
7
+ * rather than read once: a host that rotates tokens can hand back a fresh one
8
+ * on reconnect without the caller having to drive `controls.refreshToken()`.
9
+ *
10
+ * @param options - Map options carrying either form of the token
11
+ * @return - A non-empty access token
12
+ */
13
+ export default function resolveAccessToken( options: MapOptions ): string {
14
+ const token = options.getAccessToken?.() || options.accessToken
15
+
16
+ if( !token )
17
+ throw new Error('Invalid Access Token')
18
+
19
+ return token
20
+ }
@@ -0,0 +1,130 @@
1
+ import type { AccessOptions, UserSession } from '../../types/access'
2
+ import AccessManager from '../Access'
3
+ import { qs, type Res } from '../../utils'
4
+
5
+ // ─────────────────────────────────────────────────────────────────────────────
6
+ //
7
+ // OTPAuth: sign a person in — de.auth routes.
8
+ //
9
+ // The whole flow is phone-and-OTP, in three steps:
10
+ //
11
+ // signin( phone, device ) → sends the code, replies `{ next }`
12
+ // verify( phone, pvc ) → replies the session: ctoken + deviceId
13
+ // setAccount( … ) → only when `next` says the person is new
14
+ //
15
+ // This client used to POST `/v1/auth/otp`, which de.auth does not serve — the
16
+ // single method it had could never succeed. Route shapes are taken from
17
+ // de.auth/src/routes/{auth,user}/index.ts.
18
+ //
19
+ // ─────────────────────────────────────────────────────────────────────────────
20
+
21
+ export type SigninBody = {
22
+ phone: string
23
+ /** Device fingerprint — an object or its JSON string. */
24
+ device: string | Record<string, any>
25
+ /** ISO 3166-1 alpha-2. */
26
+ country?: string
27
+ }
28
+
29
+ export type SigninResult = {
30
+ /** What the caller must do next — verification, or account creation first. */
31
+ next: string
32
+ /**
33
+ * The OTP itself, returned only when de.auth runs with
34
+ * NODE_ENV=development. In every other environment the code arrives by SMS
35
+ * and this is absent, which is what makes unattended sign-in a dev-only
36
+ * capability rather than a hole.
37
+ */
38
+ testVCode?: number
39
+ }
40
+
41
+ export type CreateAccountBody = {
42
+ phone: string
43
+ agreeTerms: boolean | string
44
+ firstName?: string
45
+ lastName?: string
46
+ photo?: string
47
+ type?: string
48
+ country?: string
49
+ newsletters?: boolean | string
50
+ }
51
+
52
+ export type VerifyResult = {
53
+ ctoken?: string
54
+ deviceId?: string
55
+ [ key: string ]: any
56
+ }
57
+
58
+ export default class OTPAuth extends AccessManager {
59
+ constructor( access: AccessOptions ){
60
+ super( access, 'ASI' )
61
+ }
62
+
63
+ // ── Sign-in ───────────────────────────────────────────────────────────────
64
+
65
+ /** Step 1 — sends the code. */
66
+ async signin( body: SigninBody ): Promise<Res<SigninResult>> {
67
+ if( !body.phone ) throw new Error('<phone> argument required')
68
+
69
+ return this.request<Res<SigninResult>>({ url: '/signin', method: 'POST', body })
70
+ }
71
+
72
+ /** Step 2 — exchanges the code for a session. */
73
+ async verify( body: { phone: string, pvc: number, new_phone?: string }): Promise<Res<VerifyResult>> {
74
+ return this.request<Res<VerifyResult>>({ url: '/verification', method: 'POST', body })
75
+ }
76
+
77
+ /** Step 1a — for a phone de.auth has never seen. */
78
+ async setAccount( body: CreateAccountBody ): Promise<Res<{ next: string }>> {
79
+ return this.request<Res<{ next: string }>>({ url: '/set-account', method: 'POST', body })
80
+ }
81
+
82
+ async resendSms( body: { phone: string }): Promise<Res<void>> {
83
+ return this.request<Res<void>>({ url: '/resend/sms', method: 'POST', body })
84
+ }
85
+
86
+ /** GET, with the scope in the querystring — not a POST. */
87
+ async signout( querystring?: { allDevices?: boolean | string }): Promise<Res<void>> {
88
+ return this.request<Res<void>>({ url: `/signout${qs( querystring )}`, method: 'GET' })
89
+ }
90
+
91
+ // ── The signed-in person ──────────────────────────────────────────────────
92
+
93
+ /**
94
+ * Resolve the session to a user, and to a uid.
95
+ *
96
+ * `scope` is not optional in practice: without it de.auth falls back to the
97
+ * calling service's configured scope and then fails its own response
98
+ * validation. This is the same scope de.arch asks for.
99
+ */
100
+ async active( session: UserSession, scope = 'name:photo:email:phone:timezone' ): Promise<Res<{ uid: string }>> {
101
+ return this.request<Res<{ uid: string }>>({
102
+ url: `/user/active${qs({ scope })}`,
103
+ method: 'GET',
104
+ headers: {
105
+ 'de-auth-token': session.token,
106
+ 'de-auth-device': session.device
107
+ }
108
+ })
109
+ }
110
+
111
+ async retrieve( querystring?: { type?: string }): Promise<Res<{ user: any }>> {
112
+ return this.request<Res<{ user: any }>>({ url: `/user${qs( querystring )}`, method: 'GET' })
113
+ }
114
+
115
+ async search( querystring: Record<string, any> ): Promise<Res<any>> {
116
+ return this.request<Res<any>>({ url: `/user/search${qs( querystring )}`, method: 'GET' })
117
+ }
118
+
119
+ async updateProfile( body: Record<string, any> ): Promise<Res<any>> {
120
+ return this.request<Res<any>>({ url: '/user/profile', method: 'PATCH', body })
121
+ }
122
+
123
+ async updateSettings( body: Record<string, any> ): Promise<Res<any>> {
124
+ return this.request<Res<any>>({ url: '/user/settings', method: 'PATCH', body })
125
+ }
126
+
127
+ async remove( body: Record<string, any> ): Promise<Res<void>> {
128
+ return this.request<Res<void>>({ url: '/user', method: 'DELETE', body })
129
+ }
130
+ }
@@ -0,0 +1,25 @@
1
+ import type {
2
+ PipelineAnalyticsOverviewValidation,
3
+ PipelineAnalyticsPipelineValidation
4
+ } from '@de./types'
5
+ import { qs, type Http, type Res, type Data } from '../../utils'
6
+
7
+ // ─── Analytics ────────────────────────────────────────────────────────────────
8
+
9
+ export class PipelinesAnalytics {
10
+ constructor( private http: Http ){}
11
+
12
+ async overview( querystring?: PipelineAnalyticsOverviewValidation['querystring'] ): Promise<PipelineAnalyticsOverviewValidation['response']> {
13
+ return await this.http.request<PipelineAnalyticsOverviewValidation['response']>({
14
+ url: `/pipelines/analytics/overview${qs( querystring )}`,
15
+ method: 'GET'
16
+ })
17
+ }
18
+
19
+ async pipeline( pid: string, querystring?: PipelineAnalyticsPipelineValidation['querystring'] ): Promise<PipelineAnalyticsPipelineValidation['response']> {
20
+ return await this.http.request<PipelineAnalyticsPipelineValidation['response']>({
21
+ url: `/pipelines/analytics/pipeline/${pid}${qs( querystring )}`,
22
+ method: 'GET'
23
+ })
24
+ }
25
+ }
@@ -0,0 +1,26 @@
1
+ import type {
2
+ PipelineEscalationListValidation,
3
+ PipelineEscalationResolveValidation
4
+ } from '@de./types'
5
+ import { qs, type Http, type Res, type Data } from '../../utils'
6
+
7
+ // ─── Escalations ──────────────────────────────────────────────────────────────
8
+
9
+ export class PipelinesEscalations {
10
+ constructor( private http: Http ){}
11
+
12
+ async list( querystring?: PipelineEscalationListValidation['querystring'] ): Promise<PipelineEscalationListValidation['response']> {
13
+ return await this.http.request<PipelineEscalationListValidation['response']>({
14
+ url: `/pipelines/escalations${qs( querystring )}`,
15
+ method: 'GET'
16
+ })
17
+ }
18
+
19
+ async resolve( id: string, body?: PipelineEscalationResolveValidation['body'] ): Promise<PipelineEscalationResolveValidation['response']> {
20
+ return await this.http.request<PipelineEscalationResolveValidation['response']>({
21
+ url: `/pipelines/escalations/${id}/resolve`,
22
+ method: 'POST',
23
+ body
24
+ })
25
+ }
26
+ }