Enhance CDN Manager: Add Cloudflare API token support, update documentation, and introduce new routes for managing nodes, aliases, and topology. Improve UI components and status badges for better user experience.
quality / commitlint (push) Skipped
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
CD / update-wiki (push) Successful in 6s
quality / web (push) Successful in 53s
quality / api (push) Successful in 49s
CD / quality (push) Successful in 1m57s
CD / publish (push) Successful in 27s
quality / commitlint (push) Skipped
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
CD / update-wiki (push) Successful in 6s
quality / web (push) Successful in 53s
quality / api (push) Successful in 49s
CD / quality (push) Successful in 1m57s
CD / publish (push) Successful in 27s
This commit is contained in:
Vendored
+263
-3
@@ -29,17 +29,277 @@ var loginSchema = z2.object({
|
||||
password: z2.string().min(1)
|
||||
});
|
||||
var appSettingsPatchSchema = z2.object({
|
||||
showQuickActions: z2.boolean().optional()
|
||||
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()
|
||||
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 {
|
||||
ValidationError,
|
||||
addressFamilySchema,
|
||||
aliasCreateSchema,
|
||||
aliasModeSchema,
|
||||
aliasPatchSchema,
|
||||
aliasPurposeSchema,
|
||||
aliasRetargetSchema,
|
||||
aliasSchema,
|
||||
appSettingsPatchSchema,
|
||||
appSettingsSchema,
|
||||
appSwitcherConfigSchema,
|
||||
appSwitcherEntrySchema,
|
||||
appSwitcherIconSchema,
|
||||
loginSchema
|
||||
bindExportSchema,
|
||||
cfDnsRecordSchema,
|
||||
cfZoneSchema,
|
||||
createDnsRecordPayloadSchema,
|
||||
dashboardStatsSchema,
|
||||
locationSchema,
|
||||
loginSchema,
|
||||
nodeAddressSchema,
|
||||
nodeCreateSchema,
|
||||
nodePatchSchema,
|
||||
nodeRoleSchema,
|
||||
nodeSchema,
|
||||
orphanIgnoreSchema,
|
||||
patchDnsRecordPayloadSchema,
|
||||
syncApplySchema,
|
||||
syncDiffOpSchema,
|
||||
syncJobSchema,
|
||||
syncStatusSchema,
|
||||
topologyEdgeSchema,
|
||||
topologyNodeSchema,
|
||||
topologySchema,
|
||||
zoneCreateSchema,
|
||||
zonePatchSchema,
|
||||
zoneSchema
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user