@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/src/utils/index.ts
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import type { HTTPRequestOptions } from '../types'
|
|
2
2
|
import Stream from './stream'
|
|
3
3
|
|
|
4
|
+
// ─── Requests types ───────────────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
export type Http = { request<T>( opts: HTTPRequestOptions ): Promise<T> }
|
|
7
|
+
export type Res<T = any> = { error: boolean, status?: string, message?: string, data: T }
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The payload inside De.'s envelope, for a caller who wants only that.
|
|
11
|
+
*
|
|
12
|
+
* Clients return the envelope — `{ error, status, message, data }` — because
|
|
13
|
+
* `status` names a refusal precisely and throwing it away leaves the caller
|
|
14
|
+
* reconstructing it from prose. This names the `data` half for the places that
|
|
15
|
+
* want to talk about the payload type on its own.
|
|
16
|
+
*
|
|
17
|
+
* A route answering with no payload resolves to `undefined`, and a payload the
|
|
18
|
+
* route may omit keeps the `| undefined` its schema gave it — the distinction
|
|
19
|
+
* a conditional on `T extends { data: infer D }` loses, since an optional
|
|
20
|
+
* property fails that test outright.
|
|
21
|
+
*/
|
|
22
|
+
export type Data<T> = 'data' extends keyof T ? T['data'] : undefined
|
|
23
|
+
|
|
24
|
+
export const qs = ( params?: Record<string, any> ): string => {
|
|
25
|
+
if( !params ) return ''
|
|
26
|
+
const q = new URLSearchParams(
|
|
27
|
+
Object.fromEntries(
|
|
28
|
+
Object.entries( params )
|
|
29
|
+
.filter( ( [, v] ) => v != null )
|
|
30
|
+
.map( ( [k, v] ) => [k, String( v )] )
|
|
31
|
+
)
|
|
32
|
+
).toString()
|
|
33
|
+
return q ? `?${q}` : ''
|
|
34
|
+
}
|
|
35
|
+
|
|
4
36
|
export default { Stream }
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { HTTPResponse } from '../../types';
|
|
2
|
-
import type { AccessOptions } from '../../types/access';
|
|
3
|
-
import AccessManager from '../Access';
|
|
4
|
-
type SigninBody = {
|
|
5
|
-
type?: 'CUSTOMER' | 'VENDOR' | 'ADMIN';
|
|
6
|
-
phone: string;
|
|
7
|
-
device?: string;
|
|
8
|
-
country?: string;
|
|
9
|
-
};
|
|
10
|
-
type SigninResponse = HTTPResponse & {
|
|
11
|
-
token: string;
|
|
12
|
-
};
|
|
13
|
-
export default class DAuth extends AccessManager {
|
|
14
|
-
constructor(access: AccessOptions);
|
|
15
|
-
/**
|
|
16
|
-
* Signin
|
|
17
|
-
*/
|
|
18
|
-
signin(body: SigninBody): Promise<SigninResponse>;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
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);
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
-
};
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
var Access_1 = __importDefault(require("../Access"));
|
|
58
|
-
var DAuth = /** @class */ (function (_super) {
|
|
59
|
-
__extends(DAuth, _super);
|
|
60
|
-
function DAuth(access) {
|
|
61
|
-
return _super.call(this, access, 'ASI') || this;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Signin
|
|
65
|
-
*/
|
|
66
|
-
DAuth.prototype.signin = function (body) {
|
|
67
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
-
var options, response;
|
|
69
|
-
return __generator(this, function (_a) {
|
|
70
|
-
switch (_a.label) {
|
|
71
|
-
case 0:
|
|
72
|
-
if (!body.phone)
|
|
73
|
-
throw new Error('<phone> argument required');
|
|
74
|
-
options = {
|
|
75
|
-
url: '/auth/signin',
|
|
76
|
-
method: 'POST',
|
|
77
|
-
body: body
|
|
78
|
-
};
|
|
79
|
-
return [4 /*yield*/, this.request(options)];
|
|
80
|
-
case 1:
|
|
81
|
-
response = _a.sent();
|
|
82
|
-
if (response.error)
|
|
83
|
-
throw new Error(response.message);
|
|
84
|
-
return [2 /*return*/, response];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
return DAuth;
|
|
90
|
-
}(Access_1.default));
|
|
91
|
-
exports.default = DAuth;
|
|
92
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/allend/DAuth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qDAAqC;AAYrC;IAAmC,yBAAa;IAC9C,eAAa,MAAqB;QAChC,OAAA,MAAK,YAAE,MAAM,EAAE,KAAK,CAAE,SAAA;IACxB,CAAC;IAED;;OAEG;IACG,sBAAM,GAAZ,UAAc,IAAgB;;;;;;wBAC5B,IAAI,CAAC,IAAI,CAAC,KAAK;4BACb,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;wBAG9C,OAAO,GAAuB;4BAC5B,GAAG,EAAE,cAAc;4BACnB,MAAM,EAAE,MAAM;4BACd,IAAI,MAAA;yBACL;wBACU,qBAAM,IAAI,CAAC,OAAO,CAAkB,OAAO,CAAE,EAAA;;wBAAxD,QAAQ,GAAG,SAA6C;wBACxD,IAAI,QAAQ,CAAC,KAAK;4BAAG,MAAM,IAAI,KAAK,CAAE,QAAQ,CAAC,OAAO,CAAE,CAAA;wBAExD,sBAAO,QAAQ,EAAA;;;;KAChB;IAEH,YAAC;AAAD,CAAC,AAxBD,CAAmC,gBAAa,GAwB/C"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AccessOptions } from '../../types/access';
|
|
2
|
-
import type { RTLocation, OrderService, Entity } from '../../types';
|
|
3
|
-
import AccessManager from '../Access';
|
|
4
|
-
export default class Client extends AccessManager {
|
|
5
|
-
private clientId;
|
|
6
|
-
constructor(clientId: string, access: AccessOptions);
|
|
7
|
-
fetchActiveOrders(): Promise<OrderService[]>;
|
|
8
|
-
fetchOrderHistory(): Promise<OrderService[]>;
|
|
9
|
-
nearby(location: RTLocation): Promise<Entity[]>;
|
|
10
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
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);
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
-
};
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
var Access_1 = __importDefault(require("../Access"));
|
|
58
|
-
var Client = /** @class */ (function (_super) {
|
|
59
|
-
__extends(Client, _super);
|
|
60
|
-
function Client(clientId, access) {
|
|
61
|
-
var _this = this;
|
|
62
|
-
if (!clientId)
|
|
63
|
-
throw new Error('Undefined <clientId>');
|
|
64
|
-
// Instanciate access
|
|
65
|
-
_this = _super.call(this, access, 'API') || this;
|
|
66
|
-
// ID/reference of the client on this session
|
|
67
|
-
_this.clientId = clientId;
|
|
68
|
-
return _this;
|
|
69
|
-
}
|
|
70
|
-
Client.prototype.fetchActiveOrders = function () {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var options, _a, error, message, orders;
|
|
73
|
-
return __generator(this, function (_b) {
|
|
74
|
-
switch (_b.label) {
|
|
75
|
-
case 0:
|
|
76
|
-
if (!this.accessToken)
|
|
77
|
-
throw new Error('Authentication required');
|
|
78
|
-
options = {
|
|
79
|
-
url: "/client/".concat(this.clientId, "/orders/actives"),
|
|
80
|
-
method: 'GET'
|
|
81
|
-
};
|
|
82
|
-
return [4 /*yield*/, this.request(options)];
|
|
83
|
-
case 1:
|
|
84
|
-
_a = _b.sent(), error = _a.error, message = _a.message, orders = _a.orders;
|
|
85
|
-
if (error)
|
|
86
|
-
throw new Error(message);
|
|
87
|
-
return [2 /*return*/, orders];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
Client.prototype.fetchOrderHistory = function () {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
-
var options, _a, error, message, orders;
|
|
95
|
-
return __generator(this, function (_b) {
|
|
96
|
-
switch (_b.label) {
|
|
97
|
-
case 0:
|
|
98
|
-
if (!this.accessToken)
|
|
99
|
-
throw new Error('Authentication required');
|
|
100
|
-
options = {
|
|
101
|
-
url: "/client/".concat(this.clientId, "/orders/history"),
|
|
102
|
-
method: 'GET'
|
|
103
|
-
};
|
|
104
|
-
return [4 /*yield*/, this.request(options)];
|
|
105
|
-
case 1:
|
|
106
|
-
_a = _b.sent(), error = _a.error, message = _a.message, orders = _a.orders;
|
|
107
|
-
if (error)
|
|
108
|
-
throw new Error(message);
|
|
109
|
-
return [2 /*return*/, orders];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
Client.prototype.nearby = function (location) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
116
|
-
var options, _a, error, message, nearby;
|
|
117
|
-
return __generator(this, function (_b) {
|
|
118
|
-
switch (_b.label) {
|
|
119
|
-
case 0:
|
|
120
|
-
if (!this.accessToken)
|
|
121
|
-
throw new Error('Authentication required');
|
|
122
|
-
if (!location)
|
|
123
|
-
throw new Error('Undefined epicenter location');
|
|
124
|
-
if (!location.lng || !location.lat)
|
|
125
|
-
throw new Error('Invalid location coordinates');
|
|
126
|
-
options = {
|
|
127
|
-
url: "/client/".concat(this.clientId, "/nearby"),
|
|
128
|
-
method: 'POST',
|
|
129
|
-
body: location
|
|
130
|
-
};
|
|
131
|
-
return [4 /*yield*/, this.request(options)];
|
|
132
|
-
case 1:
|
|
133
|
-
_a = _b.sent(), error = _a.error, message = _a.message, nearby = _a.nearby;
|
|
134
|
-
if (error)
|
|
135
|
-
throw new Error(message);
|
|
136
|
-
return [2 /*return*/, nearby];
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
return Client;
|
|
142
|
-
}(Access_1.default));
|
|
143
|
-
exports.default = Client;
|
|
144
|
-
//# sourceMappingURL=Client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../src/allend/DClient/Client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qDAAqC;AASrC;IAAoC,0BAAa;IAG/C,gBAAa,QAAgB,EAAE,MAAqB;QAApD,iBAQC;QAPC,IAAI,CAAC,QAAQ;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QAEzC,qBAAqB;QACrB,QAAA,MAAK,YAAE,MAAM,EAAE,KAAK,CAAE,SAAA;QACtB,6CAA6C;QAC7C,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;;IAC1B,CAAC;IAEK,kCAAiB,GAAvB;;;;;;wBACE,IAAI,CAAC,IAAI,CAAC,WAAW;4BACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;wBAG5C,OAAO,GAAuB;4BAC5B,GAAG,EAAE,kBAAW,IAAI,CAAC,QAAQ,oBAAiB;4BAC9C,MAAM,EAAE,KAAK;yBACd;wBAC4B,qBAAM,IAAI,CAAC,OAAO,CAAwB,OAAO,CAAE,EAAA;;wBAAhF,KAA6B,SAAmD,EAA9E,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,MAAM,YAAA;wBACxB,IAAI,KAAK;4BAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;wBAEtC,sBAAO,MAAM,EAAA;;;;KACd;IAEK,kCAAiB,GAAvB;;;;;;wBACE,IAAI,CAAC,IAAI,CAAC,WAAW;4BACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;wBAG5C,OAAO,GAAuB;4BAC5B,GAAG,EAAE,kBAAW,IAAI,CAAC,QAAQ,oBAAiB;4BAC9C,MAAM,EAAE,KAAK;yBACd;wBAC4B,qBAAM,IAAI,CAAC,OAAO,CAAwB,OAAO,CAAE,EAAA;;wBAAhF,KAA6B,SAAmD,EAA9E,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,MAAM,YAAA;wBACxB,IAAI,KAAK;4BAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;wBAEtC,sBAAO,MAAM,EAAA;;;;KACd;IAEK,uBAAM,GAAZ,UAAc,QAAoB;;;;;;wBAChC,IAAI,CAAC,IAAI,CAAC,WAAW;4BACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;wBAE5C,IAAI,CAAC,QAAQ;4BACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;wBAEjD,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG;4BAChC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;wBAGjD,OAAO,GAAuB;4BAC5B,GAAG,EAAE,kBAAW,IAAI,CAAC,QAAQ,YAAS;4BACtC,MAAM,EAAE,MAAM;4BACd,IAAI,EAAE,QAAQ;yBACf;wBAC4B,qBAAM,IAAI,CAAC,OAAO,CAAkB,OAAO,CAAE,EAAA;;wBAA1E,KAA6B,SAA6C,EAAxE,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,MAAM,YAAA;wBACxB,IAAI,KAAK;4BAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;wBAEtC,sBAAO,MAAM,EAAA;;;;KACd;IACH,aAAC;AAAD,CAAC,AAhED,CAAoC,gBAAa,GAgEhD"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
var socket_io_client_1 = __importDefault(require("socket.io-client"));
|
|
22
|
-
var Access_1 = __importDefault(require("../Access"));
|
|
23
|
-
var Event = /** @class */ (function (_super) {
|
|
24
|
-
__extends(Event, _super);
|
|
25
|
-
function Event(access) {
|
|
26
|
-
var _this = _super.call(this, access, 'API') || this;
|
|
27
|
-
// Socket server host
|
|
28
|
-
_this.iosHost = access.env == 'prod' ?
|
|
29
|
-
'https://api.dedot.io' // Production server
|
|
30
|
-
: 'http://api.dedot.io:24800'; // Development & staging server
|
|
31
|
-
return _this;
|
|
32
|
-
}
|
|
33
|
-
Event.prototype.connect = function (clientId) {
|
|
34
|
-
var _this = this;
|
|
35
|
-
return new Promise(function (resolve, reject) {
|
|
36
|
-
// Connect to main clients namespace
|
|
37
|
-
var auth = {
|
|
38
|
-
utype: 'client',
|
|
39
|
-
id: clientId,
|
|
40
|
-
remoteOrigin: (globalThis === null || globalThis === void 0 ? void 0 : globalThis.window) ? globalThis.origin : _this.remoteOrigin,
|
|
41
|
-
accessToken: _this.accessToken
|
|
42
|
-
};
|
|
43
|
-
_this.nsp = (0, socket_io_client_1.default)(_this.iosHost, { auth: auth });
|
|
44
|
-
_this.nsp.on('connect', resolve);
|
|
45
|
-
_this.nsp.on('connect_error', reject);
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
Event.prototype.disconnect = function () {
|
|
49
|
-
var _a;
|
|
50
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
51
|
-
return true;
|
|
52
|
-
};
|
|
53
|
-
Event.prototype.join = function (jrtoken) {
|
|
54
|
-
var _this = this;
|
|
55
|
-
return new Promise(function (resolve, reject) {
|
|
56
|
-
var _a;
|
|
57
|
-
(_a = _this.nsp) === null || _a === void 0 ? void 0 : _a.emit('JOIN', jrtoken, function (errmess) {
|
|
58
|
-
errmess ? reject(new Error(errmess)) : resolve(true);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
Event.prototype.onLeft = function (fn) {
|
|
63
|
-
var _a;
|
|
64
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('LEFT', fn);
|
|
65
|
-
return this;
|
|
66
|
-
};
|
|
67
|
-
Event.prototype.onConnected = function (fn) {
|
|
68
|
-
var _a;
|
|
69
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('CONNECTED', fn);
|
|
70
|
-
return this;
|
|
71
|
-
};
|
|
72
|
-
Event.prototype.onDisconnected = function (fn) {
|
|
73
|
-
var _a;
|
|
74
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('DISCONNECTED', fn);
|
|
75
|
-
return this;
|
|
76
|
-
};
|
|
77
|
-
Event.prototype.onRoute = function (fn) {
|
|
78
|
-
var _a;
|
|
79
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('ROUTE-CHANGE', fn);
|
|
80
|
-
return this;
|
|
81
|
-
};
|
|
82
|
-
Event.prototype.onStage = function (fn) {
|
|
83
|
-
var _a;
|
|
84
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('STAGE-CHANGE', fn);
|
|
85
|
-
return this;
|
|
86
|
-
};
|
|
87
|
-
Event.prototype.onLocation = function (fn) {
|
|
88
|
-
var _a;
|
|
89
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('LOCATION-CHANGE', fn);
|
|
90
|
-
return this;
|
|
91
|
-
};
|
|
92
|
-
Event.prototype.onMessage = function (fn) {
|
|
93
|
-
var _a;
|
|
94
|
-
(_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('MESSAGE', fn);
|
|
95
|
-
return this;
|
|
96
|
-
};
|
|
97
|
-
return Event;
|
|
98
|
-
}(Access_1.default));
|
|
99
|
-
exports.default = Event;
|
|
100
|
-
//# sourceMappingURL=Event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../src/allend/DClient/Event.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { AccessOptions } from '../../types/access';
|
|
2
|
-
import type { Package, PackageOptions, Waypoint, WaypointOptions, OrderService, OrderServiceOptions, OrderOperator, OrderStage } from '../../types';
|
|
3
|
-
import AccessManager from '../Access';
|
|
4
|
-
type OrderOperators = {
|
|
5
|
-
[index: string]: OrderOperator;
|
|
6
|
-
};
|
|
7
|
-
export default class Order extends AccessManager {
|
|
8
|
-
private intentToken;
|
|
9
|
-
constructor(access: AccessOptions);
|
|
10
|
-
/**
|
|
11
|
-
* Order intent
|
|
12
|
-
*/
|
|
13
|
-
intent(clientId: string): Promise<string>;
|
|
14
|
-
unintent(token: string): Promise<boolean>;
|
|
15
|
-
/**
|
|
16
|
-
* Order waypoints
|
|
17
|
-
*/
|
|
18
|
-
addWaypoint(list: Waypoint | Waypoint[], token?: string): Promise<Waypoint[]>;
|
|
19
|
-
getWaypoint(no: number, token?: string): Promise<Waypoint>;
|
|
20
|
-
fetchWaypoints(token?: string): Promise<Waypoint[]>;
|
|
21
|
-
updateWaypoint(no: number, updates: WaypointOptions, token?: string): Promise<Waypoint[]>;
|
|
22
|
-
deleteWaypoint(no: number, token?: string): Promise<Waypoint[]>;
|
|
23
|
-
/**
|
|
24
|
-
* Order packages
|
|
25
|
-
*/
|
|
26
|
-
addPackage(list: Package | Package[], token?: string): Promise<Package[]>;
|
|
27
|
-
getPackage(PTC: string, token?: string): Promise<Package>;
|
|
28
|
-
fetchPackages(token?: string): Promise<Package[]>;
|
|
29
|
-
updatePackage(PTC: number, updates: PackageOptions, token?: string): Promise<Package[]>;
|
|
30
|
-
deletePackage(PTC: number, token?: string): Promise<Package[]>;
|
|
31
|
-
/**
|
|
32
|
-
* Order service
|
|
33
|
-
*/
|
|
34
|
-
initiate(payload: OrderService, token?: string): Promise<string>;
|
|
35
|
-
getService(token?: string): Promise<OrderService>;
|
|
36
|
-
updateService(updates: OrderServiceOptions, token?: string): Promise<OrderService>;
|
|
37
|
-
rateService(rating: number, token?: string): Promise<boolean>;
|
|
38
|
-
/**
|
|
39
|
-
* Order operators
|
|
40
|
-
*/
|
|
41
|
-
getOperator(type: string, token?: string): Promise<OrderOperator>;
|
|
42
|
-
getOperators(token?: string): Promise<OrderOperators>;
|
|
43
|
-
/**
|
|
44
|
-
* Order monitoring
|
|
45
|
-
*/
|
|
46
|
-
getCurrentStage(token?: string): Promise<OrderStage>;
|
|
47
|
-
getCurrentRoute(token?: string): Promise<any>;
|
|
48
|
-
}
|
|
49
|
-
export {};
|