chore: add prettier (2/3): apply formatting, re-enable lint ci step (#6682)

* style: apply prettier formatting

* fix: re-enable lint ci check
This commit is contained in:
Jesse Mazzella
2023-05-18 14:54:46 -07:00
committed by GitHub
parent 172e0b23fd
commit caa7bc6fae
976 changed files with 115922 additions and 114693 deletions

View File

@ -27,70 +27,78 @@
import messages from './transcript.json';
class EventTelemetryProvider {
constructor() {
this.defaultSize = 25;
constructor() {
this.defaultSize = 25;
}
generateData(firstObservedTime, count, startTime, duration, name) {
const millisecondsSinceStart = startTime - firstObservedTime;
const utc = startTime + count * duration;
const ind = count % messages.length;
const message = messages[ind] + ' - [' + millisecondsSinceStart + ']';
return {
name,
utc,
message
};
}
supportsRequest(domainObject) {
return domainObject.type === 'eventGenerator';
}
supportsSubscribe(domainObject) {
return domainObject.type === 'eventGenerator';
}
subscribe(domainObject, callback) {
const duration = domainObject.telemetry.duration * 1000;
const firstObservedTime = Date.now();
let count = 0;
const interval = setInterval(() => {
const startTime = Date.now();
const datum = this.generateData(
firstObservedTime,
count,
startTime,
duration,
domainObject.name
);
count += 1;
callback(datum);
}, duration);
return function () {
clearInterval(interval);
};
}
request(domainObject, options) {
let start = options.start;
const end = Math.min(Date.now(), options.end); // no future values
const duration = domainObject.telemetry.duration * 1000;
const size = options.size ? options.size : this.defaultSize;
const data = [];
const firstObservedTime = options.start;
let count = 0;
if (options.strategy === 'latest' || options.size === 1) {
start = end;
}
generateData(firstObservedTime, count, startTime, duration, name) {
const millisecondsSinceStart = startTime - firstObservedTime;
const utc = startTime + (count * duration);
const ind = count % messages.length;
const message = messages[ind] + " - [" + millisecondsSinceStart + "]";
return {
name,
utc,
message
};
while (start <= end && data.length < size) {
const startTime = options.start + count;
data.push(
this.generateData(firstObservedTime, count, startTime, duration, domainObject.name)
);
start += duration;
count += 1;
}
supportsRequest(domainObject) {
return domainObject.type === 'eventGenerator';
}
supportsSubscribe(domainObject) {
return domainObject.type === 'eventGenerator';
}
subscribe(domainObject, callback) {
const duration = domainObject.telemetry.duration * 1000;
const firstObservedTime = Date.now();
let count = 0;
const interval = setInterval(() => {
const startTime = Date.now();
const datum = this.generateData(firstObservedTime, count, startTime, duration, domainObject.name);
count += 1;
callback(datum);
}, duration);
return function () {
clearInterval(interval);
};
}
request(domainObject, options) {
let start = options.start;
const end = Math.min(Date.now(), options.end); // no future values
const duration = domainObject.telemetry.duration * 1000;
const size = options.size ? options.size : this.defaultSize;
const data = [];
const firstObservedTime = options.start;
let count = 0;
if (options.strategy === 'latest' || options.size === 1) {
start = end;
}
while (start <= end && data.length < size) {
const startTime = options.start + count;
data.push(this.generateData(firstObservedTime, count, startTime, duration, domainObject.name));
start += duration;
count += 1;
}
return Promise.resolve(data);
}
return Promise.resolve(data);
}
}
export default EventTelemetryProvider;