reduct-js
Version:
ReductStore Client SDK for Javascript/NodeJS/Typescript
92 lines (91 loc) • 2.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Diagnostics = exports.OriginalDiagnostics = exports.DiagnosticsItem = exports.DiagnosticsError = void 0;
class DiagnosticsErrorOriginal {
constructor() {
this.count = 0;
this.last_message = "";
}
}
/**
* Diagnostics error
*/
class DiagnosticsError {
constructor() {
/**
* Number of errors
*/
this.count = 0;
/**
* Last error message
*/
this.lastMessage = "";
}
static parse(data) {
return {
count: data.count,
lastMessage: data.last_message,
};
}
}
exports.DiagnosticsError = DiagnosticsError;
class OrigianlDiagnosticsItem {
constructor() {
this.ok = 0n;
this.errored = 0n;
this.errors = {};
}
}
/**
* Diagnostics item
*/
class DiagnosticsItem {
constructor() {
/**
* Number of successful operations
*/
this.ok = 0n;
/**
* Number of failed operations
*/
this.errored = 0n;
/**
* Errors
*/
this.errors = {};
}
static parse(data) {
return {
ok: BigInt(data.ok),
errored: BigInt(data.errored),
errors: Object.fromEntries(Object.entries(data.errors).map(([key, value]) => [
Number(key),
DiagnosticsError.parse(value),
])),
};
}
}
exports.DiagnosticsItem = DiagnosticsItem;
class OriginalDiagnostics {
constructor() {
this.hourly = new OrigianlDiagnosticsItem();
}
}
exports.OriginalDiagnostics = OriginalDiagnostics;
/**
* Diagnostics
*/
class Diagnostics {
constructor() {
/**
* Hourly diagnostics
*/
this.hourly = new DiagnosticsItem();
}
static parse(data) {
return {
hourly: DiagnosticsItem.parse(data.hourly),
};
}
}
exports.Diagnostics = Diagnostics;