@modrinth/api-client 0.48.0 → 0.49.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
@@ -278,6 +278,7 @@ export declare abstract class AbstractWebSocketClient {
278
278
  protected readonly MAX_RECONNECT_ATTEMPTS = 10;
279
279
  protected readonly RECONNECT_BASE_DELAY = 1000;
280
280
  protected readonly RECONNECT_MAX_DELAY = 30000;
281
+ protected readonly AUTHENTICATION_TIMEOUT = 30000;
281
282
  constructor(client: {
282
283
  archon: {
283
284
  servers_v0: {
@@ -292,6 +293,7 @@ export declare abstract class AbstractWebSocketClient {
292
293
  safeConnect(serverId: string, options?: {
293
294
  force?: boolean;
294
295
  }): Promise<void>;
296
+ protected waitForAuthentication(serverId: string): Promise<void>;
295
297
  on<E extends Archon.Websocket.v0.WSEventType>(serverId: string, eventType: E, handler: WebSocketEventHandler<Extract<Archon.Websocket.v0.WSEvent, {
296
298
  event: E;
297
299
  }>>): () => void;
@@ -543,13 +545,20 @@ export declare namespace Archon {
543
545
  name: string | null;
544
546
  environment?: Labrinth.Projects.v3.Environment | null;
545
547
  };
548
+ export type AddonStatus = 'pending' | 'installed' | {
549
+ failed: {
550
+ error: string;
551
+ };
552
+ };
546
553
  export type Addon = {
547
554
  id: string;
548
555
  filename: string;
549
556
  filesize: number;
557
+ btime?: string;
550
558
  disabled: boolean;
551
559
  kind: AddonKind;
552
560
  from_modpack: boolean;
561
+ status: AddonStatus;
553
562
  pack_client_retained: boolean;
554
563
  pack_client_depends: boolean;
555
564
  has_update: string | null;
@@ -564,6 +573,10 @@ export declare namespace Archon {
564
573
  modloader_version: string | null;
565
574
  game_version: string | null;
566
575
  modpack: ModpackFields | null;
576
+ installing?: 'loader' | 'modpack';
577
+ error?: {
578
+ message: string;
579
+ };
567
580
  addons: Addon[] | null;
568
581
  };
569
582
  export type AddAddonRequest = {
@@ -1122,7 +1135,69 @@ export declare namespace Archon {
1122
1135
  world_id: string;
1123
1136
  spec: Archon.Content.v1.Addons;
1124
1137
  };
1125
- export type SyncEvent = ProtocolResetEvent | ProtocolInvalidEvent | ProtocolErrorEvent | BackupNewEvent | BackupPatchEvent | BackupDeleteEvent | BackupOperationStartEvent | BackupOperationDoneEvent | ServerPatchEvent | ServerNetworkPatchEvent | ServerTransferEvent | UsersPatchEvent | WorldPatchEvent | WorldStartupPatchEvent | WorldContentAddonPatchEvent | WorldContentBaseUpdateEvent;
1138
+ export type WorldContentPlatform = 'forge' | 'neoforge' | 'fabric' | 'quilt' | 'paper' | 'purpur' | 'vanilla';
1139
+ export type WorldContentPlatformData = {
1140
+ platform: WorldContentPlatform;
1141
+ game_version: string;
1142
+ platform_version: string | null;
1143
+ };
1144
+ export type WorldContentModpackSource = 'CurseForge' | {
1145
+ Modrinth: {
1146
+ version_id: string;
1147
+ project_id: string;
1148
+ mrpack_sha1: string | null;
1149
+ };
1150
+ } | {
1151
+ LocalMrPackFile: {
1152
+ path: string;
1153
+ name: string;
1154
+ description: string | null;
1155
+ version_name: string | null;
1156
+ };
1157
+ };
1158
+ export type WorldContentModpack = {
1159
+ spec: WorldContentModpackSource;
1160
+ downloads: number | null;
1161
+ followers: number | null;
1162
+ icon_url: string | null;
1163
+ owner: Archon.Content.v1.ContentOwner | null;
1164
+ title: string | null;
1165
+ description: string | null;
1166
+ version_number: string | null;
1167
+ date_published: string | null;
1168
+ environment: Labrinth.Projects.v3.Environment | null;
1169
+ has_update: string | null;
1170
+ };
1171
+ export type WorldContentItem = {
1172
+ parent_directory: string;
1173
+ file_sha1: string | null;
1174
+ filename: string;
1175
+ btime?: string;
1176
+ from_modpack: boolean;
1177
+ version_id: string | null;
1178
+ project_id: string | null;
1179
+ pack_client_retained: boolean;
1180
+ pack_client_depends: boolean;
1181
+ status: Archon.Content.v1.AddonStatus;
1182
+ filesize: number | null;
1183
+ name: string | null;
1184
+ version: Archon.Content.v1.AddonVersion | null;
1185
+ owner: Archon.Content.v1.ContentOwner | null;
1186
+ has_update: string | null;
1187
+ icon_url: string | null;
1188
+ };
1189
+ export type WorldContentUpdateEvent = {
1190
+ type: 'world.content.update';
1191
+ world_id: string;
1192
+ platform_data: WorldContentPlatformData | null;
1193
+ linked_modpack: WorldContentModpack | null;
1194
+ installing?: 'loader' | 'modpack';
1195
+ error?: {
1196
+ message: string;
1197
+ };
1198
+ content: WorldContentItem[];
1199
+ };
1200
+ export type SyncEvent = ProtocolResetEvent | ProtocolInvalidEvent | ProtocolErrorEvent | BackupNewEvent | BackupPatchEvent | BackupDeleteEvent | BackupOperationStartEvent | BackupOperationDoneEvent | ServerPatchEvent | ServerNetworkPatchEvent | ServerTransferEvent | UsersPatchEvent | WorldPatchEvent | WorldStartupPatchEvent | WorldContentAddonPatchEvent | WorldContentBaseUpdateEvent | WorldContentUpdateEvent;
1126
1201
  }
1127
1202
  }
1128
1203
  export namespace Websocket {
@@ -1201,6 +1276,42 @@ export declare namespace Archon {
1201
1276
  project_id: string;
1202
1277
  version_id: string;
1203
1278
  };
1279
+ export type InstallProgressFileKey = {
1280
+ type: 'file';
1281
+ install_type: 'install' | 'update';
1282
+ project_id: string;
1283
+ version_id: string;
1284
+ parent_directory: string;
1285
+ source_filename: string | null;
1286
+ target_filename?: string | null;
1287
+ };
1288
+ export type InstallProgressModrinthModpackKey = {
1289
+ type: 'modrinth_modpack';
1290
+ project_id: string;
1291
+ version_id: string;
1292
+ };
1293
+ export type InstallProgressLocalModpackKey = {
1294
+ type: 'local_modpack';
1295
+ filename: string;
1296
+ };
1297
+ export type InstallProgressPlatformKey = {
1298
+ type: 'platform';
1299
+ platform: 'forge' | 'neoforge' | 'fabric' | 'quilt' | 'paper' | 'purpur' | 'vanilla';
1300
+ platform_version: string;
1301
+ game_version: string;
1302
+ };
1303
+ export type InstallProgressKey = InstallProgressFileKey | InstallProgressModrinthModpackKey | InstallProgressLocalModpackKey | InstallProgressPlatformKey;
1304
+ export type InstallProgressItem = {
1305
+ world_id: string;
1306
+ key: InstallProgressKey;
1307
+ id: string;
1308
+ progress: number | null;
1309
+ error: string | null;
1310
+ };
1311
+ export type WSInstallProgressEvent = {
1312
+ event: 'install-progress';
1313
+ items: InstallProgressItem[];
1314
+ };
1204
1315
  export type FilesystemOpKind = 'unarchive';
1205
1316
  export type FilesystemOpState = 'queued' | 'ongoing' | 'done' | 'cancelled' | 'failure-corrupted' | 'failure-invalid-path';
1206
1317
  export type FilesystemOperation = {
@@ -1256,7 +1367,7 @@ export declare namespace Archon {
1256
1367
  event: 'command';
1257
1368
  cmd: string;
1258
1369
  };
1259
- export type WSEvent = WSBackupProgressEvent | WSLogEvent | WSLog4jEvent | WSStatsEvent | WSPowerStateEvent | WSStateEvent | WSAuthExpiringEvent | WSAuthIncorrectEvent | WSAuthOkEvent | WSInstallationResultEvent | WSUptimeEvent | WSNewModEvent | WSFilesystemOpsEvent;
1370
+ export type WSEvent = WSBackupProgressEvent | WSLogEvent | WSLog4jEvent | WSStatsEvent | WSPowerStateEvent | WSStateEvent | WSAuthExpiringEvent | WSAuthIncorrectEvent | WSAuthOkEvent | WSInstallationResultEvent | WSUptimeEvent | WSNewModEvent | WSInstallProgressEvent | WSFilesystemOpsEvent;
1260
1371
  export type WSEventType = WSEvent['event'];
1261
1372
  }
1262
1373
  }
@@ -7405,6 +7516,7 @@ export declare class VerboseLoggingFeature extends AbstractFeature {
7405
7516
  export declare interface WebSocketConnection {
7406
7517
  serverId: string;
7407
7518
  socket: WebSocket;
7519
+ authenticated: boolean;
7408
7520
  reconnectAttempts: number;
7409
7521
  reconnectTimer?: ReturnType<typeof setTimeout>;
7410
7522
  isReconnecting: boolean;