@fluid-experimental/property-common 0.59.2001 → 0.59.3000
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 +1 -0
- package/dist/chronometer.d.ts.map +1 -1
- package/dist/chronometer.js.map +1 -1
- package/dist/datastructures/collection.d.ts.map +1 -1
- package/dist/datastructures/collection.js.map +1 -1
- package/dist/deferredPromise.js +1 -0
- package/dist/deferredPromise.js.map +1 -1
- package/dist/deterministicRandomGenerator.js +1 -1
- package/dist/deterministicRandomGenerator.js.map +1 -1
- package/dist/error_objects/flaggedError.js.map +1 -1
- package/dist/guidUtils.js +1 -1
- package/dist/guidUtils.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/datastructures/collection.d.ts.map +1 -1
- package/lib/datastructures/collection.js.map +1 -1
- package/lib/deferredPromise.js +1 -0
- package/lib/deferredPromise.js.map +1 -1
- package/lib/error_objects/flaggedError.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 +4 -4
- package/platform-dependent/package.json +1 -1
- package/src/chronometer.ts +1 -1
- package/src/datastructures/collection.ts +4 -4
- package/src/error_objects/flaggedError.ts +1 -1
- package/src/packageVersion.ts +1 -1
package/.eslintrc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chronometer.d.ts","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkIH;;GAEG;AAEH,qBAAa,WAAW;;IAKpB;;OAEG;IACH,KAAK;IAIL;;;;;OAKG;IACH,IAAI,IAAI,WAAW;IAKnB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;;OAOG;WACU,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"chronometer.d.ts","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkIH;;GAEG;AAEH,qBAAa,WAAW;;IAKpB;;OAEG;IACH,KAAK;IAIL;;;;;OAKG;IACH,IAAI,IAAI,WAAW;IAKnB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;;OAOG;WACU,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC;KAAE,CAAC;CAMzG"}
|
package/dist/chronometer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chronometer.js","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;GAEG;AACH,MAAM,eAAe,GAAG;IACpB,kCAAkC;IAClC,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,SAA8B;QACzC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC;QAEf,MAAM;YACF,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QACvC,CAAC;QACD,KAAK;YACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrD,CAAC;QACD,WAA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jC,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACJ;AAnED,kCAmEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview A chronometer implementation backed by a high resolution timer. Implementation\n * falls back to milliseconds precision when high resolution timers are not supported.\n */\n\ndeclare let process: any;\n\n/**\n * All the chronometer implementations (hrtime, window.performance, and date:\n */\nconst implementations = {\n // Node implementation uses hrtime\n node: {\n name: \"hrtime\",\n _startTime: 0,\n _stopTime: undefined as any[] | undefined,\n stop: () => { },\n\n _start() {\n this._startTime = process.hrtime();\n },\n _stop() {\n this._stopTime = process.hrtime(this._startTime);\n },\n _elapsedSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return (this._stopTime![0] as number) + (this._stopTime![1] as number) / 1000000000;\n },\n _elapsedMilliSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000 + this._stopTime![1] / 1000000;\n },\n _elapsedMicroSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000000 + this._stopTime![1] / 1000;\n },\n },\n // Browser implementation uses window.performance (if available):\n performance: {\n name: \"window.performance\",\n _startTime: 0,\n _stopTime: 0,\n\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = window.performance.now();\n },\n _stop() {\n this._stopTime = window.performance.now();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this._stopTime - this._startTime;\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n // Fallback is Date implementation if none of the above is supported:\n date: {\n name: \"date\",\n _startTime: new Date(),\n _stopTime: undefined as Date | undefined,\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = new Date();\n },\n _stop() {\n this._stopTime = new Date();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return (this._stopTime as Date).getTime() - this._startTime.getTime();\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n};\n\nlet impl: typeof implementations.date | typeof implementations.node | typeof implementations.performance;\nif (typeof process !== \"undefined\" && typeof process.hrtime !== \"undefined\") {\n impl = implementations.node;\n} else if (\n typeof window !== \"undefined\" &&\n typeof window.performance !== \"undefined\" &&\n typeof window.performance.now !== \"undefined\"\n) {\n impl = implementations.performance;\n} else {\n impl = implementations.date;\n}\n\n/**\n * Creates and starts a new Chronometer.\n */\n\nexport class Chronometer {\n constructor() {\n this.start();\n }\n\n /**\n * Sets the chronometer start time.\n */\n start() {\n return impl._start.call(this);\n }\n\n /**\n * Stops the chronometer. Stopped chronometers can be reused by calling {@link Chronometer.start} again.\n *\n * @returns The chronometer instance, so that callers can do this:\n * let elapsedMS = chrono.stop().elapsedMS();\n */\n stop(): Chronometer {\n impl._stop.call(this);\n return this;\n }\n\n /**\n * @returns How many microseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Implementations that are not precise\n * enough may return \"elapsedMilliSec() * 1000\". Measuring elapsed time causes the chronometer\n * to be stopped if required (if the chrono is not stopped when this method is called).\n */\n elapsedMicroSec(): number {\n return impl._elapsedMicroSec.call(this);\n }\n\n /**\n * @returns How many milliseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedMilliSec(): number {\n return impl._elapsedMilliSec.call(this);\n }\n\n /**\n * @returns How many seconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedSec(): number {\n return impl._elapsedSec.call(this);\n }\n\n /**\n * A utility function to measure promise execution time.\n * @param promiseFn - A function that returns a promise whose execution time is to be\n * measured.\n * @returns A Promise that resolves with an object with properties:\n * - chrono A stopped chronometer instance from which to get the elapsed time,\n * - result The resolved result of the promise returned by promiseFn\n */\n static async timePromise<T>(promiseFn: () => Promise<T>): Promise<{ chrono: Chronometer, result: T }> {\n const chrono = new Chronometer();\n const result = await promiseFn();\n chrono.stop();\n return { chrono, result };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chronometer.js","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;GAEG;AACH,MAAM,eAAe,GAAG;IACpB,kCAAkC;IAClC,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,SAA8B;QACzC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC;QAEf,MAAM;YACF,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QACvC,CAAC;QACD,KAAK;YACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrD,CAAC;QACD,WAAW;YACP,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;gBAC9B,IAAI,CAAC,IAAI,EAAE,CAAC;aACf;YACD,oEAAoE;YACpE,OAAQ,IAAI,CAAC,SAAU,CAAC,CAAC,CAAY,GAAI,IAAI,CAAC,SAAU,CAAC,CA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AI,CAAC;CAC/B;KAAM,IACH,OAAO,MAAM,KAAK,WAAW;IAC7B,OAAO,MAAM,CAAC,WAAW,KAAK,WAAW;IACzC,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,WAAW,EAC/C;IACE,IAAI,GAAG,eAAe,CAAC,WAAW,CAAC;CACtC;KAAM;IACH,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;CAC/B;AAED;;GAEG;AAEH,MAAa,WAAW;IACpB;QACI,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,KAAK;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACH,IAAI;QACA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,eAAe;QACX,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,eAAe;QACX,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,UAAU;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,SAA2B;QACnD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACJ;AAnED,kCAmEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview A chronometer implementation backed by a high resolution timer. Implementation\n * falls back to milliseconds precision when high resolution timers are not supported.\n */\n\ndeclare let process: any;\n\n/**\n * All the chronometer implementations (hrtime, window.performance, and date:\n */\nconst implementations = {\n // Node implementation uses hrtime\n node: {\n name: \"hrtime\",\n _startTime: 0,\n _stopTime: undefined as any[] | undefined,\n stop: () => { },\n\n _start() {\n this._startTime = process.hrtime();\n },\n _stop() {\n this._stopTime = process.hrtime(this._startTime);\n },\n _elapsedSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return (this._stopTime![0] as number) + (this._stopTime![1] as number) / 1000000000;\n },\n _elapsedMilliSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000 + this._stopTime![1] / 1000000;\n },\n _elapsedMicroSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000000 + this._stopTime![1] / 1000;\n },\n },\n // Browser implementation uses window.performance (if available):\n performance: {\n name: \"window.performance\",\n _startTime: 0,\n _stopTime: 0,\n\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = window.performance.now();\n },\n _stop() {\n this._stopTime = window.performance.now();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this._stopTime - this._startTime;\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n // Fallback is Date implementation if none of the above is supported:\n date: {\n name: \"date\",\n _startTime: new Date(),\n _stopTime: undefined as Date | undefined,\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = new Date();\n },\n _stop() {\n this._stopTime = new Date();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return (this._stopTime as Date).getTime() - this._startTime.getTime();\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n};\n\nlet impl: typeof implementations.date | typeof implementations.node | typeof implementations.performance;\nif (typeof process !== \"undefined\" && typeof process.hrtime !== \"undefined\") {\n impl = implementations.node;\n} else if (\n typeof window !== \"undefined\" &&\n typeof window.performance !== \"undefined\" &&\n typeof window.performance.now !== \"undefined\"\n) {\n impl = implementations.performance;\n} else {\n impl = implementations.date;\n}\n\n/**\n * Creates and starts a new Chronometer.\n */\n\nexport class Chronometer {\n constructor() {\n this.start();\n }\n\n /**\n * Sets the chronometer start time.\n */\n start() {\n return impl._start.call(this);\n }\n\n /**\n * Stops the chronometer. Stopped chronometers can be reused by calling {@link Chronometer.start} again.\n *\n * @returns The chronometer instance, so that callers can do this:\n * let elapsedMS = chrono.stop().elapsedMS();\n */\n stop(): Chronometer {\n impl._stop.call(this);\n return this;\n }\n\n /**\n * @returns How many microseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Implementations that are not precise\n * enough may return \"elapsedMilliSec() * 1000\". Measuring elapsed time causes the chronometer\n * to be stopped if required (if the chrono is not stopped when this method is called).\n */\n elapsedMicroSec(): number {\n return impl._elapsedMicroSec.call(this);\n }\n\n /**\n * @returns How many milliseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedMilliSec(): number {\n return impl._elapsedMilliSec.call(this);\n }\n\n /**\n * @returns How many seconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedSec(): number {\n return impl._elapsedSec.call(this);\n }\n\n /**\n * A utility function to measure promise execution time.\n * @param promiseFn - A function that returns a promise whose execution time is to be\n * measured.\n * @returns A Promise that resolves with an object with properties:\n * - chrono A stopped chronometer instance from which to get the elapsed time,\n * - result The resolved result of the promise returned by promiseFn\n */\n static async timePromise<T>(promiseFn: () => Promise<T>): Promise<{ chrono: Chronometer; result: T; }> {\n const chrono = new Chronometer();\n const result = await promiseFn();\n chrono.stop();\n return { chrono, result };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":"AAmBA,qBAAa,UAAU,CAAC,CAAC;IAUT,SAAS,CAAC,KAAK;IAA0B,SAAS,CAAC,KAAK,CAAC,aAAY,GAAG;IATpF,SAAS,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":"AAmBA,qBAAa,UAAU,CAAC,CAAC;IAUT,SAAS,CAAC,KAAK;IAA0B,SAAS,CAAC,KAAK,CAAC,aAAY,GAAG;IATpF,SAAS,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;KAAE,CAAM;IAC7C,SAAS,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAM;IAE3C;;;;;OAKG;gBACmB,KAAK,SAAwB,EAAY,KAAK,CAAC,aAAY,GAAG,aAAA;IAIpF,KAAK,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA;IACtB,QAAQ,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA;IACzB,OAAO,CAAC,QAAQ,KAAA;IAEhB,IAAW,KA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P,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;CACJ;AAjaD,gCAiaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n TYPE_MISMATCH: \"Type does not match this collection type\",\n KEY_ALREADY_EXISTS: \"Collection key already exists. \",\n KEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n MUST_GIVE_KEY: \"Collection missing key.\",\n MUST_GIVE_VALUE: \"Collection missing value.\",\n KEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n protected _items: { [key: string]: T } = {};\n protected _order: (string | number)[] = [];\n\n /**\n * @param _name - a friendly name to describe this collection. If undefined\n * the collection will have a default \"Untitled Collection\" assigned to its name.\n * @param _type - optional parameter pointing to the constructor\n * of a type this Collection will host.\n */\n constructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {\n }\n\n // Pass-thru binding handles\n onAdd(in_key, in_value) { }\n onRemove(in_key, in_value) { }\n onClear(in_items) { }\n\n public get items() {\n return this._items;\n }\n\n public get keys() {\n return Object.keys(this._items);\n }\n\n /**\n * @param in_key - Key to store the value under\n * @param in_value - Value to store in the collection\n * @returns Return the value passed in\n */\n add(in_key: number | string, in_value: T): T {\n this._checkType(in_value);\n this._checkIsNewKey(in_key);\n\n this._items[in_key] = in_value;\n this._order.push(in_key);\n\n this.onAdd(in_key, in_value);\n\n return in_value;\n }\n\n /**\n * Checks if in_value's type is equal to this Collection type. If this collection\n * has no type set, the check will pass.\n *\n * @param in_value - A value that is equal to the type managed by this collection.\n * @returns Return true if the type is a valid type for this\n * collection, throw otherwise.\n */\n private _checkType(in_value: T) {\n if (this._type && !(in_value instanceof this._type)) {\n throw new Error(MSGS.TYPE_MISMATCH);\n } else {\n return true;\n }\n }\n\n /**\n * Bulk add items.\n * @param in_items - List of key-value pairs to be stored in the collection\n * @returns this collection after add\n */\n bulkAdd(in_items: { [key: string]: T }) {\n _.each(in_items, (item, key) => {\n this.add(key, item);\n });\n return this;\n }\n\n /**\n * Bulk remove items.\n * @param in_items - List of key-value items to be removed\n * @returns this collection after add\n */\n bulkRemove(in_items: { [key: string]: T }) {\n _.each(in_items, (item, key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Test if this collection is empty\n * @returns true if empty, false otherwise\n * */\n isEmpty() {\n return _.isEmpty(this._items);\n }\n\n /**\n * Return the first item in the collection, null if empty\n * @returns first item, or undefined if empty\n * */\n getFirstItem(): T | undefined {\n const index = _.first(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * Return the last item in the collection, null if empty\n * @returns - last item, or undefined if empty\n * */\n getLastItem(): T | undefined {\n const index = _.last(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * @returns Returns the type of collection (Array, etc.)\n */\n getType() {\n return this._type;\n }\n\n /**\n * @returns Returns the name of the collection\n */\n getName(): string {\n return this._name;\n }\n\n /**\n * Filter out by function\n * @param in_filterFunction - with arguments key and item\n * @returns New filtered collection\n */\n filter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n const keeper = in_filterFunction(in_key, in_item);\n if (keeper) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterKey\n * @param in_filterKey - a single key or an array of keys, if the\n * item matches any of the keys it will be filtered in.\n * @returns New filtered collection with all the items\n * matching at least one key.\n */\n filterByKey(in_filterKey: string | string[]): Collection<T> {\n const rtn = new Collection<T>();\n\n let filterCb;\n\n if (_.isArray(in_filterKey)) {\n filterCb = function(in_key, in_item) {\n if (in_filterKey.indexOf(in_key) >= 0) {\n rtn.add(in_key, in_item);\n }\n };\n } else {\n // if in_filterKey is an array\n filterCb = function(in_key, in_item) {\n if (in_key === in_filterKey) {\n rtn.add(in_key, in_item);\n }\n };\n }\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterValue\n * @param in_filterValue - Value to filter on\n * @returns Return a filtered collection\n */\n filterByValue(in_filterValue: T): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n if (in_item === in_filterValue) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Remove an item from this Collection. This method returns a Boolean indicating\n * the success or failure of the removal. This is practical because if we were\n * to throw an error when the key doesn't exist, it would require additional\n * checks by the caller to make sure this key exists prior to removal. Which\n * would make the attempt of removal more verbose and also costly because the\n * caller would have to keep a list – somewhere else – of the things he can\n * and cannot remove.\n *\n * @param in_key - the key we wish to remove\n * @returns true if the key exists and was removed, false otherwise.\n */\n remove(in_key: number | string): boolean {\n if (!this.has(in_key)) {\n return false;\n }\n\n const remember = this._items[in_key];\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._items[in_key];\n this._order.splice(this._order.indexOf(in_key), 1);\n\n this.onRemove(in_key, remember);\n\n return true;\n }\n\n /**\n * Return the number of items in this Collection\n * @returns the number of items in the collection\n */\n getCount(): number {\n return this._order.length;\n }\n\n /**\n * Returns this collection as an ordered Array\n * @returns Array including the values\n */\n getAsArray() {\n const rtnArr: T[] = new Array(this.getCount());\n\n for (let i = 0; i < this._order.length; i++) {\n rtnArr[i] = this._items[this._order[i]];\n }\n\n return rtnArr;\n }\n\n /**\n * @param in_key - the key we are looking for\n * @returns true if the item exists\n */\n has(in_key: string | number): boolean {\n return Object.prototype.hasOwnProperty.call(this._items, in_key);\n }\n\n /**\n * Return an item associated with the given key\n * @param in_key - the key for the item in this\n * Collection\n * @returns The item\n */\n item(in_key: number | string) {\n return this._items[in_key];\n }\n\n /**\n * Checks if this is a new key in the collection. Throw if already exists.\n * @param in_key - The key to check against\n * @returns true if key is new\n */\n private _checkIsNewKey(in_key: number | string) {\n if (this.has(in_key)) {\n throw new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Checks if the key exists in the collection. Throw if not.\n * @param in_key - the key to check against\n * @returns true if key exists\n */\n private _checkKeyExists(in_key: number | string) {\n if (!this.has(in_key)) {\n throw new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Set an existing key to a value. If key doesn't exist this call will throw\n * an error.\n * @param in_key - the key we want to modify\n * @param in_value - the value we are to set at this key\n * @returns the value passed in\n */\n set(in_key: string, in_value: T) {\n this._checkKeyExists(in_key);\n\n this._items[in_key] = in_value;\n\n return in_value;\n }\n\n /**\n * Iterate over this collection and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterate(in_callback) {\n for (const key of this._order) {\n const continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * Iterate over this collection starting from the tail and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterateFromTail(in_callback) {\n let key; let continu;\n for (let i = this._order.length - 1; i >= 0; i--) {\n key = this._order[i];\n continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * @returns Return an object containing the items of this collection\n */\n getItems(): { [key: string]: T } {\n const result = {};\n\n _.each(this._items, function(item, key) {\n result[key] = item;\n });\n\n return result;\n }\n\n /**\n * Return the list of keys\n * @returns List of keys\n */\n getKeys(): string[] {\n return Object.keys(this._items);\n }\n\n /**\n * Method used to get the first element in the collection along with its key.\n */\n peak() {\n return {\n item: this._items[this._order[0]],\n key: this._order[0],\n };\n }\n\n /**\n * Clear this collection\n * @returns this collection\n */\n clear() {\n if (_.isEmpty(this._items)) {\n return this;\n }\n\n this.onClear(this._items);\n\n // Best to just iterate through and remove everything, so that OnRemove\n // handlers are called.\n\n _.each(this.getKeys(), (key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n * @returns new Collection\n */\n clone(): Collection<T> {\n const newCol = new Collection<T>(this._name, this._type);\n newCol.bulkAdd(this._items);\n return newCol;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n */\n copy(in_collection: Collection<T>) {\n this.clear();\n const its = in_collection.items;\n\n _.each(its, (item, key) => {\n this.add(key, item);\n });\n }\n\n get values() {\n return this.getAsArray();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,4DAA4D;AAC5D;;GAEG;AACH,oDAAuB;AAEvB,MAAM,IAAI,GAAG;IACT,aAAa,EAAE,0CAA0C;IACzD,kBAAkB,EAAE,iCAAiC;IACrD,kBAAkB,EAAE,mDAAmD;IACvE,aAAa,EAAE,yBAAyB;IACxC,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,sCAAsC;CACxD,CAAC;AAEF,MAAa,UAAU;IAInB;;;;;OAKG;IACH,YAAsB,QAAQ,qBAAqB,EAAY,KAAqB;QAA9D,UAAK,GAAL,KAAK,CAAwB;QAAY,UAAK,GAAL,KAAK,CAAgB;QAT1E,WAAM,GAA0B,EAAE,CAAC;QACnC,WAAM,GAAwB,EAAE,CAAC;IAS3C,CAAC;IAED,4BAA4B;IAC5B,KAAK,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC;IAC9B,OAAO,CAAC,QAAQ,IAAI,CAAC;IAErB,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,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AiaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n TYPE_MISMATCH: \"Type does not match this collection type\",\n KEY_ALREADY_EXISTS: \"Collection key already exists. \",\n KEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n MUST_GIVE_KEY: \"Collection missing key.\",\n MUST_GIVE_VALUE: \"Collection missing value.\",\n KEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n protected _items: { [key: string]: T; } = {};\n protected _order: (string | number)[] = [];\n\n /**\n * @param _name - a friendly name to describe this collection. If undefined\n * the collection will have a default \"Untitled Collection\" assigned to its name.\n * @param _type - optional parameter pointing to the constructor\n * of a type this Collection will host.\n */\n constructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {\n }\n\n // Pass-thru binding handles\n onAdd(in_key, in_value) { }\n onRemove(in_key, in_value) { }\n onClear(in_items) { }\n\n public get items() {\n return this._items;\n }\n\n public get keys() {\n return Object.keys(this._items);\n }\n\n /**\n * @param in_key - Key to store the value under\n * @param in_value - Value to store in the collection\n * @returns Return the value passed in\n */\n add(in_key: number | string, in_value: T): T {\n this._checkType(in_value);\n this._checkIsNewKey(in_key);\n\n this._items[in_key] = in_value;\n this._order.push(in_key);\n\n this.onAdd(in_key, in_value);\n\n return in_value;\n }\n\n /**\n * Checks if in_value's type is equal to this Collection type. If this collection\n * has no type set, the check will pass.\n *\n * @param in_value - A value that is equal to the type managed by this collection.\n * @returns Return true if the type is a valid type for this\n * collection, throw otherwise.\n */\n private _checkType(in_value: T) {\n if (this._type && !(in_value instanceof this._type)) {\n throw new Error(MSGS.TYPE_MISMATCH);\n } else {\n return true;\n }\n }\n\n /**\n * Bulk add items.\n * @param in_items - List of key-value pairs to be stored in the collection\n * @returns this collection after add\n */\n bulkAdd(in_items: { [key: string]: T; }) {\n _.each(in_items, (item, key) => {\n this.add(key, item);\n });\n return this;\n }\n\n /**\n * Bulk remove items.\n * @param in_items - List of key-value items to be removed\n * @returns this collection after add\n */\n bulkRemove(in_items: { [key: string]: T; }) {\n _.each(in_items, (item, key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Test if this collection is empty\n * @returns true if empty, false otherwise\n * */\n isEmpty() {\n return _.isEmpty(this._items);\n }\n\n /**\n * Return the first item in the collection, null if empty\n * @returns first item, or undefined if empty\n * */\n getFirstItem(): T | undefined {\n const index = _.first(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * Return the last item in the collection, null if empty\n * @returns - last item, or undefined if empty\n * */\n getLastItem(): T | undefined {\n const index = _.last(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * @returns Returns the type of collection (Array, etc.)\n */\n getType() {\n return this._type;\n }\n\n /**\n * @returns Returns the name of the collection\n */\n getName(): string {\n return this._name;\n }\n\n /**\n * Filter out by function\n * @param in_filterFunction - with arguments key and item\n * @returns New filtered collection\n */\n filter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n const keeper = in_filterFunction(in_key, in_item);\n if (keeper) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterKey\n * @param in_filterKey - a single key or an array of keys, if the\n * item matches any of the keys it will be filtered in.\n * @returns New filtered collection with all the items\n * matching at least one key.\n */\n filterByKey(in_filterKey: string | string[]): Collection<T> {\n const rtn = new Collection<T>();\n\n let filterCb;\n\n if (_.isArray(in_filterKey)) {\n filterCb = function(in_key, in_item) {\n if (in_filterKey.indexOf(in_key) >= 0) {\n rtn.add(in_key, in_item);\n }\n };\n } else {\n // if in_filterKey is an array\n filterCb = function(in_key, in_item) {\n if (in_key === in_filterKey) {\n rtn.add(in_key, in_item);\n }\n };\n }\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterValue\n * @param in_filterValue - Value to filter on\n * @returns Return a filtered collection\n */\n filterByValue(in_filterValue: T): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n if (in_item === in_filterValue) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Remove an item from this Collection. This method returns a Boolean indicating\n * the success or failure of the removal. This is practical because if we were\n * to throw an error when the key doesn't exist, it would require additional\n * checks by the caller to make sure this key exists prior to removal. Which\n * would make the attempt of removal more verbose and also costly because the\n * caller would have to keep a list – somewhere else – of the things he can\n * and cannot remove.\n *\n * @param in_key - the key we wish to remove\n * @returns true if the key exists and was removed, false otherwise.\n */\n remove(in_key: number | string): boolean {\n if (!this.has(in_key)) {\n return false;\n }\n\n const remember = this._items[in_key];\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._items[in_key];\n this._order.splice(this._order.indexOf(in_key), 1);\n\n this.onRemove(in_key, remember);\n\n return true;\n }\n\n /**\n * Return the number of items in this Collection\n * @returns the number of items in the collection\n */\n getCount(): number {\n return this._order.length;\n }\n\n /**\n * Returns this collection as an ordered Array\n * @returns Array including the values\n */\n getAsArray() {\n const rtnArr: T[] = new Array(this.getCount());\n\n for (let i = 0; i < this._order.length; i++) {\n rtnArr[i] = this._items[this._order[i]];\n }\n\n return rtnArr;\n }\n\n /**\n * @param in_key - the key we are looking for\n * @returns true if the item exists\n */\n has(in_key: string | number): boolean {\n return Object.prototype.hasOwnProperty.call(this._items, in_key);\n }\n\n /**\n * Return an item associated with the given key\n * @param in_key - the key for the item in this\n * Collection\n * @returns The item\n */\n item(in_key: number | string) {\n return this._items[in_key];\n }\n\n /**\n * Checks if this is a new key in the collection. Throw if already exists.\n * @param in_key - The key to check against\n * @returns true if key is new\n */\n private _checkIsNewKey(in_key: number | string) {\n if (this.has(in_key)) {\n throw new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Checks if the key exists in the collection. Throw if not.\n * @param in_key - the key to check against\n * @returns true if key exists\n */\n private _checkKeyExists(in_key: number | string) {\n if (!this.has(in_key)) {\n throw new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Set an existing key to a value. If key doesn't exist this call will throw\n * an error.\n * @param in_key - the key we want to modify\n * @param in_value - the value we are to set at this key\n * @returns the value passed in\n */\n set(in_key: string, in_value: T) {\n this._checkKeyExists(in_key);\n\n this._items[in_key] = in_value;\n\n return in_value;\n }\n\n /**\n * Iterate over this collection and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterate(in_callback) {\n for (const key of this._order) {\n const continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * Iterate over this collection starting from the tail and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterateFromTail(in_callback) {\n let key; let continu;\n for (let i = this._order.length - 1; i >= 0; i--) {\n key = this._order[i];\n continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * @returns Return an object containing the items of this collection\n */\n getItems(): { [key: string]: T; } {\n const result = {};\n\n _.each(this._items, function(item, key) {\n result[key] = item;\n });\n\n return result;\n }\n\n /**\n * Return the list of keys\n * @returns List of keys\n */\n getKeys(): string[] {\n return Object.keys(this._items);\n }\n\n /**\n * Method used to get the first element in the collection along with its key.\n */\n peak() {\n return {\n item: this._items[this._order[0]],\n key: this._order[0],\n };\n }\n\n /**\n * Clear this collection\n * @returns this collection\n */\n clear() {\n if (_.isEmpty(this._items)) {\n return this;\n }\n\n this.onClear(this._items);\n\n // Best to just iterate through and remove everything, so that OnRemove\n // handlers are called.\n\n _.each(this.getKeys(), (key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n * @returns new Collection\n */\n clone(): Collection<T> {\n const newCol = new Collection<T>(this._name, this._type);\n newCol.bulkAdd(this._items);\n return newCol;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n */\n copy(in_collection: Collection<T>) {\n this.clear();\n const its = in_collection.items;\n\n _.each(its, (item, key) => {\n this.add(key, item);\n });\n }\n\n get values() {\n return this.getAsArray();\n }\n}\n"]}
|
package/dist/deferredPromise.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;GAKG;AACH,MAAa,eAAe;IAKxB;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAGM,KAAK,CAAC,OAAO,CAAC,SAAsB;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACrB,yEAAyE;YACzE,IAAI,KAAK,EAAE;gBACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC7B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,WACwD,EACxD,UACwD;QAExD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,KAAK,CACd,UACsD;QAEtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEM,OAAO,CAAC,GAAM,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAW,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC3D;AAjDD,0CAiDC","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 private _resolveSelf;\n private _rejectSelf;\n private readonly promise: Promise<T>;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolveSelf = resolve;\n this._rejectSelf = reject;\n });\n }\n [Symbol.toStringTag]: string;\n\n public async finally(onfinally?: () => void): Promise<T> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Fetches a node style callback that fulfills the promise when called.\n * @returns A node style callback that fulfills the promise when called.\n */\n getCb() {\n return (error, result) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (error) {\n return this.reject(error);\n }\n return this.resolve(result);\n };\n }\n\n public async then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) =>\n TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: any) =>\n TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): Promise<TResult1 | TResult2> {\n return this.promise.then(onfulfilled, onrejected);\n }\n\n public async catch<TResult = never>(\n onrejected?: ((reason: any) =>\n TResult | PromiseLike<TResult>) | undefined | null,\n ): Promise<T | TResult> {\n return this.promise.then(onrejected);\n }\n\n public resolve(val: T) { this._resolveSelf(val); }\n public reject(reason: any) { this._rejectSelf(reason); }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;GAKG;AACH,MAAa,eAAe;IAKxB;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAGM,KAAK,CAAC,OAAO,CAAC,SAAsB;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACrB,yEAAyE;YACzE,IAAI,KAAK,EAAE;gBACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC7B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,WACwD,EACxD,UACwD;QAExD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,KAAK,CACd,UACsD;QAEtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEM,OAAO,CAAC,GAAM,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAW,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC3D;AAjDD,0CAiDC;AAtCI,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 private _resolveSelf;\n private _rejectSelf;\n private readonly promise: Promise<T>;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolveSelf = resolve;\n this._rejectSelf = reject;\n });\n }\n [Symbol.toStringTag]: string;\n\n public async finally(onfinally?: () => void): Promise<T> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Fetches a node style callback that fulfills the promise when called.\n * @returns A node style callback that fulfills the promise when called.\n */\n getCb() {\n return (error, result) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (error) {\n return this.reject(error);\n }\n return this.resolve(result);\n };\n }\n\n public async then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) =>\n TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: any) =>\n TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): Promise<TResult1 | TResult2> {\n return this.promise.then(onfulfilled, onrejected);\n }\n\n public async catch<TResult = never>(\n onrejected?: ((reason: any) =>\n TResult | PromiseLike<TResult>) | undefined | null,\n ): Promise<T | TResult> {\n return this.promise.then(onrejected);\n }\n\n public resolve(val: T) { this._resolveSelf(val); }\n public reject(reason: any) { this._rejectSelf(reason); }\n}\n"]}
|
|
@@ -34,7 +34,7 @@ class DeterministicRandomGenerator {
|
|
|
34
34
|
this._guid1 = guidUtils_1.GuidUtils.guidToUint32x4(in_seed);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
this._guid1 = guidUtils_1.GuidUtils.guidToUint32x4(hashCalculator_1.calculateHash(String(in_seed)));
|
|
37
|
+
this._guid1 = guidUtils_1.GuidUtils.guidToUint32x4((0, hashCalculator_1.calculateHash)(String(in_seed)));
|
|
38
38
|
}
|
|
39
39
|
this._guid2 = new Uint32Array(4);
|
|
40
40
|
this._guid2[0] = (this._guid1[0] + 1) >>> 0;
|
|
@@ -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;IAKrC;;;;OAIG;IACH,YAAY,OAAwB;QAChC,4DAA4D;QAC5D,IAAI,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YACrB,IAAI,CAAC,MAAM,GAAG,qBAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;SACnD;aAAM;YACH,IAAI,CAAC,MAAM,GAAG,qBAAS,CAAC,cAAc,CAAC,8BAAa,
|
|
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;IAKrC;;;;OAIG;IACH,YAAY,OAAwB;QAChC,4DAA4D;QAC5D,IAAI,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YACrB,IAAI,CAAC,MAAM,GAAG,qBAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;SACnD;aAAM;YACH,IAAI,CAAC,MAAM,GAAG,qBAAS,CAAC,cAAc,CAAC,IAAA,8BAAa,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC1E;QACD,IAAI,CAAC,MAAM,G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AC,CAAC;SACpC;QAED,IAAI,MAAM,KAAK,SAAS,EAAE;YACtB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACzB;aAAM;YACH,IAAI,MAAM,GAAG,QAAQ,EAAE;gBACnB,qDAAqD;gBACrD,+DAA+D;gBAC/D,wEAAwE;gBACxE,+CAA+C;gBAC/C,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,MAAM,CAAC;aACjD;iBAAM;gBACH,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;aAClC;SACJ;IACL,CAAC;CACJ;AArED,oEAqEC","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 * Warning: This is a very straight forward implementation based on the hashCombine4xUint32 function. It probably\n * 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 _guid1: Uint32Array;\n _guid2: Uint32Array;\n _result: Uint32Array;\n\n /**\n * @param in_seed - The initial seed (it can be either a GUID or a number)\n * which is used to initialize the random number generator\n *\n */\n constructor(in_seed: string | number) {\n // Initialize the internal state from the given initial guid\n if (_.isString(in_seed)) {\n this._guid1 = GuidUtils.guidToUint32x4(in_seed);\n } else {\n this._guid1 = GuidUtils.guidToUint32x4(calculateHash(String(in_seed)));\n }\n this._guid2 = new Uint32Array(4);\n this._guid2[0] = (this._guid1[0] + 1) >>> 0;\n this._guid2[1] = (this._guid1[1] + 1) >>> 0;\n this._guid2[2] = (this._guid1[2] + 1) >>> 0;\n this._guid2[3] = (this._guid1[3] + 1) >>> 0;\n\n this._result = new Uint32Array(4);\n }\n\n /**\n * Creates a floating point random number\n *\n * @param in_max - If supplied the returned number will be 0 \\<= number \\< in_max. If none is given\n * in_max = 1 is assumed\n * @returns The random number\n */\n random(in_max = 1.0) {\n const randomInteger = this.irandom();\n return randomInteger / 4294967296 * in_max;\n }\n\n /**\n * Creates an integer point random number\n *\n * @param in_max - If supplied the returned number will be 0 \\<= number \\< in_max. If none is given\n * in_max = 14294967296 (2^32) is assumed\n * @returns The random number\n */\n irandom(in_max?: number): number {\n // Create a new hash\n GuidUtils.hashCombine4xUint32(this._guid1, this._guid2, this._result);\n\n // Permute the hashes\n for (let i = 0; i < 4; i++) {\n this._guid1[i] = this._guid2[i];\n this._guid2[i] = this._result[i];\n }\n\n if (in_max === undefined) {\n return this._guid1[0];\n } else {\n if (in_max < 16777619) {\n // The random generator doesn't seem to be very good.\n // It is quite biased (e.g. it generates too many even numbers)\n // this is a hack to solve at least this problem, but we probably should\n // instead use a different approach alltogether\n return ((this._guid1[0]) % 16777619) % in_max;\n } else {\n return this._guid1[0] % in_max;\n }\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flaggedError.js","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;GAKG;AACF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IAChD,sCAAsC;IACtC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AACnC,CAAC,CAAC;AAEF,MAAa,YAAY;IAAzB;QAec,UAAK,GAAW,CAAC,CAAC;IAehC,CAAC;IAbG;;OAEG;IACH,OAAO;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"flaggedError.js","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;GAKG;AACF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IAChD,sCAAsC;IACtC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AACnC,CAAC,CAAC;AAEF,MAAa,YAAY;IAAzB;QAec,UAAK,GAAW,CAAC,CAAC;IAehC,CAAC;IAbG;;OAEG;IACH,OAAO;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,WAAW;QACP,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;;AA7BL,oCA8BC;AA7BG;;GAEG;AACI,kBAAK,GAAG;IACX;;OAEG;IACH,SAAS,EAAE,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,CAAC;CACX,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 */\n const _isFlagSet = (flags: number, flag: number) => {\n // eslint-disable-next-line no-bitwise\n return (flags & flag) === flag;\n};\n\nexport class FlaggedError {\n /**\n * Flags that may be set on an error instance.\n */\n static FLAGS = {\n /**\n * A transient error results from an operation that could succeed if retried.\n */\n TRANSIENT: 1,\n /**\n * A quiet error should not trigger an error log.\n */\n QUIET: 2,\n };\n\n protected flags: number = 0;\n\n /**\n * @returns True if the quiet flag is set.\n */\n isQuiet(): boolean {\n return _isFlagSet(this.flags, FlaggedError.FLAGS.QUIET);\n }\n\n /**\n * @returns True if the transient flag is set.\n */\n isTransient(): boolean {\n return _isFlagSet(this.flags, FlaggedError.FLAGS.TRANSIENT);\n }\n}\n"]}
|
package/dist/guidUtils.js
CHANGED
|
@@ -52,7 +52,7 @@ const guidRNG = {
|
|
|
52
52
|
else {
|
|
53
53
|
this.isInitialized = true;
|
|
54
54
|
if (in_seed === undefined) {
|
|
55
|
-
const randomValues = platform_dependent_1.generateRandomUInt32Array(4);
|
|
55
|
+
const randomValues = (0, platform_dependent_1.generateRandomUInt32Array)(4);
|
|
56
56
|
this.u = randomValues[0];
|
|
57
57
|
this.v = randomValues[1];
|
|
58
58
|
this.w1 = randomValues[2];
|
package/dist/guidUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guidUtils.js","sourceRoot":"","sources":["../src/guidUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+BAA+B;AAE/B;;GAEG;AAEH,0DAAiC;AACjC,8DAAkE;AAClE,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG;IACZ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,aAAa,EAAE,KAAK;IAEpB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,OAAgB,EAAE,6BAAsC,KAAK;QACpE,6DAA6D;QAC7D,sDAAsD;QACtD,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,0BAA0B,EAAE;YACnD,OAAO,CAAC,CAAC;SACZ;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAE1B,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,MAAM,YAAY,GAAG,8CAAyB,CAAC,CAAC,CAAC,CAAC;gBAClD,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC1B,IA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,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7E,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7E,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE7E,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,YAAY,GAAG,UAAS,QAAgB,EAAE,QAAgB,EAAE,MAAM,GAAG,KAAK;IAC5E,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC9D,OAAO,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,mCAAmC;AACnC,OAAO,CAAC,UAAU,EAAE,CAAC;AAErB,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjE,QAAA,SAAS,GAAG;IACrB,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,uBAAuB;IACvB,YAAY;IACZ,MAAM;IACN,YAAY;IACZ,mBAAmB;CACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\n/**\n * @fileoverview Utility functions related to handling GUIDs\n */\n\nimport base64js from \"base64-js\";\nimport { generateRandomUInt32Array } from \"../platform-dependent\";\nconst UINT_32HASH_PRIME = 16777619;\n\n/**\n * Fast high quality 32 bit RNG for consistent guid.\n *\n * Good \"randomness\" (distribution); Period is approximately equal to 3.11*10^37\n * Implementation was take from \"Numerical recipes. The Art of Scientific Computing.\", 3rd edition.\n * Page 357, algorithm name: Ranlim32\n *\n */\nconst guidRNG = {\n u: 0,\n v: 0,\n w1: 0,\n w2: 0,\n isInitialized: false,\n\n /**\n * Initialize RNG.\n * This function need to be called once, before the first guid gets created.\n *\n * @param in_seed - Optional 32-bit seed for guid RNG;\n * If no seed is given, a combination of system's\n * local time and Math.random() is used.\n * @param in_enforceReInitialization - Optionally enforce re-initialization with another seed\n *\n * @returns The seed used to initialize the RNG;\n * If re-initialization is not enforced,\n * a zero indicates that the RNG was not re-seeded.\n * @alias property-common.initializeGUIDGenerator\n */\n initialize(in_seed?: number, in_enforceReInitialization: boolean = false): number {\n // Quit if the RNG has already been initialized and we do not\n // want to enforce a re-initialization with a new seed\n if (this.isInitialized && !in_enforceReInitialization) {\n return 0;\n } else {\n this.isInitialized = true;\n\n if (in_seed === undefined) {\n const randomValues = generateRandomUInt32Array(4);\n this.u = randomValues[0];\n this.v = randomValues[1];\n this.w1 = randomValues[2];\n this.w2 = randomValues[3];\n } else {\n this.v = 224461437;\n this.w1 = 521288629;\n this.w2 = 362436069;\n\n this.u = in_seed ^ this.v;\n this.genRandUInt32();\n this.v = this.u;\n this.genRandUInt32();\n }\n return -1;\n }\n },\n\n /**\n * @returns 32-bit random number based on the RNGs internal state\n */\n genRandUInt32(): number {\n this.u = multiply_uint32(this.u, 2891336453) + 1640531513;\n this.v ^= this.v >>> 13;\n this.v ^= this.v << 17;\n this.v = ((this.v >>> 5) ^ this.v) >>> 0;\n\n this.w1 = multiply_uint32(33378, (this.w1 & 0xffff)) + (this.w1 >>> 16);\n this.w2 = multiply_uint32(57225, (this.w2 & 0xffff)) + (this.w2 >>> 16);\n\n let x = this.u ^ (this.u << 9);\n x ^= x >>> 17;\n x ^= x << 6;\n\n let y = this.w1 ^ (this.w1 << 17);\n y ^= y >>> 15;\n y ^= y << 5;\n return (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;\n },\n};\n\n/**\n * Check if guid is base64 based on the length\n * The length of base16 guid is 36, base64 - 22\n *\n * @param guid - Input guid\n * @returns True if guid is base64\n */\nconst isBase64 = (guid: string): boolean => guid.length === 22;\n\n/**\n * Allows for 32-bit integer multiplication with C-like semantics\n *\n * @param a - unsigned int32 value\n * @param b - unsigned int32 value\n * @returns - result of unsigned integer multiplication\n */\nfunction multiply_uint32(a: number, b: number): number {\n let n = a;\n let m = b;\n\n n >>>= 0;\n m >>>= 0;\n const nlo = n & 0xffff;\n return (((n - nlo) * m >>> 0) + (nlo * m)) >>> 0;\n}\n\n/**\n * Helper function to convert base64 encoding to url friendly format\n *\n * @param base64 - Base64 string\n *\n * @returns Url-friendly base64 encoding.\n */\nconst toUrlBase64 = (base64: string): string => base64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").split(\"=\")[0];\n\n/**\n * Helper function to recover padding of base64 encoding\n *\n * @param x - Base64 string\n *\n * @returns Padded base64 encoding.\n */\nconst toPaddedBase64 = function(x: string): string {\n let base64 = x;\n const padLength = 4 - base64.length % 4;\n base64 += \"=\".repeat(padLength);\n return base64;\n};\n\n/**\n * Helper function to create a guid string from an array with 32Bit values\n *\n * @param in_guidArray - Array with the 32 bit values\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The guid\n */\nconst uint32x4ToGUID = function(in_guidArray: Uint32Array | Int32Array | number[], base64: boolean = false): string {\n if (base64) {\n const intArray = new Uint32Array(in_guidArray);\n const byteArray = new Uint8Array(intArray.buffer);\n const base64guid = base64js.fromByteArray(byteArray);\n // return url-friendly base64\n return toUrlBase64(base64guid);\n } else {\n // Convert to hexadecimal string\n let str = \"\";\n for (let i = 0; i < 4; i++) {\n const hex = in_guidArray[i].toString(16);\n str += (\"0\".repeat(8 - hex.length) + hex);\n }\n // eslint-disable-next-line max-len\n return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;\n }\n};\n\n/**\n * Convert guid to four 32Bit values.\n *\n * @param in_guid - The guid to convert\n * @param io_result - An optional array to write the result to;\n * If no array is given, a new one gets created\n * @returns Four 32-bit values\n *\n */\nconst guidToUint32x4 = function(in_guid: string, result: Uint32Array = new Uint32Array(4)): Uint32Array {\n if (isBase64(in_guid)) {\n const guid = toPaddedBase64(in_guid);\n const bytes = base64js.toByteArray(guid);\n const intArray = new Uint32Array(bytes.buffer);\n result.set(intArray);\n } else {\n result[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);\n result[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);\n result[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);\n result[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);\n }\n return result;\n};\n\n/**\n * Convert base64 guid into base16.\n *\n * @param in_guid - Base64 guid to convert\n * @returns Base16 guid\n *\n */\nconst base64Tobase16 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid));\n\n/**\n * Convert base16 into base64 guid.\n *\n * @param in_guid - Base16 guid to convert\n * @returns Base64 guid\n *\n */\nconst base16ToBase64 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid), true);\n\n/**\n * Based on the boolean parameter generate either\n * a 128 bit base16 guid with the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx\n * or url-friendly base64 string guid of length 22\n *\n * This function is *not* thread safe!\n *\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The guid\n */\nconst generateGUID = function(base64 = false): string {\n const rnds = new Uint32Array(4);\n\n // Random numbers for guid (4x32 bit)\n rnds[0] = guidRNG.genRandUInt32();\n rnds[1] = guidRNG.genRandUInt32();\n rnds[2] = guidRNG.genRandUInt32();\n rnds[3] = guidRNG.genRandUInt32();\n return uint32x4ToGUID(rnds, base64);\n};\n\n// The last character is checked this way because last 4 bits of 22nd character are ignored\n// by decoder, e.g. \"+Q\" and \"+Z\" result in the same decoding.\n// The only characters with last 4 bits set to 0 are A, Q, g, w.\nconst reBase64 = (/^[\\w-]{21}[AQgw]$/);\n// eslint-disable-next-line unicorn/no-unsafe-regex\nconst reBase16 = (/^[\\dA-Fa-f]{8}(?:-[\\dA-Fa-f]{4}){3}-[\\dA-Fa-f]{12}$/);\n\n/**\n * Routine used to check whether the given string is a valid guid\n *\n * @param in_guid - The guid to test.\n * @returns True if the parameter is a valid guid, false otherwise.\n */\nconst isGUID = (in_guid: string) => reBase16.test(in_guid) || reBase64.test(in_guid);\n\n/**\n * Performs a hash combination operation on the two supplied Uint32 arrays of length 4 (using\n * a variant of the algorithm from boost::hash_combine\n *\n * @param in_array1 - First array\n * @param in_array2 - Second array\n * @returns New combined hash\n */\nconst hashCombine4xUint32 = function(\n in_array1: Uint32Array,\n in_array2: Uint32Array,\n io_result?: Uint32Array,\n): Uint32Array {\n let accumulated = io_result;\n if (accumulated === undefined) {\n accumulated = new Uint32Array(in_array2);\n } else {\n accumulated[0] = in_array2[0];\n accumulated[1] = in_array2[1];\n accumulated[2] = in_array2[2];\n accumulated[3] = in_array2[3];\n }\n\n accumulated[0] += 0x9e3779b9;\n accumulated[1] += 0x638f227;\n accumulated[2] += 0x1aff2bad;\n accumulated[3] += 0x3a8f05c5;\n\n accumulated[0] += in_array1[3] << 6;\n accumulated[1] += in_array1[0] << 6;\n accumulated[2] += in_array1[1] << 6;\n accumulated[3] += in_array1[2] << 6;\n\n accumulated[0] += in_array1[2] >> 2;\n accumulated[1] += in_array1[3] >> 2;\n accumulated[2] += in_array1[0] >> 2;\n accumulated[3] += in_array1[1] >> 2;\n\n accumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;\n\n return accumulated;\n};\n\n/**\n * Takes two guids and generates a new derived guid.\n * Note: You should only use this helper function when you need only one combination.\n * Otherwise, it is more efficient to work on the uint8 arrays directly.\n *\n * @param in_guid1 - Input guid\n * @param in_guid2 - Input guid\n * @param base64 - Use base64 encoding instead of standart guids\n * @returns Combined guid\n */\nconst combineGuids = function(in_guid1: string, in_guid2: string, base64 = false): string {\n const firstArray = guidToUint32x4(in_guid1);\n const secondArray = guidToUint32x4(in_guid2);\n const combined = hashCombine4xUint32(firstArray, secondArray);\n return uint32x4ToGUID(combined, base64);\n};\n\n// Make sure the RNG is initialized\nguidRNG.initialize();\n\nconst initializeGUIDGenerator = (...args) => { guidRNG.initialize(...args); };\n\nexport const GuidUtils = {\n uint32x4ToGUID,\n guidToUint32x4,\n base64Tobase16,\n base16ToBase64,\n initializeGUIDGenerator,\n generateGUID,\n isGUID,\n combineGuids,\n hashCombine4xUint32,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"guidUtils.js","sourceRoot":"","sources":["../src/guidUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+BAA+B;AAE/B;;GAEG;AAEH,0DAAiC;AACjC,8DAAkE;AAClE,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG;IACZ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,aAAa,EAAE,KAAK;IAEpB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,OAAgB,EAAE,6BAAsC,KAAK;QACpE,6DAA6D;QAC7D,sDAAsD;QACtD,IAAI,IAAI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UAAU,EAAE,CAAC;AAErB,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjE,QAAA,SAAS,GAAG;IACrB,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,uBAAuB;IACvB,YAAY;IACZ,MAAM;IACN,YAAY;IACZ,mBAAmB;CACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\n/**\n * @fileoverview Utility functions related to handling GUIDs\n */\n\nimport base64js from \"base64-js\";\nimport { generateRandomUInt32Array } from \"../platform-dependent\";\nconst UINT_32HASH_PRIME = 16777619;\n\n/**\n * Fast high quality 32 bit RNG for consistent guid.\n *\n * Good \"randomness\" (distribution); Period is approximately equal to 3.11*10^37\n * Implementation was take from \"Numerical recipes. The Art of Scientific Computing.\", 3rd edition.\n * Page 357, algorithm name: Ranlim32\n *\n */\nconst guidRNG = {\n u: 0,\n v: 0,\n w1: 0,\n w2: 0,\n isInitialized: false,\n\n /**\n * Initialize RNG.\n * This function need to be called once, before the first guid gets created.\n *\n * @param in_seed - Optional 32-bit seed for guid RNG;\n * If no seed is given, a combination of system's\n * local time and Math.random() is used.\n * @param in_enforceReInitialization - Optionally enforce re-initialization with another seed\n *\n * @returns The seed used to initialize the RNG;\n * If re-initialization is not enforced,\n * a zero indicates that the RNG was not re-seeded.\n * @alias property-common.initializeGUIDGenerator\n */\n initialize(in_seed?: number, in_enforceReInitialization: boolean = false): number {\n // Quit if the RNG has already been initialized and we do not\n // want to enforce a re-initialization with a new seed\n if (this.isInitialized && !in_enforceReInitialization) {\n return 0;\n } else {\n this.isInitialized = true;\n\n if (in_seed === undefined) {\n const randomValues = generateRandomUInt32Array(4);\n this.u = randomValues[0];\n this.v = randomValues[1];\n this.w1 = randomValues[2];\n this.w2 = randomValues[3];\n } else {\n this.v = 224461437;\n this.w1 = 521288629;\n this.w2 = 362436069;\n\n this.u = in_seed ^ this.v;\n this.genRandUInt32();\n this.v = this.u;\n this.genRandUInt32();\n }\n return -1;\n }\n },\n\n /**\n * @returns 32-bit random number based on the RNGs internal state\n */\n genRandUInt32(): number {\n this.u = multiply_uint32(this.u, 2891336453) + 1640531513;\n this.v ^= this.v >>> 13;\n this.v ^= this.v << 17;\n this.v = ((this.v >>> 5) ^ this.v) >>> 0;\n\n this.w1 = multiply_uint32(33378, (this.w1 & 0xffff)) + (this.w1 >>> 16);\n this.w2 = multiply_uint32(57225, (this.w2 & 0xffff)) + (this.w2 >>> 16);\n\n let x = this.u ^ (this.u << 9);\n x ^= x >>> 17;\n x ^= x << 6;\n\n let y = this.w1 ^ (this.w1 << 17);\n y ^= y >>> 15;\n y ^= y << 5;\n return (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;\n },\n};\n\n/**\n * Check if guid is base64 based on the length\n * The length of base16 guid is 36, base64 - 22\n *\n * @param guid - Input guid\n * @returns True if guid is base64\n */\nconst isBase64 = (guid: string): boolean => guid.length === 22;\n\n/**\n * Allows for 32-bit integer multiplication with C-like semantics\n *\n * @param a - unsigned int32 value\n * @param b - unsigned int32 value\n * @returns - result of unsigned integer multiplication\n */\nfunction multiply_uint32(a: number, b: number): number {\n let n = a;\n let m = b;\n\n n >>>= 0;\n m >>>= 0;\n const nlo = n & 0xffff;\n return (((n - nlo) * m >>> 0) + (nlo * m)) >>> 0;\n}\n\n/**\n * Helper function to convert base64 encoding to url friendly format\n *\n * @param base64 - Base64 string\n *\n * @returns Url-friendly base64 encoding.\n */\nconst toUrlBase64 = (base64: string): string => base64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").split(\"=\")[0];\n\n/**\n * Helper function to recover padding of base64 encoding\n *\n * @param x - Base64 string\n *\n * @returns Padded base64 encoding.\n */\nconst toPaddedBase64 = function(x: string): string {\n let base64 = x;\n const padLength = 4 - base64.length % 4;\n base64 += \"=\".repeat(padLength);\n return base64;\n};\n\n/**\n * Helper function to create a guid string from an array with 32Bit values\n *\n * @param in_guidArray - Array with the 32 bit values\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The guid\n */\nconst uint32x4ToGUID = function(in_guidArray: Uint32Array | Int32Array | number[], base64: boolean = false): string {\n if (base64) {\n const intArray = new Uint32Array(in_guidArray);\n const byteArray = new Uint8Array(intArray.buffer);\n const base64guid = base64js.fromByteArray(byteArray);\n // return url-friendly base64\n return toUrlBase64(base64guid);\n } else {\n // Convert to hexadecimal string\n let str = \"\";\n for (let i = 0; i < 4; i++) {\n const hex = in_guidArray[i].toString(16);\n str += (\"0\".repeat(8 - hex.length) + hex);\n }\n // eslint-disable-next-line max-len\n return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;\n }\n};\n\n/**\n * Convert guid to four 32Bit values.\n *\n * @param in_guid - The guid to convert\n * @param io_result - An optional array to write the result to;\n * If no array is given, a new one gets created\n * @returns Four 32-bit values\n *\n */\nconst guidToUint32x4 = function(in_guid: string, result: Uint32Array = new Uint32Array(4)): Uint32Array {\n if (isBase64(in_guid)) {\n const guid = toPaddedBase64(in_guid);\n const bytes = base64js.toByteArray(guid);\n const intArray = new Uint32Array(bytes.buffer);\n result.set(intArray);\n } else {\n result[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);\n result[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);\n result[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);\n result[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);\n }\n return result;\n};\n\n/**\n * Convert base64 guid into base16.\n *\n * @param in_guid - Base64 guid to convert\n * @returns Base16 guid\n *\n */\nconst base64Tobase16 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid));\n\n/**\n * Convert base16 into base64 guid.\n *\n * @param in_guid - Base16 guid to convert\n * @returns Base64 guid\n *\n */\nconst base16ToBase64 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid), true);\n\n/**\n * Based on the boolean parameter generate either\n * a 128 bit base16 guid with the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx\n * or url-friendly base64 string guid of length 22\n *\n * This function is *not* thread safe!\n *\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The guid\n */\nconst generateGUID = function(base64 = false): string {\n const rnds = new Uint32Array(4);\n\n // Random numbers for guid (4x32 bit)\n rnds[0] = guidRNG.genRandUInt32();\n rnds[1] = guidRNG.genRandUInt32();\n rnds[2] = guidRNG.genRandUInt32();\n rnds[3] = guidRNG.genRandUInt32();\n return uint32x4ToGUID(rnds, base64);\n};\n\n// The last character is checked this way because last 4 bits of 22nd character are ignored\n// by decoder, e.g. \"+Q\" and \"+Z\" result in the same decoding.\n// The only characters with last 4 bits set to 0 are A, Q, g, w.\nconst reBase64 = (/^[\\w-]{21}[AQgw]$/);\n// eslint-disable-next-line unicorn/no-unsafe-regex\nconst reBase16 = (/^[\\dA-Fa-f]{8}(?:-[\\dA-Fa-f]{4}){3}-[\\dA-Fa-f]{12}$/);\n\n/**\n * Routine used to check whether the given string is a valid guid\n *\n * @param in_guid - The guid to test.\n * @returns True if the parameter is a valid guid, false otherwise.\n */\nconst isGUID = (in_guid: string) => reBase16.test(in_guid) || reBase64.test(in_guid);\n\n/**\n * Performs a hash combination operation on the two supplied Uint32 arrays of length 4 (using\n * a variant of the algorithm from boost::hash_combine\n *\n * @param in_array1 - First array\n * @param in_array2 - Second array\n * @returns New combined hash\n */\nconst hashCombine4xUint32 = function(\n in_array1: Uint32Array,\n in_array2: Uint32Array,\n io_result?: Uint32Array,\n): Uint32Array {\n let accumulated = io_result;\n if (accumulated === undefined) {\n accumulated = new Uint32Array(in_array2);\n } else {\n accumulated[0] = in_array2[0];\n accumulated[1] = in_array2[1];\n accumulated[2] = in_array2[2];\n accumulated[3] = in_array2[3];\n }\n\n accumulated[0] += 0x9e3779b9;\n accumulated[1] += 0x638f227;\n accumulated[2] += 0x1aff2bad;\n accumulated[3] += 0x3a8f05c5;\n\n accumulated[0] += in_array1[3] << 6;\n accumulated[1] += in_array1[0] << 6;\n accumulated[2] += in_array1[1] << 6;\n accumulated[3] += in_array1[2] << 6;\n\n accumulated[0] += in_array1[2] >> 2;\n accumulated[1] += in_array1[3] >> 2;\n accumulated[2] += in_array1[0] >> 2;\n accumulated[3] += in_array1[1] >> 2;\n\n accumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;\n\n return accumulated;\n};\n\n/**\n * Takes two guids and generates a new derived guid.\n * Note: You should only use this helper function when you need only one combination.\n * Otherwise, it is more efficient to work on the uint8 arrays directly.\n *\n * @param in_guid1 - Input guid\n * @param in_guid2 - Input guid\n * @param base64 - Use base64 encoding instead of standart guids\n * @returns Combined guid\n */\nconst combineGuids = function(in_guid1: string, in_guid2: string, base64 = false): string {\n const firstArray = guidToUint32x4(in_guid1);\n const secondArray = guidToUint32x4(in_guid2);\n const combined = hashCombine4xUint32(firstArray, secondArray);\n return uint32x4ToGUID(combined, base64);\n};\n\n// Make sure the RNG is initialized\nguidRNG.initialize();\n\nconst initializeGUIDGenerator = (...args) => { guidRNG.initialize(...args); };\n\nexport const GuidUtils = {\n uint32x4ToGUID,\n guidToUint32x4,\n base64Tobase16,\n base16ToBase64,\n initializeGUIDGenerator,\n generateGUID,\n isGUID,\n combineGuids,\n hashCombine4xUint32,\n};\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluid-experimental/property-common";
|
|
8
|
-
export declare const pkgVersion = "0.59.
|
|
8
|
+
export declare const pkgVersion = "0.59.3000";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluid-experimental/property-common";
|
|
11
|
-
exports.pkgVersion = "0.59.
|
|
11
|
+
exports.pkgVersion = "0.59.3000";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,qCAAqC,CAAC;AAChD,QAAA,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/property-common\";\nexport const pkgVersion = \"0.59.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,qCAAqC,CAAC;AAChD,QAAA,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/property-common\";\nexport const pkgVersion = \"0.59.3000\";\n"]}
|
package/lib/chronometer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chronometer.d.ts","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkIH;;GAEG;AAEH,qBAAa,WAAW;;IAKpB;;OAEG;IACH,KAAK;IAIL;;;;;OAKG;IACH,IAAI,IAAI,WAAW;IAKnB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;;OAOG;WACU,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"chronometer.d.ts","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkIH;;GAEG;AAEH,qBAAa,WAAW;;IAKpB;;OAEG;IACH,KAAK;IAIL;;;;;OAKG;IACH,IAAI,IAAI,WAAW;IAKnB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;;OAOG;WACU,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC;KAAE,CAAC;CAMzG"}
|
package/lib/chronometer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chronometer.js","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,MAAM,eAAe,GAAG;IACpB,kCAAkC;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I,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,UAAU;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,SAA2B;QACnD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview A chronometer implementation backed by a high resolution timer. Implementation\n * falls back to milliseconds precision when high resolution timers are not supported.\n */\n\ndeclare let process: any;\n\n/**\n * All the chronometer implementations (hrtime, window.performance, and date:\n */\nconst implementations = {\n // Node implementation uses hrtime\n node: {\n name: \"hrtime\",\n _startTime: 0,\n _stopTime: undefined as any[] | undefined,\n stop: () => { },\n\n _start() {\n this._startTime = process.hrtime();\n },\n _stop() {\n this._stopTime = process.hrtime(this._startTime);\n },\n _elapsedSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return (this._stopTime![0] as number) + (this._stopTime![1] as number) / 1000000000;\n },\n _elapsedMilliSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000 + this._stopTime![1] / 1000000;\n },\n _elapsedMicroSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000000 + this._stopTime![1] / 1000;\n },\n },\n // Browser implementation uses window.performance (if available):\n performance: {\n name: \"window.performance\",\n _startTime: 0,\n _stopTime: 0,\n\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = window.performance.now();\n },\n _stop() {\n this._stopTime = window.performance.now();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this._stopTime - this._startTime;\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n // Fallback is Date implementation if none of the above is supported:\n date: {\n name: \"date\",\n _startTime: new Date(),\n _stopTime: undefined as Date | undefined,\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = new Date();\n },\n _stop() {\n this._stopTime = new Date();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return (this._stopTime as Date).getTime() - this._startTime.getTime();\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n};\n\nlet impl: typeof implementations.date | typeof implementations.node | typeof implementations.performance;\nif (typeof process !== \"undefined\" && typeof process.hrtime !== \"undefined\") {\n impl = implementations.node;\n} else if (\n typeof window !== \"undefined\" &&\n typeof window.performance !== \"undefined\" &&\n typeof window.performance.now !== \"undefined\"\n) {\n impl = implementations.performance;\n} else {\n impl = implementations.date;\n}\n\n/**\n * Creates and starts a new Chronometer.\n */\n\nexport class Chronometer {\n constructor() {\n this.start();\n }\n\n /**\n * Sets the chronometer start time.\n */\n start() {\n return impl._start.call(this);\n }\n\n /**\n * Stops the chronometer. Stopped chronometers can be reused by calling {@link Chronometer.start} again.\n *\n * @returns The chronometer instance, so that callers can do this:\n * let elapsedMS = chrono.stop().elapsedMS();\n */\n stop(): Chronometer {\n impl._stop.call(this);\n return this;\n }\n\n /**\n * @returns How many microseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Implementations that are not precise\n * enough may return \"elapsedMilliSec() * 1000\". Measuring elapsed time causes the chronometer\n * to be stopped if required (if the chrono is not stopped when this method is called).\n */\n elapsedMicroSec(): number {\n return impl._elapsedMicroSec.call(this);\n }\n\n /**\n * @returns How many milliseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedMilliSec(): number {\n return impl._elapsedMilliSec.call(this);\n }\n\n /**\n * @returns How many seconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedSec(): number {\n return impl._elapsedSec.call(this);\n }\n\n /**\n * A utility function to measure promise execution time.\n * @param promiseFn - A function that returns a promise whose execution time is to be\n * measured.\n * @returns A Promise that resolves with an object with properties:\n * - chrono A stopped chronometer instance from which to get the elapsed time,\n * - result The resolved result of the promise returned by promiseFn\n */\n static async timePromise<T>(promiseFn: () => Promise<T>): Promise<{ chrono: Chronometer, result: T }> {\n const chrono = new Chronometer();\n const result = await promiseFn();\n chrono.stop();\n return { chrono, result };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chronometer.js","sourceRoot":"","sources":["../src/chronometer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,MAAM,eAAe,GAAG;IACpB,kCAAkC;IAClC,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,SAA8B;QACzC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC;QAEf,MAAM;YACF,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CA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CAAC,KAAK,CAAC,WAAW,CAAI,SAA2B;QACnD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview A chronometer implementation backed by a high resolution timer. Implementation\n * falls back to milliseconds precision when high resolution timers are not supported.\n */\n\ndeclare let process: any;\n\n/**\n * All the chronometer implementations (hrtime, window.performance, and date:\n */\nconst implementations = {\n // Node implementation uses hrtime\n node: {\n name: \"hrtime\",\n _startTime: 0,\n _stopTime: undefined as any[] | undefined,\n stop: () => { },\n\n _start() {\n this._startTime = process.hrtime();\n },\n _stop() {\n this._stopTime = process.hrtime(this._startTime);\n },\n _elapsedSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return (this._stopTime![0] as number) + (this._stopTime![1] as number) / 1000000000;\n },\n _elapsedMilliSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000 + this._stopTime![1] / 1000000;\n },\n _elapsedMicroSec(): number {\n if (this._stopTime === undefined) {\n this.stop();\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._stopTime![0] * 1000000 + this._stopTime![1] / 1000;\n },\n },\n // Browser implementation uses window.performance (if available):\n performance: {\n name: \"window.performance\",\n _startTime: 0,\n _stopTime: 0,\n\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = window.performance.now();\n },\n _stop() {\n this._stopTime = window.performance.now();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this._stopTime - this._startTime;\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n // Fallback is Date implementation if none of the above is supported:\n date: {\n name: \"date\",\n _startTime: new Date(),\n _stopTime: undefined as Date | undefined,\n stop: () => { },\n elapsedMilliSec: () => 0,\n\n _start() {\n this._startTime = new Date();\n },\n _stop() {\n this._stopTime = new Date();\n },\n _elapsedSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() / 1000;\n },\n _elapsedMilliSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return (this._stopTime as Date).getTime() - this._startTime.getTime();\n },\n _elapsedMicroSec(): number {\n if (!this._stopTime) {\n this.stop();\n }\n return this.elapsedMilliSec() * 1000;\n },\n },\n};\n\nlet impl: typeof implementations.date | typeof implementations.node | typeof implementations.performance;\nif (typeof process !== \"undefined\" && typeof process.hrtime !== \"undefined\") {\n impl = implementations.node;\n} else if (\n typeof window !== \"undefined\" &&\n typeof window.performance !== \"undefined\" &&\n typeof window.performance.now !== \"undefined\"\n) {\n impl = implementations.performance;\n} else {\n impl = implementations.date;\n}\n\n/**\n * Creates and starts a new Chronometer.\n */\n\nexport class Chronometer {\n constructor() {\n this.start();\n }\n\n /**\n * Sets the chronometer start time.\n */\n start() {\n return impl._start.call(this);\n }\n\n /**\n * Stops the chronometer. Stopped chronometers can be reused by calling {@link Chronometer.start} again.\n *\n * @returns The chronometer instance, so that callers can do this:\n * let elapsedMS = chrono.stop().elapsedMS();\n */\n stop(): Chronometer {\n impl._stop.call(this);\n return this;\n }\n\n /**\n * @returns How many microseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Implementations that are not precise\n * enough may return \"elapsedMilliSec() * 1000\". Measuring elapsed time causes the chronometer\n * to be stopped if required (if the chrono is not stopped when this method is called).\n */\n elapsedMicroSec(): number {\n return impl._elapsedMicroSec.call(this);\n }\n\n /**\n * @returns How many milliseconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedMilliSec(): number {\n return impl._elapsedMilliSec.call(this);\n }\n\n /**\n * @returns How many seconds have elapsed between the last call to {@link Chronometer.start}\n * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the\n * chronometer to be stopped if required (if the chrono is not stopped when this method is\n * called).\n */\n elapsedSec(): number {\n return impl._elapsedSec.call(this);\n }\n\n /**\n * A utility function to measure promise execution time.\n * @param promiseFn - A function that returns a promise whose execution time is to be\n * measured.\n * @returns A Promise that resolves with an object with properties:\n * - chrono A stopped chronometer instance from which to get the elapsed time,\n * - result The resolved result of the promise returned by promiseFn\n */\n static async timePromise<T>(promiseFn: () => Promise<T>): Promise<{ chrono: Chronometer; result: T; }> {\n const chrono = new Chronometer();\n const result = await promiseFn();\n chrono.stop();\n return { chrono, result };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":"AAmBA,qBAAa,UAAU,CAAC,CAAC;IAUT,SAAS,CAAC,KAAK;IAA0B,SAAS,CAAC,KAAK,CAAC,aAAY,GAAG;IATpF,SAAS,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":"AAmBA,qBAAa,UAAU,CAAC,CAAC;IAUT,SAAS,CAAC,KAAK;IAA0B,SAAS,CAAC,KAAK,CAAC,aAAY,GAAG;IATpF,SAAS,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC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,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,aAA4B;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC;QAEhC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n TYPE_MISMATCH: \"Type does not match this collection type\",\n KEY_ALREADY_EXISTS: \"Collection key already exists. \",\n KEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n MUST_GIVE_KEY: \"Collection missing key.\",\n MUST_GIVE_VALUE: \"Collection missing value.\",\n KEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n protected _items: { [key: string]: T } = {};\n protected _order: (string | number)[] = [];\n\n /**\n * @param _name - a friendly name to describe this collection. If undefined\n * the collection will have a default \"Untitled Collection\" assigned to its name.\n * @param _type - optional parameter pointing to the constructor\n * of a type this Collection will host.\n */\n constructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {\n }\n\n // Pass-thru binding handles\n onAdd(in_key, in_value) { }\n onRemove(in_key, in_value) { }\n onClear(in_items) { }\n\n public get items() {\n return this._items;\n }\n\n public get keys() {\n return Object.keys(this._items);\n }\n\n /**\n * @param in_key - Key to store the value under\n * @param in_value - Value to store in the collection\n * @returns Return the value passed in\n */\n add(in_key: number | string, in_value: T): T {\n this._checkType(in_value);\n this._checkIsNewKey(in_key);\n\n this._items[in_key] = in_value;\n this._order.push(in_key);\n\n this.onAdd(in_key, in_value);\n\n return in_value;\n }\n\n /**\n * Checks if in_value's type is equal to this Collection type. If this collection\n * has no type set, the check will pass.\n *\n * @param in_value - A value that is equal to the type managed by this collection.\n * @returns Return true if the type is a valid type for this\n * collection, throw otherwise.\n */\n private _checkType(in_value: T) {\n if (this._type && !(in_value instanceof this._type)) {\n throw new Error(MSGS.TYPE_MISMATCH);\n } else {\n return true;\n }\n }\n\n /**\n * Bulk add items.\n * @param in_items - List of key-value pairs to be stored in the collection\n * @returns this collection after add\n */\n bulkAdd(in_items: { [key: string]: T }) {\n _.each(in_items, (item, key) => {\n this.add(key, item);\n });\n return this;\n }\n\n /**\n * Bulk remove items.\n * @param in_items - List of key-value items to be removed\n * @returns this collection after add\n */\n bulkRemove(in_items: { [key: string]: T }) {\n _.each(in_items, (item, key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Test if this collection is empty\n * @returns true if empty, false otherwise\n * */\n isEmpty() {\n return _.isEmpty(this._items);\n }\n\n /**\n * Return the first item in the collection, null if empty\n * @returns first item, or undefined if empty\n * */\n getFirstItem(): T | undefined {\n const index = _.first(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * Return the last item in the collection, null if empty\n * @returns - last item, or undefined if empty\n * */\n getLastItem(): T | undefined {\n const index = _.last(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * @returns Returns the type of collection (Array, etc.)\n */\n getType() {\n return this._type;\n }\n\n /**\n * @returns Returns the name of the collection\n */\n getName(): string {\n return this._name;\n }\n\n /**\n * Filter out by function\n * @param in_filterFunction - with arguments key and item\n * @returns New filtered collection\n */\n filter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n const keeper = in_filterFunction(in_key, in_item);\n if (keeper) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterKey\n * @param in_filterKey - a single key or an array of keys, if the\n * item matches any of the keys it will be filtered in.\n * @returns New filtered collection with all the items\n * matching at least one key.\n */\n filterByKey(in_filterKey: string | string[]): Collection<T> {\n const rtn = new Collection<T>();\n\n let filterCb;\n\n if (_.isArray(in_filterKey)) {\n filterCb = function(in_key, in_item) {\n if (in_filterKey.indexOf(in_key) >= 0) {\n rtn.add(in_key, in_item);\n }\n };\n } else {\n // if in_filterKey is an array\n filterCb = function(in_key, in_item) {\n if (in_key === in_filterKey) {\n rtn.add(in_key, in_item);\n }\n };\n }\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterValue\n * @param in_filterValue - Value to filter on\n * @returns Return a filtered collection\n */\n filterByValue(in_filterValue: T): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n if (in_item === in_filterValue) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Remove an item from this Collection. This method returns a Boolean indicating\n * the success or failure of the removal. This is practical because if we were\n * to throw an error when the key doesn't exist, it would require additional\n * checks by the caller to make sure this key exists prior to removal. Which\n * would make the attempt of removal more verbose and also costly because the\n * caller would have to keep a list – somewhere else – of the things he can\n * and cannot remove.\n *\n * @param in_key - the key we wish to remove\n * @returns true if the key exists and was removed, false otherwise.\n */\n remove(in_key: number | string): boolean {\n if (!this.has(in_key)) {\n return false;\n }\n\n const remember = this._items[in_key];\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._items[in_key];\n this._order.splice(this._order.indexOf(in_key), 1);\n\n this.onRemove(in_key, remember);\n\n return true;\n }\n\n /**\n * Return the number of items in this Collection\n * @returns the number of items in the collection\n */\n getCount(): number {\n return this._order.length;\n }\n\n /**\n * Returns this collection as an ordered Array\n * @returns Array including the values\n */\n getAsArray() {\n const rtnArr: T[] = new Array(this.getCount());\n\n for (let i = 0; i < this._order.length; i++) {\n rtnArr[i] = this._items[this._order[i]];\n }\n\n return rtnArr;\n }\n\n /**\n * @param in_key - the key we are looking for\n * @returns true if the item exists\n */\n has(in_key: string | number): boolean {\n return Object.prototype.hasOwnProperty.call(this._items, in_key);\n }\n\n /**\n * Return an item associated with the given key\n * @param in_key - the key for the item in this\n * Collection\n * @returns The item\n */\n item(in_key: number | string) {\n return this._items[in_key];\n }\n\n /**\n * Checks if this is a new key in the collection. Throw if already exists.\n * @param in_key - The key to check against\n * @returns true if key is new\n */\n private _checkIsNewKey(in_key: number | string) {\n if (this.has(in_key)) {\n throw new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Checks if the key exists in the collection. Throw if not.\n * @param in_key - the key to check against\n * @returns true if key exists\n */\n private _checkKeyExists(in_key: number | string) {\n if (!this.has(in_key)) {\n throw new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Set an existing key to a value. If key doesn't exist this call will throw\n * an error.\n * @param in_key - the key we want to modify\n * @param in_value - the value we are to set at this key\n * @returns the value passed in\n */\n set(in_key: string, in_value: T) {\n this._checkKeyExists(in_key);\n\n this._items[in_key] = in_value;\n\n return in_value;\n }\n\n /**\n * Iterate over this collection and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterate(in_callback) {\n for (const key of this._order) {\n const continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * Iterate over this collection starting from the tail and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterateFromTail(in_callback) {\n let key; let continu;\n for (let i = this._order.length - 1; i >= 0; i--) {\n key = this._order[i];\n continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * @returns Return an object containing the items of this collection\n */\n getItems(): { [key: string]: T } {\n const result = {};\n\n _.each(this._items, function(item, key) {\n result[key] = item;\n });\n\n return result;\n }\n\n /**\n * Return the list of keys\n * @returns List of keys\n */\n getKeys(): string[] {\n return Object.keys(this._items);\n }\n\n /**\n * Method used to get the first element in the collection along with its key.\n */\n peak() {\n return {\n item: this._items[this._order[0]],\n key: this._order[0],\n };\n }\n\n /**\n * Clear this collection\n * @returns this collection\n */\n clear() {\n if (_.isEmpty(this._items)) {\n return this;\n }\n\n this.onClear(this._items);\n\n // Best to just iterate through and remove everything, so that OnRemove\n // handlers are called.\n\n _.each(this.getKeys(), (key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n * @returns new Collection\n */\n clone(): Collection<T> {\n const newCol = new Collection<T>(this._name, this._type);\n newCol.bulkAdd(this._items);\n return newCol;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n */\n copy(in_collection: Collection<T>) {\n this.clear();\n const its = in_collection.items;\n\n _.each(its, (item, key) => {\n this.add(key, item);\n });\n }\n\n get values() {\n return this.getAsArray();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,4DAA4D;AAC5D;;GAEG;AACH,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,MAAM,IAAI,GAAG;IACT,aAAa,EAAE,0CAA0C;IACzD,kBAAkB,EAAE,iCAAiC;IACrD,kBAAkB,EAAE,mDAAmD;IACvE,aAAa,EAAE,yBAAyB;IACxC,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,sCAAsC;CACxD,CAAC;AAEF,MAAM,OAAO,UAAU;IAInB;;;;;OAKG;IACH,YAAsB,QAAQ,qBAAqB,EAAY,KAAqB;QAA9D,UAAK,GA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,CAAC;QACb,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC;QAEhC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n TYPE_MISMATCH: \"Type does not match this collection type\",\n KEY_ALREADY_EXISTS: \"Collection key already exists. \",\n KEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n MUST_GIVE_KEY: \"Collection missing key.\",\n MUST_GIVE_VALUE: \"Collection missing value.\",\n KEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n protected _items: { [key: string]: T; } = {};\n protected _order: (string | number)[] = [];\n\n /**\n * @param _name - a friendly name to describe this collection. If undefined\n * the collection will have a default \"Untitled Collection\" assigned to its name.\n * @param _type - optional parameter pointing to the constructor\n * of a type this Collection will host.\n */\n constructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {\n }\n\n // Pass-thru binding handles\n onAdd(in_key, in_value) { }\n onRemove(in_key, in_value) { }\n onClear(in_items) { }\n\n public get items() {\n return this._items;\n }\n\n public get keys() {\n return Object.keys(this._items);\n }\n\n /**\n * @param in_key - Key to store the value under\n * @param in_value - Value to store in the collection\n * @returns Return the value passed in\n */\n add(in_key: number | string, in_value: T): T {\n this._checkType(in_value);\n this._checkIsNewKey(in_key);\n\n this._items[in_key] = in_value;\n this._order.push(in_key);\n\n this.onAdd(in_key, in_value);\n\n return in_value;\n }\n\n /**\n * Checks if in_value's type is equal to this Collection type. If this collection\n * has no type set, the check will pass.\n *\n * @param in_value - A value that is equal to the type managed by this collection.\n * @returns Return true if the type is a valid type for this\n * collection, throw otherwise.\n */\n private _checkType(in_value: T) {\n if (this._type && !(in_value instanceof this._type)) {\n throw new Error(MSGS.TYPE_MISMATCH);\n } else {\n return true;\n }\n }\n\n /**\n * Bulk add items.\n * @param in_items - List of key-value pairs to be stored in the collection\n * @returns this collection after add\n */\n bulkAdd(in_items: { [key: string]: T; }) {\n _.each(in_items, (item, key) => {\n this.add(key, item);\n });\n return this;\n }\n\n /**\n * Bulk remove items.\n * @param in_items - List of key-value items to be removed\n * @returns this collection after add\n */\n bulkRemove(in_items: { [key: string]: T; }) {\n _.each(in_items, (item, key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Test if this collection is empty\n * @returns true if empty, false otherwise\n * */\n isEmpty() {\n return _.isEmpty(this._items);\n }\n\n /**\n * Return the first item in the collection, null if empty\n * @returns first item, or undefined if empty\n * */\n getFirstItem(): T | undefined {\n const index = _.first(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * Return the last item in the collection, null if empty\n * @returns - last item, or undefined if empty\n * */\n getLastItem(): T | undefined {\n const index = _.last(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * @returns Returns the type of collection (Array, etc.)\n */\n getType() {\n return this._type;\n }\n\n /**\n * @returns Returns the name of the collection\n */\n getName(): string {\n return this._name;\n }\n\n /**\n * Filter out by function\n * @param in_filterFunction - with arguments key and item\n * @returns New filtered collection\n */\n filter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n const keeper = in_filterFunction(in_key, in_item);\n if (keeper) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterKey\n * @param in_filterKey - a single key or an array of keys, if the\n * item matches any of the keys it will be filtered in.\n * @returns New filtered collection with all the items\n * matching at least one key.\n */\n filterByKey(in_filterKey: string | string[]): Collection<T> {\n const rtn = new Collection<T>();\n\n let filterCb;\n\n if (_.isArray(in_filterKey)) {\n filterCb = function(in_key, in_item) {\n if (in_filterKey.indexOf(in_key) >= 0) {\n rtn.add(in_key, in_item);\n }\n };\n } else {\n // if in_filterKey is an array\n filterCb = function(in_key, in_item) {\n if (in_key === in_filterKey) {\n rtn.add(in_key, in_item);\n }\n };\n }\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterValue\n * @param in_filterValue - Value to filter on\n * @returns Return a filtered collection\n */\n filterByValue(in_filterValue: T): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n if (in_item === in_filterValue) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Remove an item from this Collection. This method returns a Boolean indicating\n * the success or failure of the removal. This is practical because if we were\n * to throw an error when the key doesn't exist, it would require additional\n * checks by the caller to make sure this key exists prior to removal. Which\n * would make the attempt of removal more verbose and also costly because the\n * caller would have to keep a list – somewhere else – of the things he can\n * and cannot remove.\n *\n * @param in_key - the key we wish to remove\n * @returns true if the key exists and was removed, false otherwise.\n */\n remove(in_key: number | string): boolean {\n if (!this.has(in_key)) {\n return false;\n }\n\n const remember = this._items[in_key];\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._items[in_key];\n this._order.splice(this._order.indexOf(in_key), 1);\n\n this.onRemove(in_key, remember);\n\n return true;\n }\n\n /**\n * Return the number of items in this Collection\n * @returns the number of items in the collection\n */\n getCount(): number {\n return this._order.length;\n }\n\n /**\n * Returns this collection as an ordered Array\n * @returns Array including the values\n */\n getAsArray() {\n const rtnArr: T[] = new Array(this.getCount());\n\n for (let i = 0; i < this._order.length; i++) {\n rtnArr[i] = this._items[this._order[i]];\n }\n\n return rtnArr;\n }\n\n /**\n * @param in_key - the key we are looking for\n * @returns true if the item exists\n */\n has(in_key: string | number): boolean {\n return Object.prototype.hasOwnProperty.call(this._items, in_key);\n }\n\n /**\n * Return an item associated with the given key\n * @param in_key - the key for the item in this\n * Collection\n * @returns The item\n */\n item(in_key: number | string) {\n return this._items[in_key];\n }\n\n /**\n * Checks if this is a new key in the collection. Throw if already exists.\n * @param in_key - The key to check against\n * @returns true if key is new\n */\n private _checkIsNewKey(in_key: number | string) {\n if (this.has(in_key)) {\n throw new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Checks if the key exists in the collection. Throw if not.\n * @param in_key - the key to check against\n * @returns true if key exists\n */\n private _checkKeyExists(in_key: number | string) {\n if (!this.has(in_key)) {\n throw new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Set an existing key to a value. If key doesn't exist this call will throw\n * an error.\n * @param in_key - the key we want to modify\n * @param in_value - the value we are to set at this key\n * @returns the value passed in\n */\n set(in_key: string, in_value: T) {\n this._checkKeyExists(in_key);\n\n this._items[in_key] = in_value;\n\n return in_value;\n }\n\n /**\n * Iterate over this collection and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterate(in_callback) {\n for (const key of this._order) {\n const continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * Iterate over this collection starting from the tail and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterateFromTail(in_callback) {\n let key; let continu;\n for (let i = this._order.length - 1; i >= 0; i--) {\n key = this._order[i];\n continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * @returns Return an object containing the items of this collection\n */\n getItems(): { [key: string]: T; } {\n const result = {};\n\n _.each(this._items, function(item, key) {\n result[key] = item;\n });\n\n return result;\n }\n\n /**\n * Return the list of keys\n * @returns List of keys\n */\n getKeys(): string[] {\n return Object.keys(this._items);\n }\n\n /**\n * Method used to get the first element in the collection along with its key.\n */\n peak() {\n return {\n item: this._items[this._order[0]],\n key: this._order[0],\n };\n }\n\n /**\n * Clear this collection\n * @returns this collection\n */\n clear() {\n if (_.isEmpty(this._items)) {\n return this;\n }\n\n this.onClear(this._items);\n\n // Best to just iterate through and remove everything, so that OnRemove\n // handlers are called.\n\n _.each(this.getKeys(), (key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n * @returns new Collection\n */\n clone(): Collection<T> {\n const newCol = new Collection<T>(this._name, this._type);\n newCol.bulkAdd(this._items);\n return newCol;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n */\n copy(in_collection: Collection<T>) {\n this.clear();\n const its = in_collection.items;\n\n _.each(its, (item, key) => {\n this.add(key, item);\n });\n }\n\n get values() {\n return this.getAsArray();\n }\n}\n"]}
|
package/lib/deferredPromise.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAKxB;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAGM,KAAK,CAAC,OAAO,CAAC,SAAsB;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACrB,yEAAyE;YACzE,IAAI,KAAK,EAAE;gBACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC7B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,WACwD,EACxD,UACwD;QAExD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,KAAK,CACd,UACsD;QAEtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEM,OAAO,CAAC,GAAM,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAW,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC3D","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 private _resolveSelf;\n private _rejectSelf;\n private readonly promise: Promise<T>;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolveSelf = resolve;\n this._rejectSelf = reject;\n });\n }\n [Symbol.toStringTag]: string;\n\n public async finally(onfinally?: () => void): Promise<T> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Fetches a node style callback that fulfills the promise when called.\n * @returns A node style callback that fulfills the promise when called.\n */\n getCb() {\n return (error, result) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (error) {\n return this.reject(error);\n }\n return this.resolve(result);\n };\n }\n\n public async then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) =>\n TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: any) =>\n TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): Promise<TResult1 | TResult2> {\n return this.promise.then(onfulfilled, onrejected);\n }\n\n public async catch<TResult = never>(\n onrejected?: ((reason: any) =>\n TResult | PromiseLike<TResult>) | undefined | null,\n ): Promise<T | TResult> {\n return this.promise.then(onrejected);\n }\n\n public resolve(val: T) { this._resolveSelf(val); }\n public reject(reason: any) { this._rejectSelf(reason); }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAKxB;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAGM,KAAK,CAAC,OAAO,CAAC,SAAsB;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACrB,yEAAyE;YACzE,IAAI,KAAK,EAAE;gBACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC7B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,WACwD,EACxD,UACwD;QAExD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,KAAK,CACd,UACsD;QAEtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEM,OAAO,CAAC,GAAM,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAW,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC3D;AAtCI,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 private _resolveSelf;\n private _rejectSelf;\n private readonly promise: Promise<T>;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolveSelf = resolve;\n this._rejectSelf = reject;\n });\n }\n [Symbol.toStringTag]: string;\n\n public async finally(onfinally?: () => void): Promise<T> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Fetches a node style callback that fulfills the promise when called.\n * @returns A node style callback that fulfills the promise when called.\n */\n getCb() {\n return (error, result) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (error) {\n return this.reject(error);\n }\n return this.resolve(result);\n };\n }\n\n public async then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) =>\n TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: any) =>\n TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): Promise<TResult1 | TResult2> {\n return this.promise.then(onfulfilled, onrejected);\n }\n\n public async catch<TResult = never>(\n onrejected?: ((reason: any) =>\n TResult | PromiseLike<TResult>) | undefined | null,\n ): Promise<T | TResult> {\n return this.promise.then(onrejected);\n }\n\n public resolve(val: T) { this._resolveSelf(val); }\n public reject(reason: any) { this._rejectSelf(reason); }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flaggedError.js","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IAChD,sCAAsC;IACtC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,OAAO,YAAY;IAAzB;QAec,UAAK,GAAW,CAAC,CAAC;IAehC,CAAC;IAbG;;OAEG;IACH,OAAO;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"flaggedError.js","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IAChD,sCAAsC;IACtC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,OAAO,YAAY;IAAzB;QAec,UAAK,GAAW,CAAC,CAAC;IAehC,CAAC;IAbG;;OAEG;IACH,OAAO;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,WAAW;QACP,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;;AA5BD;;GAEG;AACI,kBAAK,GAAG;IACX;;OAEG;IACH,SAAS,EAAE,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,CAAC;CACX,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 */\n const _isFlagSet = (flags: number, flag: number) => {\n // eslint-disable-next-line no-bitwise\n return (flags & flag) === flag;\n};\n\nexport class FlaggedError {\n /**\n * Flags that may be set on an error instance.\n */\n static FLAGS = {\n /**\n * A transient error results from an operation that could succeed if retried.\n */\n TRANSIENT: 1,\n /**\n * A quiet error should not trigger an error log.\n */\n QUIET: 2,\n };\n\n protected flags: number = 0;\n\n /**\n * @returns True if the quiet flag is set.\n */\n isQuiet(): boolean {\n return _isFlagSet(this.flags, FlaggedError.FLAGS.QUIET);\n }\n\n /**\n * @returns True if the transient flag is set.\n */\n isTransient(): boolean {\n return _isFlagSet(this.flags, FlaggedError.FLAGS.TRANSIENT);\n }\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluid-experimental/property-common";
|
|
8
|
-
export declare const pkgVersion = "0.59.
|
|
8
|
+
export declare const pkgVersion = "0.59.3000";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/property-common\";\nexport const pkgVersion = \"0.59.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/property-common\";\nexport const pkgVersion = \"0.59.3000\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/property-common",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.3000",
|
|
4
4
|
"description": "common functions used in properties",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@fluidframework/build-common": "^0.23.0",
|
|
72
|
-
"@fluidframework/eslint-config-fluid": "^0.28.
|
|
73
|
-
"@fluidframework/mocha-test-setup": "^0.59.
|
|
72
|
+
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
73
|
+
"@fluidframework/mocha-test-setup": "^0.59.3000",
|
|
74
74
|
"@microsoft/api-extractor": "^7.22.2",
|
|
75
75
|
"@rushstack/eslint-config": "^2.5.1",
|
|
76
76
|
"@types/debug": "^4.1.5",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"nyc": "^15.0.0",
|
|
98
98
|
"rimraf": "^2.6.2",
|
|
99
99
|
"sinon": "^7.4.2",
|
|
100
|
-
"typescript": "~4.
|
|
100
|
+
"typescript": "~4.5.5",
|
|
101
101
|
"typescript-formatter": "7.1.0"
|
|
102
102
|
}
|
|
103
103
|
}
|
package/src/chronometer.ts
CHANGED
|
@@ -196,7 +196,7 @@ export class Chronometer {
|
|
|
196
196
|
* - chrono A stopped chronometer instance from which to get the elapsed time,
|
|
197
197
|
* - result The resolved result of the promise returned by promiseFn
|
|
198
198
|
*/
|
|
199
|
-
static async timePromise<T>(promiseFn: () => Promise<T>): Promise<{ chrono: Chronometer
|
|
199
|
+
static async timePromise<T>(promiseFn: () => Promise<T>): Promise<{ chrono: Chronometer; result: T; }> {
|
|
200
200
|
const chrono = new Chronometer();
|
|
201
201
|
const result = await promiseFn();
|
|
202
202
|
chrono.stop();
|
|
@@ -18,7 +18,7 @@ const MSGS = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export class Collection<T> {
|
|
21
|
-
protected _items: { [key: string]: T } = {};
|
|
21
|
+
protected _items: { [key: string]: T; } = {};
|
|
22
22
|
protected _order: (string | number)[] = [];
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -81,7 +81,7 @@ export class Collection<T> {
|
|
|
81
81
|
* @param in_items - List of key-value pairs to be stored in the collection
|
|
82
82
|
* @returns this collection after add
|
|
83
83
|
*/
|
|
84
|
-
bulkAdd(in_items: { [key: string]: T }) {
|
|
84
|
+
bulkAdd(in_items: { [key: string]: T; }) {
|
|
85
85
|
_.each(in_items, (item, key) => {
|
|
86
86
|
this.add(key, item);
|
|
87
87
|
});
|
|
@@ -93,7 +93,7 @@ export class Collection<T> {
|
|
|
93
93
|
* @param in_items - List of key-value items to be removed
|
|
94
94
|
* @returns this collection after add
|
|
95
95
|
*/
|
|
96
|
-
bulkRemove(in_items: { [key: string]: T }) {
|
|
96
|
+
bulkRemove(in_items: { [key: string]: T; }) {
|
|
97
97
|
_.each(in_items, (item, key) => {
|
|
98
98
|
this.remove(key);
|
|
99
99
|
});
|
|
@@ -356,7 +356,7 @@ export class Collection<T> {
|
|
|
356
356
|
/**
|
|
357
357
|
* @returns Return an object containing the items of this collection
|
|
358
358
|
*/
|
|
359
|
-
getItems(): { [key: string]: T } {
|
|
359
|
+
getItems(): { [key: string]: T; } {
|
|
360
360
|
const result = {};
|
|
361
361
|
|
|
362
362
|
_.each(this._items, function(item, key) {
|
package/src/packageVersion.ts
CHANGED