@zum/flash-client
Advanced tools
Comparing version 0.0.23 to 0.0.24
@@ -36,3 +36,3 @@ "use strict"; | ||
}; | ||
return socket_io_client_1.io(this.config.baseUrl, opts); | ||
return (0, socket_io_client_1.io)(this.config.baseUrl, opts); | ||
}; | ||
@@ -63,3 +63,3 @@ this.setAuthorizationHeader = () => { | ||
this.socket = this.newConnection(); | ||
this.commandQueue = async_1.queue((operationArgument, operationCompleteHandler) => { | ||
this.commandQueue = (0, async_1.queue)((operationArgument, operationCompleteHandler) => { | ||
console.log(`[Flash] Command: ${JSON.stringify(operationArgument)}`); | ||
@@ -66,0 +66,0 @@ this.socket.emit(operationArgument.operation, operationArgument.args, (response) => { |
@@ -26,8 +26,8 @@ "use strict"; | ||
const subscribeToRides = (topic, rideIds, getRideDetail) => { | ||
const ridesObservable = initializer_1.getSubscriptionManager().subscribe(topic, rideIds); | ||
const ridesObservable = (0, initializer_1.getSubscriptionManager)().subscribe(topic, rideIds); | ||
const ridesObservableSubject = new rxjs_1.Subject(); | ||
const ridesObservableSubscription = ridesObservable.subscribe(ridesObservableSubject); | ||
const rideObservableArray = rideIds.map((rideId) => { | ||
return ridesObservableSubject.pipe(operators_1.filter((event) => event.entityId === rideId), operators_1.throttleTime(DEFAULT_THROTTLE_MS, rxjs_1.asyncScheduler, throttleConfig), operators_1.switchMap((event) => { | ||
return getRideDetail(event.entityId).pipe(operators_1.map((ride) => { | ||
return ridesObservableSubject.pipe((0, operators_1.filter)((event) => event.entityId === rideId), (0, operators_1.throttleTime)(DEFAULT_THROTTLE_MS, rxjs_1.asyncScheduler, throttleConfig), (0, operators_1.switchMap)((event) => { | ||
return getRideDetail(event.entityId).pipe((0, operators_1.map)((ride) => { | ||
return { rideId: event.entityId, result: ride }; | ||
@@ -43,13 +43,13 @@ })); | ||
}); | ||
return rxjs_1.merge(...rideObservableArray, tearDownObservable); | ||
return (0, rxjs_1.merge)(...rideObservableArray, tearDownObservable); | ||
}; | ||
const subscribeToRideRouteTrace = (rideId, getRideTraceLastFetchIndex, getActiveRideTrace) => { | ||
return initializer_1.getSubscriptionManager() | ||
return (0, initializer_1.getSubscriptionManager)() | ||
.subscribe(topicTypes_1.FlashTopic.ROUTE_TRACE, [rideId]) | ||
.pipe(operators_1.throttleTime(DEFAULT_THROTTLE_MS, rxjs_1.asyncScheduler, throttleConfig), operators_1.switchMap((event) => { | ||
return getRideTraceLastFetchIndex().pipe(operators_1.switchMap((traceLastFetchIndex) => getActiveRideTrace({ | ||
.pipe((0, operators_1.throttleTime)(DEFAULT_THROTTLE_MS, rxjs_1.asyncScheduler, throttleConfig), (0, operators_1.switchMap)((event) => { | ||
return getRideTraceLastFetchIndex().pipe((0, operators_1.switchMap)((traceLastFetchIndex) => getActiveRideTrace({ | ||
rideId: event.entityId, | ||
skip: traceLastFetchIndex, | ||
}))); | ||
}), operators_1.map((traces) => ({ rideId, result: traces }))); | ||
}), (0, operators_1.map)((traces) => ({ rideId, result: traces }))); | ||
}; | ||
@@ -60,4 +60,4 @@ exports.subscribeToRideRouteTrace = subscribeToRideRouteTrace; | ||
const subscribeToRideLocation = (rideIds) => { | ||
const ridesLocationObservable = initializer_1.getSubscriptionManager().subscribe(topicTypes_1.FlashTopic.RIDE_LOCATION, rideIds); | ||
return ridesLocationObservable.pipe(operators_1.filter((event) => !!event.data), operators_1.map((event) => { | ||
const ridesLocationObservable = (0, initializer_1.getSubscriptionManager)().subscribe(topicTypes_1.FlashTopic.RIDE_LOCATION, rideIds); | ||
return ridesLocationObservable.pipe((0, operators_1.filter)((event) => !!event.data), (0, operators_1.map)((event) => { | ||
return event.data; | ||
@@ -70,4 +70,4 @@ })); | ||
const subscribeToRideStatus = () => { | ||
const ridesStatusObservable = initializer_1.getSubscriptionManager().subscribe(topicTypes_1.FlashTopic.RIDE_STATUS, []); | ||
return ridesStatusObservable.pipe(operators_1.filter((event) => !!event.data), operators_1.map((event) => { | ||
const ridesStatusObservable = (0, initializer_1.getSubscriptionManager)().subscribe(topicTypes_1.FlashTopic.RIDE_STATUS, []); | ||
return ridesStatusObservable.pipe((0, operators_1.filter)((event) => !!event.data), (0, operators_1.map)((event) => { | ||
return event.data; | ||
@@ -80,4 +80,4 @@ })); | ||
const unsubscribe = (topic) => { | ||
return initializer_1.getSubscriptionManager().unsubscribeTopic(topic); | ||
return (0, initializer_1.getSubscriptionManager)().unsubscribeTopic(topic); | ||
}; | ||
//# sourceMappingURL=ride.js.map |
@@ -36,4 +36,4 @@ import { Observable } from 'rxjs'; | ||
rideId: string; | ||
rideStatus: 'IN_PROGRESS' | 'COMPLETED'; | ||
rideStatus: 'CREATED' | 'DRIVER_ASSIGNED' | 'DRIVER_ACCEPTED' | 'DRIVER_UNASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELED'; | ||
}; | ||
//# sourceMappingURL=ride.d.ts.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
const connect = (config) => { | ||
exports.disconnect(); | ||
(0, exports.disconnect)(); | ||
const flashSocket = new flashSocket_1.FlashSocket(config); | ||
@@ -18,0 +18,0 @@ subscriptionManager = new subscriptionManager_1.SubscriptionManager(flashSocket); |
@@ -6,4 +6,6 @@ export declare enum FlashTopic { | ||
RIDE_LOCATION = "RIDE_LOCATION", | ||
RIDE_STATUS = "RIDE_STATUS" | ||
RIDE_STATUS = "RIDE_STATUS", | ||
TASK_LIST = "TASK_LIST", | ||
DRIVER_BUS_REPORT = "DRIVER_BUS_REPORT" | ||
} | ||
//# sourceMappingURL=topicTypes.d.ts.map |
@@ -11,3 +11,5 @@ "use strict"; | ||
FlashTopic["RIDE_STATUS"] = "RIDE_STATUS"; | ||
FlashTopic["TASK_LIST"] = "TASK_LIST"; | ||
FlashTopic["DRIVER_BUS_REPORT"] = "DRIVER_BUS_REPORT"; | ||
})(FlashTopic = exports.FlashTopic || (exports.FlashTopic = {})); | ||
//# sourceMappingURL=topicTypes.js.map |
@@ -83,3 +83,3 @@ import { AsyncQueue, queue } from 'async'; | ||
}); | ||
} catch (e) { | ||
} catch (e: any) { | ||
console.error(`[Flash] Unable to get the access token, possibly forgot to disconnect on logout`, e); | ||
@@ -86,0 +86,0 @@ this.disconnect(); |
@@ -92,3 +92,3 @@ import { Observable, Subscriber } from 'rxjs'; | ||
} | ||
} catch (e) { | ||
} catch (e: any) { | ||
subscriber.error(e); | ||
@@ -95,0 +95,0 @@ this.subscriptions.delete(topic); |
@@ -32,3 +32,10 @@ import { Observable } from 'rxjs'; | ||
rideId: string; | ||
rideStatus: 'IN_PROGRESS' | 'COMPLETED'; | ||
rideStatus: | ||
| 'CREATED' | ||
| 'DRIVER_ASSIGNED' | ||
| 'DRIVER_ACCEPTED' | ||
| 'DRIVER_UNASSIGNED' | ||
| 'IN_PROGRESS' | ||
| 'COMPLETED' | ||
| 'CANCELED'; | ||
}; |
@@ -7,2 +7,4 @@ export enum FlashTopic { | ||
RIDE_STATUS = 'RIDE_STATUS', | ||
TASK_LIST = 'TASK_LIST', | ||
DRIVER_BUS_REPORT = 'DRIVER_BUS_REPORT' | ||
} |
{ | ||
"name": "@zum/flash-client", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"description": "Client for connecting to Zum Flash server", | ||
@@ -5,0 +5,0 @@ "license": "UNLICENSED", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69
1085
131580