/** * The server definition (#675, ADR-0003 §1). Pure: no I/O. * * `ServerSpec` is the v2 (D1) export and keeps its `{ name }` shape until * v3.0.0 (#715, #736); the full type is `ServerSpecDocument`. */ export interface ServerSpec { name: string; } export type WorldStorage = 'universe' | 'data'; export interface ServerSpecDocument extends ServerSpec { specVersion: 1; /** Directory name; the container is mc-. */ name: string; /** TYPE */ type: string; /** VERSION; absent = itzg/modpack decides; '' = `VERSION=` (empty, still overrides servers/global.env). */ version?: string; /** MEMORY; '' as for version. */ memory?: string; /** Compose image, e.g. itzg/minecraft-server:java25 */ image: string; world: { /** LEVEL (ADR-0002 resolveWorldName) */ level: string; /** worlds/ (universe) or servers//data/ (data), ADR-0002 D-1 */ storage: WorldStorage; }; routing: { /** User-added mc-router hostnames. */ customHostnames: string[]; /** PLAYIT_DOMAIN and a router hostname; '' = `PLAYIT_DOMAIN=` (no router hostname). */ playitDomain?: string; autoScale: { up: boolean; down: boolean; }; /** mc-router.auto-scale-asleep-motd */ asleepMotd?: string; /** mc-router.auto-scale-loading-motd */ loadingMotd?: string; }; /** Every other config.env key, file order kept. */ env: Record; } export declare const SERVER_SPEC_VERSION = 1; /** config.env keys the document holds as typed fields, so they may not appear in `env`. */ export declare const SERVER_SPEC_MANAGED_ENV_KEYS: Readonly>; export type ServerSpecErrorCode = 'invalid_spec' | 'not_found' | 'already_exists' | 'conflict' | 'edit_conflict' | 'compose_edited' | 'undetermined' | 'storage_change' | 'locked' | 'unsupported_spec_version'; export interface ServerSpecIssue { /** Dotted path in server.yaml, e.g. `routing.autoScale.up`, `env.SEED`. */ path: string; message: string; } /** Every ServerSpec failure: names the server, the file and the field, and the next step. */ export declare class ServerSpecError extends Error { readonly code: ServerSpecErrorCode; readonly server?: string | undefined; readonly issues: ServerSpecIssue[]; constructor(code: ServerSpecErrorCode, message: string, server?: string | undefined, issues?: ServerSpecIssue[]); } /** * The files (`servers//...`) a failed ServerSpec write could not put back: * their restore failed (they keep the new content) or another writer changed * them since. [] when the write left nothing behind. Read from the error the * write rejected with (IServerSpecRepository.write). */ export declare function unrestoredFiles(error: unknown): string[]; /** `create`: the strict rules for a new server. `existing`: what works today (imported servers). */ export type ServerSpecRules = 'create' | 'existing'; /** * A Minecraft version a new server may ask for: releases, LATEST, snapshots * (24w14a) and pre-releases (1.20.5-rc1). The same rule as the API create * schema; itzg resolves the value. */ export declare const MC_VERSION_INPUT_PATTERN: RegExp; /** * Hostname rule for mc-router hosts (RFC 1123, case-insensitive): why * `value` is invalid, or undefined. */ export declare function validateHostname(value: string): string | undefined; /** * Every problem with `value` as a ServerSpecDocument, in document order. * An empty list means `value` is a valid document under `rules`. */ export declare function validateServerSpecDocument(value: unknown, rules: ServerSpecRules): ServerSpecIssue[]; /** * `value` as a ServerSpecDocument, or a ServerSpecError: `unsupported_spec_version` * for a file from a newer mcctl, `invalid_spec` listing every issue otherwise. */ export declare function assertServerSpecDocument(value: unknown, rules: ServerSpecRules, where: { server: string; file: string; }): ServerSpecDocument; /** * The mc-router hosts of a server (ADR-0003 §3): `.local`, `..nip.io` * per host address, the playit domain, then the custom hosts; deduplicated * case-insensitively, first occurrence kept. */ export declare function routerHosts(doc: ServerSpecDocument, hostIps: string[]): string[]; //# sourceMappingURL=ServerSpecDocument.d.ts.map