@smartico/public-api 0.0.201 → 0.0.203
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/CustomSections/AchCustomSection.d.ts +2 -1
- package/dist/MiniGames/SAWGameType.d.ts +3 -1
- package/dist/NodeCache.d.ts +2 -2
- package/dist/index.js +27 -14
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +27 -14
- package/dist/index.modern.mjs.map +1 -1
- package/docs/enums/SAWGameTypeName.md +6 -0
- package/package.json +1 -1
- package/src/CustomSections/AchCustomSection.ts +1 -0
- package/src/MiniGames/SAWGameType.ts +3 -0
- package/src/NodeCache.ts +18 -14
- package/src/OCache.ts +5 -0
package/dist/index.modern.mjs
CHANGED
|
@@ -306,6 +306,7 @@ var SAWGameType;
|
|
|
306
306
|
SAWGameType[SAWGameType["Quiz"] = 6] = "Quiz";
|
|
307
307
|
SAWGameType[SAWGameType["LootboxWeekdays"] = 7] = "LootboxWeekdays";
|
|
308
308
|
SAWGameType[SAWGameType["LootboxCalendarDays"] = 8] = "LootboxCalendarDays";
|
|
309
|
+
SAWGameType[SAWGameType["TreasureHunt"] = 9] = "TreasureHunt";
|
|
309
310
|
})(SAWGameType || (SAWGameType = {}));
|
|
310
311
|
var SAWGameTypeName;
|
|
311
312
|
(function (SAWGameTypeName) {
|
|
@@ -317,6 +318,7 @@ var SAWGameTypeName;
|
|
|
317
318
|
SAWGameTypeName["Quiz"] = "quiz";
|
|
318
319
|
SAWGameTypeName["LootboxWeekdays"] = "lootbox_weekdays";
|
|
319
320
|
SAWGameTypeName["LootboxCalendarDays"] = "lootbox_calendar_days";
|
|
321
|
+
SAWGameTypeName["TreasureHunt"] = "treasure_hunt";
|
|
320
322
|
SAWGameTypeName["Unknown"] = "unknown";
|
|
321
323
|
})(SAWGameTypeName || (SAWGameTypeName = {}));
|
|
322
324
|
/** @hidden */
|
|
@@ -329,7 +331,8 @@ const SAWGameTypeNamed = type => {
|
|
|
329
331
|
[SAWGameType.PrizeDrop]: SAWGameTypeName.PrizeDrop,
|
|
330
332
|
[SAWGameType.Quiz]: SAWGameTypeName.Quiz,
|
|
331
333
|
[SAWGameType.LootboxWeekdays]: SAWGameTypeName.LootboxWeekdays,
|
|
332
|
-
[SAWGameType.LootboxCalendarDays]: SAWGameTypeName.LootboxCalendarDays
|
|
334
|
+
[SAWGameType.LootboxCalendarDays]: SAWGameTypeName.LootboxCalendarDays,
|
|
335
|
+
[SAWGameType.TreasureHunt]: SAWGameTypeName.TreasureHunt
|
|
333
336
|
}[type] || SAWGameTypeName.Unknown;
|
|
334
337
|
};
|
|
335
338
|
|
|
@@ -490,14 +493,16 @@ var SAWGameLayout;
|
|
|
490
493
|
|
|
491
494
|
class NodeCache {
|
|
492
495
|
constructor() {
|
|
493
|
-
|
|
494
|
-
|
|
496
|
+
this.ttlChecker = void 0;
|
|
497
|
+
this.cache = {};
|
|
498
|
+
if (this.ttlChecker === undefined) {
|
|
499
|
+
this.ttlChecker = setInterval(() => {
|
|
495
500
|
const now = new Date().getTime();
|
|
496
|
-
for (const key in
|
|
497
|
-
if (
|
|
498
|
-
const o =
|
|
501
|
+
for (const key in this.cache) {
|
|
502
|
+
if (this.cache.hasOwnProperty(key)) {
|
|
503
|
+
const o = this.cache[key];
|
|
499
504
|
if (o.ttl < now) {
|
|
500
|
-
delete
|
|
505
|
+
delete this.cache[key];
|
|
501
506
|
}
|
|
502
507
|
}
|
|
503
508
|
}
|
|
@@ -505,28 +510,30 @@ class NodeCache {
|
|
|
505
510
|
}
|
|
506
511
|
}
|
|
507
512
|
get(key) {
|
|
508
|
-
const o =
|
|
513
|
+
const o = this.cache[key];
|
|
509
514
|
if (o !== undefined && o.ttl > new Date().getTime()) {
|
|
510
515
|
return o.value;
|
|
511
516
|
}
|
|
512
517
|
}
|
|
513
518
|
set(key, value, ttlSeconds = 60) {
|
|
514
|
-
|
|
519
|
+
this.cache[key] = {
|
|
515
520
|
value,
|
|
516
521
|
ttl: new Date().getTime() + ttlSeconds * 1000
|
|
517
522
|
};
|
|
518
523
|
}
|
|
519
524
|
remove(key) {
|
|
520
|
-
if (
|
|
521
|
-
delete
|
|
525
|
+
if (this.cache.hasOwnProperty(key)) {
|
|
526
|
+
delete this.cache[key];
|
|
522
527
|
}
|
|
523
528
|
}
|
|
524
529
|
flushAll() {
|
|
525
|
-
|
|
530
|
+
this.cache = {};
|
|
531
|
+
if (this.ttlChecker) {
|
|
532
|
+
clearInterval(this.ttlChecker);
|
|
533
|
+
this.ttlChecker = undefined;
|
|
534
|
+
}
|
|
526
535
|
}
|
|
527
536
|
}
|
|
528
|
-
NodeCache.ttlChecker = void 0;
|
|
529
|
-
NodeCache.cache = {};
|
|
530
537
|
|
|
531
538
|
var ECacheContext;
|
|
532
539
|
(function (ECacheContext) {
|
|
@@ -574,6 +581,11 @@ class OCache {
|
|
|
574
581
|
}
|
|
575
582
|
}
|
|
576
583
|
static async clearAll() {
|
|
584
|
+
for (const cacheContext in this.cache) {
|
|
585
|
+
if (this.cache.hasOwnProperty(cacheContext)) {
|
|
586
|
+
this.cache[cacheContext].flushAll();
|
|
587
|
+
}
|
|
588
|
+
}
|
|
577
589
|
this.cache = {};
|
|
578
590
|
}
|
|
579
591
|
}
|
|
@@ -2109,6 +2121,7 @@ var AchCustomSectionType;
|
|
|
2109
2121
|
AchCustomSectionType[AchCustomSectionType["REDIRECT_LINK"] = 9] = "REDIRECT_LINK";
|
|
2110
2122
|
AchCustomSectionType[AchCustomSectionType["LOOTBOX_WEEKLY"] = 10] = "LOOTBOX_WEEKLY";
|
|
2111
2123
|
AchCustomSectionType[AchCustomSectionType["LOOTBOX_CALENDAR_DAYS"] = 11] = "LOOTBOX_CALENDAR_DAYS";
|
|
2124
|
+
AchCustomSectionType[AchCustomSectionType["TREASURE_HUNT"] = 12] = "TREASURE_HUNT";
|
|
2112
2125
|
})(AchCustomSectionType || (AchCustomSectionType = {}));
|
|
2113
2126
|
var AchCustomLayoutTheme;
|
|
2114
2127
|
(function (AchCustomLayoutTheme) {
|