@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,15 +1,51 @@
1
- import type { AccessOptions } from '../types/access';
1
+ import type { AccessOptions, UserSession } from '../types/access';
2
2
  import type { HTTPRequestOptions } from '../types';
3
- type AccessType = 'API' | 'ASI';
3
+ /**
4
+ * Which service the client addresses.
5
+ *
6
+ * De. is more than one server: de.arch answers the API, de.auth the ASI, and
7
+ * de.workspace the control plane. They are separate hosts, so the client has
8
+ * to say which one it means rather than assume the API.
9
+ */
10
+ type AccessType = 'API' | 'ASI' | 'WSP';
4
11
  export default class AccessManager {
5
12
  private atype;
6
13
  private version;
7
14
  private platform;
8
15
  private baseURL;
16
+ /**
17
+ * The client's own `wid:TYPE:xcode`, base64-encoded.
18
+ *
19
+ * Not a transport header: de.arch resolves the workspace from the access
20
+ * token, and its header contract has no context field. It is kept because a
21
+ * client is scoped to one context for its lifetime, and a caller holding
22
+ * several — a proxy serving many workspaces — needs to ask which is which.
23
+ * `scope` decodes it.
24
+ */
25
+ readonly context: string;
9
26
  protected accessToken?: string;
10
27
  protected remoteOrigin?: string;
28
+ protected session?: UserSession;
29
+ private timeout?;
11
30
  constructor(options: AccessOptions, atype: AccessType);
12
- request<Response>({ url, ...options }: HTTPRequestOptions): Promise<Response>;
31
+ request<Response>({ url, timeout, ...options }: HTTPRequestOptions): Promise<Response>;
32
+ /**
33
+ * The context decoded into its parts.
34
+ *
35
+ * Every consumer was decoding the base64 and splitting on ':' by hand,
36
+ * including validating that it produced three fields. Returns undefined
37
+ * rather than throwing when the string is not a context, since a caller
38
+ * asking is usually checking.
39
+ */
40
+ get scope(): {
41
+ wid: string;
42
+ type: string;
43
+ xcode: string;
44
+ } | undefined;
13
45
  setToken(token: string): void;
46
+ /** Attach or replace the signed-in user after construction. */
47
+ setSession(session: UserSession): void;
48
+ /** Drop the user session — e.g. on sign-out. */
49
+ clearSession(): void;
14
50
  }
15
51
  export {};
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -43,122 +32,166 @@ var __importStar = (this && this.__importStar) || (function () {
43
32
  return result;
44
33
  };
45
34
  })();
46
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
47
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
48
- return new (P || (P = Promise))(function (resolve, reject) {
49
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
50
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
51
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
52
- step((generator = generator.apply(thisArg, _arguments || [])).next());
53
- });
54
- };
55
- var __generator = (this && this.__generator) || function (thisArg, body) {
56
- 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);
57
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
58
- function verb(n) { return function (v) { return step([n, v]); }; }
59
- function step(op) {
60
- if (f) throw new TypeError("Generator is already executing.");
61
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
62
- 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;
63
- if (y = 0, t) op = [op[0] & 2, t.value];
64
- switch (op[0]) {
65
- case 0: case 1: t = op; break;
66
- case 4: _.label++; return { value: op[1], done: false };
67
- case 5: _.label++; y = op[1]; op = [0]; continue;
68
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
69
- default:
70
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
71
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
72
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
73
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
74
- if (t[2]) _.ops.pop();
75
- _.trys.pop(); continue;
76
- }
77
- op = body.call(thisArg, _);
78
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
79
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
80
- }
81
- };
82
- var __rest = (this && this.__rest) || function (s, e) {
83
- var t = {};
84
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
85
- t[p] = s[p];
86
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
87
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
88
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
89
- t[p[i]] = s[p[i]];
90
- }
91
- return t;
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
92
37
  };
93
38
  Object.defineProperty(exports, "__esModule", { value: true });
94
- var baseUrl_1 = require("../baseUrl");
95
- var USER_ACCOUNT_SERVICE = 'De.API';
96
- var AccessManager = /** @class */ (function () {
97
- function AccessManager(options, atype) {
39
+ const baseUrl_1 = require("../baseUrl");
40
+ const error_1 = __importDefault(require("../error"));
41
+ const USER_ACCOUNT_SERVICE = 'De.API';
42
+ /**
43
+ * Resolve a fetch implementation for the host runtime.
44
+ *
45
+ * Node 18+, every browser and React Native all expose a global `fetch`, so that
46
+ * is the first and usual answer. `node-fetch` remains only as a fallback for
47
+ * Node versions predating the global.
48
+ *
49
+ * The previous check tested `globalThis.window && globalThis.fetch`, which was
50
+ * wrong for React Native: there is no `window` there but `fetch` is global, so
51
+ * it fell through to importing node-fetch and broke. Testing for `fetch`
52
+ * directly is what lets one Access layer serve node, browser and native.
53
+ */
54
+ async function resolveFetch() {
55
+ if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.fetch) === 'function')
56
+ return globalThis.fetch;
57
+ return (await Promise.resolve().then(() => __importStar(require('node-fetch')))).default;
58
+ }
59
+ class AccessManager {
60
+ constructor(options, atype) {
61
+ var _a;
98
62
  if (!options)
99
63
  throw new Error('Undefined Access Configuration');
100
64
  if (!options.context)
101
65
  throw new Error('Undefined Context Reference. Check https://doc.dedot.io/sdk/auth');
102
66
  if (!options.accessToken)
103
67
  throw new Error('Undefined Access Token. Check https://doc.dedot.io/sdk/auth');
68
+ this.context = options.context;
104
69
  this.atype = atype;
105
70
  this.version = options.version || 1;
106
71
  this.platform = options.platform || 'proxy';
107
72
  this.accessToken = options.accessToken;
108
73
  this.remoteOrigin = options.remoteOrigin;
109
- this.baseURL = this.atype === 'ASI'
110
- ? baseUrl_1.ASI_SERVER_BASEURL[options.env || 'dev']
111
- : baseUrl_1.API_SERVER_BASEURL[options.env || 'dev'];
74
+ this.session = options.session;
75
+ this.timeout = options.timeout;
76
+ this.baseURL = ((_a = options.baseUrl) === null || _a === void 0 ? void 0 : _a.replace(/\/+$/, ''))
77
+ || (0, baseUrl_1.baseURL)(this.atype, options.env || 'dev', options.devHostname);
112
78
  }
113
- AccessManager.prototype.request = function (_a) {
114
- return __awaiter(this, void 0, void 0, function () {
115
- var rawOptions, fetch;
116
- var url = _a.url, options = __rest(_a, ["url"]);
117
- return __generator(this, function (_b) {
118
- switch (_b.label) {
119
- case 0:
120
- rawOptions = {
121
- method: 'GET',
122
- headers: {
123
- /**
124
- * Default User agent for SDK request calls
125
- *
126
- * NOTE: Later replace by latest SDK version
127
- */
128
- origin: this.remoteOrigin,
129
- 'de-user-agent': "De.".concat(this.platform, "/").concat(this.version, ".0")
130
- }
131
- };
132
- if (this.atype === 'ASI')
133
- rawOptions.headers['de-auth-service'] = USER_ACCOUNT_SERVICE;
134
- if (this.accessToken)
135
- rawOptions.headers.authorization = "Bearer ".concat(this.accessToken);
136
- if (options.body) {
137
- rawOptions.headers['content-type'] = 'application/json';
138
- if (typeof options.body === 'object')
139
- options.body = JSON.stringify(options.body);
140
- }
141
- if (typeof options.headers == 'object')
142
- options.headers = __assign(__assign({}, options.headers), rawOptions.headers);
143
- options = __assign(__assign({}, rawOptions), options);
144
- url = "".concat(this.baseURL, "/v").concat(this.version, "/").concat(url.replace(/^\//, ''));
145
- fetch = (globalThis === null || globalThis === void 0 ? void 0 : globalThis.window) && (globalThis === null || globalThis === void 0 ? void 0 : globalThis.fetch);
146
- if (!!fetch) return [3 /*break*/, 2];
147
- return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('node-fetch')); })];
148
- case 1:
149
- fetch = (_b.sent()).default;
150
- _b.label = 2;
151
- case 2: return [4 /*yield*/, fetch(url, options)];
152
- case 3: return [4 /*yield*/, (_b.sent()).json()];
153
- case 4:
154
- // console.log( options )
155
- return [2 /*return*/, _b.sent()];
156
- }
157
- });
158
- });
159
- };
160
- AccessManager.prototype.setToken = function (token) { this.accessToken = token; };
161
- return AccessManager;
162
- }());
79
+ async request({ url, timeout, ...options }) {
80
+ const rawOptions = {
81
+ method: 'GET',
82
+ headers: {
83
+ /**
84
+ * Default User agent for SDK request calls
85
+ *
86
+ * NOTE: Later replace by latest SDK version
87
+ */
88
+ origin: this.remoteOrigin,
89
+ 'de-user-agent': `De.${this.platform}/${this.version}.0`
90
+ }
91
+ };
92
+ if (this.atype === 'ASI')
93
+ rawOptions.headers['de-auth-service'] = USER_ACCOUNT_SERVICE;
94
+ if (this.accessToken)
95
+ rawOptions.headers.authorization = `Bearer ${this.accessToken}`;
96
+ /**
97
+ * User-session credentials, sent alongside the bearer token rather than
98
+ * instead of it. `isConnected` (AUX agent routes) reads only this pair;
99
+ * `isAuthorized` reads only the bearer. Routes guarded by either one are
100
+ * then reachable from a single client.
101
+ */
102
+ if (this.session) {
103
+ rawOptions.headers['de-auth-token'] = this.session.token;
104
+ rawOptions.headers['de-auth-device'] = this.session.device;
105
+ }
106
+ if (options.body) {
107
+ rawOptions.headers['content-type'] = 'application/json';
108
+ if (typeof options.body === 'object')
109
+ options.body = JSON.stringify(options.body);
110
+ }
111
+ if (typeof options.headers == 'object')
112
+ options.headers = {
113
+ ...options.headers,
114
+ ...rawOptions.headers
115
+ };
116
+ options = { ...rawOptions, ...options };
117
+ /**
118
+ * Bound the request when a deadline is configured.
119
+ *
120
+ * `AbortSignal.timeout` is not in the pre-18 Node the node-fetch fallback
121
+ * exists for, so this is guarded rather than assumed. A missing signal
122
+ * leaves the previous unbounded behaviour, which is the right degradation:
123
+ * the request still goes out.
124
+ */
125
+ const deadline = timeout !== null && timeout !== void 0 ? timeout : this.timeout;
126
+ if (deadline && typeof (AbortSignal === null || AbortSignal === void 0 ? void 0 : AbortSignal.timeout) === 'function')
127
+ options.signal = AbortSignal.timeout(deadline);
128
+ url = `${this.baseURL}/v${this.version}/${url.replace(/^\//, '')}`;
129
+ const fetch = await resolveFetch(), response = await fetch(url, options);
130
+ /**
131
+ * Everything De. answers is the `{ error, message, data }` envelope, so a
132
+ * body that will not parse did not come from De. — a gateway 502 page, a
133
+ * proxy timeout, an empty 204. Reporting that as a JSON syntax error hides
134
+ * the only two facts worth having, which are the status and the URL.
135
+ */
136
+ let body;
137
+ try {
138
+ body = await response.json();
139
+ }
140
+ catch {
141
+ /**
142
+ * Not De. answering — a gateway's HTML 502, a proxy timeout, an empty
143
+ * 204. There is no envelope to hand back, so this is the one case that
144
+ * raises, carrying the status and URL rather than a JSON syntax error.
145
+ */
146
+ throw new error_1.default(`${options.method} ${url} — ${response.statusText || 'no JSON body'}`, response.status);
147
+ }
148
+ /**
149
+ * A refusal is returned, not raised.
150
+ *
151
+ * De.'s answer is the `{ error, status, message, data }` envelope whether
152
+ * it succeeded or not, and `status` names the refusal precisely —
153
+ * SENDER_CAP_REACHED, CONSOLIDATION::NOT_IN_PROGRESS. Throwing that away
154
+ * and reconstructing it from an exception message is what callers were
155
+ * reduced to; handing back the envelope lets them read it.
156
+ *
157
+ * A non-2xx carrying an envelope is still De. answering, so it comes back
158
+ * the same way.
159
+ *
160
+ * What is NOT De. answering is raised. A wrong path gets Fastify's own
161
+ * 404 body, which is JSON but not the envelope — `error` there is the
162
+ * string 'Not Found', not a boolean. Returning that as though it were a
163
+ * refusal is how a client addressing a route that does not exist would
164
+ * look like a workspace being told no, which is precisely the bug that
165
+ * hid `/LSP/invitation/agent` behind a plausible-looking failure.
166
+ */
167
+ if (typeof (body === null || body === void 0 ? void 0 : body.error) !== 'boolean')
168
+ throw new error_1.default((body === null || body === void 0 ? void 0 : body.message) || `${options.method} ${url} — ${response.status} ${response.statusText || 'not a De. response'}`, response.status, body);
169
+ return body;
170
+ }
171
+ /**
172
+ * The context decoded into its parts.
173
+ *
174
+ * Every consumer was decoding the base64 and splitting on ':' by hand,
175
+ * including validating that it produced three fields. Returns undefined
176
+ * rather than throwing when the string is not a context, since a caller
177
+ * asking is usually checking.
178
+ */
179
+ get scope() {
180
+ try {
181
+ const decoded = typeof atob === 'function'
182
+ ? atob(this.context)
183
+ : Buffer.from(this.context, 'base64').toString('utf8'), [wid, type, xcode] = decoded.split(':');
184
+ return wid && type && xcode ? { wid, type, xcode } : undefined;
185
+ }
186
+ catch {
187
+ return undefined;
188
+ }
189
+ }
190
+ setToken(token) { this.accessToken = token; }
191
+ /** Attach or replace the signed-in user after construction. */
192
+ setSession(session) { this.session = session; }
193
+ /** Drop the user session — e.g. on sign-out. */
194
+ clearSession() { this.session = undefined; }
195
+ }
163
196
  exports.default = AccessManager;
164
197
  //# sourceMappingURL=Access.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Access.js","sourceRoot":"","sources":["../../src/allend/Access.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AQ,CAChB,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,KAAI,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,IAAI,oBAAoB,EAAE,EAC/G,QAAQ,CAAC,MAAM,EACf,IAAI,CACL,CAAA;QAEH,OAAO,IAAgB,CAAA;IACzB,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,KAAK;QACP,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,UAAU;gBACxB,CAAC,CAAC,IAAI,CAAE,IAAI,CAAC,OAAO,CAAE;gBACtB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EACpE,CAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAE,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAE/C,OAAO,GAAG,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAChE,CAAC;QACD,MAAM,CAAC;YAAC,OAAO,SAAS,CAAA;QAAC,CAAC;IAC5B,CAAC;IAED,QAAQ,CAAE,KAAa,IAAW,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA,CAAC,CAAC;IAE5D,+DAA+D;IAC/D,UAAU,CAAE,OAAoB,IAAW,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA,CAAC,CAAC;IAEnE,gDAAgD;IAChD,YAAY,KAAW,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA,CAAC,CAAC;CAClD;AA5KD,gCA4KC"}
@@ -0,0 +1,16 @@
1
+ import type { AgentConsolidationRespondValidation, AgentConsolidationHandoffValidation, AgentConsolidationCompleteValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentConsolidation {
4
+ private http;
5
+ constructor(http: Http);
6
+ respond(body: AgentConsolidationRespondValidation['body']): Promise<AgentConsolidationRespondValidation['response']>;
7
+ handoffConfirm(body: AgentConsolidationHandoffValidation['body']): Promise<AgentConsolidationHandoffValidation['response']>;
8
+ /**
9
+ * The receiving rider reporting leg 2 delivered.
10
+ *
11
+ * No handoff code — the PIN authenticated the transfer between riders at
12
+ * confirm. This is what takes the offer out of IN_PROGRESS and returns the
13
+ * rider to their zone pool.
14
+ */
15
+ handoffComplete(body: AgentConsolidationCompleteValidation['body']): Promise<AgentConsolidationCompleteValidation['response']>;
16
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // ─── Agent Consolidation ──────────────────────────────────────────────────────
4
+ class AgentConsolidation {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async respond(body) {
9
+ return await this.http.request({
10
+ url: '/agent/consolidation/respond',
11
+ method: 'POST',
12
+ body
13
+ });
14
+ }
15
+ async handoffConfirm(body) {
16
+ return await this.http.request({
17
+ url: '/agent/consolidation/handoff/confirm',
18
+ method: 'POST',
19
+ body
20
+ });
21
+ }
22
+ /**
23
+ * The receiving rider reporting leg 2 delivered.
24
+ *
25
+ * No handoff code — the PIN authenticated the transfer between riders at
26
+ * confirm. This is what takes the offer out of IN_PROGRESS and returns the
27
+ * rider to their zone pool.
28
+ */
29
+ async handoffComplete(body) {
30
+ return await this.http.request({
31
+ url: '/agent/consolidation/handoff/complete',
32
+ method: 'POST',
33
+ body
34
+ });
35
+ }
36
+ }
37
+ exports.default = AgentConsolidation;
38
+ //# sourceMappingURL=consolidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consolidation.js","sourceRoot":"","sources":["../../../src/allend/Agent/consolidation.ts"],"names":[],"mappings":";;AAOA,iFAAiF;AAEjF,MAAqB,kBAAkB;IACtC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,OAAO,CAAE,IAAiD;QAC/D,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAkD;YAC/E,GAAG,EAAE,8BAA8B;YACnC,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAE,IAAiD;QACtE,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAkD;YAC/E,GAAG,EAAE,sCAAsC;YAC3C,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAE,IAAkD;QACxE,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAmD;YAChF,GAAG,EAAE,uCAAuC;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;IACH,CAAC;CACD;AAjCD,qCAiCC"}
@@ -0,0 +1,11 @@
1
+ import type { AgentDeliveryListValidation, AgentDeliveryGetValidation, AgentDeliveryAcceptValidation, AgentDeliveryUpdateStatusValidation, AgentDeliveryReportIssueValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentDelivery {
4
+ private http;
5
+ constructor(http: Http);
6
+ list(querystring?: AgentDeliveryListValidation['querystring']): Promise<AgentDeliveryListValidation['response']>;
7
+ get(reference: string): Promise<AgentDeliveryGetValidation['response']>;
8
+ accept(reference: string): Promise<AgentDeliveryAcceptValidation['response']>;
9
+ updateStatus(reference: string, body: AgentDeliveryUpdateStatusValidation['body']): Promise<AgentDeliveryUpdateStatusValidation['response']>;
10
+ reportIssue(reference: string, body: AgentDeliveryReportIssueValidation['body']): Promise<AgentDeliveryReportIssueValidation['response']>;
11
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../utils");
4
+ // ─── Agent Delivery Orders ────────────────────────────────────────────────────
5
+ class AgentDelivery {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async list(querystring) {
10
+ return await this.http.request({
11
+ url: `/agent/delivery/orders${(0, utils_1.qs)(querystring)}`,
12
+ method: 'GET'
13
+ });
14
+ }
15
+ async get(reference) {
16
+ return await this.http.request({
17
+ url: `/agent/delivery/orders/${reference}`,
18
+ method: 'GET'
19
+ });
20
+ }
21
+ async accept(reference) {
22
+ return await this.http.request({
23
+ url: `/agent/delivery/orders/${reference}/accept`,
24
+ method: 'POST'
25
+ });
26
+ }
27
+ async updateStatus(reference, body) {
28
+ return await this.http.request({
29
+ url: `/agent/delivery/orders/${reference}/status`,
30
+ method: 'PATCH',
31
+ body
32
+ });
33
+ }
34
+ async reportIssue(reference, body) {
35
+ return await this.http.request({
36
+ url: `/agent/delivery/orders/${reference}/issue`,
37
+ method: 'POST',
38
+ body
39
+ });
40
+ }
41
+ }
42
+ exports.default = AgentDelivery;
43
+ //# sourceMappingURL=delivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../../src/allend/Agent/delivery.ts"],"names":[],"mappings":";;AAOA,uCAAgE;AAEhE,iFAAiF;AAEjF,MAAqB,aAAa;IACjC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,IAAI,CAAE,WAAwD;QACnE,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YACvE,GAAG,EAAE,yBAAyB,IAAA,UAAE,EAAE,WAAW,CAAE,EAAE;YACjD,MAAM,EAAE,KAAK;SACb,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,SAAiB;QAC3B,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAyC;YACtE,GAAG,EAAE,0BAA0B,SAAS,EAAE;YAC1C,MAAM,EAAE,KAAK;SACb,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAE,SAAiB;QAC9B,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA4C;YACzE,GAAG,EAAE,0BAA0B,SAAS,SAAS;YACjD,MAAM,EAAE,MAAM;SACd,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAE,SAAiB,EAAE,IAAiD;QACvF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAkD;YAC/E,GAAG,EAAE,0BAA0B,SAAS,SAAS;YACjD,MAAM,EAAE,OAAO;YACf,IAAI;SACJ,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAE,SAAiB,EAAE,IAAgD;QACrF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAiD;YAC9E,GAAG,EAAE,0BAA0B,SAAS,QAAQ;YAChD,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;IACH,CAAC;CACD;AAvCD,gCAuCC"}
@@ -0,0 +1,8 @@
1
+ import type { AgentDispatchRespondValidation, AgentDispatchRateValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentDispatch {
4
+ private http;
5
+ constructor(http: Http);
6
+ respond(body: AgentDispatchRespondValidation['body']): Promise<AgentDispatchRespondValidation['response']>;
7
+ rate(body: AgentDispatchRateValidation['body']): Promise<AgentDispatchRateValidation['response']>;
8
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // ─── Agent Dispatch ───────────────────────────────────────────────────────────
4
+ class AgentDispatch {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async respond(body) {
9
+ return await this.http.request({
10
+ url: '/agent/dispatch/respond',
11
+ method: 'POST',
12
+ body
13
+ });
14
+ }
15
+ async rate(body) {
16
+ return await this.http.request({
17
+ url: '/agent/dispatch/rate',
18
+ method: 'POST',
19
+ body
20
+ });
21
+ }
22
+ }
23
+ exports.default = AgentDispatch;
24
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../src/allend/Agent/dispatch.ts"],"names":[],"mappings":";;AAMA,iFAAiF;AAEjF,MAAqB,aAAa;IACjC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,OAAO,CAAE,IAA4C;QAC1D,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA6C;YAC1E,GAAG,EAAE,yBAAyB;YAC9B,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAE,IAAyC;QACpD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YACvE,GAAG,EAAE,sBAAsB;YAC3B,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;IACH,CAAC;CACD;AAlBD,gCAkBC"}
@@ -0,0 +1,49 @@
1
+ import type { UserSession } from '../../types/access';
2
+ import type { AgentInfoValidation, AgentAvailabilityValidation, AgentUpdateValidation } from '@de./types';
3
+ import AccessManager from '../Access';
4
+ import AgentRides from './rides';
5
+ import AgentDelivery from './delivery';
6
+ import AgentShipping from './shipping';
7
+ import AgentNavigation from './navigation';
8
+ import AgentConsolidation from './consolidation';
9
+ import AgentReallocation from './reallocation';
10
+ import AgentDispatch from './dispatch';
11
+ import AgentOrigin from './origin';
12
+ import AgentRealtime from './realtime';
13
+ export type AgentConfig = {
14
+ context: string;
15
+ accessToken: string;
16
+ env?: 'dev' | 'staging' | 'prod';
17
+ platform?: 'web' | 'mobile' | 'server' | 'proxy';
18
+ remoteOrigin?: string;
19
+ /** Per-request deadline in ms. See `AccessOptions.timeout`. */
20
+ timeout?: number;
21
+ /** Explicit service origin, overriding the env table. See `AccessOptions.baseUrl`. */
22
+ baseUrl?: string;
23
+ /** Host to substitute for `localhost` in `dev` (Eg. a native emulator) */
24
+ devHostname?: string;
25
+ /**
26
+ * The signed-in rider.
27
+ *
28
+ * Required in practice: AUX agent routes authenticate the caller with
29
+ * `isConnected` + `isAgent`, which read `de-auth-token` / `de-auth-device`
30
+ * and ignore the bearer token entirely. Without this, every call here
31
+ * fails authorization no matter how valid the access token is.
32
+ */
33
+ session?: UserSession;
34
+ };
35
+ export default class Agent extends AccessManager {
36
+ readonly rides: AgentRides;
37
+ readonly delivery: AgentDelivery;
38
+ readonly shipping: AgentShipping;
39
+ readonly navigation: AgentNavigation;
40
+ readonly consolidation: AgentConsolidation;
41
+ readonly reallocation: AgentReallocation;
42
+ readonly dispatch: AgentDispatch;
43
+ readonly origin: AgentOrigin;
44
+ readonly realtime: AgentRealtime;
45
+ constructor(config: AgentConfig);
46
+ info(): Promise<AgentInfoValidation['response']>;
47
+ update(body: AgentUpdateValidation['body']): Promise<AgentUpdateValidation['response']>;
48
+ availability(status: AgentAvailabilityValidation['params']['availability']): Promise<AgentAvailabilityValidation['response']>;
49
+ }