Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tardis-machine

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tardis-machine - npm Package Compare versions

Comparing version 3.3.10 to 3.3.11

3

dist/tardismachine.js

@@ -15,2 +15,5 @@ "use strict";

class TardisMachine {
options;
_httpServer;
_wsServer;
constructor(options) {

@@ -17,0 +20,0 @@ this.options = options;

11

dist/ws/replay.js

@@ -43,6 +43,5 @@ "use strict";

class ReplaySession {
_connections = [];
_hasStarted = false;
constructor() {
this._connections = [];
this._hasStarted = false;
this._onFinishedCallback = () => { };
const SESSION_START_DELAY_MS = 2000;

@@ -64,2 +63,3 @@ debug_1.debug('creating new ReplaySession');

}
_onFinishedCallback = () => { };
async _start() {

@@ -147,5 +147,8 @@ try {

class WebsocketConnection {
ws;
replayOptions;
_subscriptionsMapper;
subscriptionsCount = 0;
constructor(ws, exchange, from, to) {
this.ws = ws;
this.subscriptionsCount = 0;
this.replayOptions = {

@@ -152,0 +155,0 @@ exchange,

@@ -360,2 +360,70 @@ "use strict";

};
const ascendexMapper = {
canHandle: (message) => {
return message.op === 'sub' || message.op === 'req';
},
map: (message) => {
const channel = message.action || message.ch.split(':')[0];
const symbol = (message.args && message.args.symbol) || message.ch.split(':')[1];
return [
{
channel,
symbols: symbol ? [symbol] : []
}
];
}
};
const dydxMapper = {
canHandle: (message) => {
return message.type === 'subscribe';
},
map: (message) => {
return [
{
channel: message.channel,
symbols: message.id ? [message.id] : []
}
];
}
};
const upbitMapper = {
canHandle: (message) => {
return Array.isArray(message);
},
map: (message) => {
return message
.filter((m) => {
return m.type !== undefined;
})
.map((m) => {
return {
channel: m.type,
symbols: m.codes
};
});
}
};
const serumMaper = {
canHandle: (message) => {
return message.op === 'subscribe';
},
map: (message) => {
const finalChannels = [];
const channelMappings = {
trades: ['recent_trades', 'trade'],
level1: ['quote'],
level2: ['l2snapshot', 'l2update'],
level3: ['l3snapshot', 'open', 'fill', 'change', 'done']
};
const symbols = message.markets;
const mappedChannels = channelMappings[message.channel];
mappedChannels.forEach((channel) => {
finalChannels.push({
channel,
symbols
});
});
return finalChannels;
}
};
exports.subscriptionsMappers = {

@@ -396,4 +464,10 @@ bitmex: bitmexMapper,

'gate-io-futures': gateIOFuturesMapper,
poloniex: poloniexMapper
poloniex: poloniexMapper,
ascendex: ascendexMapper,
dydx: dydxMapper,
'huobi-dm-options': huobiMapper,
'binance-options': binanceMapper,
upbit: upbitMapper,
serum: serumMaper
};
//# sourceMappingURL=subscriptionsmappers.js.map
{
"name": "tardis-machine",
"version": "3.3.10",
"version": "3.3.11",
"engines": {

@@ -61,3 +61,3 @@ "node": ">=12"

"is-docker": "^2.2.1",
"tardis-dev": "^12.5.3",
"tardis-dev": "^12.5.8",
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v19.2.0",

@@ -70,9 +70,9 @@ "yargs": "^17.0.1"

"@types/jest": "^26.0.23",
"@types/node": "^15.3.0",
"@types/node": "^15.6.1",
"@types/node-fetch": "^2.5.10",
"@types/split2": "^3.2.0",
"@types/yargs": "^16.0.1",
"@types/yargs": "^17.0.0",
"cross-var": "^1.1.0",
"husky": "^6.0.0",
"jest": "^26.6.3",
"jest": "^27.0.3",
"lint-staged": "^11.0.0",

@@ -82,4 +82,4 @@ "node-fetch": "^2.6.1",

"split2": "^3.2.2",
"ts-jest": "^26.5.6",
"typescript": "^4.2.4"
"ts-jest": "^27.0.2",
"typescript": "^4.3.2"
},

@@ -86,0 +86,0 @@ "lint-staged": {

@@ -416,2 +416,82 @@ import { Exchange, Filter } from 'tardis-dev'

const ascendexMapper: SubscriptionMapper = {
canHandle: (message: any) => {
return message.op === 'sub' || message.op === 'req'
},
map: (message: any) => {
const channel = message.action || message.ch.split(':')[0]
const symbol = (message.args && message.args.symbol) || message.ch.split(':')[1]
return [
{
channel,
symbols: symbol ? [symbol] : []
}
]
}
}
const dydxMapper: SubscriptionMapper = {
canHandle: (message: any) => {
return message.type === 'subscribe'
},
map: (message: any) => {
return [
{
channel: message.channel,
symbols: message.id ? [message.id] : []
}
]
}
}
const upbitMapper: SubscriptionMapper = {
canHandle: (message: any) => {
return Array.isArray(message)
},
map: (message: any) => {
return message
.filter((m: any) => {
return m.type !== undefined
})
.map((m: any) => {
return {
channel: m.type,
symbols: m.codes
}
})
}
}
const serumMaper: SubscriptionMapper = {
canHandle: (message: any) => {
return message.op === 'subscribe'
},
map: (message: any) => {
const finalChannels: Filter<any>[] = []
const channelMappings = {
trades: ['recent_trades', 'trade'],
level1: ['quote'],
level2: ['l2snapshot', 'l2update'],
level3: ['l3snapshot', 'open', 'fill', 'change', 'done']
}
const symbols = message.markets
const mappedChannels = (channelMappings as any)[message.channel]
mappedChannels.forEach((channel: string) => {
finalChannels.push({
channel,
symbols
})
})
return finalChannels
}
}
export const subscriptionsMappers: { [key in Exchange]: SubscriptionMapper } = {

@@ -452,3 +532,9 @@ bitmex: bitmexMapper,

'gate-io-futures': gateIOFuturesMapper,
poloniex: poloniexMapper
poloniex: poloniexMapper,
ascendex: ascendexMapper,
dydx: dydxMapper,
'huobi-dm-options': huobiMapper,
'binance-options': binanceMapper,
upbit: upbitMapper,
serum: serumMaper
}

@@ -455,0 +541,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc