@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/backend/Auth.js
CHANGED
|
@@ -1,286 +1,166 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
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);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
-
var t = {};
|
|
51
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
-
t[p] = s[p];
|
|
53
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
-
t[p[i]] = s[p[i]];
|
|
57
|
-
}
|
|
58
|
-
return t;
|
|
59
|
-
};
|
|
60
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
61
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
62
|
-
if (ar || !(i in from)) {
|
|
63
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
64
|
-
ar[i] = from[i];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
68
|
-
};
|
|
69
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
3
|
+
const baseUrl_1 = require("../baseUrl");
|
|
4
|
+
const ACCESS_TOKEN_EXPIRY = 3.75; // in 3 minutes 45 seconds
|
|
5
|
+
class Auth {
|
|
6
|
+
constructor(config) {
|
|
74
7
|
this.isRotating = false;
|
|
75
|
-
if (!
|
|
76
|
-
throw new Error('Undefined
|
|
77
|
-
if (!
|
|
78
|
-
throw new Error('Undefined
|
|
79
|
-
if (!
|
|
80
|
-
throw new Error('Undefined
|
|
81
|
-
if (!
|
|
82
|
-
throw new Error('Undefined
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
8
|
+
if (!config)
|
|
9
|
+
throw new Error('Undefined config. Check https://doc.dedot.io/sdk/auth');
|
|
10
|
+
if (!config.context)
|
|
11
|
+
throw new Error('Undefined context. Check https://doc.dedot.io/sdk/auth');
|
|
12
|
+
if (!config.cid)
|
|
13
|
+
throw new Error('Undefined cid. Check https://doc.dedot.io/sdk/auth');
|
|
14
|
+
if (!config.secret)
|
|
15
|
+
throw new Error('Undefined secret. Check https://doc.dedot.io/sdk/auth');
|
|
16
|
+
this.context = config.context;
|
|
17
|
+
this.uid = config.uid;
|
|
18
|
+
this.cid = config.cid;
|
|
19
|
+
this.secret = config.secret;
|
|
20
|
+
this.remoteOrigin = config.remoteOrigin;
|
|
21
|
+
this.env = config.env || 'dev';
|
|
22
|
+
this.version = config.version || 1;
|
|
23
|
+
this.baseURL = (0, baseUrl_1.baseURL)('API', this.env, config.devHostname);
|
|
24
|
+
this.autorefresh = config.autorefresh || false;
|
|
25
|
+
this.onNewToken = config.onNewToken;
|
|
91
26
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*/
|
|
107
|
-
'origin': this.creds.remoteOrigin,
|
|
108
|
-
'de-user-agent': "De.remote/".concat(this.version, ".0")
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
if (this.accessToken)
|
|
112
|
-
rawOptions.headers.authorization = "Bearer ".concat(this.accessToken);
|
|
113
|
-
if (options.body) {
|
|
114
|
-
rawOptions.headers['content-type'] = 'application/json';
|
|
115
|
-
if (typeof options.body === 'object')
|
|
116
|
-
options.body = JSON.stringify(options.body);
|
|
117
|
-
}
|
|
118
|
-
options = __assign(__assign({}, rawOptions), options);
|
|
119
|
-
this.debug('Auth request', "".concat(this.baseURL, "/v").concat(this.version, "/").concat(url.replace(/^\//, '')), options);
|
|
120
|
-
return [4 /*yield*/, fetch("".concat(this.baseURL, "/v").concat(this.version, "/").concat(url.replace(/^\//, '')), options)];
|
|
121
|
-
case 1:
|
|
122
|
-
response = _b.sent();
|
|
123
|
-
return [4 /*yield*/, response.json()];
|
|
124
|
-
case 2: return [2 /*return*/, _b.sent()];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
Auth.prototype.debug = function () {
|
|
130
|
-
var _a;
|
|
131
|
-
var args = [];
|
|
132
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
133
|
-
args[_i] = arguments[_i];
|
|
134
|
-
}
|
|
135
|
-
((_a = this.options) === null || _a === void 0 ? void 0 : _a.env) === 'dev' && console.debug.apply(console, __spreadArray(['[Auth]'], args, false));
|
|
136
|
-
};
|
|
137
|
-
Auth.prototype.error = function () {
|
|
138
|
-
var args = [];
|
|
139
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
140
|
-
args[_i] = arguments[_i];
|
|
27
|
+
async request({ url, ...options }) {
|
|
28
|
+
const rawOptions = {
|
|
29
|
+
method: 'GET',
|
|
30
|
+
headers: {
|
|
31
|
+
'origin': this.remoteOrigin,
|
|
32
|
+
'de-user-agent': `De.remote/${this.version}.0`
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
if (this.accessToken)
|
|
36
|
+
rawOptions.headers.authorization = `Bearer ${this.accessToken}`;
|
|
37
|
+
if (options.body) {
|
|
38
|
+
rawOptions.headers['content-type'] = 'application/json';
|
|
39
|
+
if (typeof options.body === 'object')
|
|
40
|
+
options.body = JSON.stringify(options.body);
|
|
141
41
|
}
|
|
142
|
-
|
|
143
|
-
|
|
42
|
+
options = { ...rawOptions, ...options };
|
|
43
|
+
this.debug('Auth request', `${this.baseURL}/v${this.version}/${url.replace(/^\//, '')}`, options);
|
|
44
|
+
const response = await fetch(`${this.baseURL}/v${this.version}/${url.replace(/^\//, '')}`, options);
|
|
45
|
+
return await response.json();
|
|
46
|
+
}
|
|
47
|
+
debug(...args) {
|
|
48
|
+
this.env === 'dev' && console.debug('[Auth]', ...args);
|
|
49
|
+
}
|
|
50
|
+
error(...args) {
|
|
51
|
+
console.error('[Auth]', ...args);
|
|
52
|
+
}
|
|
144
53
|
/**
|
|
145
54
|
* Schedule next token rotation
|
|
146
55
|
*/
|
|
147
|
-
|
|
148
|
-
var _this = this;
|
|
56
|
+
scheduleRotation() {
|
|
149
57
|
if (!this.autorefresh)
|
|
150
58
|
return;
|
|
151
59
|
this.clearRotation();
|
|
152
|
-
this.refreshTimer = setTimeout(
|
|
153
|
-
}
|
|
60
|
+
this.refreshTimer = setTimeout(() => this.rotateToken(), ACCESS_TOKEN_EXPIRY * 60 * 1000);
|
|
61
|
+
}
|
|
154
62
|
/**
|
|
155
63
|
* Clear rotation timer
|
|
156
64
|
*/
|
|
157
|
-
|
|
65
|
+
clearRotation() {
|
|
158
66
|
if (!this.refreshTimer)
|
|
159
67
|
return;
|
|
160
68
|
clearTimeout(this.refreshTimer);
|
|
161
69
|
this.refreshTimer = undefined;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
70
|
+
}
|
|
71
|
+
async getToken() {
|
|
72
|
+
const options = {
|
|
73
|
+
url: '/access/token',
|
|
74
|
+
method: 'POST',
|
|
75
|
+
body: { context: this.context, cid: this.cid, secret: this.secret, remoteOrigin: this.remoteOrigin, ...(this.uid ? { uid: this.uid } : {}) }
|
|
76
|
+
}, { error, message, data } = await this.request(options);
|
|
77
|
+
if (error)
|
|
78
|
+
throw new Error(message);
|
|
79
|
+
this.accessToken = data.token;
|
|
80
|
+
this.scheduleRotation(); // Schedule auto-refresh
|
|
81
|
+
return data.token;
|
|
82
|
+
}
|
|
83
|
+
async rotateToken() {
|
|
84
|
+
// Prevent concurrent rotation attempts
|
|
85
|
+
if (this.isRotating) {
|
|
86
|
+
this.debug('Token rotation already in progress, skipping');
|
|
87
|
+
return this.accessToken;
|
|
88
|
+
}
|
|
89
|
+
if (!this.accessToken)
|
|
90
|
+
throw new Error('No access token found');
|
|
91
|
+
this.isRotating = true;
|
|
92
|
+
try {
|
|
93
|
+
const options = {
|
|
94
|
+
url: '/access/token/rotate',
|
|
95
|
+
method: 'PATCH',
|
|
96
|
+
body: { secret: this.secret }
|
|
97
|
+
}, { error, message, data } = await this.request(options);
|
|
98
|
+
if (error)
|
|
99
|
+
throw new Error(message);
|
|
100
|
+
this.accessToken = data.token;
|
|
101
|
+
// Notify callback listener
|
|
102
|
+
if (typeof this.onNewToken === 'function')
|
|
103
|
+
try {
|
|
104
|
+
this.onNewToken(data.token);
|
|
182
105
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
};
|
|
186
|
-
Auth.prototype.rotateToken = function () {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
188
|
-
var options, _a, error, message, token, error_1, newToken, fallbackError_1;
|
|
189
|
-
return __generator(this, function (_b) {
|
|
190
|
-
switch (_b.label) {
|
|
191
|
-
case 0:
|
|
192
|
-
// Prevent concurrent rotation attempts
|
|
193
|
-
if (this.isRotating) {
|
|
194
|
-
this.debug('Token rotation already in progress, skipping');
|
|
195
|
-
return [2 /*return*/, this.accessToken];
|
|
196
|
-
}
|
|
197
|
-
if (!this.accessToken)
|
|
198
|
-
throw new Error('No access token found');
|
|
199
|
-
this.isRotating = true;
|
|
200
|
-
_b.label = 1;
|
|
201
|
-
case 1:
|
|
202
|
-
_b.trys.push([1, 3, 8, 9]);
|
|
203
|
-
options = {
|
|
204
|
-
url: '/access/token/rotate',
|
|
205
|
-
method: 'PATCH',
|
|
206
|
-
body: { secret: this.creds.secret }
|
|
207
|
-
};
|
|
208
|
-
return [4 /*yield*/, this.request(options)];
|
|
209
|
-
case 2:
|
|
210
|
-
_a = _b.sent(), error = _a.error, message = _a.message, token = _a.token;
|
|
211
|
-
if (error)
|
|
212
|
-
throw new Error(message);
|
|
213
|
-
this.accessToken = token;
|
|
214
|
-
// Notify callback listener
|
|
215
|
-
if (typeof this.onNewToken === 'function')
|
|
216
|
-
try {
|
|
217
|
-
this.onNewToken(token);
|
|
218
|
-
}
|
|
219
|
-
catch (callbackError) {
|
|
220
|
-
this.error('[Auth] Error in onNewToken callback:', callbackError);
|
|
221
|
-
}
|
|
222
|
-
// Schedule next rotation
|
|
223
|
-
this.scheduleRotation();
|
|
224
|
-
this.debug('Token rotated successfully');
|
|
225
|
-
return [2 /*return*/, token];
|
|
226
|
-
case 3:
|
|
227
|
-
error_1 = _b.sent();
|
|
228
|
-
this.debug('Refresh access token failed:', error_1.message);
|
|
229
|
-
_b.label = 4;
|
|
230
|
-
case 4:
|
|
231
|
-
_b.trys.push([4, 6, , 7]);
|
|
232
|
-
return [4 /*yield*/, this.getToken()];
|
|
233
|
-
case 5:
|
|
234
|
-
newToken = _b.sent();
|
|
235
|
-
this.debug('Fallback to new token successful');
|
|
236
|
-
// Notify callback listener about new token
|
|
237
|
-
if (this.onNewToken)
|
|
238
|
-
try {
|
|
239
|
-
this.onNewToken(newToken);
|
|
240
|
-
}
|
|
241
|
-
catch (callbackError) {
|
|
242
|
-
this.error('Error in onNewToken callback:', callbackError);
|
|
243
|
-
}
|
|
244
|
-
return [2 /*return*/, newToken];
|
|
245
|
-
case 6:
|
|
246
|
-
fallbackError_1 = _b.sent();
|
|
247
|
-
this.error('Fallback to new token also failed:', fallbackError_1.message);
|
|
248
|
-
throw fallbackError_1;
|
|
249
|
-
case 7: return [3 /*break*/, 9];
|
|
250
|
-
case 8:
|
|
251
|
-
this.isRotating = false;
|
|
252
|
-
return [7 /*endfinally*/];
|
|
253
|
-
case 9: return [2 /*return*/];
|
|
106
|
+
catch (callbackError) {
|
|
107
|
+
this.error('[Auth] Error in onNewToken callback:', callbackError);
|
|
254
108
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
109
|
+
// Schedule next rotation
|
|
110
|
+
this.scheduleRotation();
|
|
111
|
+
this.debug('Token rotated successfully');
|
|
112
|
+
return data.token;
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
this.debug('Refresh access token failed:', error.message);
|
|
116
|
+
try {
|
|
117
|
+
// Fallback: Get new token instead
|
|
118
|
+
const newToken = await this.getToken();
|
|
119
|
+
this.debug('Fallback to new token successful');
|
|
120
|
+
// Notify callback listener about new token
|
|
121
|
+
if (this.onNewToken)
|
|
122
|
+
try {
|
|
123
|
+
this.onNewToken(newToken);
|
|
124
|
+
}
|
|
125
|
+
catch (callbackError) {
|
|
126
|
+
this.error('Error in onNewToken callback:', callbackError);
|
|
127
|
+
}
|
|
128
|
+
return newToken;
|
|
129
|
+
}
|
|
130
|
+
catch (fallbackError) {
|
|
131
|
+
this.error('Fallback to new token also failed:', fallbackError.message);
|
|
132
|
+
throw fallbackError;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
this.isRotating = false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
258
139
|
/**
|
|
259
140
|
* Stop auto-refresh and clean up resources
|
|
260
141
|
*/
|
|
261
|
-
|
|
142
|
+
stopAutoRefresh() {
|
|
262
143
|
this.debug('Stopping auto-refresh');
|
|
263
144
|
this.clearRotation();
|
|
264
145
|
this.autorefresh = false;
|
|
265
|
-
}
|
|
146
|
+
}
|
|
266
147
|
/**
|
|
267
148
|
* Start auto-refresh
|
|
268
149
|
*/
|
|
269
|
-
|
|
150
|
+
startAutoRefresh() {
|
|
270
151
|
this.debug('Starting auto-refresh');
|
|
271
152
|
this.autorefresh = true;
|
|
272
153
|
this.scheduleRotation();
|
|
273
|
-
}
|
|
154
|
+
}
|
|
274
155
|
/**
|
|
275
156
|
* Clean up all resources
|
|
276
157
|
*/
|
|
277
|
-
|
|
158
|
+
destroy() {
|
|
278
159
|
this.debug('Destroying Auth instance');
|
|
279
160
|
this.stopAutoRefresh();
|
|
280
161
|
this.accessToken = undefined;
|
|
281
162
|
this.onNewToken = undefined;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
}());
|
|
163
|
+
}
|
|
164
|
+
}
|
|
285
165
|
exports.default = Auth;
|
|
286
166
|
//# sourceMappingURL=Auth.js.map
|
package/dist/backend/Auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../src/backend/Auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../src/backend/Auth.ts"],"names":[],"mappings":";;AAAA,wCAAoC;AAGpC,MAAM,mBAAmB,GAAG,IAAI,CAAA,CAAC,0BAA0B;AAwC3D,MAAqB,IAAI;IAevB,YAAa,MAAkB;QAHvB,eAAU,GAAY,KAAK,CAAA;QAIjC,IAAI,CAAC,MAAM;YAAW,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;QAC9F,IAAI,CAAC,MAAM,CAAC,OAAO;YAAG,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC/F,IAAI,CAAC,MAAM,CAAC,GAAG;YAAO,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QAC3F,IAAI,CAAC,MAAM,CAAC,MAAM;YAAI,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;QAE9F,IAAI,CAAC,OAAO,GAAQ,MAAM,CAAC,OAAO,CAAA;QAClC,IAAI,CAAC,GAAG,GAAY,MAAM,CAAC,GAAG,CAAA;QAC9B,IAAI,CAAC,GAAG,GAAY,MAAM,CAAC,GAAG,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAS,MAAM,CAAC,MAAM,CAAA;QACjC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAA;QACvC,IAAI,CAAC,GAAG,GAAY,MAAM,CAAC,GAAG,IAAI,KAAK,CAAA;QACvC,IAAI,CAAC,OAAO,GAAQ,MAAM,CAAC,OAAO,IAAI,CAAC,CAAA;QACvC,IAAI,C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AAE,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACtC,IAAI,CAAC,eAAe,EAAE,CAAA;QAEtB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;QAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;CACF;AA9LD,uBA8LC"}
|
package/dist/baseUrl.d.ts
CHANGED
|
@@ -1,12 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service base URLs per environment.
|
|
3
|
+
*
|
|
4
|
+
* Only the `dev` hosts are overridable. A React Native app cannot reach the
|
|
5
|
+
* host machine on `localhost` -- the Android emulator maps it to 10.0.2.2, and
|
|
6
|
+
* a physical device needs the machine's LAN address -- so the platform entry
|
|
7
|
+
* resolves an appropriate host and passes it down as `devHostname`.
|
|
8
|
+
*
|
|
9
|
+
* The resolution deliberately lives in the caller rather than here: importing
|
|
10
|
+
* react-native's `Platform` at this level would drag the whole framework into
|
|
11
|
+
* the Node and browser builds.
|
|
12
|
+
*/
|
|
13
|
+
declare const DEV_PORTS: {
|
|
14
|
+
ASI: number;
|
|
15
|
+
RTS: number;
|
|
16
|
+
API: number;
|
|
17
|
+
IOT: number;
|
|
18
|
+
WSP: number;
|
|
19
|
+
};
|
|
1
20
|
export declare const ASI_SERVER_BASEURL: {
|
|
2
21
|
dev: string;
|
|
22
|
+
staging: string;
|
|
23
|
+
prod: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const RTS_SERVER_BASEURL: {
|
|
26
|
+
dev: string;
|
|
27
|
+
staging: string;
|
|
3
28
|
prod: string;
|
|
4
29
|
};
|
|
5
30
|
export declare const API_SERVER_BASEURL: {
|
|
6
31
|
dev: string;
|
|
32
|
+
staging: string;
|
|
33
|
+
prod: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* de.workspace — the control plane, a separate service from de.arch.
|
|
37
|
+
*
|
|
38
|
+
* It is not reachable through the API host: de.arch serves no `/workspace`
|
|
39
|
+
* routes, so a client pointed there gets 404 for the whole surface.
|
|
40
|
+
*
|
|
41
|
+
* The staging and production hosts follow the naming of the other services
|
|
42
|
+
* (auth.dedot.io, iot.dedot.io). Confirm them against the deployment before
|
|
43
|
+
* relying on them, and pass `baseUrl` to address a host that differs — which
|
|
44
|
+
* is also what a self-hosted De. needs, and what a dev machine running
|
|
45
|
+
* de.workspace on a port other than 22200 needs.
|
|
46
|
+
*/
|
|
47
|
+
export declare const WSP_SERVER_BASEURL: {
|
|
48
|
+
dev: string;
|
|
49
|
+
staging: string;
|
|
7
50
|
prod: string;
|
|
8
51
|
};
|
|
9
52
|
export declare const IOT_SERVER_BASEURL: {
|
|
10
53
|
dev: string;
|
|
54
|
+
staging: string;
|
|
11
55
|
prod: string;
|
|
12
56
|
};
|
|
57
|
+
export type ServerEnv = 'dev' | 'staging' | 'prod';
|
|
58
|
+
export type ServerName = keyof typeof DEV_PORTS;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve a service's base URL for an environment.
|
|
61
|
+
*
|
|
62
|
+
* @param server - Which service to address
|
|
63
|
+
* @param env - (Default: `dev`) Target environment
|
|
64
|
+
* @param devHostname - (Optional) Host to substitute for `localhost` in `dev`
|
|
65
|
+
* @return - Base URL
|
|
66
|
+
*/
|
|
67
|
+
export declare function baseURL(server: ServerName, env?: ServerEnv, devHostname?: string): string;
|
|
68
|
+
export {};
|
package/dist/baseUrl.js
CHANGED
|
@@ -1,16 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Service base URLs per environment.
|
|
4
|
+
*
|
|
5
|
+
* Only the `dev` hosts are overridable. A React Native app cannot reach the
|
|
6
|
+
* host machine on `localhost` -- the Android emulator maps it to 10.0.2.2, and
|
|
7
|
+
* a physical device needs the machine's LAN address -- so the platform entry
|
|
8
|
+
* resolves an appropriate host and passes it down as `devHostname`.
|
|
9
|
+
*
|
|
10
|
+
* The resolution deliberately lives in the caller rather than here: importing
|
|
11
|
+
* react-native's `Platform` at this level would drag the whole framework into
|
|
12
|
+
* the Node and browser builds.
|
|
13
|
+
*/
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IOT_SERVER_BASEURL = exports.API_SERVER_BASEURL = exports.ASI_SERVER_BASEURL = void 0;
|
|
15
|
+
exports.IOT_SERVER_BASEURL = exports.WSP_SERVER_BASEURL = exports.API_SERVER_BASEURL = exports.RTS_SERVER_BASEURL = exports.ASI_SERVER_BASEURL = void 0;
|
|
16
|
+
exports.baseURL = baseURL;
|
|
17
|
+
const DEV_PORTS = {
|
|
18
|
+
ASI: 44000,
|
|
19
|
+
RTS: 24800,
|
|
20
|
+
API: 24800,
|
|
21
|
+
IOT: 11011,
|
|
22
|
+
WSP: 22200
|
|
23
|
+
};
|
|
4
24
|
exports.ASI_SERVER_BASEURL = {
|
|
5
|
-
dev:
|
|
25
|
+
dev: `http://localhost:${DEV_PORTS.ASI}`,
|
|
26
|
+
staging: 'https://auth.staging.dedot.io',
|
|
6
27
|
prod: 'https://auth.dedot.io'
|
|
7
28
|
};
|
|
29
|
+
// Realtime Socket
|
|
30
|
+
exports.RTS_SERVER_BASEURL = {
|
|
31
|
+
dev: `http://localhost:${DEV_PORTS.RTS}`,
|
|
32
|
+
staging: 'https://api.staging.dedot.io',
|
|
33
|
+
prod: 'https://api.dedot.io'
|
|
34
|
+
};
|
|
8
35
|
exports.API_SERVER_BASEURL = {
|
|
9
|
-
dev:
|
|
36
|
+
dev: `http://localhost:${DEV_PORTS.API}`,
|
|
37
|
+
staging: 'https://api.staging.dedot.io',
|
|
10
38
|
prod: 'https://api.dedot.io'
|
|
11
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* de.workspace — the control plane, a separate service from de.arch.
|
|
42
|
+
*
|
|
43
|
+
* It is not reachable through the API host: de.arch serves no `/workspace`
|
|
44
|
+
* routes, so a client pointed there gets 404 for the whole surface.
|
|
45
|
+
*
|
|
46
|
+
* The staging and production hosts follow the naming of the other services
|
|
47
|
+
* (auth.dedot.io, iot.dedot.io). Confirm them against the deployment before
|
|
48
|
+
* relying on them, and pass `baseUrl` to address a host that differs — which
|
|
49
|
+
* is also what a self-hosted De. needs, and what a dev machine running
|
|
50
|
+
* de.workspace on a port other than 22200 needs.
|
|
51
|
+
*/
|
|
52
|
+
exports.WSP_SERVER_BASEURL = {
|
|
53
|
+
dev: `http://localhost:${DEV_PORTS.WSP}`,
|
|
54
|
+
staging: 'https://workspace.staging.dedot.io',
|
|
55
|
+
prod: 'https://workspace.dedot.io'
|
|
56
|
+
};
|
|
12
57
|
exports.IOT_SERVER_BASEURL = {
|
|
13
|
-
dev:
|
|
58
|
+
dev: `http://localhost:${DEV_PORTS.IOT}`,
|
|
59
|
+
staging: 'https://iot.staging.dedot.io',
|
|
14
60
|
prod: 'https://iot.dedot.io'
|
|
15
61
|
};
|
|
62
|
+
const BASEURLS = {
|
|
63
|
+
ASI: exports.ASI_SERVER_BASEURL,
|
|
64
|
+
RTS: exports.RTS_SERVER_BASEURL,
|
|
65
|
+
API: exports.API_SERVER_BASEURL,
|
|
66
|
+
IOT: exports.IOT_SERVER_BASEURL,
|
|
67
|
+
WSP: exports.WSP_SERVER_BASEURL
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Resolve a service's base URL for an environment.
|
|
71
|
+
*
|
|
72
|
+
* @param server - Which service to address
|
|
73
|
+
* @param env - (Default: `dev`) Target environment
|
|
74
|
+
* @param devHostname - (Optional) Host to substitute for `localhost` in `dev`
|
|
75
|
+
* @return - Base URL
|
|
76
|
+
*/
|
|
77
|
+
function baseURL(server, env = 'dev', devHostname) {
|
|
78
|
+
const url = BASEURLS[server][env];
|
|
79
|
+
// Staging and production are fixed hosts -- an override there is meaningless
|
|
80
|
+
return env === 'dev' && devHostname
|
|
81
|
+
? `http://${devHostname}:${DEV_PORTS[server]}`
|
|
82
|
+
: url;
|
|
83
|
+
}
|
|
16
84
|
//# sourceMappingURL=baseUrl.js.map
|
package/dist/baseUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseUrl.js","sourceRoot":"","sources":["../src/baseUrl.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"baseUrl.js","sourceRoot":"","sources":["../src/baseUrl.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAoEH,0BAOC;AAzED,MAAM,SAAS,GAAG;IACjB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;CACV,CAAA;AAEY,QAAA,kBAAkB,GAAG;IACjC,GAAG,EAAM,oBAAoB,SAAS,CAAC,GAAG,EAAE;IAC5C,OAAO,EAAE,+BAA+B;IACxC,IAAI,EAAK,uBAAuB;CAChC,CAAA;AACD,kBAAkB;AACL,QAAA,kBAAkB,GAAG;IACjC,GAAG,EAAM,oBAAoB,SAAS,CAAC,GAAG,EAAE;IAC5C,OAAO,EAAE,8BAA8B;IACvC,IAAI,EAAK,sBAAsB;CAC/B,CAAA;AACY,QAAA,kBAAkB,GAAG;IACjC,GAAG,EAAM,oBAAoB,SAAS,CAAC,GAAG,EAAE;IAC5C,OAAO,EAAE,8BAA8B;IACvC,IAAI,EAAK,sBAAsB;CAC/B,CAAA;AACD;;;;;;;;;;;GAWG;AACU,QAAA,kBAAkB,GAAG;IACjC,GAAG,EAAM,oBAAoB,SAAS,CAAC,GAAG,EAAE;IAC5C,OAAO,EAAE,oCAAoC;IAC7C,IAAI,EAAK,4BAA4B;CACrC,CAAA;AACY,QAAA,kBAAkB,GAAG;IACjC,GAAG,EAAM,oBAAoB,SAAS,CAAC,GAAG,EAAE;IAC5C,OAAO,EAAE,8BAA8B;IACvC,IAAI,EAAK,sBAAsB;CAC/B,CAAA;AAKD,MAAM,QAAQ,GAAG;IAChB,GAAG,EAAE,0BAAkB;IACvB,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