@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
@@ -1,80 +1,16 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
37
- var __generator = (this && this.__generator) || function (thisArg, body) {
38
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
39
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
- function verb(n) { return function (v) { return step([n, v]); }; }
41
- function step(op) {
42
- if (f) throw new TypeError("Generator is already executing.");
43
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
- if (y = 0, t) op = [op[0] & 2, t.value];
46
- switch (op[0]) {
47
- case 0: case 1: t = op; break;
48
- case 4: _.label++; return { value: op[1], done: false };
49
- case 5: _.label++; y = op[1]; op = [0]; continue;
50
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
- default:
52
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
- if (t[2]) _.ops.pop();
57
- _.trys.pop(); continue;
58
- }
59
- op = body.call(thisArg, _);
60
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
- }
63
- };
64
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
65
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
66
4
  };
67
5
  Object.defineProperty(exports, "__esModule", { value: true });
68
- var events_1 = require("events");
69
- var stream_1 = __importDefault(require("../../utils/stream"));
70
- var Handles = /** @class */ (function (_super) {
71
- __extends(Handles, _super);
72
- function Handles(chn, controls, options) {
73
- var _this = _super.call(this) || this;
74
- _this.chn = chn;
75
- _this.options = options;
76
- _this.controls = controls;
77
- return _this;
6
+ const events_1 = require("events");
7
+ const stream_1 = __importDefault(require("../../utils/stream"));
8
+ class Handles extends events_1.EventEmitter {
9
+ constructor(chn, controls, options) {
10
+ super();
11
+ this.chn = chn;
12
+ this.options = options;
13
+ this.controls = controls;
78
14
  }
79
15
  /**
80
16
  * Listen when user manually picked a location
@@ -83,9 +19,9 @@ var Handles = /** @class */ (function (_super) {
83
19
  * @param fn - Event listener function
84
20
  * @return - void
85
21
  */
86
- Handles.prototype.onPickLocation = function (fn) {
22
+ onPickLocation(fn) {
87
23
  this.chn.on('pick:location', fn);
88
- };
24
+ }
89
25
  /**
90
26
  * Create new stream through which user's current location
91
27
  * details will be pushed to the API level.
@@ -93,60 +29,65 @@ var Handles = /** @class */ (function (_super) {
93
29
  * @param usertype - (Default: `client`) Type of user at the current location
94
30
  * @return - Readable stream
95
31
  */
96
- Handles.prototype.myLocation = function (usertype) {
97
- var _this = this;
32
+ myLocation(usertype) {
98
33
  var _a;
99
34
  if (!this.chn)
100
35
  return;
101
36
  (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:current:location', usertype || 'client');
102
- var stream = new stream_1.default();
37
+ const stream = new stream_1.default();
103
38
  this.chn
104
- .on('current:location', function (location) { return stream.sync(location); })
105
- .on('live:location:start', function (location) { return stream.sync(location); })
106
- .on('live:location:update', function (location) { return stream.sync(location); })
107
- .on('live:location:end', function (location) { return stream.sync(location); })
108
- .on('current:location:error', function (message) { return stream.error(new Error(message)); });
39
+ .on('current:location', (location) => stream.sync(location))
40
+ .on('live:location:start', (location) => stream.sync(location))
41
+ .on('live:location:update', (location) => stream.sync(location))
42
+ .on('live:location:end', (location) => stream.sync(location))
43
+ .on('current:location:error', (message) => stream.error(new Error(message)));
109
44
  // Listen to stream closed
110
45
  stream
111
- .onerror(function (error) { return console.error('[Stream Error] ', error); })
112
- .onclose(function () {
113
- if (!_this.chn)
46
+ .onerror(error => console.error('[Stream Error] ', error))
47
+ .onclose(() => {
48
+ if (!this.chn)
114
49
  return;
115
- _this.chn
50
+ this.chn
116
51
  .off('current:location')
117
- .off('current:location:live')
52
+ .off('live:location:start')
53
+ .off('live:location:update')
54
+ .off('live:location:end')
118
55
  .off('current:location:error');
119
56
  });
120
57
  return stream;
121
- };
58
+ }
122
59
  /**
123
60
  * Create new stream through which the current location details
124
61
  * of user's peer (Eg. `agent`) will be pushed to the API level.
125
62
  *
126
63
  * @param position - Peer's current GPS location
127
64
  * @param caption - (Optional) Caption information of the peer
65
+ * @param type - (Default: `car`) Marker representing the peer on the map
128
66
  * @return - Readable stream
129
67
  */
130
- Handles.prototype.peerLocation = function (position, caption) {
131
- var _this = this;
68
+ peerLocation(position, caption, type) {
132
69
  var _a;
133
70
  if (!this.chn)
134
71
  return;
135
- (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:peer:location', { id: 'peer', position: position, caption: caption });
136
- var stream = new stream_1.default;
137
- // Listen to incoming new position data
72
+ (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:peer:location', { id: 'peer', position, caption, type });
73
+ const stream = new stream_1.default;
74
+ /**
75
+ * Listen to incoming new position data.
76
+ *
77
+ * Caption is re-sent on every update so a peer can stream a changing
78
+ * label (Eg. a live ETA) alongside its position.
79
+ */
138
80
  stream
139
- .on('data', function (_a) {
140
- var _b;
141
- var position = _a.position, caption = _a.caption;
81
+ .on('data', ({ position, caption }) => {
82
+ var _a;
142
83
  if (!position)
143
84
  return stream.error(new Error('Invalid Data'));
144
- (_b = _this.chn) === null || _b === void 0 ? void 0 : _b.emit('pin:peer:location', { id: 'peer', position: position, caption: caption });
85
+ (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:peer:location', { id: 'peer', position, caption, type });
145
86
  })
146
- .onerror(function (error) { return console.error('[Stream Error] ', error); })
147
- .onclose(function () { var _a; return (_a = _this.chn) === null || _a === void 0 ? void 0 : _a.emit('unpin:peer:location', 'peer'); });
87
+ .onerror(error => console.error('[Stream Error] ', error))
88
+ .onclose(() => { var _a; return (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('unpin:peer:location', 'peer'); });
148
89
  return stream;
149
- };
90
+ }
150
91
  /**
151
92
  * Open a live stream through which the current location details
152
93
  * and profile information of all nearby entities around
@@ -156,42 +97,41 @@ var Handles = /** @class */ (function (_super) {
156
97
  * @param list - List of detected nearby entities around this user.
157
98
  * @return - Live Readable Streamer (LRS)
158
99
  */
159
- Handles.prototype.nearby = function (list) {
160
- var _this = this;
100
+ nearby(list) {
161
101
  var _a;
162
102
  if (!this.chn)
163
103
  return;
164
- var self = this;
165
- var _CLOSED = false;
104
+ const self = this;
105
+ let _CLOSED = false;
166
106
  (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('show:nearby', list);
167
- var stream = new stream_1.default, controls = {
107
+ const stream = new stream_1.default, controls = {
168
108
  /**
169
109
  * Add new entity to the nearby list
170
110
  *
171
111
  * @param entity - GPS location and profile of the entity
172
112
  */
173
- add: function (entity) {
174
- return new Promise(function (resolve, reject) {
113
+ add(entity) {
114
+ return new Promise((resolve, reject) => {
175
115
  var _a, _b;
176
116
  if (_CLOSED)
177
117
  return;
178
118
  // Maintain initial list of nearby: Prevent duplicated entity
179
- for (var x = 0; x < list.length; x++)
119
+ for (let x = 0; x < list.length; x++)
180
120
  if (list[x].id === entity.id) {
181
121
  list.splice(x, 1);
182
122
  (_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby:entity', entity.id);
183
123
  break;
184
124
  }
185
125
  // Track response timeout
186
- var TIMEOUT;
126
+ let TIMEOUT;
187
127
  // Add new entity
188
128
  list.push(entity);
189
- (_b = self.chn) === null || _b === void 0 ? void 0 : _b.emit('add:nearby:entity', entity, function () {
129
+ (_b = self.chn) === null || _b === void 0 ? void 0 : _b.emit('add:nearby:entity', entity, () => {
190
130
  clearTimeout(TIMEOUT);
191
131
  resolve();
192
132
  self.emit('nearby--stream', 'add', entity);
193
133
  });
194
- setTimeout(function () { return reject('Add entity timeout'); }, 8000);
134
+ TIMEOUT = setTimeout(() => reject('Add entity timeout'), 8000);
195
135
  });
196
136
  },
197
137
  /**
@@ -199,20 +139,20 @@ var Handles = /** @class */ (function (_super) {
199
139
  *
200
140
  * @param id - ID of targeted entity
201
141
  */
202
- remove: function (id) {
203
- return new Promise(function (resolve, reject) {
142
+ remove(id) {
143
+ return new Promise((resolve, reject) => {
204
144
  var _a;
205
145
  if (_CLOSED)
206
146
  return;
207
147
  // Track response timeout
208
- var TIMEOUT;
209
- list = list.filter(function (each) { return each.id !== id; });
210
- (_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby:entity', id, function () {
148
+ let TIMEOUT;
149
+ list = list.filter(each => each.id !== id);
150
+ (_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby:entity', id, () => {
211
151
  clearTimeout(TIMEOUT);
212
152
  resolve();
213
153
  self.emit('nearby--stream', 'remove', id);
214
154
  });
215
- setTimeout(function () { return reject('Remove entity timeout'); }, 8000);
155
+ TIMEOUT = setTimeout(() => reject('Remove entity timeout'), 8000);
216
156
  });
217
157
  },
218
158
  /**
@@ -220,39 +160,39 @@ var Handles = /** @class */ (function (_super) {
220
160
  *
221
161
  * @param id - ID of targeted entity
222
162
  */
223
- focus: function (id) {
224
- return new Promise(function (resolve, reject) {
163
+ focus(id) {
164
+ return new Promise((resolve, reject) => {
225
165
  var _a;
226
166
  if (_CLOSED)
227
167
  return;
228
168
  // Track response timeout
229
- var TIMEOUT;
230
- var entity = list.find(function (each) { return each.id === id; });
169
+ let TIMEOUT;
170
+ const entity = list.find(each => each.id === id);
231
171
  if (!entity)
232
- return reject("Entity <".concat(id, "> not found"));
233
- (_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('panto:map:location', entity.currentLocation, function () {
172
+ return reject(`Entity <${id}> not found`);
173
+ (_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('panto:map:location', entity.currentLocation, () => {
234
174
  clearTimeout(TIMEOUT);
235
175
  resolve();
236
176
  self.emit('nearby--stream', 'panto', id);
237
177
  });
238
- setTimeout(function () { return reject('PanTo entity timeout'); }, 8000);
178
+ TIMEOUT = setTimeout(() => reject('PanTo entity timeout'), 8000);
239
179
  });
240
180
  },
241
181
  /**
242
182
  * Change mobile entities position on the map
243
183
  */
244
- move: function (active) {
245
- return new Promise(function (resolve, reject) {
184
+ move(active) {
185
+ return new Promise((resolve, reject) => {
246
186
  var _a;
247
187
  if (_CLOSED)
248
188
  return;
249
189
  // Track response timeout
250
- var TIMEOUT;
251
- (_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('move:nearby:entity', active, function () {
190
+ let TIMEOUT;
191
+ (_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('move:nearby:entity', active, () => {
252
192
  clearTimeout(TIMEOUT);
253
- var entity = list.find(function (each) { return each.id === active.id; });
193
+ const entity = list.find(each => each.id === active.id);
254
194
  if (!entity)
255
- throw new Error("Undefined <".concat(active.id, "> entity"));
195
+ throw new Error(`Undefined <${active.id}> entity`);
256
196
  entity.currentLocation = active.position;
257
197
  if (active.focus)
258
198
  try {
@@ -262,22 +202,22 @@ var Handles = /** @class */ (function (_super) {
262
202
  resolve();
263
203
  self.emit('nearby--stream', 'move', active);
264
204
  });
265
- setTimeout(function () { return reject('Move entity timeout'); }, 8000);
205
+ TIMEOUT = setTimeout(() => reject('Move entity timeout'), 8000);
266
206
  });
267
207
  }
268
208
  };
269
- var
209
+ const
270
210
  /**
271
211
  *
272
212
  */
273
- live = function (fn) {
213
+ live = (fn) => {
274
214
  fn(controls);
275
215
  return stream;
276
- }, close = function (fn) {
216
+ }, close = (fn) => {
277
217
  var _a;
278
218
  if (_CLOSED)
279
219
  return;
280
- (_a = _this.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby', function (error) {
220
+ (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby', (error) => {
281
221
  if (typeof error == 'string')
282
222
  return typeof fn == 'function' && fn(new Error(error));
283
223
  _CLOSED = true;
@@ -285,60 +225,46 @@ var Handles = /** @class */ (function (_super) {
285
225
  typeof fn == 'function' && fn();
286
226
  });
287
227
  };
288
- this.on('nearby--stream', function (action, dataset) { return stream.sync({ action: action, dataset: dataset, list: list }); });
228
+ this.on('nearby--stream', (action, dataset) => stream.sync({ action, dataset, list }));
289
229
  // Listen to stream closed
290
230
  stream
291
- .onerror(function (error) { return console.error('[Stream Error] ', error); })
292
- .onclose(function (fn) {
293
- _this.off('nearby--stream', fn || (function () { }));
231
+ .onerror(error => console.error('[Stream Error] ', error))
232
+ .onclose((fn) => {
233
+ this.off('nearby--stream', fn || (() => { }));
294
234
  close();
295
235
  });
296
- return { live: live, pipe: stream.pipe, close: close };
297
- };
236
+ return { live, pipe: stream.pipe, close };
237
+ }
298
238
  /**
299
239
  * Set service pickup point.
300
240
  *
301
241
  * @param location - Location coordinates
302
242
  * @param caption - (Optional) Caption information of the pickup point
303
243
  */
304
- Handles.prototype.pickupPoint = function (location, caption) {
305
- return __awaiter(this, void 0, void 0, function () {
306
- var _caption;
307
- var _a;
308
- return __generator(this, function (_b) {
309
- switch (_b.label) {
310
- case 0:
311
- _caption = __assign({ label: 'Pickup point' }, (caption || {}));
312
- return [4 /*yield*/, ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRouteOrigin('main', { coords: location, caption: _caption }))];
313
- case 1:
314
- _b.sent();
315
- return [2 /*return*/];
316
- }
317
- });
318
- });
319
- };
244
+ async pickupPoint(location, caption) {
245
+ var _a;
246
+ // Default pickup caption
247
+ const _caption = {
248
+ label: 'Pickup point',
249
+ ...(caption || {})
250
+ };
251
+ await ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRouteOrigin('main', { coords: location, caption: _caption }));
252
+ }
320
253
  /**
321
254
  * Set service dropoff point.
322
255
  *
323
256
  * @param location - Location coordinates
324
257
  * @param caption - (Optional) Caption information of the pickup point
325
258
  */
326
- Handles.prototype.dropoffPoint = function (location, caption) {
327
- return __awaiter(this, void 0, void 0, function () {
328
- var _caption;
329
- var _a;
330
- return __generator(this, function (_b) {
331
- switch (_b.label) {
332
- case 0:
333
- _caption = __assign({ label: 'Destination point' }, (caption || {}));
334
- return [4 /*yield*/, ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRouteDestination('main', { coords: location, caption: _caption }))];
335
- case 1:
336
- _b.sent();
337
- return [2 /*return*/];
338
- }
339
- });
340
- });
341
- };
259
+ async dropoffPoint(location, caption) {
260
+ var _a;
261
+ // Default destination caption
262
+ const _caption = {
263
+ label: 'Destination point',
264
+ ...(caption || {})
265
+ };
266
+ await ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRouteDestination('main', { coords: location, caption: _caption }));
267
+ }
342
268
  /**
343
269
  * Create new stream through which navigation details of
344
270
  * this user's peer will be display on the user's map also
@@ -346,18 +272,16 @@ var Handles = /** @class */ (function (_super) {
346
272
  *
347
273
  * @return - Readable stream
348
274
  */
349
- Handles.prototype.peerDirection = function (options) {
350
- var _this = this;
275
+ peerDirection(options) {
351
276
  if (!this.chn)
352
277
  return;
353
- var stream = new stream_1.default;
278
+ const stream = new stream_1.default;
354
279
  stream
355
- .on('data', function (_a) {
356
- var _b;
357
- var status = _a.status, direction = _a.direction, position = _a.position;
280
+ .on('data', ({ status, direction, position }) => {
281
+ var _a;
358
282
  if (!direction || !position)
359
283
  return stream.error(new Error('Invalid Data'));
360
- (_b = _this.controls) === null || _b === void 0 ? void 0 : _b.casting('peer-direction', direction, position, options);
284
+ (_a = this.controls) === null || _a === void 0 ? void 0 : _a.casting('peer-direction', direction, position, options);
361
285
  switch (status) {
362
286
  case 'STALE':
363
287
  case 'STARTED':
@@ -368,19 +292,19 @@ var Handles = /** @class */ (function (_super) {
368
292
  case 'SPEED_WARNING':
369
293
  case 'NEARBY':
370
294
  case 'ARRIVED':
371
- _this.emit("pe:".concat(status.toLowerCase()));
295
+ this.emit(`pe:${status.toLowerCase()}`);
372
296
  break;
373
297
  case 'UNAVAILABLE':
374
298
  {
375
- _this.emit("pe:closed");
299
+ this.emit(`pe:closed`);
376
300
  stream.isActive() && stream.close();
377
301
  }
378
302
  break;
379
303
  }
380
304
  })
381
- .onerror(function (error) { return console.error('[Stream Error] ', error); });
305
+ .onerror(error => console.error('[Stream Error] ', error));
382
306
  return stream;
383
- };
307
+ }
384
308
  /**
385
309
  * Initiate user (Eg. agent) live navigation on the map
386
310
  * and create a new stream through which the navigation details
@@ -389,19 +313,17 @@ var Handles = /** @class */ (function (_super) {
389
313
  * @param journey - Route origin, waypoints, destination
390
314
  * @return - Readable stream
391
315
  */
392
- Handles.prototype.navigation = function (journey) {
393
- var _this = this;
394
- return new Promise(function (resolve, reject) {
316
+ navigation(journey) {
317
+ return new Promise((resolve, reject) => {
395
318
  var _a;
396
- if (!_this.chn)
319
+ if (!this.chn)
397
320
  return;
398
- var initialize = function () {
321
+ const initialize = () => {
399
322
  var _a;
400
- var stream = new stream_1.default;
323
+ const stream = new stream_1.default;
401
324
  // Sync with navigation route update
402
- (_a = _this.chn) === null || _a === void 0 ? void 0 : _a.on('navigation:direction', function (_a) {
403
- var status = _a.status, direction = _a.direction, position = _a.position;
404
- stream.sync({ status: status, direction: direction, position: position });
325
+ (_a = this.chn) === null || _a === void 0 ? void 0 : _a.on('navigation:direction', ({ status, direction, position }) => {
326
+ stream.sync({ status, direction, position });
405
327
  switch (status) {
406
328
  case 'STALE':
407
329
  case 'STARTED':
@@ -412,11 +334,11 @@ var Handles = /** @class */ (function (_super) {
412
334
  case 'SPEED_WARNING':
413
335
  case 'NEARBY':
414
336
  case 'ARRIVED':
415
- _this.emit("pe:".concat(status.toLowerCase()));
337
+ this.emit(`pe:${status.toLowerCase()}`);
416
338
  break;
417
339
  case 'UNAVAILABLE':
418
340
  {
419
- _this.emit("pe:closed");
341
+ this.emit(`pe:closed`);
420
342
  stream.isActive() && stream.close();
421
343
  }
422
344
  break;
@@ -424,52 +346,33 @@ var Handles = /** @class */ (function (_super) {
424
346
  });
425
347
  stream
426
348
  // Listen location/position update
427
- .on('data', function (_a) {
428
- var _b;
429
- var position = _a.position;
349
+ .on('data', ({ position }) => {
350
+ var _a;
430
351
  if (!position)
431
352
  return stream.error(new Error('Invalid Data'));
432
- (_b = _this.controls) === null || _b === void 0 ? void 0 : _b.navigate(position);
353
+ (_a = this.controls) === null || _a === void 0 ? void 0 : _a.navigate(position);
433
354
  })
434
- .onerror(function (error) { return console.error('[Stream Error] ', error); })
435
- .onclose(function () {
355
+ .onerror(error => console.error('[Stream Error] ', error))
356
+ .onclose(() => {
436
357
  var _a, _b;
437
- (_a = _this.chn) === null || _a === void 0 ? void 0 : _a.off('navigation:direction');
438
- (_b = _this.controls) === null || _b === void 0 ? void 0 : _b.unmountNavigation();
358
+ (_a = this.chn) === null || _a === void 0 ? void 0 : _a.off('navigation:direction');
359
+ (_b = this.controls) === null || _b === void 0 ? void 0 : _b.unmountNavigation();
439
360
  });
440
361
  resolve(stream);
441
362
  };
442
363
  // Set route
443
- (_a = _this.controls) === null || _a === void 0 ? void 0 : _a.setRoute(journey).then(function () { return __awaiter(_this, void 0, void 0, function () {
444
- var position, _a;
445
- var _b, _c, _d;
446
- return __generator(this, function (_e) {
447
- switch (_e.label) {
448
- case 0:
449
- _a = journey.origin;
450
- if (_a) return [3 /*break*/, 2];
451
- return [4 /*yield*/, ((_b = this.controls) === null || _b === void 0 ? void 0 : _b.getCurrentLocation())];
452
- case 1:
453
- _a = (_e.sent());
454
- _e.label = 2;
455
- case 2:
456
- position = _a;
457
- if (!position)
458
- return [2 /*return*/, reject('Unable to get current location')];
459
- initialize();
460
- return [4 /*yield*/, ((_c = this.controls) === null || _c === void 0 ? void 0 : _c.mountNavigation(journey.routeId))];
461
- case 3:
462
- _e.sent();
463
- return [4 /*yield*/, ((_d = this.controls) === null || _d === void 0 ? void 0 : _d.setInitialNavigationPosition(position))];
464
- case 4:
465
- _e.sent();
466
- return [2 /*return*/];
467
- }
468
- });
469
- }); }).catch(reject);
364
+ (_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRoute(journey).then(async () => {
365
+ var _a, _b, _c;
366
+ // Initialize navigation point to current location
367
+ const position = journey.origin || await ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.getCurrentLocation());
368
+ if (!position)
369
+ return reject('Unable to get current location');
370
+ initialize();
371
+ await ((_b = this.controls) === null || _b === void 0 ? void 0 : _b.mountNavigation(journey.routeId));
372
+ await ((_c = this.controls) === null || _c === void 0 ? void 0 : _c.setInitialNavigationPosition(position));
373
+ }).catch(reject);
470
374
  });
471
- };
472
- return Handles;
473
- }(events_1.EventEmitter));
375
+ }
376
+ }
474
377
  exports.default = Handles;
475
378
  //# sourceMappingURL=Handles.js.map