@andrew_l/tl-pack 0.3.22 → 0.4.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.
@@ -1,482 +0,0 @@
1
- import { Data } from '@andrew_l/toolkit';
2
-
3
- declare function createDictionary(values?: string[]): Dictionary;
4
- declare class Dictionary {
5
- private _count;
6
- private _wordToIndex;
7
- private _words;
8
- private _offset;
9
- constructor(values?: string[], offset?: number);
10
- clear(): void;
11
- get size(): number;
12
- /**
13
- * Returns inserted index or nothing
14
- */
15
- maybeInsert(word: string): number | null;
16
- getValue(index: number): string | null;
17
- getIndex(value: string): number | null;
18
- hasValue(value: string): boolean;
19
- hasIndex(index: number): boolean;
20
- }
21
-
22
- type EncodeHandler<T = any> = (this: BinaryWriter, value: T) => void;
23
- type DecodeHandler<T = any> = (this: BinaryReader) => T;
24
- interface TLExtension<T = any> {
25
- token: number;
26
- encode: EncodeHandler<T>;
27
- decode: DecodeHandler<T>;
28
- }
29
- declare function createExtension(token: number, { encode, decode }: {
30
- encode: EncodeHandler;
31
- decode: DecodeHandler;
32
- }): TLExtension;
33
-
34
- interface BinaryWriterOptions {
35
- gzip?: boolean;
36
- dictionary?: string[] | Dictionary;
37
- extensions?: TLExtension[];
38
- structures?: Structure.Constructor[];
39
- }
40
- declare class BinaryWriter {
41
- private withGzip;
42
- private target;
43
- private dictionary;
44
- private dictionaryExtended;
45
- private extensions;
46
- private structures;
47
- private _last;
48
- private offsetChecksum;
49
- private _repeat?;
50
- offset: number;
51
- constructor({ gzip, dictionary, extensions, structures, }?: BinaryWriterOptions);
52
- /**
53
- * Reset internal state
54
- */
55
- reset(): this;
56
- allocate(size: number): this;
57
- private makeRoom;
58
- get safeEnd(): number;
59
- getBuffer(): Uint8Array;
60
- writeByte(value: number): this;
61
- writeBool(value: boolean): this;
62
- writeNull(): this;
63
- writeInt64(value: number | bigint, signed?: boolean): this;
64
- writeInt32(value: number, signed?: boolean): this;
65
- writeInt16(value: number, signed?: boolean): this;
66
- writeInt8(value: number, signed?: boolean): this;
67
- writeFloat(value: number): this;
68
- writeDouble(value: number): this;
69
- writeDate(value: number | Date): this;
70
- writeString(value: string): this;
71
- writeChecksum(withConstructor?: boolean): this;
72
- writeBytes(value: Uint8Array): this;
73
- writeLength(value: number): this;
74
- writeVector(value: Array<any>): this;
75
- writeMap(object: Record<string, any>): this;
76
- wireDictionary(value: string): this;
77
- writeStructure(value: Structure): this;
78
- writeGzip(value: Uint8Array | ArrayBuffer): this;
79
- encode(value: any): Uint8Array;
80
- startDynamicVector(): this;
81
- endDynamicVector(): this;
82
- private _writeCustom;
83
- writeObject(value: any): this;
84
- writeObjectGzip(value: any): this;
85
- private writeCore;
86
- private writeRepeat;
87
- }
88
-
89
- declare enum CORE_TYPES {
90
- None = 0,
91
- Binary = 1,
92
- BoolFalse = 2,
93
- BoolTrue = 3,
94
- Null = 4,
95
- Date = 5,
96
- Vector = 6,
97
- VectorDynamic = 7,
98
- Int64 = 22,
99
- Int32 = 8,
100
- Int16 = 9,
101
- Int8 = 10,
102
- UInt64 = 23,
103
- UInt32 = 11,
104
- UInt16 = 12,
105
- UInt8 = 13,
106
- Float = 14,
107
- Double = 15,
108
- Map = 16,
109
- DictValue = 17,
110
- DictIndex = 18,
111
- String = 19,
112
- Repeat = 20,
113
- Checksum = 21,
114
- GZIP = 25,
115
- Structure = 26
116
- }
117
- declare const MAX_BUFFER_SIZE = 2144337920;
118
-
119
- interface DefineStructureOptions<Props extends Structure.ObjectPropsOptions> {
120
- /**
121
- * Unique name of binary structure
122
- */
123
- readonly name: string;
124
- /**
125
- * Version of binary structure
126
- */
127
- readonly version: number;
128
- /**
129
- * Binary structure properties
130
- */
131
- readonly properties: Props;
132
- /**
133
- * Write checksum to verify decoded data
134
- * @default false
135
- */
136
- readonly checksum?: boolean;
137
- }
138
- /**
139
- * Create binary structure definition with type safety and performance optimization
140
- *
141
- * @example
142
- * // Define a user structure
143
- * const User = defineStructure({
144
- * name: 'User',
145
- * version: 1,
146
- * checksum: true,
147
- * properties: {
148
- * id: { type: Number, required: true },
149
- * name: { type: String, required: true },
150
- * email: { type: String, required: false },
151
- * isActive: { type: Boolean, required: true },
152
- * createdAt: { type: Date, required: true },
153
- * tags: { type: Array, required: false }
154
- * }
155
- * });
156
- *
157
- * // Create and serialize a user
158
- * const user = new User({
159
- * id: 123,
160
- * name: 'John Doe',
161
- * email: 'john@example.com',
162
- * isActive: true,
163
- * createdAt: new Date(),
164
- * tags: ['admin', 'verified']
165
- * });
166
- *
167
- * const buffer = user.toBuffer();
168
- * const restored = User.fromBuffer(buffer);
169
- *
170
- * @example
171
- * // Define nested structures
172
- * const Address = defineStructure({
173
- * name: 'Address',
174
- * version: 1,
175
- * properties: {
176
- * street: { type: String, required: true },
177
- * city: { type: String, required: true },
178
- * zipCode: { type: String, required: true }
179
- * }
180
- * });
181
- *
182
- * const Person = defineStructure({
183
- * name: 'Person',
184
- * version: 1,
185
- * properties: {
186
- * name: { type: String, required: true },
187
- * address: { type: Address, required: false }
188
- * }
189
- * });
190
- *
191
- * @example
192
- * // Using with complex data types
193
- * const GameState = defineStructure({
194
- * name: 'GameState',
195
- * version: 2,
196
- * checksum: true,
197
- * properties: {
198
- * playerData: { type: Object, required: true }, // Untrusted data
199
- * screenshot: { type: Uint8Array, required: false }, // Binary data
200
- * timestamp: { type: Date, required: true },
201
- * metadata: { type: Object, required: false }
202
- * }
203
- * });
204
- *
205
- * @group Main
206
- */
207
- declare function defineStructure<PropsOptions extends Structure.ObjectPropsOptions, T extends Data = Structure.ExtractPropTypes<PropsOptions>>({ name, properties, version, checksum, }: DefineStructureOptions<PropsOptions>): Structure.Constructor<T>;
208
- declare class Structure<T extends Data = Data> implements Structure.Structure<T> {
209
- readonly value: T;
210
- constructor(value: T);
211
- toBuffer(options?: BinaryWriterOptions): Uint8Array;
212
- static fromBuffer(buffer: Uint8Array, options?: BinaryReaderOptions): Data;
213
- static readonly estimatedSizeBytes: number;
214
- static readonly structures: Structure.Constructor[];
215
- static readonly extension: TLExtension;
216
- }
217
- declare namespace Structure {
218
- export interface Options<T extends Data = Data> {
219
- readonly encode: EncodeHandler<T>;
220
- readonly decode: DecodeHandler<T>;
221
- }
222
- export interface Structure<T extends Data = Data> {
223
- /**
224
- * The structured data value
225
- * @type {T}
226
- * @readonly
227
- *
228
- * @example
229
- * const user = new UserStruct({ id: 1, name: 'Alice' });
230
- * console.log(user.value.name); // 'Alice'
231
- */
232
- readonly value: T;
233
- /**
234
- * Serializes the structure to a binary buffer
235
- *
236
- * @param {BinaryWriterOptions} [options] - Writer configuration options
237
- * @returns {Uint8Array} Serialized binary data
238
- *
239
- * @example
240
- * const user = new User({ id: 1, name: 'Alice' });
241
- * const buffer = user.toBuffer();
242
- * console.log(buffer.length); // Size in bytes
243
- *
244
- * @example
245
- * // With custom writer options
246
- * const buffer = user.toBuffer({
247
- * initialSize: 1024,
248
- * growthFactor: 2
249
- * });
250
- */
251
- toBuffer(options?: BinaryWriterOptions): Uint8Array;
252
- }
253
- /**
254
- * Base Structure class for binary serialization with type safety
255
- *
256
- * @template T - Data type extending Data interface
257
- *
258
- * @example
259
- * // Direct usage (not recommended, use defineStructure instead)
260
- * class CustomStruct extends Structure<{id: number, name: string}> {
261
- * // Custom implementation
262
- * }
263
- *
264
- * @example
265
- * // Typical usage through defineStructure
266
- * const MyStruct = defineStructure({
267
- * name: 'MyStruct',
268
- * version: 1,
269
- * properties: { id: { type: Number, required: true } }
270
- * });
271
- *
272
- * const instance = new MyStruct({ id: 42 });
273
- * console.log(instance.value.id); // 42
274
- */
275
- export interface Constructor<T extends Data = any> {
276
- /**
277
- * Creates a new Structure instance
278
- *
279
- * @param {T} value - The data to structure
280
- *
281
- * @example
282
- * const data = { id: 123, name: 'Test' };
283
- * const struct = new MyStructure(data);
284
- */
285
- new (value: T): Structure<T>;
286
- /**
287
- * Deserializes a structure from a binary buffer
288
- *
289
- * @param {Uint8Array} buffer - Binary data to deserialize
290
- * @param {BinaryReaderOptions} [options] - Reader configuration options
291
- * @returns {Data} Deserialized structure data
292
- *
293
- * @example
294
- * const buffer = user.toBuffer();
295
- * const restored = User.fromBuffer(buffer);
296
- * console.log(restored.id); // Original user ID
297
- */
298
- fromBuffer(buffer: Uint8Array, options?: BinaryReaderOptions): T;
299
- /**
300
- * Estimated size of bytes
301
- */
302
- readonly estimatedSizeBytes: number;
303
- /**
304
- * Nested structures defining encoding/decoding behavior
305
- */
306
- readonly structures: Constructor[];
307
- /**
308
- * Structure extension defining encoding/decoding behavior
309
- */
310
- readonly extension: TLExtension;
311
- }
312
- type PropConstructor<T = any> = {
313
- new (...args: any[]): T & {};
314
- } | {
315
- (): T;
316
- } | PropMethod<T>;
317
- type PropMethod<T, TConstructor = any> = [T] extends [
318
- ((...args: any) => any) | undefined
319
- ] ? {
320
- new (): TConstructor;
321
- (): T;
322
- readonly prototype: TConstructor;
323
- } : never;
324
- type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
325
- type RequiredKeys<T> = {
326
- [K in keyof T]: T[K] extends {
327
- required: true;
328
- } ? K : never;
329
- }[keyof T];
330
- type Prop<T> = PropOptions<T> | PropType<T>;
331
- type CoreInt = CORE_TYPES.Int8 | CORE_TYPES.Int16 | CORE_TYPES.Int32 | CORE_TYPES.UInt8 | CORE_TYPES.UInt16 | CORE_TYPES.UInt32 | CORE_TYPES.Float | CORE_TYPES.Double;
332
- type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
333
- type: null;
334
- }] ? any : [T] extends [{
335
- type: [null];
336
- }] ? any[] : [T] extends [{
337
- type: ObjectConstructor | CORE_TYPES.Map;
338
- }] ? Record<string, any> : [T] extends [{
339
- type: CoreInt;
340
- }] ? number : [T] extends [{
341
- type: CORE_TYPES.String;
342
- }] ? string : [T] extends [{
343
- type: CORE_TYPES.Vector;
344
- }] ? unknown[] : [T] extends [{
345
- type: CORE_TYPES.Binary;
346
- }] ? Uint8Array : [T] extends [{
347
- type: BooleanConstructor;
348
- }] ? boolean : [T] extends [{
349
- type: DateConstructor | CORE_TYPES.Date;
350
- }] ? Date : [T] extends [
351
- {
352
- type: CORE_TYPES.UInt64 | CORE_TYPES.Int64;
353
- }
354
- ] ? bigint : [T] extends [{
355
- type: Constructor<infer U>;
356
- }] ? U : [T] extends [{
357
- type: [infer U];
358
- }] ? U extends DateConstructor ? Date[] : U extends Constructor<infer V> ? V[] : InferPropType<U, false>[] : [T] extends [{
359
- type: (infer U)[];
360
- }] ? U extends DateConstructor ? Date | InferPropType<U, false> : InferPropType<U, false> : [T] extends [Prop<infer V>] ? V : T;
361
- export type ObjectPropsOptions<P = Data> = {
362
- readonly [K in keyof P]: PropOptions<P[K]>;
363
- };
364
- export interface PropOptions<T = any> {
365
- type: PropType<T> | null | [null];
366
- required?: boolean;
367
- }
368
- export type PropType<T> = PropConstructor<T> | [PropConstructor<T>] | CORE_TYPES | [CORE_TYPES];
369
- export type ExtractType<T extends Constructor> = T extends Constructor<infer U> ? U : never;
370
- export type ExtractPropTypes<O> = {
371
- [K in keyof Pick<O, RequiredKeys<O>>]: O[K] extends {
372
- default: any;
373
- } ? Exclude<InferPropType<O[K]>, undefined> : InferPropType<O[K]>;
374
- } & {
375
- [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]> | null;
376
- };
377
- export { };
378
- }
379
-
380
- interface BinaryReaderOptions {
381
- dictionary?: string[] | Dictionary;
382
- extensions?: TLExtension[];
383
- structures?: Structure.Constructor[];
384
- }
385
- declare class BinaryReader {
386
- private target;
387
- private _last?;
388
- private _lastObject?;
389
- private dictionary?;
390
- private dictionaryExtended;
391
- private extensions;
392
- private structures;
393
- private _repeat?;
394
- private _checksumOffset;
395
- offset: number;
396
- length: number;
397
- /**
398
- * Small utility class to read binary data.
399
- */
400
- constructor(data: Uint8Array, { dictionary, extensions, structures, }?: BinaryReaderOptions);
401
- readByte(): number;
402
- readInt64(signed?: boolean): bigint;
403
- readInt32(signed?: boolean): number;
404
- readInt16(signed?: boolean): number;
405
- readInt8(signed?: boolean): number;
406
- /**
407
- * Reads a real floating point (4 bytes) value.
408
- * @returns {number}
409
- */
410
- readFloat(): number;
411
- /**
412
- * Reads a real floating point (8 bytes) value.
413
- */
414
- readDouble(): number;
415
- /**
416
- * Throws error if provided length cannot be read from buffer
417
- * @param length {number}
418
- */
419
- assertRead(length: number): void;
420
- assertConstructor(constructorId: CORE_TYPES): void;
421
- /**
422
- * Gets the byte array representing the current buffer as a whole.
423
- */
424
- getBuffer(): Uint8Array;
425
- readNull(): null;
426
- readLength(): number;
427
- readAll(): any[];
428
- readBytes(): Uint8Array;
429
- /**
430
- * Reads encoded string.
431
- */
432
- readString(): string;
433
- /**
434
- * Reads a boolean value.
435
- */
436
- readBool(): boolean;
437
- /**
438
- * Reads and converts Unix time
439
- * into a Javascript {Date} object.
440
- */
441
- readDate(): Date;
442
- readStructure<T extends Data = Data>(checkConstructor?: boolean): T;
443
- /**
444
- * Reads a object.
445
- */
446
- readObject(): any;
447
- readObjectGzip(): any;
448
- readGzip(): any;
449
- private readCore;
450
- getDictionaryValue(index: number): string | null;
451
- readDictionary(): null | string;
452
- readMap(checkConstructor?: boolean): Record<string, any>;
453
- decode<T = any>(value: Uint8Array): T;
454
- /**
455
- * Reads a vector (a list) of objects.
456
- */
457
- readVector<T = any>(checkConstructor?: boolean): T[];
458
- /**
459
- * Reads a vector (a list) of objects.
460
- */
461
- readVectorDynamic<T>(checkConstructor?: boolean): T[];
462
- readChecksum(checkConstructor?: boolean): void;
463
- /**
464
- * Tells the current position on the stream.
465
- */
466
- tellPosition(): number;
467
- /**
468
- * Sets the current position on the stream.
469
- */
470
- setPosition(position: number): void;
471
- /**
472
- * Seeks the stream position given an offset from the current position.
473
- * The offset may be negative.
474
- */
475
- seek(offset: number): void;
476
- /**
477
- * Sets the current buffer and reset initial state.
478
- */
479
- reset(data?: Uint8Array): void;
480
- }
481
-
482
- export { type BinaryWriterOptions as B, CORE_TYPES as C, type DecodeHandler as D, type EncodeHandler as E, MAX_BUFFER_SIZE as M, Structure as S, type TLExtension as T, type BinaryReaderOptions as a, BinaryReader as b, BinaryWriter as c, createDictionary as d, createExtension as e, type DefineStructureOptions as f, defineStructure as g };
package/dist/stream.cjs DELETED
@@ -1,72 +0,0 @@
1
- 'use strict';
2
-
3
- const node_stream = require('node:stream');
4
- const BinaryReader = require('./shared/tl-pack.5CF-VZgL.cjs');
5
- require('pako');
6
- require('@andrew_l/toolkit');
7
-
8
- class TLEncode extends node_stream.Transform {
9
- writer;
10
- count;
11
- constructor(options) {
12
- const opts = options || {};
13
- opts.streamOptions = {
14
- writableObjectMode: true,
15
- ...opts.streamOptions || {}
16
- };
17
- super(opts.streamOptions);
18
- const writer = new BinaryReader.BinaryWriter(options);
19
- const customFlush = opts.streamOptions.flush;
20
- const VECTOR_TYPES = new Uint8Array(2);
21
- VECTOR_TYPES[0] = BinaryReader.CORE_TYPES.VectorDynamic;
22
- VECTOR_TYPES[1] = BinaryReader.CORE_TYPES.None;
23
- this.push(VECTOR_TYPES.subarray(0, 1));
24
- this._flush = (callback) => {
25
- this.push(VECTOR_TYPES.subarray(1, 2));
26
- if (customFlush) {
27
- customFlush.call(this, callback);
28
- } else {
29
- callback();
30
- }
31
- };
32
- this.writer = writer;
33
- this.count = 0;
34
- }
35
- _transform(chunk, encoding, callback) {
36
- const buff = this.writer.encode(chunk);
37
- this.push(buff);
38
- this.count++;
39
- callback();
40
- }
41
- }
42
- class TLDecode extends node_stream.Transform {
43
- reader;
44
- incompleteBuffer;
45
- constructor(options) {
46
- if (!options) options = {};
47
- options.objectMode = true;
48
- super(options);
49
- this.incompleteBuffer = null;
50
- this.reader = new BinaryReader.BinaryReader(new Uint8Array(8192));
51
- }
52
- _transform(chunk, encoding, callback) {
53
- if (this.incompleteBuffer) {
54
- chunk = Buffer.concat([this.incompleteBuffer, chunk]);
55
- this.incompleteBuffer = null;
56
- }
57
- try {
58
- const value = this.reader.decode(chunk);
59
- return callback(null, value);
60
- } catch (err) {
61
- if (err?.incomplete) {
62
- this.incompleteBuffer = chunk;
63
- return callback();
64
- }
65
- return callback(err);
66
- }
67
- }
68
- }
69
-
70
- exports.TLDecode = TLDecode;
71
- exports.TLEncode = TLEncode;
72
- //# sourceMappingURL=stream.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.cjs","sources":["../src/stream.ts"],"sourcesContent":["import {\n Transform,\n type TransformCallback,\n type TransformOptions,\n} from 'node:stream';\nimport { BinaryReader } from './BinaryReader';\nimport { BinaryWriter, type BinaryWriterOptions } from './BinaryWriter';\nimport { CORE_TYPES } from './constants';\n\nexport interface TLEncodeOptions extends BinaryWriterOptions {\n streamOptions?: TransformOptions;\n}\n\nexport class TLEncode extends Transform {\n writer: BinaryWriter;\n count: number;\n\n constructor(options?: TLEncodeOptions) {\n const opts = options || {};\n opts.streamOptions = {\n writableObjectMode: true,\n ...(opts.streamOptions || {}),\n };\n\n super(opts.streamOptions);\n\n const writer = new BinaryWriter(options);\n\n const customFlush = opts.streamOptions.flush;\n\n const VECTOR_TYPES = new Uint8Array(2);\n\n VECTOR_TYPES[0] = CORE_TYPES.VectorDynamic;\n VECTOR_TYPES[1] = CORE_TYPES.None;\n\n // push a byte about dynamic vector starting\n this.push(VECTOR_TYPES.subarray(0, 1));\n\n this._flush = callback => {\n // push a byte about dynamic vector ending\n this.push(VECTOR_TYPES.subarray(1, 2));\n\n if (customFlush) {\n customFlush.call(this, callback);\n } else {\n callback();\n }\n };\n\n this.writer = writer;\n this.count = 0;\n }\n\n _transform(\n chunk: any,\n encoding: BufferEncoding,\n callback: TransformCallback,\n ) {\n const buff = this.writer.encode(chunk);\n this.push(buff);\n this.count++;\n callback();\n }\n}\n\nexport class TLDecode extends Transform {\n reader: BinaryReader;\n private incompleteBuffer: Buffer | null;\n\n constructor(options?: TransformOptions) {\n if (!options) options = {};\n options.objectMode = true;\n super(options);\n\n this.incompleteBuffer = null;\n this.reader = new BinaryReader(new Uint8Array(8192));\n }\n\n _transform(\n chunk: any,\n encoding: BufferEncoding,\n callback: TransformCallback,\n ) {\n if (this.incompleteBuffer) {\n chunk = Buffer.concat([this.incompleteBuffer, chunk]);\n this.incompleteBuffer = null;\n }\n\n try {\n const value = this.reader.decode(chunk);\n return callback(null, value);\n } catch (err) {\n if ((err as any)?.incomplete) {\n this.incompleteBuffer = chunk;\n return callback();\n }\n\n return callback(err as any);\n }\n }\n}\n"],"names":["Transform","BinaryWriter","CORE_TYPES","BinaryReader"],"mappings":";;;;;;;AAaO,MAAM,iBAAiBA,qBAAA,CAAU;AAAA,EACtC,MAAA;AAAA,EACA,KAAA;AAAA,EAEA,YAAY,OAAA,EAA2B;AACrC,IAAA,MAAM,IAAA,GAAO,WAAW,EAAC;AACzB,IAAA,IAAA,CAAK,aAAA,GAAgB;AAAA,MACnB,kBAAA,EAAoB,IAAA;AAAA,MACpB,GAAI,IAAA,CAAK,aAAA,IAAiB;AAAC,KAC7B;AAEA,IAAA,KAAA,CAAM,KAAK,aAAa,CAAA;AAExB,IAAA,MAAM,MAAA,GAAS,IAAIC,yBAAA,CAAa,OAAO,CAAA;AAEvC,IAAA,MAAM,WAAA,GAAc,KAAK,aAAA,CAAc,KAAA;AAEvC,IAAA,MAAM,YAAA,GAAe,IAAI,UAAA,CAAW,CAAC,CAAA;AAErC,IAAA,YAAA,CAAa,CAAC,IAAIC,uBAAA,CAAW,aAAA;AAC7B,IAAA,YAAA,CAAa,CAAC,IAAIA,uBAAA,CAAW,IAAA;AAG7B,IAAA,IAAA,CAAK,IAAA,CAAK,YAAA,CAAa,QAAA,CAAS,CAAA,EAAG,CAAC,CAAC,CAAA;AAErC,IAAA,IAAA,CAAK,SAAS,CAAA,QAAA,KAAY;AAExB,MAAA,IAAA,CAAK,IAAA,CAAK,YAAA,CAAa,QAAA,CAAS,CAAA,EAAG,CAAC,CAAC,CAAA;AAErC,MAAA,IAAI,WAAA,EAAa;AACf,QAAA,WAAA,CAAY,IAAA,CAAK,MAAM,QAAQ,CAAA;AAAA,MACjC,CAAA,MAAO;AACL,QAAA,QAAA,EAAS;AAAA,MACX;AAAA,IACF,CAAA;AAEA,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,KAAA,GAAQ,CAAA;AAAA,EACf;AAAA,EAEA,UAAA,CACE,KAAA,EACA,QAAA,EACA,QAAA,EACA;AACA,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA;AACrC,IAAA,IAAA,CAAK,KAAK,IAAI,CAAA;AACd,IAAA,IAAA,CAAK,KAAA,EAAA;AACL,IAAA,QAAA,EAAS;AAAA,EACX;AACF;AAEO,MAAM,iBAAiBF,qBAAA,CAAU;AAAA,EACtC,MAAA;AAAA,EACQ,gBAAA;AAAA,EAER,YAAY,OAAA,EAA4B;AACtC,IAAA,IAAI,CAAC,OAAA,EAAS,OAAA,GAAU,EAAC;AACzB,IAAA,OAAA,CAAQ,UAAA,GAAa,IAAA;AACrB,IAAA,KAAA,CAAM,OAAO,CAAA;AAEb,IAAA,IAAA,CAAK,gBAAA,GAAmB,IAAA;AACxB,IAAA,IAAA,CAAK,SAAS,IAAIG,yBAAA,CAAa,IAAI,UAAA,CAAW,IAAI,CAAC,CAAA;AAAA,EACrD;AAAA,EAEA,UAAA,CACE,KAAA,EACA,QAAA,EACA,QAAA,EACA;AACA,IAAA,IAAI,KAAK,gBAAA,EAAkB;AACzB,MAAA,KAAA,GAAQ,OAAO,MAAA,CAAO,CAAC,IAAA,CAAK,gBAAA,EAAkB,KAAK,CAAC,CAAA;AACpD,MAAA,IAAA,CAAK,gBAAA,GAAmB,IAAA;AAAA,IAC1B;AAEA,IAAA,IAAI;AACF,MAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA;AACtC,MAAA,OAAO,QAAA,CAAS,MAAM,KAAK,CAAA;AAAA,IAC7B,SAAS,GAAA,EAAK;AACZ,MAAA,IAAK,KAAa,UAAA,EAAY;AAC5B,QAAA,IAAA,CAAK,gBAAA,GAAmB,KAAA;AACxB,QAAA,OAAO,QAAA,EAAS;AAAA,MAClB;AAEA,MAAA,OAAO,SAAS,GAAU,CAAA;AAAA,IAC5B;AAAA,EACF;AACF;;;;;"}
package/dist/stream.d.cts DELETED
@@ -1,21 +0,0 @@
1
- import { TransformOptions, Transform, TransformCallback } from 'node:stream';
2
- import { B as BinaryWriterOptions, c as BinaryWriter, b as BinaryReader } from './shared/tl-pack.DM1wAuup.cjs';
3
- import '@andrew_l/toolkit';
4
-
5
- interface TLEncodeOptions extends BinaryWriterOptions {
6
- streamOptions?: TransformOptions;
7
- }
8
- declare class TLEncode extends Transform {
9
- writer: BinaryWriter;
10
- count: number;
11
- constructor(options?: TLEncodeOptions);
12
- _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
13
- }
14
- declare class TLDecode extends Transform {
15
- reader: BinaryReader;
16
- private incompleteBuffer;
17
- constructor(options?: TransformOptions);
18
- _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
19
- }
20
-
21
- export { TLDecode, TLEncode, type TLEncodeOptions };
package/dist/stream.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { TransformOptions, Transform, TransformCallback } from 'node:stream';
2
- import { B as BinaryWriterOptions, c as BinaryWriter, b as BinaryReader } from './shared/tl-pack.DM1wAuup.js';
3
- import '@andrew_l/toolkit';
4
-
5
- interface TLEncodeOptions extends BinaryWriterOptions {
6
- streamOptions?: TransformOptions;
7
- }
8
- declare class TLEncode extends Transform {
9
- writer: BinaryWriter;
10
- count: number;
11
- constructor(options?: TLEncodeOptions);
12
- _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
13
- }
14
- declare class TLDecode extends Transform {
15
- reader: BinaryReader;
16
- private incompleteBuffer;
17
- constructor(options?: TransformOptions);
18
- _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
19
- }
20
-
21
- export { TLDecode, TLEncode, type TLEncodeOptions };