@powersync/web 0.0.0-dev-20260112083235 → 0.0.0-dev-20260128023420
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.
- package/dist/index.umd.js +449 -140
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +268 -2078
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +269 -2079
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
package/dist/index.umd.js
CHANGED
|
@@ -22068,9 +22068,9 @@ module.exports = function xor (a, b) {
|
|
|
22068
22068
|
|
|
22069
22069
|
|
|
22070
22070
|
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22071
|
+
const base64 = __webpack_require__(/*! base64-js */ "../../node_modules/base64-js/index.js")
|
|
22072
|
+
const ieee754 = __webpack_require__(/*! ieee754 */ "../../node_modules/ieee754/index.js")
|
|
22073
|
+
const customInspectSymbol =
|
|
22074
22074
|
(typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
|
|
22075
22075
|
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
|
|
22076
22076
|
: null
|
|
@@ -22079,7 +22079,7 @@ exports.Buffer = Buffer
|
|
|
22079
22079
|
exports.SlowBuffer = SlowBuffer
|
|
22080
22080
|
exports.INSPECT_MAX_BYTES = 50
|
|
22081
22081
|
|
|
22082
|
-
|
|
22082
|
+
const K_MAX_LENGTH = 0x7fffffff
|
|
22083
22083
|
exports.kMaxLength = K_MAX_LENGTH
|
|
22084
22084
|
|
|
22085
22085
|
/**
|
|
@@ -22109,8 +22109,8 @@ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
|
|
22109
22109
|
function typedArraySupport () {
|
|
22110
22110
|
// Can typed array instances can be augmented?
|
|
22111
22111
|
try {
|
|
22112
|
-
|
|
22113
|
-
|
|
22112
|
+
const arr = new Uint8Array(1)
|
|
22113
|
+
const proto = { foo: function () { return 42 } }
|
|
22114
22114
|
Object.setPrototypeOf(proto, Uint8Array.prototype)
|
|
22115
22115
|
Object.setPrototypeOf(arr, proto)
|
|
22116
22116
|
return arr.foo() === 42
|
|
@@ -22140,7 +22140,7 @@ function createBuffer (length) {
|
|
|
22140
22140
|
throw new RangeError('The value "' + length + '" is invalid for option "size"')
|
|
22141
22141
|
}
|
|
22142
22142
|
// Return an augmented `Uint8Array` instance
|
|
22143
|
-
|
|
22143
|
+
const buf = new Uint8Array(length)
|
|
22144
22144
|
Object.setPrototypeOf(buf, Buffer.prototype)
|
|
22145
22145
|
return buf
|
|
22146
22146
|
}
|
|
@@ -22203,19 +22203,17 @@ function from (value, encodingOrOffset, length) {
|
|
|
22203
22203
|
)
|
|
22204
22204
|
}
|
|
22205
22205
|
|
|
22206
|
-
|
|
22206
|
+
const valueOf = value.valueOf && value.valueOf()
|
|
22207
22207
|
if (valueOf != null && valueOf !== value) {
|
|
22208
22208
|
return Buffer.from(valueOf, encodingOrOffset, length)
|
|
22209
22209
|
}
|
|
22210
22210
|
|
|
22211
|
-
|
|
22211
|
+
const b = fromObject(value)
|
|
22212
22212
|
if (b) return b
|
|
22213
22213
|
|
|
22214
22214
|
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
|
|
22215
22215
|
typeof value[Symbol.toPrimitive] === 'function') {
|
|
22216
|
-
return Buffer.from(
|
|
22217
|
-
value[Symbol.toPrimitive]('string'), encodingOrOffset, length
|
|
22218
|
-
)
|
|
22216
|
+
return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
|
|
22219
22217
|
}
|
|
22220
22218
|
|
|
22221
22219
|
throw new TypeError(
|
|
@@ -22300,10 +22298,10 @@ function fromString (string, encoding) {
|
|
|
22300
22298
|
throw new TypeError('Unknown encoding: ' + encoding)
|
|
22301
22299
|
}
|
|
22302
22300
|
|
|
22303
|
-
|
|
22304
|
-
|
|
22301
|
+
const length = byteLength(string, encoding) | 0
|
|
22302
|
+
let buf = createBuffer(length)
|
|
22305
22303
|
|
|
22306
|
-
|
|
22304
|
+
const actual = buf.write(string, encoding)
|
|
22307
22305
|
|
|
22308
22306
|
if (actual !== length) {
|
|
22309
22307
|
// Writing a hex string, for example, that contains invalid characters will
|
|
@@ -22316,9 +22314,9 @@ function fromString (string, encoding) {
|
|
|
22316
22314
|
}
|
|
22317
22315
|
|
|
22318
22316
|
function fromArrayLike (array) {
|
|
22319
|
-
|
|
22320
|
-
|
|
22321
|
-
for (
|
|
22317
|
+
const length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
22318
|
+
const buf = createBuffer(length)
|
|
22319
|
+
for (let i = 0; i < length; i += 1) {
|
|
22322
22320
|
buf[i] = array[i] & 255
|
|
22323
22321
|
}
|
|
22324
22322
|
return buf
|
|
@@ -22326,7 +22324,7 @@ function fromArrayLike (array) {
|
|
|
22326
22324
|
|
|
22327
22325
|
function fromArrayView (arrayView) {
|
|
22328
22326
|
if (isInstance(arrayView, Uint8Array)) {
|
|
22329
|
-
|
|
22327
|
+
const copy = new Uint8Array(arrayView)
|
|
22330
22328
|
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
|
|
22331
22329
|
}
|
|
22332
22330
|
return fromArrayLike(arrayView)
|
|
@@ -22341,7 +22339,7 @@ function fromArrayBuffer (array, byteOffset, length) {
|
|
|
22341
22339
|
throw new RangeError('"length" is outside of buffer bounds')
|
|
22342
22340
|
}
|
|
22343
22341
|
|
|
22344
|
-
|
|
22342
|
+
let buf
|
|
22345
22343
|
if (byteOffset === undefined && length === undefined) {
|
|
22346
22344
|
buf = new Uint8Array(array)
|
|
22347
22345
|
} else if (length === undefined) {
|
|
@@ -22358,8 +22356,8 @@ function fromArrayBuffer (array, byteOffset, length) {
|
|
|
22358
22356
|
|
|
22359
22357
|
function fromObject (obj) {
|
|
22360
22358
|
if (Buffer.isBuffer(obj)) {
|
|
22361
|
-
|
|
22362
|
-
|
|
22359
|
+
const len = checked(obj.length) | 0
|
|
22360
|
+
const buf = createBuffer(len)
|
|
22363
22361
|
|
|
22364
22362
|
if (buf.length === 0) {
|
|
22365
22363
|
return buf
|
|
@@ -22414,10 +22412,10 @@ Buffer.compare = function compare (a, b) {
|
|
|
22414
22412
|
|
|
22415
22413
|
if (a === b) return 0
|
|
22416
22414
|
|
|
22417
|
-
|
|
22418
|
-
|
|
22415
|
+
let x = a.length
|
|
22416
|
+
let y = b.length
|
|
22419
22417
|
|
|
22420
|
-
for (
|
|
22418
|
+
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
22421
22419
|
if (a[i] !== b[i]) {
|
|
22422
22420
|
x = a[i]
|
|
22423
22421
|
y = b[i]
|
|
@@ -22458,7 +22456,7 @@ Buffer.concat = function concat (list, length) {
|
|
|
22458
22456
|
return Buffer.alloc(0)
|
|
22459
22457
|
}
|
|
22460
22458
|
|
|
22461
|
-
|
|
22459
|
+
let i
|
|
22462
22460
|
if (length === undefined) {
|
|
22463
22461
|
length = 0
|
|
22464
22462
|
for (i = 0; i < list.length; ++i) {
|
|
@@ -22466,13 +22464,14 @@ Buffer.concat = function concat (list, length) {
|
|
|
22466
22464
|
}
|
|
22467
22465
|
}
|
|
22468
22466
|
|
|
22469
|
-
|
|
22470
|
-
|
|
22467
|
+
const buffer = Buffer.allocUnsafe(length)
|
|
22468
|
+
let pos = 0
|
|
22471
22469
|
for (i = 0; i < list.length; ++i) {
|
|
22472
|
-
|
|
22470
|
+
let buf = list[i]
|
|
22473
22471
|
if (isInstance(buf, Uint8Array)) {
|
|
22474
22472
|
if (pos + buf.length > buffer.length) {
|
|
22475
|
-
Buffer.
|
|
22473
|
+
if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
|
|
22474
|
+
buf.copy(buffer, pos)
|
|
22476
22475
|
} else {
|
|
22477
22476
|
Uint8Array.prototype.set.call(
|
|
22478
22477
|
buffer,
|
|
@@ -22504,12 +22503,12 @@ function byteLength (string, encoding) {
|
|
|
22504
22503
|
)
|
|
22505
22504
|
}
|
|
22506
22505
|
|
|
22507
|
-
|
|
22508
|
-
|
|
22506
|
+
const len = string.length
|
|
22507
|
+
const mustMatch = (arguments.length > 2 && arguments[2] === true)
|
|
22509
22508
|
if (!mustMatch && len === 0) return 0
|
|
22510
22509
|
|
|
22511
22510
|
// Use a for loop to avoid recursion
|
|
22512
|
-
|
|
22511
|
+
let loweredCase = false
|
|
22513
22512
|
for (;;) {
|
|
22514
22513
|
switch (encoding) {
|
|
22515
22514
|
case 'ascii':
|
|
@@ -22540,7 +22539,7 @@ function byteLength (string, encoding) {
|
|
|
22540
22539
|
Buffer.byteLength = byteLength
|
|
22541
22540
|
|
|
22542
22541
|
function slowToString (encoding, start, end) {
|
|
22543
|
-
|
|
22542
|
+
let loweredCase = false
|
|
22544
22543
|
|
|
22545
22544
|
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
22546
22545
|
// property of a typed array.
|
|
@@ -22618,28 +22617,28 @@ function slowToString (encoding, start, end) {
|
|
|
22618
22617
|
Buffer.prototype._isBuffer = true
|
|
22619
22618
|
|
|
22620
22619
|
function swap (b, n, m) {
|
|
22621
|
-
|
|
22620
|
+
const i = b[n]
|
|
22622
22621
|
b[n] = b[m]
|
|
22623
22622
|
b[m] = i
|
|
22624
22623
|
}
|
|
22625
22624
|
|
|
22626
22625
|
Buffer.prototype.swap16 = function swap16 () {
|
|
22627
|
-
|
|
22626
|
+
const len = this.length
|
|
22628
22627
|
if (len % 2 !== 0) {
|
|
22629
22628
|
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
22630
22629
|
}
|
|
22631
|
-
for (
|
|
22630
|
+
for (let i = 0; i < len; i += 2) {
|
|
22632
22631
|
swap(this, i, i + 1)
|
|
22633
22632
|
}
|
|
22634
22633
|
return this
|
|
22635
22634
|
}
|
|
22636
22635
|
|
|
22637
22636
|
Buffer.prototype.swap32 = function swap32 () {
|
|
22638
|
-
|
|
22637
|
+
const len = this.length
|
|
22639
22638
|
if (len % 4 !== 0) {
|
|
22640
22639
|
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
22641
22640
|
}
|
|
22642
|
-
for (
|
|
22641
|
+
for (let i = 0; i < len; i += 4) {
|
|
22643
22642
|
swap(this, i, i + 3)
|
|
22644
22643
|
swap(this, i + 1, i + 2)
|
|
22645
22644
|
}
|
|
@@ -22647,11 +22646,11 @@ Buffer.prototype.swap32 = function swap32 () {
|
|
|
22647
22646
|
}
|
|
22648
22647
|
|
|
22649
22648
|
Buffer.prototype.swap64 = function swap64 () {
|
|
22650
|
-
|
|
22649
|
+
const len = this.length
|
|
22651
22650
|
if (len % 8 !== 0) {
|
|
22652
22651
|
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
22653
22652
|
}
|
|
22654
|
-
for (
|
|
22653
|
+
for (let i = 0; i < len; i += 8) {
|
|
22655
22654
|
swap(this, i, i + 7)
|
|
22656
22655
|
swap(this, i + 1, i + 6)
|
|
22657
22656
|
swap(this, i + 2, i + 5)
|
|
@@ -22661,7 +22660,7 @@ Buffer.prototype.swap64 = function swap64 () {
|
|
|
22661
22660
|
}
|
|
22662
22661
|
|
|
22663
22662
|
Buffer.prototype.toString = function toString () {
|
|
22664
|
-
|
|
22663
|
+
const length = this.length
|
|
22665
22664
|
if (length === 0) return ''
|
|
22666
22665
|
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
22667
22666
|
return slowToString.apply(this, arguments)
|
|
@@ -22676,8 +22675,8 @@ Buffer.prototype.equals = function equals (b) {
|
|
|
22676
22675
|
}
|
|
22677
22676
|
|
|
22678
22677
|
Buffer.prototype.inspect = function inspect () {
|
|
22679
|
-
|
|
22680
|
-
|
|
22678
|
+
let str = ''
|
|
22679
|
+
const max = exports.INSPECT_MAX_BYTES
|
|
22681
22680
|
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
|
|
22682
22681
|
if (this.length > max) str += ' ... '
|
|
22683
22682
|
return '<Buffer ' + str + '>'
|
|
@@ -22731,14 +22730,14 @@ Buffer.prototype.compare = function compare (target, start, end, thisStart, this
|
|
|
22731
22730
|
|
|
22732
22731
|
if (this === target) return 0
|
|
22733
22732
|
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22733
|
+
let x = thisEnd - thisStart
|
|
22734
|
+
let y = end - start
|
|
22735
|
+
const len = Math.min(x, y)
|
|
22737
22736
|
|
|
22738
|
-
|
|
22739
|
-
|
|
22737
|
+
const thisCopy = this.slice(thisStart, thisEnd)
|
|
22738
|
+
const targetCopy = target.slice(start, end)
|
|
22740
22739
|
|
|
22741
|
-
for (
|
|
22740
|
+
for (let i = 0; i < len; ++i) {
|
|
22742
22741
|
if (thisCopy[i] !== targetCopy[i]) {
|
|
22743
22742
|
x = thisCopy[i]
|
|
22744
22743
|
y = targetCopy[i]
|
|
@@ -22817,9 +22816,9 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
|
22817
22816
|
}
|
|
22818
22817
|
|
|
22819
22818
|
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
22820
|
-
|
|
22821
|
-
|
|
22822
|
-
|
|
22819
|
+
let indexSize = 1
|
|
22820
|
+
let arrLength = arr.length
|
|
22821
|
+
let valLength = val.length
|
|
22823
22822
|
|
|
22824
22823
|
if (encoding !== undefined) {
|
|
22825
22824
|
encoding = String(encoding).toLowerCase()
|
|
@@ -22843,9 +22842,9 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
|
22843
22842
|
}
|
|
22844
22843
|
}
|
|
22845
22844
|
|
|
22846
|
-
|
|
22845
|
+
let i
|
|
22847
22846
|
if (dir) {
|
|
22848
|
-
|
|
22847
|
+
let foundIndex = -1
|
|
22849
22848
|
for (i = byteOffset; i < arrLength; i++) {
|
|
22850
22849
|
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
22851
22850
|
if (foundIndex === -1) foundIndex = i
|
|
@@ -22858,8 +22857,8 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
|
22858
22857
|
} else {
|
|
22859
22858
|
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
|
22860
22859
|
for (i = byteOffset; i >= 0; i--) {
|
|
22861
|
-
|
|
22862
|
-
for (
|
|
22860
|
+
let found = true
|
|
22861
|
+
for (let j = 0; j < valLength; j++) {
|
|
22863
22862
|
if (read(arr, i + j) !== read(val, j)) {
|
|
22864
22863
|
found = false
|
|
22865
22864
|
break
|
|
@@ -22886,7 +22885,7 @@ Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding)
|
|
|
22886
22885
|
|
|
22887
22886
|
function hexWrite (buf, string, offset, length) {
|
|
22888
22887
|
offset = Number(offset) || 0
|
|
22889
|
-
|
|
22888
|
+
const remaining = buf.length - offset
|
|
22890
22889
|
if (!length) {
|
|
22891
22890
|
length = remaining
|
|
22892
22891
|
} else {
|
|
@@ -22896,13 +22895,14 @@ function hexWrite (buf, string, offset, length) {
|
|
|
22896
22895
|
}
|
|
22897
22896
|
}
|
|
22898
22897
|
|
|
22899
|
-
|
|
22898
|
+
const strLen = string.length
|
|
22900
22899
|
|
|
22901
22900
|
if (length > strLen / 2) {
|
|
22902
22901
|
length = strLen / 2
|
|
22903
22902
|
}
|
|
22904
|
-
|
|
22905
|
-
|
|
22903
|
+
let i
|
|
22904
|
+
for (i = 0; i < length; ++i) {
|
|
22905
|
+
const parsed = parseInt(string.substr(i * 2, 2), 16)
|
|
22906
22906
|
if (numberIsNaN(parsed)) return i
|
|
22907
22907
|
buf[offset + i] = parsed
|
|
22908
22908
|
}
|
|
@@ -22952,7 +22952,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
|
22952
22952
|
)
|
|
22953
22953
|
}
|
|
22954
22954
|
|
|
22955
|
-
|
|
22955
|
+
const remaining = this.length - offset
|
|
22956
22956
|
if (length === undefined || length > remaining) length = remaining
|
|
22957
22957
|
|
|
22958
22958
|
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
@@ -22961,7 +22961,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
|
22961
22961
|
|
|
22962
22962
|
if (!encoding) encoding = 'utf8'
|
|
22963
22963
|
|
|
22964
|
-
|
|
22964
|
+
let loweredCase = false
|
|
22965
22965
|
for (;;) {
|
|
22966
22966
|
switch (encoding) {
|
|
22967
22967
|
case 'hex':
|
|
@@ -23011,13 +23011,13 @@ function base64Slice (buf, start, end) {
|
|
|
23011
23011
|
|
|
23012
23012
|
function utf8Slice (buf, start, end) {
|
|
23013
23013
|
end = Math.min(buf.length, end)
|
|
23014
|
-
|
|
23014
|
+
const res = []
|
|
23015
23015
|
|
|
23016
|
-
|
|
23016
|
+
let i = start
|
|
23017
23017
|
while (i < end) {
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23018
|
+
const firstByte = buf[i]
|
|
23019
|
+
let codePoint = null
|
|
23020
|
+
let bytesPerSequence = (firstByte > 0xEF)
|
|
23021
23021
|
? 4
|
|
23022
23022
|
: (firstByte > 0xDF)
|
|
23023
23023
|
? 3
|
|
@@ -23026,7 +23026,7 @@ function utf8Slice (buf, start, end) {
|
|
|
23026
23026
|
: 1
|
|
23027
23027
|
|
|
23028
23028
|
if (i + bytesPerSequence <= end) {
|
|
23029
|
-
|
|
23029
|
+
let secondByte, thirdByte, fourthByte, tempCodePoint
|
|
23030
23030
|
|
|
23031
23031
|
switch (bytesPerSequence) {
|
|
23032
23032
|
case 1:
|
|
@@ -23088,17 +23088,17 @@ function utf8Slice (buf, start, end) {
|
|
|
23088
23088
|
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
23089
23089
|
// the lowest limit is Chrome, with 0x10000 args.
|
|
23090
23090
|
// We go 1 magnitude less, for safety
|
|
23091
|
-
|
|
23091
|
+
const MAX_ARGUMENTS_LENGTH = 0x1000
|
|
23092
23092
|
|
|
23093
23093
|
function decodeCodePointsArray (codePoints) {
|
|
23094
|
-
|
|
23094
|
+
const len = codePoints.length
|
|
23095
23095
|
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
23096
23096
|
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
23097
23097
|
}
|
|
23098
23098
|
|
|
23099
23099
|
// Decode in chunks to avoid "call stack size exceeded".
|
|
23100
|
-
|
|
23101
|
-
|
|
23100
|
+
let res = ''
|
|
23101
|
+
let i = 0
|
|
23102
23102
|
while (i < len) {
|
|
23103
23103
|
res += String.fromCharCode.apply(
|
|
23104
23104
|
String,
|
|
@@ -23109,50 +23109,50 @@ function decodeCodePointsArray (codePoints) {
|
|
|
23109
23109
|
}
|
|
23110
23110
|
|
|
23111
23111
|
function asciiSlice (buf, start, end) {
|
|
23112
|
-
|
|
23112
|
+
let ret = ''
|
|
23113
23113
|
end = Math.min(buf.length, end)
|
|
23114
23114
|
|
|
23115
|
-
for (
|
|
23115
|
+
for (let i = start; i < end; ++i) {
|
|
23116
23116
|
ret += String.fromCharCode(buf[i] & 0x7F)
|
|
23117
23117
|
}
|
|
23118
23118
|
return ret
|
|
23119
23119
|
}
|
|
23120
23120
|
|
|
23121
23121
|
function latin1Slice (buf, start, end) {
|
|
23122
|
-
|
|
23122
|
+
let ret = ''
|
|
23123
23123
|
end = Math.min(buf.length, end)
|
|
23124
23124
|
|
|
23125
|
-
for (
|
|
23125
|
+
for (let i = start; i < end; ++i) {
|
|
23126
23126
|
ret += String.fromCharCode(buf[i])
|
|
23127
23127
|
}
|
|
23128
23128
|
return ret
|
|
23129
23129
|
}
|
|
23130
23130
|
|
|
23131
23131
|
function hexSlice (buf, start, end) {
|
|
23132
|
-
|
|
23132
|
+
const len = buf.length
|
|
23133
23133
|
|
|
23134
23134
|
if (!start || start < 0) start = 0
|
|
23135
23135
|
if (!end || end < 0 || end > len) end = len
|
|
23136
23136
|
|
|
23137
|
-
|
|
23138
|
-
for (
|
|
23137
|
+
let out = ''
|
|
23138
|
+
for (let i = start; i < end; ++i) {
|
|
23139
23139
|
out += hexSliceLookupTable[buf[i]]
|
|
23140
23140
|
}
|
|
23141
23141
|
return out
|
|
23142
23142
|
}
|
|
23143
23143
|
|
|
23144
23144
|
function utf16leSlice (buf, start, end) {
|
|
23145
|
-
|
|
23146
|
-
|
|
23145
|
+
const bytes = buf.slice(start, end)
|
|
23146
|
+
let res = ''
|
|
23147
23147
|
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
|
|
23148
|
-
for (
|
|
23148
|
+
for (let i = 0; i < bytes.length - 1; i += 2) {
|
|
23149
23149
|
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
|
23150
23150
|
}
|
|
23151
23151
|
return res
|
|
23152
23152
|
}
|
|
23153
23153
|
|
|
23154
23154
|
Buffer.prototype.slice = function slice (start, end) {
|
|
23155
|
-
|
|
23155
|
+
const len = this.length
|
|
23156
23156
|
start = ~~start
|
|
23157
23157
|
end = end === undefined ? len : ~~end
|
|
23158
23158
|
|
|
@@ -23172,7 +23172,7 @@ Buffer.prototype.slice = function slice (start, end) {
|
|
|
23172
23172
|
|
|
23173
23173
|
if (end < start) end = start
|
|
23174
23174
|
|
|
23175
|
-
|
|
23175
|
+
const newBuf = this.subarray(start, end)
|
|
23176
23176
|
// Return an augmented `Uint8Array` instance
|
|
23177
23177
|
Object.setPrototypeOf(newBuf, Buffer.prototype)
|
|
23178
23178
|
|
|
@@ -23193,9 +23193,9 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert)
|
|
|
23193
23193
|
byteLength = byteLength >>> 0
|
|
23194
23194
|
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
23195
23195
|
|
|
23196
|
-
|
|
23197
|
-
|
|
23198
|
-
|
|
23196
|
+
let val = this[offset]
|
|
23197
|
+
let mul = 1
|
|
23198
|
+
let i = 0
|
|
23199
23199
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
23200
23200
|
val += this[offset + i] * mul
|
|
23201
23201
|
}
|
|
@@ -23211,8 +23211,8 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert)
|
|
|
23211
23211
|
checkOffset(offset, byteLength, this.length)
|
|
23212
23212
|
}
|
|
23213
23213
|
|
|
23214
|
-
|
|
23215
|
-
|
|
23214
|
+
let val = this[offset + --byteLength]
|
|
23215
|
+
let mul = 1
|
|
23216
23216
|
while (byteLength > 0 && (mul *= 0x100)) {
|
|
23217
23217
|
val += this[offset + --byteLength] * mul
|
|
23218
23218
|
}
|
|
@@ -23263,14 +23263,58 @@ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
|
23263
23263
|
this[offset + 3])
|
|
23264
23264
|
}
|
|
23265
23265
|
|
|
23266
|
+
Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
|
|
23267
|
+
offset = offset >>> 0
|
|
23268
|
+
validateNumber(offset, 'offset')
|
|
23269
|
+
const first = this[offset]
|
|
23270
|
+
const last = this[offset + 7]
|
|
23271
|
+
if (first === undefined || last === undefined) {
|
|
23272
|
+
boundsError(offset, this.length - 8)
|
|
23273
|
+
}
|
|
23274
|
+
|
|
23275
|
+
const lo = first +
|
|
23276
|
+
this[++offset] * 2 ** 8 +
|
|
23277
|
+
this[++offset] * 2 ** 16 +
|
|
23278
|
+
this[++offset] * 2 ** 24
|
|
23279
|
+
|
|
23280
|
+
const hi = this[++offset] +
|
|
23281
|
+
this[++offset] * 2 ** 8 +
|
|
23282
|
+
this[++offset] * 2 ** 16 +
|
|
23283
|
+
last * 2 ** 24
|
|
23284
|
+
|
|
23285
|
+
return BigInt(lo) + (BigInt(hi) << BigInt(32))
|
|
23286
|
+
})
|
|
23287
|
+
|
|
23288
|
+
Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
|
|
23289
|
+
offset = offset >>> 0
|
|
23290
|
+
validateNumber(offset, 'offset')
|
|
23291
|
+
const first = this[offset]
|
|
23292
|
+
const last = this[offset + 7]
|
|
23293
|
+
if (first === undefined || last === undefined) {
|
|
23294
|
+
boundsError(offset, this.length - 8)
|
|
23295
|
+
}
|
|
23296
|
+
|
|
23297
|
+
const hi = first * 2 ** 24 +
|
|
23298
|
+
this[++offset] * 2 ** 16 +
|
|
23299
|
+
this[++offset] * 2 ** 8 +
|
|
23300
|
+
this[++offset]
|
|
23301
|
+
|
|
23302
|
+
const lo = this[++offset] * 2 ** 24 +
|
|
23303
|
+
this[++offset] * 2 ** 16 +
|
|
23304
|
+
this[++offset] * 2 ** 8 +
|
|
23305
|
+
last
|
|
23306
|
+
|
|
23307
|
+
return (BigInt(hi) << BigInt(32)) + BigInt(lo)
|
|
23308
|
+
})
|
|
23309
|
+
|
|
23266
23310
|
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
23267
23311
|
offset = offset >>> 0
|
|
23268
23312
|
byteLength = byteLength >>> 0
|
|
23269
23313
|
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
23270
23314
|
|
|
23271
|
-
|
|
23272
|
-
|
|
23273
|
-
|
|
23315
|
+
let val = this[offset]
|
|
23316
|
+
let mul = 1
|
|
23317
|
+
let i = 0
|
|
23274
23318
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
23275
23319
|
val += this[offset + i] * mul
|
|
23276
23320
|
}
|
|
@@ -23286,9 +23330,9 @@ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
|
23286
23330
|
byteLength = byteLength >>> 0
|
|
23287
23331
|
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
23288
23332
|
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
|
|
23333
|
+
let i = byteLength
|
|
23334
|
+
let mul = 1
|
|
23335
|
+
let val = this[offset + --i]
|
|
23292
23336
|
while (i > 0 && (mul *= 0x100)) {
|
|
23293
23337
|
val += this[offset + --i] * mul
|
|
23294
23338
|
}
|
|
@@ -23309,14 +23353,14 @@ Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
|
23309
23353
|
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
23310
23354
|
offset = offset >>> 0
|
|
23311
23355
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
23312
|
-
|
|
23356
|
+
const val = this[offset] | (this[offset + 1] << 8)
|
|
23313
23357
|
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
23314
23358
|
}
|
|
23315
23359
|
|
|
23316
23360
|
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
23317
23361
|
offset = offset >>> 0
|
|
23318
23362
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
23319
|
-
|
|
23363
|
+
const val = this[offset + 1] | (this[offset] << 8)
|
|
23320
23364
|
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
23321
23365
|
}
|
|
23322
23366
|
|
|
@@ -23340,6 +23384,48 @@ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
|
23340
23384
|
(this[offset + 3])
|
|
23341
23385
|
}
|
|
23342
23386
|
|
|
23387
|
+
Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
|
|
23388
|
+
offset = offset >>> 0
|
|
23389
|
+
validateNumber(offset, 'offset')
|
|
23390
|
+
const first = this[offset]
|
|
23391
|
+
const last = this[offset + 7]
|
|
23392
|
+
if (first === undefined || last === undefined) {
|
|
23393
|
+
boundsError(offset, this.length - 8)
|
|
23394
|
+
}
|
|
23395
|
+
|
|
23396
|
+
const val = this[offset + 4] +
|
|
23397
|
+
this[offset + 5] * 2 ** 8 +
|
|
23398
|
+
this[offset + 6] * 2 ** 16 +
|
|
23399
|
+
(last << 24) // Overflow
|
|
23400
|
+
|
|
23401
|
+
return (BigInt(val) << BigInt(32)) +
|
|
23402
|
+
BigInt(first +
|
|
23403
|
+
this[++offset] * 2 ** 8 +
|
|
23404
|
+
this[++offset] * 2 ** 16 +
|
|
23405
|
+
this[++offset] * 2 ** 24)
|
|
23406
|
+
})
|
|
23407
|
+
|
|
23408
|
+
Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
|
|
23409
|
+
offset = offset >>> 0
|
|
23410
|
+
validateNumber(offset, 'offset')
|
|
23411
|
+
const first = this[offset]
|
|
23412
|
+
const last = this[offset + 7]
|
|
23413
|
+
if (first === undefined || last === undefined) {
|
|
23414
|
+
boundsError(offset, this.length - 8)
|
|
23415
|
+
}
|
|
23416
|
+
|
|
23417
|
+
const val = (first << 24) + // Overflow
|
|
23418
|
+
this[++offset] * 2 ** 16 +
|
|
23419
|
+
this[++offset] * 2 ** 8 +
|
|
23420
|
+
this[++offset]
|
|
23421
|
+
|
|
23422
|
+
return (BigInt(val) << BigInt(32)) +
|
|
23423
|
+
BigInt(this[++offset] * 2 ** 24 +
|
|
23424
|
+
this[++offset] * 2 ** 16 +
|
|
23425
|
+
this[++offset] * 2 ** 8 +
|
|
23426
|
+
last)
|
|
23427
|
+
})
|
|
23428
|
+
|
|
23343
23429
|
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
23344
23430
|
offset = offset >>> 0
|
|
23345
23431
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
@@ -23376,12 +23462,12 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength,
|
|
|
23376
23462
|
offset = offset >>> 0
|
|
23377
23463
|
byteLength = byteLength >>> 0
|
|
23378
23464
|
if (!noAssert) {
|
|
23379
|
-
|
|
23465
|
+
const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
23380
23466
|
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
23381
23467
|
}
|
|
23382
23468
|
|
|
23383
|
-
|
|
23384
|
-
|
|
23469
|
+
let mul = 1
|
|
23470
|
+
let i = 0
|
|
23385
23471
|
this[offset] = value & 0xFF
|
|
23386
23472
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
23387
23473
|
this[offset + i] = (value / mul) & 0xFF
|
|
@@ -23396,12 +23482,12 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength,
|
|
|
23396
23482
|
offset = offset >>> 0
|
|
23397
23483
|
byteLength = byteLength >>> 0
|
|
23398
23484
|
if (!noAssert) {
|
|
23399
|
-
|
|
23485
|
+
const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
23400
23486
|
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
23401
23487
|
}
|
|
23402
23488
|
|
|
23403
|
-
|
|
23404
|
-
|
|
23489
|
+
let i = byteLength - 1
|
|
23490
|
+
let mul = 1
|
|
23405
23491
|
this[offset + i] = value & 0xFF
|
|
23406
23492
|
while (--i >= 0 && (mul *= 0x100)) {
|
|
23407
23493
|
this[offset + i] = (value / mul) & 0xFF
|
|
@@ -23463,18 +23549,70 @@ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert
|
|
|
23463
23549
|
return offset + 4
|
|
23464
23550
|
}
|
|
23465
23551
|
|
|
23552
|
+
function wrtBigUInt64LE (buf, value, offset, min, max) {
|
|
23553
|
+
checkIntBI(value, min, max, buf, offset, 7)
|
|
23554
|
+
|
|
23555
|
+
let lo = Number(value & BigInt(0xffffffff))
|
|
23556
|
+
buf[offset++] = lo
|
|
23557
|
+
lo = lo >> 8
|
|
23558
|
+
buf[offset++] = lo
|
|
23559
|
+
lo = lo >> 8
|
|
23560
|
+
buf[offset++] = lo
|
|
23561
|
+
lo = lo >> 8
|
|
23562
|
+
buf[offset++] = lo
|
|
23563
|
+
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
|
23564
|
+
buf[offset++] = hi
|
|
23565
|
+
hi = hi >> 8
|
|
23566
|
+
buf[offset++] = hi
|
|
23567
|
+
hi = hi >> 8
|
|
23568
|
+
buf[offset++] = hi
|
|
23569
|
+
hi = hi >> 8
|
|
23570
|
+
buf[offset++] = hi
|
|
23571
|
+
return offset
|
|
23572
|
+
}
|
|
23573
|
+
|
|
23574
|
+
function wrtBigUInt64BE (buf, value, offset, min, max) {
|
|
23575
|
+
checkIntBI(value, min, max, buf, offset, 7)
|
|
23576
|
+
|
|
23577
|
+
let lo = Number(value & BigInt(0xffffffff))
|
|
23578
|
+
buf[offset + 7] = lo
|
|
23579
|
+
lo = lo >> 8
|
|
23580
|
+
buf[offset + 6] = lo
|
|
23581
|
+
lo = lo >> 8
|
|
23582
|
+
buf[offset + 5] = lo
|
|
23583
|
+
lo = lo >> 8
|
|
23584
|
+
buf[offset + 4] = lo
|
|
23585
|
+
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
|
23586
|
+
buf[offset + 3] = hi
|
|
23587
|
+
hi = hi >> 8
|
|
23588
|
+
buf[offset + 2] = hi
|
|
23589
|
+
hi = hi >> 8
|
|
23590
|
+
buf[offset + 1] = hi
|
|
23591
|
+
hi = hi >> 8
|
|
23592
|
+
buf[offset] = hi
|
|
23593
|
+
return offset + 8
|
|
23594
|
+
}
|
|
23595
|
+
|
|
23596
|
+
Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
|
|
23597
|
+
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
|
23598
|
+
})
|
|
23599
|
+
|
|
23600
|
+
Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
|
|
23601
|
+
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
|
23602
|
+
})
|
|
23603
|
+
|
|
23466
23604
|
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
23467
23605
|
value = +value
|
|
23468
23606
|
offset = offset >>> 0
|
|
23469
23607
|
if (!noAssert) {
|
|
23470
|
-
|
|
23608
|
+
const limit = Math.pow(2, (8 * byteLength) - 1)
|
|
23471
23609
|
|
|
23472
23610
|
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
23473
23611
|
}
|
|
23474
23612
|
|
|
23475
|
-
|
|
23476
|
-
|
|
23477
|
-
|
|
23613
|
+
let i = 0
|
|
23614
|
+
let mul = 1
|
|
23615
|
+
let sub = 0
|
|
23478
23616
|
this[offset] = value & 0xFF
|
|
23479
23617
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
23480
23618
|
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
@@ -23490,14 +23628,14 @@ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, no
|
|
|
23490
23628
|
value = +value
|
|
23491
23629
|
offset = offset >>> 0
|
|
23492
23630
|
if (!noAssert) {
|
|
23493
|
-
|
|
23631
|
+
const limit = Math.pow(2, (8 * byteLength) - 1)
|
|
23494
23632
|
|
|
23495
23633
|
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
23496
23634
|
}
|
|
23497
23635
|
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23636
|
+
let i = byteLength - 1
|
|
23637
|
+
let mul = 1
|
|
23638
|
+
let sub = 0
|
|
23501
23639
|
this[offset + i] = value & 0xFF
|
|
23502
23640
|
while (--i >= 0 && (mul *= 0x100)) {
|
|
23503
23641
|
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
@@ -23559,6 +23697,14 @@ Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert)
|
|
|
23559
23697
|
return offset + 4
|
|
23560
23698
|
}
|
|
23561
23699
|
|
|
23700
|
+
Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
|
|
23701
|
+
return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
|
23702
|
+
})
|
|
23703
|
+
|
|
23704
|
+
Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
|
|
23705
|
+
return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
|
23706
|
+
})
|
|
23707
|
+
|
|
23562
23708
|
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
23563
23709
|
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
23564
23710
|
if (offset < 0) throw new RangeError('Index out of range')
|
|
@@ -23626,7 +23772,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
|
23626
23772
|
end = target.length - targetStart + start
|
|
23627
23773
|
}
|
|
23628
23774
|
|
|
23629
|
-
|
|
23775
|
+
const len = end - start
|
|
23630
23776
|
|
|
23631
23777
|
if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
|
|
23632
23778
|
// Use built-in when available, missing from IE11
|
|
@@ -23664,7 +23810,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
|
23664
23810
|
throw new TypeError('Unknown encoding: ' + encoding)
|
|
23665
23811
|
}
|
|
23666
23812
|
if (val.length === 1) {
|
|
23667
|
-
|
|
23813
|
+
const code = val.charCodeAt(0)
|
|
23668
23814
|
if ((encoding === 'utf8' && code < 128) ||
|
|
23669
23815
|
encoding === 'latin1') {
|
|
23670
23816
|
// Fast path: If `val` fits into a single byte, use that numeric value.
|
|
@@ -23691,16 +23837,16 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
|
23691
23837
|
|
|
23692
23838
|
if (!val) val = 0
|
|
23693
23839
|
|
|
23694
|
-
|
|
23840
|
+
let i
|
|
23695
23841
|
if (typeof val === 'number') {
|
|
23696
23842
|
for (i = start; i < end; ++i) {
|
|
23697
23843
|
this[i] = val
|
|
23698
23844
|
}
|
|
23699
23845
|
} else {
|
|
23700
|
-
|
|
23846
|
+
const bytes = Buffer.isBuffer(val)
|
|
23701
23847
|
? val
|
|
23702
23848
|
: Buffer.from(val, encoding)
|
|
23703
|
-
|
|
23849
|
+
const len = bytes.length
|
|
23704
23850
|
if (len === 0) {
|
|
23705
23851
|
throw new TypeError('The value "' + val +
|
|
23706
23852
|
'" is invalid for argument "value"')
|
|
@@ -23713,10 +23859,143 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
|
23713
23859
|
return this
|
|
23714
23860
|
}
|
|
23715
23861
|
|
|
23862
|
+
// CUSTOM ERRORS
|
|
23863
|
+
// =============
|
|
23864
|
+
|
|
23865
|
+
// Simplified versions from Node, changed for Buffer-only usage
|
|
23866
|
+
const errors = {}
|
|
23867
|
+
function E (sym, getMessage, Base) {
|
|
23868
|
+
errors[sym] = class NodeError extends Base {
|
|
23869
|
+
constructor () {
|
|
23870
|
+
super()
|
|
23871
|
+
|
|
23872
|
+
Object.defineProperty(this, 'message', {
|
|
23873
|
+
value: getMessage.apply(this, arguments),
|
|
23874
|
+
writable: true,
|
|
23875
|
+
configurable: true
|
|
23876
|
+
})
|
|
23877
|
+
|
|
23878
|
+
// Add the error code to the name to include it in the stack trace.
|
|
23879
|
+
this.name = `${this.name} [${sym}]`
|
|
23880
|
+
// Access the stack to generate the error message including the error code
|
|
23881
|
+
// from the name.
|
|
23882
|
+
this.stack // eslint-disable-line no-unused-expressions
|
|
23883
|
+
// Reset the name to the actual name.
|
|
23884
|
+
delete this.name
|
|
23885
|
+
}
|
|
23886
|
+
|
|
23887
|
+
get code () {
|
|
23888
|
+
return sym
|
|
23889
|
+
}
|
|
23890
|
+
|
|
23891
|
+
set code (value) {
|
|
23892
|
+
Object.defineProperty(this, 'code', {
|
|
23893
|
+
configurable: true,
|
|
23894
|
+
enumerable: true,
|
|
23895
|
+
value,
|
|
23896
|
+
writable: true
|
|
23897
|
+
})
|
|
23898
|
+
}
|
|
23899
|
+
|
|
23900
|
+
toString () {
|
|
23901
|
+
return `${this.name} [${sym}]: ${this.message}`
|
|
23902
|
+
}
|
|
23903
|
+
}
|
|
23904
|
+
}
|
|
23905
|
+
|
|
23906
|
+
E('ERR_BUFFER_OUT_OF_BOUNDS',
|
|
23907
|
+
function (name) {
|
|
23908
|
+
if (name) {
|
|
23909
|
+
return `${name} is outside of buffer bounds`
|
|
23910
|
+
}
|
|
23911
|
+
|
|
23912
|
+
return 'Attempt to access memory outside buffer bounds'
|
|
23913
|
+
}, RangeError)
|
|
23914
|
+
E('ERR_INVALID_ARG_TYPE',
|
|
23915
|
+
function (name, actual) {
|
|
23916
|
+
return `The "${name}" argument must be of type number. Received type ${typeof actual}`
|
|
23917
|
+
}, TypeError)
|
|
23918
|
+
E('ERR_OUT_OF_RANGE',
|
|
23919
|
+
function (str, range, input) {
|
|
23920
|
+
let msg = `The value of "${str}" is out of range.`
|
|
23921
|
+
let received = input
|
|
23922
|
+
if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
|
|
23923
|
+
received = addNumericalSeparator(String(input))
|
|
23924
|
+
} else if (typeof input === 'bigint') {
|
|
23925
|
+
received = String(input)
|
|
23926
|
+
if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
|
|
23927
|
+
received = addNumericalSeparator(received)
|
|
23928
|
+
}
|
|
23929
|
+
received += 'n'
|
|
23930
|
+
}
|
|
23931
|
+
msg += ` It must be ${range}. Received ${received}`
|
|
23932
|
+
return msg
|
|
23933
|
+
}, RangeError)
|
|
23934
|
+
|
|
23935
|
+
function addNumericalSeparator (val) {
|
|
23936
|
+
let res = ''
|
|
23937
|
+
let i = val.length
|
|
23938
|
+
const start = val[0] === '-' ? 1 : 0
|
|
23939
|
+
for (; i >= start + 4; i -= 3) {
|
|
23940
|
+
res = `_${val.slice(i - 3, i)}${res}`
|
|
23941
|
+
}
|
|
23942
|
+
return `${val.slice(0, i)}${res}`
|
|
23943
|
+
}
|
|
23944
|
+
|
|
23945
|
+
// CHECK FUNCTIONS
|
|
23946
|
+
// ===============
|
|
23947
|
+
|
|
23948
|
+
function checkBounds (buf, offset, byteLength) {
|
|
23949
|
+
validateNumber(offset, 'offset')
|
|
23950
|
+
if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
|
|
23951
|
+
boundsError(offset, buf.length - (byteLength + 1))
|
|
23952
|
+
}
|
|
23953
|
+
}
|
|
23954
|
+
|
|
23955
|
+
function checkIntBI (value, min, max, buf, offset, byteLength) {
|
|
23956
|
+
if (value > max || value < min) {
|
|
23957
|
+
const n = typeof min === 'bigint' ? 'n' : ''
|
|
23958
|
+
let range
|
|
23959
|
+
if (byteLength > 3) {
|
|
23960
|
+
if (min === 0 || min === BigInt(0)) {
|
|
23961
|
+
range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
|
|
23962
|
+
} else {
|
|
23963
|
+
range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
|
|
23964
|
+
`${(byteLength + 1) * 8 - 1}${n}`
|
|
23965
|
+
}
|
|
23966
|
+
} else {
|
|
23967
|
+
range = `>= ${min}${n} and <= ${max}${n}`
|
|
23968
|
+
}
|
|
23969
|
+
throw new errors.ERR_OUT_OF_RANGE('value', range, value)
|
|
23970
|
+
}
|
|
23971
|
+
checkBounds(buf, offset, byteLength)
|
|
23972
|
+
}
|
|
23973
|
+
|
|
23974
|
+
function validateNumber (value, name) {
|
|
23975
|
+
if (typeof value !== 'number') {
|
|
23976
|
+
throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
|
|
23977
|
+
}
|
|
23978
|
+
}
|
|
23979
|
+
|
|
23980
|
+
function boundsError (value, length, type) {
|
|
23981
|
+
if (Math.floor(value) !== value) {
|
|
23982
|
+
validateNumber(value, type)
|
|
23983
|
+
throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
|
|
23984
|
+
}
|
|
23985
|
+
|
|
23986
|
+
if (length < 0) {
|
|
23987
|
+
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
|
|
23988
|
+
}
|
|
23989
|
+
|
|
23990
|
+
throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
|
|
23991
|
+
`>= ${type ? 1 : 0} and <= ${length}`,
|
|
23992
|
+
value)
|
|
23993
|
+
}
|
|
23994
|
+
|
|
23716
23995
|
// HELPER FUNCTIONS
|
|
23717
23996
|
// ================
|
|
23718
23997
|
|
|
23719
|
-
|
|
23998
|
+
const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
|
|
23720
23999
|
|
|
23721
24000
|
function base64clean (str) {
|
|
23722
24001
|
// Node takes equal signs as end of the Base64 encoding
|
|
@@ -23734,12 +24013,12 @@ function base64clean (str) {
|
|
|
23734
24013
|
|
|
23735
24014
|
function utf8ToBytes (string, units) {
|
|
23736
24015
|
units = units || Infinity
|
|
23737
|
-
|
|
23738
|
-
|
|
23739
|
-
|
|
23740
|
-
|
|
24016
|
+
let codePoint
|
|
24017
|
+
const length = string.length
|
|
24018
|
+
let leadSurrogate = null
|
|
24019
|
+
const bytes = []
|
|
23741
24020
|
|
|
23742
|
-
for (
|
|
24021
|
+
for (let i = 0; i < length; ++i) {
|
|
23743
24022
|
codePoint = string.charCodeAt(i)
|
|
23744
24023
|
|
|
23745
24024
|
// is surrogate component
|
|
@@ -23813,8 +24092,8 @@ function utf8ToBytes (string, units) {
|
|
|
23813
24092
|
}
|
|
23814
24093
|
|
|
23815
24094
|
function asciiToBytes (str) {
|
|
23816
|
-
|
|
23817
|
-
for (
|
|
24095
|
+
const byteArray = []
|
|
24096
|
+
for (let i = 0; i < str.length; ++i) {
|
|
23818
24097
|
// Node's code seems to be doing this and not & 0x7F..
|
|
23819
24098
|
byteArray.push(str.charCodeAt(i) & 0xFF)
|
|
23820
24099
|
}
|
|
@@ -23822,9 +24101,9 @@ function asciiToBytes (str) {
|
|
|
23822
24101
|
}
|
|
23823
24102
|
|
|
23824
24103
|
function utf16leToBytes (str, units) {
|
|
23825
|
-
|
|
23826
|
-
|
|
23827
|
-
for (
|
|
24104
|
+
let c, hi, lo
|
|
24105
|
+
const byteArray = []
|
|
24106
|
+
for (let i = 0; i < str.length; ++i) {
|
|
23828
24107
|
if ((units -= 2) < 0) break
|
|
23829
24108
|
|
|
23830
24109
|
c = str.charCodeAt(i)
|
|
@@ -23842,7 +24121,8 @@ function base64ToBytes (str) {
|
|
|
23842
24121
|
}
|
|
23843
24122
|
|
|
23844
24123
|
function blitBuffer (src, dst, offset, length) {
|
|
23845
|
-
|
|
24124
|
+
let i
|
|
24125
|
+
for (i = 0; i < length; ++i) {
|
|
23846
24126
|
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
23847
24127
|
dst[i + offset] = src[i]
|
|
23848
24128
|
}
|
|
@@ -23864,18 +24144,27 @@ function numberIsNaN (obj) {
|
|
|
23864
24144
|
|
|
23865
24145
|
// Create lookup table for `toString('hex')`
|
|
23866
24146
|
// See: https://github.com/feross/buffer/issues/219
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
for (
|
|
23871
|
-
|
|
23872
|
-
for (
|
|
24147
|
+
const hexSliceLookupTable = (function () {
|
|
24148
|
+
const alphabet = '0123456789abcdef'
|
|
24149
|
+
const table = new Array(256)
|
|
24150
|
+
for (let i = 0; i < 16; ++i) {
|
|
24151
|
+
const i16 = i * 16
|
|
24152
|
+
for (let j = 0; j < 16; ++j) {
|
|
23873
24153
|
table[i16 + j] = alphabet[i] + alphabet[j]
|
|
23874
24154
|
}
|
|
23875
24155
|
}
|
|
23876
24156
|
return table
|
|
23877
24157
|
})()
|
|
23878
24158
|
|
|
24159
|
+
// Return not function with Error if BigInt not supported
|
|
24160
|
+
function defineBigIntMethod (fn) {
|
|
24161
|
+
return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
|
|
24162
|
+
}
|
|
24163
|
+
|
|
24164
|
+
function BufferBigIntNotDefined () {
|
|
24165
|
+
throw new Error('BigInt not supported')
|
|
24166
|
+
}
|
|
24167
|
+
|
|
23879
24168
|
|
|
23880
24169
|
/***/ },
|
|
23881
24170
|
|
|
@@ -43506,8 +43795,12 @@ if (hasToStringTag && gOPD && getProto) {
|
|
|
43506
43795
|
// @ts-expect-error TS won't narrow inside a closure
|
|
43507
43796
|
descriptor = gOPD(superProto, Symbol.toStringTag);
|
|
43508
43797
|
}
|
|
43509
|
-
|
|
43510
|
-
|
|
43798
|
+
if (descriptor && descriptor.get) {
|
|
43799
|
+
var bound = callBind(descriptor.get);
|
|
43800
|
+
cache[
|
|
43801
|
+
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
|
|
43802
|
+
] = bound;
|
|
43803
|
+
}
|
|
43511
43804
|
}
|
|
43512
43805
|
});
|
|
43513
43806
|
} else {
|
|
@@ -43515,12 +43808,13 @@ if (hasToStringTag && gOPD && getProto) {
|
|
|
43515
43808
|
var arr = new g[typedArray]();
|
|
43516
43809
|
var fn = arr.slice || arr.set;
|
|
43517
43810
|
if (fn) {
|
|
43518
|
-
|
|
43519
|
-
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
|
|
43520
|
-
] = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
|
|
43811
|
+
var bound = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
|
|
43521
43812
|
// @ts-expect-error TODO FIXME
|
|
43522
43813
|
callBind(fn)
|
|
43523
43814
|
);
|
|
43815
|
+
cache[
|
|
43816
|
+
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
|
|
43817
|
+
] = bound;
|
|
43524
43818
|
}
|
|
43525
43819
|
});
|
|
43526
43820
|
}
|
|
@@ -44347,6 +44641,19 @@ class SSRDBAdapter extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseOb
|
|
|
44347
44641
|
}
|
|
44348
44642
|
|
|
44349
44643
|
|
|
44644
|
+
/***/ },
|
|
44645
|
+
|
|
44646
|
+
/***/ "./lib/src/db/adapters/WebDBAdapter.js"
|
|
44647
|
+
/*!*********************************************!*\
|
|
44648
|
+
!*** ./lib/src/db/adapters/WebDBAdapter.js ***!
|
|
44649
|
+
\*********************************************/
|
|
44650
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
44651
|
+
|
|
44652
|
+
"use strict";
|
|
44653
|
+
__webpack_require__.r(__webpack_exports__);
|
|
44654
|
+
|
|
44655
|
+
|
|
44656
|
+
|
|
44350
44657
|
/***/ },
|
|
44351
44658
|
|
|
44352
44659
|
/***/ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js"
|
|
@@ -46914,6 +47221,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
46914
47221
|
/* harmony import */ var _db_sync_SharedWebStreamingSyncImplementation_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./db/sync/SharedWebStreamingSyncImplementation.js */ "./lib/src/db/sync/SharedWebStreamingSyncImplementation.js");
|
|
46915
47222
|
/* harmony import */ var _db_sync_WebRemote_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./db/sync/WebRemote.js */ "./lib/src/db/sync/WebRemote.js");
|
|
46916
47223
|
/* harmony import */ var _db_sync_WebStreamingSyncImplementation_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./db/sync/WebStreamingSyncImplementation.js */ "./lib/src/db/sync/WebStreamingSyncImplementation.js");
|
|
47224
|
+
/* harmony import */ var _db_adapters_WebDBAdapter_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./db/adapters/WebDBAdapter.js */ "./lib/src/db/adapters/WebDBAdapter.js");
|
|
47225
|
+
|
|
46917
47226
|
|
|
46918
47227
|
|
|
46919
47228
|
|