@modrinth/api-client 0.93.0 → 0.95.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 {
@@ -1640,16 +1650,6 @@ declare class ArchonServersV0Module extends AbstractModule {
1640
1650
  * GET /modrinth/v0/servers
1641
1651
  */
1642
1652
  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
1653
  /**
1654
1654
  * Get filesystem authentication credentials for a server
1655
1655
  * Returns URL and JWT token for accessing the server's filesystem via Kyros
@@ -1770,6 +1770,16 @@ declare class ArchonServersV1Module extends AbstractModule {
1770
1770
  * GET /v1/regions
1771
1771
  */
1772
1772
  getRegions(): Promise<Archon.Servers.v1.Region[]>;
1773
+ /**
1774
+ * Get how many servers of each memory size fit in every public region
1775
+ * GET /v1/stock
1776
+ */
1777
+ getStock(memoryMb: number[]): Promise<Archon.Servers.v1.StockResponse>;
1778
+ /**
1779
+ * Get how many servers of each memory size fit in every public region when upgrading a server
1780
+ * GET /v1/servers/:server_id/upgrade-stock
1781
+ */
1782
+ getUpgradeStock(serverId: string, memoryMb: number[]): Promise<Archon.Servers.v1.StockResponse>;
1773
1783
  /**
1774
1784
  * End the intro flow for a server
1775
1785
  * DELETE /v1/servers/:id/flows/intro
@@ -4620,7 +4630,7 @@ export declare namespace Labrinth {
4620
4630
  name: string;
4621
4631
  icon_url: string | null;
4622
4632
  };
4623
- export type ProjectsSort = 'oldest' | 'newest' | 'most_external_deps' | 'least_external_deps';
4633
+ export type ProjectsSort = 'oldest' | 'newest' | 'oldest_initial' | 'most_external_deps' | 'least_external_deps';
4624
4634
  export type ProjectsRequest = {
4625
4635
  count?: number;
4626
4636
  offset?: number;
@@ -4639,6 +4649,7 @@ export declare namespace Labrinth {
4639
4649
  status: Projects.v2.ProjectStatus;
4640
4650
  requested_status: Projects.v2.ProjectStatus | null;
4641
4651
  queued: string | null;
4652
+ initial_queued: string | null;
4642
4653
  published: string;
4643
4654
  updated: string;
4644
4655
  project_types: string[];
@@ -7660,8 +7671,6 @@ declare type ParseModule<T extends string, API extends string> = T extends `${AP
7660
7671
 
7661
7672
  export declare function parseSyncEventData(data: string): Archon.Sync.v1.SyncEvent | null;
7662
7673
 
7663
- export declare function pingWebSocketUrl(url: string, options?: WebSocketPingOptions): Promise<number>;
7664
-
7665
7674
  export declare namespace Purpur {
7666
7675
  export namespace Versions {
7667
7676
  export namespace v2 {
@@ -8212,11 +8221,30 @@ export declare interface WebSocketConnection {
8212
8221
 
8213
8222
  export declare type WebSocketEventHandler<E extends Archon.Websocket.v0.WSEvent = Archon.Websocket.v0.WSEvent> = (event: E) => void;
8214
8223
 
8224
+ /**
8225
+ * Measures the latency to a ping test WebSocket, which echoes back every message. The connection stays open between
8226
+ * measurements until {@link WebSocketPinger.close} is called.
8227
+ */
8228
+ export declare class WebSocketPinger {
8229
+ /** Resolves to whether the connection opened within the connect timeout. */
8230
+ readonly connected: Promise<boolean>;
8231
+ private readonly socket;
8232
+ private sampleListener;
8233
+ private closed;
8234
+ constructor(url: string, connectTimeoutMs: number);
8235
+ get isOpen(): boolean;
8236
+ /**
8237
+ * Sends `count` pings over the connection and resolves to the latency in ms of every ping that came back, once
8238
+ * all of them came back or `settleDelayMs` after the last one was sent.
8239
+ */
8240
+ measure(options?: WebSocketPingOptions): Promise<number[]>;
8241
+ close(): void;
8242
+ }
8243
+
8215
8244
  export declare interface WebSocketPingOptions {
8216
8245
  count?: number;
8217
8246
  intervalMs?: number;
8218
8247
  settleDelayMs?: number;
8219
- timeoutMs?: number;
8220
8248
  signal?: AbortSignal;
8221
8249
  }
8222
8250