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

tardis-dev

Package Overview
Dependencies
Maintainers
1
Versions
272
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tardis-dev - npm Package Compare versions

Comparing version 7.7.8 to 7.7.9

1

dist/options.d.ts

@@ -7,4 +7,5 @@ export declare function init(initOptions?: Partial<Options>): void;

apiKey: string;
_userAgent: string;
};
export {};
//# sourceMappingURL=options.d.ts.map

6

dist/options.js

@@ -8,7 +8,8 @@ "use strict";

const path_1 = __importDefault(require("path"));
const debug_1 = require("./debug");
const pkg = require('../package.json');
const defaultOptions = {
endpoint: 'https://api.tardis.dev/v1',
cacheDir: path_1.default.join(os_1.default.tmpdir(), '.tardis-cache'),
apiKey: ''
apiKey: '',
_userAgent: `tardis-dev/${pkg.version} (+https://github.com/tardis-dev/tardis-node)`
};

@@ -18,3 +19,2 @@ let options = { ...defaultOptions };

options = { ...defaultOptions, ...initOptions };
debug_1.debug('initialized with: %o', options);
}

@@ -21,0 +21,0 @@ exports.init = init;

@@ -14,2 +14,3 @@ "use strict";

const handy_1 = require("./handy");
const mappers_1 = require("./mappers");
const options_1 = require("./options");

@@ -29,2 +30,3 @@ async function* replay({ exchange, from, to, filters, skipDecoding = undefined, withDisconnects = undefined, apiKey = undefined }) {

apiKey: apiKey || options.apiKey,
userAgent: options._userAgent,
fromDate,

@@ -129,2 +131,3 @@ toDate,

const fromDate = handy_1.parseAsUTCDate(from);
validateReplayNormalizedOptions(fromDate, normalizers);
const createMappers = (localTimestamp) => normalizers.map(m => m(exchange, localTimestamp));

@@ -175,2 +178,9 @@ const nonFilterableExchanges = ['bitfinex', 'bitfinex-derivatives'];

}
function validateReplayNormalizedOptions(fromDate, normalizers) {
const hasBookChangeNormalizer = normalizers.some(n => n === mappers_1.normalizeBookChanges);
const dateDoesNotStartAtTheBeginningOfTheDay = fromDate.getUTCHours() !== 0 || fromDate.getUTCMinutes() !== 0;
if (hasBookChangeNormalizer && dateDoesNotStartAtTheBeginningOfTheDay) {
throw new Error(`Invalid "from" argument: ${fromDate.toISOString()}. Please provide date string starting at 00:00 UTC as otherwise initial book snapshots won't be available.`);
}
}
//# sourceMappingURL=replay.js.map

@@ -10,2 +10,3 @@ import { Exchange, Filter } from './types';

apiKey: string;
userAgent: string;
fromDate: Date;

@@ -12,0 +13,0 @@ toDate: Date;

@@ -98,3 +98,3 @@ "use strict";

}
async function reliablyFetchAndCacheSlice({ exchange, fromDate, endpoint, apiKey }, offset, filters, sliceCachePath) {
async function reliablyFetchAndCacheSlice({ exchange, fromDate, endpoint, apiKey, userAgent }, offset, filters, sliceCachePath) {
let url = `${endpoint}/data-feeds/${exchange}?from=${fromDate.toISOString()}&offset=${offset}`;

@@ -109,2 +109,3 @@ if (filters.length > 0) {

'Accept-Encoding': 'gzip',
'User-Agent': userAgent,
Authorization: apiKey ? `Bearer ${apiKey}` : ''

@@ -111,0 +112,0 @@ }

{
"name": "tardis-dev",
"version": "7.7.8",
"version": "7.7.9",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=12"

import os from 'os'
import path from 'path'
import { debug } from './debug'
const pkg = require('../package.json')

@@ -8,3 +8,4 @@ const defaultOptions: Options = {

cacheDir: path.join(os.tmpdir(), '.tardis-cache'),
apiKey: ''
apiKey: '',
_userAgent: `tardis-dev/${pkg.version} (+https://github.com/tardis-dev/tardis-node)`
}

@@ -16,4 +17,2 @@

options = { ...defaultOptions, ...initOptions }
debug('initialized with: %o', options)
}

@@ -29,2 +28,3 @@

apiKey: string
_userAgent: string
}

@@ -9,3 +9,3 @@ import { createReadStream } from 'fs-extra'

import { getFilters, normalizeMessages, parseAsUTCDate, wait } from './handy'
import { MapperFactory } from './mappers'
import { MapperFactory, normalizeBookChanges } from './mappers'
import { getOptions } from './options'

@@ -47,2 +47,3 @@ import { Disconnect, Exchange, FilterForExchange } from './types'

apiKey: apiKey || options.apiKey,
userAgent: options._userAgent,
fromDate,

@@ -179,2 +180,5 @@ toDate,

const fromDate = parseAsUTCDate(from)
validateReplayNormalizedOptions(fromDate, normalizers)
const createMappers = (localTimestamp: Date) => normalizers.map(m => m(exchange, localTimestamp))

@@ -239,2 +243,13 @@ const nonFilterableExchanges = ['bitfinex', 'bitfinex-derivatives']

function validateReplayNormalizedOptions(fromDate: Date, normalizers: MapperFactory<any, any>[]) {
const hasBookChangeNormalizer = normalizers.some(n => n === normalizeBookChanges)
const dateDoesNotStartAtTheBeginningOfTheDay = fromDate.getUTCHours() !== 0 || fromDate.getUTCMinutes() !== 0
if (hasBookChangeNormalizer && dateDoesNotStartAtTheBeginningOfTheDay) {
throw new Error(
`Invalid "from" argument: ${fromDate.toISOString()}. Please provide date string starting at 00:00 UTC as otherwise initial book snapshots won't be available.`
)
}
}
export type ReplayOptions<T extends Exchange, U extends boolean = false, Z extends boolean = false> = {

@@ -241,0 +256,0 @@ readonly exchange: T

@@ -111,3 +111,3 @@ import crypto from 'crypto'

async function reliablyFetchAndCacheSlice(
{ exchange, fromDate, endpoint, apiKey }: WorkerJobPayload,
{ exchange, fromDate, endpoint, apiKey, userAgent }: WorkerJobPayload,
offset: number,

@@ -128,2 +128,3 @@ filters: object[],

'Accept-Encoding': 'gzip',
'User-Agent': userAgent,
Authorization: apiKey ? `Bearer ${apiKey}` : ''

@@ -220,2 +221,3 @@ }

apiKey: string
userAgent: string
fromDate: Date

@@ -222,0 +224,0 @@ toDate: Date

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

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