spacetimedb 1.6.0 → 1.6.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/time_duration.ts","../src/lib/timestamp.ts","../src/lib/binary_writer.ts","../src/lib/binary_reader.ts","../src/lib/utils.ts","../src/lib/identity.ts","../src/lib/option.ts","../src/lib/autogen/sum_type_variant_type.ts","../src/lib/autogen/sum_type_type.ts","../src/lib/autogen/product_type_element_type.ts","../src/lib/autogen/product_type_type.ts","../src/lib/autogen/algebraic_type_type.ts","../src/lib/schedule_at.ts","../src/lib/algebraic_type.ts","../src/lib/connection_id.ts","../src/lib/algebraic_value.ts","../src/sdk/client_api/row_size_hint_type.ts","../src/sdk/client_api/bsatn_row_list_type.ts","../src/sdk/client_api/call_reducer_type.ts","../src/sdk/client_api/subscribe_type.ts","../src/sdk/client_api/one_off_query_type.ts","../src/sdk/client_api/query_id_type.ts","../src/sdk/client_api/subscribe_single_type.ts","../src/sdk/client_api/subscribe_multi_type.ts","../src/sdk/client_api/unsubscribe_type.ts","../src/sdk/client_api/unsubscribe_multi_type.ts","../src/sdk/client_api/client_message_type.ts","../src/sdk/client_api/query_update_type.ts","../src/sdk/client_api/compressable_query_update_type.ts","../src/sdk/client_api/table_update_type.ts","../src/sdk/client_api/database_update_type.ts","../src/sdk/client_api/initial_subscription_type.ts","../src/sdk/client_api/update_status_type.ts","../src/sdk/client_api/reducer_call_info_type.ts","../src/sdk/client_api/energy_quanta_type.ts","../src/sdk/client_api/transaction_update_type.ts","../src/sdk/client_api/transaction_update_light_type.ts","../src/sdk/client_api/identity_token_type.ts","../src/sdk/client_api/one_off_table_type.ts","../src/sdk/client_api/one_off_query_response_type.ts","../src/sdk/client_api/subscribe_rows_type.ts","../src/sdk/client_api/subscribe_applied_type.ts","../src/sdk/client_api/unsubscribe_applied_type.ts","../src/sdk/client_api/subscription_error_type.ts","../src/sdk/client_api/subscribe_multi_applied_type.ts","../src/sdk/client_api/unsubscribe_multi_applied_type.ts","../src/sdk/client_api/server_message_type.ts","../src/sdk/event_emitter.ts","../src/sdk/logger.ts","../src/sdk/table_cache.ts","../src/sdk/client_cache.ts","../src/sdk/version.ts","../src/sdk/decompress.ts","../src/sdk/ws.ts","../src/sdk/websocket_decompress_adapter.ts","../src/sdk/db_connection_builder.ts","../src/sdk/subscription_builder_impl.ts","../src/sdk/db_connection_impl.ts"],"names":["AlgebraicType","ProductType","SumType","fromByteArray","event","eventContext","callbacks"],"mappings":";;;AAcO,IAAM,YAAA,GAAN,MAAM,aAAA,CAAa;AAAA,EACxB,wBAAA;AAAA,EAEA,OAAe,iBAAA,GAA4B,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3C,OAAO,gBAAA,GAA8C;AACnD,IAAA,OAAO,cAAc,OAAA,CAAQ;AAAA,MAC3B,QAAA,EAAU;AAAA,QACR;AAAA,UACE,IAAA,EAAM,0BAAA;AAAA,UACN,eAAe,aAAA,CAAc;AAAA;AAC/B;AACF,KACD,CAAA;AAAA,EACH;AAAA,EAEA,IAAI,MAAA,GAAiB;AACnB,IAAA,OAAO,IAAA,CAAK,wBAAA;AAAA,EACd;AAAA,EAEA,IAAI,MAAA,GAAiB;AACnB,IAAA,OAAO,MAAA,CAAO,IAAA,CAAK,MAAA,GAAS,aAAA,CAAa,iBAAiB,CAAA;AAAA,EAC5D;AAAA,EAEA,YAAY,MAAA,EAAgB;AAC1B,IAAA,IAAA,CAAK,wBAAA,GAA2B,MAAA;AAAA,EAClC;AAAA,EAEA,OAAO,WAAW,MAAA,EAA8B;AAC9C,IAAA,OAAO,IAAI,aAAA,CAAa,MAAA,CAAO,MAAM,CAAA,GAAI,cAAa,iBAAiB,CAAA;AAAA,EACzE;AAAA;AAAA,EAGA,QAAA,GAAmB;AACjB,IAAA,MAAM,SAAS,IAAA,CAAK,MAAA;AACpB,IAAA,MAAM,IAAA,GAAO,MAAA,GAAS,CAAA,GAAI,G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,mBACN,QAAA,EACM;AACN,IAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,YAAA,EAAc,QAAQ,CAAA;AAAA,EAC1C;AAAA,EAEQ,qBACN,QAAA,EACM;AACN,IAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,cAAA,EAAgB,QAAQ,CAAA;AAAA,EAC5C;AAAA;AAAA;AAAA,EAIA,SAAA,CAAU,aAAqB,QAAA,EAAsC;AACnE,IAAA,IAAA,CAAK,eAAA,CAAgB,EAAA,CAAG,WAAA,EAAa,QAAQ,CAAA;AAAA,EAC/C;AAAA;AAAA;AAAA,EAIA,UAAA,CAAW,aAAqB,QAAA,EAAsC;AACpE,IAAA,IAAA,CAAK,eAAA,CAAgB,GAAA,CAAI,WAAA,EAAa,QAAQ,CAAA;AAAA,EAChD;AACF","file":"index.browser.mjs","sourcesContent":["import { AlgebraicType } from './algebraic_type';\n\nexport type TimeDurationAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [\n { name: '__time_duration_micros__'; algebraicType: { tag: 'I64' } },\n ];\n };\n};\n\n/**\n * A difference between two points in time, represented as a number of microseconds.\n */\nexport class TimeDuration {\n __time_duration_micros__: bigint;\n\n private static MICROS_PER_MILLIS: bigint = 1000n;\n\n /**\n * Get the algebraic type representation of the {@link TimeDuration} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): TimeDurationAlgebraicType {\n return AlgebraicType.Product({\n elements: [\n {\n name: '__time_duration_micros__',\n algebraicType: AlgebraicType.I64,\n },\n ],\n });\n }\n\n get micros(): bigint {\n return this.__time_duration_micros__;\n }\n\n get millis(): number {\n return Number(this.micros / TimeDuration.MICROS_PER_MILLIS);\n }\n\n constructor(micros: bigint) {\n this.__time_duration_micros__ = micros;\n }\n\n static fromMillis(millis: number): TimeDuration {\n return new TimeDuration(BigInt(millis) * TimeDuration.MICROS_PER_MILLIS);\n }\n\n /** This outputs the same string format that we use in the host and in Rust modules */\n toString(): string {\n const micros = this.micros;\n const sign = micros < 0 ? '-' : '+';\n const pos = micros < 0 ? -micros : micros;\n const secs = pos / 1_000_000n;\n const micros_remaining = pos % 1_000_000n;\n return `${sign}${secs}.${String(micros_remaining).padStart(6, '0')}`;\n }\n}\n","import { AlgebraicType } from './algebraic_type';\nimport { TimeDuration } from './time_duration';\n\nexport type TimestampAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [\n {\n name: '__timestamp_micros_since_unix_epoch__';\n algebraicType: { tag: 'I64' };\n },\n ];\n };\n};\n\n/**\n * A point in time, represented as a number of microseconds since the Unix epoch.\n */\nexport class Timestamp {\n __timestamp_micros_since_unix_epoch__: bigint;\n\n private static MICROS_PER_MILLIS: bigint = 1000n;\n\n get microsSinceUnixEpoch(): bigint {\n return this.__timestamp_micros_since_unix_epoch__;\n }\n\n constructor(micros: bigint) {\n this.__timestamp_micros_since_unix_epoch__ = micros;\n }\n\n /**\n * Get the algebraic type representation of the {@link Timestamp} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): TimestampAlgebraicType {\n return AlgebraicType.Product({\n elements: [\n {\n name: '__timestamp_micros_since_unix_epoch__',\n algebraicType: AlgebraicType.I64,\n },\n ],\n });\n }\n\n /**\n * The Unix epoch, the midnight at the beginning of January 1, 1970, UTC.\n */\n static UNIX_EPOCH: Timestamp = new Timestamp(0n);\n\n /**\n * Get a `Timestamp` representing the execution environment's belief of the current moment in time.\n */\n static now(): Timestamp {\n return Timestamp.fromDate(new Date());\n }\n\n /**\n * Get a `Timestamp` representing the same point in time as `date`.\n */\n static fromDate(date: Date): Timestamp {\n const millis = date.getTime();\n const micros = BigInt(millis) * Timestamp.MICROS_PER_MILLIS;\n return new Timestamp(micros);\n }\n\n /**\n * Get a `Date` representing approximately the same point in time as `this`.\n *\n * This method truncates to millisecond precision,\n * and throws `RangeError` if the `Timestamp` is outside the range representable as a `Date`.\n */\n toDate(): Date {\n const micros = this.__timestamp_micros_since_unix_epoch__;\n const millis = micros / Timestamp.MICROS_PER_MILLIS;\n if (\n millis > BigInt(Number.MAX_SAFE_INTEGER) ||\n millis < BigInt(Number.MIN_SAFE_INTEGER)\n ) {\n throw new RangeError(\n \"Timestamp is outside of the representable range of JS's Date\"\n );\n }\n return new Date(Number(millis));\n }\n\n since(other: Timestamp): TimeDuration {\n return new TimeDuration(\n this.__timestamp_micros_since_unix_epoch__ -\n other.__timestamp_micros_since_unix_epoch__\n );\n }\n}\n","import { fromByteArray } from 'base64-js';\n\nexport default class BinaryWriter {\n #buffer: Uint8Array;\n #view: DataView;\n #offset: number = 0;\n\n constructor(size: number) {\n this.#buffer = new Uint8Array(size);\n this.#view = new DataView(this.#buffer.buffer);\n }\n\n #expandBuffer(additionalCapacity: number): void {\n const minCapacity = this.#offset + additionalCapacity + 1;\n if (minCapacity <= this.#buffer.length) return;\n let newCapacity = this.#buffer.length * 2;\n if (newCapacity < minCapacity) newCapacity = minCapacity;\n const newBuffer = new Uint8Array(newCapacity);\n newBuffer.set(this.#buffer);\n this.#buffer = newBuffer;\n this.#view = new DataView(this.#buffer.buffer);\n }\n\n toBase64(): string {\n return fromByteArray(this.#buffer.subarray(0, this.#offset));\n }\n\n getBuffer(): Uint8Array {\n return this.#buffer.slice(0, this.#offset);\n }\n\n get offset(): number {\n return this.#offset;\n }\n\n writeUInt8Array(value: Uint8Array): void {\n const length = value.length;\n\n this.#expandBuffer(4 + length);\n\n this.writeU32(length);\n this.#buffer.set(value, this.#offset);\n this.#offset += value.length;\n }\n\n writeBool(value: boolean): void {\n this.#expandBuffer(1);\n this.#view.setUint8(this.#offset, value ? 1 : 0);\n this.#offset += 1;\n }\n\n writeByte(value: number): void {\n this.#expandBuffer(1);\n this.#view.setUint8(this.#offset, value);\n this.#offset += 1;\n }\n\n writeI8(value: number): void {\n this.#expandBuffer(1);\n this.#view.setInt8(this.#offset, value);\n this.#offset += 1;\n }\n\n writeU8(value: number): void {\n this.#expandBuffer(1);\n this.#view.setUint8(this.#offset, value);\n this.#offset += 1;\n }\n\n writeI16(value: number): void {\n this.#expandBuffer(2);\n this.#view.setInt16(this.#offset, value, true);\n this.#offset += 2;\n }\n\n writeU16(value: number): void {\n this.#expandBuffer(2);\n this.#view.setUint16(this.#offset, value, true);\n this.#offset += 2;\n }\n\n writeI32(value: number): void {\n this.#expandBuffer(4);\n this.#view.setInt32(this.#offset, value, true);\n this.#offset += 4;\n }\n\n writeU32(value: number): void {\n this.#expandBuffer(4);\n this.#view.setUint32(this.#offset, value, true);\n this.#offset += 4;\n }\n\n writeI64(value: bigint): void {\n this.#expandBuffer(8);\n this.#view.setBigInt64(this.#offset, value, true);\n this.#offset += 8;\n }\n\n writeU64(value: bigint): void {\n this.#expandBuffer(8);\n this.#view.setBigUint64(this.#offset, value, true);\n this.#offset += 8;\n }\n\n writeU128(value: bigint): void {\n this.#expandBuffer(16);\n const lowerPart = value & BigInt('0xFFFFFFFFFFFFFFFF');\n const upperPart = value >> BigInt(64);\n this.#view.setBigUint64(this.#offset, lowerPart, true);\n this.#view.setBigUint64(this.#offset + 8, upperPart, true);\n this.#offset += 16;\n }\n\n writeI128(value: bigint): void {\n this.#expandBuffer(16);\n const lowerPart = value & BigInt('0xFFFFFFFFFFFFFFFF');\n const upperPart = value >> BigInt(64);\n this.#view.setBigInt64(this.#offset, lowerPart, true);\n this.#view.setBigInt64(this.#offset + 8, upperPart, true);\n this.#offset += 16;\n }\n\n writeU256(value: bigint): void {\n this.#expandBuffer(32);\n const low_64_mask = BigInt('0xFFFFFFFFFFFFFFFF');\n const p0 = value & low_64_mask;\n const p1 = (value >> BigInt(64 * 1)) & low_64_mask;\n const p2 = (value >> BigInt(64 * 2)) & low_64_mask;\n const p3 = value >> BigInt(64 * 3);\n this.#view.setBigUint64(this.#offset + 8 * 0, p0, true);\n this.#view.setBigUint64(this.#offset + 8 * 1, p1, true);\n this.#view.setBigUint64(this.#offset + 8 * 2, p2, true);\n this.#view.setBigUint64(this.#offset + 8 * 3, p3, true);\n this.#offset += 32;\n }\n\n writeI256(value: bigint): void {\n this.#expandBuffer(32);\n const low_64_mask = BigInt('0xFFFFFFFFFFFFFFFF');\n const p0 = value & low_64_mask;\n const p1 = (value >> BigInt(64 * 1)) & low_64_mask;\n const p2 = (value >> BigInt(64 * 2)) & low_64_mask;\n const p3 = value >> BigInt(64 * 3);\n this.#view.setBigUint64(this.#offset + 8 * 0, p0, true);\n this.#view.setBigUint64(this.#offset + 8 * 1, p1, true);\n this.#view.setBigUint64(this.#offset + 8 * 2, p2, true);\n this.#view.setBigInt64(this.#offset + 8 * 3, p3, true);\n this.#offset += 32;\n }\n\n writeF32(value: number): void {\n this.#expandBuffer(4);\n this.#view.setFloat32(this.#offset, value, true);\n this.#offset += 4;\n }\n\n writeF64(value: number): void {\n this.#expandBuffer(8);\n this.#view.setFloat64(this.#offset, value, true);\n this.#offset += 8;\n }\n\n writeString(value: string): void {\n const encoder = new TextEncoder();\n const encodedString = encoder.encode(value);\n this.writeU32(encodedString.length);\n this.#expandBuffer(encodedString.length);\n this.#buffer.set(encodedString, this.#offset);\n this.#offset += encodedString.length;\n }\n}\n","export default class BinaryReader {\n /**\n * The DataView used to read values from the binary data.\n *\n * Note: The DataView's `byteOffset` is relative to the beginning of the\n * underlying ArrayBuffer, not the start of the provided Uint8Array input.\n * This `BinaryReader`'s `#offset` field is used to track the current read position\n * relative to the start of the provided Uint8Array input.\n */\n #view: DataView;\n\n /**\n * Represents the offset (in bytes) relative to the start of the DataView\n * and provided Uint8Array input.\n *\n * Note: This is *not* the absolute byte offset within the underlying ArrayBuffer.\n */\n #offset: number = 0;\n\n constructor(input: Uint8Array) {\n this.#view = new DataView(input.buffer, input.byteOffset, input.byteLength);\n this.#offset = 0;\n }\n\n get offset(): number {\n return this.#offset;\n }\n\n get remaining(): number {\n return this.#view.byteLength - this.#offset;\n }\n\n /** Ensure we have at least `n` bytes left to read */\n #ensure(n: number): void {\n if (this.#offset + n > this.#view.byteLength) {\n throw new RangeError(\n `Tried to read ${n} byte(s) at relative offset ${this.#offset}, but only ${this.remaining} byte(s) remain`\n );\n }\n }\n\n readUInt8Array(): Uint8Array {\n const length = this.readU32();\n this.#ensure(length);\n return this.readBytes(length);\n }\n\n readBool(): boolean {\n const value = this.#view.getUint8(this.#offset);\n this.#offset += 1;\n return value !== 0;\n }\n\n readByte(): number {\n const value = this.#view.getUint8(this.#offset);\n this.#offset += 1;\n return value;\n }\n\n readBytes(length: number): Uint8Array {\n // Create a Uint8Array view over the DataView's buffer at the current offset\n // The #view.buffer is the whole ArrayBuffer, so we need to account for the\n // #view's starting position in that buffer (#view.byteOffset) and the current #offset\n const array = new Uint8Array(\n this.#view.buffer,\n this.#view.byteOffset + this.#offset,\n length\n );\n this.#offset += length;\n return array;\n }\n\n readI8(): number {\n const value = this.#view.getInt8(this.#offset);\n this.#offset += 1;\n return value;\n }\n\n readU8(): number {\n return this.readByte();\n }\n\n readI16(): number {\n const value = this.#view.getInt16(this.#offset, true);\n this.#offset += 2;\n return value;\n }\n\n readU16(): number {\n const value = this.#view.getUint16(this.#offset, true);\n this.#offset += 2;\n return value;\n }\n\n readI32(): number {\n const value = this.#view.getInt32(this.#offset, true);\n this.#offset += 4;\n return value;\n }\n\n readU32(): number {\n const value = this.#view.getUint32(this.#offset, true);\n this.#offset += 4;\n return value;\n }\n\n readI64(): bigint {\n const value = this.#view.getBigInt64(this.#offset, true);\n this.#offset += 8;\n return value;\n }\n\n readU64(): bigint {\n const value = this.#view.getBigUint64(this.#offset, true);\n this.#offset += 8;\n return value;\n }\n\n readU128(): bigint {\n const lowerPart = this.#view.getBigUint64(this.#offset, true);\n const upperPart = this.#view.getBigUint64(this.#offset + 8, true);\n this.#offset += 16;\n\n return (upperPart << BigInt(64)) + lowerPart;\n }\n\n readI128(): bigint {\n const lowerPart = this.#view.getBigUint64(this.#offset, true);\n const upperPart = this.#view.getBigInt64(this.#offset + 8, true);\n this.#offset += 16;\n\n return (upperPart << BigInt(64)) + lowerPart;\n }\n\n readU256(): bigint {\n const p0 = this.#view.getBigUint64(this.#offset, true);\n const p1 = this.#view.getBigUint64(this.#offset + 8, true);\n const p2 = this.#view.getBigUint64(this.#offset + 16, true);\n const p3 = this.#view.getBigUint64(this.#offset + 24, true);\n this.#offset += 32;\n\n return (\n (p3 << BigInt(3 * 64)) +\n (p2 << BigInt(2 * 64)) +\n (p1 << BigInt(1 * 64)) +\n p0\n );\n }\n\n readI256(): bigint {\n const p0 = this.#view.getBigUint64(this.#offset, true);\n const p1 = this.#view.getBigUint64(this.#offset + 8, true);\n const p2 = this.#view.getBigUint64(this.#offset + 16, true);\n const p3 = this.#view.getBigInt64(this.#offset + 24, true);\n this.#offset += 32;\n\n return (\n (p3 << BigInt(3 * 64)) +\n (p2 << BigInt(2 * 64)) +\n (p1 << BigInt(1 * 64)) +\n p0\n );\n }\n\n readF32(): number {\n const value = this.#view.getFloat32(this.#offset, true);\n this.#offset += 4;\n return value;\n }\n\n readF64(): number {\n const value = this.#view.getFloat64(this.#offset, true);\n this.#offset += 8;\n return value;\n }\n\n readString(): string {\n const uint8Array = this.readUInt8Array();\n return new TextDecoder('utf-8').decode(uint8Array);\n }\n}\n","import BinaryReader from './binary_reader';\nimport BinaryWriter from './binary_writer';\n\nexport function toPascalCase(s: string): string {\n const str = s.replace(/([-_][a-z])/gi, $1 => {\n return $1.toUpperCase().replace('-', '').replace('_', '');\n });\n\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function deepEqual(obj1: any, obj2: any): boolean {\n // If both are strictly equal (covers primitives and reference equality), return true\n if (obj1 === obj2) return true;\n\n // If either is a primitive type or one is null, return false since we already checked for strict equality\n if (\n typeof obj1 !== 'object' ||\n obj1 === null ||\n typeof obj2 !== 'object' ||\n obj2 === null\n ) {\n return false;\n }\n\n // Get keys of both objects\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n\n // If number of keys is different, return false\n if (keys1.length !== keys2.length) return false;\n\n // Check all keys and compare values recursively\n for (const key of keys1) {\n if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function uint8ArrayToHexString(array: Uint8Array): string {\n return Array.prototype.map\n .call(array.reverse(), x => ('00' + x.toString(16)).slice(-2))\n .join('');\n}\n\nexport function uint8ArrayToU128(array: Uint8Array): bigint {\n if (array.length != 16) {\n throw new Error(`Uint8Array is not 16 bytes long: ${array}`);\n }\n return new BinaryReader(array).readU128();\n}\n\nexport function uint8ArrayToU256(array: Uint8Array): bigint {\n if (array.length != 32) {\n throw new Error(`Uint8Array is not 32 bytes long: [${array}]`);\n }\n return new BinaryReader(array).readU256();\n}\n\nexport function hexStringToUint8Array(str: string): Uint8Array {\n if (str.startsWith('0x')) {\n str = str.slice(2);\n }\n const matches = str.match(/.{1,2}/g) || [];\n const data = Uint8Array.from(\n matches.map((byte: string) => parseInt(byte, 16))\n );\n return data.reverse();\n}\n\nexport function hexStringToU128(str: string): bigint {\n return uint8ArrayToU128(hexStringToUint8Array(str));\n}\n\nexport function hexStringToU256(str: string): bigint {\n return uint8ArrayToU256(hexStringToUint8Array(str));\n}\n\nexport function u128ToUint8Array(data: bigint): Uint8Array {\n const writer = new BinaryWriter(16);\n writer.writeU128(data);\n return writer.getBuffer();\n}\n\nexport function u128ToHexString(data: bigint): string {\n return uint8ArrayToHexString(u128ToUint8Array(data));\n}\n\nexport function u256ToUint8Array(data: bigint): Uint8Array {\n const writer = new BinaryWriter(32);\n writer.writeU256(data);\n return writer.getBuffer();\n}\n\nexport function u256ToHexString(data: bigint): string {\n return uint8ArrayToHexString(u256ToUint8Array(data));\n}\n","import { AlgebraicType } from './algebraic_type';\nimport { hexStringToU256, u256ToHexString, u256ToUint8Array } from './utils';\n\nexport type IdentityAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [{ name: '__identity__'; algebraicType: { tag: 'U256' } }];\n };\n};\n\n/**\n * A unique identifier for a user connected to a database.\n */\nexport class Identity {\n __identity__: bigint;\n\n /**\n * Creates a new `Identity`.\n *\n * `data` can be a hexadecimal string or a `bigint`.\n */\n constructor(data: string | bigint) {\n // we get a JSON with __identity__ when getting a token with a JSON API\n // and an bigint when using BSATN\n this.__identity__ = typeof data === 'string' ? hexStringToU256(data) : data;\n }\n\n /**\n * Get the algebraic type representation of the {@link Identity} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): IdentityAlgebraicType {\n return AlgebraicType.Product({\n elements: [{ name: '__identity__', algebraicType: AlgebraicType.U256 }],\n });\n }\n\n /**\n * Compare two identities for equality.\n */\n isEqual(other: Identity): boolean {\n return this.toHexString() === other.toHexString();\n }\n\n /**\n * Print the identity as a hexadecimal string.\n */\n toHexString(): string {\n return u256ToHexString(this.__identity__);\n }\n\n /**\n * Convert the address to a Uint8Array.\n */\n toUint8Array(): Uint8Array {\n return u256ToUint8Array(this.__identity__);\n }\n\n /**\n * Parse an Identity from a hexadecimal string.\n */\n static fromString(str: string): Identity {\n return new Identity(str);\n }\n\n /**\n * Zero identity (0x0000000000000000000000000000000000000000000000000000000000000000)\n */\n static zero(): Identity {\n return new Identity(0n);\n }\n\n toString(): string {\n return this.toHexString();\n }\n}\n","import { AlgebraicType } from './algebraic_type';\n\nexport type OptionAlgebraicType = {\n tag: 'Sum';\n value: {\n variants: [\n { name: 'some'; algebraicType: AlgebraicType },\n {\n name: 'none';\n algebraicType: { tag: 'Product'; value: { elements: [] } };\n },\n ];\n };\n};\n\nexport const Option: {\n getAlgebraicType(innerType: AlgebraicType): OptionAlgebraicType;\n} = {\n getAlgebraicType(innerType: AlgebraicType): OptionAlgebraicType {\n return AlgebraicType.Sum({\n variants: [\n { name: 'some', algebraicType: innerType },\n {\n name: 'none',\n algebraicType: AlgebraicType.Product({ elements: [] }),\n },\n ],\n });\n },\n};\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { AlgebraicType } from './algebraic_type_type';\n// Mark import as potentially unused\ndeclare type __keep_AlgebraicType = AlgebraicType;\n\nexport type SumTypeVariant = {\n name: string | undefined;\n algebraicType: AlgebraicType;\n};\nlet _cached_SumTypeVariant_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SumTypeVariant = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SumTypeVariant_type_value)\n return _cached_SumTypeVariant_type_value;\n _cached_SumTypeVariant_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SumTypeVariant_type_value.value.elements.push(\n {\n name: 'name',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.String\n ),\n },\n {\n name: 'algebraicType',\n algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SumTypeVariant_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SumTypeVariant): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SumTypeVariant.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SumTypeVariant {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SumTypeVariant.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SumTypeVariant;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { SumTypeVariant } from './sum_type_variant_type';\n// Mark import as potentially unused\ndeclare type __keep_SumTypeVariant = SumTypeVariant;\n\nexport type SumType = {\n variants: SumTypeVariant[];\n};\nlet _cached_SumType_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SumType = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SumType_type_value) return _cached_SumType_type_value;\n _cached_SumType_type_value = __AlgebraicTypeValue.Product({ elements: [] });\n _cached_SumType_type_value.value.elements.push({\n name: 'variants',\n algebraicType: __AlgebraicTypeValue.Array(\n SumTypeVariant.getTypeScriptAlgebraicType()\n ),\n });\n return _cached_SumType_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SumType): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SumType.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SumType {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SumType.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SumType;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { AlgebraicType } from './algebraic_type_type';\n// Mark import as potentially unused\ndeclare type __keep_AlgebraicType = AlgebraicType;\n\nexport type ProductTypeElement = {\n name: string | undefined;\n algebraicType: AlgebraicType;\n};\nlet _cached_ProductTypeElement_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const ProductTypeElement = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ProductTypeElement_type_value)\n return _cached_ProductTypeElement_type_value;\n _cached_ProductTypeElement_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_ProductTypeElement_type_value.value.elements.push(\n {\n name: 'name',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.String\n ),\n },\n {\n name: 'algebraicType',\n algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_ProductTypeElement_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ProductTypeElement): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ProductTypeElement.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ProductTypeElement {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ProductTypeElement.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ProductTypeElement;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { ProductTypeElement } from './product_type_element_type';\n// Mark import as potentially unused\ndeclare type __keep_ProductTypeElement = ProductTypeElement;\n\nexport type ProductType = {\n elements: ProductTypeElement[];\n};\nlet _cached_ProductType_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const ProductType = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ProductType_type_value) return _cached_ProductType_type_value;\n _cached_ProductType_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_ProductType_type_value.value.elements.push({\n name: 'elements',\n algebraicType: __AlgebraicTypeValue.Array(\n ProductTypeElement.getTypeScriptAlgebraicType()\n ),\n });\n return _cached_ProductType_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ProductType): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ProductType.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ProductType {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ProductType.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ProductType;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { SumType } from './sum_type_type';\n// Mark import as potentially unused\ndeclare type __keep_SumType = SumType;\nimport { ProductType } from './product_type_type';\n// Mark import as potentially unused\ndeclare type __keep_ProductType = ProductType;\n\nimport * as AlgebraicTypeVariants from './algebraic_type_variants';\n\n// The tagged union or sum type for the algebraic type `AlgebraicType`.\nexport type AlgebraicType =\n | AlgebraicTypeVariants.Ref\n | AlgebraicTypeVariants.Sum\n | AlgebraicTypeVariants.Product\n | AlgebraicTypeVariants.Array\n | AlgebraicTypeVariants.String\n | AlgebraicTypeVariants.Bool\n | AlgebraicTypeVariants.I8\n | AlgebraicTypeVariants.U8\n | AlgebraicTypeVariants.I16\n | AlgebraicTypeVariants.U16\n | AlgebraicTypeVariants.I32\n | AlgebraicTypeVariants.U32\n | AlgebraicTypeVariants.I64\n | AlgebraicTypeVariants.U64\n | AlgebraicTypeVariants.I128\n | AlgebraicTypeVariants.U128\n | AlgebraicTypeVariants.I256\n | AlgebraicTypeVariants.U256\n | AlgebraicTypeVariants.F32\n | AlgebraicTypeVariants.F64;\n\nlet _cached_AlgebraicType_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const AlgebraicType = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n Ref: (value: number): AlgebraicTypeVariants.Ref => ({ tag: 'Ref', value }),\n Sum: (value: SumType): AlgebraicTypeVariants.Sum => ({ tag: 'Sum', value }),\n Product: (value: ProductType): AlgebraicTypeVariants.Product => ({\n tag: 'Product',\n value,\n }),\n Array: (value: AlgebraicType): AlgebraicTypeVariants.Array => ({\n tag: 'Array',\n value,\n }),\n String: { tag: 'String' } as const,\n Bool: { tag: 'Bool' } as const,\n I8: { tag: 'I8' } as const,\n U8: { tag: 'U8' } as const,\n I16: { tag: 'I16' } as const,\n U16: { tag: 'U16' } as const,\n I32: { tag: 'I32' } as const,\n U32: { tag: 'U32' } as const,\n I64: { tag: 'I64' } as const,\n U64: { tag: 'U64' } as const,\n I128: { tag: 'I128' } as const,\n U128: { tag: 'U128' } as const,\n I256: { tag: 'I256' } as const,\n U256: { tag: 'U256' } as const,\n F32: { tag: 'F32' } as const,\n F64: { tag: 'F64' } as const,\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_AlgebraicType_type_value)\n return _cached_AlgebraicType_type_value;\n _cached_AlgebraicType_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_AlgebraicType_type_value.value.variants.push(\n { name: 'Ref', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'Sum', algebraicType: SumType.getTypeScriptAlgebraicType() },\n {\n name: 'Product',\n algebraicType: ProductType.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Array',\n algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),\n },\n {\n name: 'String',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'Bool',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I8',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U8',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I16',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U16',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I32',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U32',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I64',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U64',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I128',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U128',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I256',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U256',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'F32',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'F64',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n }\n );\n return _cached_AlgebraicType_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: AlgebraicType): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n AlgebraicType.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): AlgebraicType {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n AlgebraicType.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default AlgebraicType;\n","import { AlgebraicType } from './algebraic_type';\nimport { TimeDuration, type TimeDurationAlgebraicType } from './time_duration';\nimport { Timestamp, type TimestampAlgebraicType } from './timestamp';\n\nexport type ScheduleAtAlgebraicType = {\n tag: 'Sum';\n value: {\n variants: [\n { name: 'Interval'; algebraicType: TimeDurationAlgebraicType },\n { name: 'Time'; algebraicType: TimestampAlgebraicType },\n ];\n };\n};\n\ntype ScheduleAtType = Interval | Time;\n\nexport const ScheduleAt: {\n interval: (micros: bigint) => ScheduleAtType;\n time: (microsSinceUnixEpoch: bigint) => ScheduleAtType;\n /**\n * Get the algebraic type representation of the {@link ScheduleAt} type.\n * @returns The algebraic type representation of the type.\n */\n getAlgebraicType(): ScheduleAtAlgebraicType;\n} = {\n interval(value: bigint): ScheduleAtType {\n return Interval(value);\n },\n time(value: bigint): ScheduleAtType {\n return Time(value);\n },\n getAlgebraicType(): ScheduleAtAlgebraicType {\n return AlgebraicType.Sum({\n variants: [\n {\n name: 'Interval',\n algebraicType: TimeDuration.getAlgebraicType(),\n },\n { name: 'Time', algebraicType: Timestamp.getAlgebraicType() },\n ],\n });\n },\n};\n\nexport type Interval = {\n tag: 'Interval';\n value: TimeDuration;\n};\nexport const Interval = (micros: bigint): Interval => ({\n tag: 'Interval',\n value: new TimeDuration(micros),\n});\nexport type Time = {\n tag: 'Time';\n value: Timestamp;\n};\nexport const Time = (microsSinceUnixEpoch: bigint): Time => ({\n tag: 'Time',\n value: new Timestamp(microsSinceUnixEpoch),\n});\n\nexport default ScheduleAt;\nexport type ScheduleAt = ScheduleAtType;\n","import { TimeDuration } from './time_duration';\nimport { Timestamp } from './timestamp';\nimport { ConnectionId } from './connection_id';\nimport type BinaryReader from './binary_reader';\nimport BinaryWriter from './binary_writer';\nimport { Identity } from './identity';\nimport { Option } from './option';\nimport {\n AlgebraicType as AlgebraicTypeType,\n AlgebraicType as AlgebraicTypeValue,\n} from './autogen/algebraic_type_type';\nimport {\n type ProductType as ProductTypeType,\n ProductType as ProductTypeValue,\n} from './autogen/product_type_type';\nimport {\n type SumType as SumTypeType,\n SumType as SumTypeValue,\n} from './autogen/sum_type_type';\nimport ScheduleAt from './schedule_at';\nimport type Typespace from './autogen/typespace_type';\n\n/**\n * A factor / element of a product type.\n *\n * An element consist of an optional name and a type.\n *\n * NOTE: Each element has an implicit element tag based on its order.\n * Uniquely identifies an element similarly to protobuf tags.\n */\nexport * from './autogen/product_type_element_type';\n\n/**\n * A variant of a sum type.\n *\n * NOTE: Each element has an implicit element tag based on its order.\n * Uniquely identifies an element similarly to protobuf tags.\n */\nexport * from './autogen/sum_type_variant_type';\n\n/**\n * The variant types of the Algebraic Type tagged union.\n */\nexport type * as AlgebraicTypeVariants from './autogen/algebraic_type_variants';\n\n/**\n * The SpacetimeDB Algebraic Type System (SATS) is a structural type system in\n * which a nominal type system can be constructed.\n *\n * The type system unifies the concepts sum types, product types, and built-in\n * primitive types into a single type system.\n */\nexport type AlgebraicType = AlgebraicTypeType;\n\n/**\n * Algebraic Type utilities.\n */\nexport const AlgebraicType: {\n Sum<T extends SumType>(value: T): { tag: 'Sum'; value: T };\n Product<T extends ProductType>(value: T): { tag: 'Product'; value: T };\n Array<T extends AlgebraicType>(value: T): { tag: 'Array'; value: T };\n\n createOptionType(innerType: AlgebraicTypeType): AlgebraicTypeType;\n createIdentityType(): AlgebraicTypeType;\n createConnectionIdType(): AlgebraicTypeType;\n createScheduleAtType(): AlgebraicTypeType;\n createTimestampType(): AlgebraicTypeType;\n createTimeDurationType(): AlgebraicTypeType;\n serializeValue(\n writer: BinaryWriter,\n ty: AlgebraicTypeType,\n value: any,\n typespace?: Typespace\n ): void;\n deserializeValue(\n reader: BinaryReader,\n ty: AlgebraicTypeType,\n typespace?: Typespace\n ): any;\n /**\n * Convert a value of the algebraic type into something that can be used as a key in a map.\n * There are no guarantees about being able to order it.\n * This is only guaranteed to be comparable to other values of the same type.\n * @param value A value of the algebraic type\n * @returns Something that can be used as a key in a map.\n */\n intoMapKey(ty: AlgebraicTypeType, value: any): ComparablePrimitive;\n} & typeof AlgebraicTypeValue = {\n ...AlgebraicTypeValue,\n Sum: <T extends SumType>(value: T): { tag: 'Sum'; value: T } => ({\n tag: 'Sum',\n value,\n }),\n Product: <T extends ProductType>(value: T): { tag: 'Product'; value: T } => ({\n tag: 'Product',\n value,\n }),\n Array: <T extends AlgebraicType>(value: T): { tag: 'Array'; value: T } => ({\n tag: 'Array',\n value,\n }),\n createOptionType: function (innerType: AlgebraicTypeType): AlgebraicTypeType {\n return Option.getAlgebraicType(innerType);\n },\n createIdentityType: function (): AlgebraicTypeType {\n return Identity.getAlgebraicType();\n },\n createConnectionIdType: function (): AlgebraicTypeType {\n return ConnectionId.getAlgebraicType();\n },\n createScheduleAtType: function (): AlgebraicTypeType {\n return ScheduleAt.getAlgebraicType();\n },\n createTimestampType: function (): AlgebraicTypeType {\n return Timestamp.getAlgebraicType();\n },\n createTimeDurationType: function (): AlgebraicTypeType {\n return TimeDuration.getAlgebraicType();\n },\n serializeValue: function (\n writer: BinaryWriter,\n ty: AlgebraicTypeType,\n value: any,\n typespace?: Typespace\n ): void {\n if (ty.tag === 'Ref') {\n if (!typespace)\n throw new Error('cannot serialize refs without a typespace');\n while (ty.tag === 'Ref') ty = typespace.types[ty.value];\n }\n switch (ty.tag) {\n case 'Product':\n ProductType.serializeValue(writer, ty.value, value, typespace);\n break;\n case 'Sum':\n SumType.serializeValue(writer, ty.value, value, typespace);\n break;\n case 'Array':\n if (ty.value.tag === 'U8') {\n writer.writeUInt8Array(value);\n } else {\n const elemType = ty.value;\n writer.writeU32(value.length);\n for (const elem of value) {\n AlgebraicType.serializeValue(writer, elemType, elem, typespace);\n }\n }\n break;\n case 'Bool':\n writer.writeBool(value);\n break;\n case 'I8':\n writer.writeI8(value);\n break;\n case 'U8':\n writer.writeU8(value);\n break;\n case 'I16':\n writer.writeI16(value);\n break;\n case 'U16':\n writer.writeU16(value);\n break;\n case 'I32':\n writer.writeI32(value);\n break;\n case 'U32':\n writer.writeU32(value);\n break;\n case 'I64':\n writer.writeI64(value);\n break;\n case 'U64':\n writer.writeU64(value);\n break;\n case 'I128':\n writer.writeI128(value);\n break;\n case 'U128':\n writer.writeU128(value);\n break;\n case 'I256':\n writer.writeI256(value);\n break;\n case 'U256':\n writer.writeU256(value);\n break;\n case 'F32':\n writer.writeF32(value);\n break;\n case 'F64':\n writer.writeF64(value);\n break;\n case 'String':\n writer.writeString(value);\n break;\n }\n },\n deserializeValue: function (\n reader: BinaryReader,\n ty: AlgebraicTypeType,\n typespace?: Typespace\n ): any {\n if (ty.tag === 'Ref') {\n if (!typespace)\n throw new Error('cannot deserialize refs without a typespace');\n while (ty.tag === 'Ref') ty = typespace.types[ty.value];\n }\n switch (ty.tag) {\n case 'Product':\n return ProductType.deserializeValue(reader, ty.value, typespace);\n case 'Sum':\n return SumType.deserializeValue(reader, ty.value, typespace);\n case 'Array':\n if (ty.value.tag === 'U8') {\n return reader.readUInt8Array();\n } else {\n const elemType = ty.value;\n const length = reader.readU32();\n const result: any[] = [];\n for (let i = 0; i < length; i++) {\n result.push(\n AlgebraicType.deserializeValue(reader, elemType, typespace)\n );\n }\n return result;\n }\n case 'Bool':\n return reader.readBool();\n case 'I8':\n return reader.readI8();\n case 'U8':\n return reader.readU8();\n case 'I16':\n return reader.readI16();\n case 'U16':\n return reader.readU16();\n case 'I32':\n return reader.readI32();\n case 'U32':\n return reader.readU32();\n case 'I64':\n return reader.readI64();\n case 'U64':\n return reader.readU64();\n case 'I128':\n return reader.readI128();\n case 'U128':\n return reader.readU128();\n case 'I256':\n return reader.readI256();\n case 'U256':\n return reader.readU256();\n case 'F32':\n return reader.readF32();\n case 'F64':\n return reader.readF64();\n case 'String':\n return reader.readString();\n }\n },\n /**\n * Convert a value of the algebraic type into something that can be used as a key in a map.\n * There are no guarantees about being able to order it.\n * This is only guaranteed to be comparable to other values of the same type.\n * @param value A value of the algebraic type\n * @returns Something that can be used as a key in a map.\n */\n intoMapKey: function (\n ty: AlgebraicTypeType,\n value: any\n ): ComparablePrimitive {\n switch (ty.tag) {\n case 'U8':\n case 'U16':\n case 'U32':\n case 'U64':\n case 'U128':\n case 'U256':\n case 'I8':\n case 'I16':\n case 'I32':\n case 'I64':\n case 'I128':\n case 'I256':\n case 'F32':\n case 'F64':\n case 'String':\n case 'Bool':\n return value;\n case 'Product':\n return ProductType.intoMapKey(ty.value, value);\n default: {\n // The fallback is to serialize and base64 encode the bytes.\n const writer = new BinaryWriter(10);\n AlgebraicType.serializeValue(writer, ty, value);\n return writer.toBase64();\n }\n }\n },\n};\n\n/**\n * A structural product type of the factors given by `elements`.\n *\n * This is also known as `struct` and `tuple` in many languages,\n * but note that unlike most languages, products in SATs are *[structural]* and not nominal.\n * When checking whether two nominal types are the same,\n * their names and/or declaration sites (e.g., module / namespace) are considered.\n * Meanwhile, a structural type system would only check the structure of the type itself,\n * e.g., the names of its fields and their types in the case of a record.\n * The name \"product\" comes from category theory.\n *\n * See also: https://ncatlab.org/nlab/show/product+type.\n *\n * These structures are known as product types because the number of possible values in product\n * ```ignore\n * { N_0: T_0, N_1: T_1, ..., N_n: T_n }\n * ```\n * is:\n * ```ignore\n * Π (i ∈ 0..n). values(T_i)\n * ```\n * so for example, `values({ A: U64, B: Bool }) = values(U64) * values(Bool)`.\n *\n * [structural]: https://en.wikipedia.org/wiki/Structural_type_system\n */\nexport type ProductType = ProductTypeType;\n\nexport const ProductType: {\n serializeValue(\n writer: BinaryWriter,\n ty: ProductTypeType,\n value: any,\n typespace?: Typespace\n ): void;\n deserializeValue(\n reader: BinaryReader,\n ty: ProductTypeType,\n typespace?: Typespace\n ): any;\n intoMapKey(ty: ProductTypeType, value: any): ComparablePrimitive;\n} = {\n ...ProductTypeValue,\n serializeValue(\n writer: BinaryWriter,\n ty: ProductTypeType,\n value: any,\n typespace?: Typespace\n ): void {\n for (const element of ty.elements) {\n AlgebraicType.serializeValue(\n writer,\n element.algebraicType,\n value[element.name!],\n typespace\n );\n }\n },\n deserializeValue(\n reader: BinaryReader,\n ty: ProductTypeType,\n typespace?: Typespace\n ): any {\n const result: { [key: string]: any } = {};\n if (ty.elements.length === 1) {\n if (ty.elements[0].name === '__time_duration_micros__') {\n return new TimeDuration(reader.readI64());\n }\n\n if (ty.elements[0].name === '__timestamp_micros_since_unix_epoch__') {\n return new Timestamp(reader.readI64());\n }\n\n if (ty.elements[0].name === '__identity__') {\n return new Identity(reader.readU256());\n }\n\n if (ty.elements[0].name === '__connection_id__') {\n return new ConnectionId(reader.readU128());\n }\n }\n\n for (const element of ty.elements) {\n result[element.name!] = AlgebraicType.deserializeValue(\n reader,\n element.algebraicType,\n typespace\n );\n }\n return result;\n },\n intoMapKey(ty: ProductTypeType, value: any): ComparablePrimitive {\n if (ty.elements.length === 1) {\n if (ty.elements[0].name === '__time_duration_micros__') {\n return (value as TimeDuration).__time_duration_micros__;\n }\n\n if (ty.elements[0].name === '__timestamp_micros_since_unix_epoch__') {\n return (value as Timestamp).__timestamp_micros_since_unix_epoch__;\n }\n\n if (ty.elements[0].name === '__identity__') {\n return (value as Identity).__identity__;\n }\n\n if (ty.elements[0].name === '__connection_id__') {\n return (value as ConnectionId).__connection_id__;\n }\n }\n // The fallback is to serialize and base64 encode the bytes.\n const writer = new BinaryWriter(10);\n AlgebraicType.serializeValue(writer, AlgebraicType.Product(ty), value);\n return writer.toBase64();\n },\n};\n\nexport type SumType = SumTypeType;\n\n/**\n * Unlike most languages, sums in SATS are *[structural]* and not nominal.\n * When checking whether two nominal types are the same,\n * their names and/or declaration sites (e.g., module / namespace) are considered.\n * Meanwhile, a structural type system would only check the structure of the type itself,\n * e.g., the names of its variants and their inner data types in the case of a sum.\n *\n * This is also known as a discriminated union (implementation) or disjoint union.\n * Another name is [coproduct (category theory)](https://ncatlab.org/nlab/show/coproduct).\n *\n * These structures are known as sum types because the number of possible values a sum\n * ```ignore\n * { N_0(T_0), N_1(T_1), ..., N_n(T_n) }\n * ```\n * is:\n * ```ignore\n * Σ (i ∈ 0..n). values(T_i)\n * ```\n * so for example, `values({ A(U64), B(Bool) }) = values(U64) + values(Bool)`.\n *\n * See also: https://ncatlab.org/nlab/show/sum+type.\n *\n * [structural]: https://en.wikipedia.org/wiki/Structural_type_system\n */\nexport const SumType: {\n serializeValue(\n writer: BinaryWriter,\n ty: SumTypeType,\n value: any,\n typespace?: Typespace\n ): void;\n deserializeValue(\n reader: BinaryReader,\n ty: SumTypeType,\n typespace?: Typespace\n ): any;\n} = {\n ...SumTypeValue,\n serializeValue: function (\n writer: BinaryWriter,\n ty: SumTypeType,\n value: any,\n typespace?: Typespace\n ): void {\n if (\n ty.variants.length == 2 &&\n ty.variants[0].name === 'some' &&\n ty.variants[1].name === 'none'\n ) {\n if (value !== null && value !== undefined) {\n writer.writeByte(0);\n AlgebraicType.serializeValue(\n writer,\n ty.variants[0].algebraicType,\n value,\n typespace\n );\n } else {\n writer.writeByte(1);\n }\n } else {\n const variant = value['tag'];\n const index = ty.variants.findIndex(v => v.name === variant);\n if (index < 0) {\n throw `Can't serialize a sum type, couldn't find ${value.tag} tag`;\n }\n writer.writeU8(index);\n AlgebraicType.serializeValue(\n writer,\n ty.variants[index].algebraicType,\n value['value'],\n typespace\n );\n }\n },\n deserializeValue: function (\n reader: BinaryReader,\n ty: SumTypeType,\n typespace?: Typespace\n ): any {\n const tag = reader.readU8();\n // In TypeScript we handle Option values as a special case\n // we don't represent the some and none variants, but instead\n // we represent the value directly.\n if (\n ty.variants.length == 2 &&\n ty.variants[0].name === 'some' &&\n ty.variants[1].name === 'none'\n ) {\n if (tag === 0) {\n return AlgebraicType.deserializeValue(\n reader,\n ty.variants[0].algebraicType,\n typespace\n );\n } else if (tag === 1) {\n return undefined;\n } else {\n throw `Can't deserialize an option type, couldn't find ${tag} tag`;\n }\n } else {\n const variant = ty.variants[tag];\n const value = AlgebraicType.deserializeValue(\n reader,\n variant.algebraicType,\n typespace\n );\n return { tag: variant.name, value };\n }\n },\n};\n\nexport type ComparablePrimitive = number | string | boolean | bigint;\n","import { AlgebraicType } from './algebraic_type';\nimport { hexStringToU128, u128ToHexString, u128ToUint8Array } from './utils';\n\nexport type ConnectionIdAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [{ name: '__connection_id__'; algebraicType: { tag: 'U128' } }];\n };\n};\n\n/**\n * A unique identifier for a client connected to a database.\n */\nexport class ConnectionId {\n __connection_id__: bigint;\n\n /**\n * Creates a new `ConnectionId`.\n */\n constructor(data: bigint) {\n this.__connection_id__ = data;\n }\n\n /**\n * Get the algebraic type representation of the {@link ConnectionId} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): ConnectionIdAlgebraicType {\n return AlgebraicType.Product({\n elements: [\n { name: '__connection_id__', algebraicType: AlgebraicType.U128 },\n ],\n });\n }\n\n isZero(): boolean {\n return this.__connection_id__ === BigInt(0);\n }\n\n static nullIfZero(addr: ConnectionId): ConnectionId | null {\n if (addr.isZero()) {\n return null;\n } else {\n return addr;\n }\n }\n\n static random(): ConnectionId {\n function randomU8(): number {\n return Math.floor(Math.random() * 0xff);\n }\n let result = BigInt(0);\n for (let i = 0; i < 16; i++) {\n result = (result << BigInt(8)) | BigInt(randomU8());\n }\n return new ConnectionId(result);\n }\n\n /**\n * Compare two connection IDs for equality.\n */\n isEqual(other: ConnectionId): boolean {\n return this.__connection_id__ == other.__connection_id__;\n }\n\n /**\n * Print the connection ID as a hexadecimal string.\n */\n toHexString(): string {\n return u128ToHexString(this.__connection_id__);\n }\n\n /**\n * Convert the connection ID to a Uint8Array.\n */\n toUint8Array(): Uint8Array {\n return u128ToUint8Array(this.__connection_id__);\n }\n\n /**\n * Parse a connection ID from a hexadecimal string.\n */\n static fromString(str: string): ConnectionId {\n return new ConnectionId(hexStringToU128(str));\n }\n\n static fromStringOrNull(str: string): ConnectionId | null {\n const addr = ConnectionId.fromString(str);\n if (addr.isZero()) {\n return null;\n } else {\n return addr;\n }\n }\n}\n","import BinaryReader from './binary_reader';\n\nexport interface ParseableType<T> {\n deserialize: (reader: BinaryReader) => T;\n}\n\nexport function parseValue<T>(ty: ParseableType<T>, src: Uint8Array): T {\n const reader = new BinaryReader(src);\n return ty.deserialize(reader);\n}\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport * as RowSizeHintVariants from './row_size_hint_variants';\n\n// The tagged union or sum type for the algebraic type `RowSizeHint`.\nexport type RowSizeHint =\n | RowSizeHintVariants.FixedSize\n | RowSizeHintVariants.RowOffsets;\n\nlet _cached_RowSizeHint_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const RowSizeHint = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n FixedSize: (value: number): RowSizeHintVariants.FixedSize => ({\n tag: 'FixedSize',\n value,\n }),\n RowOffsets: (value: bigint[]): RowSizeHintVariants.RowOffsets => ({\n tag: 'RowOffsets',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_RowSizeHint_type_value) return _cached_RowSizeHint_type_value;\n _cached_RowSizeHint_type_value = __AlgebraicTypeValue.Sum({ variants: [] });\n _cached_RowSizeHint_type_value.value.variants.push(\n { name: 'FixedSize', algebraicType: __AlgebraicTypeValue.U16 },\n {\n name: 'RowOffsets',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U64),\n }\n );\n return _cached_RowSizeHint_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: RowSizeHint): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n RowSizeHint.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): RowSizeHint {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n RowSizeHint.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default RowSizeHint;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { RowSizeHint } from './row_size_hint_type';\n// Mark import as potentially unused\ndeclare type __keep_RowSizeHint = RowSizeHint;\n\nexport type BsatnRowList = {\n sizeHint: RowSizeHint;\n rowsData: Uint8Array;\n};\nlet _cached_BsatnRowList_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const BsatnRowList = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_BsatnRowList_type_value) return _cached_BsatnRowList_type_value;\n _cached_BsatnRowList_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_BsatnRowList_type_value.value.elements.push(\n {\n name: 'sizeHint',\n algebraicType: RowSizeHint.getTypeScriptAlgebraicType(),\n },\n {\n name: 'rowsData',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n }\n );\n return _cached_BsatnRowList_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: BsatnRowList): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n BsatnRowList.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): BsatnRowList {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n BsatnRowList.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default BsatnRowList;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type CallReducer = {\n reducer: string;\n args: Uint8Array;\n requestId: number;\n flags: number;\n};\nlet _cached_CallReducer_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const CallReducer = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_CallReducer_type_value) return _cached_CallReducer_type_value;\n _cached_CallReducer_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_CallReducer_type_value.value.elements.push(\n { name: 'reducer', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'args',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'flags', algebraicType: __AlgebraicTypeValue.U8 }\n );\n return _cached_CallReducer_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: CallReducer): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n CallReducer.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): CallReducer {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n CallReducer.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default CallReducer;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type Subscribe = {\n queryStrings: string[];\n requestId: number;\n};\nlet _cached_Subscribe_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const Subscribe = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_Subscribe_type_value) return _cached_Subscribe_type_value;\n _cached_Subscribe_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_Subscribe_type_value.value.elements.push(\n {\n name: 'queryStrings',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.String),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 }\n );\n return _cached_Subscribe_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: Subscribe): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n Subscribe.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): Subscribe {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n Subscribe.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default Subscribe;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type OneOffQuery = {\n messageId: Uint8Array;\n queryString: string;\n};\nlet _cached_OneOffQuery_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const OneOffQuery = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_OneOffQuery_type_value) return _cached_OneOffQuery_type_value;\n _cached_OneOffQuery_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_OneOffQuery_type_value.value.elements.push(\n {\n name: 'messageId',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n { name: 'queryString', algebraicType: __AlgebraicTypeValue.String }\n );\n return _cached_OneOffQuery_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: OneOffQuery): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n OneOffQuery.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): OneOffQuery {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n OneOffQuery.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default OneOffQuery;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type QueryId = {\n id: number;\n};\nlet _cached_QueryId_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const QueryId = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_QueryId_type_value) return _cached_QueryId_type_value;\n _cached_QueryId_type_value = __AlgebraicTypeValue.Product({ elements: [] });\n _cached_QueryId_type_value.value.elements.push({\n name: 'id',\n algebraicType: __AlgebraicTypeValue.U32,\n });\n return _cached_QueryId_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: QueryId): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n QueryId.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): QueryId {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n QueryId.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default QueryId;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type SubscribeSingle = {\n query: string;\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_SubscribeSingle_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeSingle = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeSingle_type_value)\n return _cached_SubscribeSingle_type_value;\n _cached_SubscribeSingle_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeSingle_type_value.value.elements.push(\n { name: 'query', algebraicType: __AlgebraicTypeValue.String },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_SubscribeSingle_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeSingle): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeSingle.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeSingle {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeSingle.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeSingle;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type SubscribeMulti = {\n queryStrings: string[];\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_SubscribeMulti_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeMulti = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeMulti_type_value)\n return _cached_SubscribeMulti_type_value;\n _cached_SubscribeMulti_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeMulti_type_value.value.elements.push(\n {\n name: 'queryStrings',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.String),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_SubscribeMulti_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeMulti): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeMulti.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeMulti {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeMulti.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeMulti;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type Unsubscribe = {\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_Unsubscribe_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const Unsubscribe = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_Unsubscribe_type_value) return _cached_Unsubscribe_type_value;\n _cached_Unsubscribe_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_Unsubscribe_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_Unsubscribe_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: Unsubscribe): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n Unsubscribe.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): Unsubscribe {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n Unsubscribe.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default Unsubscribe;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type UnsubscribeMulti = {\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_UnsubscribeMulti_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const UnsubscribeMulti = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UnsubscribeMulti_type_value)\n return _cached_UnsubscribeMulti_type_value;\n _cached_UnsubscribeMulti_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_UnsubscribeMulti_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_UnsubscribeMulti_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UnsubscribeMulti): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UnsubscribeMulti.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UnsubscribeMulti {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UnsubscribeMulti.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UnsubscribeMulti;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { CallReducer } from './call_reducer_type';\n// Mark import as potentially unused\ndeclare type __keep_CallReducer = CallReducer;\nimport { Subscribe } from './subscribe_type';\n// Mark import as potentially unused\ndeclare type __keep_Subscribe = Subscribe;\nimport { OneOffQuery } from './one_off_query_type';\n// Mark import as potentially unused\ndeclare type __keep_OneOffQuery = OneOffQuery;\nimport { SubscribeSingle } from './subscribe_single_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeSingle = SubscribeSingle;\nimport { SubscribeMulti } from './subscribe_multi_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeMulti = SubscribeMulti;\nimport { Unsubscribe } from './unsubscribe_type';\n// Mark import as potentially unused\ndeclare type __keep_Unsubscribe = Unsubscribe;\nimport { UnsubscribeMulti } from './unsubscribe_multi_type';\n// Mark import as potentially unused\ndeclare type __keep_UnsubscribeMulti = UnsubscribeMulti;\n\nimport * as ClientMessageVariants from './client_message_variants';\n\n// The tagged union or sum type for the algebraic type `ClientMessage`.\nexport type ClientMessage =\n | ClientMessageVariants.CallReducer\n | ClientMessageVariants.Subscribe\n | ClientMessageVariants.OneOffQuery\n | ClientMessageVariants.SubscribeSingle\n | ClientMessageVariants.SubscribeMulti\n | ClientMessageVariants.Unsubscribe\n | ClientMessageVariants.UnsubscribeMulti;\n\nlet _cached_ClientMessage_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const ClientMessage = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n CallReducer: (value: CallReducer): ClientMessageVariants.CallReducer => ({\n tag: 'CallReducer',\n value,\n }),\n Subscribe: (value: Subscribe): ClientMessageVariants.Subscribe => ({\n tag: 'Subscribe',\n value,\n }),\n OneOffQuery: (value: OneOffQuery): ClientMessageVariants.OneOffQuery => ({\n tag: 'OneOffQuery',\n value,\n }),\n SubscribeSingle: (\n value: SubscribeSingle\n ): ClientMessageVariants.SubscribeSingle => ({\n tag: 'SubscribeSingle',\n value,\n }),\n SubscribeMulti: (\n value: SubscribeMulti\n ): ClientMessageVariants.SubscribeMulti => ({ tag: 'SubscribeMulti', value }),\n Unsubscribe: (value: Unsubscribe): ClientMessageVariants.Unsubscribe => ({\n tag: 'Unsubscribe',\n value,\n }),\n UnsubscribeMulti: (\n value: UnsubscribeMulti\n ): ClientMessageVariants.UnsubscribeMulti => ({\n tag: 'UnsubscribeMulti',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ClientMessage_type_value)\n return _cached_ClientMessage_type_value;\n _cached_ClientMessage_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_ClientMessage_type_value.value.variants.push(\n {\n name: 'CallReducer',\n algebraicType: CallReducer.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Subscribe',\n algebraicType: Subscribe.getTypeScriptAlgebraicType(),\n },\n {\n name: 'OneOffQuery',\n algebraicType: OneOffQuery.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeSingle',\n algebraicType: SubscribeSingle.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeMulti',\n algebraicType: SubscribeMulti.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Unsubscribe',\n algebraicType: Unsubscribe.getTypeScriptAlgebraicType(),\n },\n {\n name: 'UnsubscribeMulti',\n algebraicType: UnsubscribeMulti.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_ClientMessage_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ClientMessage): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ClientMessage.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ClientMessage {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ClientMessage.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ClientMessage;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { BsatnRowList } from './bsatn_row_list_type';\n// Mark import as potentially unused\ndeclare type __keep_BsatnRowList = BsatnRowList;\n\nexport type QueryUpdate = {\n deletes: BsatnRowList;\n inserts: BsatnRowList;\n};\nlet _cached_QueryUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const QueryUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_QueryUpdate_type_value) return _cached_QueryUpdate_type_value;\n _cached_QueryUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_QueryUpdate_type_value.value.elements.push(\n {\n name: 'deletes',\n algebraicType: BsatnRowList.getTypeScriptAlgebraicType(),\n },\n {\n name: 'inserts',\n algebraicType: BsatnRowList.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_QueryUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: QueryUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n QueryUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): QueryUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n QueryUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default QueryUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryUpdate } from './query_update_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryUpdate = QueryUpdate;\n\nimport * as CompressableQueryUpdateVariants from './compressable_query_update_variants';\n\n// The tagged union or sum type for the algebraic type `CompressableQueryUpdate`.\nexport type CompressableQueryUpdate =\n | CompressableQueryUpdateVariants.Uncompressed\n | CompressableQueryUpdateVariants.Brotli\n | CompressableQueryUpdateVariants.Gzip;\n\nlet _cached_CompressableQueryUpdate_type_value: __AlgebraicTypeType | null =\n null;\n\n// A value with helper functions to construct the type.\nexport const CompressableQueryUpdate = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n Uncompressed: (\n value: QueryUpdate\n ): CompressableQueryUpdateVariants.Uncompressed => ({\n tag: 'Uncompressed',\n value,\n }),\n Brotli: (value: Uint8Array): CompressableQueryUpdateVariants.Brotli => ({\n tag: 'Brotli',\n value,\n }),\n Gzip: (value: Uint8Array): CompressableQueryUpdateVariants.Gzip => ({\n tag: 'Gzip',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_CompressableQueryUpdate_type_value)\n return _cached_CompressableQueryUpdate_type_value;\n _cached_CompressableQueryUpdate_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_CompressableQueryUpdate_type_value.value.variants.push(\n {\n name: 'Uncompressed',\n algebraicType: QueryUpdate.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Brotli',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n {\n name: 'Gzip',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n }\n );\n return _cached_CompressableQueryUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: CompressableQueryUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n CompressableQueryUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): CompressableQueryUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n CompressableQueryUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default CompressableQueryUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { CompressableQueryUpdate } from './compressable_query_update_type';\n// Mark import as potentially unused\ndeclare type __keep_CompressableQueryUpdate = CompressableQueryUpdate;\n\nexport type TableUpdate = {\n tableId: number;\n tableName: string;\n numRows: bigint;\n updates: CompressableQueryUpdate[];\n};\nlet _cached_TableUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const TableUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_TableUpdate_type_value) return _cached_TableUpdate_type_value;\n _cached_TableUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_TableUpdate_type_value.value.elements.push(\n { name: 'tableId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'tableName', algebraicType: __AlgebraicTypeValue.String },\n { name: 'numRows', algebraicType: __AlgebraicTypeValue.U64 },\n {\n name: 'updates',\n algebraicType: __AlgebraicTypeValue.Array(\n CompressableQueryUpdate.getTypeScriptAlgebraicType()\n ),\n }\n );\n return _cached_TableUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: TableUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n TableUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): TableUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n TableUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default TableUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { TableUpdate } from './table_update_type';\n// Mark import as potentially unused\ndeclare type __keep_TableUpdate = TableUpdate;\n\nexport type DatabaseUpdate = {\n tables: TableUpdate[];\n};\nlet _cached_DatabaseUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const DatabaseUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_DatabaseUpdate_type_value)\n return _cached_DatabaseUpdate_type_value;\n _cached_DatabaseUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_DatabaseUpdate_type_value.value.elements.push({\n name: 'tables',\n algebraicType: __AlgebraicTypeValue.Array(\n TableUpdate.getTypeScriptAlgebraicType()\n ),\n });\n return _cached_DatabaseUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: DatabaseUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n DatabaseUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): DatabaseUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n DatabaseUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default DatabaseUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type InitialSubscription = {\n databaseUpdate: DatabaseUpdate;\n requestId: number;\n totalHostExecutionDuration: __TimeDuration;\n};\nlet _cached_InitialSubscription_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const InitialSubscription = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_InitialSubscription_type_value)\n return _cached_InitialSubscription_type_value;\n _cached_InitialSubscription_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_InitialSubscription_type_value.value.elements.push(\n {\n name: 'databaseUpdate',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDuration',\n algebraicType: __AlgebraicTypeValue.createTimeDurationType(),\n }\n );\n return _cached_InitialSubscription_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: InitialSubscription): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n InitialSubscription.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): InitialSubscription {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n InitialSubscription.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default InitialSubscription;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nimport * as UpdateStatusVariants from './update_status_variants';\n\n// The tagged union or sum type for the algebraic type `UpdateStatus`.\nexport type UpdateStatus =\n | UpdateStatusVariants.Committed\n | UpdateStatusVariants.Failed\n | UpdateStatusVariants.OutOfEnergy;\n\nlet _cached_UpdateStatus_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const UpdateStatus = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n Committed: (value: DatabaseUpdate): UpdateStatusVariants.Committed => ({\n tag: 'Committed',\n value,\n }),\n Failed: (value: string): UpdateStatusVariants.Failed => ({\n tag: 'Failed',\n value,\n }),\n OutOfEnergy: { tag: 'OutOfEnergy' } as const,\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UpdateStatus_type_value) return _cached_UpdateStatus_type_value;\n _cached_UpdateStatus_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_UpdateStatus_type_value.value.variants.push(\n {\n name: 'Committed',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n },\n { name: 'Failed', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'OutOfEnergy',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n }\n );\n return _cached_UpdateStatus_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UpdateStatus): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UpdateStatus.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UpdateStatus {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UpdateStatus.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UpdateStatus;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type ReducerCallInfo = {\n reducerName: string;\n reducerId: number;\n args: Uint8Array;\n requestId: number;\n};\nlet _cached_ReducerCallInfo_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const ReducerCallInfo = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ReducerCallInfo_type_value)\n return _cached_ReducerCallInfo_type_value;\n _cached_ReducerCallInfo_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_ReducerCallInfo_type_value.value.elements.push(\n { name: 'reducerName', algebraicType: __AlgebraicTypeValue.String },\n { name: 'reducerId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'args',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 }\n );\n return _cached_ReducerCallInfo_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ReducerCallInfo): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ReducerCallInfo.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ReducerCallInfo {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ReducerCallInfo.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ReducerCallInfo;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type EnergyQuanta = {\n quanta: bigint;\n};\nlet _cached_EnergyQuanta_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const EnergyQuanta = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_EnergyQuanta_type_value) return _cached_EnergyQuanta_type_value;\n _cached_EnergyQuanta_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_EnergyQuanta_type_value.value.elements.push({\n name: 'quanta',\n algebraicType: __AlgebraicTypeValue.U128,\n });\n return _cached_EnergyQuanta_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: EnergyQuanta): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n EnergyQuanta.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): EnergyQuanta {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n EnergyQuanta.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default EnergyQuanta;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { UpdateStatus } from './update_status_type';\n// Mark import as potentially unused\ndeclare type __keep_UpdateStatus = UpdateStatus;\nimport { ReducerCallInfo } from './reducer_call_info_type';\n// Mark import as potentially unused\ndeclare type __keep_ReducerCallInfo = ReducerCallInfo;\nimport { EnergyQuanta } from './energy_quanta_type';\n// Mark import as potentially unused\ndeclare type __keep_EnergyQuanta = EnergyQuanta;\n\nexport type TransactionUpdate = {\n status: UpdateStatus;\n timestamp: __Timestamp;\n callerIdentity: __Identity;\n callerConnectionId: __ConnectionId;\n reducerCall: ReducerCallInfo;\n energyQuantaUsed: EnergyQuanta;\n totalHostExecutionDuration: __TimeDuration;\n};\nlet _cached_TransactionUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const TransactionUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_TransactionUpdate_type_value)\n return _cached_TransactionUpdate_type_value;\n _cached_TransactionUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_TransactionUpdate_type_value.value.elements.push(\n {\n name: 'status',\n algebraicType: UpdateStatus.getTypeScriptAlgebraicType(),\n },\n {\n name: 'timestamp',\n algebraicType: __AlgebraicTypeValue.createTimestampType(),\n },\n {\n name: 'callerIdentity',\n algebraicType: __AlgebraicTypeValue.createIdentityType(),\n },\n {\n name: 'callerConnectionId',\n algebraicType: __AlgebraicTypeValue.createConnectionIdType(),\n },\n {\n name: 'reducerCall',\n algebraicType: ReducerCallInfo.getTypeScriptAlgebraicType(),\n },\n {\n name: 'energyQuantaUsed',\n algebraicType: EnergyQuanta.getTypeScriptAlgebraicType(),\n },\n {\n name: 'totalHostExecutionDuration',\n algebraicType: __AlgebraicTypeValue.createTimeDurationType(),\n }\n );\n return _cached_TransactionUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: TransactionUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n TransactionUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): TransactionUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n TransactionUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default TransactionUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type TransactionUpdateLight = {\n requestId: number;\n update: DatabaseUpdate;\n};\nlet _cached_TransactionUpdateLight_type_value: __AlgebraicTypeType | null =\n null;\n\n/**\n * An object for generated helper functions.\n */\nexport const TransactionUpdateLight = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_TransactionUpdateLight_type_value)\n return _cached_TransactionUpdateLight_type_value;\n _cached_TransactionUpdateLight_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_TransactionUpdateLight_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'update',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_TransactionUpdateLight_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: TransactionUpdateLight): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n TransactionUpdateLight.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): TransactionUpdateLight {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n TransactionUpdateLight.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default TransactionUpdateLight;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type IdentityToken = {\n identity: __Identity;\n token: string;\n connectionId: __ConnectionId;\n};\nlet _cached_IdentityToken_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const IdentityToken = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_IdentityToken_type_value)\n return _cached_IdentityToken_type_value;\n _cached_IdentityToken_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_IdentityToken_type_value.value.elements.push(\n {\n name: 'identity',\n algebraicType: __AlgebraicTypeValue.createIdentityType(),\n },\n { name: 'token', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'connectionId',\n algebraicType: __AlgebraicTypeValue.createConnectionIdType(),\n }\n );\n return _cached_IdentityToken_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: IdentityToken): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n IdentityToken.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): IdentityToken {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n IdentityToken.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default IdentityToken;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { BsatnRowList } from './bsatn_row_list_type';\n// Mark import as potentially unused\ndeclare type __keep_BsatnRowList = BsatnRowList;\n\nexport type OneOffTable = {\n tableName: string;\n rows: BsatnRowList;\n};\nlet _cached_OneOffTable_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const OneOffTable = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_OneOffTable_type_value) return _cached_OneOffTable_type_value;\n _cached_OneOffTable_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_OneOffTable_type_value.value.elements.push(\n { name: 'tableName', algebraicType: __AlgebraicTypeValue.String },\n { name: 'rows', algebraicType: BsatnRowList.getTypeScriptAlgebraicType() }\n );\n return _cached_OneOffTable_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: OneOffTable): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n OneOffTable.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): OneOffTable {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n OneOffTable.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default OneOffTable;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { OneOffTable } from './one_off_table_type';\n// Mark import as potentially unused\ndeclare type __keep_OneOffTable = OneOffTable;\n\nexport type OneOffQueryResponse = {\n messageId: Uint8Array;\n error: string | undefined;\n tables: OneOffTable[];\n totalHostExecutionDuration: __TimeDuration;\n};\nlet _cached_OneOffQueryResponse_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const OneOffQueryResponse = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_OneOffQueryResponse_type_value)\n return _cached_OneOffQueryResponse_type_value;\n _cached_OneOffQueryResponse_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_OneOffQueryResponse_type_value.value.elements.push(\n {\n name: 'messageId',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n {\n name: 'error',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.String\n ),\n },\n {\n name: 'tables',\n algebraicType: __AlgebraicTypeValue.Array(\n OneOffTable.getTypeScriptAlgebraicType()\n ),\n },\n {\n name: 'totalHostExecutionDuration',\n algebraicType: __AlgebraicTypeValue.createTimeDurationType(),\n }\n );\n return _cached_OneOffQueryResponse_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: OneOffQueryResponse): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n OneOffQueryResponse.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): OneOffQueryResponse {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n OneOffQueryResponse.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default OneOffQueryResponse;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { TableUpdate } from './table_update_type';\n// Mark import as potentially unused\ndeclare type __keep_TableUpdate = TableUpdate;\n\nexport type SubscribeRows = {\n tableId: number;\n tableName: string;\n tableRows: TableUpdate;\n};\nlet _cached_SubscribeRows_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeRows = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeRows_type_value)\n return _cached_SubscribeRows_type_value;\n _cached_SubscribeRows_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeRows_type_value.value.elements.push(\n { name: 'tableId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'tableName', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'tableRows',\n algebraicType: TableUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SubscribeRows_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeRows): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeRows.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeRows {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeRows.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeRows;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { SubscribeRows } from './subscribe_rows_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeRows = SubscribeRows;\n\nexport type SubscribeApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n rows: SubscribeRows;\n};\nlet _cached_SubscribeApplied_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeApplied_type_value)\n return _cached_SubscribeApplied_type_value;\n _cached_SubscribeApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'rows',\n algebraicType: SubscribeRows.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SubscribeApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { SubscribeRows } from './subscribe_rows_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeRows = SubscribeRows;\n\nexport type UnsubscribeApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n rows: SubscribeRows;\n};\nlet _cached_UnsubscribeApplied_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const UnsubscribeApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UnsubscribeApplied_type_value)\n return _cached_UnsubscribeApplied_type_value;\n _cached_UnsubscribeApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_UnsubscribeApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'rows',\n algebraicType: SubscribeRows.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_UnsubscribeApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UnsubscribeApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UnsubscribeApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UnsubscribeApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UnsubscribeApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UnsubscribeApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type SubscriptionError = {\n totalHostExecutionDurationMicros: bigint;\n requestId: number | undefined;\n queryId: number | undefined;\n tableId: number | undefined;\n error: string;\n};\nlet _cached_SubscriptionError_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscriptionError = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscriptionError_type_value)\n return _cached_SubscriptionError_type_value;\n _cached_SubscriptionError_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscriptionError_type_value.value.elements.push(\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n {\n name: 'requestId',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.U32\n ),\n },\n {\n name: 'queryId',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.U32\n ),\n },\n {\n name: 'tableId',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.U32\n ),\n },\n { name: 'error', algebraicType: __AlgebraicTypeValue.String }\n );\n return _cached_SubscriptionError_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscriptionError): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscriptionError.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscriptionError {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscriptionError.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscriptionError;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type SubscribeMultiApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n update: DatabaseUpdate;\n};\nlet _cached_SubscribeMultiApplied_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeMultiApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeMultiApplied_type_value)\n return _cached_SubscribeMultiApplied_type_value;\n _cached_SubscribeMultiApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeMultiApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'update',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SubscribeMultiApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeMultiApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeMultiApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeMultiApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeMultiApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeMultiApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type UnsubscribeMultiApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n update: DatabaseUpdate;\n};\nlet _cached_UnsubscribeMultiApplied_type_value: __AlgebraicTypeType | null =\n null;\n\n/**\n * An object for generated helper functions.\n */\nexport const UnsubscribeMultiApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UnsubscribeMultiApplied_type_value)\n return _cached_UnsubscribeMultiApplied_type_value;\n _cached_UnsubscribeMultiApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_UnsubscribeMultiApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'update',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_UnsubscribeMultiApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UnsubscribeMultiApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UnsubscribeMultiApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UnsubscribeMultiApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UnsubscribeMultiApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UnsubscribeMultiApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { InitialSubscription } from './initial_subscription_type';\n// Mark import as potentially unused\ndeclare type __keep_InitialSubscription = InitialSubscription;\nimport { TransactionUpdate } from './transaction_update_type';\n// Mark import as potentially unused\ndeclare type __keep_TransactionUpdate = TransactionUpdate;\nimport { TransactionUpdateLight } from './transaction_update_light_type';\n// Mark import as potentially unused\ndeclare type __keep_TransactionUpdateLight = TransactionUpdateLight;\nimport { IdentityToken } from './identity_token_type';\n// Mark import as potentially unused\ndeclare type __keep_IdentityToken = IdentityToken;\nimport { OneOffQueryResponse } from './one_off_query_response_type';\n// Mark import as potentially unused\ndeclare type __keep_OneOffQueryResponse = OneOffQueryResponse;\nimport { SubscribeApplied } from './subscribe_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeApplied = SubscribeApplied;\nimport { UnsubscribeApplied } from './unsubscribe_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_UnsubscribeApplied = UnsubscribeApplied;\nimport { SubscriptionError } from './subscription_error_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscriptionError = SubscriptionError;\nimport { SubscribeMultiApplied } from './subscribe_multi_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeMultiApplied = SubscribeMultiApplied;\nimport { UnsubscribeMultiApplied } from './unsubscribe_multi_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_UnsubscribeMultiApplied = UnsubscribeMultiApplied;\n\nimport * as ServerMessageVariants from './server_message_variants';\n\n// The tagged union or sum type for the algebraic type `ServerMessage`.\nexport type ServerMessage =\n | ServerMessageVariants.InitialSubscription\n | ServerMessageVariants.TransactionUpdate\n | ServerMessageVariants.TransactionUpdateLight\n | ServerMessageVariants.IdentityToken\n | ServerMessageVariants.OneOffQueryResponse\n | ServerMessageVariants.SubscribeApplied\n | ServerMessageVariants.UnsubscribeApplied\n | ServerMessageVariants.SubscriptionError\n | ServerMessageVariants.SubscribeMultiApplied\n | ServerMessageVariants.UnsubscribeMultiApplied;\n\nlet _cached_ServerMessage_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const ServerMessage = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n InitialSubscription: (\n value: InitialSubscription\n ): ServerMessageVariants.InitialSubscription => ({\n tag: 'InitialSubscription',\n value,\n }),\n TransactionUpdate: (\n value: TransactionUpdate\n ): ServerMessageVariants.TransactionUpdate => ({\n tag: 'TransactionUpdate',\n value,\n }),\n TransactionUpdateLight: (\n value: TransactionUpdateLight\n ): ServerMessageVariants.TransactionUpdateLight => ({\n tag: 'TransactionUpdateLight',\n value,\n }),\n IdentityToken: (\n value: IdentityToken\n ): ServerMessageVariants.IdentityToken => ({ tag: 'IdentityToken', value }),\n OneOffQueryResponse: (\n value: OneOffQueryResponse\n ): ServerMessageVariants.OneOffQueryResponse => ({\n tag: 'OneOffQueryResponse',\n value,\n }),\n SubscribeApplied: (\n value: SubscribeApplied\n ): ServerMessageVariants.SubscribeApplied => ({\n tag: 'SubscribeApplied',\n value,\n }),\n UnsubscribeApplied: (\n value: UnsubscribeApplied\n ): ServerMessageVariants.UnsubscribeApplied => ({\n tag: 'UnsubscribeApplied',\n value,\n }),\n SubscriptionError: (\n value: SubscriptionError\n ): ServerMessageVariants.SubscriptionError => ({\n tag: 'SubscriptionError',\n value,\n }),\n SubscribeMultiApplied: (\n value: SubscribeMultiApplied\n ): ServerMessageVariants.SubscribeMultiApplied => ({\n tag: 'SubscribeMultiApplied',\n value,\n }),\n UnsubscribeMultiApplied: (\n value: UnsubscribeMultiApplied\n ): ServerMessageVariants.UnsubscribeMultiApplied => ({\n tag: 'UnsubscribeMultiApplied',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ServerMessage_type_value)\n return _cached_ServerMessage_type_value;\n _cached_ServerMessage_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_ServerMessage_type_value.value.variants.push(\n {\n name: 'InitialSubscription',\n algebraicType: InitialSubscription.getTypeScriptAlgebraicType(),\n },\n {\n name: 'TransactionUpdate',\n algebraicType: TransactionUpdate.getTypeScriptAlgebraicType(),\n },\n {\n name: 'TransactionUpdateLight',\n algebraicType: TransactionUpdateLight.getTypeScriptAlgebraicType(),\n },\n {\n name: 'IdentityToken',\n algebraicType: IdentityToken.getTypeScriptAlgebraicType(),\n },\n {\n name: 'OneOffQueryResponse',\n algebraicType: OneOffQueryResponse.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeApplied',\n algebraicType: SubscribeApplied.getTypeScriptAlgebraicType(),\n },\n {\n name: 'UnsubscribeApplied',\n algebraicType: UnsubscribeApplied.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscriptionError',\n algebraicType: SubscriptionError.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeMultiApplied',\n algebraicType: SubscribeMultiApplied.getTypeScriptAlgebraicType(),\n },\n {\n name: 'UnsubscribeMultiApplied',\n algebraicType: UnsubscribeMultiApplied.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_ServerMessage_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ServerMessage): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ServerMessage.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ServerMessage {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ServerMessage.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ServerMessage;\n","// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport class EventEmitter<Key, Callback extends Function = Function> {\n #events: Map<Key, Set<Callback>> = new Map();\n\n on(event: Key, callback: Callback): void {\n let callbacks = this.#events.get(event);\n if (!callbacks) {\n callbacks = new Set();\n this.#events.set(event, callbacks);\n }\n callbacks.add(callback);\n }\n\n off(event: Key, callback: Callback): void {\n const callbacks = this.#events.get(event);\n if (!callbacks) {\n return;\n }\n callbacks.delete(callback);\n }\n\n emit(event: Key, ...args: any[]): void {\n const callbacks = this.#events.get(event);\n if (!callbacks) {\n return;\n }\n\n for (const callback of callbacks) {\n callback(...args);\n }\n }\n}\n","type LogLevel = 'info' | 'warn' | 'error' | 'debug';\n\nconst LogLevelIdentifierIcon = {\n component: '📦',\n info: 'ℹ️',\n warn: '⚠️',\n error: '❌',\n debug: '🐛',\n};\n\nconst LogStyle = {\n component:\n 'color: #fff; background-color: #8D6FDD; padding: 2px 5px; border-radius: 3px;',\n info: 'color: #fff; background-color: #007bff; padding: 2px 5px; border-radius: 3px;',\n warn: 'color: #fff; background-color: #ffc107; padding: 2px 5px; border-radius: 3px;',\n error:\n 'color: #fff; background-color: #dc3545; padding: 2px 5px; border-radius: 3px;',\n debug:\n 'color: #fff; background-color: #28a745; padding: 2px 5px; border-radius: 3px;',\n};\n\nconst LogTextStyle = {\n component: 'color: #8D6FDD;',\n info: 'color: #007bff;',\n warn: 'color: #ffc107;',\n error: 'color: #dc3545;',\n debug: 'color: #28a745;',\n};\n\nexport const stdbLogger = (level: LogLevel, message: any): void => {\n console.log(\n `%c${LogLevelIdentifierIcon[level]} ${level.toUpperCase()}%c ${message}`,\n LogStyle[level],\n LogTextStyle[level]\n );\n};\n","import { EventEmitter } from './event_emitter.ts';\nimport type { TableRuntimeTypeInfo } from './spacetime_module.ts';\n\nimport { stdbLogger } from './logger.ts';\nimport type { ComparablePrimitive } from '../';\nimport type { EventContextInterface } from './index.ts';\n\nexport type Operation<\n RowType extends Record<string, any> = Record<string, any>,\n> = {\n type: 'insert' | 'delete';\n // For tables with a primary key, this is the primary key value, as a primitive or string.\n // Otherwise, it is an encoding of the full row.\n rowId: ComparablePrimitive;\n row: RowType;\n};\n\nexport type TableUpdate<\n RowType extends Record<string, any> = Record<string, any>,\n> = {\n tableName: string;\n operations: Operation<RowType>[];\n};\n\nexport type PendingCallback = {\n type: 'insert' | 'delete' | 'update';\n table: string;\n cb: () => void;\n};\n/**\n * Builder to generate calls to query a `table` in the database\n */\nexport class TableCache<\n RowType extends Record<string, any> = Record<string, any>,\n> {\n private rows: Map<ComparablePrimitive, [RowType, number]>;\n private tableTypeInfo: TableRuntimeTypeInfo;\n private emitter: EventEmitter<'insert' | 'delete' | 'update'>;\n\n /**\n * @param name the table name\n * @param primaryKeyCol column index designated as `#[primarykey]`\n * @param primaryKey column name designated as `#[primarykey]`\n * @param entityClass the entityClass\n */\n constructor(tableTypeInfo: TableRuntimeTypeInfo) {\n this.tableTypeInfo = tableTypeInfo;\n this.rows = new Map();\n this.emitter = new EventEmitter();\n }\n\n /**\n * @returns number of rows in the table\n */\n count(): number {\n return this.rows.size;\n }\n\n /**\n * @returns The values of the rows in the table\n */\n iter(): RowType[] {\n return Array.from(this.rows.values()).map(([row]) => row);\n }\n\n applyOperations = (\n operations: Operation<RowType>[],\n ctx: EventContextInterface\n ): PendingCallback[] => {\n const pendingCallbacks: PendingCallback[] = [];\n if (this.tableTypeInfo.primaryKeyInfo !== undefined) {\n const insertMap = new Map<\n ComparablePrimitive,\n [Operation<RowType>, number]\n >();\n const deleteMap = new Map<\n ComparablePrimitive,\n [Operation<RowType>, number]\n >();\n for (const op of operations) {\n if (op.type === 'insert') {\n const [_, prevCount] = insertMap.get(op.rowId) || [op, 0];\n insertMap.set(op.rowId, [op, prevCount + 1]);\n } else {\n const [_, prevCount] = deleteMap.get(op.rowId) || [op, 0];\n deleteMap.set(op.rowId, [op, prevCount + 1]);\n }\n }\n for (const [primaryKey, [insertOp, refCount]] of insertMap) {\n const deleteEntry = deleteMap.get(primaryKey);\n if (deleteEntry) {\n const [_, deleteCount] = deleteEntry;\n // In most cases the refCountDelta will be either 0 or refCount, but if\n // an update moves a row in or out of the result set of different queries, then\n // other deltas are possible.\n const refCountDelta = refCount - deleteCount;\n const maybeCb = this.update(\n ctx,\n primaryKey,\n insertOp.row,\n refCountDelta\n );\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n deleteMap.delete(primaryKey);\n } else {\n const maybeCb = this.insert(ctx, insertOp, refCount);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n }\n }\n for (const [deleteOp, refCount] of deleteMap.values()) {\n const maybeCb = this.delete(ctx, deleteOp, refCount);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n }\n } else {\n for (const op of operations) {\n if (op.type === 'insert') {\n const maybeCb = this.insert(ctx, op);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n } else {\n const maybeCb = this.delete(ctx, op);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n }\n }\n }\n return pendingCallbacks;\n };\n\n update = (\n ctx: EventContextInterface,\n rowId: ComparablePrimitive,\n newRow: RowType,\n refCountDelta: number = 0\n ): PendingCallback | undefined => {\n const existingEntry = this.rows.get(rowId);\n if (!existingEntry) {\n // TODO: this should throw an error and kill the connection.\n stdbLogger(\n 'error',\n `Updating a row that was not present in the cache. Table: ${this.tableTypeInfo.tableName}, RowId: ${rowId}`\n );\n return undefined;\n }\n const [oldRow, previousCount] = existingEntry;\n const refCount = Math.max(1, previousCount + refCountDelta);\n if (previousCount + refCountDelta <= 0) {\n stdbLogger(\n 'error',\n `Negative reference count for in table ${this.tableTypeInfo.tableName} row ${rowId} (${previousCount} + ${refCountDelta})`\n );\n return undefined;\n }\n this.rows.set(rowId, [newRow, refCount]);\n // This indicates something is wrong, so we could arguably crash here.\n if (previousCount === 0) {\n stdbLogger(\n 'error',\n `Updating a row id in table ${this.tableTypeInfo.tableName} which was not present in the cache (rowId: ${rowId})`\n );\n return {\n type: 'insert',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('insert', ctx, newRow);\n },\n };\n }\n return {\n type: 'update',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('update', ctx, oldRow, newRow);\n },\n };\n };\n\n insert = (\n ctx: EventContextInterface,\n operation: Operation<RowType>,\n count: number = 1\n ): PendingCallback | undefined => {\n const [_, previousCount] = this.rows.get(operation.rowId) || [\n operation.row,\n 0,\n ];\n this.rows.set(operation.rowId, [operation.row, previousCount + count]);\n if (previousCount === 0) {\n return {\n type: 'insert',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('insert', ctx, operation.row);\n },\n };\n }\n // It's possible to get a duplicate insert because rows can be returned from multiple queries.\n return undefined;\n };\n\n delete = (\n ctx: EventContextInterface,\n operation: Operation<RowType>,\n count: number = 1\n ): PendingCallback | undefined => {\n const [_, previousCount] = this.rows.get(operation.rowId) || [\n operation.row,\n 0,\n ];\n // This should never happen.\n if (previousCount === 0) {\n stdbLogger('warn', 'Deleting a row that was not present in the cache');\n return undefined;\n }\n // If this was the last reference, we are actually deleting the row.\n if (previousCount <= count) {\n // TODO: Log a warning/error if previousCount is less than count.\n this.rows.delete(operation.rowId);\n return {\n type: 'delete',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('delete', ctx, operation.row);\n },\n };\n }\n this.rows.set(operation.rowId, [operation.row, previousCount - count]);\n return undefined;\n };\n\n /**\n * Register a callback for when a row is newly inserted into the database.\n *\n * ```ts\n * User.onInsert((user, reducerEvent) => {\n * if (reducerEvent) {\n * console.log(\"New user on reducer\", reducerEvent, user);\n * } else {\n * console.log(\"New user received during subscription update on insert\", user);\n * }\n * });\n * ```\n *\n * @param cb Callback to be called when a new row is inserted\n */\n onInsert = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.on('insert', cb);\n };\n\n /**\n * Register a callback for when a row is deleted from the database.\n *\n * ```ts\n * User.onDelete((user, reducerEvent) => {\n * if (reducerEvent) {\n * console.log(\"Deleted user on reducer\", reducerEvent, user);\n * } else {\n * console.log(\"Deleted user received during subscription update on update\", user);\n * }\n * });\n * ```\n *\n * @param cb Callback to be called when a new row is inserted\n */\n onDelete = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.on('delete', cb);\n };\n\n /**\n * Register a callback for when a row is updated into the database.\n *\n * ```ts\n * User.onInsert((user, reducerEvent) => {\n * if (reducerEvent) {\n * console.log(\"Updated user on reducer\", reducerEvent, user);\n * } else {\n * console.log(\"Updated user received during subscription update on delete\", user);\n * }\n * });\n * ```\n *\n * @param cb Callback to be called when a new row is inserted\n */\n onUpdate = <EventContext>(\n cb: (ctx: EventContext, oldRow: RowType, row: RowType) => void\n ): void => {\n this.emitter.on('update', cb);\n };\n\n /**\n * Remove a callback for when a row is newly inserted into the database.\n *\n * @param cb Callback to be removed\n */\n removeOnInsert = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.off('insert', cb);\n };\n\n /**\n * Remove a callback for when a row is deleted from the database.\n *\n * @param cb Callback to be removed\n */\n removeOnDelete = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.off('delete', cb);\n };\n\n /**\n * Remove a callback for when a row is updated into the database.\n *\n * @param cb Callback to be removed\n */\n removeOnUpdate = <EventContext>(\n cb: (ctx: EventContext, oldRow: RowType, row: RowType) => void\n ): void => {\n this.emitter.off('update', cb);\n };\n}\n","import type { TableRuntimeTypeInfo } from './spacetime_module.ts';\nimport { TableCache } from './table_cache.ts';\n\nexport class ClientCache {\n /**\n * The tables in the database.\n */\n tables: Map<string, TableCache<any>>;\n\n constructor() {\n this.tables = new Map();\n }\n\n /**\n * Returns the table with the given name.\n * @param name The name of the table.\n * @returns The table\n */\n getTable<RowType extends Record<string, any>>(\n name: string\n ): TableCache<RowType> {\n const table = this.tables.get(name);\n\n // ! This should not happen as the table should be available but an exception is thrown just in case.\n if (!table) {\n console.error(\n 'The table has not been registered for this client. Please register the table before using it. If you have registered global tables using the SpacetimeDBClient.registerTables() or `registerTable()` method, please make sure that is executed first!'\n );\n throw new Error(`Table ${name} does not exist`);\n }\n\n return table;\n }\n\n getOrCreateTable<RowType extends Record<string, any>>(\n tableTypeInfo: TableRuntimeTypeInfo\n ): TableCache<RowType> {\n let table: TableCache<RowType>;\n if (!this.tables.has(tableTypeInfo.tableName)) {\n table = new TableCache<RowType>(tableTypeInfo);\n this.tables.set(tableTypeInfo.tableName, table);\n } else {\n table = this.tables.get(tableTypeInfo.tableName)!;\n }\n return table;\n }\n}\n","export type PrereleaseId = string | number;\n\nexport type PreRelease = PrereleaseId[];\n\n// Compare pre-release identifiers according to the semver spec (https://semver.org/#spec-item-11).\nfunction comparePreReleases(a: PreRelease, b: PreRelease): number {\n const len = Math.min(a.length, b.length);\n for (let i = 0; i < len; i++) {\n const aPart = a[i];\n const bPart = b[i];\n if (aPart === bPart) continue;\n if (typeof aPart === 'number' && typeof bPart === 'number') {\n return aPart - bPart;\n }\n if (typeof aPart === 'string' && typeof bPart === 'string') {\n return aPart.localeCompare(bPart);\n }\n // According to item 11.4.3, numeric identifiers always have lower precedence than non-numeric identifiers.\n // So if `a` is a string, it has higher precedence than `b`.\n return typeof aPart === 'string' ? 1 : -1;\n }\n // See rule 11.4.4 in the semver spec.\n return a.length - b.length;\n}\n\n// We don't use these, and they don't matter for version ordering, so I'm not going to parse it to spec.\nexport type BuildInfo = string;\n\n// This is exported for tests.\nexport class SemanticVersion {\n major: number;\n minor: number;\n patch: number;\n preRelease: PreRelease | null;\n buildInfo: BuildInfo | null;\n\n constructor(\n major: number,\n minor: number,\n patch: number,\n preRelease: PreRelease | null = null,\n buildInfo: BuildInfo | null = null\n ) {\n this.major = major;\n this.minor = minor;\n this.patch = patch;\n this.preRelease = preRelease;\n this.buildInfo = buildInfo;\n }\n\n toString(): string {\n let versionString = `${this.major}.${this.minor}.${this.patch}`;\n if (this.preRelease) {\n versionString += `-${this.preRelease.join('.')}`;\n }\n if (this.buildInfo) {\n versionString += `+${this.buildInfo}`;\n }\n return versionString;\n }\n\n compare(other: SemanticVersion): number {\n if (this.major !== other.major) {\n return this.major - other.major;\n }\n if (this.minor !== other.minor) {\n return this.minor - other.minor;\n }\n if (this.patch !== other.patch) {\n return this.patch - other.patch;\n }\n if (this.preRelease && other.preRelease) {\n return comparePreReleases(this.preRelease, other.preRelease);\n }\n if (this.preRelease) {\n return -1; // The version without a pre-release is greater.\n }\n if (other.preRelease) {\n return -1; // Since we don't have a pre-release, this version is greater.\n }\n return 0; // versions are equal\n }\n\n clone(): SemanticVersion {\n return new SemanticVersion(\n this.major,\n this.minor,\n this.patch,\n this.preRelease ? [...this.preRelease] : null,\n this.buildInfo\n );\n }\n\n static parseVersionString(version: string): SemanticVersion {\n const regex =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-([\\da-zA-Z-]+(?:\\.[\\da-zA-Z-]+)*))?(?:\\+([\\da-zA-Z-]+(?:\\.[\\da-zA-Z-]+)*))?$/;\n const match = version.match(regex);\n if (!match) {\n throw new Error(`Invalid version string: ${version}`);\n }\n\n const major = parseInt(match[1], 10);\n const minor = parseInt(match[2], 10);\n const patch = parseInt(match[3], 10);\n const preRelease = match[4]\n ? match[4].split('.').map(id => (isNaN(Number(id)) ? id : Number(id)))\n : null;\n const buildInfo = match[5] || null;\n\n return new SemanticVersion(major, minor, patch, preRelease, buildInfo);\n }\n}\n\n// The SDK depends on some module information that was not generated before this version.\nexport const _MINIMUM_CLI_VERSION: SemanticVersion = new SemanticVersion(\n 1,\n 4,\n 0\n);\n\nexport function ensureMinimumVersionOrThrow(versionString?: string): void {\n if (versionString === undefined) {\n throw new Error(versionErrorMessage(versionString));\n }\n const version = SemanticVersion.parseVersionString(versionString);\n if (version.compare(_MINIMUM_CLI_VERSION) < 0) {\n throw new Error(versionErrorMessage(versionString));\n }\n}\n\nfunction versionErrorMessage(incompatibleVersion?: string): string {\n return `Module code was generated with an incompatible version of the spacetimedb cli (${incompatibleVersion}). Update the cli version to at least ${_MINIMUM_CLI_VERSION.toString()} and regenerate the bindings. You can upgrade to the latest cli version by running: spacetime version upgrade`;\n}\n","export async function decompress(\n buffer: Uint8Array,\n // Leaving it here to expand to brotli when it lands in the browsers and NodeJS\n type: 'gzip',\n chunkSize: number = 128 * 1024 // 128KB\n): Promise<Uint8Array> {\n // Create a single ReadableStream to handle chunks\n let offset = 0;\n const readableStream = new ReadableStream({\n pull(controller) {\n if (offset < buffer.length) {\n // Slice a chunk of the buffer and enqueue it\n const chunk = buffer.subarray(\n offset,\n Math.min(offset + chunkSize, buffer.length)\n );\n controller.enqueue(chunk);\n offset += chunkSize;\n } else {\n controller.close();\n }\n },\n });\n\n // Create a single DecompressionStream\n const decompressionStream = new DecompressionStream(type);\n\n // Pipe the ReadableStream through the DecompressionStream\n const decompressedStream = readableStream.pipeThrough(decompressionStream);\n\n // Collect the decompressed chunks efficiently\n const reader = decompressedStream.getReader();\n const chunks: Uint8Array[] = [];\n let totalLength = 0;\n let result: any;\n\n while (!(result = await reader.read()).done) {\n chunks.push(result.value);\n totalLength += result.value.length;\n }\n\n // Allocate a single Uint8Array for the decompressed data\n const decompressedArray = new Uint8Array(totalLength);\n let chunkOffset = 0;\n\n for (const chunk of chunks) {\n decompressedArray.set(chunk, chunkOffset);\n chunkOffset += chunk.length;\n }\n\n return decompressedArray;\n}\n","export async function resolveWS(): Promise<typeof WebSocket> {\n // Browser or Node >= 22 (or any env that exposes global WebSocket)\n if (typeof (globalThis as any).WebSocket !== 'undefined') {\n return (globalThis as any).WebSocket as typeof WebSocket;\n }\n\n // Node without a global WebSocket: lazily load undici's polyfill.\n // Use an unstatable dynamic import so bundlers don't prebundle it.\n const dynamicImport = new Function('m', 'return import(m)') as (\n m: string\n ) => Promise<any>;\n\n try {\n const { WebSocket: UndiciWS } = await dynamicImport('undici');\n return UndiciWS as unknown as typeof WebSocket;\n } catch (err) {\n console.warn(\n '[spacetimedb-sdk] No global WebSocket found. ' +\n 'On Node 18–21, please install `undici` (npm install undici) ' +\n 'to enable WebSocket support.'\n );\n throw err;\n }\n}\n","import { decompress } from './decompress';\nimport { resolveWS } from './ws';\n\nexport class WebsocketDecompressAdapter {\n onclose?: (...ev: any[]) => void;\n onopen?: (...ev: any[]) => void;\n onmessage?: (msg: { data: Uint8Array }) => void;\n onerror?: (msg: ErrorEvent) => void;\n\n #ws: WebSocket;\n\n async #handleOnMessage(msg: MessageEvent) {\n const buffer = new Uint8Array(msg.data);\n let decompressed: Uint8Array;\n\n if (buffer[0] === 0) {\n decompressed = buffer.slice(1);\n } else if (buffer[0] === 1) {\n throw new Error(\n 'Brotli Compression not supported. Please use gzip or none compression in withCompression method on DbConnection.'\n );\n } else if (buffer[0] === 2) {\n decompressed = await decompress(buffer.slice(1), 'gzip');\n } else {\n throw new Error(\n 'Unexpected Compression Algorithm. Please use `gzip` or `none`'\n );\n }\n\n this.onmessage?.({ data: decompressed });\n }\n\n #handleOnOpen(msg: any) {\n this.onopen?.(msg);\n }\n\n #handleOnError(msg: any) {\n this.onerror?.(msg);\n }\n\n #handleOnClose(msg: any) {\n this.onclose?.(msg);\n }\n\n send(msg: any): void {\n this.#ws.send(msg);\n }\n\n close(): void {\n this.#ws.close();\n }\n\n constructor(ws: WebSocket) {\n this.onmessage = undefined;\n this.onopen = undefined;\n this.onmessage = undefined;\n this.onerror = undefined;\n\n ws.onmessage = this.#handleOnMessage.bind(this);\n ws.onerror = this.#handleOnError.bind(this);\n ws.onclose = this.#handleOnClose.bind(this);\n ws.onopen = this.#handleOnOpen.bind(this);\n\n ws.binaryType = 'arraybuffer';\n\n this.#ws = ws;\n }\n\n static async createWebSocketFn({\n url,\n nameOrAddress,\n wsProtocol,\n authToken,\n compression,\n lightMode,\n confirmedReads,\n }: {\n url: URL;\n wsProtocol: string;\n nameOrAddress: string;\n authToken?: string;\n compression: 'gzip' | 'none';\n lightMode: boolean;\n confirmedReads?: boolean;\n }): Promise<WebsocketDecompressAdapter> {\n const headers = new Headers();\n\n const WS = await resolveWS();\n\n // We swap our original token to a shorter-lived token\n // to avoid sending the original via query params.\n let temporaryAuthToken: string | undefined = undefined;\n if (authToken) {\n headers.set('Authorization', `Bearer ${authToken}`);\n const tokenUrl = new URL('v1/identity/websocket-token', url);\n tokenUrl.protocol = url.protocol === 'wss:' ? 'https:' : 'http:';\n\n const response = await fetch(tokenUrl, { method: 'POST', headers });\n if (response.ok) {\n const { token } = await response.json();\n temporaryAuthToken = token;\n } else {\n return Promise.reject(\n new Error(`Failed to verify token: ${response.statusText}`)\n );\n }\n }\n\n const databaseUrl = new URL(`v1/database/${nameOrAddress}/subscribe`, url);\n if (temporaryAuthToken) {\n databaseUrl.searchParams.set('token', temporaryAuthToken);\n }\n databaseUrl.searchParams.set(\n 'compression',\n compression === 'gzip' ? 'Gzip' : 'None'\n );\n if (lightMode) {\n databaseUrl.searchParams.set('light', 'true');\n }\n if (confirmedReads !== undefined) {\n databaseUrl.searchParams.set('confirmed', confirmedReads.toString());\n }\n\n const ws = new WS(databaseUrl.toString(), wsProtocol);\n\n return new WebsocketDecompressAdapter(ws);\n }\n}\n","import { DbConnectionImpl, type ConnectionEvent } from './db_connection_impl';\nimport { EventEmitter } from './event_emitter';\nimport type { Identity } from '../';\nimport type RemoteModule from './spacetime_module';\nimport { ensureMinimumVersionOrThrow } from './version';\nimport { WebsocketDecompressAdapter } from './websocket_decompress_adapter';\n\n/**\n * The database client connection to a SpacetimeDB server.\n */\nexport class DbConnectionBuilder<\n DbConnection,\n ErrorContext,\n _SubscriptionEventContext,\n> {\n #uri?: URL;\n #nameOrAddress?: string;\n #identity?: Identity;\n #token?: string;\n #emitter: EventEmitter<ConnectionEvent> = new EventEmitter();\n #compression: 'gzip' | 'none' = 'gzip';\n #lightMode: boolean = false;\n #confirmedReads?: boolean;\n #createWSFn: typeof WebsocketDecompressAdapter.createWebSocketFn;\n\n /**\n * Creates a new `DbConnectionBuilder` database client and set the initial parameters.\n *\n * Users are not expected to call this constructor directly. Instead, use the static method `DbConnection.builder()`.\n *\n * @param remoteModule The remote module to use to connect to the SpacetimeDB server.\n * @param dbConnectionConstructor The constructor to use to create a new `DbConnection`.\n */\n constructor(\n private remoteModule: RemoteModule,\n private dbConnectionConstructor: (imp: DbConnectionImpl) => DbConnection\n ) {\n this.#createWSFn = WebsocketDecompressAdapter.createWebSocketFn;\n }\n\n /**\n * Set the URI of the SpacetimeDB server to connect to.\n *\n * @param uri The URI of the SpacetimeDB server to connect to.\n *\n **/\n withUri(uri: string | URL): this {\n this.#uri = new URL(uri);\n return this;\n }\n\n /**\n * Set the name or Identity of the database module to connect to.\n *\n * @param nameOrAddress\n *\n * @returns The `DbConnectionBuilder` instance.\n */\n withModuleName(nameOrAddress: string): this {\n this.#nameOrAddress = nameOrAddress;\n return this;\n }\n\n /**\n * Set the identity of the client to connect to the database.\n *\n * @param token The credentials to use to authenticate with SpacetimeDB. This\n * is optional. You can store the token returned by the `onConnect` callback\n * to use in future connections.\n *\n * @returns The `DbConnectionBuilder` instance.\n */\n withToken(token?: string): this {\n this.#token = token;\n return this;\n }\n\n withWSFn(\n createWSFn: (args: {\n url: URL;\n wsProtocol: string;\n authToken?: string;\n }) => Promise<WebsocketDecompressAdapter>\n ): this {\n this.#createWSFn = createWSFn;\n return this;\n }\n\n /**\n * Set the compression algorithm to use for the connection.\n *\n * @param compression The compression algorithm to use for the connection.\n */\n withCompression(compression: 'gzip' | 'none'): this {\n this.#compression = compression;\n return this;\n }\n\n /**\n * Sets the connection to operate in light mode.\n *\n * Light mode is a mode that reduces the amount of data sent over the network.\n *\n * @param lightMode The light mode for the connection.\n */\n withLightMode(lightMode: boolean): this {\n this.#lightMode = lightMode;\n return this;\n }\n\n /**\n * Sets the connection to use confirmed reads.\n *\n * When enabled, the server will send query results only after they are\n * confirmed to be durable.\n *\n * What durable means depends on the server configuration: a single node\n * server may consider a transaction durable once it is `fsync`'ed to disk,\n * whereas a cluster may require that some number of replicas have\n * acknowledge that they have stored the transactions.\n *\n * Note that enabling confirmed reads will increase the latency between a\n * reducer call and the corresponding subscription update arriving at the\n * client.\n *\n * If this method is not called, not preference is sent to the server, and\n * the server will choose the default.\n *\n * @param confirmedReads `true` to enable confirmed reads, `false` to disable.\n */\n withConfirmedReads(confirmedReads: boolean): this {\n this.#confirmedReads = confirmedReads;\n return this;\n }\n\n /**\n * Register a callback to be invoked upon authentication with the database.\n *\n * @param identity A unique identifier for a client connected to a database.\n * @param token The credentials to use to authenticate with SpacetimeDB.\n *\n * @returns The `DbConnectionBuilder` instance.\n *\n * The callback will be invoked with the `Identity` and private authentication `token` provided by the database to identify this connection.\n *\n * If credentials were supplied to connect, those passed to the callback will be equivalent to the ones used to connect.\n *\n * If the initial connection was anonymous, a new set of credentials will be generated by the database to identify this user.\n *\n * The credentials passed to the callback can be saved and used to authenticate the same user in future connections.\n *\n * @example\n *\n * ```ts\n * DbConnection.builder().onConnect((ctx, identity, token) => {\n * console.log(\"Connected to SpacetimeDB with identity:\", identity.toHexString());\n * });\n * ```\n */\n onConnect(\n callback: (\n connection: DbConnection,\n identity: Identity,\n token: string\n ) => void\n ): this {\n this.#emitter.on('connect', callback);\n return this;\n }\n\n /**\n * Register a callback to be invoked upon an error.\n *\n * @example\n *\n * ```ts\n * DbConnection.builder().onConnectError((ctx, error) => {\n * console.log(\"Error connecting to SpacetimeDB:\", error);\n * });\n * ```\n */\n onConnectError(callback: (ctx: ErrorContext, error: Error) => void): this {\n this.#emitter.on('connectError', callback);\n return this;\n }\n\n /**\n * Registers a callback to run when a {@link DbConnection} whose connection initially succeeded\n * is disconnected, either after a {@link DbConnection.disconnect} call or due to an error.\n *\n * If the connection ended because of an error, the error is passed to the callback.\n *\n * The `callback` will be installed on the `DbConnection` created by `build`\n * before initiating the connection, ensuring there's no opportunity for the disconnect to happen\n * before the callback is installed.\n *\n * Note that this does not trigger if `build` fails\n * or in cases where {@link DbConnectionBuilder.onConnectError} would trigger.\n * This callback only triggers if the connection closes after `build` returns successfully\n * and {@link DbConnectionBuilder.onConnect} is invoked, i.e., after the `IdentityToken` is received.\n *\n * To simplify SDK implementation, at most one such callback can be registered.\n * Calling `onDisconnect` on the same `DbConnectionBuilder` multiple times throws an error.\n *\n * Unlike callbacks registered via {@link DbConnection},\n * no mechanism is provided to unregister the provided callback.\n * This is a concession to ergonomics; there's no clean place to return a `CallbackId` from this method\n * or from `build`.\n *\n * @param {function(error?: Error): void} callback - The callback to invoke upon disconnection.\n * @throws {Error} Throws an error if called multiple times on the same `DbConnectionBuilder`.\n */\n onDisconnect(\n callback: (ctx: ErrorContext, error?: Error | undefined) => void\n ): this {\n this.#emitter.on('disconnect', callback);\n return this;\n }\n\n /**\n * Builds a new `DbConnection` with the parameters set on this `DbConnectionBuilder` and attempts to connect to the SpacetimeDB server.\n *\n * @returns A new `DbConnection` with the parameters set on this `DbConnectionBuilder`.\n *\n * @example\n *\n * ```ts\n * const host = \"http://localhost:3000\";\n * const name_or_address = \"database_name\"\n * const auth_token = undefined;\n * DbConnection.builder().withUri(host).withModuleName(name_or_address).withToken(auth_token).build();\n * ```\n */\n build(): DbConnection {\n if (!this.#uri) {\n throw new Error('URI is required to connect to SpacetimeDB');\n }\n\n if (!this.#nameOrAddress) {\n throw new Error(\n 'Database name or address is required to connect to SpacetimeDB'\n );\n }\n // We could consider making this an `onConnectError` instead of throwing here.\n // Ideally, it would be a compile time error, but I'm not sure how to accomplish that.\n ensureMinimumVersionOrThrow(this.remoteModule.versionInfo?.cliVersion);\n\n return this.dbConnectionConstructor(\n new DbConnectionImpl({\n uri: this.#uri,\n nameOrAddress: this.#nameOrAddress,\n identity: this.#identity,\n token: this.#token,\n emitter: this.#emitter,\n compression: this.#compression,\n lightMode: this.#lightMode,\n confirmedReads: this.#confirmedReads,\n createWSFn: this.#createWSFn,\n remoteModule: this.remoteModule,\n })\n );\n }\n}\n","import type { DbConnectionImpl } from './db_connection_impl';\nimport type {\n ErrorContextInterface,\n SubscriptionEventContextInterface,\n} from './event_context';\nimport { EventEmitter } from './event_emitter';\n\nexport class SubscriptionBuilderImpl<\n DBView = any,\n Reducers = any,\n SetReducerFlags = any,\n> {\n #onApplied?: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void = undefined;\n #onError?: (\n ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void = undefined;\n constructor(\n private db: DbConnectionImpl<DBView, Reducers, SetReducerFlags>\n ) {}\n\n /**\n * Registers `callback` to run when this query is successfully added to our subscribed set,\n * I.e. when its `SubscriptionApplied` message is received.\n *\n * The database state exposed via the `&EventContext` argument\n * includes all the rows added to the client cache as a result of the new subscription.\n *\n * The event in the `&EventContext` argument is `Event::SubscribeApplied`.\n *\n * Multiple `on_applied` callbacks for the same query may coexist.\n * No mechanism for un-registering `on_applied` callbacks is exposed.\n *\n * @param cb - Callback to run when the subscription is applied.\n * @returns The current `SubscriptionBuilder` instance.\n */\n onApplied(\n cb: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void\n ): SubscriptionBuilderImpl<DBView, Reducers, SetReducerFlags> {\n this.#onApplied = cb;\n return this;\n }\n\n /**\n * Registers `callback` to run when this query either:\n * - Fails to be added to our subscribed set.\n * - Is unexpectedly removed from our subscribed set.\n *\n * If the subscription had previously started and has been unexpectedly removed,\n * the database state exposed via the `&EventContext` argument contains no rows\n * from any subscriptions removed within the same error event.\n * As proposed, it must therefore contain no rows.\n *\n * The event in the `&EventContext` argument is `Event::SubscribeError`,\n * containing a dynamic error object with a human-readable description of the error\n * for diagnostic purposes.\n *\n * Multiple `on_error` callbacks for the same query may coexist.\n * No mechanism for un-registering `on_error` callbacks is exposed.\n *\n * @param cb - Callback to run when there is an error in subscription.\n * @returns The current `SubscriptionBuilder` instance.\n */\n onError(\n cb: (ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>) => void\n ): SubscriptionBuilderImpl<DBView, Reducers, SetReducerFlags> {\n this.#onError = cb;\n return this;\n }\n\n /**\n * Subscribe to a single query. The results of the query will be merged into the client\n * cache and deduplicated on the client.\n *\n * @param query_sql A `SQL` query to subscribe to.\n *\n * @example\n *\n * ```ts\n * const subscription = connection.subscriptionBuilder().onApplied(() => {\n * console.log(\"SDK client cache initialized.\");\n * }).subscribe(\"SELECT * FROM User\");\n *\n * subscription.unsubscribe();\n * ```\n */\n subscribe(\n query_sql: string | string[]\n ): SubscriptionHandleImpl<DBView, Reducers, SetReducerFlags> {\n const queries = Array.isArray(query_sql) ? query_sql : [query_sql];\n if (queries.length === 0) {\n throw new Error('Subscriptions must have at least one query');\n }\n return new SubscriptionHandleImpl(\n this.db,\n queries,\n this.#onApplied,\n this.#onError\n );\n }\n\n /**\n * Subscribes to all rows from all tables.\n *\n * This method is intended as a convenience\n * for applications where client-side memory use and network bandwidth are not concerns.\n * Applications where these resources are a constraint\n * should register more precise queries via `subscribe`\n * in order to replicate only the subset of data which the client needs to function.\n *\n * This method should not be combined with `subscribe` on the same `DbConnection`.\n * A connection may either `subscribe` to particular queries,\n * or `subscribeToAllTables`, but not both.\n * Attempting to call `subscribe`\n * on a `DbConnection` that has previously used `subscribeToAllTables`,\n * or vice versa, may misbehave in any number of ways,\n * including dropping subscriptions, corrupting the client cache, or throwing errors.\n */\n subscribeToAllTables(): void {\n this.subscribe('SELECT * FROM *');\n }\n}\n\nexport type SubscribeEvent = 'applied' | 'error' | 'end';\n\nexport class SubscriptionManager {\n subscriptions: Map<\n number,\n { handle: SubscriptionHandleImpl; emitter: EventEmitter<SubscribeEvent> }\n > = new Map();\n}\n\nexport class SubscriptionHandleImpl<\n DBView = any,\n Reducers = any,\n SetReducerFlags = any,\n> {\n #queryId: number;\n #unsubscribeCalled: boolean = false;\n #endedState: boolean = false;\n #activeState: boolean = false;\n #emitter: EventEmitter<SubscribeEvent, (...args: any[]) => void> =\n new EventEmitter();\n\n constructor(\n private db: DbConnectionImpl<DBView, Reducers, SetReducerFlags>,\n querySql: string[],\n onApplied?: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void,\n onError?: (\n ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>,\n error: Error\n ) => void\n ) {\n this.#emitter.on(\n 'applied',\n (\n ctx: SubscriptionEventContextInterface<\n DBView,\n Reducers,\n SetReducerFlags\n >\n ) => {\n this.#activeState = true;\n if (onApplied) {\n onApplied(ctx);\n }\n }\n );\n this.#emitter.on(\n 'error',\n (\n ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>,\n error: Error\n ) => {\n this.#activeState = false;\n this.#endedState = true;\n if (onError) {\n onError(ctx, error);\n }\n }\n );\n this.#queryId = this.db.registerSubscription(this, this.#emitter, querySql);\n }\n\n /**\n * Consumes self and issues an `Unsubscribe` message,\n * removing this query from the client's set of subscribed queries.\n * It is only valid to call this method if `is_active()` is `true`.\n */\n unsubscribe(): void {\n if (this.#unsubscribeCalled) {\n throw new Error('Unsubscribe has already been called');\n }\n this.#unsubscribeCalled = true;\n this.db.unregisterSubscription(this.#queryId);\n this.#emitter.on(\n 'end',\n (\n _ctx: SubscriptionEventContextInterface<\n DBView,\n Reducers,\n SetReducerFlags\n >\n ) => {\n this.#endedState = true;\n this.#activeState = false;\n }\n );\n }\n\n /**\n * Unsubscribes and also registers a callback to run upon success.\n * I.e. when an `UnsubscribeApplied` message is received.\n *\n * If `Unsubscribe` returns an error,\n * or if the `on_error` callback(s) are invoked before this subscription would end normally,\n * the `on_end` callback is not invoked.\n *\n * @param onEnd - Callback to run upon successful unsubscribe.\n */\n unsubscribeThen(\n onEnd: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void\n ): void {\n if (this.#endedState) {\n throw new Error('Subscription has already ended');\n }\n if (this.#unsubscribeCalled) {\n throw new Error('Unsubscribe has already been called');\n }\n this.#unsubscribeCalled = true;\n this.db.unregisterSubscription(this.#queryId);\n this.#emitter.on(\n 'end',\n (\n ctx: SubscriptionEventContextInterface<\n DBView,\n Reducers,\n SetReducerFlags\n >\n ) => {\n this.#endedState = true;\n this.#activeState = false;\n onEnd(ctx);\n }\n );\n }\n\n /**\n * True if this `SubscriptionHandle` has ended,\n * either due to an error or a call to `unsubscribe`.\n *\n * This is initially false, and becomes true when either the `on_end` or `on_error` callback is invoked.\n * A subscription which has not yet been applied is not active, but is also not ended.\n */\n isEnded(): boolean {\n return this.#endedState;\n }\n\n /**\n * True if this `SubscriptionHandle` is active, meaning it has been successfully applied\n * and has not since ended, either due to an error or a complete `unsubscribe` request-response pair.\n *\n * This corresponds exactly to the interval bounded at the start by the `on_applied` callback\n * and at the end by either the `on_end` or `on_error` callback.\n */\n isActive(): boolean {\n return this.#activeState;\n }\n}\n","import { ConnectionId } from '../';\nimport {\n AlgebraicType,\n type AlgebraicTypeVariants,\n type ComparablePrimitive,\n} from '../';\nimport { parseValue } from '../';\nimport { BinaryReader } from '../';\nimport { BinaryWriter } from '../';\nimport { BsatnRowList } from './client_api/bsatn_row_list_type.ts';\nimport { ClientMessage } from './client_api/client_message_type.ts';\nimport { DatabaseUpdate } from './client_api/database_update_type.ts';\nimport { QueryUpdate } from './client_api/query_update_type.ts';\nimport { ServerMessage } from './client_api/server_message_type.ts';\nimport { TableUpdate as RawTableUpdate } from './client_api/table_update_type.ts';\nimport { ClientCache } from './client_cache.ts';\nimport { DbConnectionBuilder } from './db_connection_builder.ts';\nimport { type DbContext } from './db_context.ts';\nimport type { Event } from './event.ts';\nimport {\n type ErrorContextInterface,\n type EventContextInterface,\n type ReducerEventContextInterface,\n type SubscriptionEventContextInterface,\n} from './event_context.ts';\nimport { EventEmitter } from './event_emitter.ts';\nimport { decompress } from './decompress.ts';\nimport type { Identity } from '../';\nimport type {\n IdentityTokenMessage,\n Message,\n SubscribeAppliedMessage,\n UnsubscribeAppliedMessage,\n} from './message_types.ts';\nimport type { ReducerEvent } from './reducer_event.ts';\nimport type RemoteModule from './spacetime_module.ts';\nimport {\n TableCache,\n type Operation,\n type PendingCallback,\n type TableUpdate as CacheTableUpdate,\n} from './table_cache.ts';\nimport { WebsocketDecompressAdapter } from './websocket_decompress_adapter.ts';\nimport type { WebsocketTestAdapter } from './websocket_test_adapter.ts';\nimport {\n SubscriptionBuilderImpl,\n SubscriptionHandleImpl,\n SubscriptionManager,\n type SubscribeEvent,\n} from './subscription_builder_impl.ts';\nimport { stdbLogger } from './logger.ts';\nimport { type ReducerRuntimeTypeInfo } from './spacetime_module.ts';\nimport { fromByteArray } from 'base64-js';\n\nexport {\n BinaryReader,\n BinaryWriter,\n DbConnectionBuilder,\n SubscriptionBuilderImpl,\n TableCache,\n type Event,\n};\n\nexport type {\n DbContext,\n EventContextInterface,\n ReducerEventContextInterface,\n SubscriptionEventContextInterface,\n ErrorContextInterface,\n ReducerEvent,\n};\n\nexport type ConnectionEvent = 'connect' | 'disconnect' | 'connectError';\nexport type CallReducerFlags = 'FullUpdate' | 'NoSuccessNotify';\n\ntype ReducerEventCallback<ReducerArgs extends any[] = any[]> = (\n ctx: ReducerEventContextInterface,\n ...args: ReducerArgs\n) => void;\ntype SubscriptionEventCallback = (\n ctx: SubscriptionEventContextInterface\n) => void;\n\nfunction callReducerFlagsToNumber(flags: CallReducerFlags): number {\n switch (flags) {\n case 'FullUpdate':\n return 0;\n case 'NoSuccessNotify':\n return 1;\n }\n}\n\ntype DbConnectionConfig = {\n uri: URL;\n nameOrAddress: string;\n identity?: Identity;\n token?: string;\n emitter: EventEmitter<ConnectionEvent>;\n remoteModule: RemoteModule;\n createWSFn: typeof WebsocketDecompressAdapter.createWebSocketFn;\n compression: 'gzip' | 'none';\n lightMode: boolean;\n confirmedReads?: boolean;\n};\n\nexport class DbConnectionImpl<\n DBView = any,\n Reducers = any,\n SetReducerFlags = any,\n> implements DbContext<DBView, Reducers>\n{\n /**\n * Whether or not the connection is active.\n */\n isActive = false;\n\n /**\n * This connection's public identity.\n */\n identity?: Identity = undefined;\n\n /**\n * This connection's private authentication token.\n */\n token?: string = undefined;\n\n /**\n * The accessor field to access the tables in the database and associated\n * callback functions.\n */\n db: DBView;\n\n /**\n * The accessor field to access the reducers in the database and associated\n * callback functions.\n */\n reducers: Reducers;\n\n /**\n * The accessor field to access functions related to setting flags on\n * reducers regarding how the server should handle the reducer call and\n * the events that it sends back to the client.\n */\n setReducerFlags: SetReducerFlags;\n\n /**\n * The `ConnectionId` of the connection to to the database.\n */\n connectionId: ConnectionId = ConnectionId.random();\n\n // These fields are meant to be strictly private.\n #queryId = 0;\n #emitter: EventEmitter<ConnectionEvent>;\n #reducerEmitter: EventEmitter<string, ReducerEventCallback> =\n new EventEmitter();\n #onApplied?: SubscriptionEventCallback;\n #remoteModule: RemoteModule;\n #messageQueue = Promise.resolve();\n #subscriptionManager = new SubscriptionManager();\n\n // These fields are not part of the public API, but in a pinch you\n // could use JavaScript to access them by bypassing TypeScript's\n // private fields.\n // We use them in testing.\n private clientCache: ClientCache;\n private ws?: WebsocketDecompressAdapter | WebsocketTestAdapter;\n private wsPromise: Promise<\n WebsocketDecompressAdapter | WebsocketTestAdapter | undefined\n >;\n\n constructor({\n uri,\n nameOrAddress,\n identity,\n token,\n emitter,\n remoteModule,\n createWSFn,\n compression,\n lightMode,\n confirmedReads,\n }: DbConnectionConfig) {\n stdbLogger('info', 'Connecting to SpacetimeDB WS...');\n\n // We use .toString() here because some versions of React Native contain a bug where the URL constructor\n // incorrectly treats a URL instance as a plain string.\n // This results in an attempt to call .endsWith() on it, leading to an error.\n const url = new URL(uri.toString());\n if (!/^wss?:/.test(uri.protocol)) {\n url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';\n }\n\n this.identity = identity;\n this.token = token;\n\n this.#remoteModule = remoteModule;\n this.#emitter = emitter;\n\n const connectionId = this.connectionId.toHexString();\n url.searchParams.set('connection_id', connectionId);\n\n this.clientCache = new ClientCache();\n this.db = this.#remoteModule.dbViewConstructor(this);\n this.setReducerFlags = this.#remoteModule.setReducerFlagsConstructor();\n this.reducers = this.#remoteModule.reducersConstructor(\n this,\n this.setReducerFlags\n );\n\n this.wsPromise = createWSFn({\n url,\n nameOrAddress,\n wsProtocol: 'v1.bsatn.spacetimedb',\n authToken: token,\n compression: compression,\n lightMode: lightMode,\n confirmedReads: confirmedReads,\n })\n .then(v => {\n this.ws = v;\n\n this.ws.onclose = () => {\n this.#emitter.emit('disconnect', this);\n };\n this.ws.onerror = (e: ErrorEvent) => {\n this.#emitter.emit('connectError', this, e);\n };\n this.ws.onopen = this.#handleOnOpen.bind(this);\n this.ws.onmessage = this.#handleOnMessage.bind(this);\n return v;\n })\n .catch(e => {\n stdbLogger('error', 'Error connecting to SpacetimeDB WS');\n this.#emitter.emit('connectError', this, e);\n\n return undefined;\n });\n }\n\n #getNextQueryId = () => {\n const queryId = this.#queryId;\n this.#queryId += 1;\n return queryId;\n };\n\n // NOTE: This is very important!!! This is the actual function that\n // gets called when you call `connection.subscriptionBuilder()`.\n // The `subscriptionBuilder` function which is generated, just shadows\n // this function in the type system, but not the actual implementation!\n // Do not remove this function, or shoot yourself in the foot please.\n // It's not clear what would be a better way to do this at this exact\n // moment.\n subscriptionBuilder = (): SubscriptionBuilderImpl => {\n return new SubscriptionBuilderImpl(this);\n };\n\n registerSubscription(\n handle: SubscriptionHandleImpl<DBView, Reducers, SetReducerFlags>,\n handleEmitter: EventEmitter<SubscribeEvent, SubscriptionEventCallback>,\n querySql: string[]\n ): number {\n const queryId = this.#getNextQueryId();\n this.#subscriptionManager.subscriptions.set(queryId, {\n handle,\n emitter: handleEmitter,\n });\n this.#sendMessage(\n ClientMessage.SubscribeMulti({\n queryStrings: querySql,\n queryId: { id: queryId },\n // The TypeScript SDK doesn't currently track `request_id`s,\n // so always use 0.\n requestId: 0,\n })\n );\n return queryId;\n }\n\n unregisterSubscription(queryId: number): void {\n this.#sendMessage(\n ClientMessage.UnsubscribeMulti({\n queryId: { id: queryId },\n // The TypeScript SDK doesn't currently track `request_id`s,\n // so always use 0.\n requestId: 0,\n })\n );\n }\n\n // This function is async because we decompress the message async\n async #processParsedMessage(\n message: ServerMessage\n ): Promise<Message | undefined> {\n const parseRowList = (\n type: 'insert' | 'delete',\n tableName: string,\n rowList: BsatnRowList\n ): Operation[] => {\n const buffer = rowList.rowsData;\n const reader = new BinaryReader(buffer);\n const rows: Operation[] = [];\n const rowType = this.#remoteModule.tables[tableName]!.rowType;\n const primaryKeyInfo =\n this.#remoteModule.tables[tableName]!.primaryKeyInfo;\n while (reader.remaining > 0) {\n const row = AlgebraicType.deserializeValue(reader, rowType);\n let rowId: ComparablePrimitive | undefined = undefined;\n if (primaryKeyInfo !== undefined) {\n rowId = AlgebraicType.intoMapKey(\n primaryKeyInfo.colType,\n row[primaryKeyInfo.colName]\n );\n } else {\n // Get a view of the bytes for this row.\n const rowBytes = buffer.subarray(0, reader.offset);\n // Convert it to a base64 string, so we can use it as a map key.\n const asBase64 = fromByteArray(rowBytes);\n rowId = asBase64;\n }\n\n rows.push({\n type,\n rowId,\n row,\n });\n }\n return rows;\n };\n\n const parseTableUpdate = async (\n rawTableUpdate: RawTableUpdate\n ): Promise<CacheTableUpdate> => {\n const tableName = rawTableUpdate.tableName;\n let operations: Operation[] = [];\n for (const update of rawTableUpdate.updates) {\n let decompressed: QueryUpdate;\n if (update.tag === 'Gzip') {\n const decompressedBuffer = await decompress(update.value, 'gzip');\n decompressed = QueryUpdate.deserialize(\n new BinaryReader(decompressedBuffer)\n );\n } else if (update.tag === 'Brotli') {\n throw new Error(\n 'Brotli compression not supported. Please use gzip or none compression in withCompression method on DbConnection.'\n );\n } else {\n decompressed = update.value;\n }\n operations = operations.concat(\n parseRowList('insert', tableName, decompressed.inserts)\n );\n operations = operations.concat(\n parseRowList('delete', tableName, decompressed.deletes)\n );\n }\n return {\n tableName,\n operations,\n };\n };\n\n const parseDatabaseUpdate = async (\n dbUpdate: DatabaseUpdate\n ): Promise<CacheTableUpdate[]> => {\n const tableUpdates: CacheTableUpdate[] = [];\n for (const rawTableUpdate of dbUpdate.tables) {\n tableUpdates.push(await parseTableUpdate(rawTableUpdate));\n }\n return tableUpdates;\n };\n\n switch (message.tag) {\n case 'InitialSubscription': {\n const dbUpdate = message.value.databaseUpdate;\n const tableUpdates = await parseDatabaseUpdate(dbUpdate);\n const subscriptionUpdate: Message = {\n tag: 'InitialSubscription',\n tableUpdates,\n };\n return subscriptionUpdate;\n }\n\n case 'TransactionUpdateLight': {\n const dbUpdate = message.value.update;\n const tableUpdates = await parseDatabaseUpdate(dbUpdate);\n const subscriptionUpdate: Message = {\n tag: 'TransactionUpdateLight',\n tableUpdates,\n };\n return subscriptionUpdate;\n }\n\n case 'TransactionUpdate': {\n const txUpdate = message.value;\n const identity = txUpdate.callerIdentity;\n const connectionId = ConnectionId.nullIfZero(\n txUpdate.callerConnectionId\n );\n const reducerName: string = txUpdate.reducerCall.reducerName;\n const args = txUpdate.reducerCall.args;\n const energyQuantaUsed = txUpdate.energyQuantaUsed;\n\n let tableUpdates: CacheTableUpdate[] = [];\n let errMessage = '';\n switch (txUpdate.status.tag) {\n case 'Committed':\n tableUpdates = await parseDatabaseUpdate(txUpdate.status.value);\n break;\n case 'Failed':\n tableUpdates = [];\n errMessage = txUpdate.status.value;\n break;\n case 'OutOfEnergy':\n tableUpdates = [];\n break;\n }\n\n // TODO: Can `reducerName` be '<none>'?\n // See: https://github.com/clockworklabs/SpacetimeDB/blob/a2a1b5d9b2e0ebaaf753d074db056d319952d442/crates/core/src/client/message_handlers.rs#L155\n if (reducerName === '<none>') {\n const errorMessage = errMessage;\n console.error(`Received an error from the database: ${errorMessage}`);\n return;\n }\n\n let reducerInfo:\n | {\n reducerName: string;\n args: Uint8Array;\n }\n | undefined;\n if (reducerName !== '') {\n reducerInfo = {\n reducerName,\n args,\n };\n }\n\n const transactionUpdate: Message = {\n tag: 'TransactionUpdate',\n tableUpdates,\n identity,\n connectionId,\n reducerInfo,\n status: txUpdate.status,\n energyConsumed: energyQuantaUsed.quanta,\n message: errMessage,\n timestamp: txUpdate.timestamp,\n };\n return transactionUpdate;\n }\n\n case 'IdentityToken': {\n const identityTokenMessage: IdentityTokenMessage = {\n tag: 'IdentityToken',\n identity: message.value.identity,\n token: message.value.token,\n connectionId: message.value.connectionId,\n };\n return identityTokenMessage;\n }\n\n case 'OneOffQueryResponse': {\n throw new Error(\n `TypeScript SDK never sends one-off queries, but got OneOffQueryResponse ${message}`\n );\n }\n\n case 'SubscribeMultiApplied': {\n const parsedTableUpdates = await parseDatabaseUpdate(\n message.value.update\n );\n const subscribeAppliedMessage: SubscribeAppliedMessage<\n Record<string, any>\n > = {\n tag: 'SubscribeApplied',\n queryId: message.value.queryId.id,\n tableUpdates: parsedTableUpdates,\n };\n return subscribeAppliedMessage;\n }\n\n case 'UnsubscribeMultiApplied': {\n const parsedTableUpdates = await parseDatabaseUpdate(\n message.value.update\n );\n const unsubscribeAppliedMessage: UnsubscribeAppliedMessage<\n Record<string, any>\n > = {\n tag: 'UnsubscribeApplied',\n queryId: message.value.queryId.id,\n tableUpdates: parsedTableUpdates,\n };\n return unsubscribeAppliedMessage;\n }\n\n case 'SubscriptionError': {\n return {\n tag: 'SubscriptionError',\n queryId: message.value.queryId,\n error: message.value.error,\n };\n }\n }\n }\n\n #sendMessage(message: ClientMessage): void {\n this.wsPromise.then(wsResolved => {\n if (wsResolved) {\n const writer = new BinaryWriter(1024);\n ClientMessage.serialize(writer, message);\n const encoded = writer.getBuffer();\n wsResolved.send(encoded);\n }\n });\n }\n\n /**\n * Handles WebSocket onOpen event.\n */\n #handleOnOpen(): void {\n this.isActive = true;\n }\n\n #applyTableUpdates(\n tableUpdates: CacheTableUpdate[],\n eventContext: EventContextInterface\n ): PendingCallback[] {\n const pendingCallbacks: PendingCallback[] = [];\n for (const tableUpdate of tableUpdates) {\n // Get table information for the table being updated\n const tableName = tableUpdate.tableName;\n const tableTypeInfo = this.#remoteModule.tables[tableName]!;\n const table = this.clientCache.getOrCreateTable(tableTypeInfo);\n const newCallbacks = table.applyOperations(\n tableUpdate.operations,\n eventContext\n );\n for (const callback of newCallbacks) {\n pendingCallbacks.push(callback);\n }\n }\n return pendingCallbacks;\n }\n\n async #processMessage(data: Uint8Array): Promise<void> {\n const serverMessage = parseValue(ServerMessage, data);\n const message = await this.#processParsedMessage(serverMessage);\n if (!message) {\n return;\n }\n switch (message.tag) {\n case 'InitialSubscription': {\n const event: Event<never> = { tag: 'SubscribeApplied' };\n\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n // Remove the event from the subscription event context\n // It is not a field in the type narrowed SubscriptionEventContext\n const { event: _, ...subscriptionEventContext } = eventContext;\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n\n if (this.#emitter) {\n this.#onApplied?.(subscriptionEventContext);\n }\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'TransactionUpdateLight': {\n const event: Event<never> = { tag: 'UnknownTransaction' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'TransactionUpdate': {\n let reducerInfo = message.reducerInfo;\n let unknownTransaction = false;\n let reducerArgs: any | undefined;\n let reducerTypeInfo: ReducerRuntimeTypeInfo | undefined;\n if (!reducerInfo) {\n unknownTransaction = true;\n } else {\n reducerTypeInfo =\n this.#remoteModule.reducers[reducerInfo.reducerName];\n try {\n const reader = new BinaryReader(reducerInfo.args as Uint8Array);\n reducerArgs = AlgebraicType.deserializeValue(\n reader,\n reducerTypeInfo.argsType\n );\n } catch {\n // This should only be printed in development, since it's\n // possible for clients to receive new reducers that they don't\n // know about.\n console.debug('Failed to deserialize reducer arguments');\n unknownTransaction = true;\n }\n }\n\n if (unknownTransaction) {\n const event: Event<never> = { tag: 'UnknownTransaction' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n\n for (const callback of callbacks) {\n callback.cb();\n }\n return;\n }\n\n // At this point, we know that `reducerInfo` is not null because\n // we return if `unknownTransaction` is true.\n reducerInfo = reducerInfo!;\n reducerTypeInfo = reducerTypeInfo!;\n\n // Thus this must be a reducer event create it and emit it.\n const reducerEvent = {\n callerIdentity: message.identity,\n status: message.status,\n callerConnectionId: message.connectionId as ConnectionId,\n timestamp: message.timestamp,\n energyConsumed: message.energyConsumed,\n reducer: {\n name: reducerInfo.reducerName,\n args: reducerArgs,\n },\n };\n const event: Event<typeof reducerEvent.reducer> = {\n tag: 'Reducer',\n value: reducerEvent,\n };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const reducerEventContext = {\n ...eventContext,\n event: reducerEvent,\n };\n\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n\n const argsArray: any[] = [];\n (\n reducerTypeInfo.argsType as AlgebraicTypeVariants.Product\n ).value.elements.forEach(element => {\n argsArray.push(reducerArgs[element.name!]);\n });\n this.#reducerEmitter.emit(\n reducerInfo.reducerName,\n reducerEventContext,\n ...argsArray\n );\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'IdentityToken': {\n this.identity = message.identity;\n if (!this.token && message.token) {\n this.token = message.token;\n }\n this.connectionId = message.connectionId;\n this.#emitter.emit('connect', this, this.identity, this.token);\n break;\n }\n case 'SubscribeApplied': {\n const subscription = this.#subscriptionManager.subscriptions.get(\n message.queryId\n );\n if (subscription === undefined) {\n stdbLogger(\n 'error',\n `Received SubscribeApplied for unknown queryId ${message.queryId}.`\n );\n // If we don't know about the subscription, we won't apply the table updates.\n break;\n }\n const event: Event<never> = { tag: 'SubscribeApplied' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const { event: _, ...subscriptionEventContext } = eventContext;\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n subscription?.emitter.emit('applied', subscriptionEventContext);\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'UnsubscribeApplied': {\n const subscription = this.#subscriptionManager.subscriptions.get(\n message.queryId\n );\n if (subscription === undefined) {\n stdbLogger(\n 'error',\n `Received UnsubscribeApplied for unknown queryId ${message.queryId}.`\n );\n // If we don't know about the subscription, we won't apply the table updates.\n break;\n }\n const event: Event<never> = { tag: 'UnsubscribeApplied' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const { event: _, ...subscriptionEventContext } = eventContext;\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n subscription?.emitter.emit('end', subscriptionEventContext);\n this.#subscriptionManager.subscriptions.delete(message.queryId);\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'SubscriptionError': {\n const error = Error(message.error);\n const event: Event<never> = { tag: 'Error', value: error };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const errorContext = {\n ...eventContext,\n event: error,\n };\n if (message.queryId !== undefined) {\n this.#subscriptionManager.subscriptions\n .get(message.queryId)\n ?.emitter.emit('error', errorContext, error);\n this.#subscriptionManager.subscriptions.delete(message.queryId);\n } else {\n console.error('Received an error message without a queryId: ', error);\n // TODO: This should actually kill the connection.\n // A subscription error without a specific subscription means we aren't receiving\n // updates for all of our subscriptions, so our cache is out of sync.\n\n // Send it to all of them:\n this.#subscriptionManager.subscriptions.forEach(({ emitter }) => {\n emitter.emit('error', errorContext, error);\n });\n }\n }\n }\n }\n\n /**\n * Handles WebSocket onMessage event.\n * @param wsMessage MessageEvent object.\n */\n #handleOnMessage(wsMessage: { data: Uint8Array }): void {\n // Utilize promise chaining to ensure that we process messages in order\n // even though we are processing them asyncronously. This will not begin\n // processing the next message until we await the processing of the\n // current message.\n this.#messageQueue = this.#messageQueue.then(() => {\n return this.#processMessage(wsMessage.data);\n });\n }\n\n /**\n * Call a reducer on your SpacetimeDB module.\n *\n * @param reducerName The name of the reducer to call\n * @param argsSerializer The arguments to pass to the reducer\n */\n callReducer(\n reducerName: string,\n argsBuffer: Uint8Array,\n flags: CallReducerFlags\n ): void {\n const message = ClientMessage.CallReducer({\n reducer: reducerName,\n args: argsBuffer,\n // The TypeScript SDK doesn't currently track `request_id`s,\n // so always use 0.\n requestId: 0,\n flags: callReducerFlagsToNumber(flags),\n });\n this.#sendMessage(message);\n }\n\n /**\n * Close the current connection.\n *\n * @example\n *\n * ```ts\n * const connection = DbConnection.builder().build();\n * connection.disconnect()\n * ```\n */\n disconnect(): void {\n this.wsPromise.then(wsResolved => {\n if (wsResolved) {\n wsResolved.close();\n }\n });\n }\n\n private on(\n eventName: ConnectionEvent,\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on(eventName, callback);\n }\n\n private off(\n eventName: ConnectionEvent,\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off(eventName, callback);\n }\n\n private onConnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on('connect', callback);\n }\n\n private onDisconnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on('disconnect', callback);\n }\n\n private onConnectError(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on('connectError', callback);\n }\n\n private removeOnConnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off('connect', callback);\n }\n\n private removeOnDisconnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off('disconnect', callback);\n }\n\n private removeOnConnectError(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off('connectError', callback);\n }\n\n // Note: This is required to be public because it needs to be\n // called from the `RemoteReducers` class.\n onReducer(reducerName: string, callback: ReducerEventCallback): void {\n this.#reducerEmitter.on(reducerName, callback);\n }\n\n // Note: This is required to be public because it needs to be\n // called from the `RemoteReducers` class.\n offReducer(reducerName: string, callback: ReducerEventCallback): void {\n this.#reducerEmitter.off(reducerName, callback);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/time_duration.ts","../src/lib/timestamp.ts","../src/lib/binary_writer.ts","../src/lib/binary_reader.ts","../src/lib/utils.ts","../src/lib/identity.ts","../src/lib/option.ts","../src/lib/autogen/sum_type_variant_type.ts","../src/lib/autogen/sum_type_type.ts","../src/lib/autogen/product_type_element_type.ts","../src/lib/autogen/product_type_type.ts","../src/lib/autogen/algebraic_type_type.ts","../src/lib/schedule_at.ts","../src/lib/algebraic_type.ts","../src/lib/connection_id.ts","../src/lib/algebraic_value.ts","../src/sdk/client_api/row_size_hint_type.ts","../src/sdk/client_api/bsatn_row_list_type.ts","../src/sdk/client_api/call_reducer_type.ts","../src/sdk/client_api/subscribe_type.ts","../src/sdk/client_api/one_off_query_type.ts","../src/sdk/client_api/query_id_type.ts","../src/sdk/client_api/subscribe_single_type.ts","../src/sdk/client_api/subscribe_multi_type.ts","../src/sdk/client_api/unsubscribe_type.ts","../src/sdk/client_api/unsubscribe_multi_type.ts","../src/sdk/client_api/client_message_type.ts","../src/sdk/client_api/query_update_type.ts","../src/sdk/client_api/compressable_query_update_type.ts","../src/sdk/client_api/table_update_type.ts","../src/sdk/client_api/database_update_type.ts","../src/sdk/client_api/initial_subscription_type.ts","../src/sdk/client_api/update_status_type.ts","../src/sdk/client_api/reducer_call_info_type.ts","../src/sdk/client_api/energy_quanta_type.ts","../src/sdk/client_api/transaction_update_type.ts","../src/sdk/client_api/transaction_update_light_type.ts","../src/sdk/client_api/identity_token_type.ts","../src/sdk/client_api/one_off_table_type.ts","../src/sdk/client_api/one_off_query_response_type.ts","../src/sdk/client_api/subscribe_rows_type.ts","../src/sdk/client_api/subscribe_applied_type.ts","../src/sdk/client_api/unsubscribe_applied_type.ts","../src/sdk/client_api/subscription_error_type.ts","../src/sdk/client_api/subscribe_multi_applied_type.ts","../src/sdk/client_api/unsubscribe_multi_applied_type.ts","../src/sdk/client_api/server_message_type.ts","../src/sdk/event_emitter.ts","../src/sdk/logger.ts","../src/sdk/table_cache.ts","../src/sdk/client_cache.ts","../src/sdk/version.ts","../src/sdk/decompress.ts","../src/sdk/ws.ts","../src/sdk/websocket_decompress_adapter.ts","../src/sdk/db_connection_builder.ts","../src/sdk/subscription_builder_impl.ts","../src/sdk/db_connection_impl.ts"],"names":["AlgebraicType","ProductType","SumType","fromByteArray","event","eventContext","callbacks"],"mappings":";;;AAcO,IAAM,YAAA,GAAN,MAAM,aAAA,CAAa;AAAA,EACxB,wBAAA;AAAA,EAEA,OAAe,iBAAA,GAA4B,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3C,OAAO,gBAAA,GAA8C;AACnD,IAAA,O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","file":"index.browser.mjs","sourcesContent":["import { AlgebraicType } from './algebraic_type';\n\nexport type TimeDurationAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [\n { name: '__time_duration_micros__'; algebraicType: { tag: 'I64' } },\n ];\n };\n};\n\n/**\n * A difference between two points in time, represented as a number of microseconds.\n */\nexport class TimeDuration {\n __time_duration_micros__: bigint;\n\n private static MICROS_PER_MILLIS: bigint = 1000n;\n\n /**\n * Get the algebraic type representation of the {@link TimeDuration} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): TimeDurationAlgebraicType {\n return AlgebraicType.Product({\n elements: [\n {\n name: '__time_duration_micros__',\n algebraicType: AlgebraicType.I64,\n },\n ],\n });\n }\n\n get micros(): bigint {\n return this.__time_duration_micros__;\n }\n\n get millis(): number {\n return Number(this.micros / TimeDuration.MICROS_PER_MILLIS);\n }\n\n constructor(micros: bigint) {\n this.__time_duration_micros__ = micros;\n }\n\n static fromMillis(millis: number): TimeDuration {\n return new TimeDuration(BigInt(millis) * TimeDuration.MICROS_PER_MILLIS);\n }\n\n /** This outputs the same string format that we use in the host and in Rust modules */\n toString(): string {\n const micros = this.micros;\n const sign = micros < 0 ? '-' : '+';\n const pos = micros < 0 ? -micros : micros;\n const secs = pos / 1_000_000n;\n const micros_remaining = pos % 1_000_000n;\n return `${sign}${secs}.${String(micros_remaining).padStart(6, '0')}`;\n }\n}\n","import { AlgebraicType } from './algebraic_type';\nimport { TimeDuration } from './time_duration';\n\nexport type TimestampAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [\n {\n name: '__timestamp_micros_since_unix_epoch__';\n algebraicType: { tag: 'I64' };\n },\n ];\n };\n};\n\n/**\n * A point in time, represented as a number of microseconds since the Unix epoch.\n */\nexport class Timestamp {\n __timestamp_micros_since_unix_epoch__: bigint;\n\n private static MICROS_PER_MILLIS: bigint = 1000n;\n\n get microsSinceUnixEpoch(): bigint {\n return this.__timestamp_micros_since_unix_epoch__;\n }\n\n constructor(micros: bigint) {\n this.__timestamp_micros_since_unix_epoch__ = micros;\n }\n\n /**\n * Get the algebraic type representation of the {@link Timestamp} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): TimestampAlgebraicType {\n return AlgebraicType.Product({\n elements: [\n {\n name: '__timestamp_micros_since_unix_epoch__',\n algebraicType: AlgebraicType.I64,\n },\n ],\n });\n }\n\n /**\n * The Unix epoch, the midnight at the beginning of January 1, 1970, UTC.\n */\n static UNIX_EPOCH: Timestamp = new Timestamp(0n);\n\n /**\n * Get a `Timestamp` representing the execution environment's belief of the current moment in time.\n */\n static now(): Timestamp {\n return Timestamp.fromDate(new Date());\n }\n\n /**\n * Get a `Timestamp` representing the same point in time as `date`.\n */\n static fromDate(date: Date): Timestamp {\n const millis = date.getTime();\n const micros = BigInt(millis) * Timestamp.MICROS_PER_MILLIS;\n return new Timestamp(micros);\n }\n\n /**\n * Get a `Date` representing approximately the same point in time as `this`.\n *\n * This method truncates to millisecond precision,\n * and throws `RangeError` if the `Timestamp` is outside the range representable as a `Date`.\n */\n toDate(): Date {\n const micros = this.__timestamp_micros_since_unix_epoch__;\n const millis = micros / Timestamp.MICROS_PER_MILLIS;\n if (\n millis > BigInt(Number.MAX_SAFE_INTEGER) ||\n millis < BigInt(Number.MIN_SAFE_INTEGER)\n ) {\n throw new RangeError(\n \"Timestamp is outside of the representable range of JS's Date\"\n );\n }\n return new Date(Number(millis));\n }\n\n since(other: Timestamp): TimeDuration {\n return new TimeDuration(\n this.__timestamp_micros_since_unix_epoch__ -\n other.__timestamp_micros_since_unix_epoch__\n );\n }\n}\n","import { fromByteArray } from 'base64-js';\n\nexport default class BinaryWriter {\n #buffer: Uint8Array;\n #view: DataView;\n #offset: number = 0;\n\n constructor(size: number) {\n this.#buffer = new Uint8Array(size);\n this.#view = new DataView(this.#buffer.buffer);\n }\n\n #expandBuffer(additionalCapacity: number): void {\n const minCapacity = this.#offset + additionalCapacity + 1;\n if (minCapacity <= this.#buffer.length) return;\n let newCapacity = this.#buffer.length * 2;\n if (newCapacity < minCapacity) newCapacity = minCapacity;\n const newBuffer = new Uint8Array(newCapacity);\n newBuffer.set(this.#buffer);\n this.#buffer = newBuffer;\n this.#view = new DataView(this.#buffer.buffer);\n }\n\n toBase64(): string {\n return fromByteArray(this.#buffer.subarray(0, this.#offset));\n }\n\n getBuffer(): Uint8Array {\n return this.#buffer.slice(0, this.#offset);\n }\n\n get offset(): number {\n return this.#offset;\n }\n\n writeUInt8Array(value: Uint8Array): void {\n const length = value.length;\n\n this.#expandBuffer(4 + length);\n\n this.writeU32(length);\n this.#buffer.set(value, this.#offset);\n this.#offset += value.length;\n }\n\n writeBool(value: boolean): void {\n this.#expandBuffer(1);\n this.#view.setUint8(this.#offset, value ? 1 : 0);\n this.#offset += 1;\n }\n\n writeByte(value: number): void {\n this.#expandBuffer(1);\n this.#view.setUint8(this.#offset, value);\n this.#offset += 1;\n }\n\n writeI8(value: number): void {\n this.#expandBuffer(1);\n this.#view.setInt8(this.#offset, value);\n this.#offset += 1;\n }\n\n writeU8(value: number): void {\n this.#expandBuffer(1);\n this.#view.setUint8(this.#offset, value);\n this.#offset += 1;\n }\n\n writeI16(value: number): void {\n this.#expandBuffer(2);\n this.#view.setInt16(this.#offset, value, true);\n this.#offset += 2;\n }\n\n writeU16(value: number): void {\n this.#expandBuffer(2);\n this.#view.setUint16(this.#offset, value, true);\n this.#offset += 2;\n }\n\n writeI32(value: number): void {\n this.#expandBuffer(4);\n this.#view.setInt32(this.#offset, value, true);\n this.#offset += 4;\n }\n\n writeU32(value: number): void {\n this.#expandBuffer(4);\n this.#view.setUint32(this.#offset, value, true);\n this.#offset += 4;\n }\n\n writeI64(value: bigint): void {\n this.#expandBuffer(8);\n this.#view.setBigInt64(this.#offset, value, true);\n this.#offset += 8;\n }\n\n writeU64(value: bigint): void {\n this.#expandBuffer(8);\n this.#view.setBigUint64(this.#offset, value, true);\n this.#offset += 8;\n }\n\n writeU128(value: bigint): void {\n this.#expandBuffer(16);\n const lowerPart = value & BigInt('0xFFFFFFFFFFFFFFFF');\n const upperPart = value >> BigInt(64);\n this.#view.setBigUint64(this.#offset, lowerPart, true);\n this.#view.setBigUint64(this.#offset + 8, upperPart, true);\n this.#offset += 16;\n }\n\n writeI128(value: bigint): void {\n this.#expandBuffer(16);\n const lowerPart = value & BigInt('0xFFFFFFFFFFFFFFFF');\n const upperPart = value >> BigInt(64);\n this.#view.setBigInt64(this.#offset, lowerPart, true);\n this.#view.setBigInt64(this.#offset + 8, upperPart, true);\n this.#offset += 16;\n }\n\n writeU256(value: bigint): void {\n this.#expandBuffer(32);\n const low_64_mask = BigInt('0xFFFFFFFFFFFFFFFF');\n const p0 = value & low_64_mask;\n const p1 = (value >> BigInt(64 * 1)) & low_64_mask;\n const p2 = (value >> BigInt(64 * 2)) & low_64_mask;\n const p3 = value >> BigInt(64 * 3);\n this.#view.setBigUint64(this.#offset + 8 * 0, p0, true);\n this.#view.setBigUint64(this.#offset + 8 * 1, p1, true);\n this.#view.setBigUint64(this.#offset + 8 * 2, p2, true);\n this.#view.setBigUint64(this.#offset + 8 * 3, p3, true);\n this.#offset += 32;\n }\n\n writeI256(value: bigint): void {\n this.#expandBuffer(32);\n const low_64_mask = BigInt('0xFFFFFFFFFFFFFFFF');\n const p0 = value & low_64_mask;\n const p1 = (value >> BigInt(64 * 1)) & low_64_mask;\n const p2 = (value >> BigInt(64 * 2)) & low_64_mask;\n const p3 = value >> BigInt(64 * 3);\n this.#view.setBigUint64(this.#offset + 8 * 0, p0, true);\n this.#view.setBigUint64(this.#offset + 8 * 1, p1, true);\n this.#view.setBigUint64(this.#offset + 8 * 2, p2, true);\n this.#view.setBigInt64(this.#offset + 8 * 3, p3, true);\n this.#offset += 32;\n }\n\n writeF32(value: number): void {\n this.#expandBuffer(4);\n this.#view.setFloat32(this.#offset, value, true);\n this.#offset += 4;\n }\n\n writeF64(value: number): void {\n this.#expandBuffer(8);\n this.#view.setFloat64(this.#offset, value, true);\n this.#offset += 8;\n }\n\n writeString(value: string): void {\n const encoder = new TextEncoder();\n const encodedString = encoder.encode(value);\n this.writeU32(encodedString.length);\n this.#expandBuffer(encodedString.length);\n this.#buffer.set(encodedString, this.#offset);\n this.#offset += encodedString.length;\n }\n}\n","export default class BinaryReader {\n /**\n * The DataView used to read values from the binary data.\n *\n * Note: The DataView's `byteOffset` is relative to the beginning of the\n * underlying ArrayBuffer, not the start of the provided Uint8Array input.\n * This `BinaryReader`'s `#offset` field is used to track the current read position\n * relative to the start of the provided Uint8Array input.\n */\n #view: DataView;\n\n /**\n * Represents the offset (in bytes) relative to the start of the DataView\n * and provided Uint8Array input.\n *\n * Note: This is *not* the absolute byte offset within the underlying ArrayBuffer.\n */\n #offset: number = 0;\n\n constructor(input: Uint8Array) {\n this.#view = new DataView(input.buffer, input.byteOffset, input.byteLength);\n this.#offset = 0;\n }\n\n get offset(): number {\n return this.#offset;\n }\n\n get remaining(): number {\n return this.#view.byteLength - this.#offset;\n }\n\n /** Ensure we have at least `n` bytes left to read */\n #ensure(n: number): void {\n if (this.#offset + n > this.#view.byteLength) {\n throw new RangeError(\n `Tried to read ${n} byte(s) at relative offset ${this.#offset}, but only ${this.remaining} byte(s) remain`\n );\n }\n }\n\n readUInt8Array(): Uint8Array {\n const length = this.readU32();\n this.#ensure(length);\n return this.readBytes(length);\n }\n\n readBool(): boolean {\n const value = this.#view.getUint8(this.#offset);\n this.#offset += 1;\n return value !== 0;\n }\n\n readByte(): number {\n const value = this.#view.getUint8(this.#offset);\n this.#offset += 1;\n return value;\n }\n\n readBytes(length: number): Uint8Array {\n // Create a Uint8Array view over the DataView's buffer at the current offset\n // The #view.buffer is the whole ArrayBuffer, so we need to account for the\n // #view's starting position in that buffer (#view.byteOffset) and the current #offset\n const array = new Uint8Array(\n this.#view.buffer,\n this.#view.byteOffset + this.#offset,\n length\n );\n this.#offset += length;\n return array;\n }\n\n readI8(): number {\n const value = this.#view.getInt8(this.#offset);\n this.#offset += 1;\n return value;\n }\n\n readU8(): number {\n return this.readByte();\n }\n\n readI16(): number {\n const value = this.#view.getInt16(this.#offset, true);\n this.#offset += 2;\n return value;\n }\n\n readU16(): number {\n const value = this.#view.getUint16(this.#offset, true);\n this.#offset += 2;\n return value;\n }\n\n readI32(): number {\n const value = this.#view.getInt32(this.#offset, true);\n this.#offset += 4;\n return value;\n }\n\n readU32(): number {\n const value = this.#view.getUint32(this.#offset, true);\n this.#offset += 4;\n return value;\n }\n\n readI64(): bigint {\n const value = this.#view.getBigInt64(this.#offset, true);\n this.#offset += 8;\n return value;\n }\n\n readU64(): bigint {\n const value = this.#view.getBigUint64(this.#offset, true);\n this.#offset += 8;\n return value;\n }\n\n readU128(): bigint {\n const lowerPart = this.#view.getBigUint64(this.#offset, true);\n const upperPart = this.#view.getBigUint64(this.#offset + 8, true);\n this.#offset += 16;\n\n return (upperPart << BigInt(64)) + lowerPart;\n }\n\n readI128(): bigint {\n const lowerPart = this.#view.getBigUint64(this.#offset, true);\n const upperPart = this.#view.getBigInt64(this.#offset + 8, true);\n this.#offset += 16;\n\n return (upperPart << BigInt(64)) + lowerPart;\n }\n\n readU256(): bigint {\n const p0 = this.#view.getBigUint64(this.#offset, true);\n const p1 = this.#view.getBigUint64(this.#offset + 8, true);\n const p2 = this.#view.getBigUint64(this.#offset + 16, true);\n const p3 = this.#view.getBigUint64(this.#offset + 24, true);\n this.#offset += 32;\n\n return (\n (p3 << BigInt(3 * 64)) +\n (p2 << BigInt(2 * 64)) +\n (p1 << BigInt(1 * 64)) +\n p0\n );\n }\n\n readI256(): bigint {\n const p0 = this.#view.getBigUint64(this.#offset, true);\n const p1 = this.#view.getBigUint64(this.#offset + 8, true);\n const p2 = this.#view.getBigUint64(this.#offset + 16, true);\n const p3 = this.#view.getBigInt64(this.#offset + 24, true);\n this.#offset += 32;\n\n return (\n (p3 << BigInt(3 * 64)) +\n (p2 << BigInt(2 * 64)) +\n (p1 << BigInt(1 * 64)) +\n p0\n );\n }\n\n readF32(): number {\n const value = this.#view.getFloat32(this.#offset, true);\n this.#offset += 4;\n return value;\n }\n\n readF64(): number {\n const value = this.#view.getFloat64(this.#offset, true);\n this.#offset += 8;\n return value;\n }\n\n readString(): string {\n const uint8Array = this.readUInt8Array();\n return new TextDecoder('utf-8').decode(uint8Array);\n }\n}\n","import BinaryReader from './binary_reader';\nimport BinaryWriter from './binary_writer';\n\nexport function toPascalCase(s: string): string {\n const str = s.replace(/([-_][a-z])/gi, $1 => {\n return $1.toUpperCase().replace('-', '').replace('_', '');\n });\n\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function deepEqual(obj1: any, obj2: any): boolean {\n // If both are strictly equal (covers primitives and reference equality), return true\n if (obj1 === obj2) return true;\n\n // If either is a primitive type or one is null, return false since we already checked for strict equality\n if (\n typeof obj1 !== 'object' ||\n obj1 === null ||\n typeof obj2 !== 'object' ||\n obj2 === null\n ) {\n return false;\n }\n\n // Get keys of both objects\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n\n // If number of keys is different, return false\n if (keys1.length !== keys2.length) return false;\n\n // Check all keys and compare values recursively\n for (const key of keys1) {\n if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function uint8ArrayToHexString(array: Uint8Array): string {\n return Array.prototype.map\n .call(array.reverse(), x => ('00' + x.toString(16)).slice(-2))\n .join('');\n}\n\nexport function uint8ArrayToU128(array: Uint8Array): bigint {\n if (array.length != 16) {\n throw new Error(`Uint8Array is not 16 bytes long: ${array}`);\n }\n return new BinaryReader(array).readU128();\n}\n\nexport function uint8ArrayToU256(array: Uint8Array): bigint {\n if (array.length != 32) {\n throw new Error(`Uint8Array is not 32 bytes long: [${array}]`);\n }\n return new BinaryReader(array).readU256();\n}\n\nexport function hexStringToUint8Array(str: string): Uint8Array {\n if (str.startsWith('0x')) {\n str = str.slice(2);\n }\n const matches = str.match(/.{1,2}/g) || [];\n const data = Uint8Array.from(\n matches.map((byte: string) => parseInt(byte, 16))\n );\n return data.reverse();\n}\n\nexport function hexStringToU128(str: string): bigint {\n return uint8ArrayToU128(hexStringToUint8Array(str));\n}\n\nexport function hexStringToU256(str: string): bigint {\n return uint8ArrayToU256(hexStringToUint8Array(str));\n}\n\nexport function u128ToUint8Array(data: bigint): Uint8Array {\n const writer = new BinaryWriter(16);\n writer.writeU128(data);\n return writer.getBuffer();\n}\n\nexport function u128ToHexString(data: bigint): string {\n return uint8ArrayToHexString(u128ToUint8Array(data));\n}\n\nexport function u256ToUint8Array(data: bigint): Uint8Array {\n const writer = new BinaryWriter(32);\n writer.writeU256(data);\n return writer.getBuffer();\n}\n\nexport function u256ToHexString(data: bigint): string {\n return uint8ArrayToHexString(u256ToUint8Array(data));\n}\n","import { AlgebraicType } from './algebraic_type';\nimport { hexStringToU256, u256ToHexString, u256ToUint8Array } from './utils';\n\nexport type IdentityAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [{ name: '__identity__'; algebraicType: { tag: 'U256' } }];\n };\n};\n\n/**\n * A unique identifier for a user connected to a database.\n */\nexport class Identity {\n __identity__: bigint;\n\n /**\n * Creates a new `Identity`.\n *\n * `data` can be a hexadecimal string or a `bigint`.\n */\n constructor(data: string | bigint) {\n // we get a JSON with __identity__ when getting a token with a JSON API\n // and an bigint when using BSATN\n this.__identity__ = typeof data === 'string' ? hexStringToU256(data) : data;\n }\n\n /**\n * Get the algebraic type representation of the {@link Identity} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): IdentityAlgebraicType {\n return AlgebraicType.Product({\n elements: [{ name: '__identity__', algebraicType: AlgebraicType.U256 }],\n });\n }\n\n /**\n * Compare two identities for equality.\n */\n isEqual(other: Identity): boolean {\n return this.toHexString() === other.toHexString();\n }\n\n /**\n * Print the identity as a hexadecimal string.\n */\n toHexString(): string {\n return u256ToHexString(this.__identity__);\n }\n\n /**\n * Convert the address to a Uint8Array.\n */\n toUint8Array(): Uint8Array {\n return u256ToUint8Array(this.__identity__);\n }\n\n /**\n * Parse an Identity from a hexadecimal string.\n */\n static fromString(str: string): Identity {\n return new Identity(str);\n }\n\n /**\n * Zero identity (0x0000000000000000000000000000000000000000000000000000000000000000)\n */\n static zero(): Identity {\n return new Identity(0n);\n }\n\n toString(): string {\n return this.toHexString();\n }\n}\n","import { AlgebraicType } from './algebraic_type';\n\nexport type OptionAlgebraicType = {\n tag: 'Sum';\n value: {\n variants: [\n { name: 'some'; algebraicType: AlgebraicType },\n {\n name: 'none';\n algebraicType: { tag: 'Product'; value: { elements: [] } };\n },\n ];\n };\n};\n\nexport const Option: {\n getAlgebraicType(innerType: AlgebraicType): OptionAlgebraicType;\n} = {\n getAlgebraicType(innerType: AlgebraicType): OptionAlgebraicType {\n return AlgebraicType.Sum({\n variants: [\n { name: 'some', algebraicType: innerType },\n {\n name: 'none',\n algebraicType: AlgebraicType.Product({ elements: [] }),\n },\n ],\n });\n },\n};\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { AlgebraicType } from './algebraic_type_type';\n// Mark import as potentially unused\ndeclare type __keep_AlgebraicType = AlgebraicType;\n\nexport type SumTypeVariant = {\n name: string | undefined;\n algebraicType: AlgebraicType;\n};\nlet _cached_SumTypeVariant_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SumTypeVariant = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SumTypeVariant_type_value)\n return _cached_SumTypeVariant_type_value;\n _cached_SumTypeVariant_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SumTypeVariant_type_value.value.elements.push(\n {\n name: 'name',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.String\n ),\n },\n {\n name: 'algebraicType',\n algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SumTypeVariant_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SumTypeVariant): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SumTypeVariant.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SumTypeVariant {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SumTypeVariant.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SumTypeVariant;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { SumTypeVariant } from './sum_type_variant_type';\n// Mark import as potentially unused\ndeclare type __keep_SumTypeVariant = SumTypeVariant;\n\nexport type SumType = {\n variants: SumTypeVariant[];\n};\nlet _cached_SumType_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SumType = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SumType_type_value) return _cached_SumType_type_value;\n _cached_SumType_type_value = __AlgebraicTypeValue.Product({ elements: [] });\n _cached_SumType_type_value.value.elements.push({\n name: 'variants',\n algebraicType: __AlgebraicTypeValue.Array(\n SumTypeVariant.getTypeScriptAlgebraicType()\n ),\n });\n return _cached_SumType_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SumType): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SumType.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SumType {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SumType.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SumType;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { AlgebraicType } from './algebraic_type_type';\n// Mark import as potentially unused\ndeclare type __keep_AlgebraicType = AlgebraicType;\n\nexport type ProductTypeElement = {\n name: string | undefined;\n algebraicType: AlgebraicType;\n};\nlet _cached_ProductTypeElement_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const ProductTypeElement = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ProductTypeElement_type_value)\n return _cached_ProductTypeElement_type_value;\n _cached_ProductTypeElement_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_ProductTypeElement_type_value.value.elements.push(\n {\n name: 'name',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.String\n ),\n },\n {\n name: 'algebraicType',\n algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_ProductTypeElement_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ProductTypeElement): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ProductTypeElement.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ProductTypeElement {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ProductTypeElement.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ProductTypeElement;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { ProductTypeElement } from './product_type_element_type';\n// Mark import as potentially unused\ndeclare type __keep_ProductTypeElement = ProductTypeElement;\n\nexport type ProductType = {\n elements: ProductTypeElement[];\n};\nlet _cached_ProductType_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const ProductType = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ProductType_type_value) return _cached_ProductType_type_value;\n _cached_ProductType_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_ProductType_type_value.value.elements.push({\n name: 'elements',\n algebraicType: __AlgebraicTypeValue.Array(\n ProductTypeElement.getTypeScriptAlgebraicType()\n ),\n });\n return _cached_ProductType_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ProductType): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ProductType.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ProductType {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ProductType.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ProductType;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ConnectionId as __ConnectionId,\n Identity as __Identity,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { SumType } from './sum_type_type';\n// Mark import as potentially unused\ndeclare type __keep_SumType = SumType;\nimport { ProductType } from './product_type_type';\n// Mark import as potentially unused\ndeclare type __keep_ProductType = ProductType;\n\nimport * as AlgebraicTypeVariants from './algebraic_type_variants';\n\n// The tagged union or sum type for the algebraic type `AlgebraicType`.\nexport type AlgebraicType =\n | AlgebraicTypeVariants.Ref\n | AlgebraicTypeVariants.Sum\n | AlgebraicTypeVariants.Product\n | AlgebraicTypeVariants.Array\n | AlgebraicTypeVariants.String\n | AlgebraicTypeVariants.Bool\n | AlgebraicTypeVariants.I8\n | AlgebraicTypeVariants.U8\n | AlgebraicTypeVariants.I16\n | AlgebraicTypeVariants.U16\n | AlgebraicTypeVariants.I32\n | AlgebraicTypeVariants.U32\n | AlgebraicTypeVariants.I64\n | AlgebraicTypeVariants.U64\n | AlgebraicTypeVariants.I128\n | AlgebraicTypeVariants.U128\n | AlgebraicTypeVariants.I256\n | AlgebraicTypeVariants.U256\n | AlgebraicTypeVariants.F32\n | AlgebraicTypeVariants.F64;\n\nlet _cached_AlgebraicType_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const AlgebraicType = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n Ref: (value: number): AlgebraicTypeVariants.Ref => ({ tag: 'Ref', value }),\n Sum: (value: SumType): AlgebraicTypeVariants.Sum => ({ tag: 'Sum', value }),\n Product: (value: ProductType): AlgebraicTypeVariants.Product => ({\n tag: 'Product',\n value,\n }),\n Array: (value: AlgebraicType): AlgebraicTypeVariants.Array => ({\n tag: 'Array',\n value,\n }),\n String: { tag: 'String' } as const,\n Bool: { tag: 'Bool' } as const,\n I8: { tag: 'I8' } as const,\n U8: { tag: 'U8' } as const,\n I16: { tag: 'I16' } as const,\n U16: { tag: 'U16' } as const,\n I32: { tag: 'I32' } as const,\n U32: { tag: 'U32' } as const,\n I64: { tag: 'I64' } as const,\n U64: { tag: 'U64' } as const,\n I128: { tag: 'I128' } as const,\n U128: { tag: 'U128' } as const,\n I256: { tag: 'I256' } as const,\n U256: { tag: 'U256' } as const,\n F32: { tag: 'F32' } as const,\n F64: { tag: 'F64' } as const,\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_AlgebraicType_type_value)\n return _cached_AlgebraicType_type_value;\n _cached_AlgebraicType_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_AlgebraicType_type_value.value.variants.push(\n { name: 'Ref', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'Sum', algebraicType: SumType.getTypeScriptAlgebraicType() },\n {\n name: 'Product',\n algebraicType: ProductType.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Array',\n algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),\n },\n {\n name: 'String',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'Bool',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I8',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U8',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I16',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U16',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I32',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U32',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I64',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U64',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I128',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U128',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'I256',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'U256',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'F32',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n },\n {\n name: 'F64',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n }\n );\n return _cached_AlgebraicType_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: AlgebraicType): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n AlgebraicType.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): AlgebraicType {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n AlgebraicType.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default AlgebraicType;\n","import { AlgebraicType } from './algebraic_type';\nimport { TimeDuration, type TimeDurationAlgebraicType } from './time_duration';\nimport { Timestamp, type TimestampAlgebraicType } from './timestamp';\n\nexport type ScheduleAtAlgebraicType = {\n tag: 'Sum';\n value: {\n variants: [\n { name: 'Interval'; algebraicType: TimeDurationAlgebraicType },\n { name: 'Time'; algebraicType: TimestampAlgebraicType },\n ];\n };\n};\n\ntype ScheduleAtType = Interval | Time;\n\nexport const ScheduleAt: {\n interval: (micros: bigint) => ScheduleAtType;\n time: (microsSinceUnixEpoch: bigint) => ScheduleAtType;\n /**\n * Get the algebraic type representation of the {@link ScheduleAt} type.\n * @returns The algebraic type representation of the type.\n */\n getAlgebraicType(): ScheduleAtAlgebraicType;\n} = {\n interval(value: bigint): ScheduleAtType {\n return Interval(value);\n },\n time(value: bigint): ScheduleAtType {\n return Time(value);\n },\n getAlgebraicType(): ScheduleAtAlgebraicType {\n return AlgebraicType.Sum({\n variants: [\n {\n name: 'Interval',\n algebraicType: TimeDuration.getAlgebraicType(),\n },\n { name: 'Time', algebraicType: Timestamp.getAlgebraicType() },\n ],\n });\n },\n};\n\nexport type Interval = {\n tag: 'Interval';\n value: TimeDuration;\n};\nexport const Interval = (micros: bigint): Interval => ({\n tag: 'Interval',\n value: new TimeDuration(micros),\n});\nexport type Time = {\n tag: 'Time';\n value: Timestamp;\n};\nexport const Time = (microsSinceUnixEpoch: bigint): Time => ({\n tag: 'Time',\n value: new Timestamp(microsSinceUnixEpoch),\n});\n\nexport default ScheduleAt;\nexport type ScheduleAt = ScheduleAtType;\n","import { TimeDuration } from './time_duration';\nimport { Timestamp } from './timestamp';\nimport { ConnectionId } from './connection_id';\nimport type BinaryReader from './binary_reader';\nimport BinaryWriter from './binary_writer';\nimport { Identity } from './identity';\nimport { Option } from './option';\nimport {\n AlgebraicType as AlgebraicTypeType,\n AlgebraicType as AlgebraicTypeValue,\n} from './autogen/algebraic_type_type';\nimport {\n type ProductType as ProductTypeType,\n ProductType as ProductTypeValue,\n} from './autogen/product_type_type';\nimport {\n type SumType as SumTypeType,\n SumType as SumTypeValue,\n} from './autogen/sum_type_type';\nimport ScheduleAt from './schedule_at';\nimport type Typespace from './autogen/typespace_type';\n\n/**\n * A factor / element of a product type.\n *\n * An element consist of an optional name and a type.\n *\n * NOTE: Each element has an implicit element tag based on its order.\n * Uniquely identifies an element similarly to protobuf tags.\n */\nexport * from './autogen/product_type_element_type';\n\n/**\n * A variant of a sum type.\n *\n * NOTE: Each element has an implicit element tag based on its order.\n * Uniquely identifies an element similarly to protobuf tags.\n */\nexport * from './autogen/sum_type_variant_type';\n\n/**\n * The variant types of the Algebraic Type tagged union.\n */\nexport type * as AlgebraicTypeVariants from './autogen/algebraic_type_variants';\n\n/**\n * The SpacetimeDB Algebraic Type System (SATS) is a structural type system in\n * which a nominal type system can be constructed.\n *\n * The type system unifies the concepts sum types, product types, and built-in\n * primitive types into a single type system.\n */\nexport type AlgebraicType = AlgebraicTypeType;\n\n/**\n * Algebraic Type utilities.\n */\nexport const AlgebraicType: {\n Sum<T extends SumType>(value: T): { tag: 'Sum'; value: T };\n Product<T extends ProductType>(value: T): { tag: 'Product'; value: T };\n Array<T extends AlgebraicType>(value: T): { tag: 'Array'; value: T };\n\n createOptionType(innerType: AlgebraicTypeType): AlgebraicTypeType;\n createIdentityType(): AlgebraicTypeType;\n createConnectionIdType(): AlgebraicTypeType;\n createScheduleAtType(): AlgebraicTypeType;\n createTimestampType(): AlgebraicTypeType;\n createTimeDurationType(): AlgebraicTypeType;\n serializeValue(\n writer: BinaryWriter,\n ty: AlgebraicTypeType,\n value: any,\n typespace?: Typespace\n ): void;\n deserializeValue(\n reader: BinaryReader,\n ty: AlgebraicTypeType,\n typespace?: Typespace\n ): any;\n /**\n * Convert a value of the algebraic type into something that can be used as a key in a map.\n * There are no guarantees about being able to order it.\n * This is only guaranteed to be comparable to other values of the same type.\n * @param value A value of the algebraic type\n * @returns Something that can be used as a key in a map.\n */\n intoMapKey(ty: AlgebraicTypeType, value: any): ComparablePrimitive;\n} & typeof AlgebraicTypeValue = {\n ...AlgebraicTypeValue,\n Sum: <T extends SumType>(value: T): { tag: 'Sum'; value: T } => ({\n tag: 'Sum',\n value,\n }),\n Product: <T extends ProductType>(value: T): { tag: 'Product'; value: T } => ({\n tag: 'Product',\n value,\n }),\n Array: <T extends AlgebraicType>(value: T): { tag: 'Array'; value: T } => ({\n tag: 'Array',\n value,\n }),\n createOptionType: function (innerType: AlgebraicTypeType): AlgebraicTypeType {\n return Option.getAlgebraicType(innerType);\n },\n createIdentityType: function (): AlgebraicTypeType {\n return Identity.getAlgebraicType();\n },\n createConnectionIdType: function (): AlgebraicTypeType {\n return ConnectionId.getAlgebraicType();\n },\n createScheduleAtType: function (): AlgebraicTypeType {\n return ScheduleAt.getAlgebraicType();\n },\n createTimestampType: function (): AlgebraicTypeType {\n return Timestamp.getAlgebraicType();\n },\n createTimeDurationType: function (): AlgebraicTypeType {\n return TimeDuration.getAlgebraicType();\n },\n serializeValue: function (\n writer: BinaryWriter,\n ty: AlgebraicTypeType,\n value: any,\n typespace?: Typespace\n ): void {\n if (ty.tag === 'Ref') {\n if (!typespace)\n throw new Error('cannot serialize refs without a typespace');\n while (ty.tag === 'Ref') ty = typespace.types[ty.value];\n }\n switch (ty.tag) {\n case 'Product':\n ProductType.serializeValue(writer, ty.value, value, typespace);\n break;\n case 'Sum':\n SumType.serializeValue(writer, ty.value, value, typespace);\n break;\n case 'Array':\n if (ty.value.tag === 'U8') {\n writer.writeUInt8Array(value);\n } else {\n const elemType = ty.value;\n writer.writeU32(value.length);\n for (const elem of value) {\n AlgebraicType.serializeValue(writer, elemType, elem, typespace);\n }\n }\n break;\n case 'Bool':\n writer.writeBool(value);\n break;\n case 'I8':\n writer.writeI8(value);\n break;\n case 'U8':\n writer.writeU8(value);\n break;\n case 'I16':\n writer.writeI16(value);\n break;\n case 'U16':\n writer.writeU16(value);\n break;\n case 'I32':\n writer.writeI32(value);\n break;\n case 'U32':\n writer.writeU32(value);\n break;\n case 'I64':\n writer.writeI64(value);\n break;\n case 'U64':\n writer.writeU64(value);\n break;\n case 'I128':\n writer.writeI128(value);\n break;\n case 'U128':\n writer.writeU128(value);\n break;\n case 'I256':\n writer.writeI256(value);\n break;\n case 'U256':\n writer.writeU256(value);\n break;\n case 'F32':\n writer.writeF32(value);\n break;\n case 'F64':\n writer.writeF64(value);\n break;\n case 'String':\n writer.writeString(value);\n break;\n }\n },\n deserializeValue: function (\n reader: BinaryReader,\n ty: AlgebraicTypeType,\n typespace?: Typespace\n ): any {\n if (ty.tag === 'Ref') {\n if (!typespace)\n throw new Error('cannot deserialize refs without a typespace');\n while (ty.tag === 'Ref') ty = typespace.types[ty.value];\n }\n switch (ty.tag) {\n case 'Product':\n return ProductType.deserializeValue(reader, ty.value, typespace);\n case 'Sum':\n return SumType.deserializeValue(reader, ty.value, typespace);\n case 'Array':\n if (ty.value.tag === 'U8') {\n return reader.readUInt8Array();\n } else {\n const elemType = ty.value;\n const length = reader.readU32();\n const result: any[] = [];\n for (let i = 0; i < length; i++) {\n result.push(\n AlgebraicType.deserializeValue(reader, elemType, typespace)\n );\n }\n return result;\n }\n case 'Bool':\n return reader.readBool();\n case 'I8':\n return reader.readI8();\n case 'U8':\n return reader.readU8();\n case 'I16':\n return reader.readI16();\n case 'U16':\n return reader.readU16();\n case 'I32':\n return reader.readI32();\n case 'U32':\n return reader.readU32();\n case 'I64':\n return reader.readI64();\n case 'U64':\n return reader.readU64();\n case 'I128':\n return reader.readI128();\n case 'U128':\n return reader.readU128();\n case 'I256':\n return reader.readI256();\n case 'U256':\n return reader.readU256();\n case 'F32':\n return reader.readF32();\n case 'F64':\n return reader.readF64();\n case 'String':\n return reader.readString();\n }\n },\n /**\n * Convert a value of the algebraic type into something that can be used as a key in a map.\n * There are no guarantees about being able to order it.\n * This is only guaranteed to be comparable to other values of the same type.\n * @param value A value of the algebraic type\n * @returns Something that can be used as a key in a map.\n */\n intoMapKey: function (\n ty: AlgebraicTypeType,\n value: any\n ): ComparablePrimitive {\n switch (ty.tag) {\n case 'U8':\n case 'U16':\n case 'U32':\n case 'U64':\n case 'U128':\n case 'U256':\n case 'I8':\n case 'I16':\n case 'I32':\n case 'I64':\n case 'I128':\n case 'I256':\n case 'F32':\n case 'F64':\n case 'String':\n case 'Bool':\n return value;\n case 'Product':\n return ProductType.intoMapKey(ty.value, value);\n default: {\n // The fallback is to serialize and base64 encode the bytes.\n const writer = new BinaryWriter(10);\n AlgebraicType.serializeValue(writer, ty, value);\n return writer.toBase64();\n }\n }\n },\n};\n\n/**\n * A structural product type of the factors given by `elements`.\n *\n * This is also known as `struct` and `tuple` in many languages,\n * but note that unlike most languages, products in SATs are *[structural]* and not nominal.\n * When checking whether two nominal types are the same,\n * their names and/or declaration sites (e.g., module / namespace) are considered.\n * Meanwhile, a structural type system would only check the structure of the type itself,\n * e.g., the names of its fields and their types in the case of a record.\n * The name \"product\" comes from category theory.\n *\n * See also: https://ncatlab.org/nlab/show/product+type.\n *\n * These structures are known as product types because the number of possible values in product\n * ```ignore\n * { N_0: T_0, N_1: T_1, ..., N_n: T_n }\n * ```\n * is:\n * ```ignore\n * Π (i ∈ 0..n). values(T_i)\n * ```\n * so for example, `values({ A: U64, B: Bool }) = values(U64) * values(Bool)`.\n *\n * [structural]: https://en.wikipedia.org/wiki/Structural_type_system\n */\nexport type ProductType = ProductTypeType;\n\nexport const ProductType: {\n serializeValue(\n writer: BinaryWriter,\n ty: ProductTypeType,\n value: any,\n typespace?: Typespace\n ): void;\n deserializeValue(\n reader: BinaryReader,\n ty: ProductTypeType,\n typespace?: Typespace\n ): any;\n intoMapKey(ty: ProductTypeType, value: any): ComparablePrimitive;\n} = {\n ...ProductTypeValue,\n serializeValue(\n writer: BinaryWriter,\n ty: ProductTypeType,\n value: any,\n typespace?: Typespace\n ): void {\n for (const element of ty.elements) {\n AlgebraicType.serializeValue(\n writer,\n element.algebraicType,\n value[element.name!],\n typespace\n );\n }\n },\n deserializeValue(\n reader: BinaryReader,\n ty: ProductTypeType,\n typespace?: Typespace\n ): any {\n const result: { [key: string]: any } = {};\n if (ty.elements.length === 1) {\n if (ty.elements[0].name === '__time_duration_micros__') {\n return new TimeDuration(reader.readI64());\n }\n\n if (ty.elements[0].name === '__timestamp_micros_since_unix_epoch__') {\n return new Timestamp(reader.readI64());\n }\n\n if (ty.elements[0].name === '__identity__') {\n return new Identity(reader.readU256());\n }\n\n if (ty.elements[0].name === '__connection_id__') {\n return new ConnectionId(reader.readU128());\n }\n }\n\n for (const element of ty.elements) {\n result[element.name!] = AlgebraicType.deserializeValue(\n reader,\n element.algebraicType,\n typespace\n );\n }\n return result;\n },\n intoMapKey(ty: ProductTypeType, value: any): ComparablePrimitive {\n if (ty.elements.length === 1) {\n if (ty.elements[0].name === '__time_duration_micros__') {\n return (value as TimeDuration).__time_duration_micros__;\n }\n\n if (ty.elements[0].name === '__timestamp_micros_since_unix_epoch__') {\n return (value as Timestamp).__timestamp_micros_since_unix_epoch__;\n }\n\n if (ty.elements[0].name === '__identity__') {\n return (value as Identity).__identity__;\n }\n\n if (ty.elements[0].name === '__connection_id__') {\n return (value as ConnectionId).__connection_id__;\n }\n }\n // The fallback is to serialize and base64 encode the bytes.\n const writer = new BinaryWriter(10);\n AlgebraicType.serializeValue(writer, AlgebraicType.Product(ty), value);\n return writer.toBase64();\n },\n};\n\nexport type SumType = SumTypeType;\n\n/**\n * Unlike most languages, sums in SATS are *[structural]* and not nominal.\n * When checking whether two nominal types are the same,\n * their names and/or declaration sites (e.g., module / namespace) are considered.\n * Meanwhile, a structural type system would only check the structure of the type itself,\n * e.g., the names of its variants and their inner data types in the case of a sum.\n *\n * This is also known as a discriminated union (implementation) or disjoint union.\n * Another name is [coproduct (category theory)](https://ncatlab.org/nlab/show/coproduct).\n *\n * These structures are known as sum types because the number of possible values a sum\n * ```ignore\n * { N_0(T_0), N_1(T_1), ..., N_n(T_n) }\n * ```\n * is:\n * ```ignore\n * Σ (i ∈ 0..n). values(T_i)\n * ```\n * so for example, `values({ A(U64), B(Bool) }) = values(U64) + values(Bool)`.\n *\n * See also: https://ncatlab.org/nlab/show/sum+type.\n *\n * [structural]: https://en.wikipedia.org/wiki/Structural_type_system\n */\nexport const SumType: {\n serializeValue(\n writer: BinaryWriter,\n ty: SumTypeType,\n value: any,\n typespace?: Typespace\n ): void;\n deserializeValue(\n reader: BinaryReader,\n ty: SumTypeType,\n typespace?: Typespace\n ): any;\n} = {\n ...SumTypeValue,\n serializeValue: function (\n writer: BinaryWriter,\n ty: SumTypeType,\n value: any,\n typespace?: Typespace\n ): void {\n if (\n ty.variants.length == 2 &&\n ty.variants[0].name === 'some' &&\n ty.variants[1].name === 'none'\n ) {\n if (value !== null && value !== undefined) {\n writer.writeByte(0);\n AlgebraicType.serializeValue(\n writer,\n ty.variants[0].algebraicType,\n value,\n typespace\n );\n } else {\n writer.writeByte(1);\n }\n } else {\n const variant = value['tag'];\n const index = ty.variants.findIndex(v => v.name === variant);\n if (index < 0) {\n throw `Can't serialize a sum type, couldn't find ${value.tag} tag`;\n }\n writer.writeU8(index);\n AlgebraicType.serializeValue(\n writer,\n ty.variants[index].algebraicType,\n value['value'],\n typespace\n );\n }\n },\n deserializeValue: function (\n reader: BinaryReader,\n ty: SumTypeType,\n typespace?: Typespace\n ): any {\n const tag = reader.readU8();\n // In TypeScript we handle Option values as a special case\n // we don't represent the some and none variants, but instead\n // we represent the value directly.\n if (\n ty.variants.length == 2 &&\n ty.variants[0].name === 'some' &&\n ty.variants[1].name === 'none'\n ) {\n if (tag === 0) {\n return AlgebraicType.deserializeValue(\n reader,\n ty.variants[0].algebraicType,\n typespace\n );\n } else if (tag === 1) {\n return undefined;\n } else {\n throw `Can't deserialize an option type, couldn't find ${tag} tag`;\n }\n } else {\n const variant = ty.variants[tag];\n const value = AlgebraicType.deserializeValue(\n reader,\n variant.algebraicType,\n typespace\n );\n return { tag: variant.name, value };\n }\n },\n};\n\nexport type ComparablePrimitive = number | string | boolean | bigint;\n","import { AlgebraicType } from './algebraic_type';\nimport { hexStringToU128, u128ToHexString, u128ToUint8Array } from './utils';\n\nexport type ConnectionIdAlgebraicType = {\n tag: 'Product';\n value: {\n elements: [{ name: '__connection_id__'; algebraicType: { tag: 'U128' } }];\n };\n};\n\n/**\n * A unique identifier for a client connected to a database.\n */\nexport class ConnectionId {\n __connection_id__: bigint;\n\n /**\n * Creates a new `ConnectionId`.\n */\n constructor(data: bigint) {\n this.__connection_id__ = data;\n }\n\n /**\n * Get the algebraic type representation of the {@link ConnectionId} type.\n * @returns The algebraic type representation of the type.\n */\n static getAlgebraicType(): ConnectionIdAlgebraicType {\n return AlgebraicType.Product({\n elements: [\n { name: '__connection_id__', algebraicType: AlgebraicType.U128 },\n ],\n });\n }\n\n isZero(): boolean {\n return this.__connection_id__ === BigInt(0);\n }\n\n static nullIfZero(addr: ConnectionId): ConnectionId | null {\n if (addr.isZero()) {\n return null;\n } else {\n return addr;\n }\n }\n\n static random(): ConnectionId {\n function randomU8(): number {\n return Math.floor(Math.random() * 0xff);\n }\n let result = BigInt(0);\n for (let i = 0; i < 16; i++) {\n result = (result << BigInt(8)) | BigInt(randomU8());\n }\n return new ConnectionId(result);\n }\n\n /**\n * Compare two connection IDs for equality.\n */\n isEqual(other: ConnectionId): boolean {\n return this.__connection_id__ == other.__connection_id__;\n }\n\n /**\n * Print the connection ID as a hexadecimal string.\n */\n toHexString(): string {\n return u128ToHexString(this.__connection_id__);\n }\n\n /**\n * Convert the connection ID to a Uint8Array.\n */\n toUint8Array(): Uint8Array {\n return u128ToUint8Array(this.__connection_id__);\n }\n\n /**\n * Parse a connection ID from a hexadecimal string.\n */\n static fromString(str: string): ConnectionId {\n return new ConnectionId(hexStringToU128(str));\n }\n\n static fromStringOrNull(str: string): ConnectionId | null {\n const addr = ConnectionId.fromString(str);\n if (addr.isZero()) {\n return null;\n } else {\n return addr;\n }\n }\n}\n","import BinaryReader from './binary_reader';\n\nexport interface ParseableType<T> {\n deserialize: (reader: BinaryReader) => T;\n}\n\nexport function parseValue<T>(ty: ParseableType<T>, src: Uint8Array): T {\n const reader = new BinaryReader(src);\n return ty.deserialize(reader);\n}\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport * as RowSizeHintVariants from './row_size_hint_variants';\n\n// The tagged union or sum type for the algebraic type `RowSizeHint`.\nexport type RowSizeHint =\n | RowSizeHintVariants.FixedSize\n | RowSizeHintVariants.RowOffsets;\n\nlet _cached_RowSizeHint_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const RowSizeHint = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n FixedSize: (value: number): RowSizeHintVariants.FixedSize => ({\n tag: 'FixedSize',\n value,\n }),\n RowOffsets: (value: bigint[]): RowSizeHintVariants.RowOffsets => ({\n tag: 'RowOffsets',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_RowSizeHint_type_value) return _cached_RowSizeHint_type_value;\n _cached_RowSizeHint_type_value = __AlgebraicTypeValue.Sum({ variants: [] });\n _cached_RowSizeHint_type_value.value.variants.push(\n { name: 'FixedSize', algebraicType: __AlgebraicTypeValue.U16 },\n {\n name: 'RowOffsets',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U64),\n }\n );\n return _cached_RowSizeHint_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: RowSizeHint): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n RowSizeHint.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): RowSizeHint {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n RowSizeHint.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default RowSizeHint;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { RowSizeHint } from './row_size_hint_type';\n// Mark import as potentially unused\ndeclare type __keep_RowSizeHint = RowSizeHint;\n\nexport type BsatnRowList = {\n sizeHint: RowSizeHint;\n rowsData: Uint8Array;\n};\nlet _cached_BsatnRowList_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const BsatnRowList = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_BsatnRowList_type_value) return _cached_BsatnRowList_type_value;\n _cached_BsatnRowList_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_BsatnRowList_type_value.value.elements.push(\n {\n name: 'sizeHint',\n algebraicType: RowSizeHint.getTypeScriptAlgebraicType(),\n },\n {\n name: 'rowsData',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n }\n );\n return _cached_BsatnRowList_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: BsatnRowList): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n BsatnRowList.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): BsatnRowList {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n BsatnRowList.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default BsatnRowList;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type CallReducer = {\n reducer: string;\n args: Uint8Array;\n requestId: number;\n flags: number;\n};\nlet _cached_CallReducer_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const CallReducer = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_CallReducer_type_value) return _cached_CallReducer_type_value;\n _cached_CallReducer_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_CallReducer_type_value.value.elements.push(\n { name: 'reducer', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'args',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'flags', algebraicType: __AlgebraicTypeValue.U8 }\n );\n return _cached_CallReducer_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: CallReducer): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n CallReducer.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): CallReducer {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n CallReducer.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default CallReducer;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type Subscribe = {\n queryStrings: string[];\n requestId: number;\n};\nlet _cached_Subscribe_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const Subscribe = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_Subscribe_type_value) return _cached_Subscribe_type_value;\n _cached_Subscribe_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_Subscribe_type_value.value.elements.push(\n {\n name: 'queryStrings',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.String),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 }\n );\n return _cached_Subscribe_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: Subscribe): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n Subscribe.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): Subscribe {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n Subscribe.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default Subscribe;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type OneOffQuery = {\n messageId: Uint8Array;\n queryString: string;\n};\nlet _cached_OneOffQuery_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const OneOffQuery = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_OneOffQuery_type_value) return _cached_OneOffQuery_type_value;\n _cached_OneOffQuery_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_OneOffQuery_type_value.value.elements.push(\n {\n name: 'messageId',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n { name: 'queryString', algebraicType: __AlgebraicTypeValue.String }\n );\n return _cached_OneOffQuery_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: OneOffQuery): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n OneOffQuery.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): OneOffQuery {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n OneOffQuery.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default OneOffQuery;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type QueryId = {\n id: number;\n};\nlet _cached_QueryId_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const QueryId = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_QueryId_type_value) return _cached_QueryId_type_value;\n _cached_QueryId_type_value = __AlgebraicTypeValue.Product({ elements: [] });\n _cached_QueryId_type_value.value.elements.push({\n name: 'id',\n algebraicType: __AlgebraicTypeValue.U32,\n });\n return _cached_QueryId_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: QueryId): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n QueryId.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): QueryId {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n QueryId.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default QueryId;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type SubscribeSingle = {\n query: string;\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_SubscribeSingle_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeSingle = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeSingle_type_value)\n return _cached_SubscribeSingle_type_value;\n _cached_SubscribeSingle_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeSingle_type_value.value.elements.push(\n { name: 'query', algebraicType: __AlgebraicTypeValue.String },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_SubscribeSingle_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeSingle): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeSingle.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeSingle {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeSingle.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeSingle;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type SubscribeMulti = {\n queryStrings: string[];\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_SubscribeMulti_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeMulti = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeMulti_type_value)\n return _cached_SubscribeMulti_type_value;\n _cached_SubscribeMulti_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeMulti_type_value.value.elements.push(\n {\n name: 'queryStrings',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.String),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_SubscribeMulti_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeMulti): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeMulti.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeMulti {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeMulti.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeMulti;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type Unsubscribe = {\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_Unsubscribe_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const Unsubscribe = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_Unsubscribe_type_value) return _cached_Unsubscribe_type_value;\n _cached_Unsubscribe_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_Unsubscribe_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_Unsubscribe_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: Unsubscribe): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n Unsubscribe.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): Unsubscribe {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n Unsubscribe.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default Unsubscribe;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\n\nexport type UnsubscribeMulti = {\n requestId: number;\n queryId: QueryId;\n};\nlet _cached_UnsubscribeMulti_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const UnsubscribeMulti = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UnsubscribeMulti_type_value)\n return _cached_UnsubscribeMulti_type_value;\n _cached_UnsubscribeMulti_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_UnsubscribeMulti_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() }\n );\n return _cached_UnsubscribeMulti_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UnsubscribeMulti): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UnsubscribeMulti.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UnsubscribeMulti {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UnsubscribeMulti.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UnsubscribeMulti;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { CallReducer } from './call_reducer_type';\n// Mark import as potentially unused\ndeclare type __keep_CallReducer = CallReducer;\nimport { Subscribe } from './subscribe_type';\n// Mark import as potentially unused\ndeclare type __keep_Subscribe = Subscribe;\nimport { OneOffQuery } from './one_off_query_type';\n// Mark import as potentially unused\ndeclare type __keep_OneOffQuery = OneOffQuery;\nimport { SubscribeSingle } from './subscribe_single_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeSingle = SubscribeSingle;\nimport { SubscribeMulti } from './subscribe_multi_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeMulti = SubscribeMulti;\nimport { Unsubscribe } from './unsubscribe_type';\n// Mark import as potentially unused\ndeclare type __keep_Unsubscribe = Unsubscribe;\nimport { UnsubscribeMulti } from './unsubscribe_multi_type';\n// Mark import as potentially unused\ndeclare type __keep_UnsubscribeMulti = UnsubscribeMulti;\n\nimport * as ClientMessageVariants from './client_message_variants';\n\n// The tagged union or sum type for the algebraic type `ClientMessage`.\nexport type ClientMessage =\n | ClientMessageVariants.CallReducer\n | ClientMessageVariants.Subscribe\n | ClientMessageVariants.OneOffQuery\n | ClientMessageVariants.SubscribeSingle\n | ClientMessageVariants.SubscribeMulti\n | ClientMessageVariants.Unsubscribe\n | ClientMessageVariants.UnsubscribeMulti;\n\nlet _cached_ClientMessage_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const ClientMessage = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n CallReducer: (value: CallReducer): ClientMessageVariants.CallReducer => ({\n tag: 'CallReducer',\n value,\n }),\n Subscribe: (value: Subscribe): ClientMessageVariants.Subscribe => ({\n tag: 'Subscribe',\n value,\n }),\n OneOffQuery: (value: OneOffQuery): ClientMessageVariants.OneOffQuery => ({\n tag: 'OneOffQuery',\n value,\n }),\n SubscribeSingle: (\n value: SubscribeSingle\n ): ClientMessageVariants.SubscribeSingle => ({\n tag: 'SubscribeSingle',\n value,\n }),\n SubscribeMulti: (\n value: SubscribeMulti\n ): ClientMessageVariants.SubscribeMulti => ({ tag: 'SubscribeMulti', value }),\n Unsubscribe: (value: Unsubscribe): ClientMessageVariants.Unsubscribe => ({\n tag: 'Unsubscribe',\n value,\n }),\n UnsubscribeMulti: (\n value: UnsubscribeMulti\n ): ClientMessageVariants.UnsubscribeMulti => ({\n tag: 'UnsubscribeMulti',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ClientMessage_type_value)\n return _cached_ClientMessage_type_value;\n _cached_ClientMessage_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_ClientMessage_type_value.value.variants.push(\n {\n name: 'CallReducer',\n algebraicType: CallReducer.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Subscribe',\n algebraicType: Subscribe.getTypeScriptAlgebraicType(),\n },\n {\n name: 'OneOffQuery',\n algebraicType: OneOffQuery.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeSingle',\n algebraicType: SubscribeSingle.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeMulti',\n algebraicType: SubscribeMulti.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Unsubscribe',\n algebraicType: Unsubscribe.getTypeScriptAlgebraicType(),\n },\n {\n name: 'UnsubscribeMulti',\n algebraicType: UnsubscribeMulti.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_ClientMessage_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ClientMessage): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ClientMessage.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ClientMessage {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ClientMessage.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ClientMessage;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { BsatnRowList } from './bsatn_row_list_type';\n// Mark import as potentially unused\ndeclare type __keep_BsatnRowList = BsatnRowList;\n\nexport type QueryUpdate = {\n deletes: BsatnRowList;\n inserts: BsatnRowList;\n};\nlet _cached_QueryUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const QueryUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_QueryUpdate_type_value) return _cached_QueryUpdate_type_value;\n _cached_QueryUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_QueryUpdate_type_value.value.elements.push(\n {\n name: 'deletes',\n algebraicType: BsatnRowList.getTypeScriptAlgebraicType(),\n },\n {\n name: 'inserts',\n algebraicType: BsatnRowList.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_QueryUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: QueryUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n QueryUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): QueryUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n QueryUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default QueryUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryUpdate } from './query_update_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryUpdate = QueryUpdate;\n\nimport * as CompressableQueryUpdateVariants from './compressable_query_update_variants';\n\n// The tagged union or sum type for the algebraic type `CompressableQueryUpdate`.\nexport type CompressableQueryUpdate =\n | CompressableQueryUpdateVariants.Uncompressed\n | CompressableQueryUpdateVariants.Brotli\n | CompressableQueryUpdateVariants.Gzip;\n\nlet _cached_CompressableQueryUpdate_type_value: __AlgebraicTypeType | null =\n null;\n\n// A value with helper functions to construct the type.\nexport const CompressableQueryUpdate = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n Uncompressed: (\n value: QueryUpdate\n ): CompressableQueryUpdateVariants.Uncompressed => ({\n tag: 'Uncompressed',\n value,\n }),\n Brotli: (value: Uint8Array): CompressableQueryUpdateVariants.Brotli => ({\n tag: 'Brotli',\n value,\n }),\n Gzip: (value: Uint8Array): CompressableQueryUpdateVariants.Gzip => ({\n tag: 'Gzip',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_CompressableQueryUpdate_type_value)\n return _cached_CompressableQueryUpdate_type_value;\n _cached_CompressableQueryUpdate_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_CompressableQueryUpdate_type_value.value.variants.push(\n {\n name: 'Uncompressed',\n algebraicType: QueryUpdate.getTypeScriptAlgebraicType(),\n },\n {\n name: 'Brotli',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n {\n name: 'Gzip',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n }\n );\n return _cached_CompressableQueryUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: CompressableQueryUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n CompressableQueryUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): CompressableQueryUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n CompressableQueryUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default CompressableQueryUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { CompressableQueryUpdate } from './compressable_query_update_type';\n// Mark import as potentially unused\ndeclare type __keep_CompressableQueryUpdate = CompressableQueryUpdate;\n\nexport type TableUpdate = {\n tableId: number;\n tableName: string;\n numRows: bigint;\n updates: CompressableQueryUpdate[];\n};\nlet _cached_TableUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const TableUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_TableUpdate_type_value) return _cached_TableUpdate_type_value;\n _cached_TableUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_TableUpdate_type_value.value.elements.push(\n { name: 'tableId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'tableName', algebraicType: __AlgebraicTypeValue.String },\n { name: 'numRows', algebraicType: __AlgebraicTypeValue.U64 },\n {\n name: 'updates',\n algebraicType: __AlgebraicTypeValue.Array(\n CompressableQueryUpdate.getTypeScriptAlgebraicType()\n ),\n }\n );\n return _cached_TableUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: TableUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n TableUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): TableUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n TableUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default TableUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { TableUpdate } from './table_update_type';\n// Mark import as potentially unused\ndeclare type __keep_TableUpdate = TableUpdate;\n\nexport type DatabaseUpdate = {\n tables: TableUpdate[];\n};\nlet _cached_DatabaseUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const DatabaseUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_DatabaseUpdate_type_value)\n return _cached_DatabaseUpdate_type_value;\n _cached_DatabaseUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_DatabaseUpdate_type_value.value.elements.push({\n name: 'tables',\n algebraicType: __AlgebraicTypeValue.Array(\n TableUpdate.getTypeScriptAlgebraicType()\n ),\n });\n return _cached_DatabaseUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: DatabaseUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n DatabaseUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): DatabaseUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n DatabaseUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default DatabaseUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type InitialSubscription = {\n databaseUpdate: DatabaseUpdate;\n requestId: number;\n totalHostExecutionDuration: __TimeDuration;\n};\nlet _cached_InitialSubscription_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const InitialSubscription = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_InitialSubscription_type_value)\n return _cached_InitialSubscription_type_value;\n _cached_InitialSubscription_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_InitialSubscription_type_value.value.elements.push(\n {\n name: 'databaseUpdate',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDuration',\n algebraicType: __AlgebraicTypeValue.createTimeDurationType(),\n }\n );\n return _cached_InitialSubscription_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: InitialSubscription): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n InitialSubscription.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): InitialSubscription {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n InitialSubscription.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default InitialSubscription;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nimport * as UpdateStatusVariants from './update_status_variants';\n\n// The tagged union or sum type for the algebraic type `UpdateStatus`.\nexport type UpdateStatus =\n | UpdateStatusVariants.Committed\n | UpdateStatusVariants.Failed\n | UpdateStatusVariants.OutOfEnergy;\n\nlet _cached_UpdateStatus_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const UpdateStatus = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n Committed: (value: DatabaseUpdate): UpdateStatusVariants.Committed => ({\n tag: 'Committed',\n value,\n }),\n Failed: (value: string): UpdateStatusVariants.Failed => ({\n tag: 'Failed',\n value,\n }),\n OutOfEnergy: { tag: 'OutOfEnergy' } as const,\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UpdateStatus_type_value) return _cached_UpdateStatus_type_value;\n _cached_UpdateStatus_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_UpdateStatus_type_value.value.variants.push(\n {\n name: 'Committed',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n },\n { name: 'Failed', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'OutOfEnergy',\n algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),\n }\n );\n return _cached_UpdateStatus_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UpdateStatus): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UpdateStatus.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UpdateStatus {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UpdateStatus.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UpdateStatus;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type ReducerCallInfo = {\n reducerName: string;\n reducerId: number;\n args: Uint8Array;\n requestId: number;\n};\nlet _cached_ReducerCallInfo_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const ReducerCallInfo = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ReducerCallInfo_type_value)\n return _cached_ReducerCallInfo_type_value;\n _cached_ReducerCallInfo_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_ReducerCallInfo_type_value.value.elements.push(\n { name: 'reducerName', algebraicType: __AlgebraicTypeValue.String },\n { name: 'reducerId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'args',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 }\n );\n return _cached_ReducerCallInfo_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ReducerCallInfo): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ReducerCallInfo.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ReducerCallInfo {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ReducerCallInfo.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ReducerCallInfo;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type EnergyQuanta = {\n quanta: bigint;\n};\nlet _cached_EnergyQuanta_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const EnergyQuanta = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_EnergyQuanta_type_value) return _cached_EnergyQuanta_type_value;\n _cached_EnergyQuanta_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_EnergyQuanta_type_value.value.elements.push({\n name: 'quanta',\n algebraicType: __AlgebraicTypeValue.U128,\n });\n return _cached_EnergyQuanta_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: EnergyQuanta): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n EnergyQuanta.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): EnergyQuanta {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n EnergyQuanta.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default EnergyQuanta;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { UpdateStatus } from './update_status_type';\n// Mark import as potentially unused\ndeclare type __keep_UpdateStatus = UpdateStatus;\nimport { ReducerCallInfo } from './reducer_call_info_type';\n// Mark import as potentially unused\ndeclare type __keep_ReducerCallInfo = ReducerCallInfo;\nimport { EnergyQuanta } from './energy_quanta_type';\n// Mark import as potentially unused\ndeclare type __keep_EnergyQuanta = EnergyQuanta;\n\nexport type TransactionUpdate = {\n status: UpdateStatus;\n timestamp: __Timestamp;\n callerIdentity: __Identity;\n callerConnectionId: __ConnectionId;\n reducerCall: ReducerCallInfo;\n energyQuantaUsed: EnergyQuanta;\n totalHostExecutionDuration: __TimeDuration;\n};\nlet _cached_TransactionUpdate_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const TransactionUpdate = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_TransactionUpdate_type_value)\n return _cached_TransactionUpdate_type_value;\n _cached_TransactionUpdate_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_TransactionUpdate_type_value.value.elements.push(\n {\n name: 'status',\n algebraicType: UpdateStatus.getTypeScriptAlgebraicType(),\n },\n {\n name: 'timestamp',\n algebraicType: __AlgebraicTypeValue.createTimestampType(),\n },\n {\n name: 'callerIdentity',\n algebraicType: __AlgebraicTypeValue.createIdentityType(),\n },\n {\n name: 'callerConnectionId',\n algebraicType: __AlgebraicTypeValue.createConnectionIdType(),\n },\n {\n name: 'reducerCall',\n algebraicType: ReducerCallInfo.getTypeScriptAlgebraicType(),\n },\n {\n name: 'energyQuantaUsed',\n algebraicType: EnergyQuanta.getTypeScriptAlgebraicType(),\n },\n {\n name: 'totalHostExecutionDuration',\n algebraicType: __AlgebraicTypeValue.createTimeDurationType(),\n }\n );\n return _cached_TransactionUpdate_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: TransactionUpdate): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n TransactionUpdate.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): TransactionUpdate {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n TransactionUpdate.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default TransactionUpdate;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type TransactionUpdateLight = {\n requestId: number;\n update: DatabaseUpdate;\n};\nlet _cached_TransactionUpdateLight_type_value: __AlgebraicTypeType | null =\n null;\n\n/**\n * An object for generated helper functions.\n */\nexport const TransactionUpdateLight = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_TransactionUpdateLight_type_value)\n return _cached_TransactionUpdateLight_type_value;\n _cached_TransactionUpdateLight_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_TransactionUpdateLight_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'update',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_TransactionUpdateLight_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: TransactionUpdateLight): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n TransactionUpdateLight.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): TransactionUpdateLight {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n TransactionUpdateLight.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default TransactionUpdateLight;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type IdentityToken = {\n identity: __Identity;\n token: string;\n connectionId: __ConnectionId;\n};\nlet _cached_IdentityToken_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const IdentityToken = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_IdentityToken_type_value)\n return _cached_IdentityToken_type_value;\n _cached_IdentityToken_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_IdentityToken_type_value.value.elements.push(\n {\n name: 'identity',\n algebraicType: __AlgebraicTypeValue.createIdentityType(),\n },\n { name: 'token', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'connectionId',\n algebraicType: __AlgebraicTypeValue.createConnectionIdType(),\n }\n );\n return _cached_IdentityToken_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: IdentityToken): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n IdentityToken.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): IdentityToken {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n IdentityToken.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default IdentityToken;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { BsatnRowList } from './bsatn_row_list_type';\n// Mark import as potentially unused\ndeclare type __keep_BsatnRowList = BsatnRowList;\n\nexport type OneOffTable = {\n tableName: string;\n rows: BsatnRowList;\n};\nlet _cached_OneOffTable_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const OneOffTable = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_OneOffTable_type_value) return _cached_OneOffTable_type_value;\n _cached_OneOffTable_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_OneOffTable_type_value.value.elements.push(\n { name: 'tableName', algebraicType: __AlgebraicTypeValue.String },\n { name: 'rows', algebraicType: BsatnRowList.getTypeScriptAlgebraicType() }\n );\n return _cached_OneOffTable_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: OneOffTable): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n OneOffTable.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): OneOffTable {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n OneOffTable.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default OneOffTable;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { OneOffTable } from './one_off_table_type';\n// Mark import as potentially unused\ndeclare type __keep_OneOffTable = OneOffTable;\n\nexport type OneOffQueryResponse = {\n messageId: Uint8Array;\n error: string | undefined;\n tables: OneOffTable[];\n totalHostExecutionDuration: __TimeDuration;\n};\nlet _cached_OneOffQueryResponse_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const OneOffQueryResponse = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_OneOffQueryResponse_type_value)\n return _cached_OneOffQueryResponse_type_value;\n _cached_OneOffQueryResponse_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_OneOffQueryResponse_type_value.value.elements.push(\n {\n name: 'messageId',\n algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),\n },\n {\n name: 'error',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.String\n ),\n },\n {\n name: 'tables',\n algebraicType: __AlgebraicTypeValue.Array(\n OneOffTable.getTypeScriptAlgebraicType()\n ),\n },\n {\n name: 'totalHostExecutionDuration',\n algebraicType: __AlgebraicTypeValue.createTimeDurationType(),\n }\n );\n return _cached_OneOffQueryResponse_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: OneOffQueryResponse): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n OneOffQueryResponse.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): OneOffQueryResponse {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n OneOffQueryResponse.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default OneOffQueryResponse;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { TableUpdate } from './table_update_type';\n// Mark import as potentially unused\ndeclare type __keep_TableUpdate = TableUpdate;\n\nexport type SubscribeRows = {\n tableId: number;\n tableName: string;\n tableRows: TableUpdate;\n};\nlet _cached_SubscribeRows_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeRows = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeRows_type_value)\n return _cached_SubscribeRows_type_value;\n _cached_SubscribeRows_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeRows_type_value.value.elements.push(\n { name: 'tableId', algebraicType: __AlgebraicTypeValue.U32 },\n { name: 'tableName', algebraicType: __AlgebraicTypeValue.String },\n {\n name: 'tableRows',\n algebraicType: TableUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SubscribeRows_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeRows): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeRows.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeRows {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeRows.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeRows;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { SubscribeRows } from './subscribe_rows_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeRows = SubscribeRows;\n\nexport type SubscribeApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n rows: SubscribeRows;\n};\nlet _cached_SubscribeApplied_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeApplied_type_value)\n return _cached_SubscribeApplied_type_value;\n _cached_SubscribeApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'rows',\n algebraicType: SubscribeRows.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SubscribeApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { SubscribeRows } from './subscribe_rows_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeRows = SubscribeRows;\n\nexport type UnsubscribeApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n rows: SubscribeRows;\n};\nlet _cached_UnsubscribeApplied_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const UnsubscribeApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UnsubscribeApplied_type_value)\n return _cached_UnsubscribeApplied_type_value;\n _cached_UnsubscribeApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_UnsubscribeApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'rows',\n algebraicType: SubscribeRows.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_UnsubscribeApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UnsubscribeApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UnsubscribeApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UnsubscribeApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UnsubscribeApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UnsubscribeApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\n\nexport type SubscriptionError = {\n totalHostExecutionDurationMicros: bigint;\n requestId: number | undefined;\n queryId: number | undefined;\n tableId: number | undefined;\n error: string;\n};\nlet _cached_SubscriptionError_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscriptionError = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscriptionError_type_value)\n return _cached_SubscriptionError_type_value;\n _cached_SubscriptionError_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscriptionError_type_value.value.elements.push(\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n {\n name: 'requestId',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.U32\n ),\n },\n {\n name: 'queryId',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.U32\n ),\n },\n {\n name: 'tableId',\n algebraicType: __AlgebraicTypeValue.createOptionType(\n __AlgebraicTypeValue.U32\n ),\n },\n { name: 'error', algebraicType: __AlgebraicTypeValue.String }\n );\n return _cached_SubscriptionError_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscriptionError): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscriptionError.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscriptionError {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscriptionError.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscriptionError;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type SubscribeMultiApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n update: DatabaseUpdate;\n};\nlet _cached_SubscribeMultiApplied_type_value: __AlgebraicTypeType | null = null;\n\n/**\n * An object for generated helper functions.\n */\nexport const SubscribeMultiApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_SubscribeMultiApplied_type_value)\n return _cached_SubscribeMultiApplied_type_value;\n _cached_SubscribeMultiApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_SubscribeMultiApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'update',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_SubscribeMultiApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: SubscribeMultiApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n SubscribeMultiApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): SubscribeMultiApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n SubscribeMultiApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default SubscribeMultiApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { QueryId } from './query_id_type';\n// Mark import as potentially unused\ndeclare type __keep_QueryId = QueryId;\nimport { DatabaseUpdate } from './database_update_type';\n// Mark import as potentially unused\ndeclare type __keep_DatabaseUpdate = DatabaseUpdate;\n\nexport type UnsubscribeMultiApplied = {\n requestId: number;\n totalHostExecutionDurationMicros: bigint;\n queryId: QueryId;\n update: DatabaseUpdate;\n};\nlet _cached_UnsubscribeMultiApplied_type_value: __AlgebraicTypeType | null =\n null;\n\n/**\n * An object for generated helper functions.\n */\nexport const UnsubscribeMultiApplied = {\n /**\n * A function which returns this type represented as an AlgebraicType.\n * This function is derived from the AlgebraicType used to generate this type.\n */\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_UnsubscribeMultiApplied_type_value)\n return _cached_UnsubscribeMultiApplied_type_value;\n _cached_UnsubscribeMultiApplied_type_value = __AlgebraicTypeValue.Product({\n elements: [],\n });\n _cached_UnsubscribeMultiApplied_type_value.value.elements.push(\n { name: 'requestId', algebraicType: __AlgebraicTypeValue.U32 },\n {\n name: 'totalHostExecutionDurationMicros',\n algebraicType: __AlgebraicTypeValue.U64,\n },\n { name: 'queryId', algebraicType: QueryId.getTypeScriptAlgebraicType() },\n {\n name: 'update',\n algebraicType: DatabaseUpdate.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_UnsubscribeMultiApplied_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: UnsubscribeMultiApplied): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n UnsubscribeMultiApplied.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): UnsubscribeMultiApplied {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n UnsubscribeMultiApplied.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default UnsubscribeMultiApplied;\n","// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE\n// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.\n\n/* eslint-disable */\n/* tslint:disable */\nimport {\n AlgebraicType as __AlgebraicTypeValue,\n BinaryReader as __BinaryReader,\n BinaryWriter as __BinaryWriter,\n ClientCache as __ClientCache,\n ConnectionId as __ConnectionId,\n DbConnectionBuilder as __DbConnectionBuilder,\n DbConnectionImpl as __DbConnectionImpl,\n Identity as __Identity,\n SubscriptionBuilderImpl as __SubscriptionBuilderImpl,\n TableCache as __TableCache,\n TimeDuration as __TimeDuration,\n Timestamp as __Timestamp,\n deepEqual as __deepEqual,\n type AlgebraicType as __AlgebraicTypeType,\n type AlgebraicTypeVariants as __AlgebraicTypeVariants,\n type CallReducerFlags as __CallReducerFlags,\n type ErrorContextInterface as __ErrorContextInterface,\n type Event as __Event,\n type EventContextInterface as __EventContextInterface,\n type ReducerEventContextInterface as __ReducerEventContextInterface,\n type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,\n type TableHandle as __TableHandle,\n} from '../../index';\nimport { InitialSubscription } from './initial_subscription_type';\n// Mark import as potentially unused\ndeclare type __keep_InitialSubscription = InitialSubscription;\nimport { TransactionUpdate } from './transaction_update_type';\n// Mark import as potentially unused\ndeclare type __keep_TransactionUpdate = TransactionUpdate;\nimport { TransactionUpdateLight } from './transaction_update_light_type';\n// Mark import as potentially unused\ndeclare type __keep_TransactionUpdateLight = TransactionUpdateLight;\nimport { IdentityToken } from './identity_token_type';\n// Mark import as potentially unused\ndeclare type __keep_IdentityToken = IdentityToken;\nimport { OneOffQueryResponse } from './one_off_query_response_type';\n// Mark import as potentially unused\ndeclare type __keep_OneOffQueryResponse = OneOffQueryResponse;\nimport { SubscribeApplied } from './subscribe_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeApplied = SubscribeApplied;\nimport { UnsubscribeApplied } from './unsubscribe_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_UnsubscribeApplied = UnsubscribeApplied;\nimport { SubscriptionError } from './subscription_error_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscriptionError = SubscriptionError;\nimport { SubscribeMultiApplied } from './subscribe_multi_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_SubscribeMultiApplied = SubscribeMultiApplied;\nimport { UnsubscribeMultiApplied } from './unsubscribe_multi_applied_type';\n// Mark import as potentially unused\ndeclare type __keep_UnsubscribeMultiApplied = UnsubscribeMultiApplied;\n\nimport * as ServerMessageVariants from './server_message_variants';\n\n// The tagged union or sum type for the algebraic type `ServerMessage`.\nexport type ServerMessage =\n | ServerMessageVariants.InitialSubscription\n | ServerMessageVariants.TransactionUpdate\n | ServerMessageVariants.TransactionUpdateLight\n | ServerMessageVariants.IdentityToken\n | ServerMessageVariants.OneOffQueryResponse\n | ServerMessageVariants.SubscribeApplied\n | ServerMessageVariants.UnsubscribeApplied\n | ServerMessageVariants.SubscriptionError\n | ServerMessageVariants.SubscribeMultiApplied\n | ServerMessageVariants.UnsubscribeMultiApplied;\n\nlet _cached_ServerMessage_type_value: __AlgebraicTypeType | null = null;\n\n// A value with helper functions to construct the type.\nexport const ServerMessage = {\n // Helper functions for constructing each variant of the tagged union.\n // ```\n // const foo = Foo.A(42);\n // assert!(foo.tag === \"A\");\n // assert!(foo.value === 42);\n // ```\n InitialSubscription: (\n value: InitialSubscription\n ): ServerMessageVariants.InitialSubscription => ({\n tag: 'InitialSubscription',\n value,\n }),\n TransactionUpdate: (\n value: TransactionUpdate\n ): ServerMessageVariants.TransactionUpdate => ({\n tag: 'TransactionUpdate',\n value,\n }),\n TransactionUpdateLight: (\n value: TransactionUpdateLight\n ): ServerMessageVariants.TransactionUpdateLight => ({\n tag: 'TransactionUpdateLight',\n value,\n }),\n IdentityToken: (\n value: IdentityToken\n ): ServerMessageVariants.IdentityToken => ({ tag: 'IdentityToken', value }),\n OneOffQueryResponse: (\n value: OneOffQueryResponse\n ): ServerMessageVariants.OneOffQueryResponse => ({\n tag: 'OneOffQueryResponse',\n value,\n }),\n SubscribeApplied: (\n value: SubscribeApplied\n ): ServerMessageVariants.SubscribeApplied => ({\n tag: 'SubscribeApplied',\n value,\n }),\n UnsubscribeApplied: (\n value: UnsubscribeApplied\n ): ServerMessageVariants.UnsubscribeApplied => ({\n tag: 'UnsubscribeApplied',\n value,\n }),\n SubscriptionError: (\n value: SubscriptionError\n ): ServerMessageVariants.SubscriptionError => ({\n tag: 'SubscriptionError',\n value,\n }),\n SubscribeMultiApplied: (\n value: SubscribeMultiApplied\n ): ServerMessageVariants.SubscribeMultiApplied => ({\n tag: 'SubscribeMultiApplied',\n value,\n }),\n UnsubscribeMultiApplied: (\n value: UnsubscribeMultiApplied\n ): ServerMessageVariants.UnsubscribeMultiApplied => ({\n tag: 'UnsubscribeMultiApplied',\n value,\n }),\n\n getTypeScriptAlgebraicType(): __AlgebraicTypeType {\n if (_cached_ServerMessage_type_value)\n return _cached_ServerMessage_type_value;\n _cached_ServerMessage_type_value = __AlgebraicTypeValue.Sum({\n variants: [],\n });\n _cached_ServerMessage_type_value.value.variants.push(\n {\n name: 'InitialSubscription',\n algebraicType: InitialSubscription.getTypeScriptAlgebraicType(),\n },\n {\n name: 'TransactionUpdate',\n algebraicType: TransactionUpdate.getTypeScriptAlgebraicType(),\n },\n {\n name: 'TransactionUpdateLight',\n algebraicType: TransactionUpdateLight.getTypeScriptAlgebraicType(),\n },\n {\n name: 'IdentityToken',\n algebraicType: IdentityToken.getTypeScriptAlgebraicType(),\n },\n {\n name: 'OneOffQueryResponse',\n algebraicType: OneOffQueryResponse.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeApplied',\n algebraicType: SubscribeApplied.getTypeScriptAlgebraicType(),\n },\n {\n name: 'UnsubscribeApplied',\n algebraicType: UnsubscribeApplied.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscriptionError',\n algebraicType: SubscriptionError.getTypeScriptAlgebraicType(),\n },\n {\n name: 'SubscribeMultiApplied',\n algebraicType: SubscribeMultiApplied.getTypeScriptAlgebraicType(),\n },\n {\n name: 'UnsubscribeMultiApplied',\n algebraicType: UnsubscribeMultiApplied.getTypeScriptAlgebraicType(),\n }\n );\n return _cached_ServerMessage_type_value;\n },\n\n serialize(writer: __BinaryWriter, value: ServerMessage): void {\n __AlgebraicTypeValue.serializeValue(\n writer,\n ServerMessage.getTypeScriptAlgebraicType(),\n value\n );\n },\n\n deserialize(reader: __BinaryReader): ServerMessage {\n return __AlgebraicTypeValue.deserializeValue(\n reader,\n ServerMessage.getTypeScriptAlgebraicType()\n );\n },\n};\n\nexport default ServerMessage;\n","// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport class EventEmitter<Key, Callback extends Function = Function> {\n #events: Map<Key, Set<Callback>> = new Map();\n\n on(event: Key, callback: Callback): void {\n let callbacks = this.#events.get(event);\n if (!callbacks) {\n callbacks = new Set();\n this.#events.set(event, callbacks);\n }\n callbacks.add(callback);\n }\n\n off(event: Key, callback: Callback): void {\n const callbacks = this.#events.get(event);\n if (!callbacks) {\n return;\n }\n callbacks.delete(callback);\n }\n\n emit(event: Key, ...args: any[]): void {\n const callbacks = this.#events.get(event);\n if (!callbacks) {\n return;\n }\n\n for (const callback of callbacks) {\n callback(...args);\n }\n }\n}\n","type LogLevel = 'info' | 'warn' | 'error' | 'debug';\n\nconst LogLevelIdentifierIcon = {\n component: '📦',\n info: 'ℹ️',\n warn: '⚠️',\n error: '❌',\n debug: '🐛',\n};\n\nconst LogStyle = {\n component:\n 'color: #fff; background-color: #8D6FDD; padding: 2px 5px; border-radius: 3px;',\n info: 'color: #fff; background-color: #007bff; padding: 2px 5px; border-radius: 3px;',\n warn: 'color: #fff; background-color: #ffc107; padding: 2px 5px; border-radius: 3px;',\n error:\n 'color: #fff; background-color: #dc3545; padding: 2px 5px; border-radius: 3px;',\n debug:\n 'color: #fff; background-color: #28a745; padding: 2px 5px; border-radius: 3px;',\n};\n\nconst LogTextStyle = {\n component: 'color: #8D6FDD;',\n info: 'color: #007bff;',\n warn: 'color: #ffc107;',\n error: 'color: #dc3545;',\n debug: 'color: #28a745;',\n};\n\nexport const stdbLogger = (level: LogLevel, message: any): void => {\n console.log(\n `%c${LogLevelIdentifierIcon[level]} ${level.toUpperCase()}%c ${message}`,\n LogStyle[level],\n LogTextStyle[level]\n );\n};\n","import { EventEmitter } from './event_emitter.ts';\nimport type { TableRuntimeTypeInfo } from './spacetime_module.ts';\n\nimport { stdbLogger } from './logger.ts';\nimport type { ComparablePrimitive } from '../';\nimport type { EventContextInterface } from './index.ts';\n\nexport type Operation<\n RowType extends Record<string, any> = Record<string, any>,\n> = {\n type: 'insert' | 'delete';\n // For tables with a primary key, this is the primary key value, as a primitive or string.\n // Otherwise, it is an encoding of the full row.\n rowId: ComparablePrimitive;\n row: RowType;\n};\n\nexport type TableUpdate<\n RowType extends Record<string, any> = Record<string, any>,\n> = {\n tableName: string;\n operations: Operation<RowType>[];\n};\n\nexport type PendingCallback = {\n type: 'insert' | 'delete' | 'update';\n table: string;\n cb: () => void;\n};\n/**\n * Builder to generate calls to query a `table` in the database\n */\nexport class TableCache<\n RowType extends Record<string, any> = Record<string, any>,\n> {\n private rows: Map<ComparablePrimitive, [RowType, number]>;\n private tableTypeInfo: TableRuntimeTypeInfo;\n private emitter: EventEmitter<'insert' | 'delete' | 'update'>;\n\n /**\n * @param name the table name\n * @param primaryKeyCol column index designated as `#[primarykey]`\n * @param primaryKey column name designated as `#[primarykey]`\n * @param entityClass the entityClass\n */\n constructor(tableTypeInfo: TableRuntimeTypeInfo) {\n this.tableTypeInfo = tableTypeInfo;\n this.rows = new Map();\n this.emitter = new EventEmitter();\n }\n\n /**\n * @returns number of rows in the table\n */\n count(): number {\n return this.rows.size;\n }\n\n /**\n * @returns The values of the rows in the table\n */\n iter(): RowType[] {\n return Array.from(this.rows.values()).map(([row]) => row);\n }\n\n applyOperations = (\n operations: Operation<RowType>[],\n ctx: EventContextInterface\n ): PendingCallback[] => {\n const pendingCallbacks: PendingCallback[] = [];\n if (this.tableTypeInfo.primaryKeyInfo !== undefined) {\n const insertMap = new Map<\n ComparablePrimitive,\n [Operation<RowType>, number]\n >();\n const deleteMap = new Map<\n ComparablePrimitive,\n [Operation<RowType>, number]\n >();\n for (const op of operations) {\n if (op.type === 'insert') {\n const [_, prevCount] = insertMap.get(op.rowId) || [op, 0];\n insertMap.set(op.rowId, [op, prevCount + 1]);\n } else {\n const [_, prevCount] = deleteMap.get(op.rowId) || [op, 0];\n deleteMap.set(op.rowId, [op, prevCount + 1]);\n }\n }\n for (const [primaryKey, [insertOp, refCount]] of insertMap) {\n const deleteEntry = deleteMap.get(primaryKey);\n if (deleteEntry) {\n const [_, deleteCount] = deleteEntry;\n // In most cases the refCountDelta will be either 0 or refCount, but if\n // an update moves a row in or out of the result set of different queries, then\n // other deltas are possible.\n const refCountDelta = refCount - deleteCount;\n const maybeCb = this.update(\n ctx,\n primaryKey,\n insertOp.row,\n refCountDelta\n );\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n deleteMap.delete(primaryKey);\n } else {\n const maybeCb = this.insert(ctx, insertOp, refCount);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n }\n }\n for (const [deleteOp, refCount] of deleteMap.values()) {\n const maybeCb = this.delete(ctx, deleteOp, refCount);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n }\n } else {\n for (const op of operations) {\n if (op.type === 'insert') {\n const maybeCb = this.insert(ctx, op);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n } else {\n const maybeCb = this.delete(ctx, op);\n if (maybeCb) {\n pendingCallbacks.push(maybeCb);\n }\n }\n }\n }\n return pendingCallbacks;\n };\n\n update = (\n ctx: EventContextInterface,\n rowId: ComparablePrimitive,\n newRow: RowType,\n refCountDelta: number = 0\n ): PendingCallback | undefined => {\n const existingEntry = this.rows.get(rowId);\n if (!existingEntry) {\n // TODO: this should throw an error and kill the connection.\n stdbLogger(\n 'error',\n `Updating a row that was not present in the cache. Table: ${this.tableTypeInfo.tableName}, RowId: ${rowId}`\n );\n return undefined;\n }\n const [oldRow, previousCount] = existingEntry;\n const refCount = Math.max(1, previousCount + refCountDelta);\n if (previousCount + refCountDelta <= 0) {\n stdbLogger(\n 'error',\n `Negative reference count for in table ${this.tableTypeInfo.tableName} row ${rowId} (${previousCount} + ${refCountDelta})`\n );\n return undefined;\n }\n this.rows.set(rowId, [newRow, refCount]);\n // This indicates something is wrong, so we could arguably crash here.\n if (previousCount === 0) {\n stdbLogger(\n 'error',\n `Updating a row id in table ${this.tableTypeInfo.tableName} which was not present in the cache (rowId: ${rowId})`\n );\n return {\n type: 'insert',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('insert', ctx, newRow);\n },\n };\n }\n return {\n type: 'update',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('update', ctx, oldRow, newRow);\n },\n };\n };\n\n insert = (\n ctx: EventContextInterface,\n operation: Operation<RowType>,\n count: number = 1\n ): PendingCallback | undefined => {\n const [_, previousCount] = this.rows.get(operation.rowId) || [\n operation.row,\n 0,\n ];\n this.rows.set(operation.rowId, [operation.row, previousCount + count]);\n if (previousCount === 0) {\n return {\n type: 'insert',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('insert', ctx, operation.row);\n },\n };\n }\n // It's possible to get a duplicate insert because rows can be returned from multiple queries.\n return undefined;\n };\n\n delete = (\n ctx: EventContextInterface,\n operation: Operation<RowType>,\n count: number = 1\n ): PendingCallback | undefined => {\n const [_, previousCount] = this.rows.get(operation.rowId) || [\n operation.row,\n 0,\n ];\n // This should never happen.\n if (previousCount === 0) {\n stdbLogger('warn', 'Deleting a row that was not present in the cache');\n return undefined;\n }\n // If this was the last reference, we are actually deleting the row.\n if (previousCount <= count) {\n // TODO: Log a warning/error if previousCount is less than count.\n this.rows.delete(operation.rowId);\n return {\n type: 'delete',\n table: this.tableTypeInfo.tableName,\n cb: () => {\n this.emitter.emit('delete', ctx, operation.row);\n },\n };\n }\n this.rows.set(operation.rowId, [operation.row, previousCount - count]);\n return undefined;\n };\n\n /**\n * Register a callback for when a row is newly inserted into the database.\n *\n * ```ts\n * User.onInsert((user, reducerEvent) => {\n * if (reducerEvent) {\n * console.log(\"New user on reducer\", reducerEvent, user);\n * } else {\n * console.log(\"New user received during subscription update on insert\", user);\n * }\n * });\n * ```\n *\n * @param cb Callback to be called when a new row is inserted\n */\n onInsert = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.on('insert', cb);\n };\n\n /**\n * Register a callback for when a row is deleted from the database.\n *\n * ```ts\n * User.onDelete((user, reducerEvent) => {\n * if (reducerEvent) {\n * console.log(\"Deleted user on reducer\", reducerEvent, user);\n * } else {\n * console.log(\"Deleted user received during subscription update on update\", user);\n * }\n * });\n * ```\n *\n * @param cb Callback to be called when a new row is inserted\n */\n onDelete = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.on('delete', cb);\n };\n\n /**\n * Register a callback for when a row is updated into the database.\n *\n * ```ts\n * User.onInsert((user, reducerEvent) => {\n * if (reducerEvent) {\n * console.log(\"Updated user on reducer\", reducerEvent, user);\n * } else {\n * console.log(\"Updated user received during subscription update on delete\", user);\n * }\n * });\n * ```\n *\n * @param cb Callback to be called when a new row is inserted\n */\n onUpdate = <EventContext>(\n cb: (ctx: EventContext, oldRow: RowType, row: RowType) => void\n ): void => {\n this.emitter.on('update', cb);\n };\n\n /**\n * Remove a callback for when a row is newly inserted into the database.\n *\n * @param cb Callback to be removed\n */\n removeOnInsert = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.off('insert', cb);\n };\n\n /**\n * Remove a callback for when a row is deleted from the database.\n *\n * @param cb Callback to be removed\n */\n removeOnDelete = <EventContext>(\n cb: (ctx: EventContext, row: RowType) => void\n ): void => {\n this.emitter.off('delete', cb);\n };\n\n /**\n * Remove a callback for when a row is updated into the database.\n *\n * @param cb Callback to be removed\n */\n removeOnUpdate = <EventContext>(\n cb: (ctx: EventContext, oldRow: RowType, row: RowType) => void\n ): void => {\n this.emitter.off('update', cb);\n };\n}\n","import type { TableRuntimeTypeInfo } from './spacetime_module.ts';\nimport { TableCache } from './table_cache.ts';\n\nexport class ClientCache {\n /**\n * The tables in the database.\n */\n tables: Map<string, TableCache<any>>;\n\n constructor() {\n this.tables = new Map();\n }\n\n /**\n * Returns the table with the given name.\n * @param name The name of the table.\n * @returns The table\n */\n getTable<RowType extends Record<string, any>>(\n name: string\n ): TableCache<RowType> {\n const table = this.tables.get(name);\n\n // ! This should not happen as the table should be available but an exception is thrown just in case.\n if (!table) {\n console.error(\n 'The table has not been registered for this client. Please register the table before using it. If you have registered global tables using the SpacetimeDBClient.registerTables() or `registerTable()` method, please make sure that is executed first!'\n );\n throw new Error(`Table ${name} does not exist`);\n }\n\n return table;\n }\n\n getOrCreateTable<RowType extends Record<string, any>>(\n tableTypeInfo: TableRuntimeTypeInfo\n ): TableCache<RowType> {\n let table: TableCache<RowType>;\n if (!this.tables.has(tableTypeInfo.tableName)) {\n table = new TableCache<RowType>(tableTypeInfo);\n this.tables.set(tableTypeInfo.tableName, table);\n } else {\n table = this.tables.get(tableTypeInfo.tableName)!;\n }\n return table;\n }\n}\n","export type PrereleaseId = string | number;\n\nexport type PreRelease = PrereleaseId[];\n\n// Compare pre-release identifiers according to the semver spec (https://semver.org/#spec-item-11).\nfunction comparePreReleases(a: PreRelease, b: PreRelease): number {\n const len = Math.min(a.length, b.length);\n for (let i = 0; i < len; i++) {\n const aPart = a[i];\n const bPart = b[i];\n if (aPart === bPart) continue;\n if (typeof aPart === 'number' && typeof bPart === 'number') {\n return aPart - bPart;\n }\n if (typeof aPart === 'string' && typeof bPart === 'string') {\n return aPart.localeCompare(bPart);\n }\n // According to item 11.4.3, numeric identifiers always have lower precedence than non-numeric identifiers.\n // So if `a` is a string, it has higher precedence than `b`.\n return typeof aPart === 'string' ? 1 : -1;\n }\n // See rule 11.4.4 in the semver spec.\n return a.length - b.length;\n}\n\n// We don't use these, and they don't matter for version ordering, so I'm not going to parse it to spec.\nexport type BuildInfo = string;\n\n// This is exported for tests.\nexport class SemanticVersion {\n major: number;\n minor: number;\n patch: number;\n preRelease: PreRelease | null;\n buildInfo: BuildInfo | null;\n\n constructor(\n major: number,\n minor: number,\n patch: number,\n preRelease: PreRelease | null = null,\n buildInfo: BuildInfo | null = null\n ) {\n this.major = major;\n this.minor = minor;\n this.patch = patch;\n this.preRelease = preRelease;\n this.buildInfo = buildInfo;\n }\n\n toString(): string {\n let versionString = `${this.major}.${this.minor}.${this.patch}`;\n if (this.preRelease) {\n versionString += `-${this.preRelease.join('.')}`;\n }\n if (this.buildInfo) {\n versionString += `+${this.buildInfo}`;\n }\n return versionString;\n }\n\n compare(other: SemanticVersion): number {\n if (this.major !== other.major) {\n return this.major - other.major;\n }\n if (this.minor !== other.minor) {\n return this.minor - other.minor;\n }\n if (this.patch !== other.patch) {\n return this.patch - other.patch;\n }\n if (this.preRelease && other.preRelease) {\n return comparePreReleases(this.preRelease, other.preRelease);\n }\n if (this.preRelease) {\n return -1; // The version without a pre-release is greater.\n }\n if (other.preRelease) {\n return -1; // Since we don't have a pre-release, this version is greater.\n }\n return 0; // versions are equal\n }\n\n clone(): SemanticVersion {\n return new SemanticVersion(\n this.major,\n this.minor,\n this.patch,\n this.preRelease ? [...this.preRelease] : null,\n this.buildInfo\n );\n }\n\n static parseVersionString(version: string): SemanticVersion {\n const regex =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-([\\da-zA-Z-]+(?:\\.[\\da-zA-Z-]+)*))?(?:\\+([\\da-zA-Z-]+(?:\\.[\\da-zA-Z-]+)*))?$/;\n const match = version.match(regex);\n if (!match) {\n throw new Error(`Invalid version string: ${version}`);\n }\n\n const major = parseInt(match[1], 10);\n const minor = parseInt(match[2], 10);\n const patch = parseInt(match[3], 10);\n const preRelease = match[4]\n ? match[4].split('.').map(id => (isNaN(Number(id)) ? id : Number(id)))\n : null;\n const buildInfo = match[5] || null;\n\n return new SemanticVersion(major, minor, patch, preRelease, buildInfo);\n }\n}\n\n// The SDK depends on some module information that was not generated before this version.\nexport const _MINIMUM_CLI_VERSION: SemanticVersion = new SemanticVersion(\n 1,\n 4,\n 0\n);\n\nexport function ensureMinimumVersionOrThrow(versionString?: string): void {\n if (versionString === undefined) {\n throw new Error(versionErrorMessage(versionString));\n }\n const version = SemanticVersion.parseVersionString(versionString);\n if (version.compare(_MINIMUM_CLI_VERSION) < 0) {\n throw new Error(versionErrorMessage(versionString));\n }\n}\n\nfunction versionErrorMessage(incompatibleVersion?: string): string {\n return `Module code was generated with an incompatible version of the spacetimedb cli (${incompatibleVersion}). Update the cli version to at least ${_MINIMUM_CLI_VERSION.toString()} and regenerate the bindings. You can upgrade to the latest cli version by running: spacetime version upgrade`;\n}\n","export async function decompress(\n buffer: Uint8Array,\n // Leaving it here to expand to brotli when it lands in the browsers and NodeJS\n type: 'gzip',\n chunkSize: number = 128 * 1024 // 128KB\n): Promise<Uint8Array> {\n // Create a single ReadableStream to handle chunks\n let offset = 0;\n const readableStream = new ReadableStream({\n pull(controller) {\n if (offset < buffer.length) {\n // Slice a chunk of the buffer and enqueue it\n const chunk = buffer.subarray(\n offset,\n Math.min(offset + chunkSize, buffer.length)\n );\n controller.enqueue(chunk);\n offset += chunkSize;\n } else {\n controller.close();\n }\n },\n });\n\n // Create a single DecompressionStream\n const decompressionStream = new DecompressionStream(type);\n\n // Pipe the ReadableStream through the DecompressionStream\n const decompressedStream = readableStream.pipeThrough(decompressionStream);\n\n // Collect the decompressed chunks efficiently\n const reader = decompressedStream.getReader();\n const chunks: Uint8Array[] = [];\n let totalLength = 0;\n let result: any;\n\n while (!(result = await reader.read()).done) {\n chunks.push(result.value);\n totalLength += result.value.length;\n }\n\n // Allocate a single Uint8Array for the decompressed data\n const decompressedArray = new Uint8Array(totalLength);\n let chunkOffset = 0;\n\n for (const chunk of chunks) {\n decompressedArray.set(chunk, chunkOffset);\n chunkOffset += chunk.length;\n }\n\n return decompressedArray;\n}\n","export async function resolveWS(): Promise<typeof WebSocket> {\n // Browser or Node >= 22 (or any env that exposes global WebSocket)\n if (typeof (globalThis as any).WebSocket !== 'undefined') {\n return (globalThis as any).WebSocket as typeof WebSocket;\n }\n\n // Node without a global WebSocket: lazily load undici's polyfill.\n // Use an unstatable dynamic import so bundlers don't prebundle it.\n const dynamicImport = new Function('m', 'return import(m)') as (\n m: string\n ) => Promise<any>;\n\n try {\n const { WebSocket: UndiciWS } = await dynamicImport('undici');\n return UndiciWS as unknown as typeof WebSocket;\n } catch (err) {\n console.warn(\n '[spacetimedb-sdk] No global WebSocket found. ' +\n 'On Node 18–21, please install `undici` (npm install undici) ' +\n 'to enable WebSocket support.'\n );\n throw err;\n }\n}\n","import { decompress } from './decompress';\nimport { resolveWS } from './ws';\n\nexport class WebsocketDecompressAdapter {\n onclose?: (...ev: any[]) => void;\n onopen?: (...ev: any[]) => void;\n onmessage?: (msg: { data: Uint8Array }) => void;\n onerror?: (msg: ErrorEvent) => void;\n\n #ws: WebSocket;\n\n async #handleOnMessage(msg: MessageEvent) {\n const buffer = new Uint8Array(msg.data);\n let decompressed: Uint8Array;\n\n if (buffer[0] === 0) {\n decompressed = buffer.slice(1);\n } else if (buffer[0] === 1) {\n throw new Error(\n 'Brotli Compression not supported. Please use gzip or none compression in withCompression method on DbConnection.'\n );\n } else if (buffer[0] === 2) {\n decompressed = await decompress(buffer.slice(1), 'gzip');\n } else {\n throw new Error(\n 'Unexpected Compression Algorithm. Please use `gzip` or `none`'\n );\n }\n\n this.onmessage?.({ data: decompressed });\n }\n\n #handleOnOpen(msg: any) {\n this.onopen?.(msg);\n }\n\n #handleOnError(msg: any) {\n this.onerror?.(msg);\n }\n\n #handleOnClose(msg: any) {\n this.onclose?.(msg);\n }\n\n send(msg: any): void {\n this.#ws.send(msg);\n }\n\n close(): void {\n this.#ws.close();\n }\n\n constructor(ws: WebSocket) {\n this.onmessage = undefined;\n this.onopen = undefined;\n this.onmessage = undefined;\n this.onerror = undefined;\n\n ws.onmessage = this.#handleOnMessage.bind(this);\n ws.onerror = this.#handleOnError.bind(this);\n ws.onclose = this.#handleOnClose.bind(this);\n ws.onopen = this.#handleOnOpen.bind(this);\n\n ws.binaryType = 'arraybuffer';\n\n this.#ws = ws;\n }\n\n static async createWebSocketFn({\n url,\n nameOrAddress,\n wsProtocol,\n authToken,\n compression,\n lightMode,\n confirmedReads,\n }: {\n url: URL;\n wsProtocol: string;\n nameOrAddress: string;\n authToken?: string;\n compression: 'gzip' | 'none';\n lightMode: boolean;\n confirmedReads?: boolean;\n }): Promise<WebsocketDecompressAdapter> {\n const headers = new Headers();\n\n const WS = await resolveWS();\n\n // We swap our original token to a shorter-lived token\n // to avoid sending the original via query params.\n let temporaryAuthToken: string | undefined = undefined;\n if (authToken) {\n headers.set('Authorization', `Bearer ${authToken}`);\n const tokenUrl = new URL('v1/identity/websocket-token', url);\n tokenUrl.protocol = url.protocol === 'wss:' ? 'https:' : 'http:';\n\n const response = await fetch(tokenUrl, { method: 'POST', headers });\n if (response.ok) {\n const { token } = await response.json();\n temporaryAuthToken = token;\n } else {\n return Promise.reject(\n new Error(`Failed to verify token: ${response.statusText}`)\n );\n }\n }\n\n const databaseUrl = new URL(`v1/database/${nameOrAddress}/subscribe`, url);\n if (temporaryAuthToken) {\n databaseUrl.searchParams.set('token', temporaryAuthToken);\n }\n databaseUrl.searchParams.set(\n 'compression',\n compression === 'gzip' ? 'Gzip' : 'None'\n );\n if (lightMode) {\n databaseUrl.searchParams.set('light', 'true');\n }\n if (confirmedReads !== undefined) {\n databaseUrl.searchParams.set('confirmed', confirmedReads.toString());\n }\n\n const ws = new WS(databaseUrl.toString(), wsProtocol);\n\n return new WebsocketDecompressAdapter(ws);\n }\n}\n","import { DbConnectionImpl, type ConnectionEvent } from './db_connection_impl';\nimport { EventEmitter } from './event_emitter';\nimport type { Identity } from '../';\nimport type RemoteModule from './spacetime_module';\nimport { ensureMinimumVersionOrThrow } from './version';\nimport { WebsocketDecompressAdapter } from './websocket_decompress_adapter';\n\n/**\n * The database client connection to a SpacetimeDB server.\n */\nexport class DbConnectionBuilder<\n DbConnection,\n ErrorContext,\n _SubscriptionEventContext,\n> {\n #uri?: URL;\n #nameOrAddress?: string;\n #identity?: Identity;\n #token?: string;\n #emitter: EventEmitter<ConnectionEvent> = new EventEmitter();\n #compression: 'gzip' | 'none' = 'gzip';\n #lightMode: boolean = false;\n #confirmedReads?: boolean;\n #createWSFn: typeof WebsocketDecompressAdapter.createWebSocketFn;\n\n /**\n * Creates a new `DbConnectionBuilder` database client and set the initial parameters.\n *\n * Users are not expected to call this constructor directly. Instead, use the static method `DbConnection.builder()`.\n *\n * @param remoteModule The remote module to use to connect to the SpacetimeDB server.\n * @param dbConnectionConstructor The constructor to use to create a new `DbConnection`.\n */\n constructor(\n private remoteModule: RemoteModule,\n private dbConnectionConstructor: (imp: DbConnectionImpl) => DbConnection\n ) {\n this.#createWSFn = WebsocketDecompressAdapter.createWebSocketFn;\n }\n\n /**\n * Set the URI of the SpacetimeDB server to connect to.\n *\n * @param uri The URI of the SpacetimeDB server to connect to.\n *\n **/\n withUri(uri: string | URL): this {\n this.#uri = new URL(uri);\n return this;\n }\n\n /**\n * Set the name or Identity of the database module to connect to.\n *\n * @param nameOrAddress\n *\n * @returns The `DbConnectionBuilder` instance.\n */\n withModuleName(nameOrAddress: string): this {\n this.#nameOrAddress = nameOrAddress;\n return this;\n }\n\n /**\n * Set the identity of the client to connect to the database.\n *\n * @param token The credentials to use to authenticate with SpacetimeDB. This\n * is optional. You can store the token returned by the `onConnect` callback\n * to use in future connections.\n *\n * @returns The `DbConnectionBuilder` instance.\n */\n withToken(token?: string): this {\n this.#token = token;\n return this;\n }\n\n withWSFn(\n createWSFn: (args: {\n url: URL;\n wsProtocol: string;\n authToken?: string;\n }) => Promise<WebsocketDecompressAdapter>\n ): this {\n this.#createWSFn = createWSFn;\n return this;\n }\n\n /**\n * Set the compression algorithm to use for the connection.\n *\n * @param compression The compression algorithm to use for the connection.\n */\n withCompression(compression: 'gzip' | 'none'): this {\n this.#compression = compression;\n return this;\n }\n\n /**\n * Sets the connection to operate in light mode.\n *\n * Light mode is a mode that reduces the amount of data sent over the network.\n *\n * @param lightMode The light mode for the connection.\n */\n withLightMode(lightMode: boolean): this {\n this.#lightMode = lightMode;\n return this;\n }\n\n /**\n * Sets the connection to use confirmed reads.\n *\n * When enabled, the server will send query results only after they are\n * confirmed to be durable.\n *\n * What durable means depends on the server configuration: a single node\n * server may consider a transaction durable once it is `fsync`'ed to disk,\n * whereas a cluster may require that some number of replicas have\n * acknowledge that they have stored the transactions.\n *\n * Note that enabling confirmed reads will increase the latency between a\n * reducer call and the corresponding subscription update arriving at the\n * client.\n *\n * If this method is not called, not preference is sent to the server, and\n * the server will choose the default.\n *\n * @param confirmedReads `true` to enable confirmed reads, `false` to disable.\n */\n withConfirmedReads(confirmedReads: boolean): this {\n this.#confirmedReads = confirmedReads;\n return this;\n }\n\n /**\n * Register a callback to be invoked upon authentication with the database.\n *\n * @param identity A unique identifier for a client connected to a database.\n * @param token The credentials to use to authenticate with SpacetimeDB.\n *\n * @returns The `DbConnectionBuilder` instance.\n *\n * The callback will be invoked with the `Identity` and private authentication `token` provided by the database to identify this connection.\n *\n * If credentials were supplied to connect, those passed to the callback will be equivalent to the ones used to connect.\n *\n * If the initial connection was anonymous, a new set of credentials will be generated by the database to identify this user.\n *\n * The credentials passed to the callback can be saved and used to authenticate the same user in future connections.\n *\n * @example\n *\n * ```ts\n * DbConnection.builder().onConnect((ctx, identity, token) => {\n * console.log(\"Connected to SpacetimeDB with identity:\", identity.toHexString());\n * });\n * ```\n */\n onConnect(\n callback: (\n connection: DbConnection,\n identity: Identity,\n token: string\n ) => void\n ): this {\n this.#emitter.on('connect', callback);\n return this;\n }\n\n /**\n * Register a callback to be invoked upon an error.\n *\n * @example\n *\n * ```ts\n * DbConnection.builder().onConnectError((ctx, error) => {\n * console.log(\"Error connecting to SpacetimeDB:\", error);\n * });\n * ```\n */\n onConnectError(callback: (ctx: ErrorContext, error: Error) => void): this {\n this.#emitter.on('connectError', callback);\n return this;\n }\n\n /**\n * Registers a callback to run when a {@link DbConnection} whose connection initially succeeded\n * is disconnected, either after a {@link DbConnection.disconnect} call or due to an error.\n *\n * If the connection ended because of an error, the error is passed to the callback.\n *\n * The `callback` will be installed on the `DbConnection` created by `build`\n * before initiating the connection, ensuring there's no opportunity for the disconnect to happen\n * before the callback is installed.\n *\n * Note that this does not trigger if `build` fails\n * or in cases where {@link DbConnectionBuilder.onConnectError} would trigger.\n * This callback only triggers if the connection closes after `build` returns successfully\n * and {@link DbConnectionBuilder.onConnect} is invoked, i.e., after the `IdentityToken` is received.\n *\n * To simplify SDK implementation, at most one such callback can be registered.\n * Calling `onDisconnect` on the same `DbConnectionBuilder` multiple times throws an error.\n *\n * Unlike callbacks registered via {@link DbConnection},\n * no mechanism is provided to unregister the provided callback.\n * This is a concession to ergonomics; there's no clean place to return a `CallbackId` from this method\n * or from `build`.\n *\n * @param {function(error?: Error): void} callback - The callback to invoke upon disconnection.\n * @throws {Error} Throws an error if called multiple times on the same `DbConnectionBuilder`.\n */\n onDisconnect(\n callback: (ctx: ErrorContext, error?: Error | undefined) => void\n ): this {\n this.#emitter.on('disconnect', callback);\n return this;\n }\n\n /**\n * Builds a new `DbConnection` with the parameters set on this `DbConnectionBuilder` and attempts to connect to the SpacetimeDB server.\n *\n * @returns A new `DbConnection` with the parameters set on this `DbConnectionBuilder`.\n *\n * @example\n *\n * ```ts\n * const host = \"http://localhost:3000\";\n * const name_or_address = \"database_name\"\n * const auth_token = undefined;\n * DbConnection.builder().withUri(host).withModuleName(name_or_address).withToken(auth_token).build();\n * ```\n */\n build(): DbConnection {\n if (!this.#uri) {\n throw new Error('URI is required to connect to SpacetimeDB');\n }\n\n if (!this.#nameOrAddress) {\n throw new Error(\n 'Database name or address is required to connect to SpacetimeDB'\n );\n }\n // We could consider making this an `onConnectError` instead of throwing here.\n // Ideally, it would be a compile time error, but I'm not sure how to accomplish that.\n ensureMinimumVersionOrThrow(this.remoteModule.versionInfo?.cliVersion);\n\n return this.dbConnectionConstructor(\n new DbConnectionImpl({\n uri: this.#uri,\n nameOrAddress: this.#nameOrAddress,\n identity: this.#identity,\n token: this.#token,\n emitter: this.#emitter,\n compression: this.#compression,\n lightMode: this.#lightMode,\n confirmedReads: this.#confirmedReads,\n createWSFn: this.#createWSFn,\n remoteModule: this.remoteModule,\n })\n );\n }\n}\n","import type { DbConnectionImpl } from './db_connection_impl';\nimport type {\n ErrorContextInterface,\n SubscriptionEventContextInterface,\n} from './event_context';\nimport { EventEmitter } from './event_emitter';\n\nexport class SubscriptionBuilderImpl<\n DBView = any,\n Reducers = any,\n SetReducerFlags = any,\n> {\n #onApplied?: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void = undefined;\n #onError?: (\n ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void = undefined;\n constructor(\n private db: DbConnectionImpl<DBView, Reducers, SetReducerFlags>\n ) {}\n\n /**\n * Registers `callback` to run when this query is successfully added to our subscribed set,\n * I.e. when its `SubscriptionApplied` message is received.\n *\n * The database state exposed via the `&EventContext` argument\n * includes all the rows added to the client cache as a result of the new subscription.\n *\n * The event in the `&EventContext` argument is `Event::SubscribeApplied`.\n *\n * Multiple `on_applied` callbacks for the same query may coexist.\n * No mechanism for un-registering `on_applied` callbacks is exposed.\n *\n * @param cb - Callback to run when the subscription is applied.\n * @returns The current `SubscriptionBuilder` instance.\n */\n onApplied(\n cb: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void\n ): SubscriptionBuilderImpl<DBView, Reducers, SetReducerFlags> {\n this.#onApplied = cb;\n return this;\n }\n\n /**\n * Registers `callback` to run when this query either:\n * - Fails to be added to our subscribed set.\n * - Is unexpectedly removed from our subscribed set.\n *\n * If the subscription had previously started and has been unexpectedly removed,\n * the database state exposed via the `&EventContext` argument contains no rows\n * from any subscriptions removed within the same error event.\n * As proposed, it must therefore contain no rows.\n *\n * The event in the `&EventContext` argument is `Event::SubscribeError`,\n * containing a dynamic error object with a human-readable description of the error\n * for diagnostic purposes.\n *\n * Multiple `on_error` callbacks for the same query may coexist.\n * No mechanism for un-registering `on_error` callbacks is exposed.\n *\n * @param cb - Callback to run when there is an error in subscription.\n * @returns The current `SubscriptionBuilder` instance.\n */\n onError(\n cb: (ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>) => void\n ): SubscriptionBuilderImpl<DBView, Reducers, SetReducerFlags> {\n this.#onError = cb;\n return this;\n }\n\n /**\n * Subscribe to a single query. The results of the query will be merged into the client\n * cache and deduplicated on the client.\n *\n * @param query_sql A `SQL` query to subscribe to.\n *\n * @example\n *\n * ```ts\n * const subscription = connection.subscriptionBuilder().onApplied(() => {\n * console.log(\"SDK client cache initialized.\");\n * }).subscribe(\"SELECT * FROM User\");\n *\n * subscription.unsubscribe();\n * ```\n */\n subscribe(\n query_sql: string | string[]\n ): SubscriptionHandleImpl<DBView, Reducers, SetReducerFlags> {\n const queries = Array.isArray(query_sql) ? query_sql : [query_sql];\n if (queries.length === 0) {\n throw new Error('Subscriptions must have at least one query');\n }\n return new SubscriptionHandleImpl(\n this.db,\n queries,\n this.#onApplied,\n this.#onError\n );\n }\n\n /**\n * Subscribes to all rows from all tables.\n *\n * This method is intended as a convenience\n * for applications where client-side memory use and network bandwidth are not concerns.\n * Applications where these resources are a constraint\n * should register more precise queries via `subscribe`\n * in order to replicate only the subset of data which the client needs to function.\n *\n * This method should not be combined with `subscribe` on the same `DbConnection`.\n * A connection may either `subscribe` to particular queries,\n * or `subscribeToAllTables`, but not both.\n * Attempting to call `subscribe`\n * on a `DbConnection` that has previously used `subscribeToAllTables`,\n * or vice versa, may misbehave in any number of ways,\n * including dropping subscriptions, corrupting the client cache, or throwing errors.\n */\n subscribeToAllTables(): void {\n this.subscribe('SELECT * FROM *');\n }\n}\n\nexport type SubscribeEvent = 'applied' | 'error' | 'end';\n\nexport class SubscriptionManager {\n subscriptions: Map<\n number,\n { handle: SubscriptionHandleImpl; emitter: EventEmitter<SubscribeEvent> }\n > = new Map();\n}\n\nexport class SubscriptionHandleImpl<\n DBView = any,\n Reducers = any,\n SetReducerFlags = any,\n> {\n #queryId: number;\n #unsubscribeCalled: boolean = false;\n #endedState: boolean = false;\n #activeState: boolean = false;\n #emitter: EventEmitter<SubscribeEvent, (...args: any[]) => void> =\n new EventEmitter();\n\n constructor(\n private db: DbConnectionImpl<DBView, Reducers, SetReducerFlags>,\n querySql: string[],\n onApplied?: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void,\n onError?: (\n ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>,\n error: Error\n ) => void\n ) {\n this.#emitter.on(\n 'applied',\n (\n ctx: SubscriptionEventContextInterface<\n DBView,\n Reducers,\n SetReducerFlags\n >\n ) => {\n this.#activeState = true;\n if (onApplied) {\n onApplied(ctx);\n }\n }\n );\n this.#emitter.on(\n 'error',\n (\n ctx: ErrorContextInterface<DBView, Reducers, SetReducerFlags>,\n error: Error\n ) => {\n this.#activeState = false;\n this.#endedState = true;\n if (onError) {\n onError(ctx, error);\n }\n }\n );\n this.#queryId = this.db.registerSubscription(this, this.#emitter, querySql);\n }\n\n /**\n * Consumes self and issues an `Unsubscribe` message,\n * removing this query from the client's set of subscribed queries.\n * It is only valid to call this method if `is_active()` is `true`.\n */\n unsubscribe(): void {\n if (this.#unsubscribeCalled) {\n throw new Error('Unsubscribe has already been called');\n }\n this.#unsubscribeCalled = true;\n this.db.unregisterSubscription(this.#queryId);\n this.#emitter.on(\n 'end',\n (\n _ctx: SubscriptionEventContextInterface<\n DBView,\n Reducers,\n SetReducerFlags\n >\n ) => {\n this.#endedState = true;\n this.#activeState = false;\n }\n );\n }\n\n /**\n * Unsubscribes and also registers a callback to run upon success.\n * I.e. when an `UnsubscribeApplied` message is received.\n *\n * If `Unsubscribe` returns an error,\n * or if the `on_error` callback(s) are invoked before this subscription would end normally,\n * the `on_end` callback is not invoked.\n *\n * @param onEnd - Callback to run upon successful unsubscribe.\n */\n unsubscribeThen(\n onEnd: (\n ctx: SubscriptionEventContextInterface<DBView, Reducers, SetReducerFlags>\n ) => void\n ): void {\n if (this.#endedState) {\n throw new Error('Subscription has already ended');\n }\n if (this.#unsubscribeCalled) {\n throw new Error('Unsubscribe has already been called');\n }\n this.#unsubscribeCalled = true;\n this.db.unregisterSubscription(this.#queryId);\n this.#emitter.on(\n 'end',\n (\n ctx: SubscriptionEventContextInterface<\n DBView,\n Reducers,\n SetReducerFlags\n >\n ) => {\n this.#endedState = true;\n this.#activeState = false;\n onEnd(ctx);\n }\n );\n }\n\n /**\n * True if this `SubscriptionHandle` has ended,\n * either due to an error or a call to `unsubscribe`.\n *\n * This is initially false, and becomes true when either the `on_end` or `on_error` callback is invoked.\n * A subscription which has not yet been applied is not active, but is also not ended.\n */\n isEnded(): boolean {\n return this.#endedState;\n }\n\n /**\n * True if this `SubscriptionHandle` is active, meaning it has been successfully applied\n * and has not since ended, either due to an error or a complete `unsubscribe` request-response pair.\n *\n * This corresponds exactly to the interval bounded at the start by the `on_applied` callback\n * and at the end by either the `on_end` or `on_error` callback.\n */\n isActive(): boolean {\n return this.#activeState;\n }\n}\n","import { ConnectionId } from '../';\nimport {\n AlgebraicType,\n type AlgebraicTypeVariants,\n type ComparablePrimitive,\n} from '../';\nimport { parseValue } from '../';\nimport { BinaryReader } from '../';\nimport { BinaryWriter } from '../';\nimport { BsatnRowList } from './client_api/bsatn_row_list_type.ts';\nimport { ClientMessage } from './client_api/client_message_type.ts';\nimport { DatabaseUpdate } from './client_api/database_update_type.ts';\nimport { QueryUpdate } from './client_api/query_update_type.ts';\nimport { ServerMessage } from './client_api/server_message_type.ts';\nimport { TableUpdate as RawTableUpdate } from './client_api/table_update_type.ts';\nimport { ClientCache } from './client_cache.ts';\nimport { DbConnectionBuilder } from './db_connection_builder.ts';\nimport { type DbContext } from './db_context.ts';\nimport type { Event } from './event.ts';\nimport {\n type ErrorContextInterface,\n type EventContextInterface,\n type ReducerEventContextInterface,\n type SubscriptionEventContextInterface,\n} from './event_context.ts';\nimport { EventEmitter } from './event_emitter.ts';\nimport { decompress } from './decompress.ts';\nimport type { Identity } from '../';\nimport type {\n IdentityTokenMessage,\n Message,\n SubscribeAppliedMessage,\n UnsubscribeAppliedMessage,\n} from './message_types.ts';\nimport type { ReducerEvent } from './reducer_event.ts';\nimport type RemoteModule from './spacetime_module.ts';\nimport {\n TableCache,\n type Operation,\n type PendingCallback,\n type TableUpdate as CacheTableUpdate,\n} from './table_cache.ts';\nimport { WebsocketDecompressAdapter } from './websocket_decompress_adapter.ts';\nimport type { WebsocketTestAdapter } from './websocket_test_adapter.ts';\nimport {\n SubscriptionBuilderImpl,\n SubscriptionHandleImpl,\n SubscriptionManager,\n type SubscribeEvent,\n} from './subscription_builder_impl.ts';\nimport { stdbLogger } from './logger.ts';\nimport { type ReducerRuntimeTypeInfo } from './spacetime_module.ts';\nimport { fromByteArray } from 'base64-js';\n\nexport { DbConnectionBuilder, SubscriptionBuilderImpl, TableCache, type Event };\n\nexport type {\n DbContext,\n EventContextInterface,\n ReducerEventContextInterface,\n SubscriptionEventContextInterface,\n ErrorContextInterface,\n ReducerEvent,\n};\n\nexport type ConnectionEvent = 'connect' | 'disconnect' | 'connectError';\nexport type CallReducerFlags = 'FullUpdate' | 'NoSuccessNotify';\n\ntype ReducerEventCallback<ReducerArgs extends any[] = any[]> = (\n ctx: ReducerEventContextInterface,\n ...args: ReducerArgs\n) => void;\ntype SubscriptionEventCallback = (\n ctx: SubscriptionEventContextInterface\n) => void;\n\nfunction callReducerFlagsToNumber(flags: CallReducerFlags): number {\n switch (flags) {\n case 'FullUpdate':\n return 0;\n case 'NoSuccessNotify':\n return 1;\n }\n}\n\ntype DbConnectionConfig = {\n uri: URL;\n nameOrAddress: string;\n identity?: Identity;\n token?: string;\n emitter: EventEmitter<ConnectionEvent>;\n remoteModule: RemoteModule;\n createWSFn: typeof WebsocketDecompressAdapter.createWebSocketFn;\n compression: 'gzip' | 'none';\n lightMode: boolean;\n confirmedReads?: boolean;\n};\n\nexport class DbConnectionImpl<\n DBView = any,\n Reducers = any,\n SetReducerFlags = any,\n> implements DbContext<DBView, Reducers>\n{\n /**\n * Whether or not the connection is active.\n */\n isActive = false;\n\n /**\n * This connection's public identity.\n */\n identity?: Identity = undefined;\n\n /**\n * This connection's private authentication token.\n */\n token?: string = undefined;\n\n /**\n * The accessor field to access the tables in the database and associated\n * callback functions.\n */\n db: DBView;\n\n /**\n * The accessor field to access the reducers in the database and associated\n * callback functions.\n */\n reducers: Reducers;\n\n /**\n * The accessor field to access functions related to setting flags on\n * reducers regarding how the server should handle the reducer call and\n * the events that it sends back to the client.\n */\n setReducerFlags: SetReducerFlags;\n\n /**\n * The `ConnectionId` of the connection to to the database.\n */\n connectionId: ConnectionId = ConnectionId.random();\n\n // These fields are meant to be strictly private.\n #queryId = 0;\n #emitter: EventEmitter<ConnectionEvent>;\n #reducerEmitter: EventEmitter<string, ReducerEventCallback> =\n new EventEmitter();\n #onApplied?: SubscriptionEventCallback;\n #remoteModule: RemoteModule;\n #messageQueue = Promise.resolve();\n #subscriptionManager = new SubscriptionManager();\n\n // These fields are not part of the public API, but in a pinch you\n // could use JavaScript to access them by bypassing TypeScript's\n // private fields.\n // We use them in testing.\n private clientCache: ClientCache;\n private ws?: WebsocketDecompressAdapter | WebsocketTestAdapter;\n private wsPromise: Promise<\n WebsocketDecompressAdapter | WebsocketTestAdapter | undefined\n >;\n\n constructor({\n uri,\n nameOrAddress,\n identity,\n token,\n emitter,\n remoteModule,\n createWSFn,\n compression,\n lightMode,\n confirmedReads,\n }: DbConnectionConfig) {\n stdbLogger('info', 'Connecting to SpacetimeDB WS...');\n\n // We use .toString() here because some versions of React Native contain a bug where the URL constructor\n // incorrectly treats a URL instance as a plain string.\n // This results in an attempt to call .endsWith() on it, leading to an error.\n const url = new URL(uri.toString());\n if (!/^wss?:/.test(uri.protocol)) {\n url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';\n }\n\n this.identity = identity;\n this.token = token;\n\n this.#remoteModule = remoteModule;\n this.#emitter = emitter;\n\n const connectionId = this.connectionId.toHexString();\n url.searchParams.set('connection_id', connectionId);\n\n this.clientCache = new ClientCache();\n this.db = this.#remoteModule.dbViewConstructor(this);\n this.setReducerFlags = this.#remoteModule.setReducerFlagsConstructor();\n this.reducers = this.#remoteModule.reducersConstructor(\n this,\n this.setReducerFlags\n );\n\n this.wsPromise = createWSFn({\n url,\n nameOrAddress,\n wsProtocol: 'v1.bsatn.spacetimedb',\n authToken: token,\n compression: compression,\n lightMode: lightMode,\n confirmedReads: confirmedReads,\n })\n .then(v => {\n this.ws = v;\n\n this.ws.onclose = () => {\n this.#emitter.emit('disconnect', this);\n };\n this.ws.onerror = (e: ErrorEvent) => {\n this.#emitter.emit('connectError', this, e);\n };\n this.ws.onopen = this.#handleOnOpen.bind(this);\n this.ws.onmessage = this.#handleOnMessage.bind(this);\n return v;\n })\n .catch(e => {\n stdbLogger('error', 'Error connecting to SpacetimeDB WS');\n this.#emitter.emit('connectError', this, e);\n\n return undefined;\n });\n }\n\n #getNextQueryId = () => {\n const queryId = this.#queryId;\n this.#queryId += 1;\n return queryId;\n };\n\n // NOTE: This is very important!!! This is the actual function that\n // gets called when you call `connection.subscriptionBuilder()`.\n // The `subscriptionBuilder` function which is generated, just shadows\n // this function in the type system, but not the actual implementation!\n // Do not remove this function, or shoot yourself in the foot please.\n // It's not clear what would be a better way to do this at this exact\n // moment.\n subscriptionBuilder = (): SubscriptionBuilderImpl => {\n return new SubscriptionBuilderImpl(this);\n };\n\n registerSubscription(\n handle: SubscriptionHandleImpl<DBView, Reducers, SetReducerFlags>,\n handleEmitter: EventEmitter<SubscribeEvent, SubscriptionEventCallback>,\n querySql: string[]\n ): number {\n const queryId = this.#getNextQueryId();\n this.#subscriptionManager.subscriptions.set(queryId, {\n handle,\n emitter: handleEmitter,\n });\n this.#sendMessage(\n ClientMessage.SubscribeMulti({\n queryStrings: querySql,\n queryId: { id: queryId },\n // The TypeScript SDK doesn't currently track `request_id`s,\n // so always use 0.\n requestId: 0,\n })\n );\n return queryId;\n }\n\n unregisterSubscription(queryId: number): void {\n this.#sendMessage(\n ClientMessage.UnsubscribeMulti({\n queryId: { id: queryId },\n // The TypeScript SDK doesn't currently track `request_id`s,\n // so always use 0.\n requestId: 0,\n })\n );\n }\n\n // This function is async because we decompress the message async\n async #processParsedMessage(\n message: ServerMessage\n ): Promise<Message | undefined> {\n const parseRowList = (\n type: 'insert' | 'delete',\n tableName: string,\n rowList: BsatnRowList\n ): Operation[] => {\n const buffer = rowList.rowsData;\n const reader = new BinaryReader(buffer);\n const rows: Operation[] = [];\n const rowType = this.#remoteModule.tables[tableName]!.rowType;\n const primaryKeyInfo =\n this.#remoteModule.tables[tableName]!.primaryKeyInfo;\n while (reader.remaining > 0) {\n const row = AlgebraicType.deserializeValue(reader, rowType);\n let rowId: ComparablePrimitive | undefined = undefined;\n if (primaryKeyInfo !== undefined) {\n rowId = AlgebraicType.intoMapKey(\n primaryKeyInfo.colType,\n row[primaryKeyInfo.colName]\n );\n } else {\n // Get a view of the bytes for this row.\n const rowBytes = buffer.subarray(0, reader.offset);\n // Convert it to a base64 string, so we can use it as a map key.\n const asBase64 = fromByteArray(rowBytes);\n rowId = asBase64;\n }\n\n rows.push({\n type,\n rowId,\n row,\n });\n }\n return rows;\n };\n\n const parseTableUpdate = async (\n rawTableUpdate: RawTableUpdate\n ): Promise<CacheTableUpdate> => {\n const tableName = rawTableUpdate.tableName;\n let operations: Operation[] = [];\n for (const update of rawTableUpdate.updates) {\n let decompressed: QueryUpdate;\n if (update.tag === 'Gzip') {\n const decompressedBuffer = await decompress(update.value, 'gzip');\n decompressed = QueryUpdate.deserialize(\n new BinaryReader(decompressedBuffer)\n );\n } else if (update.tag === 'Brotli') {\n throw new Error(\n 'Brotli compression not supported. Please use gzip or none compression in withCompression method on DbConnection.'\n );\n } else {\n decompressed = update.value;\n }\n operations = operations.concat(\n parseRowList('insert', tableName, decompressed.inserts)\n );\n operations = operations.concat(\n parseRowList('delete', tableName, decompressed.deletes)\n );\n }\n return {\n tableName,\n operations,\n };\n };\n\n const parseDatabaseUpdate = async (\n dbUpdate: DatabaseUpdate\n ): Promise<CacheTableUpdate[]> => {\n const tableUpdates: CacheTableUpdate[] = [];\n for (const rawTableUpdate of dbUpdate.tables) {\n tableUpdates.push(await parseTableUpdate(rawTableUpdate));\n }\n return tableUpdates;\n };\n\n switch (message.tag) {\n case 'InitialSubscription': {\n const dbUpdate = message.value.databaseUpdate;\n const tableUpdates = await parseDatabaseUpdate(dbUpdate);\n const subscriptionUpdate: Message = {\n tag: 'InitialSubscription',\n tableUpdates,\n };\n return subscriptionUpdate;\n }\n\n case 'TransactionUpdateLight': {\n const dbUpdate = message.value.update;\n const tableUpdates = await parseDatabaseUpdate(dbUpdate);\n const subscriptionUpdate: Message = {\n tag: 'TransactionUpdateLight',\n tableUpdates,\n };\n return subscriptionUpdate;\n }\n\n case 'TransactionUpdate': {\n const txUpdate = message.value;\n const identity = txUpdate.callerIdentity;\n const connectionId = ConnectionId.nullIfZero(\n txUpdate.callerConnectionId\n );\n const reducerName: string = txUpdate.reducerCall.reducerName;\n const args = txUpdate.reducerCall.args;\n const energyQuantaUsed = txUpdate.energyQuantaUsed;\n\n let tableUpdates: CacheTableUpdate[] = [];\n let errMessage = '';\n switch (txUpdate.status.tag) {\n case 'Committed':\n tableUpdates = await parseDatabaseUpdate(txUpdate.status.value);\n break;\n case 'Failed':\n tableUpdates = [];\n errMessage = txUpdate.status.value;\n break;\n case 'OutOfEnergy':\n tableUpdates = [];\n break;\n }\n\n // TODO: Can `reducerName` be '<none>'?\n // See: https://github.com/clockworklabs/SpacetimeDB/blob/a2a1b5d9b2e0ebaaf753d074db056d319952d442/crates/core/src/client/message_handlers.rs#L155\n if (reducerName === '<none>') {\n const errorMessage = errMessage;\n console.error(`Received an error from the database: ${errorMessage}`);\n return;\n }\n\n let reducerInfo:\n | {\n reducerName: string;\n args: Uint8Array;\n }\n | undefined;\n if (reducerName !== '') {\n reducerInfo = {\n reducerName,\n args,\n };\n }\n\n const transactionUpdate: Message = {\n tag: 'TransactionUpdate',\n tableUpdates,\n identity,\n connectionId,\n reducerInfo,\n status: txUpdate.status,\n energyConsumed: energyQuantaUsed.quanta,\n message: errMessage,\n timestamp: txUpdate.timestamp,\n };\n return transactionUpdate;\n }\n\n case 'IdentityToken': {\n const identityTokenMessage: IdentityTokenMessage = {\n tag: 'IdentityToken',\n identity: message.value.identity,\n token: message.value.token,\n connectionId: message.value.connectionId,\n };\n return identityTokenMessage;\n }\n\n case 'OneOffQueryResponse': {\n throw new Error(\n `TypeScript SDK never sends one-off queries, but got OneOffQueryResponse ${message}`\n );\n }\n\n case 'SubscribeMultiApplied': {\n const parsedTableUpdates = await parseDatabaseUpdate(\n message.value.update\n );\n const subscribeAppliedMessage: SubscribeAppliedMessage<\n Record<string, any>\n > = {\n tag: 'SubscribeApplied',\n queryId: message.value.queryId.id,\n tableUpdates: parsedTableUpdates,\n };\n return subscribeAppliedMessage;\n }\n\n case 'UnsubscribeMultiApplied': {\n const parsedTableUpdates = await parseDatabaseUpdate(\n message.value.update\n );\n const unsubscribeAppliedMessage: UnsubscribeAppliedMessage<\n Record<string, any>\n > = {\n tag: 'UnsubscribeApplied',\n queryId: message.value.queryId.id,\n tableUpdates: parsedTableUpdates,\n };\n return unsubscribeAppliedMessage;\n }\n\n case 'SubscriptionError': {\n return {\n tag: 'SubscriptionError',\n queryId: message.value.queryId,\n error: message.value.error,\n };\n }\n }\n }\n\n #sendMessage(message: ClientMessage): void {\n this.wsPromise.then(wsResolved => {\n if (wsResolved) {\n const writer = new BinaryWriter(1024);\n ClientMessage.serialize(writer, message);\n const encoded = writer.getBuffer();\n wsResolved.send(encoded);\n }\n });\n }\n\n /**\n * Handles WebSocket onOpen event.\n */\n #handleOnOpen(): void {\n this.isActive = true;\n }\n\n #applyTableUpdates(\n tableUpdates: CacheTableUpdate[],\n eventContext: EventContextInterface\n ): PendingCallback[] {\n const pendingCallbacks: PendingCallback[] = [];\n for (const tableUpdate of tableUpdates) {\n // Get table information for the table being updated\n const tableName = tableUpdate.tableName;\n const tableTypeInfo = this.#remoteModule.tables[tableName]!;\n const table = this.clientCache.getOrCreateTable(tableTypeInfo);\n const newCallbacks = table.applyOperations(\n tableUpdate.operations,\n eventContext\n );\n for (const callback of newCallbacks) {\n pendingCallbacks.push(callback);\n }\n }\n return pendingCallbacks;\n }\n\n async #processMessage(data: Uint8Array): Promise<void> {\n const serverMessage = parseValue(ServerMessage, data);\n const message = await this.#processParsedMessage(serverMessage);\n if (!message) {\n return;\n }\n switch (message.tag) {\n case 'InitialSubscription': {\n const event: Event<never> = { tag: 'SubscribeApplied' };\n\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n // Remove the event from the subscription event context\n // It is not a field in the type narrowed SubscriptionEventContext\n const { event: _, ...subscriptionEventContext } = eventContext;\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n\n if (this.#emitter) {\n this.#onApplied?.(subscriptionEventContext);\n }\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'TransactionUpdateLight': {\n const event: Event<never> = { tag: 'UnknownTransaction' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'TransactionUpdate': {\n let reducerInfo = message.reducerInfo;\n let unknownTransaction = false;\n let reducerArgs: any | undefined;\n let reducerTypeInfo: ReducerRuntimeTypeInfo | undefined;\n if (!reducerInfo) {\n unknownTransaction = true;\n } else {\n reducerTypeInfo =\n this.#remoteModule.reducers[reducerInfo.reducerName];\n try {\n const reader = new BinaryReader(reducerInfo.args as Uint8Array);\n reducerArgs = AlgebraicType.deserializeValue(\n reader,\n reducerTypeInfo.argsType\n );\n } catch {\n // This should only be printed in development, since it's\n // possible for clients to receive new reducers that they don't\n // know about.\n console.debug('Failed to deserialize reducer arguments');\n unknownTransaction = true;\n }\n }\n\n if (unknownTransaction) {\n const event: Event<never> = { tag: 'UnknownTransaction' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n\n for (const callback of callbacks) {\n callback.cb();\n }\n return;\n }\n\n // At this point, we know that `reducerInfo` is not null because\n // we return if `unknownTransaction` is true.\n reducerInfo = reducerInfo!;\n reducerTypeInfo = reducerTypeInfo!;\n\n // Thus this must be a reducer event create it and emit it.\n const reducerEvent = {\n callerIdentity: message.identity,\n status: message.status,\n callerConnectionId: message.connectionId as ConnectionId,\n timestamp: message.timestamp,\n energyConsumed: message.energyConsumed,\n reducer: {\n name: reducerInfo.reducerName,\n args: reducerArgs,\n },\n };\n const event: Event<typeof reducerEvent.reducer> = {\n tag: 'Reducer',\n value: reducerEvent,\n };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const reducerEventContext = {\n ...eventContext,\n event: reducerEvent,\n };\n\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n\n const argsArray: any[] = [];\n (\n reducerTypeInfo.argsType as AlgebraicTypeVariants.Product\n ).value.elements.forEach(element => {\n argsArray.push(reducerArgs[element.name!]);\n });\n this.#reducerEmitter.emit(\n reducerInfo.reducerName,\n reducerEventContext,\n ...argsArray\n );\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'IdentityToken': {\n this.identity = message.identity;\n if (!this.token && message.token) {\n this.token = message.token;\n }\n this.connectionId = message.connectionId;\n this.#emitter.emit('connect', this, this.identity, this.token);\n break;\n }\n case 'SubscribeApplied': {\n const subscription = this.#subscriptionManager.subscriptions.get(\n message.queryId\n );\n if (subscription === undefined) {\n stdbLogger(\n 'error',\n `Received SubscribeApplied for unknown queryId ${message.queryId}.`\n );\n // If we don't know about the subscription, we won't apply the table updates.\n break;\n }\n const event: Event<never> = { tag: 'SubscribeApplied' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const { event: _, ...subscriptionEventContext } = eventContext;\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n subscription?.emitter.emit('applied', subscriptionEventContext);\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'UnsubscribeApplied': {\n const subscription = this.#subscriptionManager.subscriptions.get(\n message.queryId\n );\n if (subscription === undefined) {\n stdbLogger(\n 'error',\n `Received UnsubscribeApplied for unknown queryId ${message.queryId}.`\n );\n // If we don't know about the subscription, we won't apply the table updates.\n break;\n }\n const event: Event<never> = { tag: 'UnsubscribeApplied' };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const { event: _, ...subscriptionEventContext } = eventContext;\n const callbacks = this.#applyTableUpdates(\n message.tableUpdates,\n eventContext\n );\n subscription?.emitter.emit('end', subscriptionEventContext);\n this.#subscriptionManager.subscriptions.delete(message.queryId);\n for (const callback of callbacks) {\n callback.cb();\n }\n break;\n }\n case 'SubscriptionError': {\n const error = Error(message.error);\n const event: Event<never> = { tag: 'Error', value: error };\n const eventContext = this.#remoteModule.eventContextConstructor(\n this,\n event\n );\n const errorContext = {\n ...eventContext,\n event: error,\n };\n if (message.queryId !== undefined) {\n this.#subscriptionManager.subscriptions\n .get(message.queryId)\n ?.emitter.emit('error', errorContext, error);\n this.#subscriptionManager.subscriptions.delete(message.queryId);\n } else {\n console.error('Received an error message without a queryId: ', error);\n // TODO: This should actually kill the connection.\n // A subscription error without a specific subscription means we aren't receiving\n // updates for all of our subscriptions, so our cache is out of sync.\n\n // Send it to all of them:\n this.#subscriptionManager.subscriptions.forEach(({ emitter }) => {\n emitter.emit('error', errorContext, error);\n });\n }\n }\n }\n }\n\n /**\n * Handles WebSocket onMessage event.\n * @param wsMessage MessageEvent object.\n */\n #handleOnMessage(wsMessage: { data: Uint8Array }): void {\n // Utilize promise chaining to ensure that we process messages in order\n // even though we are processing them asyncronously. This will not begin\n // processing the next message until we await the processing of the\n // current message.\n this.#messageQueue = this.#messageQueue.then(() => {\n return this.#processMessage(wsMessage.data);\n });\n }\n\n /**\n * Call a reducer on your SpacetimeDB module.\n *\n * @param reducerName The name of the reducer to call\n * @param argsSerializer The arguments to pass to the reducer\n */\n callReducer(\n reducerName: string,\n argsBuffer: Uint8Array,\n flags: CallReducerFlags\n ): void {\n const message = ClientMessage.CallReducer({\n reducer: reducerName,\n args: argsBuffer,\n // The TypeScript SDK doesn't currently track `request_id`s,\n // so always use 0.\n requestId: 0,\n flags: callReducerFlagsToNumber(flags),\n });\n this.#sendMessage(message);\n }\n\n /**\n * Close the current connection.\n *\n * @example\n *\n * ```ts\n * const connection = DbConnection.builder().build();\n * connection.disconnect()\n * ```\n */\n disconnect(): void {\n this.wsPromise.then(wsResolved => {\n if (wsResolved) {\n wsResolved.close();\n }\n });\n }\n\n private on(\n eventName: ConnectionEvent,\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on(eventName, callback);\n }\n\n private off(\n eventName: ConnectionEvent,\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off(eventName, callback);\n }\n\n private onConnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on('connect', callback);\n }\n\n private onDisconnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on('disconnect', callback);\n }\n\n private onConnectError(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.on('connectError', callback);\n }\n\n private removeOnConnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off('connect', callback);\n }\n\n private removeOnDisconnect(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off('disconnect', callback);\n }\n\n private removeOnConnectError(\n callback: (ctx: DbConnectionImpl, ...args: any[]) => void\n ): void {\n this.#emitter.off('connectError', callback);\n }\n\n // Note: This is required to be public because it needs to be\n // called from the `RemoteReducers` class.\n onReducer(reducerName: string, callback: ReducerEventCallback): void {\n this.#reducerEmitter.on(reducerName, callback);\n }\n\n // Note: This is required to be public because it needs to be\n // called from the `RemoteReducers` class.\n offReducer(reducerName: string, callback: ReducerEventCallback): void {\n this.#reducerEmitter.off(reducerName, callback);\n }\n}\n"]}