Files
CDNManager/packages/shared/dist/index.js
T
DenozordecandCursor 654b08c8e5
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 5s
quality / changes (push) Successful in 4s
quality / docker-check (push) Skipped
quality / web (push) Successful in 45s
quality / api (push) Successful in 36s
CD / quality (push) Successful in 1m30s
CD / publish (push) Successful in 1m51s
fix(ui): полный справочник стран и городов как в VPS Tracker
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 15:15:34 +07:00

339 lines
8.6 KiB
JavaScript

import {
CANONICAL_LOC_CODES,
CITIES,
CITY_BY_NAME_RU,
COUNTRIES,
COUNTRY_BY_CODE,
COUNTRY_BY_NAME_RU,
buildCityOptions,
catalogCitiesWithLocCodes,
cityMatchesCountry,
countriesWithCities,
listCities,
locCodeForCity,
resolveCityRef,
resolveCountryForCity,
resolveCountryForCityFromRows
} from "./chunk-FK3U7DSV.js";
// src/app-switcher.ts
import { z } from "zod";
var appSwitcherIconSchema = z.enum([
"server",
"cloud",
"globe",
"dashboard",
"chart"
]);
var appSwitcherEntrySchema = z.object({
id: z.string(),
name: z.string(),
subtitle: z.string().optional(),
url: z.string().url(),
icon: appSwitcherIconSchema.default("server"),
enabled: z.boolean().optional(),
sort: z.number().optional(),
shortcut: z.string().optional()
});
var appSwitcherConfigSchema = z.object({
menuLabel: z.string().default("\u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F"),
apps: z.array(appSwitcherEntrySchema).min(1)
});
// src/settings.ts
import { z as z2 } from "zod";
var loginSchema = z2.object({
username: z2.string().min(1),
password: z2.string().min(1)
});
var appSettingsPatchSchema = z2.object({
showQuickActions: z2.boolean().optional(),
defaultTtl: z2.number().int().min(60).max(86400).optional(),
namingTemplate: z2.string().min(1).optional(),
proxiedLock: z2.boolean().optional()
});
var appSettingsSchema = z2.object({
id: z2.string(),
showQuickActions: z2.boolean(),
defaultTtl: z2.number(),
namingTemplate: z2.string(),
proxiedLock: z2.boolean(),
cloudflareConfigured: z2.boolean().optional()
});
// src/fleet.ts
import { z as z3 } from "zod";
var nodeRoleSchema = z3.enum(["hub", "gw", "edge", "ix"]);
var aliasPurposeSchema = z3.enum([
"geo",
"ix",
"backup",
"admin",
"custom"
]);
var aliasModeSchema = z3.enum(["primary", "pair"]);
var syncStatusSchema = z3.enum([
"pending",
"ok",
"drift",
"missing",
"error"
]);
var addressFamilySchema = z3.enum(["v4", "v6"]);
var cfZoneSchema = z3.object({
id: z3.string(),
name: z3.string(),
status: z3.string().optional()
});
var cfDnsRecordSchema = z3.object({
id: z3.string().optional(),
type: z3.string(),
name: z3.string(),
content: z3.string(),
ttl: z3.number(),
proxied: z3.boolean().optional(),
priority: z3.number().optional()
});
var createDnsRecordPayloadSchema = z3.object({
type: z3.string(),
name: z3.string(),
content: z3.string(),
ttl: z3.number(),
proxied: z3.boolean().optional(),
priority: z3.number().optional()
});
var patchDnsRecordPayloadSchema = createDnsRecordPayloadSchema.partial();
var locationSchema = z3.object({
id: z3.string(),
code: z3.string(),
name: z3.string(),
country: z3.string().nullable(),
sortOrder: z3.number()
});
var zoneSchema = z3.object({
id: z3.string(),
cfZoneId: z3.string().nullable(),
name: z3.string(),
role: z3.string(),
namingTemplate: z3.string(),
defaultTtl: z3.number(),
lastSyncAt: z3.string().nullable(),
createdAt: z3.string(),
updatedAt: z3.string()
});
var zoneCreateSchema = z3.object({
name: z3.string().min(1),
cfZoneId: z3.string().optional().nullable(),
role: z3.string().default("routing"),
namingTemplate: z3.string().optional(),
defaultTtl: z3.number().int().min(60).max(86400).optional()
});
var zonePatchSchema = zoneCreateSchema.partial();
var nodeAddressSchema = z3.object({
id: z3.string(),
family: addressFamilySchema,
ip: z3.string()
});
var nodeSchema = z3.object({
id: z3.string(),
zoneId: z3.string(),
locationId: z3.string(),
locationCode: z3.string().optional(),
locationName: z3.string().optional(),
hostname: z3.string(),
role: nodeRoleSchema,
indexNum: z3.number(),
providerTag: z3.string().nullable(),
notes: z3.string().nullable(),
syncStatus: syncStatusSchema,
cfARecordId: z3.string().nullable(),
cfAaaaRecordId: z3.string().nullable(),
lastError: z3.string().nullable(),
addresses: z3.array(nodeAddressSchema).default([]),
aliasCount: z3.number().optional(),
createdAt: z3.string(),
updatedAt: z3.string()
});
var nodeCreateSchema = z3.object({
zoneId: z3.string().min(1),
locationId: z3.string().min(1),
role: nodeRoleSchema,
indexNum: z3.number().int().min(1).max(99).default(1),
hostname: z3.string().min(1).optional(),
providerTag: z3.string().optional().nullable(),
notes: z3.string().optional().nullable(),
ipv4: z3.string().min(1),
ipv6: z3.string().optional().nullable()
});
var nodePatchSchema = z3.object({
locationId: z3.string().optional(),
role: nodeRoleSchema.optional(),
indexNum: z3.number().int().min(1).max(99).optional(),
hostname: z3.string().min(1).optional(),
providerTag: z3.string().optional().nullable(),
notes: z3.string().optional().nullable(),
ipv4: z3.string().min(1).optional(),
ipv6: z3.string().optional().nullable()
});
var aliasSchema = z3.object({
id: z3.string(),
zoneId: z3.string(),
name: z3.string(),
purpose: aliasPurposeSchema,
mode: aliasModeSchema,
targetNodeId: z3.string(),
targetHostname: z3.string().optional(),
syncStatus: syncStatusSchema,
cfRecordId: z3.string().nullable(),
lastError: z3.string().nullable(),
createdAt: z3.string(),
updatedAt: z3.string()
});
var aliasCreateSchema = z3.object({
zoneId: z3.string().min(1),
name: z3.string().min(1),
purpose: aliasPurposeSchema.default("geo"),
mode: aliasModeSchema.default("primary"),
targetNodeId: z3.string().min(1)
});
var aliasPatchSchema = z3.object({
name: z3.string().min(1).optional(),
purpose: aliasPurposeSchema.optional(),
mode: aliasModeSchema.optional(),
targetNodeId: z3.string().min(1).optional()
});
var aliasRetargetSchema = z3.object({
targetNodeId: z3.string().min(1)
});
var syncDiffOpSchema = z3.object({
id: z3.string(),
kind: z3.enum([
"create",
"update",
"delete",
"orphan",
"proxy_violation",
"noop"
]),
entityType: z3.enum(["node_a", "node_aaaa", "alias", "orphan"]),
entityId: z3.string().nullable(),
recordName: z3.string(),
recordType: z3.string(),
desired: z3.record(z3.string(), z3.unknown()).nullable(),
observed: z3.record(z3.string(), z3.unknown()).nullable(),
detail: z3.string().optional()
});
var syncJobSchema = z3.object({
id: z3.string(),
zoneId: z3.string(),
status: z3.enum(["pending", "running", "done", "failed"]),
diff: z3.array(syncDiffOpSchema).optional(),
error: z3.string().nullable(),
createdAt: z3.string(),
finishedAt: z3.string().nullable()
});
var syncApplySchema = z3.object({
opIds: z3.array(z3.string()).optional()
});
var dashboardStatsSchema = z3.object({
nodes: z3.number(),
aliases: z3.number(),
syncOk: z3.number(),
drift: z3.number(),
proxyViolations: z3.number(),
orphans: z3.number(),
lastSyncAt: z3.string().nullable(),
nodesWithoutIp: z3.number(),
brokenAliases: z3.number()
});
var topologyNodeSchema = z3.object({
id: z3.string(),
hostname: z3.string(),
role: nodeRoleSchema,
locationCode: z3.string(),
ipv4: z3.string().nullable(),
syncStatus: syncStatusSchema
});
var topologyEdgeSchema = z3.object({
id: z3.string(),
aliasName: z3.string(),
purpose: aliasPurposeSchema,
fromNodeId: z3.string(),
toHostname: z3.string()
});
var topologySchema = z3.object({
nodes: z3.array(topologyNodeSchema),
edges: z3.array(topologyEdgeSchema),
locations: z3.array(locationSchema)
});
var bindExportSchema = z3.object({
zoneName: z3.string(),
content: z3.string()
});
var orphanIgnoreSchema = z3.object({
recordName: z3.string().min(1),
recordType: z3.string().min(1)
});
// src/index.ts
var ValidationError = class extends Error {
constructor(message) {
super(message);
this.name = "ValidationError";
}
};
export {
CANONICAL_LOC_CODES,
CITIES,
CITY_BY_NAME_RU,
COUNTRIES,
COUNTRY_BY_CODE,
COUNTRY_BY_NAME_RU,
ValidationError,
addressFamilySchema,
aliasCreateSchema,
aliasModeSchema,
aliasPatchSchema,
aliasPurposeSchema,
aliasRetargetSchema,
aliasSchema,
appSettingsPatchSchema,
appSettingsSchema,
appSwitcherConfigSchema,
appSwitcherEntrySchema,
appSwitcherIconSchema,
bindExportSchema,
buildCityOptions,
catalogCitiesWithLocCodes,
cfDnsRecordSchema,
cfZoneSchema,
cityMatchesCountry,
countriesWithCities,
createDnsRecordPayloadSchema,
dashboardStatsSchema,
listCities,
locCodeForCity,
locationSchema,
loginSchema,
nodeAddressSchema,
nodeCreateSchema,
nodePatchSchema,
nodeRoleSchema,
nodeSchema,
orphanIgnoreSchema,
patchDnsRecordPayloadSchema,
resolveCityRef,
resolveCountryForCity,
resolveCountryForCityFromRows,
syncApplySchema,
syncDiffOpSchema,
syncJobSchema,
syncStatusSchema,
topologyEdgeSchema,
topologyNodeSchema,
topologySchema,
zoneCreateSchema,
zonePatchSchema,
zoneSchema
};