@sapphire/string-store 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,630 @@
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
+ readUint2(offset: PointerLike): number;
47
+ readInt4(offset: PointerLike): number;
48
+ readUint4(offset: PointerLike): number;
49
+ readInt8(offset: PointerLike): number;
50
+ readUint8(offset: PointerLike): number;
51
+ readInt16(offset: PointerLike): number;
52
+ readUint16(offset: PointerLike): number;
53
+ readInt32(offset: PointerLike): number;
54
+ readUint32(offset: PointerLike): number;
55
+ readInt64(offset: PointerLike): number;
56
+ readUint64(offset: PointerLike): number;
57
+ readBigInt32(offset: PointerLike): bigint;
58
+ readBigUint32(offset: PointerLike): bigint;
59
+ readBigInt64(offset: PointerLike): bigint;
60
+ readBigUint64(offset: PointerLike): bigint;
61
+ readFloat32(offset: PointerLike): number;
62
+ readFloat64(offset: PointerLike): number;
63
+ toString(): string;
64
+ toArray(): Uint16Array;
65
+ static from(value: string | UnalignedUint16Array): UnalignedUint16Array;
66
+ }
67
+
68
+ interface IType<ValueType, BitSize extends number | null> {
69
+ /**
70
+ * Serialize a value to a buffer.
71
+ *
72
+ * @param buffer The buffer to write to
73
+ * @param value The value to write
74
+ */
75
+ serialize(buffer: UnalignedUint16Array, value: Readonly<ValueType>): void;
76
+ /**
77
+ * Deserialize a value from a buffer.
78
+ *
79
+ * @param buffer The buffer to read from
80
+ * @param pointer The pointer indicating the current position in the buffer
81
+ */
82
+ deserialize(buffer: UnalignedUint16Array, pointer: Pointer): ValueType;
83
+ /**
84
+ * The size of the value in bits, or `null` if the size is variable.
85
+ */
86
+ readonly BIT_SIZE: BitSize;
87
+ }
88
+
89
+ declare function ArrayType<ValueType, ValueBitSize extends number | null>(type: IType<ValueType, ValueBitSize>): IType<ValueType[], null>;
90
+
91
+ declare const BigInt32Type: IType<bigint, 32>;
92
+
93
+ declare const BigInt64Type: IType<bigint, 64>;
94
+
95
+ declare const BigUint32Type: IType<bigint, 32>;
96
+
97
+ declare const BigUint64Type: IType<bigint, 64>;
98
+
99
+ declare const BitType: IType<number, 1>;
100
+
101
+ declare const BooleanType: IType<boolean, 1>;
102
+
103
+ declare function FixedLengthArrayType<ValueType, ValueBitSize extends number | null>(type: IType<ValueType, ValueBitSize>, length: number): IType<ValueType[], ValueBitSize extends null ? null : number>;
104
+
105
+ declare const Float32Type: IType<number, 32>;
106
+
107
+ declare const Float64Type: IType<number, 64>;
108
+
109
+ declare const Int16Type: IType<number, 16>;
110
+
111
+ declare const Int2Type: IType<number, 2>;
112
+
113
+ declare const Int32Type: IType<number, 32>;
114
+
115
+ declare const Int4Type: IType<number, 4>;
116
+
117
+ declare const Int64Type: IType<number, 64>;
118
+
119
+ declare const Int8Type: IType<number, 8>;
120
+
121
+ declare const SnowflakeType: {
122
+ readonly serialize: (buffer: UnalignedUint16Array, value: bigint | string) => void;
123
+ readonly deserialize: (buffer: UnalignedUint16Array, offset: Pointer) => bigint;
124
+ readonly BIT_SIZE: 64;
125
+ };
126
+
127
+ declare const StringType: IType<string, null>;
128
+
129
+ declare const Uint16Type: IType<number, 16>;
130
+
131
+ declare const Uint2Type: IType<number, 2>;
132
+
133
+ declare const Uint32Type: IType<number, 32>;
134
+
135
+ declare const Uint4Type: IType<number, 4>;
136
+
137
+ declare const Uint64Type: IType<number, 64>;
138
+
139
+ declare const Uint8Type: IType<number, 8>;
140
+
141
+ declare const t: {
142
+ array: typeof ArrayType;
143
+ bigInt32: IType<bigint, 32>;
144
+ bigInt64: IType<bigint, 64>;
145
+ bigUint32: IType<bigint, 32>;
146
+ bigUint64: IType<bigint, 64>;
147
+ bit: IType<number, 1>;
148
+ boolean: IType<boolean, 1>;
149
+ fixedLengthArray: typeof FixedLengthArrayType;
150
+ float32: IType<number, 32>;
151
+ float64: IType<number, 64>;
152
+ int16: IType<number, 16>;
153
+ int2: IType<number, 2>;
154
+ int32: IType<number, 32>;
155
+ int4: IType<number, 4>;
156
+ int64: IType<number, 64>;
157
+ int8: IType<number, 8>;
158
+ snowflake: {
159
+ readonly serialize: (buffer: UnalignedUint16Array, value: string | bigint) => void;
160
+ readonly deserialize: (buffer: UnalignedUint16Array, offset: Pointer) => bigint;
161
+ readonly BIT_SIZE: 64;
162
+ };
163
+ string: IType<string, null>;
164
+ uint16: IType<number, 16>;
165
+ uint2: IType<number, 2>;
166
+ uint32: IType<number, 32>;
167
+ uint4: IType<number, 4>;
168
+ uint64: IType<number, 64>;
169
+ uint8: IType<number, 8>;
170
+ };
171
+
172
+ declare class Schema<Id extends number = number, Entries extends object = object> {
173
+ #private;
174
+ /**
175
+ * Creates a new schema.
176
+ *
177
+ * @param id The id of the schema
178
+ */
179
+ constructor(id: Id);
180
+ /**
181
+ * The id of the schema.
182
+ */
183
+ get id(): Id;
184
+ /**
185
+ * The total bit size of the schema.
186
+ *
187
+ * @remarks
188
+ *
189
+ * If any of the entries have a bit size of `null`, the bit size of the
190
+ * schema will also be `null`.
191
+ */
192
+ get bitSize(): number | null;
193
+ /**
194
+ * Get a property from the schema.
195
+ *
196
+ * @param name The name of the property
197
+ * @returns The specified property
198
+ *
199
+ * @remarks
200
+ *
201
+ * If the property does not exist, an error will be thrown.
202
+ */
203
+ get<const Name extends keyof Entries & string>(name: Name): Entries[Name];
204
+ /**
205
+ * Serialize a value into a buffer.
206
+ *
207
+ * @param buffer The buffer to serialize
208
+ * @param value The value to serialize into the buffer
209
+ *
210
+ * @remarks
211
+ *
212
+ * The schema's ID is written to the buffer first, followed by each property
213
+ * in the schema.
214
+ */
215
+ serialize(buffer: UnalignedUint16Array, value: Readonly<UnwrapSchemaEntries<Entries>>): void;
216
+ /**
217
+ * Deserialize a value from a buffer.
218
+ *
219
+ * @param buffer The buffer to deserialize
220
+ * @param pointer The pointer to where the buffer should be read from
221
+ * @returns The deserialized value
222
+ *
223
+ * @remarks
224
+ *
225
+ * Unlike {@link Schema.serialize}, this method does not read the schema's ID
226
+ * from the buffer, that is reserved for the {@link SchemaStore}.
227
+ */
228
+ deserialize(buffer: UnalignedUint16Array, pointer: PointerLike): UnwrapSchemaEntries<Entries>;
229
+ /**
230
+ * Adds an array property to the schema.
231
+ *
232
+ * @seealso {@link Schema.fixedLengthArray} for a fixed length array
233
+ *
234
+ * @param name The name of the property
235
+ * @param type The type of the entry in the array
236
+ * @returns The modified schema
237
+ */
238
+ 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>>;
239
+ /**
240
+ * Adds a fixed length array property to the schema.
241
+ *
242
+ * @seealso {@link Schema.array} for a dynamic length array
243
+ *
244
+ * @param name The name of the property
245
+ * @param type The type of the entry in the array
246
+ * @param length The length of the array
247
+ * @returns The modified schema
248
+ */
249
+ 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>>;
250
+ /**
251
+ * Adds a string property to the schema.
252
+ *
253
+ * @param name The name of the property
254
+ * @returns The modified schema
255
+ */
256
+ string<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<string, null>>;
257
+ /**
258
+ * Adds a boolean property to the schema.
259
+ *
260
+ * @param name The name of the property
261
+ * @returns The modified schema
262
+ */
263
+ boolean<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<boolean, 1>>;
264
+ /**
265
+ * Adds a bit property to the schema.
266
+ *
267
+ * @param name The name of the property
268
+ * @returns The modified schema
269
+ */
270
+ bit<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 1>>;
271
+ /**
272
+ * Adds a 2-bit integer property to the schema.
273
+ *
274
+ * @remarks
275
+ *
276
+ * The range of values is from -2 to 1, inclusive.
277
+ *
278
+ * @param name The name of the property
279
+ * @returns The modified schema
280
+ */
281
+ int2<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 2>>;
282
+ /**
283
+ * Adds a 2-bit unsigned integer property to the schema.
284
+ *
285
+ * @remarks
286
+ *
287
+ * The range of values is from 0 to 3, inclusive.
288
+ *
289
+ * @param name The name of the property
290
+ * @returns The modified schema
291
+ */
292
+ uint2<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 2>>;
293
+ /**
294
+ * Adds a 4-bit integer property to the schema.
295
+ *
296
+ * @remarks
297
+ *
298
+ * The range of values is from -8 to 7, inclusive.
299
+ *
300
+ * @param name The name of the property
301
+ * @returns The modified schema
302
+ */
303
+ int4<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 4>>;
304
+ /**
305
+ * Adds a 4-bit unsigned integer property to the schema.
306
+ *
307
+ * @remarks
308
+ *
309
+ * The range of values is from 0 to 15, inclusive.
310
+ *
311
+ * @param name The name of the property
312
+ * @returns The modified schema
313
+ */
314
+ uint4<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 4>>;
315
+ /**
316
+ * Adds a 8-bit integer property to the schema.
317
+ *
318
+ * @remarks
319
+ *
320
+ * The range of values is from -128 to 127, inclusive.
321
+ *
322
+ * @param name The name of the property
323
+ * @returns The modified schema
324
+ */
325
+ int8<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 8>>;
326
+ /**
327
+ * Adds a 8-bit unsigned integer property to the schema.
328
+ *
329
+ * @remarks
330
+ *
331
+ * The range of values is from 0 to 255, inclusive.
332
+ *
333
+ * @param name The name of the property
334
+ * @returns The modified schema
335
+ */
336
+ uint8<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 8>>;
337
+ /**
338
+ * Adds a 16-bit integer property to the schema.
339
+ *
340
+ * @remarks
341
+ *
342
+ * The range of values is from -32768 to 32767, inclusive.
343
+ *
344
+ * @param name The name of the property
345
+ * @returns The modified schema
346
+ */
347
+ int16<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 16>>;
348
+ /**
349
+ * Adds a 16-bit unsigned integer property to the schema.
350
+ *
351
+ * @remarks
352
+ *
353
+ * The range of values is from 0 to 65535, inclusive.
354
+ *
355
+ * @param name The name of the property
356
+ * @returns The modified schema
357
+ */
358
+ uint16<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 16>>;
359
+ /**
360
+ * Adds a 32-bit integer property to the schema.
361
+ *
362
+ * @remarks
363
+ *
364
+ * The range of values is from -2_147_483_648 to 2_147_483_647, inclusive.
365
+ *
366
+ * @param name The name of the property
367
+ * @returns The modified schema
368
+ */
369
+ int32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 32>>;
370
+ /**
371
+ * Adds a 32-bit unsigned integer property to the schema.
372
+ *
373
+ * @remarks
374
+ *
375
+ * The range of values is from 0 to 4_294_967_295, inclusive.
376
+ *
377
+ * @param name The name of the property
378
+ * @returns The modified schema
379
+ */
380
+ uint32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 32>>;
381
+ /**
382
+ * Adds a 64-bit integer property to the schema.
383
+ *
384
+ * @remarks
385
+ *
386
+ * The range of values is from -9_223_372_036_854_775_808 to 9_223_372_036_854_775_807, inclusive.
387
+ *
388
+ * However, it may run into precision issues past the range of `-9_007_199_254_740_991` to `9_007_199_254_740_991`
389
+ *
390
+ * @param name The name of the property
391
+ * @returns The modified schema
392
+ */
393
+ int64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 64>>;
394
+ /**
395
+ * Adds a 64-bit unsigned integer property to the schema.
396
+ *
397
+ * @remarks
398
+ *
399
+ * The range of values is from 0 to 18_446_744_073_709_551_615, inclusive.
400
+ *
401
+ * However, it may run into precision issues past `9_007_199_254_740_991`
402
+ *
403
+ * @param name The name of the property
404
+ * @returns The modified schema
405
+ */
406
+ uint64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 64>>;
407
+ /**
408
+ * Adds a 32-bit big integer property to the schema.
409
+ *
410
+ * @remarks
411
+ *
412
+ * The range of values is from -2_147_483_648n to 2_147_483_647n, inclusive.
413
+ *
414
+ * @param name The name of the property
415
+ * @returns The modified schema
416
+ */
417
+ bigInt32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 32>>;
418
+ /**
419
+ * Adds a 32-bit big integer property to the schema.
420
+ *
421
+ * @remarks
422
+ *
423
+ * The range of values is from 0n to 4_294_967_295n, inclusive.
424
+ *
425
+ * @param name The name of the property
426
+ * @returns The modified schema
427
+ */
428
+ bigUint32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 32>>;
429
+ /**
430
+ * Adds a 64-bit big integer property to the schema.
431
+ *
432
+ * @remarks
433
+ *
434
+ * The range of values is from -9_223_372_036_854_775_808n to 9_223_372_036_854_775_807n, inclusive.
435
+ *
436
+ * @param name The name of the property
437
+ * @returns The modified schema
438
+ */
439
+ bigInt64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 64>>;
440
+ /**
441
+ * Adds a 64-bit big integer property to the schema.
442
+ *
443
+ * @remarks
444
+ *
445
+ * The range of values is from 0n to 18_446_744_073_709_551_615n, inclusive.
446
+ *
447
+ * @param name The name of the property
448
+ * @returns The modified schema
449
+ */
450
+ bigUint64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 64>>;
451
+ /**
452
+ * Adds a 32-bit floating point number property to the schema.
453
+ *
454
+ * @remarks
455
+ *
456
+ * The range of values is from -3.4028234663852886e+38 to 3.4028234663852886e+38, inclusive.
457
+ *
458
+ * @param name The name of the property
459
+ * @returns The modified schema
460
+ */
461
+ float32<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 32>>;
462
+ /**
463
+ * Adds a 64-bit floating point number property to the schema.
464
+ *
465
+ * @remarks
466
+ *
467
+ * The range of values is from -1.7976931348623157e+308 to 1.7976931348623157e+308, inclusive.
468
+ *
469
+ * @param name The name of the property
470
+ * @returns The modified schema
471
+ */
472
+ float64<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<number, 64>>;
473
+ /**
474
+ * Adds a 64-bit big integer property to the schema, similar to {@link Schema.bigUint64}.
475
+ *
476
+ * @remarks
477
+ *
478
+ * The range of values is from 0n to 18_446_744_073_709_551_615n, inclusive.
479
+ *
480
+ * @param name The name of the property
481
+ * @returns The modified schema
482
+ */
483
+ snowflake<const Name extends string>(name: Name): Merge$1<Id, Entries, Name, IType<bigint, 64>>;
484
+ /**
485
+ * Iterates over the schema's property names.
486
+ *
487
+ * @returns An iterator for the schema's property names
488
+ */
489
+ keys(): IterableIterator<KeyOfSchema<this>>;
490
+ /**
491
+ * Iterates over the schema's property values
492
+ *
493
+ * @returns An iterator for the schema's property values
494
+ */
495
+ values(): IterableIterator<ValueOfSchema<this>>;
496
+ /**
497
+ * Iterates over the schema's property entries
498
+ *
499
+ * @returns An iterator for the schema's property entries
500
+ */
501
+ entries(): IterableIterator<EntryOfSchema<this>>;
502
+ /**
503
+ * Iterates over the schema's property entries
504
+ *
505
+ * @returns An iterator for the schema's property entries
506
+ */
507
+ [Symbol.iterator](): IterableIterator<EntryOfSchema<this>>;
508
+ }
509
+ 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, {
510
+ [K in EntryName | keyof Entries]: K extends keyof Entries ? Entries[K] : EntryType;
511
+ }>;
512
+ type KeyOfSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? keyof Type & string : never;
513
+ type ValueOfSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? {
514
+ [K in keyof Type]: Type[K];
515
+ }[keyof Type] : never;
516
+ type EntryOfSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? {
517
+ [K in keyof Type]: readonly [K, Type[K]];
518
+ }[keyof Type] : never;
519
+ type UnwrapSchemaType<Type extends object> = Type extends IType<infer T, infer _> ? T : never;
520
+ type UnwrapSchemaEntries<Entries extends object> = {
521
+ [K in keyof Entries]: UnwrapSchemaType<Entries[K] & object>;
522
+ } & object;
523
+ type UnwrapSchema<SchemaValue extends object> = SchemaValue extends Schema<infer _, infer Type> ? UnwrapSchemaEntries<Type> : never;
524
+
525
+ declare class SchemaStore<Entries extends object = object> {
526
+ #private;
527
+ /**
528
+ * The default maximum array length for schemas
529
+ */
530
+ defaultMaximumArrayLength: number;
531
+ /**
532
+ * Creates a new schema store
533
+ *
534
+ * @param defaultMaximumArrayLength The default maximum array length for schemas
535
+ */
536
+ constructor(defaultMaximumArrayLength?: number);
537
+ /**
538
+ * Adds a schema to the store
539
+ *
540
+ * @param schema The schema to add to the store
541
+ * @returns The modified store
542
+ *
543
+ * @remarks
544
+ *
545
+ * An error will be thrown if a schema with the same id already exists in the store.
546
+ */
547
+ add<const Id extends number, const SchemaType extends object>(schema: Schema<Id, SchemaType>): Merge<Entries, Id, typeof schema>;
548
+ /**
549
+ * Gets a schema from the store
550
+ *
551
+ * @param id The id of the schema to get
552
+ * @returns The schema with the given id
553
+ *
554
+ * @remarks
555
+ *
556
+ * An error will be thrown if a schema with the given id does not exist in the store.
557
+ */
558
+ get<const Id extends KeyOfStore<this>>(id: Id): Entries[Id];
559
+ /**
560
+ * Serializes a value using the schema with the given id
561
+ *
562
+ * @param id The id of the schema to use for serialization
563
+ * @param value The value to serialize
564
+ * @returns The serialized buffer
565
+ */
566
+ serialize<const Id extends KeyOfStore<this>>(id: Id, value: Readonly<UnwrapSchema<Entries[Id] & object>>): UnalignedUint16Array;
567
+ /**
568
+ * Deserializes a buffer
569
+ *
570
+ * @param buffer The buffer to deserialize
571
+ * @returns The resolved value, including the id of the schema used for deserialization
572
+ */
573
+ deserialize(buffer: string | UnalignedUint16Array): DeserializationResult<Entries>;
574
+ /**
575
+ * Iterates over the stores's schema identifiers.
576
+ *
577
+ * @returns An iterator for the stores's schema identifiers
578
+ */
579
+ keys(): IterableIterator<KeyOfStore<this>>;
580
+ /**
581
+ * Iterates over the stores's schemas.
582
+ *
583
+ * @returns An iterator for the stores's schemas
584
+ */
585
+ values(): IterableIterator<ValueOfStore<this>>;
586
+ /**
587
+ * Iterates over the stores's schema entries.
588
+ *
589
+ * @returns An iterator for the stores's schema entries
590
+ */
591
+ entries(): IterableIterator<EntryOfStore<this>>;
592
+ /**
593
+ * Iterates over the stores's schema entries.
594
+ *
595
+ * @returns An iterator for the stores's schema entries
596
+ */
597
+ [Symbol.iterator](): IterableIterator<EntryOfStore<this>>;
598
+ }
599
+ type Merge<Entries extends object, Id extends number, Type extends object> = Id extends keyof Entries ? never : SchemaStore<{
600
+ [K in Id | keyof Entries]: K extends keyof Entries ? Entries[K] : Type;
601
+ }>;
602
+ type KeyOfStore<SchemaStoreValue extends object> = SchemaStoreValue extends SchemaStore<infer Schemas> ? keyof Schemas & number : never;
603
+ type ValueOfStore<SchemaStoreValue extends object> = SchemaStoreValue extends SchemaStore<infer Schemas> ? Schemas[keyof Schemas & number] : never;
604
+ type EntryOfStore<SchemaStoreValue extends object> = SchemaStoreValue extends SchemaStore<infer Schemas> ? {
605
+ [K in keyof Schemas]: readonly [K & number, Schemas[K]];
606
+ }[keyof Schemas] : never;
607
+ type DeserializationResult<SchemaStoreEntries extends object> = {
608
+ [K in keyof SchemaStoreEntries]: {
609
+ id: K;
610
+ data: UnwrapSchema<SchemaStoreEntries[K] & object>;
611
+ };
612
+ }[keyof SchemaStoreEntries];
613
+
614
+ type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
615
+ /**
616
+ * Converts a {@link TypedArray} to a string.
617
+ *
618
+ * @param buffer The buffer to convert
619
+ * @returns The generated UTF16 string
620
+ */
621
+ declare function toUTF16(buffer: TypedArray): string;
622
+ /**
623
+ * Converts a string to a {@link Uint16Array}.
624
+ *
625
+ * @param buffer The string to convert
626
+ * @returns The generated {@link Uint16Array}
627
+ */
628
+ declare function fromUTF16(buffer: string): Uint16Array;
629
+
630
+ export { ArrayType, BigInt32Type, BigInt64Type, BigUint32Type, BigUint64Type, 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, type TypedArray, Uint16Type, Uint2Type, Uint32Type, Uint4Type, Uint64Type, Uint8Type, UnalignedUint16Array, type UnwrapSchema, type UnwrapSchemaEntries, type UnwrapSchemaType, type ValueOfSchema, type ValueOfStore, fromUTF16, t, toUTF16 };