@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
|
@@ -1,80 +1,16 @@
|
|
|
1
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 __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
-
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);
|
|
39
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
-
function step(op) {
|
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
44
|
-
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;
|
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
-
switch (op[0]) {
|
|
47
|
-
case 0: case 1: t = op; break;
|
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
-
default:
|
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
-
if (t[2]) _.ops.pop();
|
|
57
|
-
_.trys.pop(); continue;
|
|
58
|
-
}
|
|
59
|
-
op = body.call(thisArg, _);
|
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
65
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
4
|
};
|
|
67
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
_this.controls = controls;
|
|
77
|
-
return _this;
|
|
6
|
+
const events_1 = require("events");
|
|
7
|
+
const stream_1 = __importDefault(require("../../utils/stream"));
|
|
8
|
+
class Handles extends events_1.EventEmitter {
|
|
9
|
+
constructor(chn, controls, options) {
|
|
10
|
+
super();
|
|
11
|
+
this.chn = chn;
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.controls = controls;
|
|
78
14
|
}
|
|
79
15
|
/**
|
|
80
16
|
* Listen when user manually picked a location
|
|
@@ -83,9 +19,9 @@ var Handles = /** @class */ (function (_super) {
|
|
|
83
19
|
* @param fn - Event listener function
|
|
84
20
|
* @return - void
|
|
85
21
|
*/
|
|
86
|
-
|
|
22
|
+
onPickLocation(fn) {
|
|
87
23
|
this.chn.on('pick:location', fn);
|
|
88
|
-
}
|
|
24
|
+
}
|
|
89
25
|
/**
|
|
90
26
|
* Create new stream through which user's current location
|
|
91
27
|
* details will be pushed to the API level.
|
|
@@ -93,60 +29,65 @@ var Handles = /** @class */ (function (_super) {
|
|
|
93
29
|
* @param usertype - (Default: `client`) Type of user at the current location
|
|
94
30
|
* @return - Readable stream
|
|
95
31
|
*/
|
|
96
|
-
|
|
97
|
-
var _this = this;
|
|
32
|
+
myLocation(usertype) {
|
|
98
33
|
var _a;
|
|
99
34
|
if (!this.chn)
|
|
100
35
|
return;
|
|
101
36
|
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:current:location', usertype || 'client');
|
|
102
|
-
|
|
37
|
+
const stream = new stream_1.default();
|
|
103
38
|
this.chn
|
|
104
|
-
.on('current:location',
|
|
105
|
-
.on('live:location:start',
|
|
106
|
-
.on('live:location:update',
|
|
107
|
-
.on('live:location:end',
|
|
108
|
-
.on('current:location:error',
|
|
39
|
+
.on('current:location', (location) => stream.sync(location))
|
|
40
|
+
.on('live:location:start', (location) => stream.sync(location))
|
|
41
|
+
.on('live:location:update', (location) => stream.sync(location))
|
|
42
|
+
.on('live:location:end', (location) => stream.sync(location))
|
|
43
|
+
.on('current:location:error', (message) => stream.error(new Error(message)));
|
|
109
44
|
// Listen to stream closed
|
|
110
45
|
stream
|
|
111
|
-
.onerror(
|
|
112
|
-
.onclose(
|
|
113
|
-
if (!
|
|
46
|
+
.onerror(error => console.error('[Stream Error] ', error))
|
|
47
|
+
.onclose(() => {
|
|
48
|
+
if (!this.chn)
|
|
114
49
|
return;
|
|
115
|
-
|
|
50
|
+
this.chn
|
|
116
51
|
.off('current:location')
|
|
117
|
-
.off('
|
|
52
|
+
.off('live:location:start')
|
|
53
|
+
.off('live:location:update')
|
|
54
|
+
.off('live:location:end')
|
|
118
55
|
.off('current:location:error');
|
|
119
56
|
});
|
|
120
57
|
return stream;
|
|
121
|
-
}
|
|
58
|
+
}
|
|
122
59
|
/**
|
|
123
60
|
* Create new stream through which the current location details
|
|
124
61
|
* of user's peer (Eg. `agent`) will be pushed to the API level.
|
|
125
62
|
*
|
|
126
63
|
* @param position - Peer's current GPS location
|
|
127
64
|
* @param caption - (Optional) Caption information of the peer
|
|
65
|
+
* @param type - (Default: `car`) Marker representing the peer on the map
|
|
128
66
|
* @return - Readable stream
|
|
129
67
|
*/
|
|
130
|
-
|
|
131
|
-
var _this = this;
|
|
68
|
+
peerLocation(position, caption, type) {
|
|
132
69
|
var _a;
|
|
133
70
|
if (!this.chn)
|
|
134
71
|
return;
|
|
135
|
-
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:peer:location', { id: 'peer', position
|
|
136
|
-
|
|
137
|
-
|
|
72
|
+
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:peer:location', { id: 'peer', position, caption, type });
|
|
73
|
+
const stream = new stream_1.default;
|
|
74
|
+
/**
|
|
75
|
+
* Listen to incoming new position data.
|
|
76
|
+
*
|
|
77
|
+
* Caption is re-sent on every update so a peer can stream a changing
|
|
78
|
+
* label (Eg. a live ETA) alongside its position.
|
|
79
|
+
*/
|
|
138
80
|
stream
|
|
139
|
-
.on('data',
|
|
140
|
-
var
|
|
141
|
-
var position = _a.position, caption = _a.caption;
|
|
81
|
+
.on('data', ({ position, caption }) => {
|
|
82
|
+
var _a;
|
|
142
83
|
if (!position)
|
|
143
84
|
return stream.error(new Error('Invalid Data'));
|
|
144
|
-
(
|
|
85
|
+
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('pin:peer:location', { id: 'peer', position, caption, type });
|
|
145
86
|
})
|
|
146
|
-
.onerror(
|
|
147
|
-
.onclose(
|
|
87
|
+
.onerror(error => console.error('[Stream Error] ', error))
|
|
88
|
+
.onclose(() => { var _a; return (_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('unpin:peer:location', 'peer'); });
|
|
148
89
|
return stream;
|
|
149
|
-
}
|
|
90
|
+
}
|
|
150
91
|
/**
|
|
151
92
|
* Open a live stream through which the current location details
|
|
152
93
|
* and profile information of all nearby entities around
|
|
@@ -156,42 +97,41 @@ var Handles = /** @class */ (function (_super) {
|
|
|
156
97
|
* @param list - List of detected nearby entities around this user.
|
|
157
98
|
* @return - Live Readable Streamer (LRS)
|
|
158
99
|
*/
|
|
159
|
-
|
|
160
|
-
var _this = this;
|
|
100
|
+
nearby(list) {
|
|
161
101
|
var _a;
|
|
162
102
|
if (!this.chn)
|
|
163
103
|
return;
|
|
164
|
-
|
|
165
|
-
|
|
104
|
+
const self = this;
|
|
105
|
+
let _CLOSED = false;
|
|
166
106
|
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('show:nearby', list);
|
|
167
|
-
|
|
107
|
+
const stream = new stream_1.default, controls = {
|
|
168
108
|
/**
|
|
169
109
|
* Add new entity to the nearby list
|
|
170
110
|
*
|
|
171
111
|
* @param entity - GPS location and profile of the entity
|
|
172
112
|
*/
|
|
173
|
-
add
|
|
174
|
-
return new Promise(
|
|
113
|
+
add(entity) {
|
|
114
|
+
return new Promise((resolve, reject) => {
|
|
175
115
|
var _a, _b;
|
|
176
116
|
if (_CLOSED)
|
|
177
117
|
return;
|
|
178
118
|
// Maintain initial list of nearby: Prevent duplicated entity
|
|
179
|
-
for (
|
|
119
|
+
for (let x = 0; x < list.length; x++)
|
|
180
120
|
if (list[x].id === entity.id) {
|
|
181
121
|
list.splice(x, 1);
|
|
182
122
|
(_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby:entity', entity.id);
|
|
183
123
|
break;
|
|
184
124
|
}
|
|
185
125
|
// Track response timeout
|
|
186
|
-
|
|
126
|
+
let TIMEOUT;
|
|
187
127
|
// Add new entity
|
|
188
128
|
list.push(entity);
|
|
189
|
-
(_b = self.chn) === null || _b === void 0 ? void 0 : _b.emit('add:nearby:entity', entity,
|
|
129
|
+
(_b = self.chn) === null || _b === void 0 ? void 0 : _b.emit('add:nearby:entity', entity, () => {
|
|
190
130
|
clearTimeout(TIMEOUT);
|
|
191
131
|
resolve();
|
|
192
132
|
self.emit('nearby--stream', 'add', entity);
|
|
193
133
|
});
|
|
194
|
-
setTimeout(
|
|
134
|
+
TIMEOUT = setTimeout(() => reject('Add entity timeout'), 8000);
|
|
195
135
|
});
|
|
196
136
|
},
|
|
197
137
|
/**
|
|
@@ -199,20 +139,20 @@ var Handles = /** @class */ (function (_super) {
|
|
|
199
139
|
*
|
|
200
140
|
* @param id - ID of targeted entity
|
|
201
141
|
*/
|
|
202
|
-
remove
|
|
203
|
-
return new Promise(
|
|
142
|
+
remove(id) {
|
|
143
|
+
return new Promise((resolve, reject) => {
|
|
204
144
|
var _a;
|
|
205
145
|
if (_CLOSED)
|
|
206
146
|
return;
|
|
207
147
|
// Track response timeout
|
|
208
|
-
|
|
209
|
-
list = list.filter(
|
|
210
|
-
(_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby:entity', id,
|
|
148
|
+
let TIMEOUT;
|
|
149
|
+
list = list.filter(each => each.id !== id);
|
|
150
|
+
(_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby:entity', id, () => {
|
|
211
151
|
clearTimeout(TIMEOUT);
|
|
212
152
|
resolve();
|
|
213
153
|
self.emit('nearby--stream', 'remove', id);
|
|
214
154
|
});
|
|
215
|
-
setTimeout(
|
|
155
|
+
TIMEOUT = setTimeout(() => reject('Remove entity timeout'), 8000);
|
|
216
156
|
});
|
|
217
157
|
},
|
|
218
158
|
/**
|
|
@@ -220,39 +160,39 @@ var Handles = /** @class */ (function (_super) {
|
|
|
220
160
|
*
|
|
221
161
|
* @param id - ID of targeted entity
|
|
222
162
|
*/
|
|
223
|
-
focus
|
|
224
|
-
return new Promise(
|
|
163
|
+
focus(id) {
|
|
164
|
+
return new Promise((resolve, reject) => {
|
|
225
165
|
var _a;
|
|
226
166
|
if (_CLOSED)
|
|
227
167
|
return;
|
|
228
168
|
// Track response timeout
|
|
229
|
-
|
|
230
|
-
|
|
169
|
+
let TIMEOUT;
|
|
170
|
+
const entity = list.find(each => each.id === id);
|
|
231
171
|
if (!entity)
|
|
232
|
-
return reject(
|
|
233
|
-
(_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('panto:map:location', entity.currentLocation,
|
|
172
|
+
return reject(`Entity <${id}> not found`);
|
|
173
|
+
(_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('panto:map:location', entity.currentLocation, () => {
|
|
234
174
|
clearTimeout(TIMEOUT);
|
|
235
175
|
resolve();
|
|
236
176
|
self.emit('nearby--stream', 'panto', id);
|
|
237
177
|
});
|
|
238
|
-
setTimeout(
|
|
178
|
+
TIMEOUT = setTimeout(() => reject('PanTo entity timeout'), 8000);
|
|
239
179
|
});
|
|
240
180
|
},
|
|
241
181
|
/**
|
|
242
182
|
* Change mobile entities position on the map
|
|
243
183
|
*/
|
|
244
|
-
move
|
|
245
|
-
return new Promise(
|
|
184
|
+
move(active) {
|
|
185
|
+
return new Promise((resolve, reject) => {
|
|
246
186
|
var _a;
|
|
247
187
|
if (_CLOSED)
|
|
248
188
|
return;
|
|
249
189
|
// Track response timeout
|
|
250
|
-
|
|
251
|
-
(_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('move:nearby:entity', active,
|
|
190
|
+
let TIMEOUT;
|
|
191
|
+
(_a = self.chn) === null || _a === void 0 ? void 0 : _a.emit('move:nearby:entity', active, () => {
|
|
252
192
|
clearTimeout(TIMEOUT);
|
|
253
|
-
|
|
193
|
+
const entity = list.find(each => each.id === active.id);
|
|
254
194
|
if (!entity)
|
|
255
|
-
throw new Error(
|
|
195
|
+
throw new Error(`Undefined <${active.id}> entity`);
|
|
256
196
|
entity.currentLocation = active.position;
|
|
257
197
|
if (active.focus)
|
|
258
198
|
try {
|
|
@@ -262,22 +202,22 @@ var Handles = /** @class */ (function (_super) {
|
|
|
262
202
|
resolve();
|
|
263
203
|
self.emit('nearby--stream', 'move', active);
|
|
264
204
|
});
|
|
265
|
-
setTimeout(
|
|
205
|
+
TIMEOUT = setTimeout(() => reject('Move entity timeout'), 8000);
|
|
266
206
|
});
|
|
267
207
|
}
|
|
268
208
|
};
|
|
269
|
-
|
|
209
|
+
const
|
|
270
210
|
/**
|
|
271
211
|
*
|
|
272
212
|
*/
|
|
273
|
-
live =
|
|
213
|
+
live = (fn) => {
|
|
274
214
|
fn(controls);
|
|
275
215
|
return stream;
|
|
276
|
-
}, close =
|
|
216
|
+
}, close = (fn) => {
|
|
277
217
|
var _a;
|
|
278
218
|
if (_CLOSED)
|
|
279
219
|
return;
|
|
280
|
-
(_a =
|
|
220
|
+
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.emit('remove:nearby', (error) => {
|
|
281
221
|
if (typeof error == 'string')
|
|
282
222
|
return typeof fn == 'function' && fn(new Error(error));
|
|
283
223
|
_CLOSED = true;
|
|
@@ -285,60 +225,46 @@ var Handles = /** @class */ (function (_super) {
|
|
|
285
225
|
typeof fn == 'function' && fn();
|
|
286
226
|
});
|
|
287
227
|
};
|
|
288
|
-
this.on('nearby--stream',
|
|
228
|
+
this.on('nearby--stream', (action, dataset) => stream.sync({ action, dataset, list }));
|
|
289
229
|
// Listen to stream closed
|
|
290
230
|
stream
|
|
291
|
-
.onerror(
|
|
292
|
-
.onclose(
|
|
293
|
-
|
|
231
|
+
.onerror(error => console.error('[Stream Error] ', error))
|
|
232
|
+
.onclose((fn) => {
|
|
233
|
+
this.off('nearby--stream', fn || (() => { }));
|
|
294
234
|
close();
|
|
295
235
|
});
|
|
296
|
-
return { live
|
|
297
|
-
}
|
|
236
|
+
return { live, pipe: stream.pipe, close };
|
|
237
|
+
}
|
|
298
238
|
/**
|
|
299
239
|
* Set service pickup point.
|
|
300
240
|
*
|
|
301
241
|
* @param location - Location coordinates
|
|
302
242
|
* @param caption - (Optional) Caption information of the pickup point
|
|
303
243
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
case 1:
|
|
314
|
-
_b.sent();
|
|
315
|
-
return [2 /*return*/];
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
};
|
|
244
|
+
async pickupPoint(location, caption) {
|
|
245
|
+
var _a;
|
|
246
|
+
// Default pickup caption
|
|
247
|
+
const _caption = {
|
|
248
|
+
label: 'Pickup point',
|
|
249
|
+
...(caption || {})
|
|
250
|
+
};
|
|
251
|
+
await ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRouteOrigin('main', { coords: location, caption: _caption }));
|
|
252
|
+
}
|
|
320
253
|
/**
|
|
321
254
|
* Set service dropoff point.
|
|
322
255
|
*
|
|
323
256
|
* @param location - Location coordinates
|
|
324
257
|
* @param caption - (Optional) Caption information of the pickup point
|
|
325
258
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
case 1:
|
|
336
|
-
_b.sent();
|
|
337
|
-
return [2 /*return*/];
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
};
|
|
259
|
+
async dropoffPoint(location, caption) {
|
|
260
|
+
var _a;
|
|
261
|
+
// Default destination caption
|
|
262
|
+
const _caption = {
|
|
263
|
+
label: 'Destination point',
|
|
264
|
+
...(caption || {})
|
|
265
|
+
};
|
|
266
|
+
await ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRouteDestination('main', { coords: location, caption: _caption }));
|
|
267
|
+
}
|
|
342
268
|
/**
|
|
343
269
|
* Create new stream through which navigation details of
|
|
344
270
|
* this user's peer will be display on the user's map also
|
|
@@ -346,18 +272,16 @@ var Handles = /** @class */ (function (_super) {
|
|
|
346
272
|
*
|
|
347
273
|
* @return - Readable stream
|
|
348
274
|
*/
|
|
349
|
-
|
|
350
|
-
var _this = this;
|
|
275
|
+
peerDirection(options) {
|
|
351
276
|
if (!this.chn)
|
|
352
277
|
return;
|
|
353
|
-
|
|
278
|
+
const stream = new stream_1.default;
|
|
354
279
|
stream
|
|
355
|
-
.on('data',
|
|
356
|
-
var
|
|
357
|
-
var status = _a.status, direction = _a.direction, position = _a.position;
|
|
280
|
+
.on('data', ({ status, direction, position }) => {
|
|
281
|
+
var _a;
|
|
358
282
|
if (!direction || !position)
|
|
359
283
|
return stream.error(new Error('Invalid Data'));
|
|
360
|
-
(
|
|
284
|
+
(_a = this.controls) === null || _a === void 0 ? void 0 : _a.casting('peer-direction', direction, position, options);
|
|
361
285
|
switch (status) {
|
|
362
286
|
case 'STALE':
|
|
363
287
|
case 'STARTED':
|
|
@@ -368,19 +292,19 @@ var Handles = /** @class */ (function (_super) {
|
|
|
368
292
|
case 'SPEED_WARNING':
|
|
369
293
|
case 'NEARBY':
|
|
370
294
|
case 'ARRIVED':
|
|
371
|
-
|
|
295
|
+
this.emit(`pe:${status.toLowerCase()}`);
|
|
372
296
|
break;
|
|
373
297
|
case 'UNAVAILABLE':
|
|
374
298
|
{
|
|
375
|
-
|
|
299
|
+
this.emit(`pe:closed`);
|
|
376
300
|
stream.isActive() && stream.close();
|
|
377
301
|
}
|
|
378
302
|
break;
|
|
379
303
|
}
|
|
380
304
|
})
|
|
381
|
-
.onerror(
|
|
305
|
+
.onerror(error => console.error('[Stream Error] ', error));
|
|
382
306
|
return stream;
|
|
383
|
-
}
|
|
307
|
+
}
|
|
384
308
|
/**
|
|
385
309
|
* Initiate user (Eg. agent) live navigation on the map
|
|
386
310
|
* and create a new stream through which the navigation details
|
|
@@ -389,19 +313,17 @@ var Handles = /** @class */ (function (_super) {
|
|
|
389
313
|
* @param journey - Route origin, waypoints, destination
|
|
390
314
|
* @return - Readable stream
|
|
391
315
|
*/
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
return new Promise(function (resolve, reject) {
|
|
316
|
+
navigation(journey) {
|
|
317
|
+
return new Promise((resolve, reject) => {
|
|
395
318
|
var _a;
|
|
396
|
-
if (!
|
|
319
|
+
if (!this.chn)
|
|
397
320
|
return;
|
|
398
|
-
|
|
321
|
+
const initialize = () => {
|
|
399
322
|
var _a;
|
|
400
|
-
|
|
323
|
+
const stream = new stream_1.default;
|
|
401
324
|
// Sync with navigation route update
|
|
402
|
-
(_a =
|
|
403
|
-
|
|
404
|
-
stream.sync({ status: status, direction: direction, position: position });
|
|
325
|
+
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.on('navigation:direction', ({ status, direction, position }) => {
|
|
326
|
+
stream.sync({ status, direction, position });
|
|
405
327
|
switch (status) {
|
|
406
328
|
case 'STALE':
|
|
407
329
|
case 'STARTED':
|
|
@@ -412,11 +334,11 @@ var Handles = /** @class */ (function (_super) {
|
|
|
412
334
|
case 'SPEED_WARNING':
|
|
413
335
|
case 'NEARBY':
|
|
414
336
|
case 'ARRIVED':
|
|
415
|
-
|
|
337
|
+
this.emit(`pe:${status.toLowerCase()}`);
|
|
416
338
|
break;
|
|
417
339
|
case 'UNAVAILABLE':
|
|
418
340
|
{
|
|
419
|
-
|
|
341
|
+
this.emit(`pe:closed`);
|
|
420
342
|
stream.isActive() && stream.close();
|
|
421
343
|
}
|
|
422
344
|
break;
|
|
@@ -424,52 +346,33 @@ var Handles = /** @class */ (function (_super) {
|
|
|
424
346
|
});
|
|
425
347
|
stream
|
|
426
348
|
// Listen location/position update
|
|
427
|
-
.on('data',
|
|
428
|
-
var
|
|
429
|
-
var position = _a.position;
|
|
349
|
+
.on('data', ({ position }) => {
|
|
350
|
+
var _a;
|
|
430
351
|
if (!position)
|
|
431
352
|
return stream.error(new Error('Invalid Data'));
|
|
432
|
-
(
|
|
353
|
+
(_a = this.controls) === null || _a === void 0 ? void 0 : _a.navigate(position);
|
|
433
354
|
})
|
|
434
|
-
.onerror(
|
|
435
|
-
.onclose(
|
|
355
|
+
.onerror(error => console.error('[Stream Error] ', error))
|
|
356
|
+
.onclose(() => {
|
|
436
357
|
var _a, _b;
|
|
437
|
-
(_a =
|
|
438
|
-
(_b =
|
|
358
|
+
(_a = this.chn) === null || _a === void 0 ? void 0 : _a.off('navigation:direction');
|
|
359
|
+
(_b = this.controls) === null || _b === void 0 ? void 0 : _b.unmountNavigation();
|
|
439
360
|
});
|
|
440
361
|
resolve(stream);
|
|
441
362
|
};
|
|
442
363
|
// Set route
|
|
443
|
-
(_a =
|
|
444
|
-
var
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
_a = (_e.sent());
|
|
454
|
-
_e.label = 2;
|
|
455
|
-
case 2:
|
|
456
|
-
position = _a;
|
|
457
|
-
if (!position)
|
|
458
|
-
return [2 /*return*/, reject('Unable to get current location')];
|
|
459
|
-
initialize();
|
|
460
|
-
return [4 /*yield*/, ((_c = this.controls) === null || _c === void 0 ? void 0 : _c.mountNavigation(journey.routeId))];
|
|
461
|
-
case 3:
|
|
462
|
-
_e.sent();
|
|
463
|
-
return [4 /*yield*/, ((_d = this.controls) === null || _d === void 0 ? void 0 : _d.setInitialNavigationPosition(position))];
|
|
464
|
-
case 4:
|
|
465
|
-
_e.sent();
|
|
466
|
-
return [2 /*return*/];
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
}); }).catch(reject);
|
|
364
|
+
(_a = this.controls) === null || _a === void 0 ? void 0 : _a.setRoute(journey).then(async () => {
|
|
365
|
+
var _a, _b, _c;
|
|
366
|
+
// Initialize navigation point to current location
|
|
367
|
+
const position = journey.origin || await ((_a = this.controls) === null || _a === void 0 ? void 0 : _a.getCurrentLocation());
|
|
368
|
+
if (!position)
|
|
369
|
+
return reject('Unable to get current location');
|
|
370
|
+
initialize();
|
|
371
|
+
await ((_b = this.controls) === null || _b === void 0 ? void 0 : _b.mountNavigation(journey.routeId));
|
|
372
|
+
await ((_c = this.controls) === null || _c === void 0 ? void 0 : _c.setInitialNavigationPosition(position));
|
|
373
|
+
}).catch(reject);
|
|
470
374
|
});
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
}(events_1.EventEmitter));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
474
377
|
exports.default = Handles;
|
|
475
378
|
//# sourceMappingURL=Handles.js.map
|