feat: add multi-location uptime monitoring via Globalping

## Changes

### Server
- Add `locations` field to Monitor model and types (up to 5 locations per monitor)
- Add `location` field to Check metadata for per-location tracking
- Add `globalpingApiKey` to AppSettings for API key management
- Create GlobalpingService that wraps the Globalping SDK to run distributed
  HTTP/ping checks from multiple global locations (NA, EU, AS, SA, OC, AF)
- Extend SuperSimpleQueueHelper with fire-and-forget Globalping checks that
  run alongside the existing local check without affecting the main pipeline
- Add location-aware check queries with aggregation pipeline grouping by
  location in MongoChecksRepository
- Filter location checks from main uptime aggregation to preserve local check
  as source of truth for status/incidents
- Extend monitor details endpoint to return per-location check data
- Add GET /globalping/locations endpoint for available location options
- Add globalpingKeySet to settings response
- Add Joi validation for locations and globalpingApiKey fields

### Client
- Add locations multi-select (Autocomplete with chips) to monitor creation
  form, shown only for HTTP and ping monitor types
- Add SettingsGlobalping component for API key management (matching existing
  PageSpeed pattern with set/reset flow)
- Add per-location breakdown section to uptime details page with tabs,
  avg response time, uptime percentage, and response time charts
- Add globe icon with tooltip to monitor table for monitors with locations
- Add Zod validation for locations field in HTTP and ping schemas
- Add all translation keys for globalping settings, locations form, and
  location details sections

## Benefits
- Users gain visibility into geographic availability and latency data
- Local check remains the source of truth, Globalping runs alongside
- Supports up to 5 locations per monitor with 6 continent-level options
- Graceful degradation when API key is not configured or rate limited
This commit is contained in:
gorkem-bwl committed 2026-02-19 00:45:14 -05:00
1 parent 1c1474cd6f
commit e39b44db6c
33 files changed
+1258 -24

No files matched your search

+2
View File
@@ -37,6 +37,7 @@ export const useMonitorForm = ({
matchMethod: data?.matchMethod || "",
expectedValue: data?.expectedValue || "",
jsonPath: data?.jsonPath || "",
locations: data?.locations || [],
};
break;
case "ping":
@@ -44,6 +45,7 @@ export const useMonitorForm = ({
...base,
type: "ping",
url: data?.url || "",
locations: data?.locations || [],
};
break;
case "port":
+1
View File
@@ -29,6 +29,7 @@ export const useSettingsForm = ({ data = null }: UseSettingsFormOptions = {}) =>
},
checkTTL: data?.checkTTL ?? 30,
pagespeedApiKey: "",
globalpingApiKey: "",
systemEmailPassword: "",
};
+59
View File
@@ -27,12 +27,18 @@ import {
SliderWithLabel,
Dialog,
} from "@/Components/v2/inputs";
import Chip from "@mui/material/Chip";
import { useGet, usePost, usePatch, useDelete } from "@/Hooks/UseApi";
import { useMonitorForm } from "@/Hooks/useMonitorForm";
import type { Monitor, MonitorType, GamesMap } from "@/Types/Monitor";
import type { Notification } from "@/Types/Notification";
import type { MonitorFormData } from "@/Validation/monitor";
interface GlobalpingLocation {
id: string;
label: string;
}
interface GeneralSettingsConfig {
urlLabel: string;
urlPlaceholder: string;
@@ -146,6 +152,9 @@ const CreateMonitorPage = () => {
const { data: notifications } = useGet<Notification[]>("/notifications/team");
const { data: games } = useGet<GamesMap>("/monitors/games");
const { data: globalpingLocations } = useGet<GlobalpingLocation[]>(
"/monitors/globalping/locations"
);
const { schema, defaults } = useMonitorForm({
data: existingMonitor ?? null,
@@ -489,6 +498,56 @@ const CreateMonitorPage = () => {
}
/>
{/* Global locations - only for http and ping types */}
{(watchedType === "http" || watchedType === "ping") && globalpingLocations && globalpingLocations.length > 0 && (
<ConfigBox
title={t("pages.createMonitor.form.locations.title")}
subtitle={t("pages.createMonitor.form.locations.description")}
rightContent={
<Controller
name="locations"
control={control}
render={({ field }) => {
const locationOptions = (globalpingLocations ?? []).map((loc) => ({
...loc,
name: loc.label,
}));
const selectedLocations = locationOptions.filter((loc) =>
(field.value ?? []).includes(loc.id)
);
return (
<Stack spacing={theme.spacing(4)}>
<Autocomplete
multiple
options={locationOptions}
value={selectedLocations}
getOptionLabel={(option) => option.name}
onChange={(_: unknown, newValue: typeof locationOptions) => {
const ids = newValue.map((loc) => loc.id);
if (ids.length <= 5) {
field.onChange(ids);
}
}}
isOptionEqualToValue={(option, value) => option.id === value.id}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<Chip
{...getTagProps({ index })}
key={option.id}
label={option.name}
size="small"
/>
))
}
/>
</Stack>
);
}}
/>
}
/>
)}
{/* Alert Thresholds - only for hardware type */}
{generalSettingsConfig.showSecret && (
<ConfigBox
@@ -0,0 +1,98 @@
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import ConfigBox from "@/Components/v1/ConfigBox/index.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index.jsx";
import { useTheme } from "@emotion/react";
import { PropTypes } from "prop-types";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Controller } from "react-hook-form";
const SettingsGlobalping = ({
isAdmin,
HEADING_SX,
isGlobalpingKeySet,
globalpingKeyHasBeenReset,
setGlobalpingKeyHasBeenReset,
defaults,
control,
setValue,
}) => {
const { t } = useTranslation();
const theme = useTheme();
if (!isAdmin) {
return null;
}
return (
<ConfigBox>
<Box>
<Typography
component="h1"
variant="h2"
>
{t("pages.settings.globalpingSettings.title")}
</Typography>
<Typography sx={HEADING_SX}>
{t("pages.settings.globalpingSettings.description")}
</Typography>
</Box>
<Stack gap={theme.spacing(20)}>
{(isGlobalpingKeySet === false || globalpingKeyHasBeenReset === true) && (
<Controller
name="globalpingApiKey"
control={control}
defaultValue={defaults.globalpingApiKey}
render={({ field, fieldState }) => (
<TextInput
{...field}
label={t("pages.settings.globalpingSettings.labelApiKey")}
type={"password"}
optionalLabel="(Optional)"
endAdornment={<PasswordEndAdornment />}
error={!!fieldState.error}
helperText={fieldState.error?.message}
/>
)}
/>
)}
{isGlobalpingKeySet === true && globalpingKeyHasBeenReset === false && (
<Box>
<Typography>
{t("pages.settings.globalpingSettings.labelApiKeySet")}
</Typography>
<Button
onClick={() => {
setValue("globalpingApiKey", "");
setGlobalpingKeyHasBeenReset(true);
}}
variant="contained"
color="error"
sx={{ mt: theme.spacing(4) }}
>
{t("reset")}
</Button>
</Box>
)}
</Stack>
</ConfigBox>
);
};
SettingsGlobalping.propTypes = {
isAdmin: PropTypes.bool,
HEADING_SX: PropTypes.object,
isGlobalpingKeySet: PropTypes.bool,
globalpingKeyHasBeenReset: PropTypes.bool,
setGlobalpingKeyHasBeenReset: PropTypes.func,
defaults: PropTypes.object,
control: PropTypes.object,
setValue: PropTypes.func,
};
export default SettingsGlobalping;
+20
View File
@@ -5,6 +5,7 @@ import SettingsTimeZone from "./SettingsTimeZone.jsx";
import SettingsUI from "./SettingsUI.jsx";
import SettingsURL from "./SettingsURL.jsx";
import SettingsPagespeed from "./SettingsPagespeed.jsx";
import SettingsGlobalping from "./SettingsGlobalping.jsx";
import SettingsDemoMonitors from "./SettingsDemoMonitors.jsx";
import SettingsAbout from "./SettingsAbout.jsx";
import SettingsEmail from "./SettingsEmail.jsx";
@@ -34,6 +35,10 @@ const Settings = () => {
fetchedSettings?.pagespeedKeySet ?? false
);
const [apiKeyHasBeenReset, setApiKeyHasBeenReset] = useState(false);
const [isGlobalpingKeySet, setIsGlobalpingKeySet] = useState(
fetchedSettings?.globalpingKeySet ?? false
);
const [globalpingKeyHasBeenReset, setGlobalpingKeyHasBeenReset] = useState(false);
const [isEmailPasswordSet, setIsEmailPasswordSet] = useState(
fetchedSettings?.emailPasswordSet ?? false
);
@@ -63,6 +68,7 @@ const Settings = () => {
useEffect(() => {
if (fetchedSettings) {
setIsApiKeySet(fetchedSettings?.pagespeedKeySet);
setIsGlobalpingKeySet(fetchedSettings?.globalpingKeySet);
setIsEmailPasswordSet(fetchedSettings?.emailPasswordSet);
}
}, [fetchedSettings]);
@@ -74,10 +80,14 @@ const Settings = () => {
if (response?.data) {
const data = response.data;
setIsApiKeySet(data.pagespeedKeySet);
setIsGlobalpingKeySet(data.globalpingKeySet);
setIsEmailPasswordSet(data.emailPasswordSet);
if (data.pagespeedKeySet === true) {
setApiKeyHasBeenReset(false);
}
if (data.globalpingKeySet === true) {
setGlobalpingKeyHasBeenReset(false);
}
if (data.emailPasswordSet === true) {
setEmailPasswordHasBeenReset(false);
}
@@ -134,6 +144,16 @@ const Settings = () => {
defaults={defaults}
setValue={setValue}
/>
<SettingsGlobalping
isAdmin={isAdmin}
HEADING_SX={HEADING_SX}
isGlobalpingKeySet={isGlobalpingKeySet}
globalpingKeyHasBeenReset={globalpingKeyHasBeenReset}
setGlobalpingKeyHasBeenReset={setGlobalpingKeyHasBeenReset}
control={control}
defaults={defaults}
setValue={setValue}
/>
<SettingsURL
HEADING_SX={HEADING_SX}
control={control}
+72 -1
View File
@@ -1,6 +1,10 @@
import { BasePage } from "@/Components/v2/design-elements";
import { HeaderTimeRange } from "@/Components/v2/common";
import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
import {
HistogramStatus,
RadialAvgResponse,
@@ -17,7 +21,7 @@ import { useState, useMemo } from "react";
import { useParams } from "react-router-dom";
import { useSelector } from "react-redux";
import { useGet } from "@/Hooks/UseApi";
import type { MonitorDetailsResponse } from "@/Types/Monitor";
import type { MonitorDetailsResponse, LocationCheckData } from "@/Types/Monitor";
import type { ChecksResponse } from "@/Types/Check";
import type { RootState } from "@/Types/state";
import { formatDateWithTz } from "@/Utils/TimeUtils";
@@ -38,6 +42,7 @@ const UptimeDetailsPage = () => {
const [page, setPage] = useState<number>(0);
const [rowsPerPage, setRowsPerPage] = useState<number>(5);
const [dateRange, setDateRange] = useState<string>("recent");
const [selectedLocationTab, setSelectedLocationTab] = useState<number>(0);
const monitorDetailsUrl = useMemo(() => {
if (!monitorId) {
@@ -108,6 +113,15 @@ const UptimeDetailsPage = () => {
const checks = checksData?.checks ?? [];
const checksCount = checksData?.checksCount ?? 0;
const locationChecks = monitorData?.locationChecks;
const locationKeys = useMemo(
() => (locationChecks ? Object.keys(locationChecks).sort() : []),
[locationChecks]
);
const selectedLocation = locationKeys[selectedLocationTab] ?? null;
const selectedLocationData: LocationCheckData | null =
selectedLocation && locationChecks ? locationChecks[selectedLocation] : null;
return (
<BasePage>
<HeaderMonitorControls
@@ -152,6 +166,63 @@ const UptimeDetailsPage = () => {
checks={monitorData?.groupedChecks || []}
range={dateRange}
/>
{locationKeys.length > 0 && (
<Box>
<Typography
variant="h2"
sx={{ mb: theme.spacing(4) }}
>
{t("pages.uptime.details.locations.title")}
</Typography>
<Tabs
value={selectedLocationTab}
onChange={(_e, newVal) => setSelectedLocationTab(newVal)}
sx={{ mb: theme.spacing(4) }}
>
{locationKeys.map((loc) => (
<Tab
key={loc}
label={loc}
/>
))}
</Tabs>
{selectedLocationData && (
<Stack gap={theme.spacing(4)}>
<Stack
direction="row"
gap={theme.spacing(8)}
>
<Box>
<Typography
variant="body2"
color="text.secondary"
>
{t("pages.uptime.details.locations.avgResponseTime")}
</Typography>
<Typography variant="h3">
{Math.round(selectedLocationData.avgResponseTime)} ms
</Typography>
</Box>
<Box>
<Typography
variant="body2"
color="text.secondary"
>
{t("pages.uptime.details.locations.uptime")}
</Typography>
<Typography variant="h3">
{(selectedLocationData.uptimePercentage * 100).toFixed(1)}%
</Typography>
</Box>
</Stack>
<HistogramDetails
checks={selectedLocationData.groupedChecks || []}
range={dateRange}
/>
</Stack>
)}
</Box>
)}
<ChecksTable
checks={checks}
count={checksCount}
@@ -9,7 +9,8 @@ import {
} from "@/Components/v2/design-elements";
import { HeatmapResponseTime, HistogramResponseTime } from "@/Components/v2/common";
import { ActionsMenu } from "@/Components/v2/actions-menu";
import { ArrowDown, ArrowUp } from "lucide-react";
import { ArrowDown, ArrowUp, Globe } from "lucide-react";
import Tooltip from "@mui/material/Tooltip";
import { useTranslation } from "react-i18next";
import { useTheme } from "@mui/material/styles";
@@ -167,7 +168,20 @@ export const MonitorTable = ({
),
render: (row) => {
return row?.name;
return (
<Stack
direction="row"
alignItems="center"
gap={theme.spacing(2)}
>
{row?.name}
{row.locations && row.locations.length > 0 && (
<Tooltip title={`${row.locations.length} ${t("pages.uptime.table.headers.locations").toLowerCase()}: ${row.locations.join(", ")}`}>
<Globe size={14} />
</Tooltip>
)}
</Stack>
);
},
},
{
+8
View File
@@ -58,6 +58,7 @@ export interface Monitor {
selectedDisks: string[];
gameId?: string;
group: string | null;
locations: string[];
recentChecks: CheckSnapshot[];
createdAt: string;
updatedAt: string;
@@ -97,6 +98,12 @@ export interface MonitorStats {
updatedAt: string;
}
export interface LocationCheckData {
groupedChecks: GroupedCheck[];
uptimePercentage: number;
avgResponseTime: number;
}
export interface MonitorData {
monitor: Monitor;
groupedChecks: GroupedCheck[];
@@ -104,6 +111,7 @@ export interface MonitorData {
groupedDownChecks: GroupedCheck[];
groupedAvgResponseTime: number;
groupedUptimePercentage: number;
locationChecks?: Record<string, LocationCheckData>;
}
export interface MonitorDetailsResponse {
+1
View File
@@ -29,6 +29,7 @@ export interface Settings {
export interface AppSettingsResponse {
pagespeedKeySet: boolean;
globalpingKeySet: boolean;
emailPasswordSet: boolean;
settings: Settings;
}
+2
View File
@@ -31,12 +31,14 @@ const httpSchema = baseSchema.extend({
matchMethod: z.enum(["equal", "include", "regex", ""]).optional(),
expectedValue: z.string().optional(),
jsonPath: z.string().optional(),
locations: z.array(z.string()).max(5).optional(),
});
// Ping monitor schema
const pingSchema = baseSchema.extend({
type: z.literal("ping"),
url: z.string().min(1, "Host is required"),
locations: z.array(z.string()).max(5).optional(),
});
// Port monitor schema
+1
View File
@@ -34,6 +34,7 @@ export const settingsSchema = z.object({
.min(1, "Please enter a value")
.max(365, "Maximum 365 days"),
pagespeedApiKey: optionalString(),
globalpingApiKey: optionalString(),
systemEmailHost: z.preprocess(
(val) =>
val === "" || val === null || val === undefined ? undefined : String(val).trim(),
+22 -1
View File
@@ -487,6 +487,12 @@
"hardware": "Monitor CPU, memory, disk usage, and temperature for your infrastructure."
}
},
"locations": {
"title": "Global locations",
"description": "Run uptime checks from multiple geographic regions using Globalping. Select up to 5 locations.",
"label": "Check locations",
"placeholder": "Select locations"
},
"ignoreTls": {
"description": "Configure TLS/SSL certificate validation for HTTPS connections.",
"option": {
@@ -950,6 +956,12 @@
"labelApiKey": "PageSpeed API key",
"title": "Google PageSpeed API key"
},
"globalpingSettings": {
"description": "Enter your Globalping API key to enable multi-location uptime monitoring. This allows checking your monitors from different geographic regions.",
"labelApiKeySet": "API key is set. Click Reset to change it.",
"labelApiKey": "Globalping API key",
"title": "Globalping API key"
},
"saveButtonLabel": "Save",
"statsSettings": {
"clearAllStatsButton": "Clear all stats",
@@ -1106,6 +1118,14 @@
}
},
"uptime": {
"details": {
"locations": {
"title": "Location breakdown",
"label": "Location",
"avgResponseTime": "Avg response time",
"uptime": "Uptime"
}
},
"filters": {
"search": {
"placeholder": "Search monitors..."
@@ -1113,7 +1133,8 @@
},
"table": {
"headers": {
"responseTime": "Response time"
"responseTime": "Response time",
"locations": "Locations"
}
},
"fallback": {
+580 -17
View File
@@ -22,6 +22,7 @@
"express": "^4.19.2",
"express-rate-limit": "8.0.1",
"gamedig": "^5.3.1",
"globalping": "^0.2.0",
"got": "14.4.7",
"handlebars": "^4.7.8",
"helmet": "^8.0.0",
@@ -874,7 +875,6 @@
"integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.28.6",
"@babel/generator": "^7.28.6",
@@ -1504,7 +1504,6 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
},
@@ -1549,7 +1548,6 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
}
@@ -2261,6 +2259,132 @@
"@hapi/hoek": "^9.0.0"
}
},
"node_modules/@hey-api/client-fetch": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@hey-api/client-fetch/-/client-fetch-0.10.2.tgz",
"integrity": "sha512-AGiFYDx+y8VT1wlQ3EbzzZtfU8EfV+hLLRTtr8Y/tjYZaxIECwJagVZf24YzNbtEBXONFV50bwcU1wLVGXe1ow==",
"deprecated": "Starting with v0.73.0, this package is bundled directly inside @hey-api/openapi-ts.",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/hey-api"
},
"peerDependencies": {
"@hey-api/openapi-ts": "< 2"
}
},
"node_modules/@hey-api/codegen-core": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@hey-api/codegen-core/-/codegen-core-0.7.0.tgz",
"integrity": "sha512-HglL4B4QwpzocE+c8qDU6XK8zMf8W8Pcv0RpFDYxHuYALWLTnpDUuEsglC7NQ4vC1maoXsBpMbmwpco0N4QviA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@hey-api/types": "0.1.3",
"ansi-colors": "4.1.3",
"c12": "3.3.3",
"color-support": "1.1.3"
},
"engines": {
"node": ">=20.19.0"
},
"funding": {
"url": "https://github.com/sponsors/hey-api"
},
"peerDependencies": {
"typescript": ">=5.5.3"
}
},
"node_modules/@hey-api/json-schema-ref-parser": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@hey-api/json-schema-ref-parser/-/json-schema-ref-parser-1.3.0.tgz",
"integrity": "sha512-3tQJ8N2egHXZjQWUeceoWrl88APWjo7gRrQ/L4HWJKnh6HowczCv7yNNFeSusPoWGV6HGdoFiCvq6UsLkrwKhg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jsdevtools/ono": "7.1.3",
"@types/json-schema": "7.0.15",
"js-yaml": "4.1.1"
},
"engines": {
"node": ">=20.19.0"
},
"funding": {
"url": "https://github.com/sponsors/hey-api"
}
},
"node_modules/@hey-api/openapi-ts": {
"version": "0.92.4",
"resolved": "https://registry.npmjs.org/@hey-api/openapi-ts/-/openapi-ts-0.92.4.tgz",
"integrity": "sha512-RA3wnL7Odr5xczuS3xpvnPClgJ/K8jivK3hvD8J0m5GBuvJFkZ1A1xp+6Ve1G0BV8p4LwxwgN1Qhb+4BFsLfMg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@hey-api/codegen-core": "0.7.0",
"@hey-api/json-schema-ref-parser": "1.3.0",
"@hey-api/shared": "0.2.0",
"@hey-api/types": "0.1.3",
"ansi-colors": "4.1.3",
"color-support": "1.1.3",
"commander": "14.0.3"
},
"bin": {
"openapi-ts": "bin/run.js"
},
"engines": {
"node": ">=20.19.0"
},
"funding": {
"url": "https://github.com/sponsors/hey-api"
},
"peerDependencies": {
"typescript": ">=5.5.3"
}
},
"node_modules/@hey-api/openapi-ts/node_modules/commander": {
"version": "14.0.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",
"integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20"
}
},
"node_modules/@hey-api/shared": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@hey-api/shared/-/shared-0.2.0.tgz",
"integrity": "sha512-t7C+65ES12OqAE5k6DB/y5nDuTjydtqdxf/Qe4zflVn2AzGs7hO/7KjXvGXZYnpNVF7QISAcj0LEObASU9I53Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"@hey-api/codegen-core": "0.7.0",
"@hey-api/json-schema-ref-parser": "1.3.0",
"@hey-api/types": "0.1.3",
"ansi-colors": "4.1.3",
"cross-spawn": "7.0.6",
"open": "11.0.0",
"semver": "7.7.3"
},
"engines": {
"node": ">=20.19.0"
},
"funding": {
"url": "https://github.com/sponsors/hey-api"
},
"peerDependencies": {
"typescript": ">=5.5.3"
}
},
"node_modules/@hey-api/types": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@hey-api/types/-/types-0.1.3.tgz",
"integrity": "sha512-mZaiPOWH761yD4GjDQvtjS2ZYLu5o5pI1TVSvV/u7cmbybv51/FVtinFBeaE1kFQCKZ8OQpn2ezjLBJrKsGATw==",
"license": "MIT",
"peer": true,
"peerDependencies": {
"typescript": ">=5.5.3"
}
},
"node_modules/@humanfs/core": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
@@ -3223,6 +3347,13 @@
"url": "https://opencollective.com/js-sdsl"
}
},
"node_modules/@jsdevtools/ono": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz",
"integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==",
"license": "MIT",
"peer": true
},
"node_modules/@mongodb-js/saslprep": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.3.2.tgz",
@@ -4229,6 +4360,7 @@
"integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==",
"license": "ISC",
"optional": true,
"peer": true,
"engines": {
"node": ">=10.13.0"
}
@@ -4405,7 +4537,6 @@
"integrity": "sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^5.0.0",
@@ -4506,7 +4637,6 @@
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/jsonwebtoken": {
@@ -4566,7 +4696,6 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz",
"integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==",
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@@ -5053,7 +5182,6 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -5632,7 +5760,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.8.19",
"caniuse-lite": "^1.0.30001751",
@@ -5739,6 +5866,22 @@
"uuid": "^9.0.0"
}
},
"node_modules/bundle-name": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz",
"integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"run-applescript": "^7.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/busboy": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
@@ -5759,6 +5902,78 @@
"node": ">= 0.8"
}
},
"node_modules/c12": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/c12/-/c12-3.3.3.tgz",
"integrity": "sha512-750hTRvgBy5kcMNPdh95Qo+XUBeGo8C7nsKSmedDmaQI+E0r82DwHeM6vBewDe4rGFbnxoa4V9pw+sPh5+Iz8Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"chokidar": "^5.0.0",
"confbox": "^0.2.2",
"defu": "^6.1.4",
"dotenv": "^17.2.3",
"exsolve": "^1.0.8",
"giget": "^2.0.0",
"jiti": "^2.6.1",
"ohash": "^2.0.11",
"pathe": "^2.0.3",
"perfect-debounce": "^2.0.0",
"pkg-types": "^2.3.0",
"rc9": "^2.1.2"
},
"peerDependencies": {
"magicast": "*"
},
"peerDependenciesMeta": {
"magicast": {
"optional": true
}
}
},
"node_modules/c12/node_modules/chokidar": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
"integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",
"license": "MIT",
"peer": true,
"dependencies": {
"readdirp": "^5.0.0"
},
"engines": {
"node": ">= 20.19.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/c12/node_modules/dotenv": {
"version": "17.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.3.1.tgz",
"integrity": "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA==",
"license": "BSD-2-Clause",
"peer": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/c12/node_modules/readdirp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
"integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">= 20.19.0"
},
"funding": {
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/c8": {
"version": "10.1.3",
"resolved": "https://registry.npmjs.org/c8/-/c8-10.1.3.tgz",
@@ -6023,6 +6238,16 @@
"node": ">=8"
}
},
"node_modules/citty": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/citty/-/citty-0.1.6.tgz",
"integrity": "sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"consola": "^3.2.3"
}
},
"node_modules/cjs-module-lexer": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz",
@@ -6220,6 +6445,16 @@
"simple-swizzle": "^0.2.2"
}
},
"node_modules/color-support": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
"license": "ISC",
"peer": true,
"bin": {
"color-support": "bin.js"
}
},
"node_modules/colord": {
"version": "2.9.3",
"resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz",
@@ -6357,6 +6592,23 @@
"safe-buffer": "~5.1.0"
}
},
"node_modules/confbox": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.4.tgz",
"integrity": "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==",
"license": "MIT",
"peer": true
},
"node_modules/consola": {
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz",
"integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==",
"license": "MIT",
"peer": true,
"engines": {
"node": "^14.18.0 || >=16.10.0"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@@ -6575,7 +6827,6 @@
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-7.1.1.tgz",
"integrity": "sha512-fm4D8ti0dQmFPeF8DXSAA//btEmqCOgAc/9Oa3C1LW94h5usNrJEfrON7b4FkPZgnDEn6OUs5NdxiJZmAtGOpQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"cssnano-preset-default": "^7.0.9",
"lilconfig": "^3.1.3"
@@ -6821,6 +7072,36 @@
"node": ">=0.10.0"
}
},
"node_modules/default-browser": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.0.tgz",
"integrity": "sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw==",
"license": "MIT",
"peer": true,
"dependencies": {
"bundle-name": "^4.1.0",
"default-browser-id": "^5.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/default-browser-id": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz",
"integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/defer-to-connect": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",
@@ -6830,6 +7111,26 @@
"node": ">=10"
}
},
"node_modules/define-lazy-prop": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/defu": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
"integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
"license": "MIT",
"peer": true
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@@ -6857,6 +7158,13 @@
"node": ">= 0.8"
}
},
"node_modules/destr": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz",
"integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==",
"license": "MIT",
"peer": true
},
"node_modules/destroy": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
@@ -7330,7 +7638,6 @@
"integrity": "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -7692,7 +7999,6 @@
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
"integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
"license": "MIT",
"peer": true,
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
@@ -7767,6 +8073,13 @@
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"license": "MIT"
},
"node_modules/exsolve": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.8.tgz",
"integrity": "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==",
"license": "MIT",
"peer": true
},
"node_modules/extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
@@ -8395,6 +8708,24 @@
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/giget": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/giget/-/giget-2.0.0.tgz",
"integrity": "sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==",
"license": "MIT",
"peer": true,
"dependencies": {
"citty": "^0.1.6",
"consola": "^3.4.0",
"defu": "^6.1.4",
"node-fetch-native": "^1.6.6",
"nypm": "^0.6.0",
"pathe": "^2.0.3"
},
"bin": {
"giget": "dist/cli.mjs"
}
},
"node_modules/glob": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
@@ -8452,6 +8783,15 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/globalping": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/globalping/-/globalping-0.2.0.tgz",
"integrity": "sha512-rxyvqXF/oz5yBGJHR58TEsCkcbc4WQVmdKC+uZ8LXfIt4KwTdTvbzkfwhhjuyUmuQr8U/b8m/ZicdrA8ZIroKw==",
"license": "MIT",
"dependencies": {
"@hey-api/client-fetch": "^0.10.0"
}
},
"node_modules/globals": {
"version": "15.15.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz",
@@ -8947,6 +9287,22 @@
"node": ">=8"
}
},
"node_modules/is-docker": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
"license": "MIT",
"peer": true,
"bin": {
"is-docker": "cli.js"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -8987,6 +9343,38 @@
"node": ">=0.10.0"
}
},
"node_modules/is-in-ssh": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-in-ssh/-/is-in-ssh-1.0.0.tgz",
"integrity": "sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-inside-container": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
"integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
"license": "MIT",
"peer": true,
"dependencies": {
"is-docker": "^3.0.0"
},
"bin": {
"is-inside-container": "cli.js"
},
"engines": {
"node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-json": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-json/-/is-json-2.0.1.tgz",
@@ -9020,6 +9408,22 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-wsl": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz",
"integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==",
"license": "MIT",
"peer": true,
"dependencies": {
"is-inside-container": "^1.0.0"
},
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
@@ -9341,7 +9745,6 @@
"integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@jest/core": "30.2.0",
"@jest/types": "30.2.0",
@@ -9929,6 +10332,16 @@
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/jiti": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz",
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
"license": "MIT",
"peer": true,
"bin": {
"jiti": "lib/jiti-cli.mjs"
}
},
"node_modules/jmespath": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz",
@@ -11611,6 +12024,13 @@
}
}
},
"node_modules/node-fetch-native": {
"version": "1.6.7",
"resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz",
"integrity": "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==",
"license": "MIT",
"peer": true
},
"node_modules/node-fetch/node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
@@ -11780,6 +12200,31 @@
"integrity": "sha512-ujSMe1OWVn55euT1ihwCI1ZcAaAU3nxUiDwfDQldc51ZXaB9m2AyOn6/jh1BLe2t/G8xd6uKG1UBF2aZJeg2SQ==",
"license": "MIT"
},
"node_modules/nypm": {
"version": "0.6.5",
"resolved": "https://registry.npmjs.org/nypm/-/nypm-0.6.5.tgz",
"integrity": "sha512-K6AJy1GMVyfyMXRVB88700BJqNUkByijGJM8kEHpLdcAt+vSQAVfkWWHYzuRXHSY6xA2sNc5RjTj0p9rE2izVQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"citty": "^0.2.0",
"pathe": "^2.0.3",
"tinyexec": "^1.0.2"
},
"bin": {
"nypm": "dist/cli.mjs"
},
"engines": {
"node": ">=18"
}
},
"node_modules/nypm/node_modules/citty": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/citty/-/citty-0.2.1.tgz",
"integrity": "sha512-kEV95lFBhQgtogAPlQfJJ0WGVSokvLr/UEoFPiKKOXF7pl98HfUVUD0ejsuTCld/9xH9vogSywZ5KqHzXrZpqg==",
"license": "MIT",
"peer": true
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -11801,6 +12246,13 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/ohash": {
"version": "2.0.11",
"resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz",
"integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==",
"license": "MIT",
"peer": true
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
@@ -11856,6 +12308,27 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/open/-/open-11.0.0.tgz",
"integrity": "sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw==",
"license": "MIT",
"peer": true,
"dependencies": {
"default-browser": "^5.4.0",
"define-lazy-prop": "^3.0.0",
"is-in-ssh": "^1.0.0",
"is-inside-container": "^1.0.0",
"powershell-utils": "^0.1.0",
"wsl-utils": "^0.3.0"
},
"engines": {
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@@ -12080,6 +12553,20 @@
"node": ">=8"
}
},
"node_modules/pathe": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
"integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
"license": "MIT",
"peer": true
},
"node_modules/perfect-debounce": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-2.1.0.tgz",
"integrity": "sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g==",
"license": "MIT",
"peer": true
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@@ -12199,6 +12686,18 @@
"node": ">=8"
}
},
"node_modules/pkg-types": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.0.tgz",
"integrity": "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==",
"license": "MIT",
"peer": true,
"dependencies": {
"confbox": "^0.2.2",
"exsolve": "^1.0.7",
"pathe": "^2.0.3"
}
},
"node_modules/plimit-lit": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz",
@@ -12231,7 +12730,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@@ -12825,6 +13323,19 @@
"node": ">=12"
}
},
"node_modules/powershell-utils": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.1.0.tgz",
"integrity": "sha512-dM0jVuXJPsDN6DvRpea484tCUaMiXWjuCn++HGTqUWzGDjv5tZkEZldAJ/UMlqRYGFrD/etByo4/xOuC/snX2A==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -13088,6 +13599,17 @@
"node": ">= 0.8"
}
},
"node_modules/rc9": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/rc9/-/rc9-2.1.2.tgz",
"integrity": "sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==",
"license": "MIT",
"peer": true,
"dependencies": {
"defu": "^6.1.4",
"destr": "^2.0.3"
}
},
"node_modules/react-is": {
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
@@ -13280,6 +13802,19 @@
"integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==",
"license": "MIT"
},
"node_modules/run-applescript": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz",
"integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@@ -14179,6 +14714,7 @@
"integrity": "sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==",
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"@trysound/sax": "0.2.0",
"commander": "^7.2.0",
@@ -14205,6 +14741,7 @@
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">= 10"
}
@@ -14215,6 +14752,7 @@
"integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"mdn-data": "2.0.30",
"source-map-js": "^1.0.1"
@@ -14228,7 +14766,8 @@
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",
"integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==",
"license": "CC0-1.0",
"optional": true
"optional": true,
"peer": true
},
"node_modules/swagger-ui-dist": {
"version": "5.30.0",
@@ -14365,6 +14904,16 @@
"integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==",
"license": "MIT"
},
"node_modules/tinyexec": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz",
"integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/tldts": {
"version": "6.1.86",
"resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
@@ -14513,7 +15062,6 @@
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
@@ -14674,9 +15222,7 @@
"version": "5.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"devOptional": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -15306,6 +15852,23 @@
}
}
},
"node_modules/wsl-utils": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.3.1.tgz",
"integrity": "sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg==",
"license": "MIT",
"peer": true,
"dependencies": {
"is-wsl": "^3.1.0",
"powershell-utils": "^0.1.0"
},
"engines": {
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/xml-name-validator": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
+1
View File
@@ -37,6 +37,7 @@
"express": "^4.19.2",
"express-rate-limit": "8.0.1",
"gamedig": "^5.3.1",
"globalping": "^0.2.0",
"got": "14.4.7",
"handlebars": "^4.7.8",
"helmet": "^8.0.0",
+4
View File
@@ -14,6 +14,7 @@ import {
INotificationsService,
} from "@/service/index.js";
import SuperSimpleQueueHelper from "../service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.js";
import GlobalpingService from "../service/infrastructure/globalpingService.js";
import SuperSimpleQueue from "../service/infrastructure/SuperSimpleQueue/SuperSimpleQueue.js";
import UserService from "../service/business/userService.js";
import CheckService from "../service/business/checkService.js";
@@ -192,6 +193,8 @@ export const initializeServices = async ({
notificationMessageBuilder
);
const globalpingService = new GlobalpingService({ settingsService, logger });
const superSimpleQueueHelper = new SuperSimpleQueueHelper({
logger,
networkService,
@@ -200,6 +203,7 @@ export const initializeServices = async ({
checkService,
buffer: bufferService,
incidentService,
globalpingService,
maintenanceWindowsRepository,
monitorsRepository,
teamsRepository,
@@ -26,6 +26,7 @@ import {
} from "./controllerUtils.js";
import { AppError } from "@/utils/AppError.js";
import { IMonitorService } from "@/service/index.js";
import { GLOBALPING_LOCATIONS } from "@/service/infrastructure/globalpingService.js";
const SERVICE_NAME = "monitorController";
class MonitorController {
@@ -387,6 +388,18 @@ class MonitorController {
}
};
getGlobalpingLocations = async (_req: Request, res: Response, next: NextFunction) => {
try {
return res.status(200).json({
success: true,
msg: "Globalping locations retrieved successfully",
data: GLOBALPING_LOCATIONS,
});
} catch (error) {
next(error);
}
};
getGroupsByTeamId = async (req: Request, res: Response, next: NextFunction) => {
try {
const teamId = req?.user?.teamId;
+6 -1
View File
@@ -21,8 +21,9 @@ class SettingsController {
const sanitizedSettings = { ...dbSettings };
delete sanitizedSettings.version;
delete sanitizedSettings.jwtSecret;
const returnSettings = {
const returnSettings: any = {
pagespeedKeySet: false,
globalpingKeySet: false,
emailPasswordSet: false,
settings: null,
};
@@ -31,6 +32,10 @@ class SettingsController {
returnSettings.pagespeedKeySet = true;
delete sanitizedSettings.pagespeedApiKey;
}
if (typeof sanitizedSettings.globalpingApiKey !== "undefined") {
returnSettings.globalpingKeySet = true;
delete sanitizedSettings.globalpingApiKey;
}
if (typeof sanitizedSettings.systemEmailPassword !== "undefined") {
returnSettings.emailPasswordSet = true;
delete sanitizedSettings.systemEmailPassword;
+1
View File
@@ -23,6 +23,7 @@ const AppSettingsSchema = new Schema<AppSettingsDocument>(
language: { type: String, default: "gb" },
jwtSecret: { type: String },
pagespeedApiKey: { type: String },
globalpingApiKey: { type: String },
systemEmailHost: { type: String },
systemEmailPort: { type: Number },
systemEmailAddress: { type: String },
+5
View File
@@ -19,6 +19,7 @@ type CheckMetadataDocument = Omit<CheckMetadata, "monitorId" | "teamId"> & {
monitorId: Types.ObjectId;
teamId: Types.ObjectId;
type: MonitorType;
location?: string;
};
type CheckDocumentBase = Omit<Check, "id" | "metadata" | "expiry" | "ackAt" | "createdAt" | "updatedAt"> & {
@@ -197,6 +198,9 @@ const metadataSchema = new Schema<CheckMetadataDocument>(
required: true,
index: true,
},
location: {
type: String,
},
},
{ _id: false }
);
@@ -299,6 +303,7 @@ CheckSchema.index({ createdAt: 1 });
CheckSchema.index({ "metadata.teamId": 1, createdAt: -1 });
CheckSchema.index({ "metadata.monitorId": 1, "metadata.type": 1, createdAt: -1 });
CheckSchema.index({ "metadata.teamId": 1, status: 1, createdAt: -1 });
CheckSchema.index({ "metadata.monitorId": 1, "metadata.location": 1, createdAt: -1 });
const CheckModel = model<CheckDocument>("Check", CheckSchema);
+4
View File
@@ -160,6 +160,10 @@ const MonitorSchema = new Schema<MonitorDocument>(
gameId: {
type: String,
},
locations: {
type: [String],
default: [],
},
group: {
type: String,
trim: true,
@@ -35,6 +35,12 @@ export interface IChecksRepository {
options?: { type?: MonitorType }
): Promise<UptimeChecksResult | HardwareChecksResult | PageSpeedChecksResult>;
findSummaryByTeamId(teamId: string, dateRange: string): Promise<ChecksSummary>;
findLocationChecksByMonitorId(
monitorId: string,
startDate: Date,
endDate: Date,
dateString: string
): Promise<Record<string, UptimeChecksResult>>;
// update
//delete
deleteByMonitorId(monitorId: string): Promise<number>;
@@ -169,6 +169,7 @@ class MongoChecksRepository implements IChecksRepository {
monitorId: toStringId(metadata.monitorId),
teamId: toStringId(metadata.teamId),
type: metadata.type,
...(metadata.location ? { location: metadata.location } : {}),
});
return {
@@ -219,6 +220,7 @@ class MongoChecksRepository implements IChecksRepository {
monitorId: new mongoose.Types.ObjectId(metadata.monitorId),
teamId: new mongoose.Types.ObjectId(metadata.teamId),
type: metadata.type,
...(metadata.location ? { location: metadata.location } : {}),
},
...rest,
} as unknown as CheckDocument;
@@ -420,6 +422,68 @@ class MongoChecksRepository implements IChecksRepository {
return result.deletedCount ?? 0;
};
findLocationChecksByMonitorId = async (
monitorId: string,
startDate: Date,
endDate: Date,
dateString: string
): Promise<Record<string, any>> => {
const monitorObjectId = new mongoose.Types.ObjectId(monitorId);
const matchStage = {
"metadata.monitorId": monitorObjectId,
"metadata.location": { $exists: true, $ne: null },
createdAt: { $gte: startDate, $lte: endDate },
};
const results = await CheckModel.aggregate([
{ $match: matchStage },
{ $sort: { createdAt: 1 } },
{
$group: {
_id: {
location: "$metadata.location",
bucket: { $dateToString: { format: dateString, date: "$createdAt" } },
},
avgResponseTime: { $avg: "$responseTime" },
totalChecks: { $sum: 1 },
upChecks: { $sum: { $cond: [{ $eq: ["$status", true] }, 1, 0] } },
},
},
{ $sort: { "_id.bucket": 1 } },
{
$group: {
_id: "$_id.location",
groupedChecks: {
$push: {
bucketDate: "$_id.bucket",
avgResponseTime: "$avgResponseTime",
totalChecks: "$totalChecks",
},
},
totalUpChecks: { $sum: "$upChecks" },
totalAllChecks: { $sum: "$totalChecks" },
overallAvgResponseTime: { $avg: "$avgResponseTime" },
},
},
]);
const locationChecks: Record<string, any> = {};
for (const loc of results) {
const uptimePercentage =
loc.totalAllChecks > 0 ? loc.totalUpChecks / loc.totalAllChecks : 0;
locationChecks[loc._id] = {
monitorType: "http" as const,
groupedChecks: loc.groupedChecks,
groupedUpChecks: [],
groupedDownChecks: [],
uptimePercentage,
avgResponseTime: loc.overallAvgResponseTime ?? 0,
};
}
return locationChecks;
};
private findUptimeDateRangeChecks = async (
monitorType: Exclude<MonitorType, "hardware" | "pagespeed">,
monitorObjectId: mongoose.Types.ObjectId,
@@ -427,9 +491,10 @@ class MongoChecksRepository implements IChecksRepository {
endDate: Date,
dateString: string
) => {
const matchStage = {
const matchStage: Record<string, any> = {
"metadata.monitorId": monitorObjectId,
createdAt: { $gte: startDate, $lte: endDate },
"metadata.location": { $exists: false },
};
const [result] = await CheckModel.aggregate([
{ $match: matchStage },
@@ -343,6 +343,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
selectedDisks: doc.selectedDisks ?? [],
gameId: doc.gameId ?? undefined,
group: doc.group ?? null,
locations: doc.locations ?? [],
recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)),
createdAt: toDateString(doc.createdAt),
updatedAt: toDateString(doc.updatedAt),
@@ -398,6 +399,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
selectedDisks: doc.selectedDisks ?? [],
gameId: doc.gameId ?? undefined,
group: doc.group ?? null,
locations: doc.locations ?? [],
recentChecks: (doc.recentChecks ?? []).map((check: any) => this.toCheckSnapshot(check)),
createdAt: toDateString(doc.createdAt),
updatedAt: toDateString(doc.updatedAt),
+3
View File
@@ -21,6 +21,9 @@ class MonitorRoutes {
this.router.get("/team/with-checks", this.monitorController.getMonitorsWithChecksByTeamId);
this.router.get("/team/groups", this.monitorController.getGroupsByTeamId);
// Globalping locations
this.router.get("/globalping/locations", this.monitorController.getGlobalpingLocations);
// Uptime routes
this.router.get("/uptime/details/:monitorId", this.monitorController.getUptimeDetailsById);
+2 -1
View File
@@ -37,7 +37,7 @@ class CheckService {
};
buildCheck = (statusResponse: MonitorStatusResponse<PageSpeedStatusPayload | HardwareStatusPayload | undefined>) => {
const { monitorId, teamId, type, status, responseTime, code, message, payload, timings } = statusResponse;
const { monitorId, teamId, type, status, responseTime, code, message, payload, timings, location } = statusResponse;
const check: Partial<Check> = {
id: new Types.ObjectId().toString(),
@@ -46,6 +46,7 @@ class CheckService {
monitorId,
teamId,
type,
...(location ? { location } : {}),
},
status,
statusCode: code,
@@ -222,6 +222,20 @@ export class MonitorService implements IMonitorService {
throw new AppError({ message: `${monitor.type} monitors are not supported for uptime details`, status: 400 });
}
// Fetch location checks if monitor has locations configured
let locationChecks: Record<string, any> | undefined;
if (monitor.locations && monitor.locations.length > 0) {
const locData = await this.checksRepository.findLocationChecksByMonitorId(
monitor.id,
start,
end,
this.getDateFormat(rangeKey)
);
if (Object.keys(locData).length > 0) {
locationChecks = locData;
}
}
return {
monitorData: {
monitor,
@@ -230,6 +244,7 @@ export class MonitorService implements IMonitorService {
groupedDownChecks: NormalizeDataUptimeDetails(checksData.groupedDownChecks, 10, 100),
groupedAvgResponseTime: checksData.avgResponseTime,
groupedUptimePercentage: checksData.uptimePercentage,
...(locationChecks ? { locationChecks } : {}),
},
monitorStats,
};
@@ -4,6 +4,7 @@ import { AppError } from "@/utils/AppError.js";
import { INetworkService, INotificationsService, IStatusService } from "@/service/index.js";
import type { StatusChangeResult, MonitorStatusResponse, HardwareStatusPayload, MonitorStatus } from "@/types/index.js";
import IncidentService from "@/service/business/incidentService.js";
import type GlobalpingService from "@/service/infrastructure/globalpingService.js";
import {
IMaintenanceWindowsRepository,
IMonitorsRepository,
@@ -37,6 +38,7 @@ class SuperSimpleQueueHelper {
private checkService: any;
private buffer: any;
private incidentService: IncidentService;
private globalpingService: GlobalpingService;
private maintenanceWindowsRepository: IMaintenanceWindowsRepository;
private monitorsRepository: IMonitorsRepository;
private teamsRepository: ITeamsRepository;
@@ -52,6 +54,7 @@ class SuperSimpleQueueHelper {
checkService,
buffer,
incidentService,
globalpingService,
maintenanceWindowsRepository,
monitorsRepository,
teamsRepository,
@@ -66,6 +69,7 @@ class SuperSimpleQueueHelper {
checkService: any;
buffer: any;
incidentService: IncidentService;
globalpingService: GlobalpingService;
maintenanceWindowsRepository: IMaintenanceWindowsRepository;
monitorsRepository: IMonitorsRepository;
teamsRepository: ITeamsRepository;
@@ -80,6 +84,7 @@ class SuperSimpleQueueHelper {
this.buffer = buffer;
this.notificationsService = notificationsService;
this.incidentService = incidentService;
this.globalpingService = globalpingService;
this.maintenanceWindowsRepository = maintenanceWindowsRepository;
this.monitorsRepository = monitorsRepository;
this.teamsRepository = teamsRepository;
@@ -122,6 +127,27 @@ class SuperSimpleQueueHelper {
throw new Error("No network response");
}
// Step 2b. Run Globalping checks (fire-and-forget, doesn't affect local check pipeline)
if (monitor.locations && monitor.locations.length > 0 && (monitor.type === "http" || monitor.type === "ping")) {
this.globalpingService
.runChecks(monitor)
.then((locationStatuses) => {
for (const locStatus of locationStatuses) {
const locCheck = this.checkService.buildCheck(locStatus);
if (locCheck) {
this.buffer.addToBuffer(locCheck);
}
}
})
.catch((err: any) => {
this.logger.warn({
message: `Globalping checks failed for monitor ${monitorId}: ${err.message}`,
service: SERVICE_NAME,
method: "getMonitorJob",
});
});
}
// Step 3. Build check
const check = await this.checkService.buildCheck(status);
if (!check) {
@@ -0,0 +1,208 @@
import { Globalping } from "globalping";
import type { ISettingsService } from "@/service/system/settingsService.js";
import type { Monitor } from "@/types/monitor.js";
import type { MonitorStatusResponse } from "@/types/network.js";
const SERVICE_NAME = "GlobalpingService";
const LOCATION_MAP: Record<string, { continent: string }> = {
"north-america": { continent: "NA" },
europe: { continent: "EU" },
asia: { continent: "AS" },
"south-america": { continent: "SA" },
oceania: { continent: "OC" },
africa: { continent: "AF" },
};
export const GLOBALPING_LOCATIONS = [
{ id: "north-america", label: "North America" },
{ id: "europe", label: "Europe" },
{ id: "asia", label: "Asia" },
{ id: "south-america", label: "South America" },
{ id: "oceania", label: "Oceania" },
{ id: "africa", label: "Africa" },
];
class GlobalpingService {
static SERVICE_NAME = SERVICE_NAME;
private logger: any;
private settingsService: ISettingsService;
private client: Globalping<false> | null = null;
private lastApiKey: string | undefined;
constructor({ settingsService, logger }: { settingsService: ISettingsService; logger: any }) {
this.settingsService = settingsService;
this.logger = logger;
}
get serviceName() {
return GlobalpingService.SERVICE_NAME;
}
private async getClient(): Promise<Globalping<false> | null> {
const dbSettings = await this.settingsService.getDBSettings();
const apiKey = dbSettings.globalpingApiKey;
if (!apiKey) {
return null;
}
if (this.client && this.lastApiKey === apiKey) {
return this.client;
}
this.client = new Globalping({ auth: apiKey, throwApiErrors: false, timeout: 30000 });
this.lastApiKey = apiKey;
return this.client;
}
async runChecks(monitor: Monitor): Promise<MonitorStatusResponse[]> {
if (!monitor.locations || monitor.locations.length === 0) {
return [];
}
const client = await this.getClient();
if (!client) {
this.logger.warn({
message: "Globalping API key not configured, skipping location checks",
service: SERVICE_NAME,
method: "runChecks",
});
return [];
}
const measurementType = monitor.type === "ping" ? "ping" : "http";
const monitorUrl = monitor.url ?? "";
// Parse target from monitor URL
let target: string;
try {
if (measurementType === "http") {
const url = new URL(monitorUrl);
target = url.hostname;
} else {
target = monitorUrl.replace(/^https?:\/\//, "").split("/")[0] ?? monitorUrl;
}
} catch {
target = monitorUrl;
}
const locations = monitor.locations
.map((loc) => LOCATION_MAP[loc])
.filter(Boolean);
if (locations.length === 0) {
return [];
}
try {
const createResult = measurementType === "http"
? await client.createMeasurement({
type: "http" as const,
target,
locations: locations as any,
measurementOptions: { request: { method: "HEAD" }, protocol: "HTTPS" },
})
: await client.createMeasurement({
type: "ping" as const,
target,
locations: locations as any,
});
if (!createResult.ok) {
this.logger.warn({
message: "Failed to create Globalping measurement",
service: SERVICE_NAME,
method: "runChecks",
details: JSON.stringify(createResult.data),
});
return [];
}
const measurementId = (createResult.data as any).id;
const awaitResult = await client.awaitMeasurement(measurementId);
if (!awaitResult.ok) {
this.logger.warn({
message: "Failed to await Globalping measurement",
service: SERVICE_NAME,
method: "runChecks",
details: JSON.stringify(awaitResult.data),
});
return [];
}
const measurement = awaitResult.data as any;
const results: MonitorStatusResponse[] = [];
for (const item of measurement.results || []) {
const probe = item.probe;
const result = item.result;
const locationLabel = this.getLocationLabel(probe?.continent, probe?.country);
if (measurementType === "http") {
results.push({
monitorId: monitor.id,
teamId: monitor.teamId,
type: monitor.type,
status: result.statusCode >= 200 && result.statusCode < 400,
code: result.statusCode || 0,
message: result.statusCodeName || result.rawOutput || "",
responseTime: result.timings?.total ?? 0,
location: locationLabel,
});
} else {
// Ping
const stats = result.stats;
results.push({
monitorId: monitor.id,
teamId: monitor.teamId,
type: monitor.type,
status: stats?.loss !== undefined ? stats.loss < 100 : false,
code: stats?.loss === 0 ? 200 : 5000,
message: stats?.loss === 0 ? "Ping successful" : `Packet loss: ${stats?.loss}%`,
responseTime: stats?.avg ?? 0,
location: locationLabel,
});
}
}
return results;
} catch (error: any) {
this.logger.warn({
message: `Globalping check failed: ${error.message}`,
service: SERVICE_NAME,
method: "runChecks",
stack: error.stack,
});
return [];
}
}
private getLocationLabel(continent?: string, country?: string): string {
if (continent && country) {
return `${continent}-${country}`;
}
return continent || country || "unknown";
}
async getLimits(): Promise<any | null> {
const client = await this.getClient();
if (!client) {
return null;
}
try {
const result = await client.getLimits();
if (result.ok) {
return result.data;
}
return null;
} catch {
return null;
}
}
}
export default GlobalpingService;
+1
View File
@@ -6,6 +6,7 @@ export interface CheckMetadata {
monitorId: string;
teamId: string;
type: MonitorType;
location?: string;
}
export interface CheckCpuInfo {
+8
View File
@@ -43,6 +43,7 @@ export interface Monitor {
selectedDisks: string[];
gameId?: string;
group: string | null;
locations: string[];
recentChecks: CheckSnapshot[];
createdAt: string;
updatedAt: string;
@@ -64,6 +65,12 @@ export interface MonitorsWithChecksByTeamIdResult {
monitors: Monitor[];
}
export interface LocationCheckData {
groupedChecks: import("./check.js").GroupedCheck[];
uptimePercentage: number;
avgResponseTime: number;
}
export interface UptimeDetailsResult {
monitorData: {
monitor: Monitor;
@@ -72,6 +79,7 @@ export interface UptimeDetailsResult {
groupedDownChecks: import("./check.js").GroupedCheck[];
groupedAvgResponseTime: number;
groupedUptimePercentage: number;
locationChecks?: Record<string, LocationCheckData>;
};
monitorStats: import("./monitorStats.js").MonitorStats | null;
}
+1
View File
@@ -34,6 +34,7 @@ export interface MonitorStatusResponse<T = any> {
matchMethod?: MonitorMatchMethod;
expectedValue?: string;
extracted?: unknown;
location?: string;
}
export interface PingStatusPayload {
+1
View File
@@ -24,6 +24,7 @@ export interface Settings {
systemEmailRequireTLS: boolean;
systemEmailRejectUnauthorized: boolean;
showURL: boolean;
globalpingApiKey?: string;
singleton: boolean;
version: number;
globalThresholds?: SettingsThresholds;
+3
View File
@@ -172,6 +172,7 @@ const createMonitorBodyValidation = joi.object({
gameId: joi.string().allow(""),
selectedDisks: joi.array().items(joi.string()).optional(),
group: joi.string().max(50).trim().allow(null, "").optional(),
locations: joi.array().items(joi.string()).max(5).optional(),
});
const createMonitorsBodyValidation = joi.array().items(
@@ -203,6 +204,7 @@ const editMonitorBodyValidation = joi
gameId: joi.string().allow(""),
selectedDisks: joi.array().items(joi.string()).optional(),
group: joi.string().max(50).trim().allow(null, "").optional(),
locations: joi.array().items(joi.string()).max(5).optional(),
})
.options({ stripUnknown: true });
@@ -428,6 +430,7 @@ const updateAppSettingsBodyValidation = joi.object({
systemEmailRequireTLS: joi.boolean(),
systemEmailRejectUnauthorized: joi.boolean(),
globalpingApiKey: joi.string().allow(""),
globalThresholds: joi
.object({
cpu: joi.number().min(1).max(100).allow(""),