@de./types 1.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 (531) hide show
  1. package/dist/api.d.ts +113 -0
  2. package/dist/api.d.ts.map +1 -0
  3. package/dist/api.js +92 -0
  4. package/dist/api.js.map +1 -0
  5. package/dist/auth.d.ts +109 -0
  6. package/dist/auth.d.ts.map +1 -0
  7. package/dist/auth.js +80 -0
  8. package/dist/auth.js.map +1 -0
  9. package/dist/aux/agent-rvs.d.ts +1205 -0
  10. package/dist/aux/agent-rvs.d.ts.map +1 -0
  11. package/dist/aux/agent-rvs.js +444 -0
  12. package/dist/aux/agent-rvs.js.map +1 -0
  13. package/dist/aux/agents.d.ts +1573 -0
  14. package/dist/aux/agents.d.ts.map +1 -0
  15. package/dist/aux/agents.js +487 -0
  16. package/dist/aux/agents.js.map +1 -0
  17. package/dist/aux/customer-rvs.d.ts +711 -0
  18. package/dist/aux/customer-rvs.d.ts.map +1 -0
  19. package/dist/aux/customer-rvs.js +321 -0
  20. package/dist/aux/customer-rvs.js.map +1 -0
  21. package/dist/aux/customers.d.ts +379 -0
  22. package/dist/aux/customers.d.ts.map +1 -0
  23. package/dist/aux/customers.js +67 -0
  24. package/dist/aux/customers.js.map +1 -0
  25. package/dist/aux/index.d.ts +5 -0
  26. package/dist/aux/index.d.ts.map +1 -0
  27. package/dist/aux/index.js +21 -0
  28. package/dist/aux/index.js.map +1 -0
  29. package/dist/billing.d.ts +367 -0
  30. package/dist/billing.d.ts.map +1 -0
  31. package/dist/billing.js +308 -0
  32. package/dist/billing.js.map +1 -0
  33. package/dist/bucket.d.ts +97 -0
  34. package/dist/bucket.d.ts.map +1 -0
  35. package/dist/bucket.js +52 -0
  36. package/dist/bucket.js.map +1 -0
  37. package/dist/context.d.ts +148 -0
  38. package/dist/context.d.ts.map +1 -0
  39. package/dist/context.js +148 -0
  40. package/dist/context.js.map +1 -0
  41. package/dist/csp/analytics.d.ts +270 -0
  42. package/dist/csp/analytics.d.ts.map +1 -0
  43. package/dist/csp/analytics.js +185 -0
  44. package/dist/csp/analytics.js.map +1 -0
  45. package/dist/csp/base.d.ts +11 -0
  46. package/dist/csp/base.d.ts.map +1 -0
  47. package/dist/csp/base.js +17 -0
  48. package/dist/csp/base.js.map +1 -0
  49. package/dist/csp/index.d.ts +107 -0
  50. package/dist/csp/index.d.ts.map +1 -0
  51. package/dist/csp/index.js +48 -0
  52. package/dist/csp/index.js.map +1 -0
  53. package/dist/csp/inventory.d.ts +361 -0
  54. package/dist/csp/inventory.d.ts.map +1 -0
  55. package/dist/csp/inventory.js +267 -0
  56. package/dist/csp/inventory.js.map +1 -0
  57. package/dist/csp/order.d.ts +1457 -0
  58. package/dist/csp/order.d.ts.map +1 -0
  59. package/dist/csp/order.js +367 -0
  60. package/dist/csp/order.js.map +1 -0
  61. package/dist/csp/webhook.d.ts +381 -0
  62. package/dist/csp/webhook.d.ts.map +1 -0
  63. package/dist/csp/webhook.js +207 -0
  64. package/dist/csp/webhook.js.map +1 -0
  65. package/dist/de.profile.d.ts +411 -0
  66. package/dist/de.profile.d.ts.map +1 -0
  67. package/dist/de.profile.js +98 -0
  68. package/dist/de.profile.js.map +1 -0
  69. package/dist/dev/developer.d.ts +211 -0
  70. package/dist/dev/developer.d.ts.map +1 -0
  71. package/dist/dev/developer.js +55 -0
  72. package/dist/dev/developer.js.map +1 -0
  73. package/dist/dev/index.d.ts +133 -0
  74. package/dist/dev/index.d.ts.map +1 -0
  75. package/dist/dev/index.js +79 -0
  76. package/dist/dev/index.js.map +1 -0
  77. package/dist/entity.d.ts +159 -0
  78. package/dist/entity.d.ts.map +1 -0
  79. package/dist/entity.js +127 -0
  80. package/dist/entity.js.map +1 -0
  81. package/dist/events.d.ts +1844 -0
  82. package/dist/events.d.ts.map +1 -0
  83. package/dist/events.js +303 -0
  84. package/dist/events.js.map +1 -0
  85. package/dist/faq.d.ts +60 -0
  86. package/dist/faq.d.ts.map +1 -0
  87. package/dist/faq.js +31 -0
  88. package/dist/faq.js.map +1 -0
  89. package/dist/geo.d.ts +123 -0
  90. package/dist/geo.d.ts.map +1 -0
  91. package/dist/geo.js +87 -0
  92. package/dist/geo.js.map +1 -0
  93. package/dist/index.d.ts +28 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +59 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/inventory.d.ts +1347 -0
  98. package/dist/inventory.d.ts.map +1 -0
  99. package/dist/inventory.js +356 -0
  100. package/dist/inventory.js.map +1 -0
  101. package/dist/invoice.d.ts +46 -0
  102. package/dist/invoice.d.ts.map +1 -0
  103. package/dist/invoice.js +33 -0
  104. package/dist/invoice.js.map +1 -0
  105. package/dist/iotsp/device.d.ts +581 -0
  106. package/dist/iotsp/device.d.ts.map +1 -0
  107. package/dist/iotsp/device.js +277 -0
  108. package/dist/iotsp/device.js.map +1 -0
  109. package/dist/iotsp/index.d.ts +111 -0
  110. package/dist/iotsp/index.d.ts.map +1 -0
  111. package/dist/iotsp/index.js +76 -0
  112. package/dist/iotsp/index.js.map +1 -0
  113. package/dist/iotsp/rule.d.ts +340 -0
  114. package/dist/iotsp/rule.d.ts.map +1 -0
  115. package/dist/iotsp/rule.js +172 -0
  116. package/dist/iotsp/rule.js.map +1 -0
  117. package/dist/iotsp/topic.d.ts +249 -0
  118. package/dist/iotsp/topic.d.ts.map +1 -0
  119. package/dist/iotsp/topic.js +139 -0
  120. package/dist/iotsp/topic.js.map +1 -0
  121. package/dist/lsp/carrier/analytics.d.ts +1191 -0
  122. package/dist/lsp/carrier/analytics.d.ts.map +1 -0
  123. package/dist/lsp/carrier/analytics.js +354 -0
  124. package/dist/lsp/carrier/analytics.js.map +1 -0
  125. package/dist/lsp/carrier/capabilities.d.ts +3603 -0
  126. package/dist/lsp/carrier/capabilities.d.ts.map +1 -0
  127. package/dist/lsp/carrier/capabilities.js +880 -0
  128. package/dist/lsp/carrier/capabilities.js.map +1 -0
  129. package/dist/lsp/carrier/capacities.d.ts +4436 -0
  130. package/dist/lsp/carrier/capacities.d.ts.map +1 -0
  131. package/dist/lsp/carrier/capacities.js +615 -0
  132. package/dist/lsp/carrier/capacities.js.map +1 -0
  133. package/dist/lsp/carrier/index.d.ts +734 -0
  134. package/dist/lsp/carrier/index.d.ts.map +1 -0
  135. package/dist/lsp/carrier/index.js +150 -0
  136. package/dist/lsp/carrier/index.js.map +1 -0
  137. package/dist/lsp/carrier/performance.d.ts +567 -0
  138. package/dist/lsp/carrier/performance.d.ts.map +1 -0
  139. package/dist/lsp/carrier/performance.js +127 -0
  140. package/dist/lsp/carrier/performance.js.map +1 -0
  141. package/dist/lsp/carrier/utilities.d.ts +6671 -0
  142. package/dist/lsp/carrier/utilities.d.ts.map +1 -0
  143. package/dist/lsp/carrier/utilities.js +597 -0
  144. package/dist/lsp/carrier/utilities.js.map +1 -0
  145. package/dist/lsp/consolidation.d.ts +793 -0
  146. package/dist/lsp/consolidation.d.ts.map +1 -0
  147. package/dist/lsp/consolidation.js +343 -0
  148. package/dist/lsp/consolidation.js.map +1 -0
  149. package/dist/lsp/coverage.d.ts +7449 -0
  150. package/dist/lsp/coverage.d.ts.map +1 -0
  151. package/dist/lsp/coverage.js +706 -0
  152. package/dist/lsp/coverage.js.map +1 -0
  153. package/dist/lsp/fleet/index.d.ts +1128 -0
  154. package/dist/lsp/fleet/index.d.ts.map +1 -0
  155. package/dist/lsp/fleet/index.js +269 -0
  156. package/dist/lsp/fleet/index.js.map +1 -0
  157. package/dist/lsp/fleet/maintenance.d.ts +2022 -0
  158. package/dist/lsp/fleet/maintenance.d.ts.map +1 -0
  159. package/dist/lsp/fleet/maintenance.js +386 -0
  160. package/dist/lsp/fleet/maintenance.js.map +1 -0
  161. package/dist/lsp/fleet/parking.d.ts +2043 -0
  162. package/dist/lsp/fleet/parking.d.ts.map +1 -0
  163. package/dist/lsp/fleet/parking.js +458 -0
  164. package/dist/lsp/fleet/parking.js.map +1 -0
  165. package/dist/lsp/fleet/vehicle.d.ts +783 -0
  166. package/dist/lsp/fleet/vehicle.d.ts.map +1 -0
  167. package/dist/lsp/fleet/vehicle.js +314 -0
  168. package/dist/lsp/fleet/vehicle.js.map +1 -0
  169. package/dist/lsp/graph.d.ts +212 -0
  170. package/dist/lsp/graph.d.ts.map +1 -0
  171. package/dist/lsp/graph.js +92 -0
  172. package/dist/lsp/graph.js.map +1 -0
  173. package/dist/lsp/hub/analytics.d.ts +4294 -0
  174. package/dist/lsp/hub/analytics.d.ts.map +1 -0
  175. package/dist/lsp/hub/analytics.js +219 -0
  176. package/dist/lsp/hub/analytics.js.map +1 -0
  177. package/dist/lsp/hub/capabilities.d.ts +1467 -0
  178. package/dist/lsp/hub/capabilities.d.ts.map +1 -0
  179. package/dist/lsp/hub/capabilities.js +464 -0
  180. package/dist/lsp/hub/capabilities.js.map +1 -0
  181. package/dist/lsp/hub/capacities.d.ts +4278 -0
  182. package/dist/lsp/hub/capacities.d.ts.map +1 -0
  183. package/dist/lsp/hub/capacities.js +495 -0
  184. package/dist/lsp/hub/capacities.js.map +1 -0
  185. package/dist/lsp/hub/index.d.ts +2784 -0
  186. package/dist/lsp/hub/index.d.ts.map +1 -0
  187. package/dist/lsp/hub/index.js +268 -0
  188. package/dist/lsp/hub/index.js.map +1 -0
  189. package/dist/lsp/hub/performance.d.ts +391 -0
  190. package/dist/lsp/hub/performance.d.ts.map +1 -0
  191. package/dist/lsp/hub/performance.js +78 -0
  192. package/dist/lsp/hub/performance.js.map +1 -0
  193. package/dist/lsp/hub/utilities.d.ts +2996 -0
  194. package/dist/lsp/hub/utilities.d.ts.map +1 -0
  195. package/dist/lsp/hub/utilities.js +521 -0
  196. package/dist/lsp/hub/utilities.js.map +1 -0
  197. package/dist/lsp/index.d.ts +157 -0
  198. package/dist/lsp/index.d.ts.map +1 -0
  199. package/dist/lsp/index.js +121 -0
  200. package/dist/lsp/index.js.map +1 -0
  201. package/dist/lsp/operations.d.ts +563 -0
  202. package/dist/lsp/operations.d.ts.map +1 -0
  203. package/dist/lsp/operations.js +265 -0
  204. package/dist/lsp/operations.js.map +1 -0
  205. package/dist/lsp/order/delivery.d.ts +1119 -0
  206. package/dist/lsp/order/delivery.d.ts.map +1 -0
  207. package/dist/lsp/order/delivery.js +169 -0
  208. package/dist/lsp/order/delivery.js.map +1 -0
  209. package/dist/lsp/order/flow/processes.d.ts +8 -0
  210. package/dist/lsp/order/flow/processes.d.ts.map +1 -0
  211. package/dist/lsp/order/flow/processes.js +67 -0
  212. package/dist/lsp/order/flow/processes.js.map +1 -0
  213. package/dist/lsp/order/flow/stages.d.ts +8 -0
  214. package/dist/lsp/order/flow/stages.d.ts.map +1 -0
  215. package/dist/lsp/order/flow/stages.js +111 -0
  216. package/dist/lsp/order/flow/stages.js.map +1 -0
  217. package/dist/lsp/order/inbound.d.ts +1165 -0
  218. package/dist/lsp/order/inbound.d.ts.map +1 -0
  219. package/dist/lsp/order/inbound.js +185 -0
  220. package/dist/lsp/order/inbound.js.map +1 -0
  221. package/dist/lsp/order/internal.d.ts +1404 -0
  222. package/dist/lsp/order/internal.d.ts.map +1 -0
  223. package/dist/lsp/order/internal.js +255 -0
  224. package/dist/lsp/order/internal.js.map +1 -0
  225. package/dist/lsp/order/management.d.ts +541 -0
  226. package/dist/lsp/order/management.d.ts.map +1 -0
  227. package/dist/lsp/order/management.js +326 -0
  228. package/dist/lsp/order/management.js.map +1 -0
  229. package/dist/lsp/order/outbound.d.ts +909 -0
  230. package/dist/lsp/order/outbound.d.ts.map +1 -0
  231. package/dist/lsp/order/outbound.js +105 -0
  232. package/dist/lsp/order/outbound.js.map +1 -0
  233. package/dist/lsp/order/passthrough.d.ts +1816 -0
  234. package/dist/lsp/order/passthrough.d.ts.map +1 -0
  235. package/dist/lsp/order/passthrough.js +360 -0
  236. package/dist/lsp/order/passthrough.js.map +1 -0
  237. package/dist/lsp/order/ride.d.ts +1056 -0
  238. package/dist/lsp/order/ride.d.ts.map +1 -0
  239. package/dist/lsp/order/ride.js +166 -0
  240. package/dist/lsp/order/ride.js.map +1 -0
  241. package/dist/lsp/order/shipping.d.ts +1524 -0
  242. package/dist/lsp/order/shipping.d.ts.map +1 -0
  243. package/dist/lsp/order/shipping.js +223 -0
  244. package/dist/lsp/order/shipping.js.map +1 -0
  245. package/dist/lsp/performance.d.ts +2 -0
  246. package/dist/lsp/performance.d.ts.map +1 -0
  247. package/dist/lsp/performance.js +3 -0
  248. package/dist/lsp/performance.js.map +1 -0
  249. package/dist/lsp/pod/index.d.ts +805 -0
  250. package/dist/lsp/pod/index.d.ts.map +1 -0
  251. package/dist/lsp/pod/index.js +250 -0
  252. package/dist/lsp/pod/index.js.map +1 -0
  253. package/dist/lsp/pricing.d.ts +1811 -0
  254. package/dist/lsp/pricing.d.ts.map +1 -0
  255. package/dist/lsp/pricing.js +972 -0
  256. package/dist/lsp/pricing.js.map +1 -0
  257. package/dist/lsp/processing.d.ts +893 -0
  258. package/dist/lsp/processing.d.ts.map +1 -0
  259. package/dist/lsp/processing.js +202 -0
  260. package/dist/lsp/processing.js.map +1 -0
  261. package/dist/lsp/product.d.ts +76 -0
  262. package/dist/lsp/product.d.ts.map +1 -0
  263. package/dist/lsp/product.js +3 -0
  264. package/dist/lsp/product.js.map +1 -0
  265. package/dist/lsp/psl.d.ts +785 -0
  266. package/dist/lsp/psl.d.ts.map +1 -0
  267. package/dist/lsp/psl.js +333 -0
  268. package/dist/lsp/psl.js.map +1 -0
  269. package/dist/lsp/terminal/analytics.d.ts +278 -0
  270. package/dist/lsp/terminal/analytics.d.ts.map +1 -0
  271. package/dist/lsp/terminal/analytics.js +310 -0
  272. package/dist/lsp/terminal/analytics.js.map +1 -0
  273. package/dist/lsp/terminal/capabilities.d.ts +797 -0
  274. package/dist/lsp/terminal/capabilities.d.ts.map +1 -0
  275. package/dist/lsp/terminal/capabilities.js +506 -0
  276. package/dist/lsp/terminal/capabilities.js.map +1 -0
  277. package/dist/lsp/terminal/capacities.d.ts +3152 -0
  278. package/dist/lsp/terminal/capacities.d.ts.map +1 -0
  279. package/dist/lsp/terminal/capacities.js +504 -0
  280. package/dist/lsp/terminal/capacities.js.map +1 -0
  281. package/dist/lsp/terminal/index.d.ts +1056 -0
  282. package/dist/lsp/terminal/index.d.ts.map +1 -0
  283. package/dist/lsp/terminal/index.js +394 -0
  284. package/dist/lsp/terminal/index.js.map +1 -0
  285. package/dist/lsp/terminal/performance.d.ts +955 -0
  286. package/dist/lsp/terminal/performance.d.ts.map +1 -0
  287. package/dist/lsp/terminal/performance.js +159 -0
  288. package/dist/lsp/terminal/performance.js.map +1 -0
  289. package/dist/lsp/terminal/utilities.d.ts +2374 -0
  290. package/dist/lsp/terminal/utilities.d.ts.map +1 -0
  291. package/dist/lsp/terminal/utilities.js +161 -0
  292. package/dist/lsp/terminal/utilities.js.map +1 -0
  293. package/dist/lsp/warehouse/analytics.d.ts +3088 -0
  294. package/dist/lsp/warehouse/analytics.d.ts.map +1 -0
  295. package/dist/lsp/warehouse/analytics.js +229 -0
  296. package/dist/lsp/warehouse/analytics.js.map +1 -0
  297. package/dist/lsp/warehouse/capabilities.d.ts +1384 -0
  298. package/dist/lsp/warehouse/capabilities.d.ts.map +1 -0
  299. package/dist/lsp/warehouse/capabilities.js +567 -0
  300. package/dist/lsp/warehouse/capabilities.js.map +1 -0
  301. package/dist/lsp/warehouse/capacities.d.ts +2921 -0
  302. package/dist/lsp/warehouse/capacities.d.ts.map +1 -0
  303. package/dist/lsp/warehouse/capacities.js +450 -0
  304. package/dist/lsp/warehouse/capacities.js.map +1 -0
  305. package/dist/lsp/warehouse/index.d.ts +2566 -0
  306. package/dist/lsp/warehouse/index.d.ts.map +1 -0
  307. package/dist/lsp/warehouse/index.js +264 -0
  308. package/dist/lsp/warehouse/index.js.map +1 -0
  309. package/dist/lsp/warehouse/performance.d.ts +287 -0
  310. package/dist/lsp/warehouse/performance.d.ts.map +1 -0
  311. package/dist/lsp/warehouse/performance.js +72 -0
  312. package/dist/lsp/warehouse/performance.js.map +1 -0
  313. package/dist/lsp/warehouse/utilities.d.ts +5174 -0
  314. package/dist/lsp/warehouse/utilities.d.ts.map +1 -0
  315. package/dist/lsp/warehouse/utilities.js +588 -0
  316. package/dist/lsp/warehouse/utilities.js.map +1 -0
  317. package/dist/lsp/zones.d.ts +305 -0
  318. package/dist/lsp/zones.d.ts.map +1 -0
  319. package/dist/lsp/zones.js +118 -0
  320. package/dist/lsp/zones.js.map +1 -0
  321. package/dist/measure.d.ts +139 -0
  322. package/dist/measure.d.ts.map +1 -0
  323. package/dist/measure.js +190 -0
  324. package/dist/measure.js.map +1 -0
  325. package/dist/operator.d.ts +103 -0
  326. package/dist/operator.d.ts.map +1 -0
  327. package/dist/operator.js +38 -0
  328. package/dist/operator.js.map +1 -0
  329. package/dist/order.d.ts +2739 -0
  330. package/dist/order.d.ts.map +1 -0
  331. package/dist/order.js +1078 -0
  332. package/dist/order.js.map +1 -0
  333. package/dist/realm/index.d.ts +4 -0
  334. package/dist/realm/index.d.ts.map +1 -0
  335. package/dist/realm/index.js +20 -0
  336. package/dist/realm/index.js.map +1 -0
  337. package/dist/realm/pipelines.d.ts +32567 -0
  338. package/dist/realm/pipelines.d.ts.map +1 -0
  339. package/dist/realm/pipelines.js +1273 -0
  340. package/dist/realm/pipelines.js.map +1 -0
  341. package/dist/realm/queries.d.ts +1327 -0
  342. package/dist/realm/queries.d.ts.map +1 -0
  343. package/dist/realm/queries.js +456 -0
  344. package/dist/realm/queries.js.map +1 -0
  345. package/dist/realm/utilities.d.ts +1794 -0
  346. package/dist/realm/utilities.d.ts.map +1 -0
  347. package/dist/realm/utilities.js +594 -0
  348. package/dist/realm/utilities.js.map +1 -0
  349. package/dist/routing.d.ts +428 -0
  350. package/dist/routing.d.ts.map +1 -0
  351. package/dist/routing.js +60 -0
  352. package/dist/routing.js.map +1 -0
  353. package/dist/service.d.ts +264 -0
  354. package/dist/service.d.ts.map +1 -0
  355. package/dist/service.js +60 -0
  356. package/dist/service.js.map +1 -0
  357. package/dist/shared/access.d.ts +102 -0
  358. package/dist/shared/access.d.ts.map +1 -0
  359. package/dist/shared/access.js +30 -0
  360. package/dist/shared/access.js.map +1 -0
  361. package/dist/shared/account.d.ts +44 -0
  362. package/dist/shared/account.d.ts.map +1 -0
  363. package/dist/shared/account.js +15 -0
  364. package/dist/shared/account.js.map +1 -0
  365. package/dist/shared/auth.d.ts +45 -0
  366. package/dist/shared/auth.d.ts.map +1 -0
  367. package/dist/shared/auth.js +19 -0
  368. package/dist/shared/auth.js.map +1 -0
  369. package/dist/shared/bucket.d.ts +294 -0
  370. package/dist/shared/bucket.d.ts.map +1 -0
  371. package/dist/shared/bucket.js +79 -0
  372. package/dist/shared/bucket.js.map +1 -0
  373. package/dist/shared/faq.d.ts +280 -0
  374. package/dist/shared/faq.d.ts.map +1 -0
  375. package/dist/shared/faq.js +73 -0
  376. package/dist/shared/faq.js.map +1 -0
  377. package/dist/shared/index.d.ts +10 -0
  378. package/dist/shared/index.d.ts.map +1 -0
  379. package/dist/shared/index.js +26 -0
  380. package/dist/shared/index.js.map +1 -0
  381. package/dist/shared/invitation.d.ts +1525 -0
  382. package/dist/shared/invitation.d.ts.map +1 -0
  383. package/dist/shared/invitation.js +60 -0
  384. package/dist/shared/invitation.js.map +1 -0
  385. package/dist/shared/operator.d.ts +956 -0
  386. package/dist/shared/operator.d.ts.map +1 -0
  387. package/dist/shared/operator.js +48 -0
  388. package/dist/shared/operator.js.map +1 -0
  389. package/dist/shared/tracking.d.ts +31 -0
  390. package/dist/shared/tracking.d.ts.map +1 -0
  391. package/dist/shared/tracking.js +23 -0
  392. package/dist/shared/tracking.js.map +1 -0
  393. package/dist/shared/user.d.ts +77 -0
  394. package/dist/shared/user.d.ts.map +1 -0
  395. package/dist/shared/user.js +22 -0
  396. package/dist/shared/user.js.map +1 -0
  397. package/dist/sync.d.ts +539 -0
  398. package/dist/sync.d.ts.map +1 -0
  399. package/dist/sync.js +329 -0
  400. package/dist/sync.js.map +1 -0
  401. package/dist/time.d.ts +139 -0
  402. package/dist/time.d.ts.map +1 -0
  403. package/dist/time.js +93 -0
  404. package/dist/time.js.map +1 -0
  405. package/dist/user.d.ts +394 -0
  406. package/dist/user.d.ts.map +1 -0
  407. package/dist/user.js +205 -0
  408. package/dist/user.js.map +1 -0
  409. package/dist/workspace/admin.d.ts +91 -0
  410. package/dist/workspace/admin.d.ts.map +1 -0
  411. package/dist/workspace/admin.js +33 -0
  412. package/dist/workspace/admin.js.map +1 -0
  413. package/dist/workspace/billing.d.ts +2 -0
  414. package/dist/workspace/billing.d.ts.map +1 -0
  415. package/dist/workspace/billing.js +18 -0
  416. package/dist/workspace/billing.js.map +1 -0
  417. package/dist/workspace/connector.d.ts +595 -0
  418. package/dist/workspace/connector.d.ts.map +1 -0
  419. package/dist/workspace/connector.js +229 -0
  420. package/dist/workspace/connector.js.map +1 -0
  421. package/dist/workspace/index.d.ts +36 -0
  422. package/dist/workspace/index.d.ts.map +1 -0
  423. package/dist/workspace/index.js +21 -0
  424. package/dist/workspace/index.js.map +1 -0
  425. package/package.json +70 -0
  426. package/src/api.ts +147 -0
  427. package/src/auth.ts +103 -0
  428. package/src/aux/agent-rvs.ts +596 -0
  429. package/src/aux/agents.ts +542 -0
  430. package/src/aux/customer-rvs.ts +421 -0
  431. package/src/aux/customers.ts +80 -0
  432. package/src/aux/index.ts +4 -0
  433. package/src/billing.ts +330 -0
  434. package/src/bucket.ts +58 -0
  435. package/src/context.ts +167 -0
  436. package/src/csp/analytics.ts +238 -0
  437. package/src/csp/base.ts +18 -0
  438. package/src/csp/index.ts +41 -0
  439. package/src/csp/inventory.ts +325 -0
  440. package/src/csp/order.ts +485 -0
  441. package/src/csp/webhook.ts +269 -0
  442. package/src/de.profile.ts +123 -0
  443. package/src/dev/developer.ts +90 -0
  444. package/src/dev/index.ts +81 -0
  445. package/src/entity.ts +154 -0
  446. package/src/events.ts +349 -0
  447. package/src/faq.ts +39 -0
  448. package/src/geo.ts +111 -0
  449. package/src/index.ts +48 -0
  450. package/src/inventory.ts +405 -0
  451. package/src/invoice.ts +37 -0
  452. package/src/iotsp/device.ts +334 -0
  453. package/src/iotsp/index.ts +91 -0
  454. package/src/iotsp/rule.ts +227 -0
  455. package/src/iotsp/topic.ts +191 -0
  456. package/src/lsp/carrier/analytics.ts +393 -0
  457. package/src/lsp/carrier/capabilities.ts +1009 -0
  458. package/src/lsp/carrier/capacities.ts +723 -0
  459. package/src/lsp/carrier/index.ts +175 -0
  460. package/src/lsp/carrier/performance.ts +145 -0
  461. package/src/lsp/carrier/utilities.ts +654 -0
  462. package/src/lsp/consolidation.ts +420 -0
  463. package/src/lsp/coverage.ts +869 -0
  464. package/src/lsp/fleet/index.ts +327 -0
  465. package/src/lsp/fleet/maintenance.ts +478 -0
  466. package/src/lsp/fleet/parking.ts +582 -0
  467. package/src/lsp/fleet/vehicle.ts +381 -0
  468. package/src/lsp/graph.ts +113 -0
  469. package/src/lsp/hub/analytics.ts +236 -0
  470. package/src/lsp/hub/capabilities.ts +549 -0
  471. package/src/lsp/hub/capacities.ts +590 -0
  472. package/src/lsp/hub/index.ts +298 -0
  473. package/src/lsp/hub/performance.ts +89 -0
  474. package/src/lsp/hub/utilities.ts +560 -0
  475. package/src/lsp/index.ts +125 -0
  476. package/src/lsp/operations.ts +304 -0
  477. package/src/lsp/order/delivery.ts +212 -0
  478. package/src/lsp/order/flow/processes.ts +70 -0
  479. package/src/lsp/order/flow/stages.ts +119 -0
  480. package/src/lsp/order/inbound.ts +231 -0
  481. package/src/lsp/order/internal.ts +305 -0
  482. package/src/lsp/order/management.ts +367 -0
  483. package/src/lsp/order/outbound.ts +128 -0
  484. package/src/lsp/order/passthrough.ts +434 -0
  485. package/src/lsp/order/ride.ts +190 -0
  486. package/src/lsp/order/shipping.ts +263 -0
  487. package/src/lsp/performance.ts +2 -0
  488. package/src/lsp/pod/index.ts +323 -0
  489. package/src/lsp/pricing.ts +1097 -0
  490. package/src/lsp/processing.ts +243 -0
  491. package/src/lsp/product.ts +104 -0
  492. package/src/lsp/psl.ts +399 -0
  493. package/src/lsp/terminal/analytics.ts +334 -0
  494. package/src/lsp/terminal/capabilities.ts +541 -0
  495. package/src/lsp/terminal/capacities.ts +556 -0
  496. package/src/lsp/terminal/index.ts +442 -0
  497. package/src/lsp/terminal/performance.ts +168 -0
  498. package/src/lsp/terminal/utilities.ts +173 -0
  499. package/src/lsp/warehouse/analytics.ts +248 -0
  500. package/src/lsp/warehouse/capabilities.ts +673 -0
  501. package/src/lsp/warehouse/capacities.ts +538 -0
  502. package/src/lsp/warehouse/index.ts +298 -0
  503. package/src/lsp/warehouse/performance.ts +83 -0
  504. package/src/lsp/warehouse/utilities.ts +634 -0
  505. package/src/lsp/zones.ts +148 -0
  506. package/src/measure.ts +240 -0
  507. package/src/operator.ts +39 -0
  508. package/src/order.ts +1207 -0
  509. package/src/realm/index.ts +3 -0
  510. package/src/realm/pipelines.ts +1607 -0
  511. package/src/realm/queries.ts +608 -0
  512. package/src/realm/utilities.ts +730 -0
  513. package/src/routing.ts +69 -0
  514. package/src/service.ts +66 -0
  515. package/src/shared/access.ts +58 -0
  516. package/src/shared/account.ts +25 -0
  517. package/src/shared/auth.ts +30 -0
  518. package/src/shared/bucket.ts +153 -0
  519. package/src/shared/faq.ts +139 -0
  520. package/src/shared/index.ts +9 -0
  521. package/src/shared/invitation.ts +124 -0
  522. package/src/shared/operator.ts +159 -0
  523. package/src/shared/tracking.ts +30 -0
  524. package/src/shared/user.ts +42 -0
  525. package/src/sync.ts +364 -0
  526. package/src/time.ts +113 -0
  527. package/src/user.ts +243 -0
  528. package/src/workspace/admin.ts +38 -0
  529. package/src/workspace/billing.ts +1 -0
  530. package/src/workspace/connector.ts +270 -0
  531. package/src/workspace/index.ts +22 -0
package/src/order.ts ADDED
@@ -0,0 +1,1207 @@
1
+ import { Type, Static } from '@sinclair/typebox'
2
+ import { MoneySchema, WeightSchema, VolumeSchema, DimensionsSchema, TemperatureSchema, SpecialHandlingSchema } from './measure'
3
+ import { ActionRecordSchema, DateTimeRangeSchema, DateTimeScheduleSchema, DateTimeZoneSchema } from './time'
4
+ import { ContextSchema, GenericServiceContextSchema, PipelineContextSchema } from './context'
5
+ import { LSPOrderTypeSchema } from './lsp'
6
+ import { UserTypeSchema } from './user'
7
+ import { DProfileReferenceSchema } from './de.profile'
8
+ import { AddressSchema, ContactsSchema } from './geo'
9
+ import { PipelineExecutionSchema } from './realm'
10
+
11
+ // Order Priority Schema
12
+ export const OrderPrioritySchema = Type.Union([
13
+ Type.Literal('STANDARD'),
14
+ Type.Literal('EXPRESS'),
15
+ Type.Literal('OVERNIGHT'),
16
+ Type.Literal('SAME_DAY'),
17
+ Type.Literal('FREIGHT'),
18
+ Type.Literal('WHITE_GLOVE'),
19
+ Type.Literal('VIS') // VIS: Very Important Shipment
20
+ ])
21
+
22
+ // Order Requirement Schema
23
+ export const OrderRequirementSchema = Type.Union([
24
+ Type.Literal('SIGNATURE_REQUIRED'),
25
+ Type.Literal('AGE_VERIFICATION'),
26
+ Type.Literal('APPOINTMENT_DELIVERY'),
27
+ Type.Literal('INSIDE_DELIVERY'),
28
+ Type.Literal('TEMPERATURE_CONTROLLED'),
29
+ Type.Literal('HAZMAT_CERTIFIED'),
30
+ Type.Literal('FRAGILE_HANDLING')
31
+ ])
32
+
33
+ // Order Item Schemas
34
+ export const OrderItemStatusSchema = Type.Union([
35
+ Type.Literal('PENDING'),
36
+ Type.Literal('ALLOCATED'),
37
+ Type.Literal('PICKED'),
38
+ Type.Literal('PACKED'),
39
+ Type.Literal('SHIPPED'),
40
+ Type.Literal('BACKORDERED'),
41
+ Type.Literal('DELIVERED'),
42
+ Type.Literal('CANCELLED')
43
+ ])
44
+ export const OrderItemSchema = Type.Object({
45
+ id: Type.String(),
46
+ orderRef: Type.String(),
47
+ productId: Type.String(),
48
+ sku: Type.String(),
49
+ name: Type.String({ minLength: 1, maxLength: 200 }),
50
+ quantity: Type.Number({ minimum: 1 }),
51
+ quantityFulfilled: Type.Number({ minimum: 0 }),
52
+ unitPrice: MoneySchema,
53
+ taxes: MoneySchema,
54
+ discounts: Type.Optional(MoneySchema),
55
+ slotId: Type.Optional(Type.String()),
56
+ lotNumber: Type.Optional(Type.String()),
57
+ serialNumbers: Type.Optional(Type.Array(Type.String())),
58
+ specialHandling: Type.Optional(Type.Array(SpecialHandlingSchema)),
59
+ notes: Type.Optional(Type.String({ maxLength: 500 })),
60
+ status: OrderItemStatusSchema
61
+ })
62
+
63
+ // Order Package Schemas
64
+ export const OrderPackageTypeSchema = Type.Union([
65
+ Type.Literal('BOX'),
66
+ Type.Literal('TUBE'),
67
+ Type.Literal('ENVELOPE'),
68
+ Type.Literal('PALLET'),
69
+ Type.Literal('CUSTOM')
70
+ ])
71
+ export const OrderPackageCategorySchema = Type.Union([
72
+ Type.Literal('FD'), // Food & Drinks / Food Delivery
73
+ Type.Literal('GR'), // Groceries
74
+ Type.Literal('FT'), // Furniture
75
+ Type.Literal('EC'), // Electronics
76
+ Type.Literal('CT'), // Clothing & Textiles
77
+ Type.Literal('MC'), // Medical Care / Medical & Cosmetics
78
+ Type.Literal('JR'), // Jewelry
79
+ Type.Literal('BP'), // Books & Publications
80
+ Type.Literal('WD'), // White Goods (appliances) / Wooden items
81
+ Type.Literal('EM'), // Emergency / Express Mail
82
+ Type.Literal('CM'), // Chemicals / Cosmetics
83
+ Type.Literal('SG'), // Sporting Goods
84
+ Type.Literal('IM'), // Industrial Materials / Import
85
+ Type.Literal('TY'), // Toys
86
+ Type.Literal('DM'), // Documents / Direct Mail
87
+ Type.Literal('AM'), // Automotive / Art & Media
88
+ Type.Literal('VC'), // Vehicle Components / Video Content
89
+ Type.Literal('HC'), // Health Care / Home Care
90
+ Type.Literal('UT'), // Utilities / Tools
91
+ Type.Literal('MN') // Machinery / Maintenance
92
+ ])
93
+ export const OrderPackageItemSchema = Type.Object({
94
+ itemId: Type.String(),
95
+ productId: Type.String(),
96
+ quantity: Type.Number({ minimum: 1 }),
97
+ source: Type.String(),
98
+ serialNumbers: Type.Optional(Type.Array(Type.String())),
99
+ lotNumber: Type.Optional(Type.Union([Type.String(), Type.Null()]))
100
+ })
101
+ export const OrderPackageSchema = Type.Object({
102
+ id: Type.String(),
103
+ // Serve as package Number
104
+ packageNumber: Type.Number({ minimum: 1 }),
105
+ // Package Tracking Code - Hierarchical tracking
106
+ tracking: Type.Optional(Type.Object({
107
+ masterTrackingNumber: Type.String(),
108
+ trackingNumber: Type.String(),
109
+ carrierTrackingNumber: Type.Optional(Type.String())
110
+ })),
111
+ type: OrderPackageTypeSchema,
112
+ category: OrderPackageCategorySchema,
113
+ /**
114
+ * Attach Waypoint No to the package for better
115
+ * referencing after routing optimization
116
+ */
117
+ waypointNo: Type.Optional(Type.String()),
118
+ shipmentId: Type.Optional(Type.String()),
119
+ // Classification care level of the package: From 1 to 5
120
+ careLevel: Type.Optional(Type.Number({ minimum: 1, maximum: 5 })),
121
+ weight: Type.Optional(WeightSchema),
122
+ volume: Type.Optional(VolumeSchema),
123
+ dimensions: Type.Optional(DimensionsSchema),
124
+ temperature: Type.Optional(TemperatureSchema),
125
+ notes: Type.Optional(Type.String({ maxLength: 500 })),
126
+ items: Type.Optional(Type.Array(OrderPackageItemSchema)),
127
+ specialHandling: Type.Optional(Type.Array(SpecialHandlingSchema)),
128
+ added: Type.Optional(ActionRecordSchema),
129
+ updated: Type.Optional(ActionRecordSchema)
130
+ })
131
+
132
+ // Order Payment Schemas
133
+ export const OrderPaymentStatusSchema = Type.Union([
134
+ Type.Literal('PENDING'),
135
+ Type.Literal('AUTHORIZED'),
136
+ Type.Literal('CAPTURED'),
137
+ Type.Literal('FAILED'),
138
+ Type.Literal('REFUNDED')
139
+ ])
140
+ export const OrderPaymentModeSchema = Type.Union([
141
+ Type.Literal('PREPAY'),
142
+ Type.Literal('POSTPAY'),
143
+ Type.Literal('CASH')
144
+ ])
145
+ export const OrderPaymentSchema = Type.Object({
146
+ // Mode of payment: Define by LSP
147
+ mode: OrderPaymentModeSchema,
148
+ // Operation request payment state
149
+ status: OrderPaymentStatusSchema,
150
+ method: Type.Optional(Type.String()),
151
+ option: Type.Optional(Type.String())
152
+ })
153
+
154
+ // Order Operation Schema
155
+ export const OrderOperationSchema = Type.Object({
156
+ fees: Type.Object({
157
+ cost: MoneySchema,
158
+ taxes: Type.Optional(MoneySchema),
159
+ discount: Type.Optional(MoneySchema),
160
+ total: MoneySchema
161
+ }),
162
+ payment: OrderPaymentSchema,
163
+ rating: Type.Optional(Type.Number({ minimum: 1, maximum: 5 }))
164
+ })
165
+
166
+ // Order Intent Schema
167
+ export const OrderIntentSchema = Type.Object({
168
+ connectorId: Type.String(), // Access/Auth connector from which the intent token was issued
169
+ customerId: Type.String(), // Unique ID/reference of the client
170
+ origin: Type.String({ format: 'uri' }) // Domain origin from where order is intent from
171
+ })
172
+
173
+ // Compensation Action Schema - Defines what to do on failure (declared early for use in hierarchy)
174
+ export const CompensationActionSchema = Type.Union([
175
+ Type.Literal('ROLLBACK_ALL'),
176
+ Type.Literal('ROLLBACK_SIBLINGS'),
177
+ Type.Literal('MARK_FAILED'),
178
+ Type.Literal('COMPENSATE'),
179
+ Type.Literal('MANUAL_INTERVENTION'),
180
+ Type.Literal('IGNORE')
181
+ ])
182
+
183
+ // ========================================================================
184
+ // ORDER COMPOSITION METADATA (Flaw #10 Fix)
185
+ // ========================================================================
186
+
187
+ // Creation Reason - WHY was this child order created?
188
+ export const CompositionReasonSchema = Type.Union([
189
+ Type.Literal('LIFECYCLE_REQUIREMENT'), // Required by order type lifecycle
190
+ Type.Literal('PIPELINE_STAGE'), // Created by pipeline template
191
+ Type.Literal('AUTOMATIC_RULE'), // Triggered by business rule
192
+ Type.Literal('CONDITIONAL_TRIGGER'), // Condition met (e.g., value > $1000)
193
+ Type.Literal('EXCEPTION_HANDLING'), // Exception/failure recovery
194
+ Type.Literal('MANUAL_REQUEST'), // Operator/manager created
195
+ Type.Literal('COMPENSATION'), // Created as compensating action
196
+ Type.Literal('SPLIT_ORDER') // Split from larger order
197
+ ])
198
+
199
+ // Relationship Type - Semantic meaning of parent-child relationship
200
+ export const RelationshipTypeSchema = Type.Union([
201
+ Type.Literal('MANDATORY'), // Must complete before parent can complete
202
+ Type.Literal('OPTIONAL'), // Parent can complete without this child
203
+ Type.Literal('CONDITIONAL') // Depends on runtime conditions
204
+ ])
205
+
206
+ // Parent State at Child Creation - Context of parent when child was spawned
207
+ export const ParentStateAtCreationSchema = Type.Object({
208
+ process: Type.String(),
209
+ stage: Type.String(),
210
+ status: Type.String()
211
+ })
212
+
213
+ // Child Order Relationship Metadata
214
+ export const ChildOrderRelationshipSchema = Type.Object({
215
+ type: RelationshipTypeSchema,
216
+ canBlockParent: Type.Boolean(), // Can this child block parent completion?
217
+ sequence: Type.Optional(Type.Number()), // Order in execution sequence
218
+ dependencies: Type.Optional(Type.Array(Type.String())) // Sibling order references this depends on
219
+ })
220
+
221
+ // Additional composition metadata
222
+ export const CompositionMetadataSchema = Type.Optional(Type.Object({
223
+ trigger: Type.Optional(Type.String()), // What triggered creation
224
+ notes: Type.Optional(Type.String()), // Human notes
225
+ tags: Type.Optional(Type.Array(Type.String())) // Categorization tags
226
+ }))
227
+
228
+ export const GenericOrderProcessorSchema = Type.Object({
229
+ context: ContextSchema,
230
+ service: GenericServiceContextSchema
231
+ })
232
+
233
+ // Order Hierarchy Schema (Parent-Child Relationships)
234
+ export const OrderHierarchySchema = Type.Object({
235
+ // Is this the root/parent order (CSP's original order)?
236
+ isRoot: Type.Boolean(),
237
+
238
+ // Reference to root order (always set for non-root orders)
239
+ rootOrderId: Type.Optional(Type.String()),
240
+ rootOrderReference: Type.Optional(Type.String()),
241
+ rootOrderType: Type.Optional(LSPOrderTypeSchema),
242
+
243
+ // Immediate parent order (for multi-level hierarchies)
244
+ parentOrderId: Type.Optional(Type.String()),
245
+ parentOrderReference: Type.Optional(Type.String()),
246
+ parentOrderType: Type.Optional(Type.String()),
247
+
248
+ // Child orders spawned from this order
249
+ childOrders: Type.Optional(Type.Array(Type.Object({
250
+ orderId: Type.String(),
251
+ orderReference: Type.String(),
252
+ orderType: Type.String(),
253
+ processor: GenericOrderProcessorSchema,
254
+ status: Type.String(),
255
+ created: ActionRecordSchema, // Who/what/when
256
+
257
+ // Composition metadata
258
+ creationReason: CompositionReasonSchema,
259
+ parentStateAtCreation: ParentStateAtCreationSchema,
260
+ relationship: ChildOrderRelationshipSchema,
261
+ metadata: CompositionMetadataSchema,
262
+
263
+ // Compensation tracking
264
+ compensation: Type.Object({
265
+ compensated: Type.Optional(Type.Boolean()),
266
+ recorded: Type.Optional(ActionRecordSchema),
267
+ action: Type.Optional(CompensationActionSchema),
268
+ reason: Type.Optional(Type.String())
269
+ })
270
+ }))),
271
+
272
+ // Denormalized descendant tracking (Flaw #9 Fix)
273
+ allDescendantReferences: Type.Optional(Type.Array(Type.String())),
274
+ descendantCount: Type.Optional(Type.Number({ minimum: 0, default: 0 })),
275
+ descendantsByType: Type.Optional(Type.Record(Type.String(), Type.Array(Type.String()))),
276
+
277
+ // Order depth in hierarchy (root = 0, first child = 1, etc.)
278
+ depth: Type.Number({ minimum: 0, default: 0 }),
279
+
280
+ // Compensation state
281
+ compensationState: Type.Optional(Type.Object({
282
+ isCompensating: Type.Boolean(),
283
+ compensationStarted: Type.Optional(ActionRecordSchema),
284
+ compensationCompleted: Type.Optional(ActionRecordSchema),
285
+ compensationStrategy: Type.Optional(CompensationActionSchema),
286
+ compensatedChildren: Type.Optional(Type.Array(Type.String())),
287
+ failedCompensations: Type.Optional(Type.Array(Type.Object({
288
+ childReference: Type.String(),
289
+ error: Type.String(),
290
+ timestamp: Type.Number()
291
+ })))
292
+ }))
293
+ })
294
+
295
+ // ========================================================================
296
+ // ORDER LIFECYCLE POLICIES
297
+ // ========================================================================
298
+
299
+ // Order Lifecycle Policy Schema - Defines parent-child completion rules
300
+ export const OrderLifecyclePolicySchema = Type.Object({
301
+ // Parent completion rules
302
+ parentCompletion: Type.Object({
303
+ requireAllChildrenComplete: Type.Boolean(),
304
+ requiredChildStatuses: Type.Optional(Type.Array(Type.String())),
305
+ allowCompletionIfChildrenAre: Type.Optional(Type.Array(Type.String()))
306
+ }),
307
+
308
+ // Parent cancellation rules
309
+ parentCancellation: Type.Object({
310
+ allowWithActiveChildren: Type.Boolean(),
311
+ childAction: Type.Union([
312
+ Type.Literal('CASCADE_CANCEL'),
313
+ Type.Literal('ORPHAN'),
314
+ Type.Literal('COMPLETE_FIRST'),
315
+ Type.Literal('SUSPEND')
316
+ ])
317
+ }),
318
+
319
+ // Child completion rules
320
+ childCompletion: Type.Object({
321
+ requireActiveParent: Type.Boolean(),
322
+ notifyParent: Type.Boolean(),
323
+ autoCompleteParent: Type.Boolean()
324
+ })
325
+ })
326
+
327
+ // LSP Order Lifecycle Policies - Business rules for order relationships
328
+ export const LSP_LIFECYCLE_POLICIES: Record<string, OrderLifecyclePolicy> = {
329
+ 'OutboundOrder': {
330
+ parentCompletion: {
331
+ requireAllChildrenComplete: true,
332
+ requiredChildStatuses: ['COMPLETED', 'SHIPPED'],
333
+ allowCompletionIfChildrenAre: ['COMPLETED', 'SHIPPED', 'DELIVERED']
334
+ },
335
+ parentCancellation: {
336
+ allowWithActiveChildren: false,
337
+ childAction: 'CASCADE_CANCEL'
338
+ },
339
+ childCompletion: {
340
+ requireActiveParent: true,
341
+ notifyParent: true,
342
+ autoCompleteParent: true
343
+ }
344
+ },
345
+
346
+ 'InboundOrder': {
347
+ parentCompletion: {
348
+ requireAllChildrenComplete: true,
349
+ requiredChildStatuses: ['COMPLETED'],
350
+ allowCompletionIfChildrenAre: ['COMPLETED']
351
+ },
352
+ parentCancellation: {
353
+ allowWithActiveChildren: false,
354
+ childAction: 'CASCADE_CANCEL'
355
+ },
356
+ childCompletion: {
357
+ requireActiveParent: true,
358
+ notifyParent: true,
359
+ autoCompleteParent: true
360
+ }
361
+ },
362
+
363
+ 'InternalOrder': {
364
+ parentCompletion: {
365
+ requireAllChildrenComplete: true,
366
+ requiredChildStatuses: ['COMPLETED'],
367
+ allowCompletionIfChildrenAre: ['COMPLETED']
368
+ },
369
+ parentCancellation: {
370
+ allowWithActiveChildren: true,
371
+ childAction: 'CASCADE_CANCEL'
372
+ },
373
+ childCompletion: {
374
+ requireActiveParent: true,
375
+ notifyParent: true,
376
+ autoCompleteParent: true
377
+ }
378
+ },
379
+
380
+ 'ShippingOrder': {
381
+ parentCompletion: {
382
+ requireAllChildrenComplete: true,
383
+ requiredChildStatuses: ['COMPLETED', 'DELIVERED'],
384
+ allowCompletionIfChildrenAre: ['DELIVERED', 'COMPLETED']
385
+ },
386
+ parentCancellation: {
387
+ allowWithActiveChildren: false,
388
+ childAction: 'COMPLETE_FIRST'
389
+ },
390
+ childCompletion: {
391
+ requireActiveParent: true,
392
+ notifyParent: true,
393
+ autoCompleteParent: false
394
+ }
395
+ },
396
+
397
+ 'PassthroughOrder': {
398
+ parentCompletion: {
399
+ requireAllChildrenComplete: true,
400
+ requiredChildStatuses: ['COMPLETED', 'DISPATCHED'],
401
+ allowCompletionIfChildrenAre: ['COMPLETED', 'DISPATCHED']
402
+ },
403
+ parentCancellation: {
404
+ allowWithActiveChildren: true,
405
+ childAction: 'CASCADE_CANCEL'
406
+ },
407
+ childCompletion: {
408
+ requireActiveParent: true,
409
+ notifyParent: true,
410
+ autoCompleteParent: true
411
+ }
412
+ }
413
+ }
414
+
415
+ // ========================================================================
416
+ // COMPENSATION & ROLLBACK STRATEGIES
417
+ // ========================================================================
418
+
419
+ // Compensation Strategy Schema
420
+ export const CompensationStrategySchema = Type.Object({
421
+ // What to do when a child order fails fatally
422
+ onChildFailure: Type.Object({
423
+ action: CompensationActionSchema,
424
+
425
+ // Should we rollback parent?
426
+ rollbackParent: Type.Boolean(),
427
+
428
+ // Should we rollback siblings?
429
+ rollbackSiblings: Type.Boolean(),
430
+
431
+ // Should we rollback completed children?
432
+ rollbackCompletedChildren: Type.Boolean(),
433
+
434
+ // Custom compensation logic
435
+ compensatingActions: Type.Optional(Type.Array(Type.Object({
436
+ orderType: Type.String(),
437
+ action: Type.String(),
438
+ params: Type.Optional(Type.Record(Type.String(), Type.Any()))
439
+ })))
440
+ }),
441
+
442
+ // What to do when parent fails
443
+ onParentFailure: Type.Object({
444
+ action: CompensationActionSchema,
445
+
446
+ // Should we cancel active children?
447
+ cancelActiveChildren: Type.Boolean(),
448
+
449
+ // Should we rollback completed children?
450
+ rollbackCompletedChildren: Type.Boolean(),
451
+
452
+ // Custom compensation logic
453
+ compensatingActions: Type.Optional(Type.Array(Type.Object({
454
+ orderType: Type.String(),
455
+ action: Type.String(),
456
+ params: Type.Optional(Type.Record(Type.String(), Type.Any()))
457
+ })))
458
+ }),
459
+
460
+ // Cleanup after successful completion
461
+ onSuccess: Type.Object({
462
+ // Clean up intermediate child orders?
463
+ cleanupIntermediateOrders: Type.Boolean(),
464
+
465
+ // Archive completed children?
466
+ archiveChildren: Type.Boolean()
467
+ })
468
+ })
469
+
470
+ export type CompensationAction = Static<typeof CompensationActionSchema>
471
+ export type CompensationStrategy = Static<typeof CompensationStrategySchema>
472
+
473
+ // LSP Compensation Strategies - Rollback policies per order type
474
+ export const LSP_COMPENSATION_STRATEGIES: Record<string, CompensationStrategy> = {
475
+ 'OutboundOrder': {
476
+ onChildFailure: {
477
+ action: 'COMPENSATE',
478
+ rollbackParent: false, // Keep parent, let it retry
479
+ rollbackSiblings: true, // Cancel other picking/packing tasks
480
+ rollbackCompletedChildren: false, // Don't undo completed picks
481
+ compensatingActions: [
482
+ {
483
+ orderType: 'InternalOrder',
484
+ action: 'REVERSE_ALLOCATION', // Return allocated inventory
485
+ params: { reason: 'SIBLING_FAILURE' }
486
+ }
487
+ ]
488
+ },
489
+ onParentFailure: {
490
+ action: 'ROLLBACK_ALL',
491
+ cancelActiveChildren: true, // Cancel all in-progress children
492
+ rollbackCompletedChildren: true // Reverse completed operations
493
+ },
494
+ onSuccess: {
495
+ cleanupIntermediateOrders: false, // Keep for audit
496
+ archiveChildren: true // Move to archive collection
497
+ }
498
+ },
499
+
500
+ 'InboundOrder': {
501
+ onChildFailure: {
502
+ action: 'MARK_FAILED',
503
+ rollbackParent: false,
504
+ rollbackSiblings: false, // Let other putaway tasks continue
505
+ rollbackCompletedChildren: false
506
+ },
507
+ onParentFailure: {
508
+ action: 'ROLLBACK_ALL',
509
+ cancelActiveChildren: true,
510
+ rollbackCompletedChildren: true // Remove from inventory
511
+ },
512
+ onSuccess: {
513
+ cleanupIntermediateOrders: false,
514
+ archiveChildren: true
515
+ }
516
+ },
517
+
518
+ 'InternalOrder': {
519
+ onChildFailure: {
520
+ action: 'ROLLBACK_SIBLINGS',
521
+ rollbackParent: false,
522
+ rollbackSiblings: true, // Cancel related warehouse tasks
523
+ rollbackCompletedChildren: false
524
+ },
525
+ onParentFailure: {
526
+ action: 'ROLLBACK_ALL',
527
+ cancelActiveChildren: true,
528
+ rollbackCompletedChildren: true // Reverse inventory moves
529
+ },
530
+ onSuccess: {
531
+ cleanupIntermediateOrders: true, // Clean up temporary tasks
532
+ archiveChildren: false
533
+ }
534
+ },
535
+
536
+ 'ShippingOrder': {
537
+ onChildFailure: {
538
+ action: 'MANUAL_INTERVENTION', // Hub failures need manual handling
539
+ rollbackParent: false,
540
+ rollbackSiblings: false,
541
+ rollbackCompletedChildren: false
542
+ },
543
+ onParentFailure: {
544
+ action: 'COMPENSATE',
545
+ cancelActiveChildren: true,
546
+ rollbackCompletedChildren: false, // Can't undo physical shipment
547
+ compensatingActions: [
548
+ {
549
+ orderType: 'ShippingOrder',
550
+ action: 'CREATE_RETURN_SHIPMENT',
551
+ params: { reason: 'PARENT_FAILURE' }
552
+ }
553
+ ]
554
+ },
555
+ onSuccess: {
556
+ cleanupIntermediateOrders: false,
557
+ archiveChildren: true
558
+ }
559
+ },
560
+
561
+ 'PassthroughOrder': {
562
+ onChildFailure: {
563
+ action: 'ROLLBACK_SIBLINGS',
564
+ rollbackParent: false,
565
+ rollbackSiblings: true,
566
+ rollbackCompletedChildren: false
567
+ },
568
+ onParentFailure: {
569
+ action: 'ROLLBACK_ALL',
570
+ cancelActiveChildren: true,
571
+ rollbackCompletedChildren: true
572
+ },
573
+ onSuccess: {
574
+ cleanupIntermediateOrders: true,
575
+ archiveChildren: true
576
+ }
577
+ }
578
+ }
579
+
580
+ // ========================================================================
581
+ // PROCESS-STAGE TRANSITION MAPS
582
+ // ========================================================================
583
+
584
+ // Process-Stage Transition Map - Defines valid stages per process
585
+ export const ProcessStageTransitionMapSchema = Type.Object({
586
+ process: Type.String(),
587
+ allowedStages: Type.Array(Type.String()),
588
+ stageFlow: Type.Array(Type.Object({
589
+ from: Type.String(),
590
+ to: Type.Array(Type.String())
591
+ }))
592
+ })
593
+
594
+ export type ProcessStageTransitionMap = Static<typeof ProcessStageTransitionMapSchema>
595
+
596
+ // LSP Process-Stage Maps - Valid stage transitions per process
597
+ export const LSP_PROCESS_STAGE_MAPS: Record<string, Record<string, ProcessStageTransitionMap>> = {
598
+ // OUTBOUND ORDER PROCESS-STAGE MAPS
599
+ 'OutboundOrder': {
600
+ 'FULFILLMENT': {
601
+ process: 'FULFILLMENT',
602
+ allowedStages: ['PROCESSING', 'QUALITY_CHECK', 'ALLOCATING', 'PICKING', 'PACKING', 'STAGING', 'LOADING'],
603
+ stageFlow: [
604
+ { from: 'PROCESSING', to: ['QUALITY_CHECK', 'ALLOCATING'] },
605
+ { from: 'QUALITY_CHECK', to: ['ALLOCATING', 'PROCESSING'] },
606
+ { from: 'ALLOCATING', to: ['PICKING'] },
607
+ { from: 'PICKING', to: ['PACKING', 'QUALITY_CHECK'] },
608
+ { from: 'PACKING', to: ['STAGING', 'QUALITY_CHECK'] },
609
+ { from: 'STAGING', to: ['LOADING'] },
610
+ { from: 'LOADING', to: [] } // Terminal stage
611
+ ]
612
+ },
613
+ 'TRANSFER': {
614
+ process: 'TRANSFER',
615
+ allowedStages: ['PROCESSING', 'ALLOCATING', 'PICKING', 'STAGING', 'LOADING'],
616
+ stageFlow: [
617
+ { from: 'PROCESSING', to: ['ALLOCATING'] },
618
+ { from: 'ALLOCATING', to: ['PICKING'] },
619
+ { from: 'PICKING', to: ['STAGING'] },
620
+ { from: 'STAGING', to: ['LOADING'] },
621
+ { from: 'LOADING', to: [] }
622
+ ]
623
+ },
624
+ 'EXCEPTION': {
625
+ process: 'EXCEPTION',
626
+ allowedStages: ['PROCESSING', 'QUALITY_CHECK'],
627
+ stageFlow: [
628
+ { from: 'PROCESSING', to: ['QUALITY_CHECK'] },
629
+ { from: 'QUALITY_CHECK', to: [] }
630
+ ]
631
+ }
632
+ },
633
+
634
+ // INBOUND ORDER PROCESS-STAGE MAPS
635
+ 'InboundOrder': {
636
+ 'RECEIVING': {
637
+ process: 'RECEIVING',
638
+ allowedStages: ['UNLOADING', 'INSPECTING', 'RECEIVING', 'PROCESSING'],
639
+ stageFlow: [
640
+ { from: 'UNLOADING', to: ['INSPECTING'] },
641
+ { from: 'INSPECTING', to: ['RECEIVING', 'PROCESSING'] },
642
+ { from: 'RECEIVING', to: ['PROCESSING'] },
643
+ { from: 'PROCESSING', to: [] }
644
+ ]
645
+ },
646
+ 'PUTAWAY': {
647
+ process: 'PUTAWAY',
648
+ allowedStages: ['PROCESSING', 'ALLOCATING', 'STORING'],
649
+ stageFlow: [
650
+ { from: 'PROCESSING', to: ['ALLOCATING'] },
651
+ { from: 'ALLOCATING', to: ['STORING'] },
652
+ { from: 'STORING', to: [] }
653
+ ]
654
+ },
655
+ 'INVENTORY_ADJUSTMENT': {
656
+ process: 'INVENTORY_ADJUSTMENT',
657
+ allowedStages: ['PROCESSING', 'INSPECTING', 'RECEIVING'],
658
+ stageFlow: [
659
+ { from: 'PROCESSING', to: ['INSPECTING'] },
660
+ { from: 'INSPECTING', to: ['RECEIVING'] },
661
+ { from: 'RECEIVING', to: [] }
662
+ ]
663
+ },
664
+ 'RETURN_PROCESSING': {
665
+ process: 'RETURN_PROCESSING',
666
+ allowedStages: ['UNLOADING', 'INSPECTING', 'PROCESSING', 'ALLOCATING', 'STORING'],
667
+ stageFlow: [
668
+ { from: 'UNLOADING', to: ['INSPECTING'] },
669
+ { from: 'INSPECTING', to: ['PROCESSING'] },
670
+ { from: 'PROCESSING', to: ['ALLOCATING', 'STORING'] },
671
+ { from: 'ALLOCATING', to: ['STORING'] },
672
+ { from: 'STORING', to: [] }
673
+ ]
674
+ },
675
+ 'EXCEPTION': {
676
+ process: 'EXCEPTION',
677
+ allowedStages: ['PROCESSING', 'INSPECTING'],
678
+ stageFlow: [
679
+ { from: 'PROCESSING', to: ['INSPECTING'] },
680
+ { from: 'INSPECTING', to: [] }
681
+ ]
682
+ }
683
+ },
684
+
685
+ // INTERNAL ORDER PROCESS-STAGE MAPS
686
+ 'InternalOrder': {
687
+ 'CYCLE_COUNT': {
688
+ process: 'CYCLE_COUNT',
689
+ allowedStages: ['PROCESSING', 'COUNTING', 'ADJUSTING'],
690
+ stageFlow: [
691
+ { from: 'PROCESSING', to: ['COUNTING'] },
692
+ { from: 'COUNTING', to: ['ADJUSTING'] },
693
+ { from: 'ADJUSTING', to: [] }
694
+ ]
695
+ },
696
+ 'REPLENISHMENT': {
697
+ process: 'REPLENISHMENT',
698
+ allowedStages: ['PROCESSING', 'MOVING'],
699
+ stageFlow: [
700
+ { from: 'PROCESSING', to: ['MOVING'] },
701
+ { from: 'MOVING', to: [] }
702
+ ]
703
+ },
704
+ 'RELOCATION': {
705
+ process: 'RELOCATION',
706
+ allowedStages: ['PROCESSING', 'MOVING'],
707
+ stageFlow: [
708
+ { from: 'PROCESSING', to: ['MOVING'] },
709
+ { from: 'MOVING', to: [] }
710
+ ]
711
+ },
712
+ 'CONSOLIDATION': {
713
+ process: 'CONSOLIDATION',
714
+ allowedStages: ['PROCESSING', 'CONSOLIDATING'],
715
+ stageFlow: [
716
+ { from: 'PROCESSING', to: ['CONSOLIDATING'] },
717
+ { from: 'CONSOLIDATING', to: [] }
718
+ ]
719
+ },
720
+ 'KITTING': {
721
+ process: 'KITTING',
722
+ allowedStages: ['PROCESSING', 'KITTING'],
723
+ stageFlow: [
724
+ { from: 'PROCESSING', to: ['KITTING'] },
725
+ { from: 'KITTING', to: [] }
726
+ ]
727
+ },
728
+ 'ASSEMBLY': {
729
+ process: 'ASSEMBLY',
730
+ allowedStages: ['PROCESSING', 'ASSEMBLING'],
731
+ stageFlow: [
732
+ { from: 'PROCESSING', to: ['ASSEMBLING'] },
733
+ { from: 'ASSEMBLING', to: [] }
734
+ ]
735
+ },
736
+ 'EXCEPTION': {
737
+ process: 'EXCEPTION',
738
+ allowedStages: ['PROCESSING', 'EXCEPTION_REVIEW'],
739
+ stageFlow: [
740
+ { from: 'PROCESSING', to: ['EXCEPTION_REVIEW'] },
741
+ { from: 'EXCEPTION_REVIEW', to: [] }
742
+ ]
743
+ }
744
+ },
745
+
746
+ // SHIPPING ORDER PROCESS-STAGE MAPS
747
+ 'ShippingOrder': {
748
+ 'COLLECTION': {
749
+ process: 'COLLECTION',
750
+ allowedStages: ['DISPATCHING', 'COLLECTING', 'CONFIRMING'],
751
+ stageFlow: [
752
+ { from: 'DISPATCHING', to: ['COLLECTING'] },
753
+ { from: 'COLLECTING', to: ['CONFIRMING'] },
754
+ { from: 'CONFIRMING', to: [] }
755
+ ]
756
+ },
757
+ 'LINEHAUL': {
758
+ process: 'LINEHAUL',
759
+ allowedStages: ['DISPATCHING', 'TRANSPORTING', 'TRANSFERRING'],
760
+ stageFlow: [
761
+ { from: 'DISPATCHING', to: ['TRANSPORTING'] },
762
+ { from: 'TRANSPORTING', to: ['TRANSFERRING'] },
763
+ { from: 'TRANSFERRING', to: [] }
764
+ ]
765
+ },
766
+ 'DELIVERY': {
767
+ process: 'DELIVERY',
768
+ allowedStages: ['DISPATCHING', 'TRANSPORTING', 'DELIVERING', 'CONFIRMING'],
769
+ stageFlow: [
770
+ { from: 'DISPATCHING', to: ['TRANSPORTING'] },
771
+ { from: 'TRANSPORTING', to: ['DELIVERING'] },
772
+ { from: 'DELIVERING', to: ['CONFIRMING'] },
773
+ { from: 'CONFIRMING', to: [] }
774
+ ]
775
+ },
776
+ 'TRANSFER': {
777
+ process: 'TRANSFER',
778
+ allowedStages: ['DISPATCHING', 'TRANSPORTING', 'TRANSFERRING'],
779
+ stageFlow: [
780
+ { from: 'DISPATCHING', to: ['TRANSPORTING'] },
781
+ { from: 'TRANSPORTING', to: ['TRANSFERRING'] },
782
+ { from: 'TRANSFERRING', to: [] }
783
+ ]
784
+ },
785
+ 'CONSOLIDATION': {
786
+ process: 'CONSOLIDATION',
787
+ allowedStages: ['SORTING', 'CONSOLIDATING'],
788
+ stageFlow: [
789
+ { from: 'SORTING', to: ['CONSOLIDATING'] },
790
+ { from: 'CONSOLIDATING', to: [] }
791
+ ]
792
+ },
793
+ 'CROSS_DOCK': {
794
+ process: 'CROSS_DOCK',
795
+ allowedStages: ['SORTING', 'TRANSFERRING'],
796
+ stageFlow: [
797
+ { from: 'SORTING', to: ['TRANSFERRING'] },
798
+ { from: 'TRANSFERRING', to: [] }
799
+ ]
800
+ },
801
+ 'CUSTOMS': {
802
+ process: 'CUSTOMS',
803
+ allowedStages: ['CLEARING'],
804
+ stageFlow: [
805
+ { from: 'CLEARING', to: [] }
806
+ ]
807
+ },
808
+ 'RETURN': {
809
+ process: 'RETURN',
810
+ allowedStages: ['COLLECTING', 'TRANSPORTING', 'RETURNING'],
811
+ stageFlow: [
812
+ { from: 'COLLECTING', to: ['TRANSPORTING'] },
813
+ { from: 'TRANSPORTING', to: ['RETURNING'] },
814
+ { from: 'RETURNING', to: [] }
815
+ ]
816
+ }
817
+ },
818
+
819
+ // PASSTHROUGH ORDER PROCESS-STAGE MAPS
820
+ 'PassthroughOrder': {
821
+ 'CROSS_DOCK': {
822
+ process: 'CROSS_DOCK',
823
+ allowedStages: ['ARRIVAL', 'RECEIVING', 'SORTING', 'STAGING', 'LOADING', 'DEPARTURE'],
824
+ stageFlow: [
825
+ { from: 'ARRIVAL', to: ['RECEIVING'] },
826
+ { from: 'RECEIVING', to: ['SORTING'] },
827
+ { from: 'SORTING', to: ['STAGING'] },
828
+ { from: 'STAGING', to: ['LOADING'] },
829
+ { from: 'LOADING', to: ['DEPARTURE'] },
830
+ { from: 'DEPARTURE', to: [] }
831
+ ]
832
+ },
833
+ 'CONSOLIDATION': {
834
+ process: 'CONSOLIDATION',
835
+ allowedStages: ['ARRIVAL', 'RECEIVING', 'INSPECTION', 'SORTING', 'CONSOLIDATING', 'STAGING', 'LOADING', 'DEPARTURE'],
836
+ stageFlow: [
837
+ { from: 'ARRIVAL', to: ['RECEIVING'] },
838
+ { from: 'RECEIVING', to: ['INSPECTION'] },
839
+ { from: 'INSPECTION', to: ['SORTING'] },
840
+ { from: 'SORTING', to: ['CONSOLIDATING'] },
841
+ { from: 'CONSOLIDATING', to: ['STAGING'] },
842
+ { from: 'STAGING', to: ['LOADING'] },
843
+ { from: 'LOADING', to: ['DEPARTURE'] },
844
+ { from: 'DEPARTURE', to: [] }
845
+ ]
846
+ },
847
+ 'DECONSOLIDATION': {
848
+ process: 'DECONSOLIDATION',
849
+ allowedStages: ['ARRIVAL', 'RECEIVING', 'DECONSOLIDATING', 'SORTING', 'STAGING', 'LOADING', 'DEPARTURE'],
850
+ stageFlow: [
851
+ { from: 'ARRIVAL', to: ['RECEIVING'] },
852
+ { from: 'RECEIVING', to: ['DECONSOLIDATING'] },
853
+ { from: 'DECONSOLIDATING', to: ['SORTING'] },
854
+ { from: 'SORTING', to: ['STAGING'] },
855
+ { from: 'STAGING', to: ['LOADING'] },
856
+ { from: 'LOADING', to: ['DEPARTURE'] },
857
+ { from: 'DEPARTURE', to: [] }
858
+ ]
859
+ },
860
+ 'TRANSFER': {
861
+ process: 'TRANSFER',
862
+ allowedStages: ['ARRIVAL', 'RECEIVING', 'PROCESSING', 'STAGING', 'LOADING', 'DEPARTURE'],
863
+ stageFlow: [
864
+ { from: 'ARRIVAL', to: ['RECEIVING'] },
865
+ { from: 'RECEIVING', to: ['PROCESSING'] },
866
+ { from: 'PROCESSING', to: ['STAGING'] },
867
+ { from: 'STAGING', to: ['LOADING'] },
868
+ { from: 'LOADING', to: ['DEPARTURE'] },
869
+ { from: 'DEPARTURE', to: [] }
870
+ ]
871
+ },
872
+ 'EXCEPTION': {
873
+ process: 'EXCEPTION',
874
+ allowedStages: ['PROCESSING', 'EXCEPTION_REVIEW', 'QUALITY_CHECK'],
875
+ stageFlow: [
876
+ { from: 'PROCESSING', to: ['EXCEPTION_REVIEW'] },
877
+ { from: 'EXCEPTION_REVIEW', to: ['QUALITY_CHECK'] },
878
+ { from: 'QUALITY_CHECK', to: [] }
879
+ ]
880
+ }
881
+ }
882
+ }
883
+
884
+ // Order Assignee Schema
885
+ export const OrderAssigneeSchema = Type.Object({
886
+ type: UserTypeSchema,
887
+ id: Type.String(),
888
+ name: Type.String(),
889
+ process: Type.String(),
890
+ assigned: ActionRecordSchema
891
+ })
892
+
893
+ // Exception handling
894
+ export const OrderExceptionSchema = Type.Object({
895
+ code: Type.String(),
896
+ type: Type.Union([
897
+ Type.Literal('DAMAGE'),
898
+ Type.Literal('MISSING_PACKAGE'),
899
+ Type.Literal('WRONG_DESTINATION'),
900
+ Type.Literal('SCANNING_ERROR'),
901
+ Type.Literal('ROUTING_ERROR'),
902
+ Type.Literal('DELAY'),
903
+ Type.Literal('CUSTOMS_HOLD'),
904
+ Type.Literal('SECURITY_HOLD')
905
+ ]),
906
+ severity: Type.Union([
907
+ Type.Literal('LOW'),
908
+ Type.Literal('MEDIUM'),
909
+ Type.Literal('HIGH'),
910
+ Type.Literal('CRITICAL')
911
+ ]),
912
+ description: Type.String({ maxLength: 1000 }),
913
+ reported: ActionRecordSchema,
914
+ resolved: ActionRecordSchema,
915
+ resolution: Type.Optional(Type.String({ maxLength: 1000 }))
916
+ })
917
+
918
+ // Order Consolidation & Deconsolidation information
919
+ export const ConsolidationTypeSchema = Type.Union([
920
+ Type.Literal('ROUTE_BASED'),
921
+ Type.Literal('DESTINATION_BASED'),
922
+ Type.Literal('SERVICE_BASED'),
923
+ Type.Literal('TIME_BASED')
924
+ ])
925
+ export const OrderConsolidationSchema = Type.Object({
926
+ batchId: Type.String(),
927
+ type: ConsolidationTypeSchema,
928
+ with: Type.Array(Type.String()),
929
+ info: Type.Optional(Type.Object({
930
+ containerId: Type.String(),
931
+ containerType: Type.String(),
932
+ loadSequence: Type.Number(),
933
+ totalPackages: Type.Number()
934
+ }))
935
+ })
936
+ export const OrderDeconsolidationSchema = Type.Object({
937
+ batchId: Type.String(),
938
+ type: ConsolidationTypeSchema,
939
+ with: Type.Array(Type.String()),
940
+ info: Type.Optional(Type.Object({
941
+ containerId: Type.String(),
942
+ containerType: Type.String(),
943
+ loadSequence: Type.Number(),
944
+ totalPackages: Type.Number()
945
+ }))
946
+ })
947
+
948
+ // Base Order Status Values (string constants for reuse)
949
+ export const BASE_ORDER_STATUSES = [
950
+ 'ACK',
951
+ 'NACK',
952
+ 'PENDING',
953
+ 'ON_HOLD',
954
+ 'ASSIGNED',
955
+ 'APPROVED',
956
+ 'SCHEDULED',
957
+ 'SUSPENDED',
958
+ 'CANCELLED',
959
+ 'IN_PROGRESS',
960
+ 'EXCEPTION',
961
+ 'COMPLETED',
962
+ 'FAILED'
963
+ ] as const
964
+
965
+ // Base Order Status Schema
966
+ export const BaseOrderStatusSchema = Type.Union([
967
+ Type.Literal('ACK'),
968
+ Type.Literal('NACK'),
969
+ Type.Literal('PENDING'),
970
+ Type.Literal('ON_HOLD'),
971
+ Type.Literal('ASSIGNED'),
972
+ Type.Literal('APPROVED'),
973
+ Type.Literal('SCHEDULED'),
974
+ Type.Literal('SUSPENDED'),
975
+ Type.Literal('CANCELLED'),
976
+ Type.Literal('IN_PROGRESS'),
977
+ Type.Literal('EXCEPTION'),
978
+ Type.Literal('COMPLETED'),
979
+ Type.Literal('FAILED')
980
+ ])
981
+ export const BaseOrderFlowPrioritySchema = Type.Union([
982
+ Type.Literal('LOW'),
983
+ Type.Literal('NORMAL'),
984
+ Type.Literal('HIGH'),
985
+ Type.Literal('URGENT'),
986
+ Type.Literal('CRITICAL')
987
+ ])
988
+
989
+ // Order Tracking Schema - Hierarchical tracking strategy
990
+ export const OrderTrackingSchema = Type.Object({
991
+ // Customer-facing master tracking number (shared across hierarchy)
992
+ masterTrackingNumber: Type.String(),
993
+
994
+ // Unique tracking number for this specific order
995
+ trackingNumber: Type.String(),
996
+
997
+ // External carrier tracking number (for shipping orders)
998
+ carrierTrackingNumber: Type.Optional(Type.String()),
999
+
1000
+ // Alternative tracking references (for integration with external systems)
1001
+ alternativeTrackingNumbers: Type.Optional(Type.Array(Type.Object({
1002
+ provider: Type.String(),
1003
+ trackingNumber: Type.String()
1004
+ })))
1005
+ })
1006
+
1007
+ // Order Routing schemas
1008
+ export const OrderRoutingModeSchema = Type.Union([
1009
+ Type.Literal('PIPELINE'),
1010
+ Type.Literal('MANUAL')
1011
+ ])
1012
+ export const OrderRoutingStrategySchema = Type.Union([
1013
+ Type.Literal('CHEAPEST'),
1014
+ Type.Literal('FASTEST'),
1015
+ Type.Literal('NEAREST'),
1016
+ Type.Literal('BALANCED')
1017
+ ])
1018
+ export const OrderRoutingConfigSchema = Type.Object({
1019
+ mode: OrderRoutingModeSchema,
1020
+ handler: Type.Union([GenericServiceContextSchema, PipelineContextSchema]),
1021
+ strategy: Type.Optional(OrderRoutingStrategySchema)
1022
+ })
1023
+ export const OrderNoteSchema = Type.Object({
1024
+ content: Type.String({ maxLength: 1000 }),
1025
+ created: ActionRecordSchema
1026
+ })
1027
+
1028
+ // Order client schemas
1029
+ export const OrderClientRelationshipSchema = Type.Union([
1030
+ Type.Literal('C2B'),
1031
+ Type.Literal('B2B'),
1032
+ Type.Literal('B2C')
1033
+ ])
1034
+ export const OrderProfileClientSchema = Type.Object({
1035
+ relationship: OrderClientRelationshipSchema,
1036
+ mode: Type.Literal('PROFILE'),
1037
+ dprofile: DProfileReferenceSchema
1038
+ })
1039
+ export const OrderInlineClientSchema = Type.Object({
1040
+ relationship: OrderClientRelationshipSchema,
1041
+ mode: Type.Literal('INLINE'),
1042
+ id: Type.String(),
1043
+ // Contact and address information
1044
+ contacts: Type.Optional(ContactsSchema),
1045
+ address: Type.Optional(AddressSchema)
1046
+ })
1047
+ export const OrderClientSchema = Type.Union([
1048
+ OrderInlineClientSchema,
1049
+ OrderProfileClientSchema
1050
+ ], { discriminator: { propertyName: 'mode' } })
1051
+
1052
+ // Base Order Schema
1053
+ export const BaseOrderSchema = Type.Object({
1054
+ cid: Type.String({ description: 'Connector that created this order' }),
1055
+ reference: Type.String(),
1056
+ tracking: OrderTrackingSchema, // Hierarchical tracking information
1057
+ intentToken: Type.String(),
1058
+ // Context creator of this order
1059
+ context: ContextSchema,
1060
+
1061
+ // Order Hierarchy (Parent-Child Relationships)
1062
+ hierarchy: OrderHierarchySchema,
1063
+
1064
+ // Routing
1065
+ routing: OrderRoutingConfigSchema,
1066
+
1067
+ /**
1068
+ * Pipeline Execution State
1069
+ *
1070
+ * Only present on root orders. Tracks progress through pipeline stages.
1071
+ * Pipeline template version is locked at order creation time to prevent
1072
+ * mid-flight changes from affecting in-progress orders.
1073
+ */
1074
+ pipelineExecution: Type.Optional(PipelineExecutionSchema),
1075
+
1076
+ // Operation details (fees, payment, rating)
1077
+ operation: OrderOperationSchema,
1078
+
1079
+ // Assigned agents/workers
1080
+ assignees: Type.Optional(Type.Array(OrderAssigneeSchema)),
1081
+
1082
+ // Order characteristics
1083
+ priority: OrderPrioritySchema,
1084
+ requirements: Type.Optional(Type.Array(OrderRequirementSchema)),
1085
+ schedule: Type.Optional(DateTimeScheduleSchema),
1086
+
1087
+ // Exception tracking
1088
+ exceptions: Type.Optional(Type.Array(OrderExceptionSchema)),
1089
+
1090
+ /**
1091
+ * Client identifier for customer-facing services
1092
+ * Present when customer directly books CSP/LSP service (delivery, ride, warehouse, etc.)
1093
+ * Absent for internal operations orders
1094
+ */
1095
+ client: Type.Optional(OrderClientSchema),
1096
+ sla: Type.Optional(Type.Object({
1097
+ deadline: DateTimeZoneSchema
1098
+ })),
1099
+
1100
+ // Additional metadata
1101
+ notes: Type.Optional(Type.Array(OrderNoteSchema)),
1102
+ tags: Type.Optional(Type.Array(Type.String())),
1103
+ metadata: Type.Optional(Type.Record(Type.String(), Type.Any())),
1104
+
1105
+ // Lock order from modifications
1106
+ locked: Type.Optional(Type.Boolean()),
1107
+
1108
+ created: ActionRecordSchema,
1109
+ updated: Type.Optional(ActionRecordSchema)
1110
+ })
1111
+
1112
+ // Ride Order Schemas
1113
+ export const RideOrderTypeSchema = Type.Union([
1114
+ Type.Literal('SHORT-MILE'),
1115
+ Type.Literal('LONG-MILE')
1116
+ ])
1117
+
1118
+ export const RideBaseOrderSchema = Type.Intersect([
1119
+ BaseOrderSchema,
1120
+ Type.Object({
1121
+ type: RideOrderTypeSchema
1122
+ // passengers: Type.Array(OrderPassengerSchema), // Uncomment when available
1123
+ // luggages: Type.Array(OrderLuggageSchema), // Uncomment when available
1124
+ })
1125
+ ])
1126
+
1127
+ export const LSPBaseOrderSchema = Type.Intersect([
1128
+ BaseOrderSchema,
1129
+ Type.Object({
1130
+ type: LSPOrderTypeSchema,
1131
+ items: Type.Array(OrderItemSchema),
1132
+ packages: Type.Object({
1133
+ totalWeight: Type.Optional(WeightSchema),
1134
+ totalVolume: Type.Optional(VolumeSchema),
1135
+ list: Type.Array(OrderPackageSchema)
1136
+ }),
1137
+ consolidations: Type.Optional(Type.Array(OrderConsolidationSchema)),
1138
+ deconsolidations: Type.Optional(Type.Array(OrderDeconsolidationSchema))
1139
+ })
1140
+ ])
1141
+
1142
+ // Generate TypeScript types from schemas
1143
+ export type OrderPriority = Static<typeof OrderPrioritySchema>
1144
+ export type OrderItemStatus = Static<typeof OrderItemStatusSchema>
1145
+ export type OrderItem = Static<typeof OrderItemSchema>
1146
+ export type OrderPackageType = Static<typeof OrderPackageTypeSchema>
1147
+ export type OrderPackageCategory = Static<typeof OrderPackageCategorySchema>
1148
+ export type OrderPackageItem = Static<typeof OrderPackageItemSchema>
1149
+ export type OrderPackage = Static<typeof OrderPackageSchema>
1150
+ export type OrderOperation = Static<typeof OrderOperationSchema>
1151
+ export type OrderIntent = Static<typeof OrderIntentSchema>
1152
+ export type OrderTracking = Static<typeof OrderTrackingSchema>
1153
+ export type OrderRoutingMode = Static<typeof OrderRoutingModeSchema>
1154
+ export type OrderRoutingStrategy = Static<typeof OrderRoutingStrategySchema>
1155
+ export type OrderRoutingConfig = Static<typeof OrderRoutingConfigSchema>
1156
+ export type GenericOrderProcessor = Static<typeof GenericOrderProcessorSchema>
1157
+ export type OrderNote = Static<typeof OrderNoteSchema>
1158
+ export type OrderClientRelationship = Static<typeof OrderClientRelationshipSchema>
1159
+ export type OrderProfileClient = Static<typeof OrderProfileClientSchema>
1160
+ export type OrderInlineClient = Static<typeof OrderInlineClientSchema>
1161
+ export type OrderClient = Static<typeof OrderClientSchema>
1162
+ export type OrderHierarchy = Static<typeof OrderHierarchySchema>
1163
+ export type OrderLifecyclePolicy = Static<typeof OrderLifecyclePolicySchema>
1164
+ export type OrderAssignee = Static<typeof OrderAssigneeSchema>
1165
+ export type OrderException = Static<typeof OrderExceptionSchema>
1166
+ export type BaseOrderStatus = Static<typeof BaseOrderStatusSchema>
1167
+ export type BaseOrderFlowPriority = Static<typeof BaseOrderFlowPrioritySchema>
1168
+ export type BaseOrder = Static<typeof BaseOrderSchema>
1169
+
1170
+ // Composition metadata types
1171
+ export type CompositionReason = Static<typeof CompositionReasonSchema>
1172
+ export type RelationshipType = Static<typeof RelationshipTypeSchema>
1173
+ export type ParentStateAtCreation = Static<typeof ParentStateAtCreationSchema>
1174
+ export type ChildOrderRelationship = Static<typeof ChildOrderRelationshipSchema>
1175
+ export type CompositionMetadata = Static<typeof CompositionMetadataSchema>
1176
+
1177
+ export type RideOrderType = Static<typeof RideOrderTypeSchema>
1178
+ export type RideBaseOrder = Static<typeof RideBaseOrderSchema>
1179
+ export type LSPBaseOrder = Static<typeof LSPBaseOrderSchema>
1180
+
1181
+
1182
+ // Utility schemas for order operations
1183
+ export const OrderSearchSchema = Type.Object({
1184
+ status: Type.Optional(Type.Array(BaseOrderStatusSchema)),
1185
+ priority: Type.Optional(OrderPrioritySchema),
1186
+ dateRange: Type.Optional(DateTimeRangeSchema),
1187
+ processor: Type.Optional(Type.String()),
1188
+ assigneeId: Type.Optional(Type.String()),
1189
+ tags: Type.Optional(Type.Array(Type.String())),
1190
+ limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100 })),
1191
+ offset: Type.Optional(Type.Number({ minimum: 0 }))
1192
+ })
1193
+
1194
+ export const OrderStatsSchema = Type.Object({
1195
+ total: Type.Number(),
1196
+ byStatus: Type.Record(BaseOrderStatusSchema, Type.Number()),
1197
+ byPriority: Type.Record(OrderPrioritySchema, Type.Number()),
1198
+ byType: Type.Object({
1199
+ shipping: Type.Number(),
1200
+ ride: Type.Number()
1201
+ }),
1202
+ avgProcessingTime: Type.Number(), // minutes
1203
+ onTimeDelivery: Type.Number({ minimum: 0, maximum: 100 }) // percentage
1204
+ })
1205
+
1206
+ export type OrderSearch = Static<typeof OrderSearchSchema>
1207
+ export type OrderStats = Static<typeof OrderStatsSchema>