2024-05-13 09:34:43 -07:00
|
|
|
import { cursorTo } from "readline";
|
|
|
|
|
|
|
|
|
|
|
2024-05-09 08:10:20 -07:00
|
|
|
export class ReactionTypeCount {
|
|
|
|
|
constructor({ count, reactionType }) {
|
|
|
|
|
this.count = count;
|
|
|
|
|
this.reactionType = reactionType;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class SocialActivityCounts {
|
|
|
|
|
constructor({ entityUrn, numComments, numLikes, reactionTypeCounts, liked, preDashEntityUrn }) {
|
|
|
|
|
this.entityUrn = entityUrn;
|
|
|
|
|
this.numComments = numComments;
|
|
|
|
|
this.numLikes = numLikes;
|
|
|
|
|
this.reactionTypeCounts = reactionTypeCounts.map(count => new ReactionTypeCount(count));
|
|
|
|
|
this.liked = liked;
|
|
|
|
|
this.preDashEntityUrn = preDashEntityUrn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Group {
|
|
|
|
|
constructor({ entityUrn }) {
|
|
|
|
|
this.entityUrn = entityUrn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Placeholder class for any other types
|
|
|
|
|
export class GenericEntity {
|
|
|
|
|
constructor(data) {
|
|
|
|
|
Object.assign(this, data);
|
|
|
|
|
}
|
2024-05-13 09:34:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class LoadingBar {
|
|
|
|
|
constructor(size) {
|
|
|
|
|
this.size = size;
|
|
|
|
|
this.cursor = 0;
|
|
|
|
|
this.timer = null;
|
2024-05-29 10:37:08 -04:00
|
|
|
this.y = process.stdout.rows;
|
2024-05-13 09:34:43 -07:00
|
|
|
|
2024-05-29 10:37:08 -04:00
|
|
|
cursorTo(process.stdout, this.cursor, this.y);
|
2024-05-13 09:34:43 -07:00
|
|
|
|
|
|
|
|
// draw the initial outline
|
|
|
|
|
process.stdout.write("\x1B[?25l");
|
|
|
|
|
for (let i = 0; i < this.size; i++) {
|
|
|
|
|
process.stdout.write("\u2591");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-15 09:33:41 -07:00
|
|
|
increment(amt = 1) {
|
2024-05-29 10:37:08 -04:00
|
|
|
cursorTo(process.stdout, this.cursor, this.y);
|
2024-05-13 09:34:43 -07:00
|
|
|
for (let i = 0; i < amt; i++) process.stdout.write("\u2588");
|
|
|
|
|
this.cursor += amt;
|
|
|
|
|
}
|
2024-05-09 08:10:20 -07:00
|
|
|
}
|