Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecsl committed Jan 26, 2025
1 parent 2214252 commit 6be1773
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
23 changes: 19 additions & 4 deletions src/client/realWsJsonClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ import {
RawPayloadResponse,
WsJsonRawMessage,
} from "./tdaWsJsonTypes.js";
import { Constructor, debugLog, findByTypeOrThrow, throwError } from "./util.js";
import { isConnectionResponse, isLoginResponse, isSchwabLoginResponse } from "./messageTypeHelpers.js";
import {
Constructor,
debugLog,
findByTypeOrThrow,
throwError,
} from "./util.js";
import {
isConnectionResponse,
isLoginResponse,
isSchwabLoginResponse,
} from "./messageTypeHelpers.js";
import { deferredWrap } from "obgen";
import debug from "debug";
import { Observable, BufferedIterator, MulticastIterator } from "obgen";
Expand Down Expand Up @@ -191,7 +200,10 @@ export default class RealWsJsonClient implements WsJsonClient {
const message = JSON.parse(data) as WsJsonRawMessage;
logger("⬅️\treceived %O", message);
if (isConnectionResponse(message)) {
const handler = findByTypeOrThrow(messageHandlers, SchwabLoginMessageHandler);
const handler = findByTypeOrThrow(
messageHandlers,
SchwabLoginMessageHandler
);
if (!accessToken) {
throwError("access token is required, cannot authenticate");
}
Expand Down Expand Up @@ -355,7 +367,10 @@ export default class RealWsJsonClient implements WsJsonClient {
resolve: (value: RawLoginResponseBody) => void,
reject: (reason?: string) => void
) {
const handler = findByTypeOrThrow(messageHandlers, SchwabLoginMessageHandler);
const handler = findByTypeOrThrow(
messageHandlers,
SchwabLoginMessageHandler
);
const loginResponse = handler.parseResponse(message as RawPayloadResponse);
const [{ body }] = message.payload;
if (loginResponse.authenticated) {
Expand Down
3 changes: 0 additions & 3 deletions src/client/services/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ export type ApiService =
| "market_depth"
| "watchlist/get"
| "fake"; // testing only

// make node happy
export const __internalMarker = true
5 changes: 1 addition & 4 deletions src/client/services/schwabLoginMessageHandler.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import WebSocketApiMessageHandler, {
newPayload,
} from "../services/webSocketApiMessageHandler.js";
import {
RawPayloadRequest,
RawPayloadResponse,
} from "../tdaWsJsonTypes.js";
import { RawPayloadRequest, RawPayloadResponse } from "../tdaWsJsonTypes.js";
import { ApiService } from "../services/apiService.js";

export type SchwabLoginResponse = {
Expand Down
5 changes: 4 additions & 1 deletion src/server/wsJsonServerProxy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import ws from "ws";
import debug from "debug";
import { ProxiedRequest, ProxiedResponse } from "../client/wsJsonClientProxy.js";
import {
ProxiedRequest,
ProxiedResponse,
} from "../client/wsJsonClientProxy.js";
import { WsJsonClient } from "../client/wsJsonClient.js";
import { Disposable } from "./disposable.js";

Expand Down

0 comments on commit 6be1773

Please sign in to comment.