wangzhibo
2026-05-09 53418655c061ac26f66058253f39200aced1ab1d
1
{"version":3,"file":"writable-tracking-buffer.js","names":["SHIFT_LEFT_32","SHIFT_RIGHT_32","UNKNOWN_PLP_LEN","Buffer","from","ZERO_LENGTH_BUFFER","alloc","WritableTrackingBuffer","constructor","initialSize","encoding","doubleSizeGrowth","buffer","compositeBuffer","position","data","newBuffer","copyFrom","length","makeRoomFor","copy","requiredLength","size","Math","max","slice","concat","writeUInt8","value","writeUInt16LE","writeUShort","writeUInt16BE","writeUInt24LE","writeUInt32LE","writeBigInt64LE","writeInt64LE","BigInt","writeUInt64LE","writeBigUInt64LE","writeUInt32BE","writeUInt40LE","writeInt32LE","floor","writeInt8","writeInt16LE","writeInt16BE","writeInt32BE","writeFloatLE","writeDoubleLE","writeString","byteLength","write","writeBVarchar","writeUsVarchar","writeUsVarbyte","toString","writeBuffer","writePLPBody","writeMoney","_default","exports","default","module"],"sources":["../../src/tracking-buffer/writable-tracking-buffer.ts"],"sourcesContent":["const SHIFT_LEFT_32 = (1 << 16) * (1 << 16);\nconst SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\nconst UNKNOWN_PLP_LEN = Buffer.from([0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]);\nconst ZERO_LENGTH_BUFFER = Buffer.alloc(0);\n\nexport type Encoding = 'utf8' | 'ucs2' | 'ascii';\n\n/**\n  A Buffer-like class that tracks position.\n\n  As values are written, the position advances by the size of the written data.\n  When writing, automatically allocates new buffers if there's not enough space.\n */\nclass WritableTrackingBuffer {\n  declare initialSize: number;\n  declare encoding: Encoding;\n  declare doubleSizeGrowth: boolean;\n\n  declare buffer: Buffer;\n  declare compositeBuffer: Buffer;\n\n  declare position: number;\n\n  constructor(initialSize: number, encoding?: Encoding | null, doubleSizeGrowth?: boolean) {\n    this.initialSize = initialSize;\n    this.encoding = encoding || 'ucs2';\n    this.doubleSizeGrowth = doubleSizeGrowth || false;\n    this.buffer = Buffer.alloc(this.initialSize, 0);\n    this.compositeBuffer = ZERO_LENGTH_BUFFER;\n    this.position = 0;\n  }\n\n  get data() {\n    this.newBuffer(0);\n    return this.compositeBuffer;\n  }\n\n  copyFrom(buffer: Buffer) {\n    const length = buffer.length;\n    this.makeRoomFor(length);\n    buffer.copy(this.buffer, this.position);\n    this.position += length;\n  }\n\n  makeRoomFor(requiredLength: number) {\n    if (this.buffer.length - this.position < requiredLength) {\n      if (this.doubleSizeGrowth) {\n        let size = Math.max(128, this.buffer.length * 2);\n        while (size < requiredLength) {\n          size *= 2;\n        }\n        this.newBuffer(size);\n      } else {\n        this.newBuffer(requiredLength);\n      }\n    }\n  }\n\n  newBuffer(size: number) {\n    const buffer = this.buffer.slice(0, this.position);\n    this.compositeBuffer = Buffer.concat([this.compositeBuffer, buffer]);\n    this.buffer = (size === 0) ? ZERO_LENGTH_BUFFER : Buffer.alloc(size, 0);\n    this.position = 0;\n  }\n\n  writeUInt8(value: number) {\n    const length = 1;\n    this.makeRoomFor(length);\n    this.buffer.writeUInt8(value, this.position);\n    this.position += length;\n  }\n\n  writeUInt16LE(value: number) {\n    const length = 2;\n    this.makeRoomFor(length);\n    this.buffer.writeUInt16LE(value, this.position);\n    this.position += length;\n  }\n\n  writeUShort(value: number) {\n    this.writeUInt16LE(value);\n  }\n\n  writeUInt16BE(value: number) {\n    const length = 2;\n    this.makeRoomFor(length);\n    this.buffer.writeUInt16BE(value, this.position);\n    this.position += length;\n  }\n\n  writeUInt24LE(value: number) {\n    const length = 3;\n    this.makeRoomFor(length);\n    this.buffer[this.position + 2] = (value >>> 16) & 0xff;\n    this.buffer[this.position + 1] = (value >>> 8) & 0xff;\n    this.buffer[this.position] = value & 0xff;\n    this.position += length;\n  }\n\n  writeUInt32LE(value: number) {\n    const length = 4;\n    this.makeRoomFor(length);\n    this.buffer.writeUInt32LE(value, this.position);\n    this.position += length;\n  }\n\n  writeBigInt64LE(value: bigint) {\n    const length = 8;\n    this.makeRoomFor(length);\n    this.buffer.writeBigInt64LE(value, this.position);\n    this.position += length;\n  }\n\n  writeInt64LE(value: number) {\n    this.writeBigInt64LE(BigInt(value));\n  }\n\n  writeUInt64LE(value: number) {\n    this.writeBigUInt64LE(BigInt(value));\n  }\n\n  writeBigUInt64LE(value: bigint) {\n    const length = 8;\n    this.makeRoomFor(length);\n    this.buffer.writeBigUInt64LE(value, this.position);\n    this.position += length;\n  }\n\n  writeUInt32BE(value: number) {\n    const length = 4;\n    this.makeRoomFor(length);\n    this.buffer.writeUInt32BE(value, this.position);\n    this.position += length;\n  }\n\n  writeUInt40LE(value: number) {\n    // inspired by https://github.com/dpw/node-buffer-more-ints\n    this.writeInt32LE(value & -1);\n    this.writeUInt8(Math.floor(value * SHIFT_RIGHT_32));\n  }\n\n  writeInt8(value: number) {\n    const length = 1;\n    this.makeRoomFor(length);\n    this.buffer.writeInt8(value, this.position);\n    this.position += length;\n  }\n\n  writeInt16LE(value: number) {\n    const length = 2;\n    this.makeRoomFor(length);\n    this.buffer.writeInt16LE(value, this.position);\n    this.position += length;\n  }\n\n  writeInt16BE(value: number) {\n    const length = 2;\n    this.makeRoomFor(length);\n    this.buffer.writeInt16BE(value, this.position);\n    this.position += length;\n  }\n\n  writeInt32LE(value: number) {\n    const length = 4;\n    this.makeRoomFor(length);\n    this.buffer.writeInt32LE(value, this.position);\n    this.position += length;\n  }\n\n  writeInt32BE(value: number) {\n    const length = 4;\n    this.makeRoomFor(length);\n    this.buffer.writeInt32BE(value, this.position);\n    this.position += length;\n  }\n\n  writeFloatLE(value: number) {\n    const length = 4;\n    this.makeRoomFor(length);\n    this.buffer.writeFloatLE(value, this.position);\n    this.position += length;\n  }\n\n  writeDoubleLE(value: number) {\n    const length = 8;\n    this.makeRoomFor(length);\n    this.buffer.writeDoubleLE(value, this.position);\n    this.position += length;\n  }\n\n  writeString(value: string, encoding?: Encoding | null) {\n    if (encoding == null) {\n      encoding = this.encoding;\n    }\n\n    const length = Buffer.byteLength(value, encoding);\n    this.makeRoomFor(length);\n\n    // $FlowFixMe https://github.com/facebook/flow/pull/5398\n    this.buffer.write(value, this.position, encoding);\n    this.position += length;\n  }\n\n  writeBVarchar(value: string, encoding?: Encoding | null) {\n    this.writeUInt8(value.length);\n    this.writeString(value, encoding);\n  }\n\n  writeUsVarchar(value: string, encoding?: Encoding | null) {\n    this.writeUInt16LE(value.length);\n    this.writeString(value, encoding);\n  }\n\n  // TODO: Figure out what types are passed in other than `Buffer`\n  writeUsVarbyte(value: any, encoding?: Encoding | null) {\n    if (encoding == null) {\n      encoding = this.encoding;\n    }\n\n    let length;\n    if (value instanceof Buffer) {\n      length = value.length;\n    } else {\n      value = value.toString();\n      length = Buffer.byteLength(value, encoding);\n    }\n    this.writeUInt16LE(length);\n\n    if (value instanceof Buffer) {\n      this.writeBuffer(value);\n    } else {\n      this.makeRoomFor(length);\n      // $FlowFixMe https://github.com/facebook/flow/pull/5398\n      this.buffer.write(value, this.position, encoding);\n      this.position += length;\n    }\n  }\n\n  writePLPBody(value: any, encoding?: Encoding | null) {\n    if (encoding == null) {\n      encoding = this.encoding;\n    }\n\n    let length;\n    if (value instanceof Buffer) {\n      length = value.length;\n    } else {\n      value = value.toString();\n      length = Buffer.byteLength(value, encoding);\n    }\n\n    // Length of all chunks.\n    // this.writeUInt64LE(length);\n    // unknown seems to work better here - might revisit later.\n    this.writeBuffer(UNKNOWN_PLP_LEN);\n\n    // In the UNKNOWN_PLP_LEN case, the data is represented as a series of zero or more chunks.\n    if (length > 0) {\n      // One chunk.\n      this.writeUInt32LE(length);\n      if (value instanceof Buffer) {\n        this.writeBuffer(value);\n      } else {\n        this.makeRoomFor(length);\n        this.buffer.write(value, this.position, encoding);\n        this.position += length;\n      }\n    }\n\n    // PLP_TERMINATOR (no more chunks).\n    this.writeUInt32LE(0);\n  }\n\n  writeBuffer(value: Buffer) {\n    const length = value.length;\n    this.makeRoomFor(length);\n    value.copy(this.buffer, this.position);\n    this.position += length;\n  }\n\n  writeMoney(value: number) {\n    this.writeInt32LE(Math.floor(value * SHIFT_RIGHT_32));\n    this.writeInt32LE(value & -1);\n  }\n}\n\nexport default WritableTrackingBuffer;\nmodule.exports = WritableTrackingBuffer;\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAC3C,MAAMC,cAAc,GAAG,CAAC,GAAGD,aAAa;AACxC,MAAME,eAAe,GAAGC,MAAM,CAACC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACrF,MAAMC,kBAAkB,GAAGF,MAAM,CAACG,KAAK,CAAC,CAAC,CAAC;AAI1C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,CAAC;EAU3BC,WAAWA,CAACC,WAAmB,EAAEC,QAA0B,EAAEC,gBAA0B,EAAE;IACvF,IAAI,CAACF,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,QAAQ,GAAGA,QAAQ,IAAI,MAAM;IAClC,IAAI,CAACC,gBAAgB,GAAGA,gBAAgB,IAAI,KAAK;IACjD,IAAI,CAACC,MAAM,GAAGT,MAAM,CAACG,KAAK,CAAC,IAAI,CAACG,WAAW,EAAE,CAAC,CAAC;IAC/C,IAAI,CAACI,eAAe,GAAGR,kBAAkB;IACzC,IAAI,CAACS,QAAQ,GAAG,CAAC;EACnB;EAEA,IAAIC,IAAIA,CAAA,EAAG;IACT,IAAI,CAACC,SAAS,CAAC,CAAC,CAAC;IACjB,OAAO,IAAI,CAACH,eAAe;EAC7B;EAEAI,QAAQA,CAACL,MAAc,EAAE;IACvB,MAAMM,MAAM,GAAGN,MAAM,CAACM,MAAM;IAC5B,IAAI,CAACC,WAAW,CAACD,MAAM,CAAC;IACxBN,MAAM,CAACQ,IAAI,CAAC,IAAI,CAACR,MAAM,EAAE,IAAI,CAACE,QAAQ,CAAC;IACvC,IAA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