Skip to content

Commit

Permalink
build: clientjs-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
juancgalvis committed Feb 13, 2025
1 parent 32edcae commit c98f592
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 28 deletions.
9 changes: 1 addition & 8 deletions clients/client-js/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
sonar.projectKey=bancolombia_async-dataflow-client-js
sonar.organization=grupo-bancolombia
sonar.projectName=async-dataflow-client-js
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.sources=src
sonar.tests=test


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
6 changes: 3 additions & 3 deletions clients/client-js/src/async-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { ChannelMessage } from "./channel-message";
export class AsyncClient {
private currentTransport: Transport;
private currentTransportIndex: number = 0;
private bindings = [];
private cache: Cache = undefined;
private readonly bindings = [];
private readonly cache: Cache = undefined;
private closeWasClean: boolean = false;
private retriesByTransport = 0;

constructor(private config: AsyncConfig, private transports: Array<string> | null, private mockTransport: any = null) {
constructor(private readonly config: AsyncConfig, private readonly transports: Array<string> | null, private readonly mockTransport: any = null) {
if (!config.dedupCacheDisable) {
this.cache = new Cache(config.dedupCacheMaxSize, config.dedupCacheTtl);
}
Expand Down
2 changes: 1 addition & 1 deletion clients/client-js/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LRUCache } from 'lru-cache'

export class Cache {

private cacheImpl: LRUCache<string, string, any>;
private readonly cacheImpl: LRUCache<string, string, any>;

private static readonly MAX_SIZE = 100;
private static readonly DEFAULT_MAX_ELEMENTS = 500;
Expand Down
2 changes: 1 addition & 1 deletion clients/client-js/src/decoder/binary-decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MessageDecoder } from "./message-decoder";

export class BinaryDecoder implements MessageDecoder {

private textDecoder: TextDecoder;
private readonly textDecoder: TextDecoder;

constructor() {
this.textDecoder = new TextDecoder();
Expand Down
10 changes: 5 additions & 5 deletions clients/client-js/src/retry-timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export class RetryTimer {
private limitReachedNotified: boolean = false;

constructor(
private callback: () => void,
private initial: number = 10,
private jitterFn: (x: number) => number,
private maxRetries: number = 10,
private limitReachedCallback: () => void = () => { }) {
private readonly callback: () => void,
private readonly initial: number = 10,
private readonly jitterFn: (x: number) => number,
private readonly maxRetries: number = 10,
private readonly limitReachedCallback: () => void = () => { }) {
}

public reset(): void {
Expand Down
8 changes: 4 additions & 4 deletions clients/client-js/src/transport/sse-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class SseTransport implements Transport {

private actualToken;
private eventSource: EventSourcePlus;
private serializer: MessageDecoder;
private readonly serializer: MessageDecoder;
private errorCount = 0;
private controller: EventSourceController;
private tokenUpdated: boolean = false;
Expand All @@ -25,9 +25,9 @@ export class SseTransport implements Transport {
return new SseTransport(config, handleMessage, errorCallback, transport);
}

private constructor(private config: AsyncConfig,
private handleMessage: (_message: ChannelMessage) => void,
private errorCallback: (_error: TransportError) => void,
private constructor(private readonly config: AsyncConfig,
private readonly handleMessage: (_message: ChannelMessage) => void,
private readonly errorCallback: (_error: TransportError) => void,
private readonly transport: typeof EventSourcePlus) {
this.serializer = new JsonDecoder();
this.actualToken = config.channel_secret;
Expand Down
12 changes: 6 additions & 6 deletions clients/client-js/src/transport/ws-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ export class WsTransport implements Transport {
private socket: WebSocket;
public isOpen: boolean = false;
public isActive: boolean = false;
private stateCallbacks = { open: [], close: [], error: [], message: [] }
private readonly stateCallbacks = { open: [], close: [], error: [], message: [] }
private ref = 0;
private pendingHeartbeatRef: string = null;
private closeWasClean: boolean = false;
private heartbeatTimer = null;
private readonly heartbeatIntervalMs: number;
private tearingDown: boolean = false;
private reconnectTimer: RetryTimer;
private readonly reconnectTimer: RetryTimer;
private serializer: MessageDecoder;
private subProtocols: string[] = [Protocol.JSON]
private readonly subProtocols: string[] = [Protocol.JSON]

private readonly HEARTBEAT_TIMEOUT = 3051;

Expand All @@ -34,9 +34,9 @@ export class WsTransport implements Transport {
return new WsTransport(config, handleMessage, errorCallback, transport);
}

private constructor(private config: AsyncConfig,
private handleMessage: (_message: ChannelMessage) => void,
private errorCallback: (_error: TransportError) => void,
private constructor(private readonly config: AsyncConfig,
private readonly handleMessage: (_message: ChannelMessage) => void,
private readonly errorCallback: (_error: TransportError) => void,
private readonly transport: any = null) {

const intWindow = typeof window !== "undefined" ? window : null;
Expand Down

0 comments on commit c98f592

Please sign in to comment.