@sapphire/string-store 1.1.0-next.7c2bed20

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/shared/_common.ts","../../src/lib/shared/Pointer.ts","../../src/lib/types/Array.ts","../../src/lib/types/BigInt32.ts","../../src/lib/types/BigInt64.ts","../../src/lib/types/Bit.ts","../../src/lib/types/Boolean.ts","../../src/lib/types/FixedLengthArray.ts","../../src/lib/types/Float32.ts","../../src/lib/types/Float64.ts","../../src/lib/types/Int16.ts","../../src/lib/types/Int2.ts","../../src/lib/types/Int32.ts","../../src/lib/types/Int4.ts","../../src/lib/types/Int64.ts","../../src/lib/types/Int8.ts","../../src/lib/types/Snowflake.ts","../../src/lib/types/String.ts","../../src/lib/schema/Schema.ts","../../src/lib/UnalignedUint16Array.ts","../../src/lib/schema/SchemaStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,YAAY,MAA+C,EAAA;AAE1E,EAAA,IAAI,CAAC,QAAA,CAAS,MAAM,CAAA,EAAU,OAAA,KAAA,CAAA;AAE9B,EAAA,IAAI,KAAM,CAAA,OAAA,CAAQ,MAAM,CAAA,EAAU,OAAA,IAAA,CAAA;AAElC,EAAA,IAAI,CAAC,SAAA,CAAU,MAAM,CAAA,EAAU,OAAA,KAAA,CAAA;AAE/B,EAAA,IAAI,CAAC,aAAA,CAAc,MAAO,CAAA,MAAM,GAAU,OAAA,KAAA,CAAA;AAE1C,EAAA,OAAO,MAAO,CAAA,MAAA,KAAW,CAAK,IAAA,MAAA,CAAO,SAAS,CAAK,IAAA,MAAA,CAAA;AACpD,CAAA;AAXgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA,CAAA;AAahB,SAAS,SAAS,IAA+B,EAAA;AAChD,EAAO,OAAA,OAAO,IAAS,KAAA,QAAA,IAAY,IAAS,KAAA,IAAA,CAAA;AAC7C,CAAA;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1B,IAAA,OAAO,EAAE,EAAI,EAAA,IAAA,EAAM,OAAO,WAAY,CAAA,MAAA,EAAQ,OAAO,CAAE,EAAA,CAAA;AAAA,GACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,IAA2C,GAAA;AACjD,IAAO,OAAA,YAAA,CAAA,IAAA,EAAK,UAAS,IAAK,EAAA,CAAA;AAAA,GAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,MAA+C,GAAA;AACrD,IAAO,OAAA,YAAA,CAAA,IAAA,EAAK,UAAS,MAAO,EAAA,CAAA;AAAA,GAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,OAAgD,GAAA;AACtD,IAAO,OAAA,YAAA,CAAA,IAAA,EAAK,UAAS,OAAQ,EAAA,CAAA;AAAA,GAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,CAAQ,MAAO,CAAA,QAAQ,CAA0C,GAAA;AAChE,IAAA,OAAO,KAAK,OAAQ,EAAA,CAAA;AAAA,GACrB;AACD,CAAA,CAAA;AA7GC,QAAA,GAAA,IAAA,OAAA,EAAA,CAAA;AANyD,MAAA,CAAA,YAAA,EAAA,aAAA,CAAA,CAAA;AAAnD,IAAM,WAAN,GAAA","file":"index.cjs","sourcesContent":["export function isArrayLike(object: unknown): object is ArrayLike<unknown> {\n\t// If the item is not an object, it is not array-like:\n\tif (!isObject(object)) return false;\n\t// If the item is an array, it is array-like:\n\tif (Array.isArray(object)) return true;\n\t// If the item doesn't have a numeric length property, it is not array-like:\n\tif (!hasLength(object)) return false;\n\t// If the length isn't a valid index, it is not array-like:\n\tif (!isValidLength(object.length)) return false;\n\n\treturn object.length === 0 || object.length - 1 in object;\n}\n\nfunction isObject(item: unknown): item is object {\n\treturn typeof item === 'object' && item !== null;\n}\n\nfunction hasLength(item: object): item is { length: number } {\n\treturn 'length' in item && typeof item.length === 'number';\n}\n\nexport function isValidLength(length: number) {\n\treturn Number.isSafeInteger(length) && length >= 0 && length < 2147483648;\n}\n","import { isValidLength } from './_common';\n\n/**\n * A pointer to a position in a buffer.\n *\n * This is used to keep track of the current position in a buffer while allowing\n * the position to be updated by multiple different functions.\n *\n * @privateRemarks\n *\n * This class draws inspiration from the following constructs:\n * - `int*` in C/C++\n * - `ref int` in C#\n * - `*mut i32` in Rust\n */\nexport class Pointer {\n\t#value = 0;\n\n\tpublic get value() {\n\t\treturn this.#value;\n\t}\n\n\tpublic add(value: number) {\n\t\tconst added = this.#value + value;\n\t\tif (!isValidLength(added)) {\n\t\t\tthrow new RangeError(`The pointer value cannot be an invalid length value`);\n\t\t}\n\n\t\tthis.#value = added;\n\t\treturn this;\n\t}\n\n\tpublic static from(pointer: PointerLike) {\n\t\tif (pointer instanceof Pointer) {\n\t\t\treturn pointer;\n\t\t}\n\n\t\tconst instance = new Pointer();\n\t\tinstance.add(Number(pointer));\n\t\treturn instance;\n\t}\n}\n\nexport type PointerLike = Pointer | { valueOf(): number } | { [Symbol.toPrimitive](hint: 'number'): number };\n","import { isArrayLike } from '../shared/_common';\nimport type { IType } from './base/IType';\n\nexport function ArrayType<ValueType, ValueBitSize extends number | null>(type: IType<ValueType, ValueBitSize>): IType<ValueType[], null> {\n\treturn {\n\t\tserialize(buffer, values: readonly ValueType[]) {\n\t\t\tif (!isArrayLike(values)) {\n\t\t\t\tthrow new TypeError(`Expected an array, got ${values}`);\n\t\t\t}\n\n\t\t\tbuffer.writeInt16(values.length);\n\t\t\tfor (const value of values) {\n\t\t\t\ttype.serialize(buffer, value);\n\t\t\t}\n\t\t},\n\t\tdeserialize(buffer, pointer) {\n\t\t\tconst length = buffer.readInt16(pointer);\n\t\t\tconst value = [];\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tvalue.push(type.deserialize(buffer, pointer));\n\t\t\t}\n\t\t\treturn value;\n\t\t},\n\t\tBIT_SIZE: null\n\t};\n}\n","import type { IType } from './base/IType';\n\nexport const BigInt32Type: IType<bigint, 32> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeBigInt32(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readBigInt32(pointer);\n\t},\n\tBIT_SIZE: 32\n};\n","import type { IType } from './base/IType';\n\nexport const BigInt64Type: IType<bigint, 64> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeBigInt64(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readBigInt64(pointer);\n\t},\n\tBIT_SIZE: 64\n};\n","import type { IType } from './base/IType';\n\nexport const BitType: IType<number, 1> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeBit(value & 0b1);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readBit(pointer);\n\t},\n\tBIT_SIZE: 1\n};\n","import type { IType } from './base/IType';\n\nexport const BooleanType: IType<boolean, 1> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeBit(Number(value));\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readBit(pointer) === 1;\n\t},\n\tBIT_SIZE: 1\n};\n","import { isArrayLike } from '../shared/_common';\nimport type { IType } from './base/IType';\n\nexport function FixedLengthArrayType<ValueType, ValueBitSize extends number | null>(\n\ttype: IType<ValueType, ValueBitSize>,\n\tlength: number\n): IType<ValueType[], ValueBitSize extends null ? null : number> {\n\treturn {\n\t\tserialize(buffer, values) {\n\t\t\tif (!isArrayLike(values) || values.length !== length) {\n\t\t\t\tthrow new TypeError(`Expected array of length ${length}, got ${values.length}`);\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\ttype.serialize(buffer, values[i]);\n\t\t\t}\n\t\t},\n\t\tdeserialize(buffer, pointer) {\n\t\t\tconst value = [];\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tvalue.push(type.deserialize(buffer, pointer));\n\t\t\t}\n\t\t\treturn value;\n\t\t},\n\t\tBIT_SIZE: (typeof type.BIT_SIZE === 'number' ? type.BIT_SIZE * length : null) as ValueBitSize extends null ? null : number\n\t};\n}\n","import type { IType } from './base/IType';\n\nexport const Float32Type: IType<number, 32> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeFloat32(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readFloat32(pointer);\n\t},\n\tBIT_SIZE: 32\n};\n","import type { IType } from './base/IType';\n\nexport const Float64Type: IType<number, 64> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeFloat64(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readFloat64(pointer);\n\t},\n\tBIT_SIZE: 64\n};\n","import type { IType } from './base/IType';\n\nexport const Int16Type: IType<number, 16> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeInt16(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readInt16(pointer);\n\t},\n\tBIT_SIZE: 16\n};\n","import type { IType } from './base/IType';\n\nexport const Int2Type: IType<number, 2> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeInt2(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readInt2(pointer);\n\t},\n\tBIT_SIZE: 2\n};\n","import type { IType } from './base/IType';\n\nexport const Int32Type: IType<number, 32> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeInt32(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readInt32(pointer);\n\t},\n\tBIT_SIZE: 32\n};\n","import type { IType } from './base/IType';\n\nexport const Int4Type: IType<number, 4> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeInt4(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readInt4(pointer);\n\t},\n\tBIT_SIZE: 4\n};\n","import type { IType } from './base/IType';\n\nexport const Int64Type: IType<number, 64> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeInt64(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readInt64(pointer);\n\t},\n\tBIT_SIZE: 64\n};\n","import type { IType } from './base/IType';\n\nexport const Int8Type: IType<number, 8> = {\n\tserialize(buffer, value) {\n\t\tbuffer.writeInt8(value);\n\t},\n\tdeserialize(buffer, pointer) {\n\t\treturn buffer.readInt8(pointer);\n\t},\n\tBIT_SIZE: 8\n};\n","import type { IType } from './base/IType';\n\nexport const SnowflakeType = {\n\tserialize(buffer, value: bigint | string) {\n\t\tbuffer.writeBigInt64(BigInt(value));\n\t},\n\tdeserialize(buffer, offset) {\n\t\treturn buffer.readBigInt64(offset);\n\t},\n\tBIT_SIZE: 64\n} as const satisfies IType<bigint, 64>;\n","import type { IType } from './base/IType';\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\nexport const StringType: IType<string, null> = {\n\tserialize(buffer, value) {\n\t\tconst encoded = encoder.encode(value);\n\t\tbuffer.writeInt16(encoded.length);\n\t\tfor (const byte of encoded) {\n\t\t\tbuffer.writeInt8(byte);\n\t\t}\n\t},\n\tdeserialize(buffer, pointer) {\n\t\tconst length = buffer.readInt16(pointer);\n\t\tconst bytes = new Uint8Array(length);\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tbytes[i] = buffer.readInt8(pointer);\n\t\t}\n\t\treturn decoder.decode(bytes);\n\t},\n\tBIT_SIZE: null\n};\n","import { Pointer, type PointerLike } from '../shared/Pointer';\nimport { ArrayType } from '../types/Array';\nimport type { IType } from '../types/base/IType';\nimport { BigInt32Type } from '../types/BigInt32';\nimport { BigInt64Type } from '../types/BigInt64';\nimport { BitType } from '../types/Bit';\nimport { BooleanType } from '../types/Boolean';\nimport { FixedLengthArrayType } from '../types/FixedLengthArray';\nimport { Float32Type } from '../types/Float32';\nimport { Float64Type } from '../types/Float64';\nimport { Int16Type } from '../types/Int16';\nimport { Int2Type } from '../types/Int2';\nimport { Int32Type } from '../types/Int32';\nimport { Int4Type } from '../types/Int4';\nimport { Int64Type } from '../types/Int64';\nimport { Int8Type } from '../types/Int8';\nimport { SnowflakeType } from '../types/Snowflake';\nimport { StringType } from '../types/String';\nimport type { UnalignedUint16Array } from '../UnalignedUint16Array';\n\nexport class Schema<Id extends number = number, Entries extends object = object> {\n\treadonly #id: Id;\n\treadonly #types = new Map<string, IType<any, number | null>>();\n\t#bitSize: number | null = 0;\n\n\t/**\n\t * Creates a new schema.\n\t *\n\t * @param id The id of the schema\n\t */\n\tpublic constructor(id: Id) {\n\t\tthis.#id = id;\n\t}\n\n\t/**\n\t * The id of the schema.\n\t */\n\tpublic get id(): Id {\n\t\treturn this.#id;\n\t}\n\n\t/**\n\t * The total bit size of the schema.\n\t *\n\t * @remarks\n\t *\n\t * If any of the entries have a bit size of `null`, the bit size of the\n\t * schema will also be `null`.\n\t */\n\tpublic get bitSize(): number | null {\n\t\treturn this.#bitSize;\n\t}\n\n\t/**\n\t * Get a property from the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The specified property\n\t *\n\t * @remarks\n\t *\n\t * If the property does not exist, an error will be thrown.\n\t */\n\tpublic get<const Name extends keyof Entries & string>(name: Name): Entries[Name] {\n\t\tconst type = this.#types.get(name) as Entries[Name];\n\t\tif (!type) throw new Error(`Schema with id ${this.#id} does not have a property with name \"${name}\"`);\n\t\treturn type;\n\t}\n\n\t/**\n\t * Serialize a value into a buffer.\n\t *\n\t * @param buffer The buffer to serialize\n\t * @param value The value to serialize into the buffer\n\t *\n\t * @remarks\n\t *\n\t * The schema's ID is written to the buffer first, followed by each property\n\t * in the schema.\n\t */\n\tpublic serialize(buffer: UnalignedUint16Array, value: Readonly<UnwrapSchemaEntries<Entries>>): void {\n\t\tbuffer.writeInt16(this.#id);\n\t\tfor (const [name, type] of this) {\n\t\t\t(type as IType<any, number | null>).serialize(buffer, (value as any)[name]);\n\t\t}\n\t}\n\n\t/**\n\t * Deserialize a value from a buffer.\n\t *\n\t * @param buffer The buffer to deserialize\n\t * @param pointer The pointer to where the buffer should be read from\n\t * @returns The deserialized value\n\t *\n\t * @remarks\n\t *\n\t * Unlike {@link Schema.serialize}, this method does not read the schema's ID\n\t * from the buffer, that is reserved for the {@link SchemaStore}.\n\t */\n\tpublic deserialize(buffer: UnalignedUint16Array, pointer: PointerLike): UnwrapSchemaEntries<Entries> {\n\t\tconst ptr = Pointer.from(pointer);\n\t\tconst result = Object.create(null) as UnwrapSchemaEntries<Entries>;\n\t\tfor (const [name, type] of this) {\n\t\t\t// @ts-expect-error Complex types\n\t\t\tresult[name] = type.deserialize(buffer, ptr);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Adds an array property to the schema.\n\t *\n\t * @seealso {@link Schema.fixedLengthArray} for a fixed length array\n\t *\n\t * @param name The name of the property\n\t * @param type The type of the entry in the array\n\t * @returns The modified schema\n\t */\n\tpublic array<const Name extends string, const ValueType, const ValueBitSize extends number | null>(\n\t\tname: Name,\n\t\ttype: IType<ValueType, ValueBitSize>\n\t) {\n\t\treturn this.#addType(name, ArrayType(type));\n\t}\n\n\t/**\n\t * Adds a fixed length array property to the schema.\n\t *\n\t * @seealso {@link Schema.array} for a dynamic length array\n\t *\n\t * @param name The name of the property\n\t * @param type The type of the entry in the array\n\t * @param length The length of the array\n\t * @returns The modified schema\n\t */\n\tpublic fixedLengthArray<const Name extends string, const ValueType, const ValueBitSize extends number | null>(\n\t\tname: Name,\n\t\ttype: IType<ValueType, ValueBitSize>,\n\t\tlength: number\n\t) {\n\t\treturn this.#addType(name, FixedLengthArrayType(type, length));\n\t}\n\n\t/**\n\t * Adds a string property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic string<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, StringType);\n\t}\n\n\t/**\n\t * Adds a boolean property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic boolean<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, BooleanType);\n\t}\n\n\t/**\n\t * Adds a bit property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic bit<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, BitType);\n\t}\n\n\t/**\n\t * Adds a 2-bit integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic int2<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Int2Type);\n\t}\n\n\t/**\n\t * Adds a 4-bit integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic int4<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Int4Type);\n\t}\n\n\t/**\n\t * Adds a 8-bit integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic int8<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Int8Type);\n\t}\n\n\t/**\n\t * Adds a 16-bit integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic int16<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Int16Type);\n\t}\n\n\t/**\n\t * Adds a 32-bit integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic int32<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Int32Type);\n\t}\n\n\t/**\n\t * Adds a 64-bit integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic int64<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Int64Type);\n\t}\n\n\t/**\n\t * Adds a 32-bit big integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic bigInt32<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, BigInt32Type);\n\t}\n\n\t/**\n\t * Adds a 64-bit big integer property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic bigInt64<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, BigInt64Type);\n\t}\n\n\t/**\n\t * Adds a 32-bit floating point number property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic float32<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Float32Type);\n\t}\n\n\t/**\n\t * Adds a 64-bit floating point number property to the schema.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic float64<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, Float64Type);\n\t}\n\n\t/**\n\t * Adds a 64-bit big integer property to the schema, similar to {@link Schema.bigInt64}.\n\t *\n\t * @param name The name of the property\n\t * @returns The modified schema\n\t */\n\tpublic snowflake<const Name extends string>(name: Name) {\n\t\treturn this.#addType(name, SnowflakeType);\n\t}\n\n\t/**\n\t * Iterates over the schema's property names.\n\t *\n\t * @returns An iterator for the schema's property names\n\t */\n\tpublic keys(): IterableIterator<KeyOfSchema<this>> {\n\t\treturn this.#types.keys() as IterableIterator<KeyOfSchema<this>>;\n\t}\n\n\t/**\n\t * Iterates over the schema's property values\n\t *\n\t * @returns An iterator for the schema's property values\n\t */\n\tpublic values(): IterableIterator<ValueOfSchema<this>> {\n\t\treturn this.#types.values() as IterableIterator<ValueOfSchema<this>>;\n\t}\n\n\t/**\n\t * Iterates over the schema's property entries\n\t *\n\t * @returns An iterator for the schema's property entries\n\t */\n\tpublic entries(): IterableIterator<EntryOfSchema<this>> {\n\t\treturn this.#types.entries() as IterableIterator<EntryOfSchema<this>>;\n\t}\n\n\t/**\n\t * Iterates over the schema's property entries\n\t *\n\t * @returns An iterator for the schema's property entries\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<EntryOfSchema<this>> {\n\t\treturn this.entries();\n\t}\n\n\t#addType<const EntryName extends string, const ValueType, const ValueBitSize extends number | null>(\n\t\tname: EntryName,\n\t\ttype: IType<ValueType, ValueBitSize>\n\t): Merge<Id, Entries, EntryName, typeof type> {\n\t\tif (this.#types.has(name)) {\n\t\t\tthrow new Error(`Schema with id ${this.#id} already has a property with name \"${name}\"`);\n\t\t}\n\n\t\tthis.#types.set(name, type);\n\n\t\tif (type.BIT_SIZE === null) {\n\t\t\tthis.#bitSize = null;\n\t\t} else if (this.#bitSize !== null) {\n\t\t\tthis.#bitSize += type.BIT_SIZE;\n\t\t}\n\n\t\treturn this as unknown as Merge<Id, Entries, EntryName, typeof type>;\n\t}\n}\n\ntype Merge<\n\tId extends number,\n\tEntries extends object,\n\tEntryName extends string,\n\tEntryType extends IType<any, number | null>\n> = EntryName extends keyof Entries ? never : Schema<Id, { [K in EntryName | keyof Entries]: K extends keyof Entries ? Entries[K] : EntryType }>;\n\nexport type KeyOfSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? keyof Type & string : never;\nexport type ValueOfSchema<SchemaValue extends object> =\n\tSchemaValue extends Schema<infer _, infer Type> ? { [K in keyof Type]: Type[K] }[keyof Type] : never;\nexport type EntryOfSchema<SchemaValue extends object> =\n\tSchemaValue extends Schema<infer _, infer Type> ? { [K in keyof Type]: readonly [K, Type[K]] }[keyof Type] : never;\n\nexport type UnwrapSchemaType<Type extends object> = Type extends IType<infer T, infer _> ? T : never;\nexport type UnwrapSchemaEntries<Entries extends object> = { [K in keyof Entries]: UnwrapSchemaType<Entries[K] & object> } & object;\nexport type UnwrapSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? UnwrapSchemaEntries<Type> : never;\n","import { Pointer, type PointerLike } from './shared/Pointer';\n\nconst Converter8 = new Uint8Array(8);\nconst ConverterFloat = new Float32Array(Converter8.buffer);\nconst ConverterDouble = new Float64Array(Converter8.buffer);\n\nexport class UnalignedUint16Array {\n\t#buffer: Uint16Array;\n\t#bitLength = 0;\n\t#wordIndex = 0;\n\t#wordLength = 0;\n\n\tpublic constructor(maxLength: number) {\n\t\tthis.#buffer = new Uint16Array(maxLength);\n\t}\n\n\tpublic get maxLength(): number {\n\t\treturn this.#buffer.length;\n\t}\n\n\tpublic get maxBitLength(): number {\n\t\treturn this.#buffer.length * 16;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.#wordLength;\n\t}\n\n\tpublic get bitLength(): number {\n\t\treturn this.#bitLength;\n\t}\n\n\tpublic writeBit(value: number): void {\n\t\tthis.#writeBit(value);\n\t}\n\n\tpublic writeInt2(value: number): void {\n\t\tthis.writeBit(value & 1);\n\t\tthis.writeBit(value >> 1);\n\t}\n\n\tpublic writeInt4(value: number): void {\n\t\tthis.writeInt2(value & 0b11);\n\t\tthis.writeInt2(value >> 2);\n\t}\n\n\tpublic writeInt8(value: number): void {\n\t\tthis.writeInt4(value & 0b1111);\n\t\tthis.writeInt4(value >> 4);\n\t}\n\n\tpublic writeInt16(value: number): void {\n\t\tthis.writeInt8(value & 0xff);\n\t\tthis.writeInt8(value >> 8);\n\t}\n\n\tpublic writeInt32(value: number): void {\n\t\tthis.writeInt16(value & 0xffff);\n\t\tthis.writeInt16(value >> 16);\n\t}\n\n\tpublic writeInt64(value: number): void {\n\t\tthis.writeBigInt64(BigInt(value));\n\t}\n\n\tpublic writeBigInt32(value: bigint): void {\n\t\tthis.writeInt16(Number(value & 0xffffn));\n\t\tthis.writeInt16(Number(value >> 16n));\n\t}\n\n\tpublic writeBigInt64(value: bigint): void {\n\t\tthis.writeInt32(Number(value & 0xffffffffn));\n\t\tthis.writeInt32(Number(value >> 32n));\n\t}\n\n\tpublic writeFloat32(value: number): void {\n\t\tConverterFloat[0] = value;\n\t\tthis.writeInt8(Converter8[0]);\n\t\tthis.writeInt8(Converter8[1]);\n\t\tthis.writeInt8(Converter8[2]);\n\t\tthis.writeInt8(Converter8[3]);\n\t}\n\n\tpublic writeFloat64(value: number): void {\n\t\tConverterDouble[0] = value;\n\t\tthis.writeInt8(Converter8[0]);\n\t\tthis.writeInt8(Converter8[1]);\n\t\tthis.writeInt8(Converter8[2]);\n\t\tthis.writeInt8(Converter8[3]);\n\t\tthis.writeInt8(Converter8[4]);\n\t\tthis.writeInt8(Converter8[5]);\n\t\tthis.writeInt8(Converter8[6]);\n\t\tthis.writeInt8(Converter8[7]);\n\t}\n\n\tpublic readBit(offset: PointerLike): 0 | 1 {\n\t\tconst ptr = Pointer.from(offset);\n\t\treturn this.#readBit(ptr) as 0 | 1;\n\t}\n\n\tpublic readInt2(offset: PointerLike): number {\n\t\tconst ptr = Pointer.from(offset);\n\t\treturn this.#readBit(ptr) | (this.#readBit(ptr) << 1);\n\t}\n\n\tpublic readInt4(offset: PointerLike): number {\n\t\tconst ptr = Pointer.from(offset);\n\t\treturn this.#readBit(ptr) | (this.#readBit(ptr) << 1) | (this.#readBit(ptr) << 2) | (this.#readBit(ptr) << 3);\n\t}\n\n\tpublic readInt8(offset: PointerLike): number {\n\t\tconst ptr = Pointer.from(offset);\n\t\treturn this.#readByte(ptr);\n\t}\n\n\tpublic readInt16(offset: PointerLike): number {\n\t\tconst ptr = Pointer.from(offset);\n\t\treturn this.#readByte(ptr) | (this.#readByte(ptr) << 8);\n\t}\n\n\tpublic readInt32(offset: PointerLike): number {\n\t\treturn Number(this.readBigInt32(offset));\n\t}\n\n\tpublic readInt64(offset: PointerLike) {\n\t\treturn Number(this.readBigInt64(offset));\n\t}\n\n\tpublic readBigInt32(offset: PointerLike): bigint {\n\t\tconst ptr = Pointer.from(offset);\n\t\treturn (\n\t\t\tBigInt(this.#readByte(ptr)) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 8n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 16n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 24n)\n\t\t);\n\t}\n\n\tpublic readBigInt64(offset: PointerLike): bigint {\n\t\tconst ptr = Pointer.from(offset);\n\t\treturn (\n\t\t\tBigInt(this.#readByte(ptr)) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 8n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 16n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 24n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 32n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 40n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 48n) |\n\t\t\t(BigInt(this.#readByte(ptr)) << 56n)\n\t\t);\n\t}\n\n\tpublic readFloat32(offset: PointerLike): number {\n\t\tconst ptr = Pointer.from(offset);\n\t\tConverter8[0] = this.#readByte(ptr);\n\t\tConverter8[1] = this.#readByte(ptr);\n\t\tConverter8[2] = this.#readByte(ptr);\n\t\tConverter8[3] = this.#readByte(ptr);\n\t\treturn ConverterFloat[0];\n\t}\n\n\tpublic readFloat64(offset: PointerLike): number {\n\t\tconst ptr = Pointer.from(offset);\n\t\tConverter8[0] = this.#readByte(ptr);\n\t\tConverter8[1] = this.#readByte(ptr);\n\t\tConverter8[2] = this.#readByte(ptr);\n\t\tConverter8[3] = this.#readByte(ptr);\n\t\tConverter8[4] = this.#readByte(ptr);\n\t\tConverter8[5] = this.#readByte(ptr);\n\t\tConverter8[6] = this.#readByte(ptr);\n\t\tConverter8[7] = this.#readByte(ptr);\n\t\treturn ConverterDouble[0];\n\t}\n\n\tpublic toString() {\n\t\tlet result = '';\n\t\tfor (let i = 0; i < this.length; i++) {\n\t\t\tresult += String.fromCharCode(this.#buffer[i]);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic toArray(): Uint16Array {\n\t\treturn this.#buffer.slice(0, this.length);\n\t}\n\n\t#readBit(pointer: Pointer) {\n\t\tconst bitOffset = pointer.value;\n\t\tconst index = bitOffset >> 4;\n\t\tconst bitIndex = bitOffset & 0xf;\n\t\tpointer.add(1);\n\t\treturn (this.#buffer[index] >> bitIndex) & 1;\n\t}\n\n\t#readByte(ptr: Pointer) {\n\t\treturn (\n\t\t\tthis.#readBit(ptr) |\n\t\t\t(this.#readBit(ptr) << 1) |\n\t\t\t(this.#readBit(ptr) << 2) |\n\t\t\t(this.#readBit(ptr) << 3) |\n\t\t\t(this.#readBit(ptr) << 4) |\n\t\t\t(this.#readBit(ptr) << 5) |\n\t\t\t(this.#readBit(ptr) << 6) |\n\t\t\t(this.#readBit(ptr) << 7)\n\t\t);\n\t}\n\n\t#writeBit(value: number) {\n\t\tif (this.#wordIndex === this.maxLength) {\n\t\t\tthrow new RangeError(`The buffer is full`);\n\t\t}\n\n\t\tif (value) {\n\t\t\tconst index = this.#wordIndex;\n\t\t\tconst bitIndex = this.bitLength & 0xf;\n\t\t\tthis.#buffer[index] |= 1 << bitIndex;\n\t\t}\n\n\t\tif ((this.#bitLength & 0xf) === 0) this.#wordLength++;\n\t\tthis.#bitLength++;\n\t\tif ((this.#bitLength & 0xf) === 0) this.#wordIndex++;\n\t}\n\n\tpublic static from(value: string | UnalignedUint16Array): UnalignedUint16Array {\n\t\tif (value instanceof UnalignedUint16Array) return value;\n\n\t\tconst buffer = new UnalignedUint16Array(value.length);\n\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\tbuffer.#buffer[i] = value.charCodeAt(i);\n\t\t}\n\n\t\tbuffer.#bitLength = value.length << 4;\n\t\treturn buffer;\n\t}\n}\n","import { Pointer } from '../shared/Pointer';\nimport { UnalignedUint16Array } from '../UnalignedUint16Array';\nimport { Schema, type UnwrapSchema } from './Schema';\n\nexport class SchemaStore<Entries extends object = object> {\n\t/**\n\t * The default maximum array length for schemas\n\t */\n\tpublic defaultMaximumArrayLength: number;\n\n\t#schemas = new Map<number, Schema>();\n\n\t/**\n\t * Creates a new schema store\n\t *\n\t * @param defaultMaximumArrayLength The default maximum array length for schemas\n\t */\n\tpublic constructor(defaultMaximumArrayLength = 100) {\n\t\tthis.defaultMaximumArrayLength = defaultMaximumArrayLength;\n\t}\n\n\t/**\n\t * Adds a schema to the store\n\t *\n\t * @param schema The schema to add to the store\n\t * @returns The modified store\n\t *\n\t * @remarks\n\t *\n\t * An error will be thrown if a schema with the same id already exists in the store.\n\t */\n\tpublic add<const Id extends number, const SchemaType extends object>(schema: Schema<Id, SchemaType>): Merge<Entries, Id, typeof schema> {\n\t\tif (this.#schemas.has(schema.id)) {\n\t\t\tthrow new Error(`Schema with id ${schema.id} already exists`);\n\t\t}\n\n\t\tthis.#schemas.set(schema.id, schema as any);\n\t\treturn this as unknown as Merge<Entries, Id, typeof schema>;\n\t}\n\n\t/**\n\t * Gets a schema from the store\n\t *\n\t * @param id The id of the schema to get\n\t * @returns The schema with the given id\n\t *\n\t * @remarks\n\t *\n\t * An error will be thrown if a schema with the given id does not exist in the store.\n\t */\n\tpublic get<const Id extends KeyOfStore<this>>(id: Id): Entries[Id] {\n\t\tconst schema = this.#schemas.get(id) as Entries[Id];\n\t\tif (!schema) throw new Error(`Schema with id ${id} does not exist`);\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Serializes a value using the schema with the given id\n\t *\n\t * @param id The id of the schema to use for serialization\n\t * @param value The value to serialize\n\t * @returns The serialized buffer\n\t */\n\tpublic serialize<const Id extends KeyOfStore<this>>(id: Id, value: Readonly<UnwrapSchema<Entries[Id] & object>>): UnalignedUint16Array {\n\t\tconst schema = this.get(id) as Schema<Id, object>;\n\t\tconst buffer = new UnalignedUint16Array(schema.bitSize ?? this.defaultMaximumArrayLength);\n\t\tschema.serialize(buffer, value);\n\t\treturn buffer;\n\t}\n\n\t/**\n\t * Deserializes a buffer\n\t *\n\t * @param buffer The buffer to deserialize\n\t * @returns The resolved value, including the id of the schema used for deserialization\n\t */\n\tpublic deserialize(buffer: string | UnalignedUint16Array): DeserializationResult<Entries> {\n\t\tbuffer = UnalignedUint16Array.from(buffer);\n\t\tconst pointer = new Pointer();\n\t\tconst id = buffer.readInt16(pointer) as KeyOfStore<this>;\n\t\tconst schema = this.get(id) as Schema<number, object>;\n\t\treturn { id, data: schema.deserialize(buffer, pointer) } as unknown as DeserializationResult<Entries>;\n\t}\n\n\t/**\n\t * Iterates over the stores's schema identifiers.\n\t *\n\t * @returns An iterator for the stores's schema identifiers\n\t */\n\tpublic keys(): IterableIterator<KeyOfStore<this>> {\n\t\treturn this.#schemas.keys() as IterableIterator<KeyOfStore<this>>;\n\t}\n\n\t/**\n\t * Iterates over the stores's schemas.\n\t *\n\t * @returns An iterator for the stores's schemas\n\t */\n\tpublic values(): IterableIterator<ValueOfStore<this>> {\n\t\treturn this.#schemas.values() as IterableIterator<ValueOfStore<this>>;\n\t}\n\n\t/**\n\t * Iterates over the stores's schema entries.\n\t *\n\t * @returns An iterator for the stores's schema entries\n\t */\n\tpublic entries(): IterableIterator<EntryOfStore<this>> {\n\t\treturn this.#schemas.entries() as IterableIterator<EntryOfStore<this>>;\n\t}\n\n\t/**\n\t * Iterates over the stores's schema entries.\n\t *\n\t * @returns An iterator for the stores's schema entries\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<EntryOfStore<this>> {\n\t\treturn this.entries();\n\t}\n}\n\ntype Merge<Entries extends object, Id extends number, Type extends object> = Id extends keyof Entries\n\t? never\n\t: SchemaStore<{ [K in Id | keyof Entries]: K extends keyof Entries ? Entries[K] : Type }>;\n\nexport type KeyOfStore<SchemaStoreValue extends object> = SchemaStoreValue extends SchemaStore<infer Schemas> ? keyof Schemas & number : never;\nexport type ValueOfStore<SchemaStoreValue extends object> =\n\tSchemaStoreValue extends SchemaStore<infer Schemas> ? Schemas[keyof Schemas & number] : never;\nexport type EntryOfStore<SchemaStoreValue extends object> =\n\tSchemaStoreValue extends SchemaStore<infer Schemas> ? { [K in keyof Schemas]: readonly [K & number, Schemas[K]] }[keyof Schemas] : never;\n\nexport type DeserializationResult<SchemaStoreEntries extends object> = {\n\t[K in keyof SchemaStoreEntries]: { id: K; data: UnwrapSchema<SchemaStoreEntries[K] & object> };\n}[keyof SchemaStoreEntries];\n"]}
@@ -0,0 +1,423 @@
1
+ /**
2
+ * A pointer to a position in a buffer.
3
+ *
4
+ * This is used to keep track of the current position in a buffer while allowing
5
+ * the position to be updated by multiple different functions.
6
+ *
7
+ * @privateRemarks
8
+ *
9
+ * This class draws inspiration from the following constructs:
10
+ * - `int*` in C/C++
11
+ * - `ref int` in C#
12
+ * - `*mut i32` in Rust
13
+ */
14
+ declare class Pointer {
15
+ #private;
16
+ get value(): number;
17
+ add(value: number): this;
18
+ static from(pointer: PointerLike): Pointer;
19
+ }
20
+ type PointerLike = Pointer | {
21
+ valueOf(): number;
22
+ } | {
23
+ [Symbol.toPrimitive](hint: 'number'): number;
24
+ };
25
+
26
+ declare class UnalignedUint16Array {
27
+ #private;
28
+ constructor(maxLength: number);
29
+ get maxLength(): number;
30
+ get maxBitLength(): number;
31
+ get length(): number;
32
+ get bitLength(): number;
33
+ writeBit(value: number): void;
34
+ writeInt2(value: number): void;
35
+ writeInt4(value: number): void;
36
+ writeInt8(value: number): void;
37
+ writeInt16(value: number): void;
38
+ writeInt32(value: number): void;
39
+ writeInt64(value: number): void;
40
+ writeBigInt32(value: bigint): void;
41
+ writeBigInt64(value: bigint): void;
42
+ writeFloat32(value: number): void;
43
+ writeFloat64(value: number): void;
44
+ readBit(offset: PointerLike): 0 | 1;
45
+ readInt2(offset: PointerLike): number;
46
+ readInt4(offset: PointerLike): number;
47
+ readInt8(offset: PointerLike): number;
48
+ readInt16(offset: PointerLike): number;
49
+ readInt32(offset: PointerLike): number;
50
+ readInt64(offset: PointerLike): number;
51
+ readBigInt32(offset: PointerLike): bigint;
52
+ readBigInt64(offset: PointerLike): bigint;
53
+ readFloat32(offset: PointerLike): number;
54
+ readFloat64(offset: PointerLike): number;
55
+ toString(): string;
56
+ toArray(): Uint16Array;
57
+ static from(value: string | UnalignedUint16Array): UnalignedUint16Array;
58
+ }
59
+
60
+ interface IType<ValueType, BitSize extends number | null> {
61
+ /**
62
+ * Serialize a value to a buffer.
63
+ *
64
+ * @param buffer The buffer to write to
65
+ * @param value The value to write
66
+ */
67
+ serialize(buffer: UnalignedUint16Array, value: Readonly<ValueType>): void;
68
+ /**
69
+ * Deserialize a value from a buffer.
70
+ *
71
+ * @param buffer The buffer to read from
72
+ * @param pointer The pointer indicating the current position in the buffer
73
+ */
74
+ deserialize(buffer: UnalignedUint16Array, pointer: Pointer): ValueType;
75
+ /**
76
+ * The size of the value in bits, or `null` if the size is variable.
77
+ */
78
+ readonly BIT_SIZE: BitSize;
79
+ }
80
+
81
+ declare class Schema<Id extends number = number, Entries extends object = object> {
82
+ #private;
83
+ /**
84
+ * Creates a new schema.
85
+ *
86
+ * @param id The id of the schema
87
+ */
88
+ constructor(id: Id);
89
+ /**
90
+ * The id of the schema.
91
+ */
92
+ get id(): Id;
93
+ /**
94
+ * The total bit size of the schema.
95
+ *
96
+ * @remarks
97
+ *
98
+ * If any of the entries have a bit size of `null`, the bit size of the
99
+ * schema will also be `null`.
100
+ */
101
+ get bitSize(): number | null;
102
+ /**
103
+ * Get a property from the schema.
104
+ *
105
+ * @param name The name of the property
106
+ * @returns The specified property
107
+ *
108
+ * @remarks
109
+ *
110
+ * If the property does not exist, an error will be thrown.
111
+ */
112
+ get<const Name extends keyof Entries & string>(name: Name): Entries[Name];
113
+ /**
114
+ * Serialize a value into a buffer.
115
+ *
116
+ * @param buffer The buffer to serialize
117
+ * @param value The value to serialize into the buffer
118
+ *
119
+ * @remarks
120
+ *
121
+ * The schema's ID is written to the buffer first, followed by each property
122
+ * in the schema.
123
+ */
124
+ serialize(buffer: UnalignedUint16Array, value: Readonly<UnwrapSchemaEntries<Entries>>): void;
125
+ /**
126
+ * Deserialize a value from a buffer.
127
+ *
128
+ * @param buffer The buffer to deserialize
129
+ * @param pointer The pointer to where the buffer should be read from
130
+ * @returns The deserialized value
131
+ *
132
+ * @remarks
133
+ *
134
+ * Unlike {@link Schema.serialize}, this method does not read the schema's ID
135
+ * from the buffer, that is reserved for the {@link SchemaStore}.
136
+ */
137
+ deserialize(buffer: UnalignedUint16Array, pointer: PointerLike): UnwrapSchemaEntries<Entries>;
138
+ /**
139
+ * Adds an array property to the schema.
140
+ *
141
+ * @seealso {@link Schema.fixedLengthArray} for a fixed length array
142
+ *
143
+ * @param name The name of the property
144
+ * @param type The type of the entry in the array
145
+ * @returns The modified schema
146
+ */
147
+ array<const Name extends string, const ValueType, const ValueBitSize extends number | null>(name: Name, type: IType<ValueType, ValueBitSize>): Merge$1<Id, Entries, Name, IType<ValueType[], null>>;
148
+ /**
149
+ * Adds a fixed length array property to the schema.
150
+ *
151
+ * @seealso {@link Schema.array} for a dynamic length array
152
+ *
153
+ * @param name The name of the property
154
+ * @param type The type of the entry in the array
155
+ * @param length The length of the array
156
+ * @returns The modified schema
157
+ */
158
+ fixedLengthArray<const Name extends string, const ValueType, const ValueBitSize extends number | null>(name: Name, type: IType<ValueType, ValueBitSize>, length: number): Merge$1<Id, Entries, Name, IType<ValueType[], ValueBitSize extends null ? null : number>>;
159
+ /**
160
+ * Adds a string property to the schema.
161
+ *
162
+ * @param name The name of the property
163
+ * @returns The modified schema
164
+ */
165
+ string<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<string, null>>;
166
+ /**
167
+ * Adds a boolean property to the schema.
168
+ *
169
+ * @param name The name of the property
170
+ * @returns The modified schema
171
+ */
172
+ boolean<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<boolean, 1>>;
173
+ /**
174
+ * Adds a bit property to the schema.
175
+ *
176
+ * @param name The name of the property
177
+ * @returns The modified schema
178
+ */
179
+ bit<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 1>>;
180
+ /**
181
+ * Adds a 2-bit integer property to the schema.
182
+ *
183
+ * @param name The name of the property
184
+ * @returns The modified schema
185
+ */
186
+ int2<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 2>>;
187
+ /**
188
+ * Adds a 4-bit integer property to the schema.
189
+ *
190
+ * @param name The name of the property
191
+ * @returns The modified schema
192
+ */
193
+ int4<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 4>>;
194
+ /**
195
+ * Adds a 8-bit integer property to the schema.
196
+ *
197
+ * @param name The name of the property
198
+ * @returns The modified schema
199
+ */
200
+ int8<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 8>>;
201
+ /**
202
+ * Adds a 16-bit integer property to the schema.
203
+ *
204
+ * @param name The name of the property
205
+ * @returns The modified schema
206
+ */
207
+ int16<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 16>>;
208
+ /**
209
+ * Adds a 32-bit integer property to the schema.
210
+ *
211
+ * @param name The name of the property
212
+ * @returns The modified schema
213
+ */
214
+ int32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 32>>;
215
+ /**
216
+ * Adds a 64-bit integer property to the schema.
217
+ *
218
+ * @param name The name of the property
219
+ * @returns The modified schema
220
+ */
221
+ int64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 64>>;
222
+ /**
223
+ * Adds a 32-bit big integer property to the schema.
224
+ *
225
+ * @param name The name of the property
226
+ * @returns The modified schema
227
+ */
228
+ bigInt32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 32>>;
229
+ /**
230
+ * Adds a 64-bit big integer property to the schema.
231
+ *
232
+ * @param name The name of the property
233
+ * @returns The modified schema
234
+ */
235
+ bigInt64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 64>>;
236
+ /**
237
+ * Adds a 32-bit floating point number property to the schema.
238
+ *
239
+ * @param name The name of the property
240
+ * @returns The modified schema
241
+ */
242
+ float32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 32>>;
243
+ /**
244
+ * Adds a 64-bit floating point number property to the schema.
245
+ *
246
+ * @param name The name of the property
247
+ * @returns The modified schema
248
+ */
249
+ float64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 64>>;
250
+ /**
251
+ * Adds a 64-bit big integer property to the schema, similar to {@link Schema.bigInt64}.
252
+ *
253
+ * @param name The name of the property
254
+ * @returns The modified schema
255
+ */
256
+ snowflake<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 64>>;
257
+ /**
258
+ * Iterates over the schema's property names.
259
+ *
260
+ * @returns An iterator for the schema's property names
261
+ */
262
+ keys(): IterableIterator<KeyOfSchema<this>>;
263
+ /**
264
+ * Iterates over the schema's property values
265
+ *
266
+ * @returns An iterator for the schema's property values
267
+ */
268
+ values(): IterableIterator<ValueOfSchema<this>>;
269
+ /**
270
+ * Iterates over the schema's property entries
271
+ *
272
+ * @returns An iterator for the schema's property entries
273
+ */
274
+ entries(): IterableIterator<EntryOfSchema<this>>;
275
+ /**
276
+ * Iterates over the schema's property entries
277
+ *
278
+ * @returns An iterator for the schema's property entries
279
+ */
280
+ [Symbol.iterator](): IterableIterator<EntryOfSchema<this>>;
281
+ }
282
+ type Merge$1<Id extends number, Entries extends object, EntryName extends string, EntryType extends IType<any, number | null>> = EntryName extends keyof Entries ? never : Schema<Id, {
283
+ [K in EntryName | keyof Entries]: K extends keyof Entries ? Entries[K] : EntryType;
284
+ }>;
285
+ type KeyOfSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? keyof Type & string : never;
286
+ type ValueOfSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? {
287
+ [K in keyof Type]: Type[K];
288
+ }[keyof Type] : never;
289
+ type EntryOfSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? {
290
+ [K in keyof Type]: readonly [K, Type[K]];
291
+ }[keyof Type] : never;
292
+ type UnwrapSchemaType<Type extends object> = Type extends IType<infer T, infer _> ? T : never;
293
+ type UnwrapSchemaEntries<Entries extends object> = {
294
+ [K in keyof Entries]: UnwrapSchemaType<Entries[K] & object>;
295
+ } & object;
296
+ type UnwrapSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? UnwrapSchemaEntries<Type> : never;
297
+
298
+ declare class SchemaStore<Entries extends object = object> {
299
+ #private;
300
+ /**
301
+ * The default maximum array length for schemas
302
+ */
303
+ defaultMaximumArrayLength: number;
304
+ /**
305
+ * Creates a new schema store
306
+ *
307
+ * @param defaultMaximumArrayLength The default maximum array length for schemas
308
+ */
309
+ constructor(defaultMaximumArrayLength?: number);
310
+ /**
311
+ * Adds a schema to the store
312
+ *
313
+ * @param schema The schema to add to the store
314
+ * @returns The modified store
315
+ *
316
+ * @remarks
317
+ *
318
+ * An error will be thrown if a schema with the same id already exists in the store.
319
+ */
320
+ add<const Id extends number, const SchemaType extends object>(schema: Schema<Id, SchemaType>): Merge<Entries, Id, typeof schema>;
321
+ /**
322
+ * Gets a schema from the store
323
+ *
324
+ * @param id The id of the schema to get
325
+ * @returns The schema with the given id
326
+ *
327
+ * @remarks
328
+ *
329
+ * An error will be thrown if a schema with the given id does not exist in the store.
330
+ */
331
+ get<const Id extends KeyOfStore<this>>(id: Id): Entries[Id];
332
+ /**
333
+ * Serializes a value using the schema with the given id
334
+ *
335
+ * @param id The id of the schema to use for serialization
336
+ * @param value The value to serialize
337
+ * @returns The serialized buffer
338
+ */
339
+ serialize<const Id extends KeyOfStore<this>>(id: Id, value: Readonly<UnwrapSchema<Entries[Id] & object>>): UnalignedUint16Array;
340
+ /**
341
+ * Deserializes a buffer
342
+ *
343
+ * @param buffer The buffer to deserialize
344
+ * @returns The resolved value, including the id of the schema used for deserialization
345
+ */
346
+ deserialize(buffer: string | UnalignedUint16Array): DeserializationResult<Entries>;
347
+ /**
348
+ * Iterates over the stores's schema identifiers.
349
+ *
350
+ * @returns An iterator for the stores's schema identifiers
351
+ */
352
+ keys(): IterableIterator<KeyOfStore<this>>;
353
+ /**
354
+ * Iterates over the stores's schemas.
355
+ *
356
+ * @returns An iterator for the stores's schemas
357
+ */
358
+ values(): IterableIterator<ValueOfStore<this>>;
359
+ /**
360
+ * Iterates over the stores's schema entries.
361
+ *
362
+ * @returns An iterator for the stores's schema entries
363
+ */
364
+ entries(): IterableIterator<EntryOfStore<this>>;
365
+ /**
366
+ * Iterates over the stores's schema entries.
367
+ *
368
+ * @returns An iterator for the stores's schema entries
369
+ */
370
+ [Symbol.iterator](): IterableIterator<EntryOfStore<this>>;
371
+ }
372
+ type Merge<Entries extends object, Id extends number, Type extends object> = Id extends keyof Entries ? never : SchemaStore<{
373
+ [K in Id | keyof Entries]: K extends keyof Entries ? Entries[K] : Type;
374
+ }>;
375
+ type KeyOfStore<SchemaStoreValue extends object> = SchemaStoreValue extends SchemaStore<infer Schemas> ? keyof Schemas & number : never;
376
+ type ValueOfStore<SchemaStoreValue extends object> = SchemaStoreValue extends SchemaStore<infer Schemas> ? Schemas[keyof Schemas & number] : never;
377
+ type EntryOfStore<SchemaStoreValue extends object> = SchemaStoreValue extends SchemaStore<infer Schemas> ? {
378
+ [K in keyof Schemas]: readonly [K & number, Schemas[K]];
379
+ }[keyof Schemas] : never;
380
+ type DeserializationResult<SchemaStoreEntries extends object> = {
381
+ [K in keyof SchemaStoreEntries]: {
382
+ id: K;
383
+ data: UnwrapSchema<SchemaStoreEntries[K] & object>;
384
+ };
385
+ }[keyof SchemaStoreEntries];
386
+
387
+ declare function ArrayType<ValueType, ValueBitSize extends number | null>(type: IType<ValueType, ValueBitSize>): IType<ValueType[], null>;
388
+
389
+ declare const BigInt32Type: IType<bigint, 32>;
390
+
391
+ declare const BigInt64Type: IType<bigint, 64>;
392
+
393
+ declare const BitType: IType<number, 1>;
394
+
395
+ declare const BooleanType: IType<boolean, 1>;
396
+
397
+ declare function FixedLengthArrayType<ValueType, ValueBitSize extends number | null>(type: IType<ValueType, ValueBitSize>, length: number): IType<ValueType[], ValueBitSize extends null ? null : number>;
398
+
399
+ declare const Float32Type: IType<number, 32>;
400
+
401
+ declare const Float64Type: IType<number, 64>;
402
+
403
+ declare const Int16Type: IType<number, 16>;
404
+
405
+ declare const Int2Type: IType<number, 2>;
406
+
407
+ declare const Int32Type: IType<number, 32>;
408
+
409
+ declare const Int4Type: IType<number, 4>;
410
+
411
+ declare const Int64Type: IType<number, 64>;
412
+
413
+ declare const Int8Type: IType<number, 8>;
414
+
415
+ declare const SnowflakeType: {
416
+ readonly serialize: (buffer: UnalignedUint16Array, value: bigint | string) => void;
417
+ readonly deserialize: (buffer: UnalignedUint16Array, offset: Pointer) => bigint;
418
+ readonly BIT_SIZE: 64;
419
+ };
420
+
421
+ declare const StringType: IType<string, null>;
422
+
423
+ export { ArrayType, BigInt32Type, BigInt64Type, BitType, BooleanType, type DeserializationResult, type EntryOfSchema, type EntryOfStore, FixedLengthArrayType, Float32Type, Float64Type, type IType, Int16Type, Int2Type, Int32Type, Int4Type, Int64Type, Int8Type, type KeyOfSchema, type KeyOfStore, Pointer, type PointerLike, Schema, SchemaStore, SnowflakeType, StringType, UnalignedUint16Array, type UnwrapSchema, type UnwrapSchemaEntries, type UnwrapSchemaType, type ValueOfSchema, type ValueOfStore };