@trap_stevo/filetide 0.0.70 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/FileMessager.js +266 -143
- package/dist/cjs/FileMessagerClient.js +22 -17
- package/dist/cjs/FileTide.js +256 -179
- package/dist/cjs/FileTideEnvironment.js +8 -0
- package/dist/cjs/HUDComponents/FileTideCommunicationConfigurations.js +12 -0
- package/dist/cjs/HUDComponents/FileTideEnvironment.js +8 -0
- package/dist/cjs/HUDManagers/FileNetClientManager.js +8 -0
- package/dist/cjs/HUDManagers/FileTideDebugUtilityManager.js +44 -5
- package/dist/cjs/HUDManagers/FileTideUniversalUtilityManager.js +109 -0
- package/dist/cjs/HUDManagers/TideTokenEnforcementManager.js +149 -0
- package/package.json +6 -3
package/dist/cjs/FileMessager.js
CHANGED
|
@@ -64,6 +64,13 @@ class FileMessager {
|
|
|
64
64
|
}
|
|
65
65
|
onDisconnect(connectionRes, socket) {
|
|
66
66
|
console.log(`Client disconnected ~ ${socket.id}`);
|
|
67
|
+
const currentOnlineClient = FileNetClientManager.getOnlineClientByConnectionID(socket.id);
|
|
68
|
+
if (currentOnlineClient) {
|
|
69
|
+
this.handleClientOffline({}, {
|
|
70
|
+
connectionID: currentOnlineClient.id,
|
|
71
|
+
...currentOnlineClient
|
|
72
|
+
});
|
|
73
|
+
}
|
|
67
74
|
this.onlineClients.delete(socket.id);
|
|
68
75
|
return;
|
|
69
76
|
}
|
|
@@ -100,6 +107,9 @@ class FileMessager {
|
|
|
100
107
|
async getTidalyticsSince(interval = "1d", source = "storage", filter = {}) {
|
|
101
108
|
return await tidalytics.getMetricsSince(interval, source, filter);
|
|
102
109
|
}
|
|
110
|
+
async getTidalyticsBetween(start, end, source = "both", filter = {}) {
|
|
111
|
+
return await tidalytics.getMetricsBetween(start, end, source, filter);
|
|
112
|
+
}
|
|
103
113
|
async getStoredTidalytics(filter = {}) {
|
|
104
114
|
return await tidalytics.getStoredMetrics(filter);
|
|
105
115
|
}
|
|
@@ -281,26 +291,30 @@ class FileMessager {
|
|
|
281
291
|
interval = "1d",
|
|
282
292
|
limit = Infinity,
|
|
283
293
|
filter = {},
|
|
284
|
-
|
|
294
|
+
rangeMode = "since",
|
|
295
|
+
mode = "all",
|
|
296
|
+
start = null,
|
|
297
|
+
end = null
|
|
285
298
|
} = options;
|
|
286
299
|
const sources = ["storage", "memory"];
|
|
287
|
-
const
|
|
300
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
301
|
+
const [storedOnline, storedOffline] = await Promise.all([fetch({
|
|
288
302
|
...filter,
|
|
289
303
|
tags: {
|
|
290
304
|
"tider:online": "tider:online"
|
|
291
305
|
}
|
|
292
|
-
}
|
|
306
|
+
}, sources[0]), fetch({
|
|
293
307
|
...filter,
|
|
294
308
|
tags: {
|
|
295
309
|
"tider:offline": "tider:offline"
|
|
296
310
|
}
|
|
297
|
-
})]);
|
|
298
|
-
const [liveOnline] = await Promise.all([
|
|
311
|
+
}, sources[0])]);
|
|
312
|
+
const [liveOnline] = await Promise.all([fetch({
|
|
299
313
|
...filter,
|
|
300
314
|
tags: {
|
|
301
315
|
"tider:online": "tider:online"
|
|
302
316
|
}
|
|
303
|
-
})]);
|
|
317
|
+
}, sources[1])]);
|
|
304
318
|
const onlineMetrics = [...storedOnline, ...liveOnline];
|
|
305
319
|
const offlineMetrics = storedOffline;
|
|
306
320
|
const sessionsByKey = {};
|
|
@@ -337,11 +351,14 @@ class FileMessager {
|
|
|
337
351
|
}
|
|
338
352
|
async getAlreadyOnlineVisualData(options = {}) {
|
|
339
353
|
const {
|
|
354
|
+
chartConfig = {},
|
|
340
355
|
interval = "1d",
|
|
341
356
|
filter = {},
|
|
342
357
|
limit = Infinity,
|
|
343
358
|
format = "raw",
|
|
344
|
-
|
|
359
|
+
rangeMode = "since",
|
|
360
|
+
start = null,
|
|
361
|
+
end = null
|
|
345
362
|
} = options;
|
|
346
363
|
const fullChartConfig = {
|
|
347
364
|
groupBy: "metadata.user",
|
|
@@ -352,17 +369,18 @@ class FileMessager {
|
|
|
352
369
|
...chartConfig
|
|
353
370
|
};
|
|
354
371
|
const sources = ["storage", "memory"];
|
|
355
|
-
const
|
|
372
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
373
|
+
const [alreadyOnlineEvents, onlineJoins] = await Promise.all([fetch({
|
|
356
374
|
...filter,
|
|
357
375
|
tags: {
|
|
358
376
|
"tider:already-online": "tider:already-online"
|
|
359
377
|
}
|
|
360
|
-
}
|
|
378
|
+
}, sources[0]), fetch({
|
|
361
379
|
...filter,
|
|
362
380
|
tags: {
|
|
363
381
|
"tider:online": "tider:online"
|
|
364
382
|
}
|
|
365
|
-
})]);
|
|
383
|
+
}, sources[0])]);
|
|
366
384
|
const entries = alreadyOnlineEvents.map(e => ({
|
|
367
385
|
...e,
|
|
368
386
|
type: "already-online"
|
|
@@ -397,11 +415,14 @@ class FileMessager {
|
|
|
397
415
|
}
|
|
398
416
|
async getTiderBanVisualData(options = {}) {
|
|
399
417
|
const {
|
|
418
|
+
chartConfig = {},
|
|
400
419
|
interval = "1d",
|
|
401
420
|
filter = {},
|
|
402
421
|
limit = Infinity,
|
|
403
422
|
format = "raw",
|
|
404
|
-
|
|
423
|
+
rangeMode = "since",
|
|
424
|
+
start = null,
|
|
425
|
+
end = null
|
|
405
426
|
} = options;
|
|
406
427
|
const fullChartConfig = {
|
|
407
428
|
groupBy: "type",
|
|
@@ -409,22 +430,23 @@ class FileMessager {
|
|
|
409
430
|
...chartConfig
|
|
410
431
|
};
|
|
411
432
|
const sources = ["storage", "memory"];
|
|
412
|
-
const
|
|
433
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
434
|
+
const [banned, kicked, unbanned] = await Promise.all([fetch({
|
|
413
435
|
...filter,
|
|
414
436
|
tags: {
|
|
415
437
|
"tider:banned": "tider:banned"
|
|
416
438
|
}
|
|
417
|
-
}
|
|
439
|
+
}, sources[0]), fetch({
|
|
418
440
|
...filter,
|
|
419
441
|
tags: {
|
|
420
442
|
"tider:kicked": "tider:kicked"
|
|
421
443
|
}
|
|
422
|
-
}
|
|
444
|
+
}, sources[0]), fetch({
|
|
423
445
|
...filter,
|
|
424
446
|
tags: {
|
|
425
447
|
"tider:unbanned": "tider:unbanned"
|
|
426
448
|
}
|
|
427
|
-
})]);
|
|
449
|
+
}, sources[0])]);
|
|
428
450
|
const entries = [...banned.map(e => ({
|
|
429
451
|
...e,
|
|
430
452
|
type: "banned"
|
|
@@ -448,11 +470,14 @@ class FileMessager {
|
|
|
448
470
|
}
|
|
449
471
|
async getTideFileTransferVisualData(options = {}) {
|
|
450
472
|
const {
|
|
473
|
+
chartConfig = {},
|
|
451
474
|
interval = "1d",
|
|
452
475
|
filter = {},
|
|
453
476
|
limit = Infinity,
|
|
454
477
|
format = "raw",
|
|
455
|
-
|
|
478
|
+
rangeMode = "since",
|
|
479
|
+
start = null,
|
|
480
|
+
end = null
|
|
456
481
|
} = options;
|
|
457
482
|
const fullChartConfig = {
|
|
458
483
|
groupBy: "type",
|
|
@@ -460,22 +485,23 @@ class FileMessager {
|
|
|
460
485
|
...chartConfig
|
|
461
486
|
};
|
|
462
487
|
const sources = ["storage", "memory"];
|
|
463
|
-
const
|
|
488
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
489
|
+
const [incomingTransfers, incoming, completed] = await Promise.all([fetch({
|
|
464
490
|
...filter,
|
|
465
491
|
tags: {
|
|
466
492
|
"tide:incoming-transfer": "tide:incoming-transfer"
|
|
467
493
|
}
|
|
468
|
-
}
|
|
494
|
+
}, sources[0]), fetch({
|
|
469
495
|
...filter,
|
|
470
496
|
tags: {
|
|
471
497
|
"tide:incoming-file": "tide:incoming-file"
|
|
472
498
|
}
|
|
473
|
-
}
|
|
499
|
+
}, sources[0]), fetch({
|
|
474
500
|
...filter,
|
|
475
501
|
tags: {
|
|
476
502
|
"tide:completed-transfer": "tide:completed-transfer"
|
|
477
503
|
}
|
|
478
|
-
})]);
|
|
504
|
+
}, sources[0])]);
|
|
479
505
|
const entries = [...incomingTransfers.map(e => ({
|
|
480
506
|
...e,
|
|
481
507
|
type: "incoming-transfer"
|
|
@@ -499,11 +525,14 @@ class FileMessager {
|
|
|
499
525
|
}
|
|
500
526
|
async getTideTransferStateVisualData(options = {}) {
|
|
501
527
|
const {
|
|
528
|
+
chartConfig = {},
|
|
502
529
|
interval = "1d",
|
|
503
530
|
filter = {},
|
|
504
531
|
limit = Infinity,
|
|
505
532
|
format = "raw",
|
|
506
|
-
|
|
533
|
+
rangeMode = "since",
|
|
534
|
+
start = null,
|
|
535
|
+
end = null
|
|
507
536
|
} = options;
|
|
508
537
|
const fullChartConfig = {
|
|
509
538
|
groupBy: "metadata.transferStateID",
|
|
@@ -514,12 +543,13 @@ class FileMessager {
|
|
|
514
543
|
...chartConfig
|
|
515
544
|
};
|
|
516
545
|
const sources = ["storage", "memory"];
|
|
517
|
-
const
|
|
546
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
547
|
+
const [transferStates] = await Promise.all([fetch({
|
|
518
548
|
...filter,
|
|
519
549
|
tags: {
|
|
520
550
|
"tide:transfer-state": "tide:transfer-state"
|
|
521
551
|
}
|
|
522
|
-
})]);
|
|
552
|
+
}, sources[0])]);
|
|
523
553
|
const entries = transferStates.map(e => ({
|
|
524
554
|
...e,
|
|
525
555
|
type: "transfer-state"
|
|
@@ -537,11 +567,14 @@ class FileMessager {
|
|
|
537
567
|
}
|
|
538
568
|
async getFileListActivityVisualData(options = {}) {
|
|
539
569
|
const {
|
|
570
|
+
chartConfig = {},
|
|
540
571
|
interval = "1d",
|
|
541
572
|
filter = {},
|
|
542
573
|
limit = Infinity,
|
|
543
574
|
format = "raw",
|
|
544
|
-
|
|
575
|
+
rangeMode = "since",
|
|
576
|
+
start = null,
|
|
577
|
+
end = null
|
|
545
578
|
} = options;
|
|
546
579
|
const fullChartConfig = {
|
|
547
580
|
groupBy: "type",
|
|
@@ -549,17 +582,18 @@ class FileMessager {
|
|
|
549
582
|
...chartConfig
|
|
550
583
|
};
|
|
551
584
|
const sources = ["storage", "memory"];
|
|
552
|
-
const
|
|
585
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
586
|
+
const [requested, received] = await Promise.all([fetch({
|
|
553
587
|
...filter,
|
|
554
588
|
tags: {
|
|
555
589
|
"file-list:request": "file-list:request"
|
|
556
590
|
}
|
|
557
|
-
}
|
|
591
|
+
}, sources[0]), fetch({
|
|
558
592
|
...filter,
|
|
559
593
|
tags: {
|
|
560
594
|
"file-list:received": "file-list:received"
|
|
561
595
|
}
|
|
562
|
-
})]);
|
|
596
|
+
}, sources[0])]);
|
|
563
597
|
const entries = [...requested.map(e => ({
|
|
564
598
|
...e,
|
|
565
599
|
type: "requested"
|
|
@@ -580,11 +614,14 @@ class FileMessager {
|
|
|
580
614
|
}
|
|
581
615
|
async getTideBarrierVisualData(options = {}) {
|
|
582
616
|
const {
|
|
617
|
+
chartConfig = {},
|
|
583
618
|
interval = "1d",
|
|
584
619
|
filter = {},
|
|
585
620
|
limit = Infinity,
|
|
586
621
|
format = "raw",
|
|
587
|
-
|
|
622
|
+
rangeMode = "since",
|
|
623
|
+
start = null,
|
|
624
|
+
end = null
|
|
588
625
|
} = options;
|
|
589
626
|
const fullChartConfig = {
|
|
590
627
|
groupBy: "type",
|
|
@@ -592,17 +629,18 @@ class FileMessager {
|
|
|
592
629
|
...chartConfig
|
|
593
630
|
};
|
|
594
631
|
const sources = ["storage", "memory"];
|
|
595
|
-
const
|
|
632
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
633
|
+
const [accepted, denied] = await Promise.all([fetch({
|
|
596
634
|
...filter,
|
|
597
635
|
tags: {
|
|
598
636
|
"tide-barrier:accepted": "tide-barrier:accepted"
|
|
599
637
|
}
|
|
600
|
-
}
|
|
638
|
+
}, sources[0]), fetch({
|
|
601
639
|
...filter,
|
|
602
640
|
tags: {
|
|
603
641
|
"tide-barrier:denied": "tide-barrier:denied"
|
|
604
642
|
}
|
|
605
|
-
})]);
|
|
643
|
+
}, sources[0])]);
|
|
606
644
|
const entries = [...accepted.map(e => ({
|
|
607
645
|
...e,
|
|
608
646
|
type: "accepted"
|
|
@@ -624,18 +662,23 @@ class FileMessager {
|
|
|
624
662
|
|
|
625
663
|
// --- File Messager Tide Actions Management ---
|
|
626
664
|
|
|
627
|
-
async getTideCompletedTransferActions({
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
665
|
+
async getTideCompletedTransferActions(options = {}) {
|
|
666
|
+
const {
|
|
667
|
+
interval = "1d",
|
|
668
|
+
limit = 50,
|
|
669
|
+
source = "storage",
|
|
670
|
+
filter = {},
|
|
671
|
+
rangeMode = "since",
|
|
672
|
+
start = null,
|
|
673
|
+
end = null
|
|
674
|
+
} = options;
|
|
675
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
676
|
+
const rawMetrics = await fetch({
|
|
634
677
|
...filter,
|
|
635
678
|
tags: {
|
|
636
679
|
"tide:completed-transfer": "tide:completed-transfer"
|
|
637
680
|
}
|
|
638
|
-
});
|
|
681
|
+
}, source);
|
|
639
682
|
if (!Array.isArray(rawMetrics)) {
|
|
640
683
|
return [];
|
|
641
684
|
}
|
|
@@ -655,18 +698,23 @@ class FileMessager {
|
|
|
655
698
|
}
|
|
656
699
|
}));
|
|
657
700
|
}
|
|
658
|
-
async getTideTransferStateActions({
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
701
|
+
async getTideTransferStateActions(options = {}) {
|
|
702
|
+
const {
|
|
703
|
+
interval = "1d",
|
|
704
|
+
limit = Infinity,
|
|
705
|
+
source = "storage",
|
|
706
|
+
filter = {},
|
|
707
|
+
rangeMode = "since",
|
|
708
|
+
start = null,
|
|
709
|
+
end = null
|
|
710
|
+
} = options;
|
|
711
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
712
|
+
const rawMetrics = await fetch({
|
|
665
713
|
...filter,
|
|
666
714
|
tags: {
|
|
667
715
|
"tide:transfer-state": "tide:transfer-state"
|
|
668
716
|
}
|
|
669
|
-
});
|
|
717
|
+
}, source);
|
|
670
718
|
if (!Array.isArray(rawMetrics)) {
|
|
671
719
|
return [];
|
|
672
720
|
}
|
|
@@ -689,18 +737,23 @@ class FileMessager {
|
|
|
689
737
|
}
|
|
690
738
|
}));
|
|
691
739
|
}
|
|
692
|
-
async getTideIncomingFileActions({
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
740
|
+
async getTideIncomingFileActions(options = {}) {
|
|
741
|
+
const {
|
|
742
|
+
interval = "1d",
|
|
743
|
+
limit = 50,
|
|
744
|
+
source = "storage",
|
|
745
|
+
filter = {},
|
|
746
|
+
rangeMode = "since",
|
|
747
|
+
start = null,
|
|
748
|
+
end = null
|
|
749
|
+
} = options;
|
|
750
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
751
|
+
const rawMetrics = await fetch({
|
|
699
752
|
...filter,
|
|
700
753
|
tags: {
|
|
701
754
|
"tide:incoming-file": "tide:incoming-file"
|
|
702
755
|
}
|
|
703
|
-
});
|
|
756
|
+
}, source);
|
|
704
757
|
if (!Array.isArray(rawMetrics)) {
|
|
705
758
|
return [];
|
|
706
759
|
}
|
|
@@ -719,18 +772,23 @@ class FileMessager {
|
|
|
719
772
|
}
|
|
720
773
|
}));
|
|
721
774
|
}
|
|
722
|
-
async getTideIncomingTransferActions({
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
775
|
+
async getTideIncomingTransferActions(options = {}) {
|
|
776
|
+
const {
|
|
777
|
+
interval = "1d",
|
|
778
|
+
limit = 50,
|
|
779
|
+
source = "storage",
|
|
780
|
+
filter = {},
|
|
781
|
+
rangeMode = "since",
|
|
782
|
+
start = null,
|
|
783
|
+
end = null
|
|
784
|
+
} = options;
|
|
785
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
786
|
+
const rawMetrics = await fetch({
|
|
729
787
|
...filter,
|
|
730
788
|
tags: {
|
|
731
789
|
"tide:incoming-transfer": "tide:incoming-transfer"
|
|
732
790
|
}
|
|
733
|
-
});
|
|
791
|
+
}, source);
|
|
734
792
|
if (!Array.isArray(rawMetrics)) {
|
|
735
793
|
return [];
|
|
736
794
|
}
|
|
@@ -748,18 +806,23 @@ class FileMessager {
|
|
|
748
806
|
}
|
|
749
807
|
}));
|
|
750
808
|
}
|
|
751
|
-
async getTideBarrierAcceptedActions({
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
809
|
+
async getTideBarrierAcceptedActions(options = {}) {
|
|
810
|
+
const {
|
|
811
|
+
interval = "1d",
|
|
812
|
+
limit = 50,
|
|
813
|
+
source = "storage",
|
|
814
|
+
filter = {},
|
|
815
|
+
rangeMode = "since",
|
|
816
|
+
start = null,
|
|
817
|
+
end = null
|
|
818
|
+
} = options;
|
|
819
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
820
|
+
const rawMetrics = await fetch({
|
|
758
821
|
...filter,
|
|
759
822
|
tags: {
|
|
760
823
|
"tide-barrier:accepted": "tide-barrier:accepted"
|
|
761
824
|
}
|
|
762
|
-
});
|
|
825
|
+
}, source);
|
|
763
826
|
if (!Array.isArray(rawMetrics)) {
|
|
764
827
|
return [];
|
|
765
828
|
}
|
|
@@ -780,18 +843,23 @@ class FileMessager {
|
|
|
780
843
|
}
|
|
781
844
|
}));
|
|
782
845
|
}
|
|
783
|
-
async getTideBarrierDeniedActions({
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
846
|
+
async getTideBarrierDeniedActions(options = {}) {
|
|
847
|
+
const {
|
|
848
|
+
interval = "1d",
|
|
849
|
+
limit = 50,
|
|
850
|
+
source = "storage",
|
|
851
|
+
filter = {},
|
|
852
|
+
rangeMode = "since",
|
|
853
|
+
start = null,
|
|
854
|
+
end = null
|
|
855
|
+
} = options;
|
|
856
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
857
|
+
const rawMetrics = await fetch({
|
|
790
858
|
...filter,
|
|
791
859
|
tags: {
|
|
792
860
|
"tide-barrier:denied": "tide-barrier:denied"
|
|
793
861
|
}
|
|
794
|
-
});
|
|
862
|
+
}, source);
|
|
795
863
|
if (!Array.isArray(rawMetrics)) {
|
|
796
864
|
return [];
|
|
797
865
|
}
|
|
@@ -812,18 +880,23 @@ class FileMessager {
|
|
|
812
880
|
}
|
|
813
881
|
}));
|
|
814
882
|
}
|
|
815
|
-
async getFileListReceivedActions({
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
883
|
+
async getFileListReceivedActions(options = {}) {
|
|
884
|
+
const {
|
|
885
|
+
interval = "1d",
|
|
886
|
+
limit = 50,
|
|
887
|
+
source = "storage",
|
|
888
|
+
filter = {},
|
|
889
|
+
rangeMode = "since",
|
|
890
|
+
start = null,
|
|
891
|
+
end = null
|
|
892
|
+
} = options;
|
|
893
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
894
|
+
const rawMetrics = await fetch({
|
|
822
895
|
...filter,
|
|
823
896
|
tags: {
|
|
824
897
|
"file-list:received": "file-list:received"
|
|
825
898
|
}
|
|
826
|
-
});
|
|
899
|
+
}, source);
|
|
827
900
|
if (!Array.isArray(rawMetrics)) {
|
|
828
901
|
return [];
|
|
829
902
|
}
|
|
@@ -839,18 +912,23 @@ class FileMessager {
|
|
|
839
912
|
}
|
|
840
913
|
}));
|
|
841
914
|
}
|
|
842
|
-
async getFileListRequestActions({
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
915
|
+
async getFileListRequestActions(options = {}) {
|
|
916
|
+
const {
|
|
917
|
+
interval = "1d",
|
|
918
|
+
limit = 50,
|
|
919
|
+
source = "storage",
|
|
920
|
+
filter = {},
|
|
921
|
+
rangeMode = "since",
|
|
922
|
+
start = null,
|
|
923
|
+
end = null
|
|
924
|
+
} = options;
|
|
925
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
926
|
+
const rawMetrics = await fetch({
|
|
849
927
|
...filter,
|
|
850
928
|
tags: {
|
|
851
929
|
"file-list:request": "file-list:request"
|
|
852
930
|
}
|
|
853
|
-
});
|
|
931
|
+
}, source);
|
|
854
932
|
if (!Array.isArray(rawMetrics)) {
|
|
855
933
|
return [];
|
|
856
934
|
}
|
|
@@ -865,18 +943,23 @@ class FileMessager {
|
|
|
865
943
|
}
|
|
866
944
|
}));
|
|
867
945
|
}
|
|
868
|
-
async getTiderBannedActions({
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
946
|
+
async getTiderBannedActions(options = {}) {
|
|
947
|
+
const {
|
|
948
|
+
interval = "1d",
|
|
949
|
+
limit = 50,
|
|
950
|
+
source = "storage",
|
|
951
|
+
filter = {},
|
|
952
|
+
rangeMode = "since",
|
|
953
|
+
start = null,
|
|
954
|
+
end = null
|
|
955
|
+
} = options;
|
|
956
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
957
|
+
const rawMetrics = await fetch({
|
|
875
958
|
...filter,
|
|
876
959
|
tags: {
|
|
877
960
|
"tider:banned": "tider:banned"
|
|
878
961
|
}
|
|
879
|
-
});
|
|
962
|
+
}, source);
|
|
880
963
|
if (!Array.isArray(rawMetrics)) {
|
|
881
964
|
return [];
|
|
882
965
|
}
|
|
@@ -890,18 +973,23 @@ class FileMessager {
|
|
|
890
973
|
}
|
|
891
974
|
}));
|
|
892
975
|
}
|
|
893
|
-
async getTiderKickedActions({
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
976
|
+
async getTiderKickedActions(options = {}) {
|
|
977
|
+
const {
|
|
978
|
+
interval = "1d",
|
|
979
|
+
limit = 50,
|
|
980
|
+
source = "storage",
|
|
981
|
+
filter = {},
|
|
982
|
+
rangeMode = "since",
|
|
983
|
+
start = null,
|
|
984
|
+
end = null
|
|
985
|
+
} = options;
|
|
986
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
987
|
+
const rawMetrics = await fetch({
|
|
900
988
|
...filter,
|
|
901
989
|
tags: {
|
|
902
990
|
"tider:kicked": "tider:kicked"
|
|
903
991
|
}
|
|
904
|
-
});
|
|
992
|
+
}, source);
|
|
905
993
|
if (!Array.isArray(rawMetrics)) {
|
|
906
994
|
return [];
|
|
907
995
|
}
|
|
@@ -915,18 +1003,23 @@ class FileMessager {
|
|
|
915
1003
|
}
|
|
916
1004
|
}));
|
|
917
1005
|
}
|
|
918
|
-
async getTiderUnbannedActions({
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1006
|
+
async getTiderUnbannedActions(options = {}) {
|
|
1007
|
+
const {
|
|
1008
|
+
interval = "1d",
|
|
1009
|
+
limit = 50,
|
|
1010
|
+
source = "storage",
|
|
1011
|
+
filter = {},
|
|
1012
|
+
rangeMode = "since",
|
|
1013
|
+
start = null,
|
|
1014
|
+
end = null
|
|
1015
|
+
} = options;
|
|
1016
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
1017
|
+
const rawMetrics = await fetch({
|
|
925
1018
|
...filter,
|
|
926
1019
|
tags: {
|
|
927
1020
|
"tider:unbanned": "tider:unbanned"
|
|
928
1021
|
}
|
|
929
|
-
});
|
|
1022
|
+
}, source);
|
|
930
1023
|
if (!Array.isArray(rawMetrics)) {
|
|
931
1024
|
return [];
|
|
932
1025
|
}
|
|
@@ -939,18 +1032,23 @@ class FileMessager {
|
|
|
939
1032
|
}
|
|
940
1033
|
}));
|
|
941
1034
|
}
|
|
942
|
-
async getTiderAlreadyOnlineActions({
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1035
|
+
async getTiderAlreadyOnlineActions(options = {}) {
|
|
1036
|
+
const {
|
|
1037
|
+
interval = "1d",
|
|
1038
|
+
limit = 50,
|
|
1039
|
+
source = "storage",
|
|
1040
|
+
filter = {},
|
|
1041
|
+
rangeMode = "since",
|
|
1042
|
+
start = null,
|
|
1043
|
+
end = null
|
|
1044
|
+
} = options;
|
|
1045
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
1046
|
+
const rawMetrics = await fetch({
|
|
949
1047
|
...filter,
|
|
950
1048
|
tags: {
|
|
951
1049
|
"tider:already-online": "tider:already-online"
|
|
952
1050
|
}
|
|
953
|
-
});
|
|
1051
|
+
}, source);
|
|
954
1052
|
if (!Array.isArray(rawMetrics)) {
|
|
955
1053
|
return [];
|
|
956
1054
|
}
|
|
@@ -969,18 +1067,23 @@ class FileMessager {
|
|
|
969
1067
|
}
|
|
970
1068
|
}));
|
|
971
1069
|
}
|
|
972
|
-
async getTiderOnlineActions({
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1070
|
+
async getTiderOnlineActions(options = {}) {
|
|
1071
|
+
const {
|
|
1072
|
+
interval = "1d",
|
|
1073
|
+
limit = 50,
|
|
1074
|
+
source = "storage",
|
|
1075
|
+
filter = {},
|
|
1076
|
+
rangeMode = "since",
|
|
1077
|
+
start = null,
|
|
1078
|
+
end = null
|
|
1079
|
+
} = options;
|
|
1080
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
1081
|
+
const rawMetrics = await fetch({
|
|
979
1082
|
...filter,
|
|
980
1083
|
tags: {
|
|
981
1084
|
"tider:online": "tider:online"
|
|
982
1085
|
}
|
|
983
|
-
});
|
|
1086
|
+
}, source);
|
|
984
1087
|
if (!rawMetrics || !Array.isArray(rawMetrics)) {
|
|
985
1088
|
return [];
|
|
986
1089
|
}
|
|
@@ -999,18 +1102,23 @@ class FileMessager {
|
|
|
999
1102
|
}
|
|
1000
1103
|
}));
|
|
1001
1104
|
}
|
|
1002
|
-
async getTiderOfflineActions({
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1105
|
+
async getTiderOfflineActions(options = {}) {
|
|
1106
|
+
const {
|
|
1107
|
+
interval = "1d",
|
|
1108
|
+
limit = 50,
|
|
1109
|
+
source = "storage",
|
|
1110
|
+
filter = {},
|
|
1111
|
+
rangeMode = "since",
|
|
1112
|
+
start = null,
|
|
1113
|
+
end = null
|
|
1114
|
+
} = options;
|
|
1115
|
+
const fetch = _assertClassBrand(_FileMessager_brand, this, _getTidalyticsRangeFetcher).call(this, interval, rangeMode, start, end);
|
|
1116
|
+
const rawMetrics = await fetch({
|
|
1009
1117
|
...filter,
|
|
1010
1118
|
tags: {
|
|
1011
1119
|
"tider:offline": "tider:offline"
|
|
1012
1120
|
}
|
|
1013
|
-
});
|
|
1121
|
+
}, source);
|
|
1014
1122
|
if (!rawMetrics || !Array.isArray(rawMetrics)) {
|
|
1015
1123
|
return [];
|
|
1016
1124
|
}
|
|
@@ -2159,5 +2267,20 @@ function _log(...message) {
|
|
|
2159
2267
|
}
|
|
2160
2268
|
console.log(...message);
|
|
2161
2269
|
}
|
|
2270
|
+
function _getTidalyticsRangeFetcher(interval, rangeMode, start, end) {
|
|
2271
|
+
return async (tagFilter, source) => {
|
|
2272
|
+
const effectiveFilter = {
|
|
2273
|
+
...tagFilter
|
|
2274
|
+
};
|
|
2275
|
+
if (rangeMode === "between") {
|
|
2276
|
+
if (start == null || end == null) {
|
|
2277
|
+
console.log("[FileTide | Tidalytics] ~ Missing start or end time for 'between' mode.");
|
|
2278
|
+
return [];
|
|
2279
|
+
}
|
|
2280
|
+
return await this.getTidalyticsBetween(start, end, source, effectiveFilter);
|
|
2281
|
+
}
|
|
2282
|
+
return await this.getTidalyticsSince(interval, source, effectiveFilter);
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2162
2285
|
;
|
|
2163
2286
|
module.exports = FileMessager;
|