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

ferrum-db-client

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ferrum-db-client - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

3

dist/protcol.d.ts

@@ -58,4 +58,5 @@ export declare enum ApiMessageType {

GET_TIME_SERIES = 55,
TIME_SERIES_DELETE_ENTRY = 56
TIME_SERIES_DELETE_ENTRY = 56,
TIME_SERIES_GET_FULL_SERIE = 57
}
//# sourceMappingURL=protcol.d.ts.map

@@ -63,3 +63,4 @@ "use strict";

ApiMessageType[ApiMessageType["TIME_SERIES_DELETE_ENTRY"] = 56] = "TIME_SERIES_DELETE_ENTRY";
ApiMessageType[ApiMessageType["TIME_SERIES_GET_FULL_SERIE"] = 57] = "TIME_SERIES_GET_FULL_SERIE";
})(ApiMessageType = exports.ApiMessageType || (exports.ApiMessageType = {}));
//# sourceMappingURL=protcol.js.map

@@ -12,2 +12,3 @@ import { FerrumServerClient } from './client';

getEntry(serie: string, timestamp: number): Promise<T>;
getFullSerie(serie: string): Promise<T[]>;
getNearestEntryToTimestamp(serie: string, timestamp: number): Promise<T>;

@@ -14,0 +15,0 @@ getFirstEntryBeforeTimestamp(serie: string, timestamp: number): Promise<T>;

@@ -53,2 +53,23 @@ "use strict";

}
async getFullSerie(serie) {
const { bw, myId } = this.client.getSendWriter(protcol_1.ApiMessageType.TIME_SERIES_GET_FULL_SERIE, this.database.length + this.timeSeriesKey.length + serie.length);
bw.writeString(this.database, csharp_binary_stream_1.Encoding.Utf8);
bw.writeString(this.timeSeriesKey, csharp_binary_stream_1.Encoding.Utf8);
bw.writeString(serie, csharp_binary_stream_1.Encoding.Utf8);
this.client.sendMsg(bw);
const response = await this.client.getResponse(myId);
const br = (0, utils_1.getBinaryReader)(response);
const success = br.readBoolean();
if (!success) {
return (0, utils_1.handleErrorResponse)(br);
}
else {
try {
return (0, utils_1.readEncodedDataArray)(br, this.encoding, this.compression);
}
catch (e) {
throw new Error(`Failed to get ${serie} from ${this.timeSeriesKey} \n\nCaused by: ${e}`);
}
}
}
async getNearestEntryToTimestamp(serie, timestamp) {

@@ -55,0 +76,0 @@ const { bw, myId } = this.client.getSendWriter(protcol_1.ApiMessageType.TIME_SERIES_GET_NEAREST_ENTRY_TO_TIMESTAMP, this.database.length + this.timeSeriesKey.length + 8 + serie.length);

{
"name": "ferrum-db-client",
"version": "0.2.1",
"version": "0.2.2",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts",

@@ -59,2 +59,3 @@ export enum ApiMessageType {

TIME_SERIES_DELETE_ENTRY = 56,
TIME_SERIES_GET_FULL_SERIE = 57,
}

@@ -73,2 +73,27 @@ import { Encoding } from 'csharp-binary-stream';

public async getFullSerie(serie: string): Promise<T[]> {
const { bw, myId } = this.client.getSendWriter(
ApiMessageType.TIME_SERIES_GET_FULL_SERIE,
this.database.length + this.timeSeriesKey.length + serie.length,
);
bw.writeString(this.database, Encoding.Utf8);
bw.writeString(this.timeSeriesKey, Encoding.Utf8);
bw.writeString(serie, Encoding.Utf8);
this.client.sendMsg(bw);
const response = await this.client.getResponse(myId);
const br = getBinaryReader(response);
const success = br.readBoolean();
if (!success) {
return handleErrorResponse(br);
} else {
try {
return readEncodedDataArray(br, this.encoding, this.compression);
} catch (e) {
throw new Error(`Failed to get ${serie} from ${this.timeSeriesKey} \n\nCaused by: ${e}`);
}
}
}
public async getNearestEntryToTimestamp(serie: string, timestamp: number): Promise<T> {

@@ -75,0 +100,0 @@ const { bw, myId } = this.client.getSendWriter(

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