refactor: app event bus (#6985)

* refactor: app event bus

* fix: use messagepack + cleanup

* fix: use postcard

* fix: lint

* fix: import gate

* fix: prettierignore + lint

* fix: lint

* fix: rev
This commit is contained in:
Calum H.
2026-08-13 16:33:06 +00:00
committed by GitHub
parent 5f7493491f
commit 579109a478
93 changed files with 2669 additions and 834 deletions
@@ -0,0 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommandPayload } from "./CommandPayload";
import type { FriendPayload } from "./FriendPayload";
import type { InstallJobSnapshot } from "./InstallJobSnapshot";
import type { InstanceBulkUpdateProgressPayload } from "./InstanceBulkUpdateProgressPayload";
import type { InstancePayload } from "./InstancePayload";
import type { LoadingPayload } from "./LoadingPayload";
import type { LogPayload } from "./LogPayload";
import type { ProcessPayload } from "./ProcessPayload";
import type { WarningPayload } from "./WarningPayload";
export type AppEvent = { "type": "loading", "payload": LoadingPayload } | { "type": "process", "payload": ProcessPayload } | { "type": "instance", "payload": InstancePayload } | { "type": "instance_bulk_update_progress", "payload": InstanceBulkUpdateProgressPayload } | { "type": "install_job", "payload": InstallJobSnapshot } | { "type": "command", "payload": CommandPayload } | { "type": "warning", "payload": WarningPayload } | { "type": "friend", "payload": FriendPayload } | { "type": "notification", "payload": unknown } | { "type": "log", "payload": LogPayload } | { "type": "ads_consent_required", "payload": boolean };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type CommandPayload = { "event": "InstallMod", id: string, } | { "event": "InstallVersion", id: string, } | { "event": "InstallModpack", id: string, } | { "event": "InstallServer", id: string, } | { "event": "LaunchInstance", id: string, server: string | null, singleplayer_world: string | null, } | { "event": "InstallSharedInstanceInvite", invite_id: string, } | { "event": "RunMRPack", path: string, };
@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { FriendStatusPayload } from "./FriendStatusPayload";
export type FriendPayload = { "event": "friend_request", from: string, } | { "event": "user_offline", id: string, } | { "event": "status_update", user_status: FriendStatusPayload, } | { "event": "status_sync" };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type FriendStatusPayload = { user_id: string, profile_name: string | null, last_update: string, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ImportLauncherType = "MultiMC" | "PrismLauncher" | "ATLauncher" | "GDLauncher" | "Curseforge" | "Unknown";
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallApiErrorDetails = { error: string, status?: number, method?: string, url?: string, route?: string, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallErrorContext = { operation: string, source_path?: string, target_path?: string, file_path?: string, entry_path?: string, urls: Array<string>, expected_hash?: string, expected_size?: number, project_id?: string, version_id?: string, minecraft_version?: string, loader?: string, java_version?: number, os?: string, arch?: string, };
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { InstallApiErrorDetails } from "./InstallApiErrorDetails";
import type { InstallErrorContext } from "./InstallErrorContext";
import type { InstallPhaseId } from "./InstallPhaseId";
import type { SharedInstanceUnavailableReason } from "./SharedInstanceUnavailableReason";
export type InstallErrorView = { code: string, phase?: InstallPhaseId, message: string, reason?: SharedInstanceUnavailableReason, api?: InstallApiErrorDetails, context?: InstallErrorContext, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallJavaStep = "resolving" | "fetching_metadata" | "downloading" | "extracting" | "validating";
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallJobDisplay = { title: string, icon: string | null, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallJobKind = "create_instance" | "create_modpack_instance" | "create_shared_instance" | "import_instance" | "duplicate_instance" | "install_existing_instance" | "install_pack_to_existing_instance" | "update_shared_instance";
@@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { InstallErrorView } from "./InstallErrorView";
import type { InstallJobDisplay } from "./InstallJobDisplay";
import type { InstallJobKind } from "./InstallJobKind";
import type { InstallJobStatus } from "./InstallJobStatus";
import type { InstallPhaseDetails } from "./InstallPhaseDetails";
import type { InstallPhaseId } from "./InstallPhaseId";
import type { InstallProgress } from "./InstallProgress";
import type { InstallTarget } from "./InstallTarget";
export type InstallJobSnapshot = { job_id: string, instance_id: string | null, kind: InstallJobKind, status: InstallJobStatus, target: InstallTarget, phase: InstallPhaseId, progress: InstallProgress | null, details: InstallPhaseDetails, display: InstallJobDisplay | null, error: InstallErrorView | null, rollback_error: InstallErrorView | null, created: string, modified: string, finished: string | null, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallJobStatus = "queued" | "running" | "succeeded" | "failed" | "interrupted" | "canceled";
@@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ImportLauncherType } from "./ImportLauncherType";
import type { InstallJavaStep } from "./InstallJavaStep";
import type { ModLoader } from "./ModLoader";
export type InstallPhaseDetails = { "type": "empty" } | { "type": "instance", name: string, } | { "type": "minecraft", game_version: string, loader: ModLoader, } | { "type": "java", major_version: number, step: InstallJavaStep, } | { "type": "modpack", project_id: string | null, version_id: string | null, title: string | null, } | { "type": "import", launcher_type: ImportLauncherType, instance_folder: string, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallPhaseId = "preparing_instance" | "resolving_pack" | "downloading_pack_file" | "reading_pack_manifest" | "downloading_content" | "extracting_overrides" | "resolving_minecraft" | "resolving_loader" | "preparing_java" | "downloading_minecraft" | "running_loader_processors" | "finalizing" | "rolling_back";
@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { InstallProgressSecondary } from "./InstallProgressSecondary";
export type InstallProgress = { current: number, total: number, secondary?: InstallProgressSecondary, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallProgressSecondary = { current: number, total: number, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstallTarget = { "type": "new_instance", instance_id: string | null, } | { "type": "existing_instance", instance_id: string, };
@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { InstanceBulkUpdateProgressStage } from "./InstanceBulkUpdateProgressStage";
export type InstanceBulkUpdateProgressPayload = { instanceId: string, stage: InstanceBulkUpdateProgressStage, current: number, total: number, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstanceBulkUpdateProgressStage = "resolving_versions" | "downloading" | "finishing";
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type InstancePayload = { instance_id: string, } & ({ "event": "created" } | { "event": "synced" } | { "event": "servers_updated" } | { "event": "world_updated", world: string, } | { "event": "server_joined", host: string, port: number, timestamp: string, } | { "event": "edited" } | { "event": "content_install_finished", project_ids: Array<string>, } | { "event": "content_install_failed", project_ids: Array<string>, message: string, } | { "event": "removed" });
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type LoadingBarType = { "type": "legacy_data_migration" } | { "type": "directory_move", old: string, new: string, } | { "type": "java_download", version: number, } | { "type": "pack_file_download", instance_id: string, pack_name: string, icon: string | null, pack_version: string, } | { "type": "pack_download", instance_id: string, pack_name: string, icon: string | null, pack_id: string | null, pack_version: string | null, } | { "type": "minecraft_download", instance_id: string, instance_name: string, } | { "type": "instance_update", instance_id: string, instance_name: string, } | { "type": "zip_extract", instance_id: string, instance_name: string, } | { "type": "config_change", new_path: string, } | { "type": "copy_instance", import_location: string, instance_name: string, } | { "type": "launcher_update", version: string, current_version: string, };
@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LoadingBarType } from "./LoadingBarType";
export type LoadingPayload = { event: LoadingBarType, loader_uuid: string, fraction: number | null, message: string, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Log4jEvent = { timestamp_millis: number | null, logger_name: string | null, level: string | null, thread_name: string | null, message: string | null, throwable: string | null, };
@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Log4jEvent } from "./Log4jEvent";
export type LogPayload = { instance_id: string, } & ({ "type": "log4j" } & Log4jEvent | { "type": "legacy", message: string, });
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ModLoader = "vanilla" | "forge" | "fabric" | "quilt" | "neoforge";
@@ -0,0 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ProcessPayloadType } from "./ProcessPayloadType";
export type ProcessPayload = { instance_id: string, uuid: string, event: ProcessPayloadType, message: string, };
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ProcessPayloadType = "launched" | "finished";
@@ -0,0 +1,8 @@
# App event bindings
> [!WARNING]
> Do not edit the generated TypeScript or Postcard binding files in this directory manually.
The event bus types are determined by the Rust [`AppEvent`](../../../../../packages/app-lib/src/event/mod.rs) contract.
They are regenerated automatically when you run `pnpm app:dev` from the workspace root. Commit any generated changes with the Rust contract change.
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type SharedInstanceUnavailableReason = "deleted" | "access_revoked" | "quarantined";
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type WarningPayload = { message: string, };
@@ -0,0 +1,78 @@
declare type u8 = number
declare type u16 = number
declare type u32 = number
declare type u64 = bigint
declare type u128 = bigint
declare type usize = bigint
declare type i8 = number
declare type i16 = number
declare type i32 = number
declare type i64 = bigint
declare type i128 = bigint
declare type isize = bigint
declare type NonZeroU8 = number
declare type NonZeroU16 = number
declare type NonZeroU32 = number
declare type NonZeroU64 = bigint
declare type NonZeroU128 = bigint
declare type NonZeroUsize = bigint
declare type NonZeroI8 = number
declare type NonZeroI16 = number
declare type NonZeroI32 = number
declare type NonZeroI64 = bigint
declare type NonZeroI128 = bigint
declare type NonZeroIsize = bigint
declare type f32 = number
declare type f64 = number
declare type ArrayLengthMutationKeys = "splice" | "push" | "pop" | "shift" | "unshift"
declare type FixedLengthArray<T, L extends number, TObj = [T, ...Array<T>]> =
Pick<TObj, Exclude<keyof TObj, ArrayLengthMutationKeys>>
& {
readonly length: L
[ I : number ] : T
[Symbol.iterator]: () => IterableIterator<T>
}
export type AppEvent = { tag: "loading", value: LoadingPayload } | { tag: "process", value: ProcessPayload } | { tag: "instance", value: InstancePayload } | { tag: "instance_bulk_update_progress", value: InstanceBulkUpdateProgressPayload } | { tag: "install_job", value: InstallJobSnapshot } | { tag: "command", value: CommandPayload } | { tag: "warning", value: WarningPayload } | { tag: "friend", value: FriendPayload } | { tag: "notification", value: string } | { tag: "log", value: LogPayload } | { tag: "ads_consent_required", value: boolean }
export type LoadingBarType = { tag: "legacy_data_migration" } | { tag: "directory_move", value: { old: string, new: string } } | { tag: "java_download", value: { version: u32 } } | { tag: "pack_file_download", value: { instance_id: string, pack_name: string, icon: string | undefined, pack_version: string } } | { tag: "pack_download", value: { instance_id: string, pack_name: string, icon: string | undefined, pack_id: string | undefined, pack_version: string | undefined } } | { tag: "minecraft_download", value: { instance_id: string, instance_name: string } } | { tag: "instance_update", value: { instance_id: string, instance_name: string } } | { tag: "zip_extract", value: { instance_id: string, instance_name: string } } | { tag: "config_change", value: { new_path: string } } | { tag: "copy_instance", value: { import_location: string, instance_name: string } } | { tag: "launcher_update", value: { version: string, current_version: string } }
export type LoadingPayload = { event: LoadingBarType, loader_uuid: string, fraction: f64 | undefined, message: string }
export type WarningPayload = { message: string }
export type InstanceBulkUpdateProgressPayload = { instanceId: string, stage: InstanceBulkUpdateProgressStage, current: u64, total: u64 }
export type InstanceBulkUpdateProgressStage = { tag: "resolving_versions" } | { tag: "downloading" } | { tag: "finishing" }
export type CommandPayload = { tag: "InstallMod", value: { id: string } } | { tag: "InstallVersion", value: { id: string } } | { tag: "InstallModpack", value: { id: string } } | { tag: "InstallServer", value: { id: string } } | { tag: "LaunchInstance", value: { id: string, server: string | undefined, singleplayer_world: string | undefined } } | { tag: "InstallSharedInstanceInvite", value: { invite_id: string } } | { tag: "RunMRPack", value: { path: string } }
export type ProcessPayload = { instance_id: string, uuid: string, event: ProcessPayloadType, message: string }
export type ProcessPayloadType = { tag: "launched" } | { tag: "finished" }
export type InstancePayload = { instance_id: string, event: InstancePayloadType }
export type InstancePayloadType = { tag: "created" } | { tag: "synced" } | { tag: "servers_updated" } | { tag: "world_updated", value: { world: string } } | { tag: "server_joined", value: { host: string, port: u16, timestamp: string } } | { tag: "edited" } | { tag: "content_install_finished", value: { project_ids: string[] } } | { tag: "content_install_failed", value: { project_ids: string[], message: string } } | { tag: "removed" }
export type FriendPayload = { tag: "friend_request", value: { from: string } } | { tag: "user_offline", value: { id: string } } | { tag: "status_update", value: { user_status: FriendStatusPayload } } | { tag: "status_sync" }
export type FriendStatusPayload = { user_id: string, profile_name: string | undefined, last_update: string }
export type SharedInstanceUnavailableReason = { tag: "deleted" } | { tag: "access_revoked" } | { tag: "quarantined" }
export type LogEvent = { tag: "log4j", value: Log4jEvent } | { tag: "legacy", value: { message: string } }
export type LogPayload = { instance_id: string, event: LogEvent }
export type Log4jEvent = { timestamp_millis: i64 | undefined, logger_name: string | undefined, level: string | undefined, thread_name: string | undefined, message: string | undefined, throwable: string | undefined }
export type ModLoader = { tag: "vanilla" } | { tag: "forge" } | { tag: "fabric" } | { tag: "quilt" } | { tag: "neoforge" }
export type InstallJobSnapshot = { job_id: string, instance_id: string | undefined, kind: InstallJobKind, status: InstallJobStatus, target: InstallTarget, phase: InstallPhaseId, progress: InstallProgress | undefined, details: InstallPhaseDetails, display: InstallJobDisplay | undefined, error: InstallErrorView | undefined, rollback_error: InstallErrorView | undefined, created: string, modified: string, finished: string | undefined }
export type InstallJobKind = { tag: "create_instance" } | { tag: "create_modpack_instance" } | { tag: "create_shared_instance" } | { tag: "import_instance" } | { tag: "duplicate_instance" } | { tag: "install_existing_instance" } | { tag: "install_pack_to_existing_instance" } | { tag: "update_shared_instance" }
export type InstallJobStatus = { tag: "queued" } | { tag: "running" } | { tag: "succeeded" } | { tag: "failed" } | { tag: "interrupted" } | { tag: "canceled" }
export type InstallTarget = { tag: "new_instance", value: { instance_id: string | undefined } } | { tag: "existing_instance", value: { instance_id: string } }
export type InstallPhaseId = { tag: "preparing_instance" } | { tag: "resolving_pack" } | { tag: "downloading_pack_file" } | { tag: "reading_pack_manifest" } | { tag: "downloading_content" } | { tag: "extracting_overrides" } | { tag: "resolving_minecraft" } | { tag: "resolving_loader" } | { tag: "preparing_java" } | { tag: "downloading_minecraft" } | { tag: "running_loader_processors" } | { tag: "finalizing" } | { tag: "rolling_back" }
export type InstallProgress = { current: u64, total: u64, secondary: InstallProgressSecondary | undefined }
export type InstallProgressSecondary = { current: u64, total: u64 }
export type InstallPhaseDetails = { tag: "empty" } | { tag: "instance", value: { name: string } } | { tag: "minecraft", value: { game_version: string, loader: ModLoader } } | { tag: "java", value: { major_version: u32, step: InstallJavaStep } } | { tag: "modpack", value: { project_id: string | undefined, version_id: string | undefined, title: string | undefined } } | { tag: "import", value: { launcher_type: ImportLauncherType, instance_folder: string } }
export type InstallJavaStep = { tag: "resolving" } | { tag: "fetching_metadata" } | { tag: "downloading" } | { tag: "extracting" } | { tag: "validating" }
export type InstallJobDisplay = { title: string, icon: string | undefined }
export type InstallErrorView = { code: string, phase: InstallPhaseId | undefined, message: string, reason: SharedInstanceUnavailableReason | undefined, api: InstallApiErrorDetails | undefined, context: InstallErrorContext | undefined }
export type InstallApiErrorDetails = { error: string, status: u16 | undefined, method: string | undefined, url: string | undefined, route: string | undefined }
export type InstallErrorContext = { operation: string, source_path: string | undefined, target_path: string | undefined, file_path: string | undefined, entry_path: string | undefined, urls: string[], expected_hash: string | undefined, expected_size: u64 | undefined, project_id: string | undefined, version_id: string | undefined, minecraft_version: string | undefined, loader: string | undefined, java_version: u32 | undefined, os: string | undefined, arch: string | undefined }
export type ImportLauncherType = { tag: "MultiMC" } | { tag: "PrismLauncher" } | { tag: "ATLauncher" } | { tag: "GDLauncher" } | { tag: "Curseforge" } | { tag: "Unknown" }
export type Type = "AppEvent" | "LoadingBarType" | "LoadingPayload" | "WarningPayload" | "InstanceBulkUpdateProgressPayload" | "InstanceBulkUpdateProgressStage" | "CommandPayload" | "ProcessPayload" | "ProcessPayloadType" | "InstancePayload" | "InstancePayloadType" | "FriendPayload" | "FriendStatusPayload" | "LogEvent" | "LogPayload" | "Log4jEvent" | "InstallJobSnapshot" | "InstallJobKind" | "InstallJobStatus" | "InstallTarget" | "InstallPhaseId" | "InstallProgress" | "InstallProgressSecondary" | "InstallPhaseDetails" | "InstallJavaStep" | "InstallJobDisplay" | "InstallErrorView" | "InstallApiErrorDetails" | "InstallErrorContext" | "ImportLauncherType" | "ModLoader" | "SharedInstanceUnavailableReason"
declare type ValueType<T extends Type> = T extends "AppEvent" ? AppEvent : T extends "LoadingBarType" ? LoadingBarType : T extends "LoadingPayload" ? LoadingPayload : T extends "WarningPayload" ? WarningPayload : T extends "InstanceBulkUpdateProgressPayload" ? InstanceBulkUpdateProgressPayload : T extends "InstanceBulkUpdateProgressStage" ? InstanceBulkUpdateProgressStage : T extends "CommandPayload" ? CommandPayload : T extends "ProcessPayload" ? ProcessPayload : T extends "ProcessPayloadType" ? ProcessPayloadType : T extends "InstancePayload" ? InstancePayload : T extends "InstancePayloadType" ? InstancePayloadType : T extends "FriendPayload" ? FriendPayload : T extends "FriendStatusPayload" ? FriendStatusPayload : T extends "LogEvent" ? LogEvent : T extends "LogPayload" ? LogPayload : T extends "Log4jEvent" ? Log4jEvent : T extends "InstallJobSnapshot" ? InstallJobSnapshot : T extends "InstallJobKind" ? InstallJobKind : T extends "InstallJobStatus" ? InstallJobStatus : T extends "InstallTarget" ? InstallTarget : T extends "InstallPhaseId" ? InstallPhaseId : T extends "InstallProgress" ? InstallProgress : T extends "InstallProgressSecondary" ? InstallProgressSecondary : T extends "InstallPhaseDetails" ? InstallPhaseDetails : T extends "InstallJavaStep" ? InstallJavaStep : T extends "InstallJobDisplay" ? InstallJobDisplay : T extends "InstallErrorView" ? InstallErrorView : T extends "InstallApiErrorDetails" ? InstallApiErrorDetails : T extends "InstallErrorContext" ? InstallErrorContext : T extends "ImportLauncherType" ? ImportLauncherType : T extends "ModLoader" ? ModLoader : T extends "SharedInstanceUnavailableReason" ? SharedInstanceUnavailableReason : void
export interface Result<T extends Type> {
value: ValueType<T>;
bytes: Uint8Array;
}
export function deserialize<T extends Type>(type: T, bytes: Uint8Array): Result<T>
@@ -0,0 +1,953 @@
const BITS_PER_BYTE = 8, BITS_PER_VARINT_BYTE = 7, U8_BYTES = 1, U16_BYTES = 2, U32_BYTES = 4, U64_BYTES = 8, U128_BYTES = 16
const de_zig_zag_signed = (n) => (n >> 1n) ^ (-(n & 0b1n))
const zig_zag = (n_bytes, n) => (n << 1n) ^ (n >> BigInt(n_bytes * BITS_PER_BYTE - 1))
const varint_max = (n_bytes) => Math.floor((n_bytes * BITS_PER_BYTE + (BITS_PER_BYTE - 1)) / BITS_PER_VARINT_BYTE)
const max_of_last_byte = (n_bytes) => (1 << (n_bytes * BITS_PER_BYTE) % 7) - 1
const to_number_if_safe = (n) => Number.MAX_SAFE_INTEGER < ((n < 0n) ? -n : n) ? n : Number(n)
const varint = (n_bytes, n) => { let value = BigInt(n), out = []; for (let i = 0; i < varint_max(n_bytes); i++) { out.push(Number(value & 0xFFn)); if (value < 128n) { return out } out[i] |= 0x80; value >>= 7n } }
class Deserializer {
constructor(bytes_in) { this.bytes = Array.from(bytes_in); }
pop_next = () => { const next = this.bytes.shift(); if (next === undefined) { throw "input buffer too small" } return next }
pop_n = (n) => { const bytes = Array(); for (let i = 0; i < n; i++) { bytes.push(this.bytes.shift()) } return bytes }
get_int8 = (signed) => signed ? new Int8Array([this.pop_next()])[0] : this.pop_next();
try_take = (n_bytes) => { let out = 0n, v_max = varint_max(n_bytes); for (let i = 0; i < v_max; i++) { const val = this.pop_next(), carry = BigInt(val & 0x7F); out |= carry << BigInt(7 * i); if ((val & 0x80) === 0) { if (i === v_max - 1 && val > max_of_last_byte(n_bytes)) { throw "Bad Variant" } else return out } } throw "Bad Variant"; }
deserialize_bool = () => { const byte = this.pop_next(); return byte === undefined ? undefined : byte > 0 ? true : false }
deserialize_number = (n_bytes, signed) => { if (n_bytes === U8_BYTES) { return this.get_int8(signed) } else if (n_bytes === U16_BYTES || n_bytes === U32_BYTES || n_bytes === U64_BYTES || n_bytes === U128_BYTES) { const val = this.try_take(n_bytes); return to_number_if_safe(signed ? de_zig_zag_signed(val) : val) } else { throw "byte count not supported" } }
deserialize_number_float = (n_bytes) => { const b_buffer = new ArrayBuffer(n_bytes), b_view = new DataView(b_buffer); this.pop_n(n_bytes).forEach((b, i) => b_view.setUint8(i, b)); if (n_bytes === U32_BYTES) { return b_view.getFloat32(0, true) } else if (n_bytes === U64_BYTES) { return b_view.getFloat64(0, true) } else { throw "byte count not supported" } }
deserialize_string = () => new TextDecoder().decode(new Uint8Array(this.pop_n(Number(this.try_take(U32_BYTES)))))
deserialize_array = (des, len) => Array.from({length: len === undefined ? Number(this.try_take(U32_BYTES)) : len}, (v, i) => des(this))
deserialize_string_key_map = (des) => { return [...Array(Number(this.try_take(U32_BYTES)))].reduce((prev) => { prev[this.deserialize_string()] = des(this); return prev }, {}) }
deserialize_map = (des) => { return [...Array(Number(this.try_take(U32_BYTES)))].reduce((prev) => { const d = des(this); prev.set(d[0], d[1]); return prev }, new Map()) }
release_bytes = () => { return new Uint8Array(this.bytes); }
}
function deserialize_APP_EVENT(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "loading",
value: deserialize_LOADING_PAYLOAD(d)
};
case 1:
return {
tag: "process",
value: deserialize_PROCESS_PAYLOAD(d)
};
case 2:
return {
tag: "instance",
value: deserialize_INSTANCE_PAYLOAD(d)
};
case 3:
return {
tag: "instance_bulk_update_progress",
value: deserialize_INSTANCE_BULK_UPDATE_PROGRESS_PAYLOAD(d)
};
case 4:
return {
tag: "install_job",
value: deserialize_INSTALL_JOB_SNAPSHOT(d)
};
case 5:
return {
tag: "command",
value: deserialize_COMMAND_PAYLOAD(d)
};
case 6:
return {
tag: "warning",
value: deserialize_WARNING_PAYLOAD(d)
};
case 7:
return {
tag: "friend",
value: deserialize_FRIEND_PAYLOAD(d)
};
case 8:
return {
tag: "notification",
value: d.deserialize_string()
};
case 9:
return {
tag: "log",
value: deserialize_LOG_PAYLOAD(d)
};
case 10:
return {
tag: "ads_consent_required",
value: d.deserialize_bool()
};
default:
throw "variant not implemented"
}
}
function deserialize_LOADING_BAR_TYPE(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "legacy_data_migration"
};
case 1:
return {
tag: "directory_move",
value: {
old: d.deserialize_string(),
new: d.deserialize_string()
}
};
case 2:
return {
tag: "java_download",
value: {
version: d.deserialize_number(U32_BYTES, false)
}
};
case 3:
return {
tag: "pack_file_download",
value: {
instance_id: d.deserialize_string(),
pack_name: d.deserialize_string(),
icon: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
pack_version: d.deserialize_string()
}
};
case 4:
return {
tag: "pack_download",
value: {
instance_id: d.deserialize_string(),
pack_name: d.deserialize_string(),
icon: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
pack_id: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
pack_version: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
}
};
case 5:
return {
tag: "minecraft_download",
value: {
instance_id: d.deserialize_string(),
instance_name: d.deserialize_string()
}
};
case 6:
return {
tag: "instance_update",
value: {
instance_id: d.deserialize_string(),
instance_name: d.deserialize_string()
}
};
case 7:
return {
tag: "zip_extract",
value: {
instance_id: d.deserialize_string(),
instance_name: d.deserialize_string()
}
};
case 8:
return {
tag: "config_change",
value: {
new_path: d.deserialize_string()
}
};
case 9:
return {
tag: "copy_instance",
value: {
import_location: d.deserialize_string(),
instance_name: d.deserialize_string()
}
};
case 10:
return {
tag: "launcher_update",
value: {
version: d.deserialize_string(),
current_version: d.deserialize_string()
}
};
default:
throw "variant not implemented"
}
}
function deserialize_LOADING_PAYLOAD(d) {
return {
event: deserialize_LOADING_BAR_TYPE(d),
loader_uuid: d.deserialize_string(),
fraction: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_number_float(U64_BYTES),
message: d.deserialize_string()
};
}
function deserialize_WARNING_PAYLOAD(d) {
return {
message: d.deserialize_string()
};
}
function deserialize_INSTANCE_BULK_UPDATE_PROGRESS_PAYLOAD(d) {
return {
instanceId: d.deserialize_string(),
stage: deserialize_INSTANCE_BULK_UPDATE_PROGRESS_STAGE(d),
current: d.deserialize_number(U64_BYTES, false),
total: d.deserialize_number(U64_BYTES, false)
};
}
function deserialize_INSTANCE_BULK_UPDATE_PROGRESS_STAGE(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "resolving_versions"
};
case 1:
return {
tag: "downloading"
};
case 2:
return {
tag: "finishing"
};
default:
throw "variant not implemented"
}
}
function deserialize_COMMAND_PAYLOAD(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "InstallMod",
value: {
id: d.deserialize_string()
}
};
case 1:
return {
tag: "InstallVersion",
value: {
id: d.deserialize_string()
}
};
case 2:
return {
tag: "InstallModpack",
value: {
id: d.deserialize_string()
}
};
case 3:
return {
tag: "InstallServer",
value: {
id: d.deserialize_string()
}
};
case 4:
return {
tag: "LaunchInstance",
value: {
id: d.deserialize_string(),
server: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
singleplayer_world: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
}
};
case 5:
return {
tag: "InstallSharedInstanceInvite",
value: {
invite_id: d.deserialize_string()
}
};
case 6:
return {
tag: "RunMRPack",
value: {
path: d.deserialize_string()
}
};
default:
throw "variant not implemented"
}
}
function deserialize_PROCESS_PAYLOAD(d) {
return {
instance_id: d.deserialize_string(),
uuid: d.deserialize_string(),
event: deserialize_PROCESS_PAYLOAD_TYPE(d),
message: d.deserialize_string()
};
}
function deserialize_PROCESS_PAYLOAD_TYPE(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "launched"
};
case 1:
return {
tag: "finished"
};
default:
throw "variant not implemented"
}
}
function deserialize_INSTANCE_PAYLOAD(d) {
return {
instance_id: d.deserialize_string(),
event: deserialize_INSTANCE_PAYLOAD_TYPE(d)
};
}
function deserialize_INSTANCE_PAYLOAD_TYPE(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "created"
};
case 1:
return {
tag: "synced"
};
case 2:
return {
tag: "servers_updated"
};
case 3:
return {
tag: "world_updated",
value: {
world: d.deserialize_string()
}
};
case 4:
return {
tag: "server_joined",
value: {
host: d.deserialize_string(),
port: d.deserialize_number(U16_BYTES, false),
timestamp: d.deserialize_string()
}
};
case 5:
return {
tag: "edited"
};
case 6:
return {
tag: "content_install_finished",
value: {
project_ids: d.deserialize_array(() => d.deserialize_string())
}
};
case 7:
return {
tag: "content_install_failed",
value: {
project_ids: d.deserialize_array(() => d.deserialize_string()),
message: d.deserialize_string()
}
};
case 8:
return {
tag: "removed"
};
default:
throw "variant not implemented"
}
}
function deserialize_FRIEND_PAYLOAD(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "friend_request",
value: {
from: d.deserialize_string()
}
};
case 1:
return {
tag: "user_offline",
value: {
id: d.deserialize_string()
}
};
case 2:
return {
tag: "status_update",
value: {
user_status: deserialize_FRIEND_STATUS_PAYLOAD(d)
}
};
case 3:
return {
tag: "status_sync"
};
default:
throw "variant not implemented"
}
}
function deserialize_FRIEND_STATUS_PAYLOAD(d) {
return {
user_id: d.deserialize_string(),
profile_name: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
last_update: d.deserialize_string()
};
}
function deserialize_LOG_EVENT(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "log4j",
value: deserialize_LOG4J_EVENT(d)
};
case 1:
return {
tag: "legacy",
value: {
message: d.deserialize_string()
}
};
default:
throw "variant not implemented"
}
}
function deserialize_LOG_PAYLOAD(d) {
return {
instance_id: d.deserialize_string(),
event: deserialize_LOG_EVENT(d)
};
}
function deserialize_LOG4J_EVENT(d) {
return {
timestamp_millis: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_number(U64_BYTES, true),
logger_name: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
level: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
thread_name: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
message: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
throwable: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
};
}
function deserialize_INSTALL_JOB_SNAPSHOT(d) {
return {
job_id: d.deserialize_string(),
instance_id: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
kind: deserialize_INSTALL_JOB_KIND(d),
status: deserialize_INSTALL_JOB_STATUS(d),
target: deserialize_INSTALL_TARGET(d),
phase: deserialize_INSTALL_PHASE_ID(d),
progress: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_PROGRESS(d),
details: deserialize_INSTALL_PHASE_DETAILS(d),
display: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_JOB_DISPLAY(d),
error: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_ERROR_VIEW(d),
rollback_error: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_ERROR_VIEW(d),
created: d.deserialize_string(),
modified: d.deserialize_string(),
finished: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
};
}
function deserialize_INSTALL_JOB_KIND(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "create_instance"
};
case 1:
return {
tag: "create_modpack_instance"
};
case 2:
return {
tag: "create_shared_instance"
};
case 3:
return {
tag: "import_instance"
};
case 4:
return {
tag: "duplicate_instance"
};
case 5:
return {
tag: "install_existing_instance"
};
case 6:
return {
tag: "install_pack_to_existing_instance"
};
case 7:
return {
tag: "update_shared_instance"
};
default:
throw "variant not implemented"
}
}
function deserialize_INSTALL_JOB_STATUS(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "queued"
};
case 1:
return {
tag: "running"
};
case 2:
return {
tag: "succeeded"
};
case 3:
return {
tag: "failed"
};
case 4:
return {
tag: "interrupted"
};
case 5:
return {
tag: "canceled"
};
default:
throw "variant not implemented"
}
}
function deserialize_INSTALL_TARGET(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "new_instance",
value: {
instance_id: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
}
};
case 1:
return {
tag: "existing_instance",
value: {
instance_id: d.deserialize_string()
}
};
default:
throw "variant not implemented"
}
}
function deserialize_INSTALL_PHASE_ID(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "preparing_instance"
};
case 1:
return {
tag: "resolving_pack"
};
case 2:
return {
tag: "downloading_pack_file"
};
case 3:
return {
tag: "reading_pack_manifest"
};
case 4:
return {
tag: "downloading_content"
};
case 5:
return {
tag: "extracting_overrides"
};
case 6:
return {
tag: "resolving_minecraft"
};
case 7:
return {
tag: "resolving_loader"
};
case 8:
return {
tag: "preparing_java"
};
case 9:
return {
tag: "downloading_minecraft"
};
case 10:
return {
tag: "running_loader_processors"
};
case 11:
return {
tag: "finalizing"
};
case 12:
return {
tag: "rolling_back"
};
default:
throw "variant not implemented"
}
}
function deserialize_INSTALL_PROGRESS(d) {
return {
current: d.deserialize_number(U64_BYTES, false),
total: d.deserialize_number(U64_BYTES, false),
secondary: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_PROGRESS_SECONDARY(d)
};
}
function deserialize_INSTALL_PROGRESS_SECONDARY(d) {
return {
current: d.deserialize_number(U64_BYTES, false),
total: d.deserialize_number(U64_BYTES, false)
};
}
function deserialize_INSTALL_PHASE_DETAILS(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "empty"
};
case 1:
return {
tag: "instance",
value: {
name: d.deserialize_string()
}
};
case 2:
return {
tag: "minecraft",
value: {
game_version: d.deserialize_string(),
loader: deserialize_MOD_LOADER(d)
}
};
case 3:
return {
tag: "java",
value: {
major_version: d.deserialize_number(U32_BYTES, false),
step: deserialize_INSTALL_JAVA_STEP(d)
}
};
case 4:
return {
tag: "modpack",
value: {
project_id: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
version_id: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
title: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
}
};
case 5:
return {
tag: "import",
value: {
launcher_type: deserialize_IMPORT_LAUNCHER_TYPE(d),
instance_folder: d.deserialize_string()
}
};
default:
throw "variant not implemented"
}
}
function deserialize_INSTALL_JAVA_STEP(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "resolving"
};
case 1:
return {
tag: "fetching_metadata"
};
case 2:
return {
tag: "downloading"
};
case 3:
return {
tag: "extracting"
};
case 4:
return {
tag: "validating"
};
default:
throw "variant not implemented"
}
}
function deserialize_INSTALL_JOB_DISPLAY(d) {
return {
title: d.deserialize_string(),
icon: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
};
}
function deserialize_INSTALL_ERROR_VIEW(d) {
return {
code: d.deserialize_string(),
phase: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_PHASE_ID(d),
message: d.deserialize_string(),
reason: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_SHARED_INSTANCE_UNAVAILABLE_REASON(d),
api: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_API_ERROR_DETAILS(d),
context: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : deserialize_INSTALL_ERROR_CONTEXT(d)
};
}
function deserialize_INSTALL_API_ERROR_DETAILS(d) {
return {
error: d.deserialize_string(),
status: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_number(U16_BYTES, false),
method: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
url: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
route: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
};
}
function deserialize_INSTALL_ERROR_CONTEXT(d) {
return {
operation: d.deserialize_string(),
source_path: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
target_path: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
file_path: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
entry_path: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
urls: d.deserialize_array(() => d.deserialize_string()),
expected_hash: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
expected_size: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_number(U64_BYTES, false),
project_id: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
version_id: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
minecraft_version: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
loader: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
java_version: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_number(U32_BYTES, false),
os: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string(),
arch: (d.deserialize_number(U32_BYTES, false) === 0) ? undefined : d.deserialize_string()
};
}
function deserialize_IMPORT_LAUNCHER_TYPE(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "MultiMC"
};
case 1:
return {
tag: "PrismLauncher"
};
case 2:
return {
tag: "ATLauncher"
};
case 3:
return {
tag: "GDLauncher"
};
case 4:
return {
tag: "Curseforge"
};
case 5:
return {
tag: "Unknown"
};
default:
throw "variant not implemented"
}
}
function deserialize_MOD_LOADER(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "vanilla"
};
case 1:
return {
tag: "forge"
};
case 2:
return {
tag: "fabric"
};
case 3:
return {
tag: "quilt"
};
case 4:
return {
tag: "neoforge"
};
default:
throw "variant not implemented"
}
}
function deserialize_SHARED_INSTANCE_UNAVAILABLE_REASON(d) {
switch (d.deserialize_number(U32_BYTES, false)) {
case 0:
return {
tag: "deleted"
};
case 1:
return {
tag: "access_revoked"
};
case 2:
return {
tag: "quarantined"
};
default:
throw "variant not implemented"
}
}
/**
* Deserialize a value from an array of bytes.
* @param {string} type - The type of the value to deserialize.
* @param {Uint8Array} bytes - The byte array to deserialize from.
* @return {Object} The deserialized value and remaining bytes.
*/
function deserialize(type, bytes) {
if (!(typeof type === "string")) {
throw "type must be a string";
}
const d = new Deserializer(bytes);
var return_value = undefined;
switch (type) {
case "AppEvent":
return_value = deserialize_APP_EVENT(d);
break;
case "LoadingBarType":
return_value = deserialize_LOADING_BAR_TYPE(d);
break;
case "LoadingPayload":
return_value = deserialize_LOADING_PAYLOAD(d);
break;
case "WarningPayload":
return_value = deserialize_WARNING_PAYLOAD(d);
break;
case "InstanceBulkUpdateProgressPayload":
return_value = deserialize_INSTANCE_BULK_UPDATE_PROGRESS_PAYLOAD(d);
break;
case "InstanceBulkUpdateProgressStage":
return_value = deserialize_INSTANCE_BULK_UPDATE_PROGRESS_STAGE(d);
break;
case "CommandPayload":
return_value = deserialize_COMMAND_PAYLOAD(d);
break;
case "ProcessPayload":
return_value = deserialize_PROCESS_PAYLOAD(d);
break;
case "ProcessPayloadType":
return_value = deserialize_PROCESS_PAYLOAD_TYPE(d);
break;
case "InstancePayload":
return_value = deserialize_INSTANCE_PAYLOAD(d);
break;
case "InstancePayloadType":
return_value = deserialize_INSTANCE_PAYLOAD_TYPE(d);
break;
case "FriendPayload":
return_value = deserialize_FRIEND_PAYLOAD(d);
break;
case "FriendStatusPayload":
return_value = deserialize_FRIEND_STATUS_PAYLOAD(d);
break;
case "LogEvent":
return_value = deserialize_LOG_EVENT(d);
break;
case "LogPayload":
return_value = deserialize_LOG_PAYLOAD(d);
break;
case "Log4jEvent":
return_value = deserialize_LOG4J_EVENT(d);
break;
case "InstallJobSnapshot":
return_value = deserialize_INSTALL_JOB_SNAPSHOT(d);
break;
case "InstallJobKind":
return_value = deserialize_INSTALL_JOB_KIND(d);
break;
case "InstallJobStatus":
return_value = deserialize_INSTALL_JOB_STATUS(d);
break;
case "InstallTarget":
return_value = deserialize_INSTALL_TARGET(d);
break;
case "InstallPhaseId":
return_value = deserialize_INSTALL_PHASE_ID(d);
break;
case "InstallProgress":
return_value = deserialize_INSTALL_PROGRESS(d);
break;
case "InstallProgressSecondary":
return_value = deserialize_INSTALL_PROGRESS_SECONDARY(d);
break;
case "InstallPhaseDetails":
return_value = deserialize_INSTALL_PHASE_DETAILS(d);
break;
case "InstallJavaStep":
return_value = deserialize_INSTALL_JAVA_STEP(d);
break;
case "InstallJobDisplay":
return_value = deserialize_INSTALL_JOB_DISPLAY(d);
break;
case "InstallErrorView":
return_value = deserialize_INSTALL_ERROR_VIEW(d);
break;
case "InstallApiErrorDetails":
return_value = deserialize_INSTALL_API_ERROR_DETAILS(d);
break;
case "InstallErrorContext":
return_value = deserialize_INSTALL_ERROR_CONTEXT(d);
break;
case "ImportLauncherType":
return_value = deserialize_IMPORT_LAUNCHER_TYPE(d);
break;
case "ModLoader":
return_value = deserialize_MOD_LOADER(d);
break;
case "SharedInstanceUnavailableReason":
return_value = deserialize_SHARED_INSTANCE_UNAVAILABLE_REASON(d);
break;
default:
throw "type not implemented";
}
return { value: return_value, bytes: d.release_bytes() };
}
export {
deserialize
};
@@ -0,0 +1,8 @@
{
"name": "postcard",
"description": "Auto generated bindings for postcard format serializing and deserializing javascript to and from bytes.",
"version": "0.0.0",
"main": "index.js",
"types": "index.d.ts",
"type": "module"
}