@rg-dev/tzevaadom-api 1.0.4 → 1.0.5
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/index.cjs +25 -0
- package/dist/index.d.cts +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -484,6 +484,27 @@ Object.defineProperty(Emittery, "listenerRemoved", {
|
|
|
484
484
|
});
|
|
485
485
|
|
|
486
486
|
// src/index.ts
|
|
487
|
+
function getThreatName(threat) {
|
|
488
|
+
switch (threat) {
|
|
489
|
+
case 0:
|
|
490
|
+
return "Rockets";
|
|
491
|
+
case 1:
|
|
492
|
+
return "HazardousMaterials";
|
|
493
|
+
case 2:
|
|
494
|
+
return "Terrorists";
|
|
495
|
+
case 3:
|
|
496
|
+
return "Earthquake";
|
|
497
|
+
case 4:
|
|
498
|
+
return "Tsunami";
|
|
499
|
+
case 5:
|
|
500
|
+
return "UnmannedAircraft";
|
|
501
|
+
case 6:
|
|
502
|
+
case 7:
|
|
503
|
+
return "NonConventionalMissile";
|
|
504
|
+
default:
|
|
505
|
+
return "GeneralAlert";
|
|
506
|
+
}
|
|
507
|
+
}
|
|
487
508
|
var WS_URL = "wss://ws.tzevaadom.co.il/socket?platform=WEB";
|
|
488
509
|
var HEADERS = { Origin: "https://www.tzevaadom.co.il" };
|
|
489
510
|
var MAX_DELAY = 1e4;
|
|
@@ -505,6 +526,10 @@ var TzevaadomClient = class extends Emittery {
|
|
|
505
526
|
return;
|
|
506
527
|
try {
|
|
507
528
|
const { type, data } = JSON.parse(raw.toString());
|
|
529
|
+
if (type === "ALERT") {
|
|
530
|
+
const casted = data;
|
|
531
|
+
casted.threatName = getThreatName(casted.threat);
|
|
532
|
+
}
|
|
508
533
|
this.emit(type, data);
|
|
509
534
|
} catch {
|
|
510
535
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -612,9 +612,11 @@ declare class Emittery<
|
|
|
612
612
|
bindMethods(target: Record<string, unknown>, methodNames?: readonly string[]): void;
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
+
type ThreatName = "Rockets" | "HazardousMaterials" | "Terrorists" | "Earthquake" | "Tsunami" | "UnmannedAircraft" | "NonConventionalMissile" | "GeneralAlert";
|
|
615
616
|
interface AlertData {
|
|
616
617
|
notificationId: string;
|
|
617
618
|
time: number;
|
|
619
|
+
threatName: ThreatName;
|
|
618
620
|
threat: number;
|
|
619
621
|
isDrill: boolean;
|
|
620
622
|
cities: string[];
|