@fluid-experimental/property-common 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229
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/.eslintrc.js +9 -11
- package/.mocharc.json +6 -6
- package/README.md +1 -0
- package/api-extractor.json +2 -2
- package/dist/chronometer.d.ts.map +1 -1
- package/dist/chronometer.js.map +1 -1
- package/dist/consoleUtils.d.ts.map +1 -1
- package/dist/consoleUtils.js +4 -1
- package/dist/consoleUtils.js.map +1 -1
- package/dist/constants.d.ts +6 -6
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +16 -26
- package/dist/constants.js.map +1 -1
- package/dist/datastructures/collection.d.ts.map +1 -1
- package/dist/datastructures/collection.js +5 -4
- package/dist/datastructures/collection.js.map +1 -1
- package/dist/datastructures/dataArray.d.ts.map +1 -1
- package/dist/datastructures/dataArray.js +18 -9
- package/dist/datastructures/dataArray.js.map +1 -1
- package/dist/datastructures/integer64.d.ts.map +1 -1
- package/dist/datastructures/integer64.js +1 -1
- package/dist/datastructures/integer64.js.map +1 -1
- package/dist/datastructures/sortedCollection.d.ts.map +1 -1
- package/dist/datastructures/sortedCollection.js +3 -1
- package/dist/datastructures/sortedCollection.js.map +1 -1
- package/dist/deferredPromise.d.ts +1 -1
- package/dist/deferredPromise.d.ts.map +1 -1
- package/dist/deferredPromise.js +9 -3
- package/dist/deferredPromise.js.map +1 -1
- package/dist/deterministicRandomGenerator.d.ts.map +1 -1
- package/dist/deterministicRandomGenerator.js +6 -6
- package/dist/deterministicRandomGenerator.js.map +1 -1
- package/dist/error_objects/flaggedError.d.ts.map +1 -1
- package/dist/error_objects/flaggedError.js.map +1 -1
- package/dist/error_objects/httpError.d.ts.map +1 -1
- package/dist/error_objects/httpError.js +9 -9
- package/dist/error_objects/httpError.js.map +1 -1
- package/dist/error_objects/httpErrorNoStack.d.ts.map +1 -1
- package/dist/error_objects/httpErrorNoStack.js.map +1 -1
- package/dist/error_objects/operationError.d.ts +7 -7
- package/dist/error_objects/operationError.d.ts.map +1 -1
- package/dist/error_objects/operationError.js +7 -7
- package/dist/error_objects/operationError.js.map +1 -1
- package/dist/guidUtils.d.ts.map +1 -1
- package/dist/guidUtils.js +10 -9
- package/dist/guidUtils.js.map +1 -1
- package/dist/hashCalculator.d.ts.map +1 -1
- package/dist/hashCalculator.js.map +1 -1
- package/dist/joinPaths.d.ts.map +1 -1
- package/dist/joinPaths.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/chronometer.d.ts.map +1 -1
- package/lib/chronometer.js.map +1 -1
- package/lib/consoleUtils.d.ts.map +1 -1
- package/lib/consoleUtils.js +4 -1
- package/lib/consoleUtils.js.map +1 -1
- package/lib/constants.d.ts +6 -6
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +16 -26
- package/lib/constants.js.map +1 -1
- package/lib/datastructures/collection.d.ts.map +1 -1
- package/lib/datastructures/collection.js +5 -4
- package/lib/datastructures/collection.js.map +1 -1
- package/lib/datastructures/dataArray.d.ts.map +1 -1
- package/lib/datastructures/dataArray.js +18 -9
- package/lib/datastructures/dataArray.js.map +1 -1
- package/lib/datastructures/integer64.d.ts.map +1 -1
- package/lib/datastructures/integer64.js +1 -1
- package/lib/datastructures/integer64.js.map +1 -1
- package/lib/datastructures/sortedCollection.d.ts.map +1 -1
- package/lib/datastructures/sortedCollection.js +3 -1
- package/lib/datastructures/sortedCollection.js.map +1 -1
- package/lib/deferredPromise.d.ts +1 -1
- package/lib/deferredPromise.d.ts.map +1 -1
- package/lib/deferredPromise.js +9 -3
- package/lib/deferredPromise.js.map +1 -1
- package/lib/deterministicRandomGenerator.d.ts.map +1 -1
- package/lib/deterministicRandomGenerator.js +6 -6
- package/lib/deterministicRandomGenerator.js.map +1 -1
- package/lib/error_objects/flaggedError.d.ts.map +1 -1
- package/lib/error_objects/flaggedError.js.map +1 -1
- package/lib/error_objects/httpError.d.ts.map +1 -1
- package/lib/error_objects/httpError.js +9 -9
- package/lib/error_objects/httpError.js.map +1 -1
- package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -1
- package/lib/error_objects/httpErrorNoStack.js.map +1 -1
- package/lib/error_objects/operationError.d.ts +7 -7
- package/lib/error_objects/operationError.d.ts.map +1 -1
- package/lib/error_objects/operationError.js +7 -7
- package/lib/error_objects/operationError.js.map +1 -1
- package/lib/guidUtils.d.ts.map +1 -1
- package/lib/guidUtils.js +10 -9
- package/lib/guidUtils.js.map +1 -1
- package/lib/hashCalculator.d.ts.map +1 -1
- package/lib/hashCalculator.js.map +1 -1
- package/lib/joinPaths.d.ts.map +1 -1
- package/lib/joinPaths.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +42 -40
- package/platform-dependent/README.md +1 -0
- package/platform-dependent/browser.js +5 -5
- package/platform-dependent/package.json +14 -14
- package/platform-dependent/server.js +5 -5
- package/prettier.config.cjs +1 -1
- package/src/chronometer.ts +174 -169
- package/src/consoleUtils.ts +16 -11
- package/src/constants.ts +1683 -1640
- package/src/datastructures/collection.ts +417 -416
- package/src/datastructures/dataArray.ts +516 -492
- package/src/datastructures/integer64.ts +102 -99
- package/src/datastructures/sortedCollection.ts +155 -145
- package/src/deferredPromise.ts +43 -42
- package/src/deterministicRandomGenerator.ts +59 -59
- package/src/error_objects/flaggedError.ts +29 -29
- package/src/error_objects/httpError.ts +45 -42
- package/src/error_objects/httpErrorNoStack.ts +17 -17
- package/src/error_objects/operationError.ts +62 -62
- package/src/guidUtils.ts +182 -171
- package/src/hashCalculator.ts +5 -2
- package/src/joinPaths.ts +15 -9
- package/src/packageVersion.ts +1 -1
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
|
@@ -26,7 +26,7 @@ class BaseDataArray {
|
|
|
26
26
|
}
|
|
27
27
|
// The 'eslint-...' is used to disable the rule that requires
|
|
28
28
|
// constructors to start with a capitalized letter.
|
|
29
|
-
this._buffer = new this.bufferConstructor(this.size);
|
|
29
|
+
this._buffer = new this.bufferConstructor(this.size);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Get the value at an index. If no index is passed, return zeroth item.
|
|
@@ -147,7 +147,9 @@ class BaseDataArray {
|
|
|
147
147
|
* @param in_array - The input array.
|
|
148
148
|
*/
|
|
149
149
|
set(in_offset, in_array) {
|
|
150
|
-
if (in_array instanceof ArrayBuffer ||
|
|
150
|
+
if (in_array instanceof ArrayBuffer ||
|
|
151
|
+
in_array instanceof Array ||
|
|
152
|
+
in_array instanceof this.getBufferCtor()) {
|
|
151
153
|
this._buffer.set(in_array, in_offset);
|
|
152
154
|
}
|
|
153
155
|
else if (in_array instanceof BaseDataArray) {
|
|
@@ -206,7 +208,7 @@ class BaseDataArray {
|
|
|
206
208
|
// target buffer with the desired new size
|
|
207
209
|
// The 'eslint-...' is used to disable the rule that requires
|
|
208
210
|
// constructors to start with a capitalized letter.
|
|
209
|
-
const newBuffer = new in_bufferCtor(in_newSize);
|
|
211
|
+
const newBuffer = new in_bufferCtor(in_newSize);
|
|
210
212
|
const oldSize = in_buffer.length;
|
|
211
213
|
const oldBuffer = in_buffer;
|
|
212
214
|
const isShrinking = oldSize > in_newSize;
|
|
@@ -229,11 +231,13 @@ class BaseDataArray {
|
|
|
229
231
|
* @returns The DataArray itself
|
|
230
232
|
*/
|
|
231
233
|
resize(size) {
|
|
234
|
+
// this can be costly!!!
|
|
232
235
|
this._alloc(size);
|
|
233
236
|
this.size = size;
|
|
234
237
|
return this;
|
|
235
238
|
}
|
|
236
239
|
copy() {
|
|
240
|
+
// and this!
|
|
237
241
|
const newBuffer = new this.bufferConstructor(this.size); // buffer with the desired new size
|
|
238
242
|
newBuffer.set(this._buffer);
|
|
239
243
|
return newBuffer;
|
|
@@ -349,7 +353,9 @@ class UniversalDataArray extends BaseDataArray {
|
|
|
349
353
|
* @param in_array - The input array.
|
|
350
354
|
*/
|
|
351
355
|
set(in_offset, in_array) {
|
|
352
|
-
if (in_array instanceof ArrayBuffer ||
|
|
356
|
+
if (in_array instanceof ArrayBuffer ||
|
|
357
|
+
in_array instanceof Array ||
|
|
358
|
+
in_array instanceof this.getBufferCtor()) {
|
|
353
359
|
this.arraySet(this._buffer, in_array, in_offset);
|
|
354
360
|
}
|
|
355
361
|
else if (in_array instanceof BaseDataArray) {
|
|
@@ -436,8 +442,7 @@ class StringDataArray extends BaseDataArray {
|
|
|
436
442
|
* @param in_string - The input string.
|
|
437
443
|
*/
|
|
438
444
|
set(in_offset, in_string) {
|
|
439
|
-
this._buffer =
|
|
440
|
-
`${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset + in_string.length)}`;
|
|
445
|
+
this._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset + in_string.length)}`;
|
|
441
446
|
}
|
|
442
447
|
/**
|
|
443
448
|
* Return a range of characters in the string.
|
|
@@ -451,7 +456,9 @@ class StringDataArray extends BaseDataArray {
|
|
|
451
456
|
}
|
|
452
457
|
return this._buffer.slice(in_idxStart, in_idxEnd);
|
|
453
458
|
}
|
|
454
|
-
get length() {
|
|
459
|
+
get length() {
|
|
460
|
+
return this._buffer.length;
|
|
461
|
+
}
|
|
455
462
|
}
|
|
456
463
|
exports.StringDataArray = StringDataArray;
|
|
457
464
|
/**
|
|
@@ -484,7 +491,7 @@ class BoolDataArray extends UniversalDataArray {
|
|
|
484
491
|
*/
|
|
485
492
|
insertRange(in_offset, in_array) {
|
|
486
493
|
const toBeAdded = in_array.map((val) => !!val);
|
|
487
|
-
this._buffer.splice.call(this._buffer, ...
|
|
494
|
+
this._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(toBeAdded));
|
|
488
495
|
this.size = this.size + in_array.length;
|
|
489
496
|
}
|
|
490
497
|
/**
|
|
@@ -493,7 +500,9 @@ class BoolDataArray extends UniversalDataArray {
|
|
|
493
500
|
* @param in_array - The input array.
|
|
494
501
|
*/
|
|
495
502
|
set(in_offset, in_array) {
|
|
496
|
-
if (in_array instanceof ArrayBuffer ||
|
|
503
|
+
if (in_array instanceof ArrayBuffer ||
|
|
504
|
+
in_array instanceof Array ||
|
|
505
|
+
in_array instanceof this.getBufferCtor()) {
|
|
497
506
|
this.arraySetBool(this._buffer, in_array, in_offset);
|
|
498
507
|
}
|
|
499
508
|
else if (in_array instanceof BaseDataArray) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataArray.js","sourceRoot":"","sources":["../../src/datastructures/dataArray.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,wDAAwD;AACxD,4DAA4D;AAE5D;;GAEG;AAEH;;;GAGG;AACH,MAAM,aAAa;IAYf,YAAY,CAAC,EAAE,CAAE;QACb,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACvB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;SACjD;aAAM;YACH,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;SACjB;QACD,6DAA6D;QAC7D,mDAAmD;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,8BAA8B;IACxF,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,MAAM,GAAG,CAAC;QACf,IAAI,MAAM,IAAI,IAAI,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACtD;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,WAAmB,EAAE,SAAiB;QAChD,I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,CAAC,CAAC,CAAE,GAAe,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,SAAiB,EAAE,QAAQ;QAC3B,IAAI,QAAQ,YAAY,WAAW,IAAI,QAAQ,YAAY,KAAK,IAAI,QAAQ,YAAY,IAAI,CAAC,aAAa,EAAE,EAAE;YAC1G,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;SACxD;aAAM,IAAI,QAAQ,YAAY,aAAa,EAAE;YAC1C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC;SACpE;aAAM;YACH,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;SACvF;IACL,CAAC;CACJ;AAcG,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n\n/**\n * The data arrays definition file.\n */\n\n/**\n * A typed data container that is persistable, high-performance, and can be used\n * as a backing store for collaborative property sets.\n */\nclass BaseDataArray {\n protected _buffer: any;\n private readonly bufferConstructor;\n protected size: number;\n\n constructor(size: number);\n\n /**\n * @param bufferConstructor - This is the constructor to be used to setup the internal buffer of the DataArray.\n * @param size - The initial size with which to allocate the array.\n */\n constructor(bufferConstructor: any, size: number);\n constructor(a, b?) {\n if (typeof a === \"number\") {\n this.size = a;\n this.bufferConstructor = this.getBufferCtor();\n } else {\n this.bufferConstructor = a;\n this.size = b;\n }\n // The 'eslint-...' is used to disable the rule that requires\n // constructors to start with a capitalized letter.\n this._buffer = new this.bufferConstructor(this.size); // eslint-disable-line new-cap\n }\n\n /**\n * Get the value at an index. If no index is passed, return zeroth item.\n * @param in_idx - The specific item in the data array.\n * @returns The value at that index.\n */\n getValue(in_idx = 0): any {\n if (in_idx >= this.size || in_idx < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n\n return this._buffer[in_idx];\n }\n\n /**\n * Return a range of values in the array.\n * @param in_idxStart - the starting index\n * @param in_idxEnd - the end index\n * @returns the array of values in the range\n */\n getValueRange(in_idxStart: number, in_idxEnd: number) {\n if (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n\n return this._buffer.subarray(in_idxStart, in_idxEnd);\n }\n\n /**\n * Return the serialized form of Data Arrays.\n * @returns An object containing an array of the values.\n */\n serialize(): number[] {\n return Array.from(this._buffer.subarray(0, this.size));\n }\n\n /**\n * Deserialize data from a serialized representation\n * @param in_serialized - the serialized representation\n */\n deserialize(in_serialized) {\n const values = in_serialized;\n const length = in_serialized.length;\n if (length !== this.size) {\n this.resize(length);\n this.size = length;\n }\n let i;\n for (i = 0; i < length; i++) {\n this._buffer[i] = values[i];\n }\n }\n\n /**\n * Set value at an index.\n * @param in_idx - the index\n * @param in_value - the value we want to set at index\n */\n setValue(in_idx: number, in_value) {\n if (in_idx < this._buffer.length) {\n this._buffer[in_idx] = in_value;\n } else {\n console.error(\"DataArray setValue in_idx is out of bounds.\");\n }\n }\n\n /**\n * creates a copy of a typed array with removed elements\n * @param in_arr - the input array (won't be modified)\n * @param in_offset - starting index of range that will be removed\n * @param in_deleteCount - number of removed elements\n * @returns a copy of the input array without the selected range\n */\n private _removeElementsFromArray(in_arr, in_offset: number, in_deleteCount: number) {\n // TODO: this function can be optimized\n const newSize = this.size - in_deleteCount;\n const splicedArray = new in_arr.constructor(newSize);\n splicedArray.set(in_arr.subarray(0, in_offset));\n splicedArray.set(in_arr.subarray(in_offset + in_deleteCount, this.size), in_offset);\n return splicedArray;\n }\n\n /**\n * remove a range of elements from the array\n * @param in_offset - start of the range\n * @param in_deleteCount - number of elements to be removed\n */\n removeRange(in_offset: number, in_deleteCount: number) {\n if (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n this._buffer = this._removeElementsFromArray(this._buffer, in_offset, in_deleteCount);\n this.size = this.size - in_deleteCount;\n } else {\n console.error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n }\n }\n\n /**\n * copy an array with elements inserted into the copy\n * @param in_arr - the input array (won't be modified)\n * @param in_offset - the index where the new elements will be inserted\n * @param in_addedArray - the array with the elements that will be added\n * @returns the combined array\n */\n private _insert(in_arr, in_offset: number, in_addedArray) {\n // TODO: this function can be optimized\n const newSize = this.size + (in_addedArray.length as number);\n const insertedArray = new in_arr.constructor(newSize);\n insertedArray.set(in_arr.subarray(0, in_offset));\n insertedArray.set(in_addedArray, in_offset);\n insertedArray.set(in_arr.subarray(in_offset, this.size), in_offset + (in_addedArray.length as number));\n return insertedArray;\n }\n\n /**\n * insert the content of an array into the DataArray\n * @param in_offset - the target index\n * @param in_array - the array to be inserted\n */\n insertRange(in_offset: number, in_array) {\n this._buffer = this._insert(this._buffer, in_offset, in_array);\n this.size = this.size + (in_array.length as number);\n }\n\n /**\n * Set this array values to be equal to in_array values.\n * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n * @param in_array - The input array.\n */\n set(in_offset: number, in_array) {\n if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {\n this._buffer.set(in_array, in_offset);\n } else if (in_array instanceof BaseDataArray) {\n this._buffer.set(in_array.getBuffer(), in_offset);\n } else {\n console.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n }\n }\n\n /**\n * Insert a value at the end of the array, creates a new element at the end and sets the value.\n * @param in_value - The new value.\n */\n push(in_value) {\n // Adjust the buffer if necessary\n const bufferLength = this._buffer.length;\n if (this.size > bufferLength - 1) {\n this._alloc(this.size * 2 || 1); // grow by a factor of 2x\n }\n // set the value and update size\n this.setValue(this.size, in_value);\n this.size++;\n }\n\n /**\n * Get direct access to the data (for performance reasons) this should be uses read only.\n * @returns The (read only) raw data.\n */\n getBuffer() {\n return this._buffer;\n }\n\n /**\n * Get the constructor of the underlying `TypedArray`.\n * @returns The constructor for the data buffer.\n */\n getBufferCtor() {\n return this.bufferConstructor;\n }\n\n /**\n * Apply a given function to all elements of the array.\n * @param in_fn - The function that will be applied to every element.\n */\n iterate(in_fn) {\n const l = this.size;\n for (let i = 0; i < l; i++) {\n in_fn(this._buffer[i]);\n }\n }\n\n /**\n * Tet a resized buffer copy.\n * @param in_bufferCtor - The constructor for the returned buffer.\n * @param in_buffer - The input buffer (won't be modified).\n * @param in_newSize - The target size.\n * @returns The buffer with the new size.\n */\n private resizeBuffer(in_bufferCtor, in_buffer, in_newSize: number) {\n // target buffer with the desired new size\n // The 'eslint-...' is used to disable the rule that requires\n // constructors to start with a capitalized letter.\n const newBuffer = new in_bufferCtor(in_newSize); // eslint-disable-line new-cap\n const oldSize = in_buffer.length;\n const oldBuffer = in_buffer;\n const isShrinking = oldSize > in_newSize;\n newBuffer.set(isShrinking ? oldBuffer.subarray(0, in_newSize) : oldBuffer);\n return newBuffer;\n }\n\n /**\n * Allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n * which makes pushes to the array less expensive later).\n * @param size - The target allocated space.\n * @returns The DataArray itself.\n */\n protected _alloc(size: number): any {\n this._buffer = this.resizeBuffer(this.bufferConstructor, this._buffer, size);\n return this;\n }\n\n /**\n * Change the size of the array\n * @param size - The target size\n * @returns The DataArray itself\n */\n resize(size: number) { // this can be costly!!!\n this._alloc(size);\n this.size = size;\n return this;\n }\n\n copy() { // and this!\n const newBuffer = new this.bufferConstructor(this.size); // buffer with the desired new size\n newBuffer.set(this._buffer);\n return newBuffer;\n }\n\n get length() {\n return this.size;\n }\n}\n\nclass Int8DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Int8Array, size);\n }\n}\n\nclass Int16DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Int16Array, size);\n }\n}\n\nclass Int32DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Int32Array, size);\n }\n}\n\nclass Uint8DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Uint8Array, size);\n }\n}\n\nclass Uint16DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Uint16Array, size);\n }\n}\n\nclass Uint32DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Uint32Array, size);\n }\n}\n\nclass Float32DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Float32Array, size);\n }\n}\n\nclass Float64DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Float64Array, size);\n }\n}\n\n/**\n * A data container that can contain every native type\n *\n * @param size - The initial size with which to allocate the array.\n */\nclass UniversalDataArray extends BaseDataArray {\n constructor(bufferConstructor: any, size: number);\n constructor(size: number);\n constructor(a?, b?) {\n if (b === undefined) {\n super(Array, a);\n } else {\n super(a, b);\n }\n }\n\n /**\n * Helper function to write array values into another array at a given offset.\n *\n * @param array - The target array.\n * @param values - The values we need to write.\n * @param offset - The starting index in target array.\n */\n private arraySet(array, values, offset = 0) {\n let index = 0;\n values.forEach(function(value) {\n array[index + offset] = value;\n index++;\n });\n }\n\n /**\n * Insert the content of an array into the DataArray.\n * @param in_offset - The target index.\n * @param in_array - The array to be inserted.\n */\n insertRange(in_offset: number, in_array: any[]) {\n this._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(in_array));\n this.size = this.size + in_array.length;\n }\n\n /**\n * Eemove a range of elements from the array.\n * @param in_offset - The start of the range.\n * @param in_deleteCount - The number of elements to be removed.\n */\n removeRange(in_offset: number, in_deleteCount: number) {\n if (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n this._buffer.splice(in_offset, in_deleteCount);\n this.size -= in_deleteCount;\n } else {\n throw Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n }\n }\n\n /**\n * Set this array values to be equal to in_array values.\n * @param in_offset - An optional offset in this array to begin start\n * setting this arrays values to in_array values.\n * @param in_array - The input array.\n */\n set(in_offset: number, in_array) {\n if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {\n this.arraySet(this._buffer, in_array, in_offset);\n } else if (in_array instanceof BaseDataArray) {\n this.arraySet(this._buffer, in_array.getBuffer(), in_offset);\n } else {\n console.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n }\n }\n\n /**\n * Return a range of values in the array.\n * @param in_idxStart - the starting index\n * @param in_idxEnd - the end index - this offset is exclusive\n * @returns the array of values in the range\n */\n getValueRange(in_idxStart: number, in_idxEnd: number) {\n if (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n return this._buffer.slice(in_idxStart, in_idxEnd);\n }\n\n /**\n * change the size of a javascript array and keep the content, if possible. Keeps the input buffer.\n * @param in_buffer - input buffer - not changed\n * @param in_newSize - target size\n * @returns an Array of the new size\n */\n private resizeBufferArray(in_buffer, in_newSize) {\n // target buffer with the desired new size\n const newBuffer = new Array(in_newSize);\n const oldSize = in_buffer.length;\n const oldBuffer = in_buffer;\n const isShrinking = oldSize > in_newSize;\n this.arraySet(newBuffer, isShrinking ? oldBuffer.slice(0, in_newSize) : oldBuffer);\n return newBuffer;\n }\n\n /**\n * allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n * which makes pushes to the array less expensive later)\n * @param size - the target allocated space\n * @returns the DataArray itself\n */\n protected _alloc(size: number): any {\n this._buffer = this.resizeBufferArray(this._buffer, size);\n return this;\n }\n}\n\n/**\n * A data container that contains a string\n */\nclass StringDataArray extends BaseDataArray {\n constructor() {\n super(String, 0);\n this.size = 0;\n this._buffer = \"\";\n }\n /**\n * insert the content of a string into the StringDataArray\n * @param in_offset - the target index\n * @param in_string - the string to be inserted\n */\n insertRange(in_offset: number, in_string: string) {\n this._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset)}`;\n this.size = this.size + in_string.length;\n }\n\n /**\n * remove a range of elements from the string\n * @param in_offset - start of the range\n * @param in_deleteCount - number of elements to be removed\n */\n removeRange(in_offset: number, in_deleteCount: number) {\n if (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n this._buffer = `${this._buffer.substr(0, in_offset)}${this._buffer.substr(in_offset + in_deleteCount)}`;\n this.size -= in_deleteCount;\n } else {\n throw Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n }\n }\n\n /**\n * Set this array values to be equal to in_string values.\n * @param in_offset - The offset in this array to begin start setting this arrays values to in_string values.\n * @param in_string - The input string.\n */\n set(in_offset: number, in_string: string) {\n this._buffer =\n `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset + in_string.length)}`;\n }\n\n /**\n * Return a range of characters in the string.\n * @param in_idxStart - the starting index\n * @param in_idxEnd - the end index - this offset is exclusive\n * @returns the characters in the range\n */\n getValueRange(in_idxStart: number, in_idxEnd: number): string {\n if (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n return this._buffer.slice(in_idxStart, in_idxEnd);\n }\n\n get length() { return this._buffer.length; }\n}\n\n/**\n * A data container that can contain boolean type\n */\nclass BoolDataArray extends UniversalDataArray {\n /**\n * @param size - The initial size with which to allocate the array.\n */\n constructor(size: number) {\n super(Array, size);\n }\n\n /**\n * helper function to write and cast to boolean array values into another array at a given offset\n * @param array - target array\n * @param values - the values we need to write\n * @param offset - starting index in target array\n */\n private arraySetBool(array, values, offset = 0) {\n let index = 0;\n values.forEach(function(value) {\n array[index + offset] = !!(value as boolean);\n index++;\n });\n }\n\n /**\n * insert the content of an array into the DataArray\n * @param in_offset - the target index\n * @param in_array - the array to be inserted\n */\n insertRange(in_offset: number, in_array: any[]) {\n const toBeAdded: any[] = in_array.map((val) => !!(val as boolean));\n this._buffer.splice.call(this._buffer, ...([in_offset, 0].concat(toBeAdded)));\n this.size = this.size + in_array.length;\n }\n\n /**\n * Set this array values to be equal to in_array values.\n * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n * @param in_array - The input array.\n */\n set(in_offset: number, in_array) {\n if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {\n this.arraySetBool(this._buffer, in_array, in_offset);\n } else if (in_array instanceof BaseDataArray) {\n this.arraySetBool(this._buffer, in_array.getBuffer(), in_offset);\n } else {\n console.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n }\n }\n}\n\nexport {\n BaseDataArray,\n Float32DataArray,\n Float64DataArray,\n Int8DataArray,\n Int16DataArray,\n Int32DataArray,\n Uint8DataArray,\n Uint16DataArray,\n Uint32DataArray,\n UniversalDataArray,\n StringDataArray,\n BoolDataArray,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"dataArray.js","sourceRoot":"","sources":["../../src/datastructures/dataArray.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,wDAAwD;AACxD,4DAA4D;AAE5D;;GAEG;AAEH;;;GAGG;AACH,MAAM,aAAa;IAYlB,YAAY,CAAC,EAAE,CAAE;QAChB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;SAC9C;aAAM;YACN,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;SACd;QACD,6DAA6D;QAC7D,mDAAmD;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC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C,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,OAAO,CAAC,UAAU,KAAK;YAC7B,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAE,KAAiB,CAAC;YAC7C,KAAK,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,SAAiB,EAAE,QAAe;QAC7C,MAAM,SAAS,GAAU,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAE,GAAe,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,SAAiB,EAAE,QAAQ;QAC9B,IACC,QAAQ,YAAY,WAAW;YAC/B,QAAQ,YAAY,KAAK;YACzB,QAAQ,YAAY,IAAI,CAAC,aAAa,EAAE,EACvC;YACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;SACrD;aAAM,IAAI,QAAQ,YAAY,aAAa,EAAE;YAC7C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC;SACjE;aAAM;YACN,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;SACpF;IACF,CAAC;CACD;AAcA,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n\n/**\n * The data arrays definition file.\n */\n\n/**\n * A typed data container that is persistable, high-performance, and can be used\n * as a backing store for collaborative property sets.\n */\nclass BaseDataArray {\n\tprotected _buffer: any;\n\tprivate readonly bufferConstructor;\n\tprotected size: number;\n\n\tconstructor(size: number);\n\n\t/**\n\t * @param bufferConstructor - This is the constructor to be used to setup the internal buffer of the DataArray.\n\t * @param size - The initial size with which to allocate the array.\n\t */\n\tconstructor(bufferConstructor: any, size: number);\n\tconstructor(a, b?) {\n\t\tif (typeof a === \"number\") {\n\t\t\tthis.size = a;\n\t\t\tthis.bufferConstructor = this.getBufferCtor();\n\t\t} else {\n\t\t\tthis.bufferConstructor = a;\n\t\t\tthis.size = b;\n\t\t}\n\t\t// The 'eslint-...' is used to disable the rule that requires\n\t\t// constructors to start with a capitalized letter.\n\t\tthis._buffer = new this.bufferConstructor(this.size);\n\t}\n\n\t/**\n\t * Get the value at an index. If no index is passed, return zeroth item.\n\t * @param in_idx - The specific item in the data array.\n\t * @returns The value at that index.\n\t */\n\tgetValue(in_idx = 0): any {\n\t\tif (in_idx >= this.size || in_idx < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\n\t\treturn this._buffer[in_idx];\n\t}\n\n\t/**\n\t * Return a range of values in the array.\n\t * @param in_idxStart - the starting index\n\t * @param in_idxEnd - the end index\n\t * @returns the array of values in the range\n\t */\n\tgetValueRange(in_idxStart: number, in_idxEnd: number) {\n\t\tif (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\n\t\treturn this._buffer.subarray(in_idxStart, in_idxEnd);\n\t}\n\n\t/**\n\t * Return the serialized form of Data Arrays.\n\t * @returns An object containing an array of the values.\n\t */\n\tserialize(): number[] {\n\t\treturn Array.from(this._buffer.subarray(0, this.size));\n\t}\n\n\t/**\n\t * Deserialize data from a serialized representation\n\t * @param in_serialized - the serialized representation\n\t */\n\tdeserialize(in_serialized) {\n\t\tconst values = in_serialized;\n\t\tconst length = in_serialized.length;\n\t\tif (length !== this.size) {\n\t\t\tthis.resize(length);\n\t\t\tthis.size = length;\n\t\t}\n\t\tlet i;\n\t\tfor (i = 0; i < length; i++) {\n\t\t\tthis._buffer[i] = values[i];\n\t\t}\n\t}\n\n\t/**\n\t * Set value at an index.\n\t * @param in_idx - the index\n\t * @param in_value - the value we want to set at index\n\t */\n\tsetValue(in_idx: number, in_value) {\n\t\tif (in_idx < this._buffer.length) {\n\t\t\tthis._buffer[in_idx] = in_value;\n\t\t} else {\n\t\t\tconsole.error(\"DataArray setValue in_idx is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * creates a copy of a typed array with removed elements\n\t * @param in_arr - the input array (won't be modified)\n\t * @param in_offset - starting index of range that will be removed\n\t * @param in_deleteCount - number of removed elements\n\t * @returns a copy of the input array without the selected range\n\t */\n\tprivate _removeElementsFromArray(in_arr, in_offset: number, in_deleteCount: number) {\n\t\t// TODO: this function can be optimized\n\t\tconst newSize = this.size - in_deleteCount;\n\t\tconst splicedArray = new in_arr.constructor(newSize);\n\t\tsplicedArray.set(in_arr.subarray(0, in_offset));\n\t\tsplicedArray.set(in_arr.subarray(in_offset + in_deleteCount, this.size), in_offset);\n\t\treturn splicedArray;\n\t}\n\n\t/**\n\t * remove a range of elements from the array\n\t * @param in_offset - start of the range\n\t * @param in_deleteCount - number of elements to be removed\n\t */\n\tremoveRange(in_offset: number, in_deleteCount: number) {\n\t\tif (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n\t\t\tthis._buffer = this._removeElementsFromArray(this._buffer, in_offset, in_deleteCount);\n\t\t\tthis.size = this.size - in_deleteCount;\n\t\t} else {\n\t\t\tconsole.error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * copy an array with elements inserted into the copy\n\t * @param in_arr - the input array (won't be modified)\n\t * @param in_offset - the index where the new elements will be inserted\n\t * @param in_addedArray - the array with the elements that will be added\n\t * @returns the combined array\n\t */\n\tprivate _insert(in_arr, in_offset: number, in_addedArray) {\n\t\t// TODO: this function can be optimized\n\t\tconst newSize = this.size + (in_addedArray.length as number);\n\t\tconst insertedArray = new in_arr.constructor(newSize);\n\t\tinsertedArray.set(in_arr.subarray(0, in_offset));\n\t\tinsertedArray.set(in_addedArray, in_offset);\n\t\tinsertedArray.set(\n\t\t\tin_arr.subarray(in_offset, this.size),\n\t\t\tin_offset + (in_addedArray.length as number),\n\t\t);\n\t\treturn insertedArray;\n\t}\n\n\t/**\n\t * insert the content of an array into the DataArray\n\t * @param in_offset - the target index\n\t * @param in_array - the array to be inserted\n\t */\n\tinsertRange(in_offset: number, in_array) {\n\t\tthis._buffer = this._insert(this._buffer, in_offset, in_array);\n\t\tthis.size = this.size + (in_array.length as number);\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_array values.\n\t * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n\t * @param in_array - The input array.\n\t */\n\tset(in_offset: number, in_array) {\n\t\tif (\n\t\t\tin_array instanceof ArrayBuffer ||\n\t\t\tin_array instanceof Array ||\n\t\t\tin_array instanceof this.getBufferCtor()\n\t\t) {\n\t\t\tthis._buffer.set(in_array, in_offset);\n\t\t} else if (in_array instanceof BaseDataArray) {\n\t\t\tthis._buffer.set(in_array.getBuffer(), in_offset);\n\t\t} else {\n\t\t\tconsole.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n\t\t}\n\t}\n\n\t/**\n\t * Insert a value at the end of the array, creates a new element at the end and sets the value.\n\t * @param in_value - The new value.\n\t */\n\tpush(in_value) {\n\t\t// Adjust the buffer if necessary\n\t\tconst bufferLength = this._buffer.length;\n\t\tif (this.size > bufferLength - 1) {\n\t\t\tthis._alloc(this.size * 2 || 1); // grow by a factor of 2x\n\t\t}\n\t\t// set the value and update size\n\t\tthis.setValue(this.size, in_value);\n\t\tthis.size++;\n\t}\n\n\t/**\n\t * Get direct access to the data (for performance reasons) this should be uses read only.\n\t * @returns The (read only) raw data.\n\t */\n\tgetBuffer() {\n\t\treturn this._buffer;\n\t}\n\n\t/**\n\t * Get the constructor of the underlying `TypedArray`.\n\t * @returns The constructor for the data buffer.\n\t */\n\tgetBufferCtor() {\n\t\treturn this.bufferConstructor;\n\t}\n\n\t/**\n\t * Apply a given function to all elements of the array.\n\t * @param in_fn - The function that will be applied to every element.\n\t */\n\titerate(in_fn) {\n\t\tconst l = this.size;\n\t\tfor (let i = 0; i < l; i++) {\n\t\t\tin_fn(this._buffer[i]);\n\t\t}\n\t}\n\n\t/**\n\t * Tet a resized buffer copy.\n\t * @param in_bufferCtor - The constructor for the returned buffer.\n\t * @param in_buffer - The input buffer (won't be modified).\n\t * @param in_newSize - The target size.\n\t * @returns The buffer with the new size.\n\t */\n\tprivate resizeBuffer(in_bufferCtor, in_buffer, in_newSize: number) {\n\t\t// target buffer with the desired new size\n\t\t// The 'eslint-...' is used to disable the rule that requires\n\t\t// constructors to start with a capitalized letter.\n\t\tconst newBuffer = new in_bufferCtor(in_newSize);\n\t\tconst oldSize = in_buffer.length;\n\t\tconst oldBuffer = in_buffer;\n\t\tconst isShrinking = oldSize > in_newSize;\n\t\tnewBuffer.set(isShrinking ? oldBuffer.subarray(0, in_newSize) : oldBuffer);\n\t\treturn newBuffer;\n\t}\n\n\t/**\n\t * Allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n\t * which makes pushes to the array less expensive later).\n\t * @param size - The target allocated space.\n\t * @returns The DataArray itself.\n\t */\n\tprotected _alloc(size: number): any {\n\t\tthis._buffer = this.resizeBuffer(this.bufferConstructor, this._buffer, size);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Change the size of the array\n\t * @param size - The target size\n\t * @returns The DataArray itself\n\t */\n\tresize(size: number) {\n\t\t// this can be costly!!!\n\t\tthis._alloc(size);\n\t\tthis.size = size;\n\t\treturn this;\n\t}\n\n\tcopy() {\n\t\t// and this!\n\t\tconst newBuffer = new this.bufferConstructor(this.size); // buffer with the desired new size\n\t\tnewBuffer.set(this._buffer);\n\t\treturn newBuffer;\n\t}\n\n\tget length() {\n\t\treturn this.size;\n\t}\n}\n\nclass Int8DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Int8Array, size);\n\t}\n}\n\nclass Int16DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Int16Array, size);\n\t}\n}\n\nclass Int32DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Int32Array, size);\n\t}\n}\n\nclass Uint8DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Uint8Array, size);\n\t}\n}\n\nclass Uint16DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Uint16Array, size);\n\t}\n}\n\nclass Uint32DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Uint32Array, size);\n\t}\n}\n\nclass Float32DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Float32Array, size);\n\t}\n}\n\nclass Float64DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Float64Array, size);\n\t}\n}\n\n/**\n * A data container that can contain every native type\n *\n * @param size - The initial size with which to allocate the array.\n */\nclass UniversalDataArray extends BaseDataArray {\n\tconstructor(bufferConstructor: any, size: number);\n\tconstructor(size: number);\n\tconstructor(a?, b?) {\n\t\tif (b === undefined) {\n\t\t\tsuper(Array, a);\n\t\t} else {\n\t\t\tsuper(a, b);\n\t\t}\n\t}\n\n\t/**\n\t * Helper function to write array values into another array at a given offset.\n\t *\n\t * @param array - The target array.\n\t * @param values - The values we need to write.\n\t * @param offset - The starting index in target array.\n\t */\n\tprivate arraySet(array, values, offset = 0) {\n\t\tlet index = 0;\n\t\tvalues.forEach(function (value) {\n\t\t\tarray[index + offset] = value;\n\t\t\tindex++;\n\t\t});\n\t}\n\n\t/**\n\t * Insert the content of an array into the DataArray.\n\t * @param in_offset - The target index.\n\t * @param in_array - The array to be inserted.\n\t */\n\tinsertRange(in_offset: number, in_array: any[]) {\n\t\tthis._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(in_array));\n\t\tthis.size = this.size + in_array.length;\n\t}\n\n\t/**\n\t * Eemove a range of elements from the array.\n\t * @param in_offset - The start of the range.\n\t * @param in_deleteCount - The number of elements to be removed.\n\t */\n\tremoveRange(in_offset: number, in_deleteCount: number) {\n\t\tif (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n\t\t\tthis._buffer.splice(in_offset, in_deleteCount);\n\t\t\tthis.size -= in_deleteCount;\n\t\t} else {\n\t\t\tthrow Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_array values.\n\t * @param in_offset - An optional offset in this array to begin start\n\t * setting this arrays values to in_array values.\n\t * @param in_array - The input array.\n\t */\n\tset(in_offset: number, in_array) {\n\t\tif (\n\t\t\tin_array instanceof ArrayBuffer ||\n\t\t\tin_array instanceof Array ||\n\t\t\tin_array instanceof this.getBufferCtor()\n\t\t) {\n\t\t\tthis.arraySet(this._buffer, in_array, in_offset);\n\t\t} else if (in_array instanceof BaseDataArray) {\n\t\t\tthis.arraySet(this._buffer, in_array.getBuffer(), in_offset);\n\t\t} else {\n\t\t\tconsole.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n\t\t}\n\t}\n\n\t/**\n\t * Return a range of values in the array.\n\t * @param in_idxStart - the starting index\n\t * @param in_idxEnd - the end index - this offset is exclusive\n\t * @returns the array of values in the range\n\t */\n\tgetValueRange(in_idxStart: number, in_idxEnd: number) {\n\t\tif (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\t\treturn this._buffer.slice(in_idxStart, in_idxEnd);\n\t}\n\n\t/**\n\t * change the size of a javascript array and keep the content, if possible. Keeps the input buffer.\n\t * @param in_buffer - input buffer - not changed\n\t * @param in_newSize - target size\n\t * @returns an Array of the new size\n\t */\n\tprivate resizeBufferArray(in_buffer, in_newSize) {\n\t\t// target buffer with the desired new size\n\t\tconst newBuffer = new Array(in_newSize);\n\t\tconst oldSize = in_buffer.length;\n\t\tconst oldBuffer = in_buffer;\n\t\tconst isShrinking = oldSize > in_newSize;\n\t\tthis.arraySet(newBuffer, isShrinking ? oldBuffer.slice(0, in_newSize) : oldBuffer);\n\t\treturn newBuffer;\n\t}\n\n\t/**\n\t * allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n\t * which makes pushes to the array less expensive later)\n\t * @param size - the target allocated space\n\t * @returns the DataArray itself\n\t */\n\tprotected _alloc(size: number): any {\n\t\tthis._buffer = this.resizeBufferArray(this._buffer, size);\n\t\treturn this;\n\t}\n}\n\n/**\n * A data container that contains a string\n */\nclass StringDataArray extends BaseDataArray {\n\tconstructor() {\n\t\tsuper(String, 0);\n\t\tthis.size = 0;\n\t\tthis._buffer = \"\";\n\t}\n\t/**\n\t * insert the content of a string into the StringDataArray\n\t * @param in_offset - the target index\n\t * @param in_string - the string to be inserted\n\t */\n\tinsertRange(in_offset: number, in_string: string) {\n\t\tthis._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(\n\t\t\tin_offset,\n\t\t)}`;\n\t\tthis.size = this.size + in_string.length;\n\t}\n\n\t/**\n\t * remove a range of elements from the string\n\t * @param in_offset - start of the range\n\t * @param in_deleteCount - number of elements to be removed\n\t */\n\tremoveRange(in_offset: number, in_deleteCount: number) {\n\t\tif (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n\t\t\tthis._buffer = `${this._buffer.substr(0, in_offset)}${this._buffer.substr(\n\t\t\t\tin_offset + in_deleteCount,\n\t\t\t)}`;\n\t\t\tthis.size -= in_deleteCount;\n\t\t} else {\n\t\t\tthrow Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_string values.\n\t * @param in_offset - The offset in this array to begin start setting this arrays values to in_string values.\n\t * @param in_string - The input string.\n\t */\n\tset(in_offset: number, in_string: string) {\n\t\tthis._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(\n\t\t\tin_offset + in_string.length,\n\t\t)}`;\n\t}\n\n\t/**\n\t * Return a range of characters in the string.\n\t * @param in_idxStart - the starting index\n\t * @param in_idxEnd - the end index - this offset is exclusive\n\t * @returns the characters in the range\n\t */\n\tgetValueRange(in_idxStart: number, in_idxEnd: number): string {\n\t\tif (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\t\treturn this._buffer.slice(in_idxStart, in_idxEnd);\n\t}\n\n\tget length() {\n\t\treturn this._buffer.length;\n\t}\n}\n\n/**\n * A data container that can contain boolean type\n */\nclass BoolDataArray extends UniversalDataArray {\n\t/**\n\t * @param size - The initial size with which to allocate the array.\n\t */\n\tconstructor(size: number) {\n\t\tsuper(Array, size);\n\t}\n\n\t/**\n\t * helper function to write and cast to boolean array values into another array at a given offset\n\t * @param array - target array\n\t * @param values - the values we need to write\n\t * @param offset - starting index in target array\n\t */\n\tprivate arraySetBool(array, values, offset = 0) {\n\t\tlet index = 0;\n\t\tvalues.forEach(function (value) {\n\t\t\tarray[index + offset] = !!(value as boolean);\n\t\t\tindex++;\n\t\t});\n\t}\n\n\t/**\n\t * insert the content of an array into the DataArray\n\t * @param in_offset - the target index\n\t * @param in_array - the array to be inserted\n\t */\n\tinsertRange(in_offset: number, in_array: any[]) {\n\t\tconst toBeAdded: any[] = in_array.map((val) => !!(val as boolean));\n\t\tthis._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(toBeAdded));\n\t\tthis.size = this.size + in_array.length;\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_array values.\n\t * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n\t * @param in_array - The input array.\n\t */\n\tset(in_offset: number, in_array) {\n\t\tif (\n\t\t\tin_array instanceof ArrayBuffer ||\n\t\t\tin_array instanceof Array ||\n\t\t\tin_array instanceof this.getBufferCtor()\n\t\t) {\n\t\t\tthis.arraySetBool(this._buffer, in_array, in_offset);\n\t\t} else if (in_array instanceof BaseDataArray) {\n\t\t\tthis.arraySetBool(this._buffer, in_array.getBuffer(), in_offset);\n\t\t} else {\n\t\t\tconsole.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n\t\t}\n\t}\n}\n\nexport {\n\tBaseDataArray,\n\tFloat32DataArray,\n\tFloat64DataArray,\n\tInt8DataArray,\n\tInt16DataArray,\n\tInt32DataArray,\n\tUint8DataArray,\n\tUint16DataArray,\n\tUint32DataArray,\n\tUniversalDataArray,\n\tStringDataArray,\n\tBoolDataArray,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integer64.d.ts","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;;;;;;;;GAUG;AACH,qBAAa,SAAS;
|
|
1
|
+
{"version":3,"file":"integer64.d.ts","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;;;;;;;;GAUG;AACH,qBAAa,SAAS;IACT,SAAS,CAAC,GAAG;IAAM,SAAS,CAAC,IAAI;gBAAvB,GAAG,SAAI,EAAY,IAAI,SAAI;IAEjD;;OAEG;IACH,YAAY;IAIZ;;OAEG;IACH,WAAW;IAIX,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,SAAK,GAAG,MAAM;CAwBlE;AA0DD;;GAEG;AACH,qBAAa,KAAM,SAAQ,SAAS;IACnC,MAAM,CAAC,UAAU,cAAwB,MAAM,2BAG7C;IAEF,KAAK;IAIL,QAAQ,CAAC,KAAK,SAAK;CAGnB;AAED;;GAEG;AACH,qBAAa,MAAO,SAAQ,SAAS;IACpC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,SAAK;IAKlD,KAAK;IAIL,QAAQ,CAAC,KAAK,KAAA;CAGd"}
|
|
@@ -50,7 +50,7 @@ class Integer64 {
|
|
|
50
50
|
let high = this.getValueHigh();
|
|
51
51
|
let low = this.getValueLow();
|
|
52
52
|
let result = "";
|
|
53
|
-
const sign = !!(isSigned &&
|
|
53
|
+
const sign = !!(isSigned && high & 0x80000000); // eslint-disable-line no-bitwise
|
|
54
54
|
if (sign) {
|
|
55
55
|
high = ~high; // eslint-disable-line no-bitwise
|
|
56
56
|
low = BIT32 - low;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integer64.js","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;GAEG;AAEH,oDAAuB;AACvB,kDAA+C;AAC/C,4CAAyC;AAEzC,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,EAAE,GAAG,EAAE,GAAG,qBAAS,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAa,SAAS;
|
|
1
|
+
{"version":3,"file":"integer64.js","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;GAEG;AAEH,oDAAuB;AACvB,kDAA+C;AAC/C,4CAAyC;AAEzC,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,EAAE,GAAG,EAAE,GAAG,qBAAS,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAa,SAAS;IACrB,YAAsB,MAAM,CAAC,EAAY,OAAO,CAAC;QAA3B,QAAG,GAAH,GAAG,CAAI;QAAY,SAAI,GAAJ,IAAI,CAAI;IAAG,CAAC;IAErD;;OAEG;IACH,YAAY;QACX,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,WAAW;QACV,OA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J,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ,CAAC,KAAK;QACb,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;CACD;AAbD,wBAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview implements (U)Int64 Datastructures\n */\n\nimport _ from \"lodash\";\nimport { ConsoleUtils } from \"../consoleUtils\";\nimport { constants } from \"../constants\";\n\nconst BIT32 = 4294967296;\nconst { MSG } = constants;\n\n/**\n * A data representation class for 64 bit integer types.\n *\n * @remarks This is necessary since js doesn't support 64bit integers natively yet.\n *\n * Please note this class is immutable.\n * There are and there won't be set functions! (see javascript String class)\n *\n * @param low - Lower 32 bit\n * @param high - Higher 32 bit\n */\nexport class Integer64 {\n\tconstructor(protected low = 0, protected high = 0) {}\n\n\t/**\n\t * @returns The higher 32 bit integer part\n\t */\n\tgetValueHigh() {\n\t\treturn this.high;\n\t}\n\n\t/**\n\t * @returns The lower 32 bit integer part\n\t */\n\tgetValueLow() {\n\t\treturn this.low;\n\t}\n\n\tprotected _int64toString(isSigned: boolean, in_radix = 10): string {\n\t\tConsoleUtils.assert(_.isNumber(in_radix), `${MSG.IN_RADIX_MUST_BE_NUMBER} ${in_radix}`);\n\t\tConsoleUtils.assert(\n\t\t\tin_radix >= 2 && 36 >= in_radix,\n\t\t\t`${MSG.BASE_OUT_OF_RANGE} ${in_radix}`,\n\t\t);\n\n\t\tlet high = this.getValueHigh();\n\t\tlet low = this.getValueLow();\n\t\tlet result = \"\";\n\t\tconst sign = !!(isSigned && high & 0x80000000); // eslint-disable-line no-bitwise\n\t\tif (sign) {\n\t\t\thigh = ~high; // eslint-disable-line no-bitwise\n\t\t\tlow = BIT32 - low;\n\t\t}\n\t\tdo {\n\t\t\tconst mod = (high % in_radix) * BIT32 + low;\n\t\t\thigh = Math.floor(high / in_radix);\n\t\t\tlow = Math.floor(mod / in_radix);\n\t\t\tresult = (mod % in_radix).toString(in_radix) + result;\n\t\t} while (high || low);\n\n\t\treturn sign ? `-${result}` : result;\n\t}\n}\n\n/**\n * stringToInt function parses a string argument updates object's lower and higher 32 bit integer parts.\n *\n * @param in_signed - If the expect response should be signed or unsigned.\n * @param in_string - The value to parse. Leading whitespace in the string argument is ignored.\n * @param in_radix - An integer between 2 and 36 that represents the\n * radix (the base in mathematical numeral systems) of the above mentioned string.\n *\n * @throws If `in_string` is not a string.\n * @throws If `in_radix` is entered but is not a number between 2 and 36.\n * @throws If the property is a `Uint64` property and `in_string` is a negative number.\n * @throws If `in_string` contains characters other than numbers.\n *\n * @returns Low and high bits of `Int64`.\n */\nfunction _stringToInt64(in_signed: boolean, in_string: string, in_radix = 10): number[] {\n\tConsoleUtils.assert(_.isString(in_string), MSG.IN_STRING_MUST_BE_STRING + in_string);\n\tconst string = in_string.trim();\n\n\tConsoleUtils.assert(_.isNumber(in_radix), `${MSG.IN_RADIX_BETWEEN_2_36} ${in_radix}`);\n\tConsoleUtils.assert(in_radix >= 2 && 36 >= in_radix, `${MSG.BASE_OUT_OF_RANGE} ${in_radix}`);\n\n\tlet position = 0;\n\tlet negative = false;\n\tlet high = 0;\n\tlet low = 0;\n\tif (string[0] === \"-\") {\n\t\tnegative = true;\n\t\tposition += 1;\n\t}\n\n\tConsoleUtils.assert(!negative || in_signed, MSG.CANNOT_UPDATE_TO_NEGATIVE + string);\n\n\twhile (position < string.length) {\n\t\tconst digit = parseInt(string[position++], in_radix);\n\t\tif (isNaN(digit)) {\n\t\t\tthrow new TypeError(MSG.CANNOT_PARSE_INVALID_CHARACTERS + string);\n\t\t}\n\t\tlow = low * in_radix + digit;\n\t\thigh = high * in_radix + Math.floor(low / BIT32);\n\t\tlow %= BIT32;\n\t}\n\n\tif (negative) {\n\t\t// eslint-disable-next-line no-bitwise\n\t\thigh = ~high;\n\t\tif (low) {\n\t\t\tlow = BIT32 - low;\n\t\t} else {\n\t\t\thigh += 1;\n\t\t}\n\t}\n\n\treturn [low, high];\n}\n\n/**\n * A data representation class for the signed 64 bit integer type\n */\nexport class Int64 extends Integer64 {\n\tstatic fromString = function (in_string: string, radix = 10) {\n\t\tconst [low, high] = _stringToInt64(true, in_string, radix);\n\t\treturn new Int64(low, high);\n\t};\n\n\tclone() {\n\t\treturn new Int64(this.low, this.high);\n\t}\n\n\ttoString(radix = 10) {\n\t\treturn this._int64toString(true, radix);\n\t}\n}\n\n/**\n * A data representation class for the unsigned 64 bit integer type\n */\nexport class Uint64 extends Integer64 {\n\tstatic fromString(in_string: string, in_radix = 10) {\n\t\tconst [low, high] = _stringToInt64.call(this, false, in_string, in_radix);\n\t\treturn new Uint64(low, high);\n\t}\n\n\tclone() {\n\t\treturn new Uint64(this.low, this.high);\n\t}\n\n\ttoString(radix) {\n\t\treturn this._int64toString(false, radix);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortedCollection.d.ts","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"sortedCollection.d.ts","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,mBAAmB,CAAC,CAA+C;IAE3E;;;;;;OAMG;gBACS,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAA;IAItC;;;;;;;;;;;OAWG;IACH,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM;IAK9D;;;;;;;OAOG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC;IASxC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAMrB;;;OAGG;IACH,KAAK,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAO5B;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IAqCjC;;;;;;OAMG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAUjC;;;;;;OAMG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAS9C"}
|
|
@@ -111,7 +111,9 @@ class SortedCollection extends collection_1.Collection {
|
|
|
111
111
|
if (in_array.length === 1) {
|
|
112
112
|
return 1;
|
|
113
113
|
}
|
|
114
|
-
return (middleIndex +
|
|
114
|
+
return (middleIndex +
|
|
115
|
+
1 +
|
|
116
|
+
this._binarySearchNearestIndex(in_array.slice(middleIndex + 1, in_array.length), in_key));
|
|
115
117
|
}
|
|
116
118
|
return middleIndex;
|
|
117
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortedCollection.js","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;;GAGG;AAEH,oDAAuB;AACvB,6CAA0C;AAE1C,MAAa,gBAAoB,SAAQ,uBAAa;
|
|
1
|
+
{"version":3,"file":"sortedCollection.js","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;;GAGG;AAEH,oDAAuB;AACvB,6CAA0C;AAE1C,MAAa,gBAAoB,SAAQ,uBAAa;IAIrD;;;;;;OAMG;IACH,YAAY,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AAI,CAAC,QAAQ,EAAE;YAC1C,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;OAMG;IACH,sBAAsB,CAAC,MAAuB;QAC7C,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,CAC1D,IAAI,CAAC,WAAW,EAChB,MAAM,CAAC,QAAQ,EAAE,CACjB,CAAC;QACF,OAAO,oBAAoB,KAAK,CAAC;YAChC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;CACD;AA5JD,4CA4JC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview\n * Declaration of the SortedCollection class\n */\n\nimport _ from \"lodash\";\nimport { Collection } from \"./collection\";\n\nexport class SortedCollection<T> extends Collection<T> {\n\tprivate _sortedKeys: string[] = [];\n\tprivate _comparisonFunction?: (x: string, y: string) => number = undefined;\n\n\t/**\n\t * A sorted collection class.\n\t * @param in_name - a friendly name to describe this collection. If undefined\n\t * the collection will have a default \"Untitled Collection\" assigned to its name.\n\t * @param in_type - optional parameter pointing to the constructor\n\t * of a type this Collection will host.\n\t */\n\tconstructor(in_name?: string, in_type?) {\n\t\tsuper(in_name, in_type);\n\t}\n\n\t/**\n\t * Set the comparison function. By default the keys will be sorted wrt their ASCII code.\n\t *\n\t * @param in_fn - The function to compare two entries.\n\t * The return value of this function must convey to the following cases:\n\t *\n\t * - if a \\> b, then the return value must be greater than 0.\n\t *\n\t * - if a \\< b, then the return value must be less than 0.\n\t *\n\t * - if a == b, then the return value must be 0.\n\t */\n\tsetComparisonFunction(in_fn?: (x: string, y: string) => number) {\n\t\tconsole.assert(_.isFunction(in_fn), \"Must provide a function\");\n\t\tthis._comparisonFunction = in_fn;\n\t}\n\n\t/**\n\t * Add an item to the collection. Sort the list of keys in an ascending order.\n\t *\n\t * @param in_key - Key to store the value under.\n\t * @param in_value - Value to store in the collection.\n\t *\n\t * @returns The value passed in.\n\t */\n\tadd(in_key: string | number, in_value: T) {\n\t\tconst toReturn = super.add(in_key, in_value);\n\n\t\tthis._sortedKeys.push(in_key.toString());\n\t\tthis._sortedKeys.sort(this._comparisonFunction);\n\n\t\treturn toReturn;\n\t}\n\n\t/**\n\t * Remove an item from this Collection. This method returns a Boolean indicating\n\t * the success or failure of the removal. This is practical because if we were\n\t * to throw an error when the key doesn't exist, it would require additional\n\t * checks by the caller to make sure this key exists prior to removal. Which\n\t * would make the attempt of removal more verbose and also costly because the\n\t * caller would have to keep a list – somewhere else – of the things he can\n\t * and cannot remove.\n\t *\n\t * @param in_key - the key we wish to remove\n\t * @returns true if the key exists and was removed, false otherwise.\n\t */\n\tremove(in_key: string) {\n\t\tconst toReturn = super.remove(in_key);\n\t\tthis._sortedKeys = _.without(this._sortedKeys, in_key);\n\t\treturn toReturn;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @returns cloned SortedCollection\n\t */\n\tclone(): SortedCollection<T> {\n\t\tconst newCol = new SortedCollection<T>(this._name, this._type);\n\t\tnewCol.setComparisonFunction(this._comparisonFunction);\n\t\tnewCol.bulkAdd(this._items);\n\t\treturn newCol;\n\t}\n\n\t/**\n\t * Internal function use to search (binary search) for the nearest index that\n\t * the given key would be inserted.\n\t * i.e. given the array [10, 20, 30, 40, 50] the index that 35 should be inserted at is 3\n\t * @param in_array - Target array\n\t * @param in_key - Key to check against\n\t * @returns The index at which the key would be inserted in\n\t */\n\tprivate _binarySearchNearestIndex(in_array: string[], in_key: string): number {\n\t\tif (this._comparisonFunction === undefined) {\n\t\t\treturn _.sortedIndex(in_array, in_key);\n\t\t} else {\n\t\t\tconst middleIndex = Math.floor((in_array.length - 1) / 2);\n\n\t\t\tif (middleIndex < 0) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tif (this._comparisonFunction(in_array[middleIndex], in_key) > 0) {\n\t\t\t\tif (in_array.length === 1) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\treturn this._binarySearchNearestIndex(in_array.slice(0, middleIndex), in_key);\n\t\t\t}\n\n\t\t\tif (this._comparisonFunction(in_array[middleIndex], in_key) < 0) {\n\t\t\t\tif (in_array.length === 1) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tmiddleIndex +\n\t\t\t\t\t1 +\n\t\t\t\t\tthis._binarySearchNearestIndex(\n\t\t\t\t\t\tin_array.slice(middleIndex + 1, in_array.length),\n\t\t\t\t\t\tin_key,\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn middleIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Return the nearest next item to the given key i.e.\n\t * For the given list of keys ['1.0.1', '2.0.0', '2.2.0', '7.0.1'] the nearest next item to 6.0.1 is\n\t * the item mapped by '7.0.1'\n\t * @param in_key - The key to check against in order to get the nearest next item\n\t * @returns The nearest next item\n\t */\n\tgetNearestNextItem(in_key: string) {\n\t\tconst closestNextIndex = this._binarySearchNearestIndex(\n\t\t\tthis._sortedKeys,\n\t\t\tin_key.toString(),\n\t\t);\n\t\treturn closestNextIndex === this.getCount()\n\t\t\t? undefined\n\t\t\t: this.item(this._sortedKeys[closestNextIndex]);\n\t}\n\n\t/**\n\t * Return the nearest previous item to the given key i.e.\n\t * For the given list of keys ['1.0.1', '2.0.0', '2.2.0', '7.0.1'] the nearest previous item to 6.0.1 is\n\t * the item mapped by '7.0.1'\n\t * @param in_key - The key to check against in order to get the nearest previous item\n\t * @returns The nearest previous item\n\t */\n\tgetNearestPreviousItem(in_key: string | number) {\n\t\tconst closestPreviousIndex = this._binarySearchNearestIndex(\n\t\t\tthis._sortedKeys,\n\t\t\tin_key.toString(),\n\t\t);\n\t\treturn closestPreviousIndex === 0\n\t\t\t? undefined\n\t\t\t: this.item(this._sortedKeys[closestPreviousIndex - 1]);\n\t}\n}\n"]}
|
|
@@ -13,7 +13,7 @@ export declare class DeferredPromise<T> implements Promise<T> {
|
|
|
13
13
|
private _rejectSelf;
|
|
14
14
|
private readonly promise;
|
|
15
15
|
constructor();
|
|
16
|
-
[Symbol.toStringTag]: string;
|
|
16
|
+
readonly [Symbol.toStringTag]: string;
|
|
17
17
|
finally(onfinally?: () => void): Promise<T>;
|
|
18
18
|
/**
|
|
19
19
|
* Fetches a node style callback that fulfills the promise when called.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferredPromise.d.ts","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"deferredPromise.d.ts","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;;IAQrC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAqB;IAE7C,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxD;;;OAGG;IACH,KAAK;IAUQ,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC/C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACjF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GACjF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAIlB,KAAK,CAAC,OAAO,GAAG,KAAK,EACjC,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAC/E,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAIhB,OAAO,CAAC,GAAG,EAAE,CAAC;IAGd,MAAM,CAAC,MAAM,EAAE,GAAG;CAGzB"}
|
package/dist/deferredPromise.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
var _a;
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
exports.DeferredPromise = void 0;
|
|
8
9
|
/**
|
|
@@ -13,6 +14,7 @@ exports.DeferredPromise = void 0;
|
|
|
13
14
|
*/
|
|
14
15
|
class DeferredPromise {
|
|
15
16
|
constructor() {
|
|
17
|
+
this[_a] = "DeferredPromise";
|
|
16
18
|
this.promise = new Promise((resolve, reject) => {
|
|
17
19
|
this._resolveSelf = resolve;
|
|
18
20
|
this._rejectSelf = reject;
|
|
@@ -40,9 +42,13 @@ class DeferredPromise {
|
|
|
40
42
|
async catch(onrejected) {
|
|
41
43
|
return this.promise.then(onrejected);
|
|
42
44
|
}
|
|
43
|
-
resolve(val) {
|
|
44
|
-
|
|
45
|
+
resolve(val) {
|
|
46
|
+
this._resolveSelf(val);
|
|
47
|
+
}
|
|
48
|
+
reject(reason) {
|
|
49
|
+
this._rejectSelf(reason);
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
exports.DeferredPromise = DeferredPromise;
|
|
47
|
-
Symbol.toStringTag;
|
|
53
|
+
_a = Symbol.toStringTag;
|
|
48
54
|
//# sourceMappingURL=deferredPromise.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH;;;;;GAKG;AACH,MAAa,eAAe;IAK3B;QAMS,QAAoB,GAAW,iBAAiB,CAAC;QALzD,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC3B,CAAC,CAAC,CAAC;IACJ,CAAC;IAGM,KAAK,CAAC,OAAO,CAAC,SAAsB;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK;QACJ,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACxB,yEAAyE;YACzE,IAAI,KAAK,EAAE;gBACV,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC1B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,WAAiF,EACjF,UAAmF;QAEnF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC;IAEM,KAAK,CAAC,KAAK,CACjB,UAAiF;QAEjF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAEM,OAAO,CAAC,GAAM;QACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IACM,MAAM,CAAC,MAAW;QACxB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACD;AAlDD,0CAkDC;KAvCU,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Creates a Promise that can be fulfilled or rejected later in an arbitrary manner (rather than\n * through the constructor's executor).\n * For example, a deferred promise could be fulfilled after waiting for many asynchronous\n * tasks to terminate. This class becomes useful when combining classic async calls with promises.\n */\nexport class DeferredPromise<T> implements Promise<T> {\n\tprivate _resolveSelf;\n\tprivate _rejectSelf;\n\tprivate readonly promise: Promise<T>;\n\n\tconstructor() {\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis._resolveSelf = resolve;\n\t\t\tthis._rejectSelf = reject;\n\t\t});\n\t}\n\treadonly [Symbol.toStringTag]: string = \"DeferredPromise\";\n\n\tpublic async finally(onfinally?: () => void): Promise<T> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * Fetches a node style callback that fulfills the promise when called.\n\t * @returns A node style callback that fulfills the promise when called.\n\t */\n\tgetCb() {\n\t\treturn (error, result) => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\tif (error) {\n\t\t\t\treturn this.reject(error);\n\t\t\t}\n\t\t\treturn this.resolve(result);\n\t\t};\n\t}\n\n\tpublic async then<TResult1 = T, TResult2 = never>(\n\t\tonfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n\t\tonrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,\n\t): Promise<TResult1 | TResult2> {\n\t\treturn this.promise.then(onfulfilled, onrejected);\n\t}\n\n\tpublic async catch<TResult = never>(\n\t\tonrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,\n\t): Promise<T | TResult> {\n\t\treturn this.promise.then(onrejected);\n\t}\n\n\tpublic resolve(val: T) {\n\t\tthis._resolveSelf(val);\n\t}\n\tpublic reject(reason: any) {\n\t\tthis._rejectSelf(reason);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deterministicRandomGenerator.d.ts","sourceRoot":"","sources":["../src/deterministicRandomGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;GAMG;AACH,qBAAa,4BAA4B;
|
|
1
|
+
{"version":3,"file":"deterministicRandomGenerator.d.ts","sourceRoot":"","sources":["../src/deterministicRandomGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;GAMG;AACH,qBAAa,4BAA4B;IACxC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;IAErB;;;OAGG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM;IAcpC;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,SAAM;IAKnB;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAsBhC"}
|
|
@@ -49,7 +49,7 @@ class DeterministicRandomGenerator {
|
|
|
49
49
|
*/
|
|
50
50
|
random(in_max = 1.0) {
|
|
51
51
|
const randomInteger = this.irandom();
|
|
52
|
-
return randomInteger / 4294967296 * in_max;
|
|
52
|
+
return (randomInteger / 4294967296) * in_max;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Creates an integer point random number.
|
|
@@ -72,11 +72,11 @@ class DeterministicRandomGenerator {
|
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
74
|
return in_max < 16777619
|
|
75
|
-
// The random generator doesn't seem to be very good.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
? // The random generator doesn't seem to be very good.
|
|
76
|
+
// It is quite biased (e.g. it generates too many even numbers)
|
|
77
|
+
// this is a hack to solve at least this problem, but we probably should
|
|
78
|
+
// instead use a different approach altogether
|
|
79
|
+
(this._guid1[0] % 16777619) % in_max
|
|
80
80
|
: this._guid1[0] % in_max;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deterministicRandomGenerator.js","sourceRoot":"","sources":["../src/deterministicRandomGenerator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;GAEG;AAEH,+BAA+B;AAE/B,oDAAuB;AACvB,2CAAwC;AACxC,qDAAiD;AAEjD;;;;;;GAMG;AACH,MAAa,4BAA4B;
|
|
1
|
+
{"version":3,"file":"deterministicRandomGenerator.js","sourceRoot":"","sources":["../src/deterministicRandomGenerator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;GAEG;AAEH,+BAA+B;AAE/B,oDAAuB;AACvB,2CAAwC;AACxC,qDAAiD;AAEjD;;;;;;GAMG;AACH,MAAa,4BAA4B;IAKxC;;;OAGG;IACH,YAAY,OAAwB;QACnC,4DAA4D;QAC5D,IAAI,CAAC,MAAM,GAAG,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,qBAAS,CAAC,cAAc,CAAC,OAAO,CAAC;YACnC,CAAC,CAAC,qBAAS,CAAC,cAAc,CAAC,IAAA,8BAAa,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CA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8CAA8C;oBAC9C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,MAAM;gBACtC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;SAC3B;IACF,CAAC;CACD;AAlED,oEAkEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Helper class to create a deterministic sequence of random numbers.\n */\n\n/* eslint-disable no-bitwise */\n\nimport _ from \"lodash\";\nimport { GuidUtils } from \"./guidUtils\";\nimport { calculateHash } from \"./hashCalculator\";\n\n/**\n * Random number generator that creates a deterministic sequence of random numbers based on an initial seed GUID.\n *\n * @remarks Warning: This is a very straight forward implementation based on the hashCombine4xUint32 function.\n * It probably doesn't produce very high quality random numbers (do not use this for cryptography!) and it is not very\n * efficient.\n */\nexport class DeterministicRandomGenerator {\n\t_guid1: Uint32Array;\n\t_guid2: Uint32Array;\n\t_result: Uint32Array;\n\n\t/**\n\t * @param in_seed - The initial seed (it can be either a GUID or a number)\n\t * which is used to initialize the random number generator.\n\t */\n\tconstructor(in_seed: string | number) {\n\t\t// Initialize the internal state from the given initial guid\n\t\tthis._guid1 = _.isString(in_seed)\n\t\t\t? GuidUtils.guidToUint32x4(in_seed)\n\t\t\t: GuidUtils.guidToUint32x4(calculateHash(String(in_seed)));\n\t\tthis._guid2 = new Uint32Array(4);\n\t\tthis._guid2[0] = (this._guid1[0] + 1) >>> 0;\n\t\tthis._guid2[1] = (this._guid1[1] + 1) >>> 0;\n\t\tthis._guid2[2] = (this._guid1[2] + 1) >>> 0;\n\t\tthis._guid2[3] = (this._guid1[3] + 1) >>> 0;\n\n\t\tthis._result = new Uint32Array(4);\n\t}\n\n\t/**\n\t * Creates a floating point random number.\n\t *\n\t * @param in_max - If supplied the returned number will be 0 \\<= number \\< `in_max`.\n\t * If none is given, `in_max` = 1 is assumed.\n\t *\n\t * @returns The random number.\n\t */\n\trandom(in_max = 1.0) {\n\t\tconst randomInteger = this.irandom();\n\t\treturn (randomInteger / 4294967296) * in_max;\n\t}\n\n\t/**\n\t * Creates an integer point random number.\n\t *\n\t * @param in_max - If supplied the returned number will be 0 \\<= number \\< `in_max`.\n\t * If none is given, `in_max` = 14294967296 (2^32) is assumed.\n\t *\n\t * @returns The random number.\n\t */\n\tirandom(in_max?: number): number {\n\t\t// Create a new hash\n\t\tGuidUtils.hashCombine4xUint32(this._guid1, this._guid2, this._result);\n\n\t\t// Permute the hashes\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tthis._guid1[i] = this._guid2[i];\n\t\t\tthis._guid2[i] = this._result[i];\n\t\t}\n\n\t\tif (in_max === undefined) {\n\t\t\treturn this._guid1[0];\n\t\t} else {\n\t\t\treturn in_max < 16777619\n\t\t\t\t? // The random generator doesn't seem to be very good.\n\t\t\t\t // It is quite biased (e.g. it generates too many even numbers)\n\t\t\t\t // this is a hack to solve at least this problem, but we probably should\n\t\t\t\t // instead use a different approach altogether\n\t\t\t\t (this._guid1[0] % 16777619) % in_max\n\t\t\t\t: this._guid1[0] % in_max;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flaggedError.d.ts","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,qBAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"flaggedError.d.ts","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,qBAAa,YAAY;IACxB;;OAEG;IACH,MAAM,CAAC,KAAK;QACX;;WAEG;;QAEH;;WAEG;;MAEF;IAEF,SAAS,CAAC,KAAK,EAAE,MAAM,CAAK;IAE5B;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,WAAW,IAAI,OAAO;CAGtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flaggedError.js","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"flaggedError.js","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IAClD,sCAAsC;IACtC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AAChC,CAAC,CAAC;AAEF,MAAa,YAAY;IAAzB;QAeW,UAAK,GAAW,CAAC,CAAC;IAe7B,CAAC;IAbA;;OAEG;IACH,OAAO;QACN,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,WAAW;QACV,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;;AA7BF,oCA8BC;AA7BA;;GAEG;AACI,kBAAK,GAAG;IACd;;OAEG;IACH,SAAS,EAAE,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,CAAC;CACR,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Checks if a flag is set\n * @param flags - Flags set within an error object\n * @param flag - A flag to be checked\n * @returns True if the flag is set in passed flags, false otherwise.\n */\nconst _isFlagSet = (flags: number, flag: number) => {\n\t// eslint-disable-next-line no-bitwise\n\treturn (flags & flag) === flag;\n};\n\nexport class FlaggedError {\n\t/**\n\t * Flags that may be set on an error instance.\n\t */\n\tstatic FLAGS = {\n\t\t/**\n\t\t * A transient error results from an operation that could succeed if retried.\n\t\t */\n\t\tTRANSIENT: 1,\n\t\t/**\n\t\t * A quiet error should not trigger an error log.\n\t\t */\n\t\tQUIET: 2,\n\t};\n\n\tprotected flags: number = 0;\n\n\t/**\n\t * @returns True if the quiet flag is set.\n\t */\n\tisQuiet(): boolean {\n\t\treturn _isFlagSet(this.flags, FlaggedError.FLAGS.QUIET);\n\t}\n\n\t/**\n\t * @returns True if the transient flag is set.\n\t */\n\tisTransient(): boolean {\n\t\treturn _isFlagSet(this.flags, FlaggedError.FLAGS.TRANSIENT);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpError.d.ts","sourceRoot":"","sources":["../../src/error_objects/httpError.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,qBAAa,SAAU,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"httpError.d.ts","sourceRoot":"","sources":["../../src/error_objects/httpError.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAE3B,KAAK,CAAC;IACN,UAAU,CAAC;IACX,aAAa,CAAC;IACd,MAAM,CAAC;IACP,GAAG,CAAC;IACJ,KAAK;gBALL,KAAK,CAAC,oBAAQ,EACd,UAAU,CAAC,oBAAQ,EACnB,aAAa,CAAC,oBAAQ,EACtB,MAAM,CAAC,oBAAQ,EACf,GAAG,CAAC,oBAAQ,EACZ,KAAK,SAAI;IASjB,MAAM,CAAC,KAAK;;;MAAsB;IAElC,OAAO,IAAI,OAAO;IAIlB,WAAW,IAAI,OAAO;IAItB,OAAO,CAAC,gBAAgB;IAaxB;;;OAGG;IACH,QAAQ,IAAI,MAAM;CAWlB"}
|
|
@@ -27,7 +27,7 @@ class HTTPError extends Error {
|
|
|
27
27
|
Object.setPrototypeOf(this, HTTPError.prototype);
|
|
28
28
|
this.name = "HTTPError";
|
|
29
29
|
this.message = this._generateMessage(title, statusCode, statusMessage, method, url);
|
|
30
|
-
this.stack =
|
|
30
|
+
this.stack = new Error(this.message).stack;
|
|
31
31
|
}
|
|
32
32
|
isQuiet() {
|
|
33
33
|
return flaggedError_1.FlaggedError.prototype.isQuiet.call(this);
|
|
@@ -36,20 +36,20 @@ class HTTPError extends Error {
|
|
|
36
36
|
return flaggedError_1.FlaggedError.prototype.isTransient.call(this);
|
|
37
37
|
}
|
|
38
38
|
_generateMessage(title, statusCode, statusMessage, method, url) {
|
|
39
|
-
const titleStr =
|
|
40
|
-
const statusCodeStr =
|
|
41
|
-
const statusMessageStr =
|
|
42
|
-
const methodStr =
|
|
43
|
-
const urlStr =
|
|
44
|
-
return `HTTPError: ${titleStr}, statusCode:${statusCodeStr}, ` +
|
|
45
|
-
`statusMessage:${statusMessageStr}, method:${methodStr}, url:${urlStr}
|
|
39
|
+
const titleStr = title === undefined ? "" : String(title);
|
|
40
|
+
const statusCodeStr = statusCode === undefined ? "" : String(statusCode);
|
|
41
|
+
const statusMessageStr = statusMessage === undefined ? "" : String(statusMessage);
|
|
42
|
+
const methodStr = method === undefined ? "" : String(method);
|
|
43
|
+
const urlStr = url === undefined ? "" : String(url);
|
|
44
|
+
return (`HTTPError: ${titleStr}, statusCode:${statusCodeStr}, ` +
|
|
45
|
+
`statusMessage:${statusMessageStr}, method:${methodStr}, url:${urlStr}`);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Returns a string representing the HTTPError object
|
|
49
49
|
* @returns a string representing the HTTPError object
|
|
50
50
|
*/
|
|
51
51
|
toString() {
|
|
52
|
-
const stack =
|
|
52
|
+
const stack = this.stack === undefined ? "" : String(this.stack);
|
|
53
53
|
const isFirefox = typeof window !== "undefined" &&
|
|
54
54
|
typeof window.navigator !== "undefined" &&
|
|
55
55
|
typeof window.navigator.userAgent !== "undefined" &&
|