@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.
- package/dist/allend/Access.d.ts +39 -3
- package/dist/allend/Access.js +147 -114
- package/dist/allend/Access.js.map +1 -1
- package/dist/allend/Agent/consolidation.d.ts +16 -0
- package/dist/allend/Agent/consolidation.js +38 -0
- package/dist/allend/Agent/consolidation.js.map +1 -0
- package/dist/allend/Agent/delivery.d.ts +11 -0
- package/dist/allend/Agent/delivery.js +43 -0
- package/dist/allend/Agent/delivery.js.map +1 -0
- package/dist/allend/Agent/dispatch.d.ts +8 -0
- package/dist/allend/Agent/dispatch.js +24 -0
- package/dist/allend/Agent/dispatch.js.map +1 -0
- package/dist/allend/Agent/index.d.ts +49 -0
- package/dist/allend/Agent/index.js +74 -0
- package/dist/allend/Agent/index.js.map +1 -0
- package/dist/allend/Agent/navigation.d.ts +8 -0
- package/dist/allend/Agent/navigation.js +25 -0
- package/dist/allend/Agent/navigation.js.map +1 -0
- package/dist/allend/Agent/origin.d.ts +9 -0
- package/dist/allend/Agent/origin.js +31 -0
- package/dist/allend/Agent/origin.js.map +1 -0
- package/dist/allend/Agent/reallocation.d.ts +7 -0
- package/dist/allend/Agent/reallocation.js +17 -0
- package/dist/allend/Agent/reallocation.js.map +1 -0
- package/dist/allend/Agent/realtime.d.ts +36 -0
- package/dist/allend/Agent/realtime.js +111 -0
- package/dist/allend/Agent/realtime.js.map +1 -0
- package/dist/allend/Agent/rides.d.ts +12 -0
- package/dist/allend/Agent/rides.js +51 -0
- package/dist/allend/Agent/rides.js.map +1 -0
- package/dist/allend/Agent/shipping.d.ts +11 -0
- package/dist/allend/Agent/shipping.js +43 -0
- package/dist/allend/Agent/shipping.js.map +1 -0
- package/dist/allend/CSP/analytics.d.ts +12 -0
- package/dist/allend/CSP/analytics.js +51 -0
- package/dist/allend/CSP/analytics.js.map +1 -0
- package/dist/allend/CSP/index.d.ts +25 -0
- package/dist/allend/CSP/index.js +43 -0
- package/dist/allend/CSP/index.js.map +1 -0
- package/dist/allend/CSP/inventory.d.ts +16 -0
- package/dist/allend/CSP/inventory.js +78 -0
- package/dist/allend/CSP/inventory.js.map +1 -0
- package/dist/allend/CSP/orders.d.ts +19 -0
- package/dist/allend/CSP/orders.js +97 -0
- package/dist/allend/CSP/orders.js.map +1 -0
- package/dist/allend/CSP/webhooks.d.ts +13 -0
- package/dist/allend/CSP/webhooks.js +56 -0
- package/dist/allend/CSP/webhooks.js.map +1 -0
- package/dist/allend/Customer/index.d.ts +27 -0
- package/dist/allend/Customer/index.js +39 -0
- package/dist/allend/Customer/index.js.map +1 -0
- package/dist/allend/Customer/intents.d.ts +12 -0
- package/dist/allend/Customer/intents.js +55 -0
- package/dist/allend/Customer/intents.js.map +1 -0
- package/dist/allend/Customer/orders.d.ts +11 -0
- package/dist/allend/Customer/orders.js +43 -0
- package/dist/allend/Customer/orders.js.map +1 -0
- package/dist/allend/Customer/rides.d.ts +12 -0
- package/dist/allend/Customer/rides.js +50 -0
- package/dist/allend/Customer/rides.js.map +1 -0
- package/dist/allend/DEV/developers.d.ts +11 -0
- package/dist/allend/DEV/developers.js +35 -0
- package/dist/allend/DEV/developers.js.map +1 -0
- package/dist/allend/DEV/index.d.ts +19 -0
- package/dist/allend/DEV/index.js +37 -0
- package/dist/allend/DEV/index.js.map +1 -0
- package/dist/allend/IoTClient.js +29 -35
- package/dist/allend/IoTClient.js.map +1 -1
- package/dist/allend/IoTSP/backend.d.ts +29 -0
- package/dist/allend/IoTSP/backend.js +75 -0
- package/dist/allend/IoTSP/backend.js.map +1 -0
- package/dist/allend/IoTSP/devices.d.ts +14 -0
- package/dist/allend/IoTSP/devices.js +61 -0
- package/dist/allend/IoTSP/devices.js.map +1 -0
- package/dist/allend/IoTSP/index.d.ts +28 -0
- package/dist/allend/IoTSP/index.js +84 -0
- package/dist/allend/IoTSP/index.js.map +1 -0
- package/dist/allend/IoTSP/rules.d.ts +17 -0
- package/dist/allend/IoTSP/rules.js +81 -0
- package/dist/allend/IoTSP/rules.js.map +1 -0
- package/dist/allend/IoTSP/topics.d.ts +17 -0
- package/dist/allend/IoTSP/topics.js +81 -0
- package/dist/allend/IoTSP/topics.js.map +1 -0
- package/dist/allend/LSP/agents.d.ts +20 -0
- package/dist/allend/LSP/agents.js +89 -0
- package/dist/allend/LSP/agents.js.map +1 -0
- package/dist/allend/LSP/carriers.d.ts +54 -0
- package/dist/allend/LSP/carriers.js +315 -0
- package/dist/allend/LSP/carriers.js.map +1 -0
- package/dist/allend/LSP/coverage.d.ts +44 -0
- package/dist/allend/LSP/coverage.js +135 -0
- package/dist/allend/LSP/coverage.js.map +1 -0
- package/dist/allend/LSP/fleets.d.ts +66 -0
- package/dist/allend/LSP/fleets.js +381 -0
- package/dist/allend/LSP/fleets.js.map +1 -0
- package/dist/allend/LSP/hubs.d.ts +39 -0
- package/dist/allend/LSP/hubs.js +186 -0
- package/dist/allend/LSP/hubs.js.map +1 -0
- package/dist/allend/LSP/index.d.ts +37 -0
- package/dist/allend/LSP/index.js +55 -0
- package/dist/allend/LSP/index.js.map +1 -0
- package/dist/allend/LSP/inventory.d.ts +13 -0
- package/dist/allend/LSP/inventory.js +56 -0
- package/dist/allend/LSP/inventory.js.map +1 -0
- package/dist/allend/LSP/operations.d.ts +47 -0
- package/dist/allend/LSP/operations.js +156 -0
- package/dist/allend/LSP/operations.js.map +1 -0
- package/dist/allend/LSP/orders.d.ts +69 -0
- package/dist/allend/LSP/orders.js +303 -0
- package/dist/allend/LSP/orders.js.map +1 -0
- package/dist/allend/LSP/pods.d.ts +26 -0
- package/dist/allend/LSP/pods.js +137 -0
- package/dist/allend/LSP/pods.js.map +1 -0
- package/dist/allend/LSP/pricing.d.ts +35 -0
- package/dist/allend/LSP/pricing.js +151 -0
- package/dist/allend/LSP/pricing.js.map +1 -0
- package/dist/allend/LSP/psl.d.ts +15 -0
- package/dist/allend/LSP/psl.js +68 -0
- package/dist/allend/LSP/psl.js.map +1 -0
- package/dist/allend/LSP/warehouses.d.ts +23 -0
- package/dist/allend/LSP/warehouses.js +94 -0
- package/dist/allend/LSP/warehouses.js.map +1 -0
- package/dist/allend/MSI/Controls.d.ts +9 -5
- package/dist/allend/MSI/Controls.js +269 -297
- package/dist/allend/MSI/Controls.js.map +1 -1
- package/dist/allend/MSI/Handles.d.ts +5 -4
- package/dist/allend/MSI/Handles.js +136 -233
- package/dist/allend/MSI/Handles.js.map +1 -1
- package/dist/allend/MSI/Plugins.d.ts +2 -2
- package/dist/allend/MSI/Plugins.js +12 -15
- package/dist/allend/MSI/Plugins.js.map +1 -1
- package/dist/allend/MSI/index.d.ts +4 -3
- package/dist/allend/MSI/index.js +123 -87
- package/dist/allend/MSI/index.js.map +1 -1
- package/dist/allend/MSI/native.d.ts +32 -0
- package/dist/allend/MSI/native.js +246 -0
- package/dist/allend/MSI/native.js.map +1 -0
- package/dist/allend/MSI/token.d.ts +12 -0
- package/dist/allend/MSI/token.js +21 -0
- package/dist/allend/MSI/token.js.map +1 -0
- package/dist/allend/OTPAuth/index.d.ts +77 -0
- package/dist/allend/OTPAuth/index.js +69 -0
- package/dist/allend/OTPAuth/index.js.map +1 -0
- package/dist/allend/Pipelines/analytics.d.ts +8 -0
- package/dist/allend/Pipelines/analytics.js +24 -0
- package/dist/allend/Pipelines/analytics.js.map +1 -0
- package/dist/allend/Pipelines/escalations.d.ts +8 -0
- package/dist/allend/Pipelines/escalations.js +25 -0
- package/dist/allend/Pipelines/escalations.js.map +1 -0
- package/dist/allend/Pipelines/executions.d.ts +11 -0
- package/dist/allend/Pipelines/executions.js +44 -0
- package/dist/allend/Pipelines/executions.js.map +1 -0
- package/dist/allend/Pipelines/index.d.ts +42 -0
- package/dist/allend/Pipelines/index.js +88 -0
- package/dist/allend/Pipelines/index.js.map +1 -0
- package/dist/allend/Pipelines/interventions.d.ts +8 -0
- package/dist/allend/Pipelines/interventions.js +25 -0
- package/dist/allend/Pipelines/interventions.js.map +1 -0
- package/dist/allend/Pipelines/monitor.d.ts +9 -0
- package/dist/allend/Pipelines/monitor.js +30 -0
- package/dist/allend/Pipelines/monitor.js.map +1 -0
- package/dist/allend/Pipelines/queries.d.ts +8 -0
- package/dist/allend/Pipelines/queries.js +25 -0
- package/dist/allend/Pipelines/queries.js.map +1 -0
- package/dist/allend/Pipelines/templates.d.ts +11 -0
- package/dist/allend/Pipelines/templates.js +46 -0
- package/dist/allend/Pipelines/templates.js.map +1 -0
- package/dist/allend/Pipelines/utils.d.ts +0 -0
- package/dist/allend/Pipelines/utils.js +2 -0
- package/dist/allend/Pipelines/utils.js.map +1 -0
- package/dist/allend/Pipelines/webhooks.d.ts +9 -0
- package/dist/allend/Pipelines/webhooks.js +35 -0
- package/dist/allend/Pipelines/webhooks.js.map +1 -0
- package/dist/allend/Pipelines/workers.d.ts +11 -0
- package/dist/allend/Pipelines/workers.js +45 -0
- package/dist/allend/Pipelines/workers.js.map +1 -0
- package/dist/allend/Queries/capacity.d.ts +11 -0
- package/dist/allend/Queries/capacity.js +44 -0
- package/dist/allend/Queries/capacity.js.map +1 -0
- package/dist/allend/Queries/discovery.d.ts +11 -0
- package/dist/allend/Queries/discovery.js +45 -0
- package/dist/allend/Queries/discovery.js.map +1 -0
- package/dist/allend/Queries/index.d.ts +27 -0
- package/dist/allend/Queries/index.js +40 -0
- package/dist/allend/Queries/index.js.map +1 -0
- package/dist/allend/Queries/matching.d.ts +7 -0
- package/dist/allend/Queries/matching.js +18 -0
- package/dist/allend/Queries/matching.js.map +1 -0
- package/dist/allend/Queries/performance.d.ts +9 -0
- package/dist/allend/Queries/performance.js +31 -0
- package/dist/allend/Queries/performance.js.map +1 -0
- package/dist/allend/Queries/pricing.d.ts +11 -0
- package/dist/allend/Queries/pricing.js +43 -0
- package/dist/allend/Queries/pricing.js.map +1 -0
- package/dist/allend/{DClient/Event.d.ts → Realtime/index.d.ts} +2 -6
- package/dist/allend/Realtime/index.js +62 -0
- package/dist/allend/Realtime/index.js.map +1 -0
- package/dist/allend/Shared/account.d.ts +10 -0
- package/dist/allend/Shared/account.js +22 -0
- package/dist/allend/Shared/account.js.map +1 -0
- package/dist/allend/Shared/buckets.d.ts +21 -0
- package/dist/allend/Shared/buckets.js +95 -0
- package/dist/allend/Shared/buckets.js.map +1 -0
- package/dist/allend/Shared/context.d.ts +14 -0
- package/dist/allend/Shared/context.js +33 -0
- package/dist/allend/Shared/context.js.map +1 -0
- package/dist/allend/Shared/faqs.d.ts +20 -0
- package/dist/allend/Shared/faqs.js +87 -0
- package/dist/allend/Shared/faqs.js.map +1 -0
- package/dist/allend/Shared/invitation.d.ts +42 -0
- package/dist/allend/Shared/invitation.js +40 -0
- package/dist/allend/Shared/invitation.js.map +1 -0
- package/dist/allend/Shared/operators.d.ts +39 -0
- package/dist/allend/Shared/operators.js +37 -0
- package/dist/allend/Shared/operators.js.map +1 -0
- package/dist/allend/Shared/users.d.ts +11 -0
- package/dist/allend/Shared/users.js +29 -0
- package/dist/allend/Shared/users.js.map +1 -0
- package/dist/allend/Tracking/index.d.ts +17 -0
- package/dist/allend/Tracking/index.js +39 -0
- package/dist/allend/Tracking/index.js.map +1 -0
- package/dist/allend/Utilities/common.d.ts +12 -0
- package/dist/allend/Utilities/common.js +53 -0
- package/dist/allend/Utilities/common.js.map +1 -0
- package/dist/allend/Utilities/fares.d.ts +10 -0
- package/dist/allend/Utilities/fares.js +39 -0
- package/dist/allend/Utilities/fares.js.map +1 -0
- package/dist/allend/Utilities/index.d.ts +23 -0
- package/dist/allend/Utilities/index.js +36 -0
- package/dist/allend/Utilities/index.js.map +1 -0
- package/dist/allend/Utilities/nearby.d.ts +9 -0
- package/dist/allend/Utilities/nearby.js +32 -0
- package/dist/allend/Utilities/nearby.js.map +1 -0
- package/dist/allend/Workflows/Client.d.ts +17 -0
- package/dist/allend/Workflows/Client.js +50 -0
- package/dist/allend/Workflows/Client.js.map +1 -0
- package/dist/allend/Workflows/Delivery.d.ts +36 -0
- package/dist/allend/Workflows/Delivery.js +16 -0
- package/dist/allend/Workflows/Delivery.js.map +1 -0
- package/dist/allend/Workflows/index.d.ts +11 -0
- package/dist/allend/Workflows/index.js +25 -0
- package/dist/allend/Workflows/index.js.map +1 -0
- package/dist/allend/Workspace/index.d.ts +162 -0
- package/dist/allend/Workspace/index.js +220 -0
- package/dist/allend/Workspace/index.js.map +1 -0
- package/dist/allend/index.d.ts +8 -5
- package/dist/allend/index.js +15 -8
- package/dist/allend/index.js.map +1 -1
- package/dist/backend/Auth.d.ts +28 -4
- package/dist/backend/Auth.js +125 -245
- package/dist/backend/Auth.js.map +1 -1
- package/dist/baseUrl.d.ts +56 -0
- package/dist/baseUrl.js +72 -4
- package/dist/baseUrl.js.map +1 -1
- package/dist/core.d.ts +88 -0
- package/dist/core.js +121 -0
- package/dist/core.js.map +1 -0
- package/dist/error.d.ts +17 -0
- package/dist/error.js +26 -0
- package/dist/error.js.map +1 -0
- package/dist/index.d.ts +30 -12
- package/dist/index.js +38 -14
- package/dist/index.js.map +1 -1
- package/dist/react-native.d.ts +30 -0
- package/dist/react-native.js +55 -0
- package/dist/react-native.js.map +1 -0
- package/dist/types/access.d.ts +64 -7
- package/dist/types/auth.d.ts +17 -17
- package/dist/types/channel.d.ts +45 -0
- package/dist/types/index.d.ts +379 -237
- package/dist/utils/index.d.ts +25 -0
- package/dist/utils/index.js +11 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/stream.js +25 -26
- package/dist/utils/stream.js.map +1 -1
- package/package.json +38 -18
- package/src/allend/Access.ts +143 -13
- package/src/allend/Agent/consolidation.ts +43 -0
- package/src/allend/Agent/delivery.ts +51 -0
- package/src/allend/Agent/dispatch.ts +27 -0
- package/src/allend/Agent/index.ts +113 -0
- package/src/allend/Agent/navigation.ts +27 -0
- package/src/allend/Agent/origin.ts +36 -0
- package/src/allend/Agent/reallocation.ts +16 -0
- package/src/allend/Agent/realtime.ts +140 -0
- package/src/allend/Agent/rides.ts +61 -0
- package/src/allend/Agent/shipping.ts +51 -0
- package/src/allend/CSP/analytics.ts +61 -0
- package/src/allend/CSP/index.ts +57 -0
- package/src/allend/CSP/inventory.ts +96 -0
- package/src/allend/CSP/orders.ts +121 -0
- package/src/allend/CSP/webhooks.ts +68 -0
- package/src/allend/Customer/index.ts +56 -0
- package/src/allend/Customer/intents.ts +66 -0
- package/src/allend/Customer/orders.ts +51 -0
- package/src/allend/Customer/rides.ts +60 -0
- package/src/allend/DEV/developers.ts +42 -0
- package/src/allend/DEV/index.ts +48 -0
- package/src/allend/IoTSP/backend.ts +103 -0
- package/src/allend/IoTSP/devices.ts +74 -0
- package/src/allend/IoTSP/index.ts +69 -0
- package/src/allend/IoTSP/rules.ts +99 -0
- package/src/allend/IoTSP/topics.ts +99 -0
- package/src/allend/LSP/agents.ts +115 -0
- package/src/allend/LSP/carriers.ts +408 -0
- package/src/allend/LSP/coverage.ts +212 -0
- package/src/allend/LSP/fleets.ts +505 -0
- package/src/allend/LSP/hubs.ts +245 -0
- package/src/allend/LSP/index.ts +75 -0
- package/src/allend/LSP/inventory.ts +65 -0
- package/src/allend/LSP/operations.ts +202 -0
- package/src/allend/LSP/orders.ts +397 -0
- package/src/allend/LSP/pods.ts +176 -0
- package/src/allend/LSP/pricing.ts +192 -0
- package/src/allend/LSP/psl.ts +81 -0
- package/src/allend/LSP/warehouses.ts +118 -0
- package/src/allend/MSI/Controls.ts +109 -90
- package/src/allend/MSI/Handles.ts +24 -15
- package/src/allend/MSI/Plugins.ts +3 -3
- package/src/allend/MSI/index.ts +85 -16
- package/src/allend/MSI/native.tsx +314 -0
- package/src/allend/MSI/token.ts +20 -0
- package/src/allend/OTPAuth/index.ts +130 -0
- package/src/allend/Pipelines/analytics.ts +25 -0
- package/src/allend/Pipelines/escalations.ts +26 -0
- package/src/allend/Pipelines/executions.ts +51 -0
- package/src/allend/Pipelines/index.ts +125 -0
- package/src/allend/Pipelines/interventions.ts +27 -0
- package/src/allend/Pipelines/monitor.ts +33 -0
- package/src/allend/Pipelines/queries.ts +27 -0
- package/src/allend/Pipelines/templates.ts +51 -0
- package/src/allend/Pipelines/utils.ts +0 -0
- package/src/allend/Pipelines/webhooks.ts +36 -0
- package/src/allend/Pipelines/workers.ts +49 -0
- package/src/allend/Queries/capacity.ts +51 -0
- package/src/allend/Queries/discovery.ts +53 -0
- package/src/allend/Queries/index.ts +58 -0
- package/src/allend/Queries/matching.ts +16 -0
- package/src/allend/Queries/performance.ts +35 -0
- package/src/allend/Queries/pricing.ts +51 -0
- package/src/allend/{DClient/Event.ts → Realtime/index.ts} +23 -22
- package/src/allend/Shared/account.ts +24 -0
- package/src/allend/Shared/buckets.ts +117 -0
- package/src/allend/Shared/context.ts +36 -0
- package/src/allend/Shared/faqs.ts +106 -0
- package/src/allend/Shared/invitation.ts +77 -0
- package/src/allend/Shared/operators.ts +84 -0
- package/src/allend/Shared/users.ts +32 -0
- package/src/allend/Tracking/index.ts +48 -0
- package/src/allend/Utilities/common.ts +63 -0
- package/src/allend/Utilities/fares.ts +45 -0
- package/src/allend/Utilities/index.ts +52 -0
- package/src/allend/Utilities/nearby.ts +36 -0
- package/src/allend/{DClient → Workflows}/Client.ts +12 -22
- package/src/allend/Workflows/Delivery.ts +94 -0
- package/src/allend/Workflows/index.ts +31 -0
- package/src/allend/Workspace/index.ts +302 -0
- package/src/allend/index.ts +23 -10
- package/src/backend/Auth.ts +68 -35
- package/src/baseUrl.ts +81 -7
- package/src/core.ts +145 -0
- package/src/error.ts +27 -0
- package/src/index.ts +25 -17
- package/src/react-native.ts +43 -0
- package/src/types/access.d.ts +64 -7
- package/src/types/auth.d.ts +17 -17
- package/src/types/channel.d.ts +45 -0
- package/src/types/index.d.ts +379 -237
- package/src/utils/index.ts +33 -1
- package/dist/allend/DAuth/index.d.ts +0 -20
- package/dist/allend/DAuth/index.js +0 -92
- package/dist/allend/DAuth/index.js.map +0 -1
- package/dist/allend/DClient/Client.d.ts +0 -10
- package/dist/allend/DClient/Client.js +0 -144
- package/dist/allend/DClient/Client.js.map +0 -1
- package/dist/allend/DClient/Event.js +0 -100
- package/dist/allend/DClient/Event.js.map +0 -1
- package/dist/allend/DClient/Order.d.ts +0 -49
- package/dist/allend/DClient/Order.js +0 -601
- package/dist/allend/DClient/Order.js.map +0 -1
- package/dist/bundle.js +0 -1
- package/src/allend/DAuth/index.ts +0 -39
- package/src/allend/DClient/Order.ts +0 -452
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UtilDistanceValidation,
|
|
3
|
+
UtilBatchDistanceMatrixValidation,
|
|
4
|
+
UtilSavingsMatrixValidation,
|
|
5
|
+
UtilAssignZoneValidation,
|
|
6
|
+
UtilETAValidation,
|
|
7
|
+
UtilBatchGeocodeValidation
|
|
8
|
+
} from '@de./types'
|
|
9
|
+
import { type Http, type Res, type Data } from '../../utils'
|
|
10
|
+
|
|
11
|
+
// ─── Common Utilities ─────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
export class UtilitiesCommon {
|
|
14
|
+
constructor( private http: Http ){}
|
|
15
|
+
|
|
16
|
+
async distance( body: UtilDistanceValidation['body'] ): Promise<UtilDistanceValidation['response']> {
|
|
17
|
+
return await this.http.request<UtilDistanceValidation['response']>({
|
|
18
|
+
url: '/utilities/distance',
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async distanceMatrix( body: UtilBatchDistanceMatrixValidation['body'] ): Promise<UtilBatchDistanceMatrixValidation['response']> {
|
|
25
|
+
return await this.http.request<UtilBatchDistanceMatrixValidation['response']>({
|
|
26
|
+
url: '/utilities/distance/matrix',
|
|
27
|
+
method: 'POST',
|
|
28
|
+
body
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async savingsMatrix( body: UtilSavingsMatrixValidation['body'] ): Promise<UtilSavingsMatrixValidation['response']> {
|
|
33
|
+
return await this.http.request<UtilSavingsMatrixValidation['response']>({
|
|
34
|
+
url: '/utilities/distance/savings',
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async assignZone( body: UtilAssignZoneValidation['body'] ): Promise<UtilAssignZoneValidation['response']> {
|
|
41
|
+
return await this.http.request<UtilAssignZoneValidation['response']>({
|
|
42
|
+
url: '/utilities/zone',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
body
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async eta( body: UtilETAValidation['body'] ): Promise<UtilETAValidation['response']> {
|
|
49
|
+
return await this.http.request<UtilETAValidation['response']>({
|
|
50
|
+
url: '/utilities/eta',
|
|
51
|
+
method: 'POST',
|
|
52
|
+
body
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async batchGeocode( body: UtilBatchGeocodeValidation['body'] ): Promise<UtilBatchGeocodeValidation['response']> {
|
|
57
|
+
return await this.http.request<UtilBatchGeocodeValidation['response']>({
|
|
58
|
+
url: '/utilities/geocode/batch',
|
|
59
|
+
method: 'POST',
|
|
60
|
+
body
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UtilDeliveryFeesValidation,
|
|
3
|
+
UtilTransportFareValidation,
|
|
4
|
+
UtilRideFareValidation,
|
|
5
|
+
UtilCrossBorderFareValidation
|
|
6
|
+
} from '@de./types'
|
|
7
|
+
import { type Http, type Res, type Data } from '../../utils'
|
|
8
|
+
|
|
9
|
+
// ─── Fares ────────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
export class UtilitiesFares {
|
|
12
|
+
constructor( private http: Http ){}
|
|
13
|
+
|
|
14
|
+
async deliveryFees( body: UtilDeliveryFeesValidation['body'] ): Promise<UtilDeliveryFeesValidation['response']> {
|
|
15
|
+
return await this.http.request<UtilDeliveryFeesValidation['response']>({
|
|
16
|
+
url: '/utilities/fares/delivery',
|
|
17
|
+
method: 'POST',
|
|
18
|
+
body
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async transportFare( body: UtilTransportFareValidation['body'] ): Promise<UtilTransportFareValidation['response']> {
|
|
23
|
+
return await this.http.request<UtilTransportFareValidation['response']>({
|
|
24
|
+
url: '/utilities/fares/transport',
|
|
25
|
+
method: 'POST',
|
|
26
|
+
body
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async rideFare( body: UtilRideFareValidation['body'] ): Promise<UtilRideFareValidation['response']> {
|
|
31
|
+
return await this.http.request<UtilRideFareValidation['response']>({
|
|
32
|
+
url: '/utilities/fares/ride',
|
|
33
|
+
method: 'POST',
|
|
34
|
+
body
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async crossBorderFare( body: UtilCrossBorderFareValidation['body'] ): Promise<UtilCrossBorderFareValidation['response']> {
|
|
39
|
+
return await this.http.request<UtilCrossBorderFareValidation['response']>({
|
|
40
|
+
url: '/utilities/fares/crossborder',
|
|
41
|
+
method: 'POST',
|
|
42
|
+
body
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Env, Platform } from '../../types'
|
|
2
|
+
import type { AccessOptions } from '../../types/access'
|
|
3
|
+
import AccessManager from '../Access'
|
|
4
|
+
import { UtilitiesCommon } from './common'
|
|
5
|
+
import { UtilitiesFares } from './fares'
|
|
6
|
+
import { UtilitiesNearby } from './nearby'
|
|
7
|
+
|
|
8
|
+
// ─── Config ───────────────────────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export type UtilitiesConfig = {
|
|
11
|
+
context: string
|
|
12
|
+
accessToken: string
|
|
13
|
+
env?: Env
|
|
14
|
+
platform?: Platform
|
|
15
|
+
remoteOrigin?: string
|
|
16
|
+
/** Per-request deadline in ms. See `AccessOptions.timeout`. */
|
|
17
|
+
timeout?: number
|
|
18
|
+
/** Explicit service origin, overriding the env table. See `AccessOptions.baseUrl`. */
|
|
19
|
+
baseUrl?: string
|
|
20
|
+
version?: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ─── Utilities ────────────────────────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
export default class Utilities extends AccessManager {
|
|
26
|
+
readonly common: UtilitiesCommon
|
|
27
|
+
readonly fares: UtilitiesFares
|
|
28
|
+
readonly nearby: UtilitiesNearby
|
|
29
|
+
|
|
30
|
+
constructor( config: UtilitiesConfig ){
|
|
31
|
+
if( !config ) throw new Error('Undefined config')
|
|
32
|
+
if( !config.context ) throw new Error('Undefined context')
|
|
33
|
+
if( !config.accessToken ) throw new Error('Undefined accessToken')
|
|
34
|
+
|
|
35
|
+
const access: AccessOptions = {
|
|
36
|
+
context: config.context,
|
|
37
|
+
accessToken: config.accessToken,
|
|
38
|
+
env: config.env || 'dev',
|
|
39
|
+
platform: config.platform || 'proxy',
|
|
40
|
+
remoteOrigin: config.remoteOrigin,
|
|
41
|
+
timeout: config.timeout,
|
|
42
|
+
baseUrl: config.baseUrl,
|
|
43
|
+
version: config.version
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
super( access, 'API' )
|
|
47
|
+
|
|
48
|
+
this.common = new UtilitiesCommon( this )
|
|
49
|
+
this.fares = new UtilitiesFares( this )
|
|
50
|
+
this.nearby = new UtilitiesNearby( this )
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UtilSearchNearbyValidation,
|
|
3
|
+
UtilSearchInBoundsValidation,
|
|
4
|
+
UtilFindNearestValidation
|
|
5
|
+
} from '@de./types'
|
|
6
|
+
import { type Http, type Res, type Data } from '../../utils'
|
|
7
|
+
|
|
8
|
+
// ─── Nearby ───────────────────────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export class UtilitiesNearby {
|
|
11
|
+
constructor( private http: Http ){}
|
|
12
|
+
|
|
13
|
+
async search( body: UtilSearchNearbyValidation['body'] ): Promise<UtilSearchNearbyValidation['response']> {
|
|
14
|
+
return await this.http.request<UtilSearchNearbyValidation['response']>({
|
|
15
|
+
url: '/utilities/nearby/search',
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async searchInBounds( body: UtilSearchInBoundsValidation['body'] ): Promise<UtilSearchInBoundsValidation['response']> {
|
|
22
|
+
return await this.http.request<UtilSearchInBoundsValidation['response']>({
|
|
23
|
+
url: '/utilities/nearby/bounds',
|
|
24
|
+
method: 'POST',
|
|
25
|
+
body
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async findNearest( body: UtilFindNearestValidation['body'] ): Promise<UtilFindNearestValidation['response']> {
|
|
30
|
+
return await this.http.request<UtilFindNearestValidation['response']>({
|
|
31
|
+
url: '/utilities/nearby/nearest',
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { AccessOptions } from '../../types/access'
|
|
2
|
-
import type { HTTPRequestOptions, RTLocation,
|
|
2
|
+
import type { HTTPRequestOptions, RTLocation, MSIEntity, HTTPResponse } from '../../types'
|
|
3
3
|
import AccessManager from '../Access'
|
|
4
4
|
|
|
5
|
-
type OrderServiceResponse = HTTPResponse
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
type NearbyResponse = HTTPResponse & {
|
|
9
|
-
nearby: Entity[]
|
|
10
|
-
}
|
|
5
|
+
type OrderServiceResponse = HTTPResponse<{ orders: any[] }>
|
|
6
|
+
type NearbyResponse = HTTPResponse<{ nearby: MSIEntity[] }>
|
|
11
7
|
|
|
12
8
|
export default class Client extends AccessManager {
|
|
13
9
|
private clientId: string
|
|
@@ -30,11 +26,9 @@ export default class Client extends AccessManager {
|
|
|
30
26
|
options: HTTPRequestOptions = {
|
|
31
27
|
url: `/client/${this.clientId}/orders/actives`,
|
|
32
28
|
method: 'GET'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return orders
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return await this.request<OrderServiceResponse>( options )
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
async fetchOrderHistory(){
|
|
@@ -45,11 +39,9 @@ export default class Client extends AccessManager {
|
|
|
45
39
|
options: HTTPRequestOptions = {
|
|
46
40
|
url: `/client/${this.clientId}/orders/history`,
|
|
47
41
|
method: 'GET'
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return orders
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return await this.request<OrderServiceResponse>( options )
|
|
53
45
|
}
|
|
54
46
|
|
|
55
47
|
async nearby( location: RTLocation ){
|
|
@@ -67,10 +59,8 @@ export default class Client extends AccessManager {
|
|
|
67
59
|
url: `/client/${this.clientId}/nearby`,
|
|
68
60
|
method: 'POST',
|
|
69
61
|
body: location
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return nearby
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return await this.request<NearbyResponse>( options )
|
|
75
65
|
}
|
|
76
66
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type LSP from '../LSP'
|
|
2
|
+
import type { Coordinates } from '../../types'
|
|
3
|
+
|
|
4
|
+
// ─── Input types ──────────────────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
export type DeliveryContact = {
|
|
7
|
+
type?: string
|
|
8
|
+
reference: string
|
|
9
|
+
phone?: string
|
|
10
|
+
email?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type DeliveryLocation = {
|
|
14
|
+
address: string
|
|
15
|
+
coordinates: Coordinates
|
|
16
|
+
contact?: DeliveryContact
|
|
17
|
+
description?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DeliveryPackage = {
|
|
21
|
+
waypointNo?: number
|
|
22
|
+
careLevel?: number
|
|
23
|
+
category?: string
|
|
24
|
+
weight?: number
|
|
25
|
+
note?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type DeliveryPickupInput = {
|
|
29
|
+
clientId: string
|
|
30
|
+
from: DeliveryLocation
|
|
31
|
+
to: DeliveryLocation
|
|
32
|
+
packages?: DeliveryPackage[]
|
|
33
|
+
service?: Record<string, any>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type DeliveryResult = {
|
|
37
|
+
intentToken: string
|
|
38
|
+
jrtoken: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
42
|
+
//
|
|
43
|
+
// LAYER 2 — Delivery workflow.
|
|
44
|
+
// Composes Lsp.orders calls into a single "get this from A to B" operation:
|
|
45
|
+
// intent → addWaypoint → addPackage? → initiate
|
|
46
|
+
//
|
|
47
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
export default class Delivery {
|
|
50
|
+
constructor( private lsp: LSP ){}
|
|
51
|
+
|
|
52
|
+
// async pickup({ clientId, from, to, packages, service = {} }: DeliveryPickupInput ): Promise<DeliveryResult> {
|
|
53
|
+
// if( !clientId ) throw new Error('<clientId> required for delivery pickup')
|
|
54
|
+
// if( !from ) throw new Error('<from> location required')
|
|
55
|
+
// if( !to ) throw new Error('<to> location required')
|
|
56
|
+
|
|
57
|
+
// // 1 — Create intent session
|
|
58
|
+
// const intentToken = await this.lsp.orders.intent( clientId )
|
|
59
|
+
|
|
60
|
+
// // 2 — Register pickup + dropoff waypoints
|
|
61
|
+
// await this.lsp.orders.addWaypoint([
|
|
62
|
+
// {
|
|
63
|
+
// no: 1,
|
|
64
|
+
// type: 'pickup',
|
|
65
|
+
// description: from.description || from.address,
|
|
66
|
+
// coordinates: from.coordinates,
|
|
67
|
+
// address: from.address,
|
|
68
|
+
// contact: from.contact || { type: 'sender', reference: clientId }
|
|
69
|
+
// },
|
|
70
|
+
// {
|
|
71
|
+
// no: 2,
|
|
72
|
+
// type: 'dropoff',
|
|
73
|
+
// description: to.description || to.address,
|
|
74
|
+
// coordinates: to.coordinates,
|
|
75
|
+
// address: to.address,
|
|
76
|
+
// contact: to.contact || { type: 'receiver', reference: '' }
|
|
77
|
+
// }
|
|
78
|
+
// ], intentToken )
|
|
79
|
+
|
|
80
|
+
// // 3 — Attach packages when provided
|
|
81
|
+
// if( packages?.length ){
|
|
82
|
+
// const stamped = packages.map(( pkg, i ) => ({
|
|
83
|
+
// ...pkg,
|
|
84
|
+
// waypointNo: pkg.waypointNo ?? 2 // defaults to dropoff
|
|
85
|
+
// }))
|
|
86
|
+
// await this.lsp.orders.addPackage( stamped, intentToken )
|
|
87
|
+
// }
|
|
88
|
+
|
|
89
|
+
// // 4 — Initiate the order and get the job-reference token
|
|
90
|
+
// const jrtoken = await this.lsp.orders.initiate( service, intentToken )
|
|
91
|
+
|
|
92
|
+
// return { intentToken, jrtoken }
|
|
93
|
+
// }
|
|
94
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type LSP from '../LSP'
|
|
2
|
+
import type MSI from '../MSI'
|
|
3
|
+
import Delivery from './Delivery'
|
|
4
|
+
|
|
5
|
+
// ─── Config ───────────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
export type WorkflowsConfig = {
|
|
8
|
+
lsp: LSP
|
|
9
|
+
msi?: MSI
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
//
|
|
14
|
+
// LAYER 2 — Workflows: use-case composition, many API calls in one.
|
|
15
|
+
// Sits explicitly on top of Core — the consumer passes core to it,
|
|
16
|
+
// making the dependency chain visible and testable.
|
|
17
|
+
//
|
|
18
|
+
// const wf = new Workflows({ core })
|
|
19
|
+
// const { jrtoken } = await wf.delivery.pickup({ clientId, from, to, packages })
|
|
20
|
+
//
|
|
21
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
export default class Workflows {
|
|
24
|
+
readonly delivery: Delivery
|
|
25
|
+
|
|
26
|
+
constructor({ lsp }: WorkflowsConfig ){
|
|
27
|
+
if( !lsp ) throw new Error('<core> instance required. Pass a Core instance to Workflows.')
|
|
28
|
+
|
|
29
|
+
this.delivery = new Delivery( lsp )
|
|
30
|
+
}
|
|
31
|
+
}
|