ag-timemachine
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -58,6 +58,8 @@ "use strict"; | ||
}, | ||
getHistoryDatas: function (id, from, to) { return __awaiter(_this, void 0, void 0, function () { | ||
getHistoryDeltas: function (id, from, to) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.getObject(id).table.getHistory(from, to)]; | ||
case 0: | ||
console.log('getHistoryDeltas', id, from, to); | ||
return [4 /*yield*/, this.getObject(id).table.getHistory(from, to)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
@@ -64,0 +66,0 @@ } |
{ | ||
"name": "ag-timemachine", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ import { type WebStateProxy } from 'ag-remote/AgRemoteTypes'; | ||
rtLifeTime: (id: string) => ([Date, Date] | undefined); | ||
getHistoryDatas: (id: string, from: Date, to: Date) => Promise<TmDelta[]>; | ||
getHistoryDeltas: (id: string, from: Date, to: Date) => Promise<TmDelta[]>; | ||
getHistoryFrequence: (id: string, date: Date) => Promise<TmFrequence>; | ||
@@ -12,0 +12,0 @@ }; |
@@ -123,3 +123,3 @@ "use strict"; | ||
max = this.max.value; | ||
return [4 /*yield*/, this.api.getHistoryDatas(this.id, max[0], max[1]).call()]; | ||
return [4 /*yield*/, this.api.getHistoryDeltas(this.id, max[0], max[1]).call()]; | ||
case 1: | ||
@@ -126,0 +126,0 @@ deltas = _b.sent(); |
@@ -196,3 +196,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var snapshot; | ||
var snapshot, ret; | ||
return __generator(this, function (_a) { | ||
@@ -205,3 +205,7 @@ switch (_a.label) { | ||
from = snapshot.time; | ||
return [4 /*yield*/, this.datatable.find({ time: { $gte: from, $lte: to } }).sort({ 'time': 1 }).toArray() | ||
return [4 /*yield*/, this.datatable.find({ time: { $gte: from, $lte: to } }).sort({ 'time': 1 }).toArray()]; | ||
case 2: | ||
ret = _a.sent(); | ||
console.log('getHistory', ret); | ||
return [2 /*return*/, ret | ||
// const result = [] as TmData[] | ||
@@ -231,27 +235,2 @@ // let diff: DiffRef<any> | undefined | ||
]; | ||
case 2: return [2 /*return*/, _a.sent() | ||
// const result = [] as TmData[] | ||
// let diff: DiffRef<any> | undefined | ||
// records.forEach(record => { | ||
// if (!record.snapshot && !diff) return | ||
// if (record.snapshot) { | ||
// if (!diff) diff = diffRef(record.snapshot.value) | ||
// else diff.value = record.snapshot.value | ||
// } else { | ||
// diff!.patch(record.delta) | ||
// } | ||
// result.push({ | ||
// time: record.time, | ||
// value: cloneDeep(diff!.value) | ||
// }) | ||
// }) | ||
// diff?.stop() | ||
// if (result.length > 0 && result[result.length - 1].time.getTime() < to.getTime()) { | ||
// result.push({ | ||
// time: to, | ||
// value: cloneDeep(result[result.length - 1].value) | ||
// }) | ||
// } | ||
// return result.filter(r => r.time.getTime() >= from.getTime() && r.time.getTime() <= to.getTime()) | ||
]; | ||
} | ||
@@ -258,0 +237,0 @@ }); |
69781
1500