@modrinth/api-client 0.94.0 → 0.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -861,15 +861,6 @@ export declare namespace Archon {
861
861
  limit?: number;
862
862
  offset?: number;
863
863
  };
864
- export type StockRequest = {
865
- cpu?: number;
866
- memory_mb?: number;
867
- swap_mb?: number;
868
- storage_mb?: number;
869
- };
870
- export type StockResponse = {
871
- available: number;
872
- };
873
864
  export type JWTAuth = {
874
865
  url: string;
875
866
  token: string;
@@ -973,6 +964,25 @@ export declare namespace Archon {
973
964
  lon: number;
974
965
  zone: string;
975
966
  };
967
+ export type MemorySizeStock = {
968
+ /** Number of servers of this memory size that fit in the region */
969
+ available: number;
970
+ /** Hostnames of the nodes which fit at least one server of this memory size */
971
+ hostnames: string[];
972
+ };
973
+ export type RegionStock = {
974
+ /** Shortcode of the region */
975
+ region: string;
976
+ /** Stock of each requested memory size, keyed by memory size in MB */
977
+ stock: Record<number, MemorySizeStock>;
978
+ /** WebSocket URLs of random nodes in the region, to measure the latency to it */
979
+ ping_urls: string[];
980
+ };
981
+ export type StockResponse = {
982
+ regions: RegionStock[];
983
+ /** Number of servers that fit across all regions, keyed by memory size in MB */
984
+ total: Record<number, number>;
985
+ };
976
986
  }
977
987
  }
978
988
  export namespace Backups {
@@ -1071,12 +1081,32 @@ export declare namespace Archon {
1071
1081
  status: BackupStatus;
1072
1082
  locked: boolean;
1073
1083
  automated: boolean;
1084
+ rotates_at?: string;
1074
1085
  history: BackupQueueOperation[];
1075
1086
  };
1076
1087
  export type BackupsQueueResponse = {
1077
1088
  active_operations: ActiveOperation[];
1078
1089
  backups: BackupQueueBackup[];
1079
1090
  };
1091
+ export type WorldBackupOptions = {
1092
+ split_automatic: number;
1093
+ split_manual: number;
1094
+ limit: number;
1095
+ interval: number;
1096
+ };
1097
+ export type BackupsQueueWithOptionsResponse = BackupsQueueResponse & {
1098
+ options: WorldBackupOptions;
1099
+ next_auto_backup_at: string | null;
1100
+ };
1101
+ export type PatchWorldBackupOptions = {
1102
+ split_automatic?: number;
1103
+ split_manual?: number;
1104
+ interval?: number;
1105
+ };
1106
+ export type PatchWorldBackupOptionsResponse = {
1107
+ applied: boolean;
1108
+ backup_ids?: string[];
1109
+ };
1080
1110
  }
1081
1111
  }
1082
1112
  export namespace Sync {
@@ -1422,6 +1452,10 @@ declare class ArchonBackupsQueueV1Module extends AbstractModule {
1422
1452
  getModuleID(): string;
1423
1453
  /** GET /v1/servers/:server_id/worlds/:world_id/backups-queue */
1424
1454
  list(serverId: string, worldId: string): Promise<Archon.BackupsQueue.v1.BackupsQueueResponse>;
1455
+ /** GET /v1/servers/:server_id/worlds/:world_id/backups-queue/with-options */
1456
+ listWithOptions(serverId: string, worldId: string): Promise<Archon.BackupsQueue.v1.BackupsQueueWithOptionsResponse>;
1457
+ /** PATCH /v1/servers/:server_id/worlds/:world_id/backups-queue/with-options */
1458
+ patchOptions(serverId: string, worldId: string, request: Archon.BackupsQueue.v1.PatchWorldBackupOptions, acknowledgeRotation?: boolean): Promise<Archon.BackupsQueue.v1.PatchWorldBackupOptionsResponse>;
1425
1459
  /** POST /v1/servers/:server_id/worlds/:world_id/backups-queue */
1426
1460
  create(serverId: string, worldId: string, request: Archon.BackupsQueue.v1.BackupRequest): Promise<Archon.BackupsQueue.v1.PostBackupQueueResponse>;
1427
1461
  /** POST /v1/servers/:server_id/worlds/:world_id/backups-queue/history/create/:operation_id/ack */
@@ -1640,16 +1674,6 @@ declare class ArchonServersV0Module extends AbstractModule {
1640
1674
  * GET /modrinth/v0/servers
1641
1675
  */
1642
1676
  list(options?: Archon.Servers.v0.GetServersOptions): Promise<Archon.Servers.v0.ServerGetResponse>;
1643
- /**
1644
- * Check stock availability for a region
1645
- * POST /modrinth/v0/stock?region=:region
1646
- */
1647
- checkStock(region: string, request: Archon.Servers.v0.StockRequest): Promise<Archon.Servers.v0.StockResponse>;
1648
- /**
1649
- * Check stock availability (without region filter)
1650
- * POST /modrinth/v0/stock
1651
- */
1652
- checkStockGlobal(request: Archon.Servers.v0.StockRequest): Promise<Archon.Servers.v0.StockResponse>;
1653
1677
  /**
1654
1678
  * Get filesystem authentication credentials for a server
1655
1679
  * Returns URL and JWT token for accessing the server's filesystem via Kyros
@@ -1770,6 +1794,16 @@ declare class ArchonServersV1Module extends AbstractModule {
1770
1794
  * GET /v1/regions
1771
1795
  */
1772
1796
  getRegions(): Promise<Archon.Servers.v1.Region[]>;
1797
+ /**
1798
+ * Get how many servers of each memory size fit in every public region
1799
+ * GET /v1/stock
1800
+ */
1801
+ getStock(memoryMb: number[]): Promise<Archon.Servers.v1.StockResponse>;
1802
+ /**
1803
+ * Get how many servers of each memory size fit in every public region when upgrading a server
1804
+ * GET /v1/servers/:server_id/upgrade-stock
1805
+ */
1806
+ getUpgradeStock(serverId: string, memoryMb: number[]): Promise<Archon.Servers.v1.StockResponse>;
1773
1807
  /**
1774
1808
  * End the intro flow for a server
1775
1809
  * DELETE /v1/servers/:id/flows/intro
@@ -2304,6 +2338,14 @@ export declare namespace Kyros {
2304
2338
  }
2305
2339
  }
2306
2340
  }
2341
+ export namespace Backups {
2342
+ export namespace v1 {
2343
+ export type BackupDumpFormat = 'zip';
2344
+ export interface BackupDownloadAuthorization {
2345
+ token: string;
2346
+ }
2347
+ }
2348
+ }
2307
2349
  export namespace Files {
2308
2350
  export namespace v1 {
2309
2351
  export interface FileDownloadAuthorization {
@@ -2363,6 +2405,18 @@ export declare namespace Kyros {
2363
2405
  }
2364
2406
  }
2365
2407
 
2408
+ declare class KyrosBackupsV1Module extends AbstractModule {
2409
+ getModuleID(): string;
2410
+ /**
2411
+ * Authorize a short-lived, single-use backup download.
2412
+ */
2413
+ authorizeDownload(nodeUrlHost: string, worldId: string, backupId: string, format?: Kyros.Backups.v1.BackupDumpFormat): Promise<Kyros.Backups.v1.BackupDownloadAuthorization>;
2414
+ /**
2415
+ * Build the browser URL for a previously authorized backup download.
2416
+ */
2417
+ getDownloadUrl(nodeUrlHost: string, worldId: string, backupId: string, token: string): string;
2418
+ }
2419
+
2366
2420
  declare class KyrosContentV1Module extends AbstractModule {
2367
2421
  getModuleID(): string;
2368
2422
  /**
@@ -7374,6 +7428,7 @@ declare const MODULE_REGISTRY: {
7374
7428
  readonly mclogs_insights_v1: typeof MclogsInsightsV1Module;
7375
7429
  readonly mclogs_logs_v1: typeof MclogsLogsV1Module;
7376
7430
  readonly launchermeta_manifest_v0: typeof LauncherMetaManifestV0Module;
7431
+ readonly kyros_backups_v1: typeof KyrosBackupsV1Module;
7377
7432
  readonly kyros_content_v1: typeof KyrosContentV1Module;
7378
7433
  readonly kyros_files_v0: typeof KyrosFilesV0Module;
7379
7434
  readonly kyros_files_v1: typeof KyrosFilesV1Module;
@@ -7661,8 +7716,6 @@ declare type ParseModule<T extends string, API extends string> = T extends `${AP
7661
7716
 
7662
7717
  export declare function parseSyncEventData(data: string): Archon.Sync.v1.SyncEvent | null;
7663
7718
 
7664
- export declare function pingWebSocketUrl(url: string, options?: WebSocketPingOptions): Promise<number>;
7665
-
7666
7719
  export declare namespace Purpur {
7667
7720
  export namespace Versions {
7668
7721
  export namespace v2 {
@@ -8213,11 +8266,30 @@ export declare interface WebSocketConnection {
8213
8266
 
8214
8267
  export declare type WebSocketEventHandler<E extends Archon.Websocket.v0.WSEvent = Archon.Websocket.v0.WSEvent> = (event: E) => void;
8215
8268
 
8269
+ /**
8270
+ * Measures the latency to a ping test WebSocket, which echoes back every message. The connection stays open between
8271
+ * measurements until {@link WebSocketPinger.close} is called.
8272
+ */
8273
+ export declare class WebSocketPinger {
8274
+ /** Resolves to whether the connection opened within the connect timeout. */
8275
+ readonly connected: Promise<boolean>;
8276
+ private readonly socket;
8277
+ private sampleListener;
8278
+ private closed;
8279
+ constructor(url: string, connectTimeoutMs: number);
8280
+ get isOpen(): boolean;
8281
+ /**
8282
+ * Sends `count` pings over the connection and resolves to the latency in ms of every ping that came back, once
8283
+ * all of them came back or `settleDelayMs` after the last one was sent.
8284
+ */
8285
+ measure(options?: WebSocketPingOptions): Promise<number[]>;
8286
+ close(): void;
8287
+ }
8288
+
8216
8289
  export declare interface WebSocketPingOptions {
8217
8290
  count?: number;
8218
8291
  intervalMs?: number;
8219
8292
  settleDelayMs?: number;
8220
- timeoutMs?: number;
8221
8293
  signal?: AbortSignal;
8222
8294
  }
8223
8295