chore: isolate frontend and backend via npm workspaces and @mmapp/contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -35,7 +35,7 @@ import {
|
||||
} from "@/lib/dashboard-internet-path"
|
||||
import type { FiltersRulesetRow, RouteOptimizerSpeedProbe } from "@/lib/route-optimizer-data"
|
||||
import { listEvents } from "@/shared/api/events"
|
||||
import type { EventItem } from "@/packages/contracts/src/events"
|
||||
import type { EventItem } from "@mmapp/contracts/events"
|
||||
|
||||
function makeApiFetch(backendUrl: string) {
|
||||
return async function apiFetch<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { PageHeader } from "@/components/page-header"
|
||||
import { StatusBadge } from "@/components/status-badge"
|
||||
import { servers as initialServers } from "@/lib/data"
|
||||
import type { ServerType, Server, WanUplink } from "@/lib/data"
|
||||
import type { ServerCreate, ServerUpdate } from "@/packages/contracts/src/servers"
|
||||
import type { ServerCreate, ServerUpdate } from "@mmapp/contracts/servers"
|
||||
import { toFrontendServer } from "@/entities/server/model/mappers"
|
||||
import {
|
||||
createServer,
|
||||
|
||||
Generated
-3008
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"build": "tsc",
|
||||
"build": "npm run build -w @mmapp/contracts && tsc",
|
||||
"test:alert-engine": "tsx src/services/alert-engine/groups.test.ts && tsx src/services/alert-engine/evaluate-rule.test.ts && tsx src/services/alert-engine/confirm-stability.test.ts",
|
||||
"start": "node dist/index.js",
|
||||
"db:generate": "drizzle-kit generate",
|
||||
@@ -13,6 +13,7 @@
|
||||
"db:studio": "drizzle-kit studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mmapp/contracts": "0.1.0",
|
||||
"@fastify/cors": "^11.2.0",
|
||||
"@fastify/type-provider-zod": "^1.0.0",
|
||||
"better-sqlite3": "^12.9.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { and, desc, eq, gte, lte } from "drizzle-orm"
|
||||
import { db } from "../../../db/index.js"
|
||||
import { events } from "../../../db/schema.js"
|
||||
import type { EventItem, EventLevel, EventSourceModule } from "../../../../../packages/contracts/dist/events.js"
|
||||
import type { EventItem, EventLevel, EventSourceModule } from "@mmapp/contracts/events"
|
||||
|
||||
export type EventInsertInput = {
|
||||
id: string
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
type AppendEventBody,
|
||||
type EventItem,
|
||||
type ListEventsQuery,
|
||||
} from "../../../../../packages/contracts/dist/events.js"
|
||||
} from "@mmapp/contracts/events"
|
||||
import { insertEventsBatch, listEvents, type EventInsertInput } from "../repository/events-repository.js"
|
||||
|
||||
function normalizeEventInput(input: AppendEventBody): EventInsertInput {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
putRulesSchema,
|
||||
putTelegramSchema,
|
||||
testTelegramSchema,
|
||||
} from "../../../packages/contracts/dist/alerts.js"
|
||||
} from "@mmapp/contracts/alerts"
|
||||
|
||||
const alertsRoutes: FastifyPluginAsyncZod = async (app) => {
|
||||
app.get("/alerts", async (_req, reply) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { FastifyPluginAsyncZod } from "@fastify/type-provider-zod"
|
||||
import { appendEventsSchema, listEventsQuerySchema } from "../../../packages/contracts/dist/events.js"
|
||||
import { appendEventsSchema, listEventsQuerySchema } from "@mmapp/contracts/events"
|
||||
import { appendEvents, readEvents } from "../modules/events/service/events-service.js"
|
||||
|
||||
const eventsRoutes: FastifyPluginAsyncZod = async (app) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
type ServerCreate as ContractServerCreate,
|
||||
type ServerUpdate as ContractServerUpdate,
|
||||
type WanUplink as ContractWanUplinkRead,
|
||||
} from "../../../packages/contracts/dist/servers.js"
|
||||
} from "@mmapp/contracts/servers"
|
||||
|
||||
// ── RouterOS raw response types ────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"moduleResolution": "NodeNext",
|
||||
"lib": ["ES2022"],
|
||||
"outDir": "dist",
|
||||
"rootDir": "..",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
|
||||
@@ -183,6 +183,18 @@ export function InternetPathMapCard({ model }: { model: InternetPathViewModel |
|
||||
wan: model.activeWanUplink,
|
||||
jumpHost: model.fallbackJumpHost,
|
||||
exitNode: model.fallbackExitNode,
|
||||
wanJhMetrics: {
|
||||
pingMs: null,
|
||||
dlMbps: null,
|
||||
ulMbps: null,
|
||||
fromMonitoring: false,
|
||||
},
|
||||
jhExitMetrics: {
|
||||
pingMs: null,
|
||||
dlMbps: null,
|
||||
ulMbps: null,
|
||||
fromMonitoring: false,
|
||||
},
|
||||
}
|
||||
: null
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ServerRead } from "@/packages/contracts/src/servers"
|
||||
import type { ServerRead } from "@mmapp/contracts/servers"
|
||||
import type { Server } from "@/lib/data"
|
||||
|
||||
export function toFrontendServer(server: ServerRead): Server {
|
||||
|
||||
Generated
+2864
-4
File diff suppressed because it is too large
Load Diff
+6
-1
@@ -2,13 +2,18 @@
|
||||
"name": "mmapp",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*",
|
||||
"backend"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"build": "npm run build -w @mmapp/contracts && next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mmapp/contracts": "0.1.0",
|
||||
"@base-ui/react": "^1.4.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
|
||||
@@ -3,14 +3,30 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json"
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./servers": "./dist/servers.js",
|
||||
"./alerts": "./dist/alerts.js",
|
||||
"./events": "./dist/events.js"
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./servers": {
|
||||
"types": "./dist/servers.d.ts",
|
||||
"default": "./dist/servers.js"
|
||||
},
|
||||
"./alerts": {
|
||||
"types": "./dist/alerts.d.ts",
|
||||
"default": "./dist/alerts.js"
|
||||
},
|
||||
"./events": {
|
||||
"types": "./dist/events.d.ts",
|
||||
"default": "./dist/events.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "^4.4.1"
|
||||
|
||||
Vendored
-204
@@ -1,204 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const alertTypeSchema: z.ZodEnum<{
|
||||
"gre-tunnel": "gre-tunnel";
|
||||
"bgp-peer": "bgp-peer";
|
||||
"bgp-prefix": "bgp-prefix";
|
||||
"gre-client": "gre-client";
|
||||
server: "server";
|
||||
rtt: "rtt";
|
||||
loss: "loss";
|
||||
traffic: "traffic";
|
||||
}>;
|
||||
export declare const alertSeveritySchema: z.ZodEnum<{
|
||||
critical: "critical";
|
||||
warning: "warning";
|
||||
info: "info";
|
||||
}>;
|
||||
export declare const alertCooldownSchema: z.ZodEnum<{
|
||||
"1\u043C": "1м";
|
||||
"5\u043C": "5м";
|
||||
"15\u043C": "15м";
|
||||
"1\u0447": "1ч";
|
||||
"4\u0447": "4ч";
|
||||
"24\u0447": "24ч";
|
||||
}>;
|
||||
export declare const recoveryModeSchema: z.ZodEnum<{
|
||||
never: "never";
|
||||
always: "always";
|
||||
conditional: "conditional";
|
||||
}>;
|
||||
export declare const combineModeSchema: z.ZodEnum<{
|
||||
any: "any";
|
||||
all: "all";
|
||||
}>;
|
||||
export declare const alertGroupSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
combineMode: z.ZodEnum<{
|
||||
any: "any";
|
||||
all: "all";
|
||||
}>;
|
||||
enabled: z.ZodBoolean;
|
||||
cooldownOverride: z.ZodUnion<readonly [z.ZodEnum<{
|
||||
"1\u043C": "1м";
|
||||
"5\u043C": "5м";
|
||||
"15\u043C": "15м";
|
||||
"1\u0447": "1ч";
|
||||
"4\u0447": "4ч";
|
||||
"24\u0447": "24ч";
|
||||
}>, z.ZodNull]>;
|
||||
}, z.core.$strip>;
|
||||
export declare const alertRuleSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
type: z.ZodEnum<{
|
||||
"gre-tunnel": "gre-tunnel";
|
||||
"bgp-peer": "bgp-peer";
|
||||
"bgp-prefix": "bgp-prefix";
|
||||
"gre-client": "gre-client";
|
||||
server: "server";
|
||||
rtt: "rtt";
|
||||
loss: "loss";
|
||||
traffic: "traffic";
|
||||
}>;
|
||||
target: z.ZodOptional<z.ZodString>;
|
||||
targets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
groupId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
condition: z.ZodOptional<z.ZodString>;
|
||||
conditions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
severity: z.ZodEnum<{
|
||||
critical: "critical";
|
||||
warning: "warning";
|
||||
info: "info";
|
||||
}>;
|
||||
enabled: z.ZodBoolean;
|
||||
cooldown: z.ZodEnum<{
|
||||
"1\u043C": "1м";
|
||||
"5\u043C": "5м";
|
||||
"15\u043C": "15м";
|
||||
"1\u0447": "1ч";
|
||||
"4\u0447": "4ч";
|
||||
"24\u0447": "24ч";
|
||||
}>;
|
||||
confirmStabilitySec: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
|
||||
recoveryMode: z.ZodOptional<z.ZodEnum<{
|
||||
never: "never";
|
||||
always: "always";
|
||||
conditional: "conditional";
|
||||
}>>;
|
||||
recoveryStabilitySec: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
|
||||
chatId: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const putRulesSchema: z.ZodObject<{
|
||||
rules: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
type: z.ZodEnum<{
|
||||
"gre-tunnel": "gre-tunnel";
|
||||
"bgp-peer": "bgp-peer";
|
||||
"bgp-prefix": "bgp-prefix";
|
||||
"gre-client": "gre-client";
|
||||
server: "server";
|
||||
rtt: "rtt";
|
||||
loss: "loss";
|
||||
traffic: "traffic";
|
||||
}>;
|
||||
target: z.ZodOptional<z.ZodString>;
|
||||
targets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
groupId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
condition: z.ZodOptional<z.ZodString>;
|
||||
conditions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
severity: z.ZodEnum<{
|
||||
critical: "critical";
|
||||
warning: "warning";
|
||||
info: "info";
|
||||
}>;
|
||||
enabled: z.ZodBoolean;
|
||||
cooldown: z.ZodEnum<{
|
||||
"1\u043C": "1м";
|
||||
"5\u043C": "5м";
|
||||
"15\u043C": "15м";
|
||||
"1\u0447": "1ч";
|
||||
"4\u0447": "4ч";
|
||||
"24\u0447": "24ч";
|
||||
}>;
|
||||
confirmStabilitySec: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
|
||||
recoveryMode: z.ZodOptional<z.ZodEnum<{
|
||||
never: "never";
|
||||
always: "always";
|
||||
conditional: "conditional";
|
||||
}>>;
|
||||
recoveryStabilitySec: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
|
||||
chatId: z.ZodString;
|
||||
}, z.core.$strip>>;
|
||||
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
combineMode: z.ZodEnum<{
|
||||
any: "any";
|
||||
all: "all";
|
||||
}>;
|
||||
enabled: z.ZodBoolean;
|
||||
cooldownOverride: z.ZodUnion<readonly [z.ZodEnum<{
|
||||
"1\u043C": "1м";
|
||||
"5\u043C": "5м";
|
||||
"15\u043C": "15м";
|
||||
"1\u0447": "1ч";
|
||||
"4\u0447": "4ч";
|
||||
"24\u0447": "24ч";
|
||||
}>, z.ZodNull]>;
|
||||
}, z.core.$strip>>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const putTelegramSchema: z.ZodObject<{
|
||||
token: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
chatId: z.ZodOptional<z.ZodString>;
|
||||
messageThreadId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const rulePreviewTelegramSchema: z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
targets: z.ZodArray<z.ZodString>;
|
||||
conditionLine: z.ZodString;
|
||||
severity: z.ZodEnum<{
|
||||
critical: "critical";
|
||||
warning: "warning";
|
||||
info: "info";
|
||||
}>;
|
||||
cooldown: z.ZodEnum<{
|
||||
"1\u043C": "1м";
|
||||
"5\u043C": "5м";
|
||||
"15\u043C": "15м";
|
||||
"1\u0447": "1ч";
|
||||
"4\u0447": "4ч";
|
||||
"24\u0447": "24ч";
|
||||
}>;
|
||||
}, z.core.$strip>;
|
||||
export declare const testTelegramSchema: z.ZodObject<{
|
||||
token: z.ZodOptional<z.ZodString>;
|
||||
chatId: z.ZodOptional<z.ZodString>;
|
||||
messageThreadId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
||||
rulePreview: z.ZodOptional<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
targets: z.ZodArray<z.ZodString>;
|
||||
conditionLine: z.ZodString;
|
||||
severity: z.ZodEnum<{
|
||||
critical: "critical";
|
||||
warning: "warning";
|
||||
info: "info";
|
||||
}>;
|
||||
cooldown: z.ZodEnum<{
|
||||
"1\u043C": "1м";
|
||||
"5\u043C": "5м";
|
||||
"15\u043C": "15м";
|
||||
"1\u0447": "1ч";
|
||||
"4\u0447": "4ч";
|
||||
"24\u0447": "24ч";
|
||||
}>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
export type AlertGroup = z.infer<typeof alertGroupSchema>;
|
||||
export type AlertRule = z.infer<typeof alertRuleSchema>;
|
||||
export type PutRulesBody = z.infer<typeof putRulesSchema>;
|
||||
export type PutTelegramBody = z.infer<typeof putTelegramSchema>;
|
||||
export type RulePreviewTelegram = z.infer<typeof rulePreviewTelegramSchema>;
|
||||
export type TestTelegramBody = z.infer<typeof testTelegramSchema>;
|
||||
//# sourceMappingURL=alerts.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["alerts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,eAAe;;;;;;;;;EAS1B,CAAA;AACF,eAAO,MAAM,mBAAmB;;;;EAA0C,CAAA;AAC1E,eAAO,MAAM,mBAAmB;;;;;;;EAAiD,CAAA;AACjF,eAAO,MAAM,kBAAkB;;;;EAA6C,CAAA;AAC5E,eAAO,MAAM,iBAAiB;;;EAAyB,CAAA;AAEvD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;iBAM3B,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBxB,CAAA;AAEJ,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGzB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;iBAI5B,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;iBAMpC,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;iBAK7B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAC3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
|
||||
@@ -1,71 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export const alertTypeSchema = z.enum([
|
||||
"gre-tunnel",
|
||||
"bgp-peer",
|
||||
"bgp-prefix",
|
||||
"gre-client",
|
||||
"server",
|
||||
"rtt",
|
||||
"loss",
|
||||
"traffic",
|
||||
]);
|
||||
export const alertSeveritySchema = z.enum(["critical", "warning", "info"]);
|
||||
export const alertCooldownSchema = z.enum(["1м", "5м", "15м", "1ч", "4ч", "24ч"]);
|
||||
export const recoveryModeSchema = z.enum(["always", "never", "conditional"]);
|
||||
export const combineModeSchema = z.enum(["any", "all"]);
|
||||
export const alertGroupSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
name: z.string().min(1),
|
||||
combineMode: combineModeSchema,
|
||||
enabled: z.boolean(),
|
||||
cooldownOverride: z.union([alertCooldownSchema, z.null()]),
|
||||
});
|
||||
export const alertRuleSchema = z
|
||||
.object({
|
||||
id: z.string().min(1),
|
||||
name: z.string().min(1),
|
||||
type: alertTypeSchema,
|
||||
target: z.string().optional(),
|
||||
targets: z.array(z.string().min(1)).optional(),
|
||||
groupId: z.string().nullable().optional(),
|
||||
condition: z.string().optional(),
|
||||
conditions: z.array(z.string().min(1)).optional(),
|
||||
severity: alertSeveritySchema,
|
||||
enabled: z.boolean(),
|
||||
cooldown: alertCooldownSchema,
|
||||
confirmStabilitySec: z.union([z.number().int().min(0).max(86400), z.null()]).optional(),
|
||||
recoveryMode: recoveryModeSchema.optional(),
|
||||
recoveryStabilitySec: z.union([z.number().int().min(0).max(86400), z.null()]).optional(),
|
||||
chatId: z.string(),
|
||||
})
|
||||
.refine((r) => (r.targets != null && r.targets.length > 0) || Boolean(r.target?.trim()), {
|
||||
message: "Нужен хотя бы один объект: targets или target",
|
||||
path: ["targets"],
|
||||
})
|
||||
.refine((r) => (r.conditions != null && r.conditions.length > 0) || Boolean(r.condition?.trim()), {
|
||||
message: "Нужно хотя бы одно условие: conditions или condition",
|
||||
path: ["conditions"],
|
||||
});
|
||||
export const putRulesSchema = z.object({
|
||||
rules: z.array(alertRuleSchema),
|
||||
groups: z.array(alertGroupSchema).optional(),
|
||||
});
|
||||
export const putTelegramSchema = z.object({
|
||||
token: z.union([z.string(), z.null()]).optional(),
|
||||
chatId: z.string().optional(),
|
||||
messageThreadId: z.union([z.number().int().positive(), z.null()]).optional(),
|
||||
});
|
||||
export const rulePreviewTelegramSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
targets: z.array(z.string().min(1)).min(1),
|
||||
conditionLine: z.string().min(1),
|
||||
severity: alertSeveritySchema,
|
||||
cooldown: alertCooldownSchema,
|
||||
});
|
||||
export const testTelegramSchema = z.object({
|
||||
token: z.string().optional(),
|
||||
chatId: z.string().optional(),
|
||||
messageThreadId: z.coerce.number().int().positive().optional(),
|
||||
rulePreview: rulePreviewTelegramSchema.optional(),
|
||||
});
|
||||
//# sourceMappingURL=alerts.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["alerts.ts"],"names":[],"mappings":"A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CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,mBAAmB;CAC9B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9D,WAAW,EAAE,yBAAyB,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAA"}
|
||||
Vendored
-228
@@ -1,228 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const serverTypeSchema: z.ZodEnum<{
|
||||
"jump-host": "jump-host";
|
||||
"exit-node": "exit-node";
|
||||
"home-router": "home-router";
|
||||
}>;
|
||||
export declare const serverStatusSchema: z.ZodEnum<{
|
||||
online: "online";
|
||||
offline: "offline";
|
||||
}>;
|
||||
export declare const wanUplinkSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
isp: z.ZodString;
|
||||
iface: z.ZodString;
|
||||
ip: z.ZodString;
|
||||
maxDl: z.ZodNumber;
|
||||
maxUl: z.ZodNumber;
|
||||
}, z.core.$strip>;
|
||||
export declare const serverCreateSchema: z.ZodObject<{
|
||||
host: z.ZodString;
|
||||
port: z.ZodDefault<z.ZodNumber>;
|
||||
username: z.ZodDefault<z.ZodString>;
|
||||
password: z.ZodDefault<z.ZodString>;
|
||||
useSsl: z.ZodDefault<z.ZodBoolean>;
|
||||
verifySsl: z.ZodDefault<z.ZodBoolean>;
|
||||
name: z.ZodDefault<z.ZodString>;
|
||||
type: z.ZodDefault<z.ZodEnum<{
|
||||
"jump-host": "jump-host";
|
||||
"exit-node": "exit-node";
|
||||
"home-router": "home-router";
|
||||
}>>;
|
||||
site: z.ZodDefault<z.ZodString>;
|
||||
country: z.ZodDefault<z.ZodString>;
|
||||
asn: z.ZodDefault<z.ZodString>;
|
||||
comment: z.ZodDefault<z.ZodString>;
|
||||
enabled: z.ZodDefault<z.ZodBoolean>;
|
||||
lanSubnet: z.ZodDefault<z.ZodString>;
|
||||
wanUplinks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
isp: z.ZodString;
|
||||
iface: z.ZodString;
|
||||
ip: z.ZodString;
|
||||
maxDl: z.ZodNumber;
|
||||
maxUl: z.ZodNumber;
|
||||
}, z.core.$strip>>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const serverUpdateSchema: z.ZodObject<{
|
||||
type: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
||||
"jump-host": "jump-host";
|
||||
"exit-node": "exit-node";
|
||||
"home-router": "home-router";
|
||||
}>>>;
|
||||
name: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
port: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
||||
username: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
password: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
useSsl: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
||||
verifySsl: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
||||
site: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
country: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
asn: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
comment: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
||||
lanSubnet: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
||||
wanUplinks: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
isp: z.ZodString;
|
||||
iface: z.ZodString;
|
||||
ip: z.ZodString;
|
||||
maxDl: z.ZodNumber;
|
||||
maxUl: z.ZodNumber;
|
||||
}, z.core.$strip>>>>;
|
||||
host: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const serverIdParamSchema: z.ZodObject<{
|
||||
id: z.ZodCoercedNumber<unknown>;
|
||||
}, z.core.$strip>;
|
||||
export declare const snapshotsQuerySchema: z.ZodObject<{
|
||||
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const testConnectionSchema: z.ZodObject<{
|
||||
host: z.ZodString;
|
||||
port: z.ZodDefault<z.ZodNumber>;
|
||||
useSsl: z.ZodDefault<z.ZodBoolean>;
|
||||
verifySsl: z.ZodDefault<z.ZodBoolean>;
|
||||
apiPath: z.ZodDefault<z.ZodString>;
|
||||
username: z.ZodDefault<z.ZodString>;
|
||||
password: z.ZodDefault<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const serverReadSchema: z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
name: z.ZodString;
|
||||
host: z.ZodString;
|
||||
port: z.ZodNumber;
|
||||
useSsl: z.ZodBoolean;
|
||||
verifySsl: z.ZodBoolean;
|
||||
username: z.ZodString;
|
||||
password: z.ZodString;
|
||||
type: z.ZodEnum<{
|
||||
"jump-host": "jump-host";
|
||||
"exit-node": "exit-node";
|
||||
"home-router": "home-router";
|
||||
}>;
|
||||
site: z.ZodString;
|
||||
country: z.ZodString;
|
||||
asn: z.ZodString;
|
||||
comment: z.ZodString;
|
||||
enabled: z.ZodBoolean;
|
||||
lanSubnet: z.ZodString;
|
||||
wanUplinks: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
isp: z.ZodString;
|
||||
iface: z.ZodString;
|
||||
ip: z.ZodString;
|
||||
maxDl: z.ZodNumber;
|
||||
maxUl: z.ZodNumber;
|
||||
}, z.core.$strip>>;
|
||||
createdAt: z.ZodString;
|
||||
updatedAt: z.ZodString;
|
||||
status: z.ZodUnion<readonly [z.ZodEnum<{
|
||||
online: "online";
|
||||
offline: "offline";
|
||||
}>, z.ZodNull]>;
|
||||
latency: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
os: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
model: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
uptime: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
cpuLoad: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
freeMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
totalMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
identityName: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
sessions: z.ZodNumber;
|
||||
polledAt: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
}, z.core.$strip>;
|
||||
export declare const snapshotReadSchema: z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
serverId: z.ZodNumber;
|
||||
polledAt: z.ZodString;
|
||||
status: z.ZodEnum<{
|
||||
online: "online";
|
||||
offline: "offline";
|
||||
}>;
|
||||
latencyMs: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
rosVersion: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
boardName: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
uptime: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
cpuLoad: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
freeMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
totalMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
identityName: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
}, z.core.$strip>;
|
||||
export declare const serverListSchema: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
name: z.ZodString;
|
||||
host: z.ZodString;
|
||||
port: z.ZodNumber;
|
||||
useSsl: z.ZodBoolean;
|
||||
verifySsl: z.ZodBoolean;
|
||||
username: z.ZodString;
|
||||
password: z.ZodString;
|
||||
type: z.ZodEnum<{
|
||||
"jump-host": "jump-host";
|
||||
"exit-node": "exit-node";
|
||||
"home-router": "home-router";
|
||||
}>;
|
||||
site: z.ZodString;
|
||||
country: z.ZodString;
|
||||
asn: z.ZodString;
|
||||
comment: z.ZodString;
|
||||
enabled: z.ZodBoolean;
|
||||
lanSubnet: z.ZodString;
|
||||
wanUplinks: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
name: z.ZodString;
|
||||
isp: z.ZodString;
|
||||
iface: z.ZodString;
|
||||
ip: z.ZodString;
|
||||
maxDl: z.ZodNumber;
|
||||
maxUl: z.ZodNumber;
|
||||
}, z.core.$strip>>;
|
||||
createdAt: z.ZodString;
|
||||
updatedAt: z.ZodString;
|
||||
status: z.ZodUnion<readonly [z.ZodEnum<{
|
||||
online: "online";
|
||||
offline: "offline";
|
||||
}>, z.ZodNull]>;
|
||||
latency: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
os: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
model: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
uptime: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
cpuLoad: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
freeMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
totalMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
identityName: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
sessions: z.ZodNumber;
|
||||
polledAt: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
}, z.core.$strip>>;
|
||||
export declare const snapshotListSchema: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
serverId: z.ZodNumber;
|
||||
polledAt: z.ZodString;
|
||||
status: z.ZodEnum<{
|
||||
online: "online";
|
||||
offline: "offline";
|
||||
}>;
|
||||
latencyMs: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
rosVersion: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
boardName: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
uptime: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
cpuLoad: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
freeMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
totalMemory: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
|
||||
identityName: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
||||
}, z.core.$strip>>;
|
||||
export type ServerType = z.infer<typeof serverTypeSchema>;
|
||||
export type WanUplink = z.infer<typeof wanUplinkSchema>;
|
||||
export type ServerCreate = z.infer<typeof serverCreateSchema>;
|
||||
export type ServerUpdate = z.infer<typeof serverUpdateSchema>;
|
||||
export type ServerRead = z.infer<typeof serverReadSchema>;
|
||||
export type SnapshotRead = z.infer<typeof snapshotReadSchema>;
|
||||
export type ServerIdParam = z.infer<typeof serverIdParamSchema>;
|
||||
export type SnapshotsQuery = z.infer<typeof snapshotsQuerySchema>;
|
||||
export type TestConnectionRequ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C,CAAA;AAC7D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
|
||||
@@ -1,95 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export const serverTypeSchema = z.enum(["jump-host", "exit-node", "home-router"]);
|
||||
export const serverStatusSchema = z.enum(["online", "offline"]);
|
||||
export const wanUplinkSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
isp: z.string(),
|
||||
iface: z.string(),
|
||||
ip: z.string(),
|
||||
maxDl: z.number(),
|
||||
maxUl: z.number(),
|
||||
});
|
||||
export const serverCreateSchema = z.object({
|
||||
host: z.string().min(1, "Host is required"),
|
||||
port: z.number().int().positive().default(443),
|
||||
username: z.string().default("admin"),
|
||||
password: z.string().default(""),
|
||||
useSsl: z.boolean().default(true),
|
||||
verifySsl: z.boolean().default(false),
|
||||
name: z.string().default(""),
|
||||
type: serverTypeSchema.default("home-router"),
|
||||
site: z.string().default(""),
|
||||
country: z.string().default(""),
|
||||
asn: z.string().default(""),
|
||||
comment: z.string().default(""),
|
||||
enabled: z.boolean().default(true),
|
||||
lanSubnet: z.string().default(""),
|
||||
wanUplinks: z.array(wanUplinkSchema).default([]),
|
||||
});
|
||||
export const serverUpdateSchema = serverCreateSchema.partial().omit({ host: true }).extend({
|
||||
host: z.string().min(1).optional(),
|
||||
});
|
||||
export const serverIdParamSchema = z.object({
|
||||
id: z.coerce.number().int().positive(),
|
||||
});
|
||||
export const snapshotsQuerySchema = z.object({
|
||||
limit: z.coerce.number().int().positive().max(500).default(50),
|
||||
});
|
||||
export const testConnectionSchema = z.object({
|
||||
host: z.string().min(1),
|
||||
port: z.number().int().positive().default(443),
|
||||
useSsl: z.boolean().default(true),
|
||||
verifySsl: z.boolean().default(false),
|
||||
apiPath: z.string().default("/rest"),
|
||||
username: z.string().default("admin"),
|
||||
password: z.string().default(""),
|
||||
});
|
||||
export const serverReadSchema = z.object({
|
||||
id: z.number().int(),
|
||||
name: z.string(),
|
||||
host: z.string(),
|
||||
port: z.number().int(),
|
||||
useSsl: z.boolean(),
|
||||
verifySsl: z.boolean(),
|
||||
username: z.string(),
|
||||
password: z.string(),
|
||||
type: serverTypeSchema,
|
||||
site: z.string(),
|
||||
country: z.string(),
|
||||
asn: z.string(),
|
||||
comment: z.string(),
|
||||
enabled: z.boolean(),
|
||||
lanSubnet: z.string(),
|
||||
wanUplinks: z.array(wanUplinkSchema),
|
||||
createdAt: z.string(),
|
||||
updatedAt: z.string(),
|
||||
status: z.union([serverStatusSchema, z.null()]),
|
||||
latency: z.union([z.number(), z.null()]),
|
||||
os: z.union([z.string(), z.null()]),
|
||||
model: z.union([z.string(), z.null()]),
|
||||
uptime: z.union([z.string(), z.null()]),
|
||||
cpuLoad: z.union([z.number(), z.null()]),
|
||||
freeMemory: z.union([z.number(), z.null()]),
|
||||
totalMemory: z.union([z.number(), z.null()]),
|
||||
identityName: z.union([z.string(), z.null()]),
|
||||
sessions: z.number().int(),
|
||||
polledAt: z.union([z.string(), z.null()]),
|
||||
});
|
||||
export const snapshotReadSchema = z.object({
|
||||
id: z.number().int(),
|
||||
serverId: z.number().int(),
|
||||
polledAt: z.string(),
|
||||
status: serverStatusSchema,
|
||||
latencyMs: z.union([z.number(), z.null()]),
|
||||
rosVersion: z.union([z.string(), z.null()]),
|
||||
boardName: z.union([z.string(), z.null()]),
|
||||
uptime: z.union([z.string(), z.null()]),
|
||||
cpuLoad: z.union([z.number().int(), z.null()]),
|
||||
freeMemory: z.union([z.number().int(), z.null()]),
|
||||
totalMemory: z.union([z.number().int(), z.null()]),
|
||||
identityName: z.union([z.string(), z.null()]),
|
||||
});
|
||||
export const serverListSchema = z.array(serverReadSchema);
|
||||
export const snapshotListSchema = z.array(snapshotReadSchema);
|
||||
//# sourceMappingURL=servers.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@ import {
|
||||
listEventsQuerySchema,
|
||||
type EventItem,
|
||||
type ListEventsQuery,
|
||||
} from "@/packages/contracts/src/events"
|
||||
} from "@mmapp/contracts/events"
|
||||
import { requestJson } from "@/shared/api/http-client"
|
||||
|
||||
type ListEventsResponse = {
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type ServerRead,
|
||||
type ServerUpdate,
|
||||
type TestConnectionRequest,
|
||||
} from "@/packages/contracts/src/servers"
|
||||
} from "@mmapp/contracts/servers"
|
||||
import { requestJson } from "@/shared/api/http-client"
|
||||
|
||||
type TestConnectionResponse = {
|
||||
|
||||
+1
-1
@@ -30,5 +30,5 @@
|
||||
".next/dev/types/**/*.ts",
|
||||
"**/*.mts"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
"exclude": ["node_modules", "backend", "packages"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user