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