@itwin/core-bentley 5.3.0-dev.18 → 5.3.0-dev.21
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/lib/cjs/Id.d.ts.map +1 -1
- package/lib/cjs/Id.js +1 -6
- package/lib/cjs/Id.js.map +1 -1
- package/lib/esm/Id.d.ts.map +1 -1
- package/lib/esm/Id.js +1 -6
- package/lib/esm/Id.js.map +1 -1
- package/package.json +2 -2
package/lib/cjs/Id.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Id.d.ts","sourceRoot":"","sources":["../../src/Id.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAiCvD;;;;;;;;GAQG;AACH,yBAAiB,IAAI,CAAC;IACpB,2GAA2G;IAC3G,SAAgB,UAAU,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM,CAOjD;IAED,6GAA6G;IAC7G,SAAgB,cAAc,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM,CAMrD;IAED;;;;;OAKG;IACH,SAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAElD;IAED;;;;;;OAMG;IACH,SAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAyBlD;IAiBD;;;;;OAKG;IACH,SAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAYzF;I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AwB;IAOzC,sDAAsD;WACxC,QAAQ,CAAC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB;IAO5E;;;OAGG;IACI,IAAI,IAAI,wBAAwB;IAOvC;;;;;OAKG;IACI,KAAK,CAAC,MAAM,EAAE,wBAAwB,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM;CAyBlF;AAED;;;;;;GAMG;AACH,yBAAiB,IAAI,CAAC;IAGpB,qEAAqE;IAC9D,MAAM,KAAK,EAAE,UAAmD,CAAC;IAExE;;OAEG;IACH,SAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7C;IAED,mEAAmE;IACnE,SAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/C;IAED,iCAAiC;IACjC,SAAgB,WAAW,IAAI,UAAU,CAExC;IAED;;;;;;;OAOG;IACH,SAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAkBvD;CACF"}
|
package/lib/cjs/Id.js
CHANGED
|
@@ -694,12 +694,7 @@ var Guid;
|
|
|
694
694
|
Guid.isV4Guid = isV4Guid;
|
|
695
695
|
/** Create a new V4 Guid value */
|
|
696
696
|
function createValue() {
|
|
697
|
-
|
|
698
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
699
|
-
const r = Math.random() * 16 | 0;
|
|
700
|
-
const v = c === "x" ? r : (r & 0x3 | 0x8);
|
|
701
|
-
return v.toString(16);
|
|
702
|
-
});
|
|
697
|
+
return crypto.randomUUID();
|
|
703
698
|
}
|
|
704
699
|
Guid.createValue = createValue;
|
|
705
700
|
/**
|
package/lib/cjs/Id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Id.js","sourceRoot":"","sources":["../../src/Id.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA4BH,SAAS,KAAK,CAAC,GAAW;IACxB,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C;IAPe,gBAAW,cAO1B,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,SAAS,CAAC,KAAiB;QACzC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAE9C,gDAAgD;QAChD,IAAI,MAAM,CAAC,UAAU,CAAC;YACpB,OAAO,UAAU,CAAC;QAEpB,gHAAgH;QAChH,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,sEAAsE,CAAC;QAC7F,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACpC,OAAO,WAAW,CAAC,OAAO,CAAC,aAAa,EACtC,CAAC,MAAc,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CAC7E,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,8DAA8D;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAlBe,cAAS,YAkBxB,CAAA;AACH,CAAC,EAvDgB,IAAI,oBAAJ,IAAI,QAuDpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Ids\n */\n\n/** A string containing a well-formed string representation of an [Id64]($core-bentley).\n * See [Working with Ids]($docs/learning/common/Id64.md).\n * @public\n */\nexport type Id64String = string;\n\n/** A string containing a well-formed string representation of a [Guid]($core-bentley).\n * @public\n */\nexport type GuidString = string;\n\n/** A set of [[Id64String]]s.\n * @public\n */\nexport type Id64Set = Set<Id64String>;\n\n/** An array of [[Id64String]]s.\n * @public\n */\nexport type Id64Array = Id64String[];\n\n/** Used as an argument to a function that can accept one or more [[Id64String]]s.\n * @public\n */\nexport type Id64Arg = Id64String | Id64Set | Id64Array;\n\nfunction toHex(str: string): number {\n const v = parseInt(str, 16);\n return Number.isNaN(v) ? 0 : v;\n}\n\nfunction isLowerCaseNonZeroHexDigit(str: string, index: number) {\n return isLowerCaseHexDigit(str, index, false);\n}\n\nfunction isLowerCaseHexDigit(str: string, index: number, allowZero: boolean = true): boolean {\n const charCode = str.charCodeAt(index);\n const minDecimalDigit = allowZero ? 0x30 : 0x31; // '0' or '1'...\n return (charCode >= minDecimalDigit && charCode <= 0x39) || (charCode >= 0x61 && charCode <= 0x66); // '0'-'9, 'a' -'f'\n}\n\nfunction isValidHexString(id: string, startIndex: number, len: number) {\n if (len === 0)\n return false;\n\n // No leading zeroes...\n if (!isLowerCaseNonZeroHexDigit(id, startIndex))\n return false;\n\n // ...followed by len-1 lowercase hexadecimal digits.\n for (let i = 1; i < len; i++)\n if (!isLowerCaseHexDigit(id, startIndex + i))\n return false;\n\n return true;\n}\n\n/**\n * The Id64 namespace provides facilities for working with 64-bit identifiers. These Ids are stored as 64-bit integers inside an [[IModelDb]], but must be represented\n * as strings in JavaScript because JavaScript does not intrinsically support 64-bit integers.\n *\n * The [[Id64String]] type alias is used to indicate function arguments, return types, and variables which are known to contain a well-formed representation of a 64-bit Id.\n *\n * See [Working with Ids]($docs/learning/common/Id64.md) for a detailed description and code examples.\n * @public\n */\nexport namespace Id64 {\n /** Extract the \"local\" Id portion of an Id64String, contained in the lower 40 bits of the 64-bit value. */\n export function getLocalId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n const start = (len > 12) ? (len - 10) : 2;\n return toHex(id.slice(start));\n }\n\n /** Extract the briefcase Id portion of an Id64String, contained in the upper 24 bits of the 64-bit value. */\n export function getBriefcaseId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n return (len <= 12) ? 0 : toHex(id.slice(2, len - 10));\n }\n\n /** Create an Id64String from its JSON representation.\n * @param prop The JSON representation of an Id.\n * @returns A well-formed Id string.\n * @note if the input is undefined, the result is \"0\", indicating an invalid Id.\n * @note if the input is not undefined, the result is the same as that of [[Id64.fromString]].\n */\n export function fromJSON(prop?: string): Id64String {\n return typeof prop === \"string\" ? Id64.fromString(prop) : Id64.invalid;\n }\n\n /** Given a string value, attempt to normalize it into a well-formed Id string.\n * If the input is already a well-formed Id string, it is returned unmodified.\n * Otherwise, the input is trimmed of leading and trailing whitespace, converted to lowercase, and an attempt is made to parse it as a 64-bit hexadecimal integer.\n * If parsing succeeds the normalized result is returned; otherwise the result is \"0\", indicating an invalid Id.\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n */\n export function fromString(val: string): Id64String {\n // NB: in case this is called from JavaScript, we must check the run-time type...\n if (typeof val !== \"string\")\n return invalid;\n\n // Skip the common case in which the input is already a well-formed Id string\n if (Id64.isId64(val))\n return val;\n\n // Attempt to normalize the input into a well-formed Id string\n val = val.toLowerCase().trim();\n const len = val.length;\n if (len < 2 || val[0] !== \"0\" || val[1] !== \"x\")\n return invalid;\n\n let low = 0;\n let high = 0;\n let start = 2;\n if (len > 12) {\n start = (len - 10);\n high = toHex(val.slice(2, start));\n }\n\n low = toHex(val.slice(start));\n return fromLocalAndBriefcaseIds(low, high);\n }\n\n // Used when constructing local ID portion of Id64String. Performance optimization.\n const _localIdPrefixByLocalIdLength = [\n \"0000000000\",\n \"000000000\",\n \"00000000\",\n \"0000000\",\n \"000000\",\n \"00000\",\n \"0000\",\n \"000\",\n \"00\",\n \"0\",\n \"\",\n ];\n\n /** Produce an Id string from a local and briefcase Id.\n * @param localId The non-zero local Id as an unsigned 40-bit integer.\n * @param briefcaseId The briefcase Id as an unsigned 24-bit integer.\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `localId | (briefcaseId << 40)`, or an invalid Id \"0\" if the inputs are invalid.\n */\n export function fromLocalAndBriefcaseIds(localId: number, briefcaseId: number): Id64String {\n // NB: Yes, we must check the run-time type...\n if (typeof localId !== \"number\" || typeof briefcaseId !== \"number\")\n return invalid;\n\n localId = Math.floor(localId);\n if (0 === localId)\n return invalid;\n\n briefcaseId = Math.floor(briefcaseId);\n const lowStr = localId.toString(16);\n return `0x${(briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr))}`;\n }\n\n // Used as a buffer when converting a pair of 32-bit integers to an Id64String. Significant performance optimization.\n const scratchCharCodes = [\n 0x30, // \"0\"\n 0x78, // \"x\"\n 0x30, // \"0\"\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n ];\n\n // Convert 4-bit unsigned integer to char code representing lower-case hexadecimal digit.\n function uint4ToCharCode(uint4: number): number {\n return uint4 + (uint4 < 10 ? 0x30 : 0x57);\n }\n\n // Convert char code representing lower-case hexadecimal digit to 4-bit unsigned integer.\n function charCodeToUint4(char: number): number {\n return char - (char >= 0x57 ? 0x57 : 0x30);\n }\n\n // Convert a substring to a uint32. This is twice as fast as using Number.parseInt().\n function substringToUint32(id: Id64String, start: number, end: number): number {\n let uint32 = 0;\n for (let i = start; i < end; i++) {\n const uint4 = charCodeToUint4(id.charCodeAt(i));\n const shift = (end - i - 1) << 2;\n const mask = uint4 << shift;\n uint32 = (uint32 | mask) >>> 0; // >>> 0 to force unsigned because javascript\n }\n\n return uint32;\n }\n\n /** Create an Id64String from a pair of unsigned 32-bit integers.\n * @param lowBytes The lower 4 bytes of the Id\n * @param highBytes The upper 4 bytes of the Id\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `lowBytes | (highBytes << 32)`.\n * @see [[Id64.fromUint32PairObject]] if you have a [[Id64.Uint32Pair]] object.\n */\n export function fromUint32Pair(lowBytes: number, highBytes: number): Id64String {\n const localIdLow = lowBytes >>> 0;\n const localIdHigh = (highBytes & 0x000000ff) * (0xffffffff + 1); // aka (highBytes & 0xff) << 32\n const localId = localIdLow + localIdHigh; // aka localIdLow | localIdHigh\n if (0 === localId)\n return invalid;\n\n // Need to omit or preserve leading zeroes...\n const buffer = scratchCharCodes;\n let index = 2;\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (highBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (lowBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n if (buffer.length !== index)\n buffer.length = index;\n\n return String.fromCharCode(...scratchCharCodes);\n }\n\n /** Create an Id64String from a [[Id64.Uint32Pair]].\n * @see [[Id64.fromUint32Pair]].\n */\n export function fromUint32PairObject(pair: Uint32Pair): Id64String {\n return fromUint32Pair(pair.lower, pair.upper);\n }\n\n /** Returns true if the inputs represent two halves of a valid 64-bit Id.\n * @see [[Id64.Uint32Pair]].\n */\n export function isValidUint32Pair(lowBytes: number, highBytes: number): boolean {\n // Detect local ID of zero\n return 0 !== lowBytes || 0 !== (highBytes & 0x000000ff);\n }\n\n /** Represents an [[Id64]] as a pair of unsigned 32-bit integers. Because Javascript lacks efficient support for 64-bit integers,\n * this representation can be useful in performance-sensitive code like the render loop.\n * @see [[Id64.getUint32Pair]] to convert an [[Id64String]] to a Uint32Pair.\n * @see [[Id64.fromUint32Pair]] to convert a Uint32Pair to an [[Id64String]].\n * @see [[Id64.Uint32Set]] and [[Id64.Uint32Map]] for collections based on Uint32Pairs.\n */\n export interface Uint32Pair {\n /** The lower 4 bytes of the 64-bit integer. */\n lower: number;\n /** The upper 4 bytes of the 64-bit integer. */\n upper: number;\n }\n\n /** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.\n * @param id The well-formed string representation of a 64-bit Id.\n * @param out Used as the return value if supplied; otherwise a new object is returned.\n * @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.\n */\n export function getUint32Pair(id: Id64String, out?: Uint32Pair): Uint32Pair {\n if (!out)\n out = { lower: 0, upper: 0 };\n\n out.lower = getLowerUint32(id);\n out.upper = getUpperUint32(id);\n return out;\n }\n\n /** Extract an unsigned 32-bit integer from the lower 4 bytes of an Id64String. */\n export function getLowerUint32(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const end = id.length;\n const start = end > 10 ? end - 8 : 2;\n return substringToUint32(id, start, end);\n }\n\n /** Extract an unsigned 32-bit integer from the upper 4 bytes of an Id64String. */\n export function getUpperUint32(id: Id64String): number {\n const len = id.length;\n if (len <= 10 || isInvalid(id))\n return 0;\n\n return substringToUint32(id, 2, len - 8);\n }\n\n /** Convert an [[Id64Arg]] into an [[Id64Set]].\n *\n * This method can be used by functions that accept an Id64Arg to conveniently process the value(s). For example:\n * ```ts\n * public addCategories(arg: Id64Arg) { Id64.toIdSet(arg).forEach((id) => this.categories.add(id)); }\n * ```\n *\n * Alternatively, to avoid allocating a new Id64Set, use [[Id64.iterable]].\n *\n * @param arg The Ids to convert to an Id64Set.\n * @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input.\n * @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg.\n */\n export function toIdSet(arg: Id64Arg, makeCopy: boolean = false): Id64Set {\n if (arg instanceof Set)\n return makeCopy ? new Set<string>(arg) : arg;\n\n const ids = new Set<Id64String>();\n if (typeof arg === \"string\")\n ids.add(arg);\n else if (Array.isArray(arg)) {\n arg.forEach((id: Id64String) => {\n if (typeof id === \"string\")\n ids.add(id);\n });\n }\n\n return ids;\n }\n\n /** Obtain iterator over the specified Ids.\n * @see [[Id64.iterable]].\n */\n export function* iterator(ids: Id64Arg): Iterator<Id64String> {\n if (typeof ids === \"string\") {\n yield ids;\n } else {\n for (const id of ids)\n yield id;\n }\n }\n\n /** Obtain an iterable over the specified Ids. Example usage:\n * ```ts\n * const ids = [\"0x123\", \"0xfed\"];\n * for (const id of Id64.iterable(ids))\n * console.log(id);\n * ```\n */\n export function iterable(ids: Id64Arg): Iterable<Id64String> {\n return {\n [Symbol.iterator]: () => iterator(ids),\n };\n }\n\n /** Return the first [[Id64String]] of an [[Id64Arg]]. */\n export function getFirst(arg: Id64Arg): Id64String {\n return typeof arg === \"string\" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value) ?? Id64.invalid;\n }\n\n /** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */\n export function sizeOf(arg: Id64Arg): number {\n return typeof arg === \"string\" ? 1 : (Array.isArray(arg) ? arg.length : arg.size);\n }\n\n /** Returns true if the [[Id64Arg]] contains the specified Id. */\n export function has(arg: Id64Arg, id: Id64String): boolean {\n if (typeof arg === \"string\")\n return arg === id;\n if (Array.isArray(arg))\n return -1 !== arg.indexOf(id);\n\n return arg.has(id);\n }\n\n /** The string representation of an invalid Id. */\n export const invalid = \"0\";\n\n /** Determine if the supplied id string represents a transient Id.\n * @param id A well-formed Id string.\n * @returns true if the Id represents a transient Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isTransientId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransient(id: Id64String): boolean {\n // A transient Id is of the format \"0xffffffxxxxxxxxxx\" where the leading 6 digits indicate an invalid briefcase Id.\n return 18 === id.length && id.startsWith(\"0xffffff\");\n }\n\n /** Determine if the input is a well-formed [[Id64String]] and represents a transient Id.\n * @see [[Id64.isTransient]]\n * @see [[Id64.isId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransientId64(id: string): boolean {\n return isValidId64(id) && isTransient(id);\n }\n\n /** Determine if the input is a well-formed [[Id64String]].\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n * @see [[Id64.isValidId64]]\n */\n export function isId64(id: string): boolean {\n const len = id.length;\n if (0 === len || 18 < len)\n return false;\n\n if (\"0\" !== id[0])\n return false;\n\n // Well-formed invalid Id: \"0\"\n if (1 === len)\n return true;\n\n // Valid Ids begin with \"0x\" followed by at least one lower-case hexadecimal digit.\n if (2 === len || \"x\" !== id[1])\n return false;\n\n // If briefcase Id is present, it occupies at least one digit, followed by 10 digits for local Id\n let localIdStart = 2;\n if (len > 12) {\n localIdStart = len - 10;\n\n // Verify briefcase Id\n if (!isValidHexString(id, 2, localIdStart - 2))\n return false;\n\n // Skip leading zeroes in local Id\n for (let i = localIdStart; i < len; i++) {\n if (0x30 !== id.charCodeAt(i)) // '0'\n break;\n else\n localIdStart++;\n }\n\n if (localIdStart >= len)\n return false;\n }\n\n return isValidHexString(id, localIdStart, len - localIdStart);\n }\n\n /** Returns true if the input is not equal to the representation of an invalid Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isInvalid]]\n * @see [[Id64.isValidId64]]\n */\n export function isValid(id: Id64String): boolean {\n return Id64.invalid !== id;\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing a valid Id.\n * @see [[Id64.isValid]]\n * @see [[Id64.isId64]]\n */\n export function isValidId64(id: string): boolean {\n return Id64.invalid !== id && Id64.isId64(id);\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing an invalid Id.\n * @see [[Id64.isValid]]\n */\n export function isInvalid(id: Id64String): boolean {\n return Id64.invalid === id;\n }\n\n /** A specialized replacement for Set<Id64String> optimized for performance-critical code which represents large sets of [[Id64]]s as pairs of\n * 32-bit integers.\n * The internal representation is a Map<number, Set<number>> where the Map key is the upper 4 bytes of the IDs and the Set elements are the lower 4 bytes of the IDs.\n * Because the upper 4 bytes store the 24-bit briefcase ID plus the upper 8 bits of the local ID, there will be a very small distribution of unique Map keys.\n * To further optimize this data type, the following assumptions are made regarding the { lower, upper } inputs, and no validation is performed to confirm them:\n * - The inputs are unsigned 32-bit integers;\n * - The inputs represent a valid Id64String (e.g., local ID is not zero).\n * @see [[Id64.Uint32Map]] for a similarly-optimized replacement for Map<Id64String, T>\n * @public\n */\n export class Uint32Set {\n protected readonly _map = new Map<number, Set<number>>();\n\n /** Construct a new Uint32Set.\n * @param ids If supplied, all of the specified Ids will be added to the new set.\n */\n public constructor(ids?: Id64Arg) {\n if (undefined !== ids)\n this.addIds(ids);\n }\n\n /** Return true if `this` and `other` contain the same set of Ids. */\n public equals(other: Uint32Set): boolean {\n if (this === other) {\n return true;\n }\n\n if (this.size !== other.size) {\n return false;\n }\n\n for (const [key, thisValue] of this._map) {\n const otherValue = other._map.get(key);\n if (!otherValue || thisValue.size !== otherValue.size) {\n return false;\n }\n\n for (const value of thisValue) {\n if (!otherValue.has(value)) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /** Remove all contents of this set. */\n public clear(): void {\n this._map.clear();\n }\n\n /** Add an Id to the set. */\n public addId(id: Id64String): void {\n this.add(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Add any number of Ids to the set. */\n public addIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.addId(id);\n }\n\n /** Returns true if the set contains the specified Id. */\n public hasId(id: Id64String): boolean { return this.has(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n\n /** Add an Id to the set. */\n public add(low: number, high: number): void {\n let set = this._map.get(high);\n if (undefined === set) {\n set = new Set<number>();\n this._map.set(high, set);\n }\n\n set.add(low);\n }\n\n /** Remove an Id from the set. */\n public deleteId(id: Id64String): void {\n this.delete(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Remove any number of Ids from the set. */\n public deleteIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.deleteId(id);\n }\n\n /** Remove an Id from the set. */\n public delete(low: number, high: number): void {\n const set = this._map.get(high);\n if (undefined !== set) {\n set.delete(low);\n if (set.size === 0)\n this._map.delete(high);\n }\n }\n\n /** Returns true if the set contains the specified Id. */\n public has(low: number, high: number): boolean {\n const set = this._map.get(high);\n return undefined !== set && set.has(low);\n }\n\n /** Returns true if the set contains the Id specified by `pair`. */\n public hasPair(pair: Uint32Pair): boolean {\n return this.has(pair.lower, pair.upper);\n }\n\n /** Returns true if the set contains no Ids. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n\n /** Returns the number of Ids contained in the set. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Populates and returns an array of all Ids contained in the set. */\n public toId64Array(): Id64Array {\n const ids: Id64Array = [];\n for (const entry of this._map)\n for (const low of entry[1])\n ids.push(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Populates and returns a set of all Ids contained in the set. */\n public toId64Set(): Id64Set {\n const ids = new Set<string>();\n for (const entry of this._map)\n for (const low of entry[1])\n ids.add(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Execute a function against each Id in this set. */\n public forEach(func: (lo: number, hi: number) => void): void {\n for (const entry of this._map)\n for (const lo of entry[1])\n func(lo, entry[0]);\n }\n }\n\n /** A specialized replacement for Map<Id64String, T> optimized for performance-critical code.\n * @see [[Id64.Uint32Set]] for implementation details.\n * @public\n */\n export class Uint32Map<T> {\n protected readonly _map = new Map<number, Map<number, T>>();\n\n /** Remove all entries from the map. */\n public clear(): void { this._map.clear(); }\n /** Find an entry in the map by Id. */\n public getById(id: Id64String): T | undefined { return this.get(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n /** Set an entry in the map by Id. */\n public setById(id: Id64String, value: T): void { this.set(Id64.getLowerUint32(id), Id64.getUpperUint32(id), value); }\n\n /** Set an entry in the map by Id components. */\n public set(low: number, high: number, value: T): void {\n let map = this._map.get(high);\n if (undefined === map) {\n map = new Map<number, T>();\n this._map.set(high, map);\n }\n\n map.set(low, value);\n }\n\n /** Get an entry from the map by Id components. */\n public get(low: number, high: number): T | undefined {\n const map = this._map.get(high);\n return undefined !== map ? map.get(low) : undefined;\n }\n\n /** Returns true if the map contains no entries. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n /** Returns the number of entries in the map. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Execute a function against each entry in this map. */\n public forEach(func: (lo: number, hi: number, value: T) => void): void {\n for (const outerEntry of this._map)\n for (const innerEntry of outerEntry[1])\n func(innerEntry[0], outerEntry[0], innerEntry[1]);\n }\n }\n}\n\n/** JSON representation of a [[TransientIdSequence]], primarily useful for transferring sequences to and from a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * It stores two \"local\" 40-bit Ids describing the range of [Id64String]($docs/learning/common/Id64.md)s generated by the sequence.\n * @public\n */\nexport interface TransientIdSequenceProps {\n /** The starting local Id. The sequence begins at `initialLocalId + 1`. */\n initialLocalId: number;\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * The next local Id generated by the sequence will be `currentLocalId + 1`.\n */\n currentLocalId: number;\n}\n\nfunction validateLocalId(num: number): void {\n if (num < 0 || Math.round(num) !== num) {\n throw new Error(\"Local Id must be a non-negative integer\");\n }\n}\n\n/** A function returned by [[TransientIdSequence.merge]] that remaps the local Id portion of an [Id64String]($docs/learning/common/Id64.md) generated by\n * the source sequence to the corresponding local Id in the target sequence.\n * It returns `sourceLocalId` if the input did not originate from the source sequence.\n* @public\n*/\nexport type RemapTransientLocalId = (sourceLocalId: number) => number;\n\n/**\n * Generates unique [[Id64String]] values in sequence, which are guaranteed not to conflict with Ids associated with persistent elements or models.\n * This is useful for associating stable, non-persistent identifiers with things like [Decorator]($frontend)s.\n * A TransientIdSequence can generate a maximum of (2^40)-2 unique Ids.\n * @public\n */\nexport class TransientIdSequence {\n /** The starting local Id provided to the constructor. The sequence begins at `initialLocalId + 1`. */\n public readonly initialLocalId: number;\n private _localId: number;\n\n /** Constructor.\n * @param initialLocalId The starting local Id. The local Id of the first [[Id64String]] generated by [[getNext]] will be `initialLocalId + 1`.\n */\n public constructor(initialLocalId = 0) {\n validateLocalId(initialLocalId);\n this.initialLocalId = initialLocalId;\n this._localId = initialLocalId;\n }\n\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * Each call to [[getNext]] increments this by 1 and uses it as the local Id of the generated [[Id64String]].\n */\n public get currentLocalId(): number {\n return this._localId;\n }\n\n /** Generate and return the next transient Id64String in the sequence. */\n public getNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(++this._localId, 0xffffff);\n }\n\n /** Preview the transient Id64String that will be returned by the next call to [[getNext]].\n * This is primarily useful for tests.\n */\n public peekNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(this._localId + 1, 0xffffff);\n }\n\n /** Convert this sequence to its JSON representation. */\n public toJSON(): TransientIdSequenceProps {\n return {\n initialLocalId: this.initialLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Create a sequence from its JSON representation. */\n public static fromJSON(props: TransientIdSequenceProps): TransientIdSequence {\n validateLocalId(props.currentLocalId);\n const sequence = new TransientIdSequence(props.initialLocalId);\n sequence._localId = props.currentLocalId;\n return sequence;\n }\n\n /** Obtain the JSON representation of a new sequence that diverges from this sequence, with its [[initialLocalId]] set to this sequence's [[currentLocalId]].\n * The two sequences can generate Ids independently. Later, you can [[merge]] the sequences, resolving conflicts where the two sequences generated identical Ids.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n */\n public fork(): TransientIdSequenceProps {\n return {\n initialLocalId: this.currentLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Integrate the Ids generated by a [[fork]] of this sequence. All of the Ids generated by `source` will be remapped to Ids at the end of this sequence.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * @param source The JSON representation of the [[fork]]ed sequence to be merged with this one.\n * @returns a function that permits you to remap the local Ids generated by `source` into the corresponding local Ids assigned by this sequence.\n * @throws Error if `source` is not a fork of this sequence or is malformed (e.g., contains negative and/or non-integer local Ids).\n */\n public merge(source: TransientIdSequenceProps): (sourceLocalId: number) => number {\n const { initialLocalId, currentLocalId } = source;\n\n validateLocalId(initialLocalId);\n validateLocalId(currentLocalId);\n\n if (initialLocalId > this.currentLocalId) {\n throw new Error(\"Transient Id sequences do not intersect\");\n }\n\n if (initialLocalId > currentLocalId) {\n throw new Error(\"Current local Id cannot be less than initial local Id\");\n }\n\n const delta = this.currentLocalId - initialLocalId;\n this._localId += currentLocalId - initialLocalId;\n\n return (sourceLocalId: number) => {\n if (sourceLocalId > initialLocalId && sourceLocalId <= currentLocalId) {\n return sourceLocalId + delta;\n }\n\n return sourceLocalId;\n };\n }\n}\n\n/**\n * The Guid namespace provides facilities for working with GUID strings using the \"8-4-4-4-12\" pattern.\n *\n * The [[GuidString]] type alias is used to indicate function arguments, return types, and variables which are known to\n * be in the GUID format.\n * @public\n */\nexport namespace Guid {\n const uuidPattern = new RegExp(\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\");\n\n /** Represents the empty Guid 00000000-0000-0000-0000-000000000000 */\n export const empty: GuidString = \"00000000-0000-0000-0000-000000000000\";\n\n /** Determine whether the input string is \"guid-like\". That is, it follows the 8-4-4-4-12 pattern. This does not enforce\n * that the string is actually in valid UUID format.\n */\n export function isGuid(value: string): boolean {\n return uuidPattern.test(value);\n }\n\n /** Determine whether the input string is a valid V4 Guid string */\n export function isV4Guid(value: string): boolean {\n return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(value);\n }\n\n /** Create a new V4 Guid value */\n export function createValue(): GuidString {\n // https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = Math.random() * 16 | 0;\n const v = c === \"x\" ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n\n /**\n * Normalize a Guid string if possible. Normalization consists of:\n * - Convert all characters to lower case\n * - Trim any leading or trailing whitespace\n * - Convert to the standard Guid format \"8-4-4-4-12\", repositioning the '-' characters as necessary, presuming there are exactly 32 hexadecimal digits.\n * @param value Input value that represents a Guid\n * @returns Normalized representation of the Guid string. If the normalization fails, return the *original* value unmodified (Note: it is *not* a valid Guid)\n */\n export function normalize(value: GuidString): GuidString {\n const lowerValue = value.toLowerCase().trim();\n\n // Return if it's already formatted to be a Guid\n if (isGuid(lowerValue))\n return lowerValue;\n\n // Remove any existing \"-\" characters and position them properly, if there remains exactly 32 hexadecimal digits\n const noDashValue = lowerValue.replace(/-/g, \"\");\n const noDashPattern = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/;\n if (noDashPattern.test(noDashValue)) {\n return noDashValue.replace(noDashPattern,\n (_match: string, p1: string, p2: string, p3: string, p4: string, p5: string) =>\n `${p1}-${p2}-${p3}-${p4}-${p5}`);\n }\n\n // Return unmodified string - (note: it is *not* a valid Guid)\n return value;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Id.js","sourceRoot":"","sources":["../../src/Id.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA4BH,SAAS,KAAK,CAAC,GAAW;IACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW,EAAE,KAAa;IAC5D,OAAO,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,m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AED,8DAA8D;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAlBe,cAAS,YAkBxB,CAAA;AACH,CAAC,EAlDgB,IAAI,oBAAJ,IAAI,QAkDpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Ids\n */\n\n/** A string containing a well-formed string representation of an [Id64]($core-bentley).\n * See [Working with Ids]($docs/learning/common/Id64.md).\n * @public\n */\nexport type Id64String = string;\n\n/** A string containing a well-formed string representation of a [Guid]($core-bentley).\n * @public\n */\nexport type GuidString = string;\n\n/** A set of [[Id64String]]s.\n * @public\n */\nexport type Id64Set = Set<Id64String>;\n\n/** An array of [[Id64String]]s.\n * @public\n */\nexport type Id64Array = Id64String[];\n\n/** Used as an argument to a function that can accept one or more [[Id64String]]s.\n * @public\n */\nexport type Id64Arg = Id64String | Id64Set | Id64Array;\n\nfunction toHex(str: string): number {\n const v = parseInt(str, 16);\n return Number.isNaN(v) ? 0 : v;\n}\n\nfunction isLowerCaseNonZeroHexDigit(str: string, index: number) {\n return isLowerCaseHexDigit(str, index, false);\n}\n\nfunction isLowerCaseHexDigit(str: string, index: number, allowZero: boolean = true): boolean {\n const charCode = str.charCodeAt(index);\n const minDecimalDigit = allowZero ? 0x30 : 0x31; // '0' or '1'...\n return (charCode >= minDecimalDigit && charCode <= 0x39) || (charCode >= 0x61 && charCode <= 0x66); // '0'-'9, 'a' -'f'\n}\n\nfunction isValidHexString(id: string, startIndex: number, len: number) {\n if (len === 0)\n return false;\n\n // No leading zeroes...\n if (!isLowerCaseNonZeroHexDigit(id, startIndex))\n return false;\n\n // ...followed by len-1 lowercase hexadecimal digits.\n for (let i = 1; i < len; i++)\n if (!isLowerCaseHexDigit(id, startIndex + i))\n return false;\n\n return true;\n}\n\n/**\n * The Id64 namespace provides facilities for working with 64-bit identifiers. These Ids are stored as 64-bit integers inside an [[IModelDb]], but must be represented\n * as strings in JavaScript because JavaScript does not intrinsically support 64-bit integers.\n *\n * The [[Id64String]] type alias is used to indicate function arguments, return types, and variables which are known to contain a well-formed representation of a 64-bit Id.\n *\n * See [Working with Ids]($docs/learning/common/Id64.md) for a detailed description and code examples.\n * @public\n */\nexport namespace Id64 {\n /** Extract the \"local\" Id portion of an Id64String, contained in the lower 40 bits of the 64-bit value. */\n export function getLocalId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n const start = (len > 12) ? (len - 10) : 2;\n return toHex(id.slice(start));\n }\n\n /** Extract the briefcase Id portion of an Id64String, contained in the upper 24 bits of the 64-bit value. */\n export function getBriefcaseId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n return (len <= 12) ? 0 : toHex(id.slice(2, len - 10));\n }\n\n /** Create an Id64String from its JSON representation.\n * @param prop The JSON representation of an Id.\n * @returns A well-formed Id string.\n * @note if the input is undefined, the result is \"0\", indicating an invalid Id.\n * @note if the input is not undefined, the result is the same as that of [[Id64.fromString]].\n */\n export function fromJSON(prop?: string): Id64String {\n return typeof prop === \"string\" ? Id64.fromString(prop) : Id64.invalid;\n }\n\n /** Given a string value, attempt to normalize it into a well-formed Id string.\n * If the input is already a well-formed Id string, it is returned unmodified.\n * Otherwise, the input is trimmed of leading and trailing whitespace, converted to lowercase, and an attempt is made to parse it as a 64-bit hexadecimal integer.\n * If parsing succeeds the normalized result is returned; otherwise the result is \"0\", indicating an invalid Id.\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n */\n export function fromString(val: string): Id64String {\n // NB: in case this is called from JavaScript, we must check the run-time type...\n if (typeof val !== \"string\")\n return invalid;\n\n // Skip the common case in which the input is already a well-formed Id string\n if (Id64.isId64(val))\n return val;\n\n // Attempt to normalize the input into a well-formed Id string\n val = val.toLowerCase().trim();\n const len = val.length;\n if (len < 2 || val[0] !== \"0\" || val[1] !== \"x\")\n return invalid;\n\n let low = 0;\n let high = 0;\n let start = 2;\n if (len > 12) {\n start = (len - 10);\n high = toHex(val.slice(2, start));\n }\n\n low = toHex(val.slice(start));\n return fromLocalAndBriefcaseIds(low, high);\n }\n\n // Used when constructing local ID portion of Id64String. Performance optimization.\n const _localIdPrefixByLocalIdLength = [\n \"0000000000\",\n \"000000000\",\n \"00000000\",\n \"0000000\",\n \"000000\",\n \"00000\",\n \"0000\",\n \"000\",\n \"00\",\n \"0\",\n \"\",\n ];\n\n /** Produce an Id string from a local and briefcase Id.\n * @param localId The non-zero local Id as an unsigned 40-bit integer.\n * @param briefcaseId The briefcase Id as an unsigned 24-bit integer.\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `localId | (briefcaseId << 40)`, or an invalid Id \"0\" if the inputs are invalid.\n */\n export function fromLocalAndBriefcaseIds(localId: number, briefcaseId: number): Id64String {\n // NB: Yes, we must check the run-time type...\n if (typeof localId !== \"number\" || typeof briefcaseId !== \"number\")\n return invalid;\n\n localId = Math.floor(localId);\n if (0 === localId)\n return invalid;\n\n briefcaseId = Math.floor(briefcaseId);\n const lowStr = localId.toString(16);\n return `0x${(briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr))}`;\n }\n\n // Used as a buffer when converting a pair of 32-bit integers to an Id64String. Significant performance optimization.\n const scratchCharCodes = [\n 0x30, // \"0\"\n 0x78, // \"x\"\n 0x30, // \"0\"\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n ];\n\n // Convert 4-bit unsigned integer to char code representing lower-case hexadecimal digit.\n function uint4ToCharCode(uint4: number): number {\n return uint4 + (uint4 < 10 ? 0x30 : 0x57);\n }\n\n // Convert char code representing lower-case hexadecimal digit to 4-bit unsigned integer.\n function charCodeToUint4(char: number): number {\n return char - (char >= 0x57 ? 0x57 : 0x30);\n }\n\n // Convert a substring to a uint32. This is twice as fast as using Number.parseInt().\n function substringToUint32(id: Id64String, start: number, end: number): number {\n let uint32 = 0;\n for (let i = start; i < end; i++) {\n const uint4 = charCodeToUint4(id.charCodeAt(i));\n const shift = (end - i - 1) << 2;\n const mask = uint4 << shift;\n uint32 = (uint32 | mask) >>> 0; // >>> 0 to force unsigned because javascript\n }\n\n return uint32;\n }\n\n /** Create an Id64String from a pair of unsigned 32-bit integers.\n * @param lowBytes The lower 4 bytes of the Id\n * @param highBytes The upper 4 bytes of the Id\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `lowBytes | (highBytes << 32)`.\n * @see [[Id64.fromUint32PairObject]] if you have a [[Id64.Uint32Pair]] object.\n */\n export function fromUint32Pair(lowBytes: number, highBytes: number): Id64String {\n const localIdLow = lowBytes >>> 0;\n const localIdHigh = (highBytes & 0x000000ff) * (0xffffffff + 1); // aka (highBytes & 0xff) << 32\n const localId = localIdLow + localIdHigh; // aka localIdLow | localIdHigh\n if (0 === localId)\n return invalid;\n\n // Need to omit or preserve leading zeroes...\n const buffer = scratchCharCodes;\n let index = 2;\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (highBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (lowBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n if (buffer.length !== index)\n buffer.length = index;\n\n return String.fromCharCode(...scratchCharCodes);\n }\n\n /** Create an Id64String from a [[Id64.Uint32Pair]].\n * @see [[Id64.fromUint32Pair]].\n */\n export function fromUint32PairObject(pair: Uint32Pair): Id64String {\n return fromUint32Pair(pair.lower, pair.upper);\n }\n\n /** Returns true if the inputs represent two halves of a valid 64-bit Id.\n * @see [[Id64.Uint32Pair]].\n */\n export function isValidUint32Pair(lowBytes: number, highBytes: number): boolean {\n // Detect local ID of zero\n return 0 !== lowBytes || 0 !== (highBytes & 0x000000ff);\n }\n\n /** Represents an [[Id64]] as a pair of unsigned 32-bit integers. Because Javascript lacks efficient support for 64-bit integers,\n * this representation can be useful in performance-sensitive code like the render loop.\n * @see [[Id64.getUint32Pair]] to convert an [[Id64String]] to a Uint32Pair.\n * @see [[Id64.fromUint32Pair]] to convert a Uint32Pair to an [[Id64String]].\n * @see [[Id64.Uint32Set]] and [[Id64.Uint32Map]] for collections based on Uint32Pairs.\n */\n export interface Uint32Pair {\n /** The lower 4 bytes of the 64-bit integer. */\n lower: number;\n /** The upper 4 bytes of the 64-bit integer. */\n upper: number;\n }\n\n /** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.\n * @param id The well-formed string representation of a 64-bit Id.\n * @param out Used as the return value if supplied; otherwise a new object is returned.\n * @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.\n */\n export function getUint32Pair(id: Id64String, out?: Uint32Pair): Uint32Pair {\n if (!out)\n out = { lower: 0, upper: 0 };\n\n out.lower = getLowerUint32(id);\n out.upper = getUpperUint32(id);\n return out;\n }\n\n /** Extract an unsigned 32-bit integer from the lower 4 bytes of an Id64String. */\n export function getLowerUint32(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const end = id.length;\n const start = end > 10 ? end - 8 : 2;\n return substringToUint32(id, start, end);\n }\n\n /** Extract an unsigned 32-bit integer from the upper 4 bytes of an Id64String. */\n export function getUpperUint32(id: Id64String): number {\n const len = id.length;\n if (len <= 10 || isInvalid(id))\n return 0;\n\n return substringToUint32(id, 2, len - 8);\n }\n\n /** Convert an [[Id64Arg]] into an [[Id64Set]].\n *\n * This method can be used by functions that accept an Id64Arg to conveniently process the value(s). For example:\n * ```ts\n * public addCategories(arg: Id64Arg) { Id64.toIdSet(arg).forEach((id) => this.categories.add(id)); }\n * ```\n *\n * Alternatively, to avoid allocating a new Id64Set, use [[Id64.iterable]].\n *\n * @param arg The Ids to convert to an Id64Set.\n * @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input.\n * @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg.\n */\n export function toIdSet(arg: Id64Arg, makeCopy: boolean = false): Id64Set {\n if (arg instanceof Set)\n return makeCopy ? new Set<string>(arg) : arg;\n\n const ids = new Set<Id64String>();\n if (typeof arg === \"string\")\n ids.add(arg);\n else if (Array.isArray(arg)) {\n arg.forEach((id: Id64String) => {\n if (typeof id === \"string\")\n ids.add(id);\n });\n }\n\n return ids;\n }\n\n /** Obtain iterator over the specified Ids.\n * @see [[Id64.iterable]].\n */\n export function* iterator(ids: Id64Arg): Iterator<Id64String> {\n if (typeof ids === \"string\") {\n yield ids;\n } else {\n for (const id of ids)\n yield id;\n }\n }\n\n /** Obtain an iterable over the specified Ids. Example usage:\n * ```ts\n * const ids = [\"0x123\", \"0xfed\"];\n * for (const id of Id64.iterable(ids))\n * console.log(id);\n * ```\n */\n export function iterable(ids: Id64Arg): Iterable<Id64String> {\n return {\n [Symbol.iterator]: () => iterator(ids),\n };\n }\n\n /** Return the first [[Id64String]] of an [[Id64Arg]]. */\n export function getFirst(arg: Id64Arg): Id64String {\n return typeof arg === \"string\" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value) ?? Id64.invalid;\n }\n\n /** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */\n export function sizeOf(arg: Id64Arg): number {\n return typeof arg === \"string\" ? 1 : (Array.isArray(arg) ? arg.length : arg.size);\n }\n\n /** Returns true if the [[Id64Arg]] contains the specified Id. */\n export function has(arg: Id64Arg, id: Id64String): boolean {\n if (typeof arg === \"string\")\n return arg === id;\n if (Array.isArray(arg))\n return -1 !== arg.indexOf(id);\n\n return arg.has(id);\n }\n\n /** The string representation of an invalid Id. */\n export const invalid = \"0\";\n\n /** Determine if the supplied id string represents a transient Id.\n * @param id A well-formed Id string.\n * @returns true if the Id represents a transient Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isTransientId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransient(id: Id64String): boolean {\n // A transient Id is of the format \"0xffffffxxxxxxxxxx\" where the leading 6 digits indicate an invalid briefcase Id.\n return 18 === id.length && id.startsWith(\"0xffffff\");\n }\n\n /** Determine if the input is a well-formed [[Id64String]] and represents a transient Id.\n * @see [[Id64.isTransient]]\n * @see [[Id64.isId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransientId64(id: string): boolean {\n return isValidId64(id) && isTransient(id);\n }\n\n /** Determine if the input is a well-formed [[Id64String]].\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n * @see [[Id64.isValidId64]]\n */\n export function isId64(id: string): boolean {\n const len = id.length;\n if (0 === len || 18 < len)\n return false;\n\n if (\"0\" !== id[0])\n return false;\n\n // Well-formed invalid Id: \"0\"\n if (1 === len)\n return true;\n\n // Valid Ids begin with \"0x\" followed by at least one lower-case hexadecimal digit.\n if (2 === len || \"x\" !== id[1])\n return false;\n\n // If briefcase Id is present, it occupies at least one digit, followed by 10 digits for local Id\n let localIdStart = 2;\n if (len > 12) {\n localIdStart = len - 10;\n\n // Verify briefcase Id\n if (!isValidHexString(id, 2, localIdStart - 2))\n return false;\n\n // Skip leading zeroes in local Id\n for (let i = localIdStart; i < len; i++) {\n if (0x30 !== id.charCodeAt(i)) // '0'\n break;\n else\n localIdStart++;\n }\n\n if (localIdStart >= len)\n return false;\n }\n\n return isValidHexString(id, localIdStart, len - localIdStart);\n }\n\n /** Returns true if the input is not equal to the representation of an invalid Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isInvalid]]\n * @see [[Id64.isValidId64]]\n */\n export function isValid(id: Id64String): boolean {\n return Id64.invalid !== id;\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing a valid Id.\n * @see [[Id64.isValid]]\n * @see [[Id64.isId64]]\n */\n export function isValidId64(id: string): boolean {\n return Id64.invalid !== id && Id64.isId64(id);\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing an invalid Id.\n * @see [[Id64.isValid]]\n */\n export function isInvalid(id: Id64String): boolean {\n return Id64.invalid === id;\n }\n\n /** A specialized replacement for Set<Id64String> optimized for performance-critical code which represents large sets of [[Id64]]s as pairs of\n * 32-bit integers.\n * The internal representation is a Map<number, Set<number>> where the Map key is the upper 4 bytes of the IDs and the Set elements are the lower 4 bytes of the IDs.\n * Because the upper 4 bytes store the 24-bit briefcase ID plus the upper 8 bits of the local ID, there will be a very small distribution of unique Map keys.\n * To further optimize this data type, the following assumptions are made regarding the { lower, upper } inputs, and no validation is performed to confirm them:\n * - The inputs are unsigned 32-bit integers;\n * - The inputs represent a valid Id64String (e.g., local ID is not zero).\n * @see [[Id64.Uint32Map]] for a similarly-optimized replacement for Map<Id64String, T>\n * @public\n */\n export class Uint32Set {\n protected readonly _map = new Map<number, Set<number>>();\n\n /** Construct a new Uint32Set.\n * @param ids If supplied, all of the specified Ids will be added to the new set.\n */\n public constructor(ids?: Id64Arg) {\n if (undefined !== ids)\n this.addIds(ids);\n }\n\n /** Return true if `this` and `other` contain the same set of Ids. */\n public equals(other: Uint32Set): boolean {\n if (this === other) {\n return true;\n }\n\n if (this.size !== other.size) {\n return false;\n }\n\n for (const [key, thisValue] of this._map) {\n const otherValue = other._map.get(key);\n if (!otherValue || thisValue.size !== otherValue.size) {\n return false;\n }\n\n for (const value of thisValue) {\n if (!otherValue.has(value)) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /** Remove all contents of this set. */\n public clear(): void {\n this._map.clear();\n }\n\n /** Add an Id to the set. */\n public addId(id: Id64String): void {\n this.add(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Add any number of Ids to the set. */\n public addIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.addId(id);\n }\n\n /** Returns true if the set contains the specified Id. */\n public hasId(id: Id64String): boolean { return this.has(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n\n /** Add an Id to the set. */\n public add(low: number, high: number): void {\n let set = this._map.get(high);\n if (undefined === set) {\n set = new Set<number>();\n this._map.set(high, set);\n }\n\n set.add(low);\n }\n\n /** Remove an Id from the set. */\n public deleteId(id: Id64String): void {\n this.delete(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Remove any number of Ids from the set. */\n public deleteIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.deleteId(id);\n }\n\n /** Remove an Id from the set. */\n public delete(low: number, high: number): void {\n const set = this._map.get(high);\n if (undefined !== set) {\n set.delete(low);\n if (set.size === 0)\n this._map.delete(high);\n }\n }\n\n /** Returns true if the set contains the specified Id. */\n public has(low: number, high: number): boolean {\n const set = this._map.get(high);\n return undefined !== set && set.has(low);\n }\n\n /** Returns true if the set contains the Id specified by `pair`. */\n public hasPair(pair: Uint32Pair): boolean {\n return this.has(pair.lower, pair.upper);\n }\n\n /** Returns true if the set contains no Ids. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n\n /** Returns the number of Ids contained in the set. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Populates and returns an array of all Ids contained in the set. */\n public toId64Array(): Id64Array {\n const ids: Id64Array = [];\n for (const entry of this._map)\n for (const low of entry[1])\n ids.push(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Populates and returns a set of all Ids contained in the set. */\n public toId64Set(): Id64Set {\n const ids = new Set<string>();\n for (const entry of this._map)\n for (const low of entry[1])\n ids.add(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Execute a function against each Id in this set. */\n public forEach(func: (lo: number, hi: number) => void): void {\n for (const entry of this._map)\n for (const lo of entry[1])\n func(lo, entry[0]);\n }\n }\n\n /** A specialized replacement for Map<Id64String, T> optimized for performance-critical code.\n * @see [[Id64.Uint32Set]] for implementation details.\n * @public\n */\n export class Uint32Map<T> {\n protected readonly _map = new Map<number, Map<number, T>>();\n\n /** Remove all entries from the map. */\n public clear(): void { this._map.clear(); }\n /** Find an entry in the map by Id. */\n public getById(id: Id64String): T | undefined { return this.get(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n /** Set an entry in the map by Id. */\n public setById(id: Id64String, value: T): void { this.set(Id64.getLowerUint32(id), Id64.getUpperUint32(id), value); }\n\n /** Set an entry in the map by Id components. */\n public set(low: number, high: number, value: T): void {\n let map = this._map.get(high);\n if (undefined === map) {\n map = new Map<number, T>();\n this._map.set(high, map);\n }\n\n map.set(low, value);\n }\n\n /** Get an entry from the map by Id components. */\n public get(low: number, high: number): T | undefined {\n const map = this._map.get(high);\n return undefined !== map ? map.get(low) : undefined;\n }\n\n /** Returns true if the map contains no entries. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n /** Returns the number of entries in the map. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Execute a function against each entry in this map. */\n public forEach(func: (lo: number, hi: number, value: T) => void): void {\n for (const outerEntry of this._map)\n for (const innerEntry of outerEntry[1])\n func(innerEntry[0], outerEntry[0], innerEntry[1]);\n }\n }\n}\n\n/** JSON representation of a [[TransientIdSequence]], primarily useful for transferring sequences to and from a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * It stores two \"local\" 40-bit Ids describing the range of [Id64String]($docs/learning/common/Id64.md)s generated by the sequence.\n * @public\n */\nexport interface TransientIdSequenceProps {\n /** The starting local Id. The sequence begins at `initialLocalId + 1`. */\n initialLocalId: number;\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * The next local Id generated by the sequence will be `currentLocalId + 1`.\n */\n currentLocalId: number;\n}\n\nfunction validateLocalId(num: number): void {\n if (num < 0 || Math.round(num) !== num) {\n throw new Error(\"Local Id must be a non-negative integer\");\n }\n}\n\n/** A function returned by [[TransientIdSequence.merge]] that remaps the local Id portion of an [Id64String]($docs/learning/common/Id64.md) generated by\n * the source sequence to the corresponding local Id in the target sequence.\n * It returns `sourceLocalId` if the input did not originate from the source sequence.\n* @public\n*/\nexport type RemapTransientLocalId = (sourceLocalId: number) => number;\n\n/**\n * Generates unique [[Id64String]] values in sequence, which are guaranteed not to conflict with Ids associated with persistent elements or models.\n * This is useful for associating stable, non-persistent identifiers with things like [Decorator]($frontend)s.\n * A TransientIdSequence can generate a maximum of (2^40)-2 unique Ids.\n * @public\n */\nexport class TransientIdSequence {\n /** The starting local Id provided to the constructor. The sequence begins at `initialLocalId + 1`. */\n public readonly initialLocalId: number;\n private _localId: number;\n\n /** Constructor.\n * @param initialLocalId The starting local Id. The local Id of the first [[Id64String]] generated by [[getNext]] will be `initialLocalId + 1`.\n */\n public constructor(initialLocalId = 0) {\n validateLocalId(initialLocalId);\n this.initialLocalId = initialLocalId;\n this._localId = initialLocalId;\n }\n\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * Each call to [[getNext]] increments this by 1 and uses it as the local Id of the generated [[Id64String]].\n */\n public get currentLocalId(): number {\n return this._localId;\n }\n\n /** Generate and return the next transient Id64String in the sequence. */\n public getNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(++this._localId, 0xffffff);\n }\n\n /** Preview the transient Id64String that will be returned by the next call to [[getNext]].\n * This is primarily useful for tests.\n */\n public peekNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(this._localId + 1, 0xffffff);\n }\n\n /** Convert this sequence to its JSON representation. */\n public toJSON(): TransientIdSequenceProps {\n return {\n initialLocalId: this.initialLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Create a sequence from its JSON representation. */\n public static fromJSON(props: TransientIdSequenceProps): TransientIdSequence {\n validateLocalId(props.currentLocalId);\n const sequence = new TransientIdSequence(props.initialLocalId);\n sequence._localId = props.currentLocalId;\n return sequence;\n }\n\n /** Obtain the JSON representation of a new sequence that diverges from this sequence, with its [[initialLocalId]] set to this sequence's [[currentLocalId]].\n * The two sequences can generate Ids independently. Later, you can [[merge]] the sequences, resolving conflicts where the two sequences generated identical Ids.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n */\n public fork(): TransientIdSequenceProps {\n return {\n initialLocalId: this.currentLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Integrate the Ids generated by a [[fork]] of this sequence. All of the Ids generated by `source` will be remapped to Ids at the end of this sequence.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * @param source The JSON representation of the [[fork]]ed sequence to be merged with this one.\n * @returns a function that permits you to remap the local Ids generated by `source` into the corresponding local Ids assigned by this sequence.\n * @throws Error if `source` is not a fork of this sequence or is malformed (e.g., contains negative and/or non-integer local Ids).\n */\n public merge(source: TransientIdSequenceProps): (sourceLocalId: number) => number {\n const { initialLocalId, currentLocalId } = source;\n\n validateLocalId(initialLocalId);\n validateLocalId(currentLocalId);\n\n if (initialLocalId > this.currentLocalId) {\n throw new Error(\"Transient Id sequences do not intersect\");\n }\n\n if (initialLocalId > currentLocalId) {\n throw new Error(\"Current local Id cannot be less than initial local Id\");\n }\n\n const delta = this.currentLocalId - initialLocalId;\n this._localId += currentLocalId - initialLocalId;\n\n return (sourceLocalId: number) => {\n if (sourceLocalId > initialLocalId && sourceLocalId <= currentLocalId) {\n return sourceLocalId + delta;\n }\n\n return sourceLocalId;\n };\n }\n}\n\n/**\n * The Guid namespace provides facilities for working with GUID strings using the \"8-4-4-4-12\" pattern.\n *\n * The [[GuidString]] type alias is used to indicate function arguments, return types, and variables which are known to\n * be in the GUID format.\n * @public\n */\nexport namespace Guid {\n const uuidPattern = new RegExp(\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\");\n\n /** Represents the empty Guid 00000000-0000-0000-0000-000000000000 */\n export const empty: GuidString = \"00000000-0000-0000-0000-000000000000\";\n\n /** Determine whether the input string is \"guid-like\". That is, it follows the 8-4-4-4-12 pattern. This does not enforce\n * that the string is actually in valid UUID format.\n */\n export function isGuid(value: string): boolean {\n return uuidPattern.test(value);\n }\n\n /** Determine whether the input string is a valid V4 Guid string */\n export function isV4Guid(value: string): boolean {\n return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(value);\n }\n\n /** Create a new V4 Guid value */\n export function createValue(): GuidString {\n return crypto.randomUUID();\n }\n\n /**\n * Normalize a Guid string if possible. Normalization consists of:\n * - Convert all characters to lower case\n * - Trim any leading or trailing whitespace\n * - Convert to the standard Guid format \"8-4-4-4-12\", repositioning the '-' characters as necessary, presuming there are exactly 32 hexadecimal digits.\n * @param value Input value that represents a Guid\n * @returns Normalized representation of the Guid string. If the normalization fails, return the *original* value unmodified (Note: it is *not* a valid Guid)\n */\n export function normalize(value: GuidString): GuidString {\n const lowerValue = value.toLowerCase().trim();\n\n // Return if it's already formatted to be a Guid\n if (isGuid(lowerValue))\n return lowerValue;\n\n // Remove any existing \"-\" characters and position them properly, if there remains exactly 32 hexadecimal digits\n const noDashValue = lowerValue.replace(/-/g, \"\");\n const noDashPattern = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/;\n if (noDashPattern.test(noDashValue)) {\n return noDashValue.replace(noDashPattern,\n (_match: string, p1: string, p2: string, p3: string, p4: string, p5: string) =>\n `${p1}-${p2}-${p3}-${p4}-${p5}`);\n }\n\n // Return unmodified string - (note: it is *not* a valid Guid)\n return value;\n }\n}\n"]}
|
package/lib/esm/Id.d.ts.map
CHANGED
|
@@ -1 +1 @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,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7C;IAED,mEAAmE;IACnE,SAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/C;IAED,iCAAiC;IACjC,SAAgB,WAAW,IAAI,UAAU,CAExC;IAED;;;;;;;OAOG;IACH,SAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAkBvD;CACF"}
|
package/lib/esm/Id.js
CHANGED
|
@@ -690,12 +690,7 @@ export var Guid;
|
|
|
690
690
|
Guid.isV4Guid = isV4Guid;
|
|
691
691
|
/** Create a new V4 Guid value */
|
|
692
692
|
function createValue() {
|
|
693
|
-
|
|
694
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
695
|
-
const r = Math.random() * 16 | 0;
|
|
696
|
-
const v = c === "x" ? r : (r & 0x3 | 0x8);
|
|
697
|
-
return v.toString(16);
|
|
698
|
-
});
|
|
693
|
+
return crypto.randomUUID();
|
|
699
694
|
}
|
|
700
695
|
Guid.createValue = createValue;
|
|
701
696
|
/**
|
package/lib/esm/Id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Id.js","sourceRoot":"","sources":["../../src/Id.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AA4BH,SAAS,KAAK,CAAC,GAAW;IACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW,EAAE,KAAa;IAC5D,OAAO,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW,EAAE,KAAa,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AAsE,CAAC;QAC7F,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACpC,OAAO,WAAW,CAAC,OAAO,CAAC,aAAa,EACtC,CAAC,MAAc,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CAC7E,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,8DAA8D;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAlBe,cAAS,YAkBxB,CAAA;AACH,CAAC,EAvDgB,IAAI,KAAJ,IAAI,QAuDpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Ids\n */\n\n/** A string containing a well-formed string representation of an [Id64]($core-bentley).\n * See [Working with Ids]($docs/learning/common/Id64.md).\n * @public\n */\nexport type Id64String = string;\n\n/** A string containing a well-formed string representation of a [Guid]($core-bentley).\n * @public\n */\nexport type GuidString = string;\n\n/** A set of [[Id64String]]s.\n * @public\n */\nexport type Id64Set = Set<Id64String>;\n\n/** An array of [[Id64String]]s.\n * @public\n */\nexport type Id64Array = Id64String[];\n\n/** Used as an argument to a function that can accept one or more [[Id64String]]s.\n * @public\n */\nexport type Id64Arg = Id64String | Id64Set | Id64Array;\n\nfunction toHex(str: string): number {\n const v = parseInt(str, 16);\n return Number.isNaN(v) ? 0 : v;\n}\n\nfunction isLowerCaseNonZeroHexDigit(str: string, index: number) {\n return isLowerCaseHexDigit(str, index, false);\n}\n\nfunction isLowerCaseHexDigit(str: string, index: number, allowZero: boolean = true): boolean {\n const charCode = str.charCodeAt(index);\n const minDecimalDigit = allowZero ? 0x30 : 0x31; // '0' or '1'...\n return (charCode >= minDecimalDigit && charCode <= 0x39) || (charCode >= 0x61 && charCode <= 0x66); // '0'-'9, 'a' -'f'\n}\n\nfunction isValidHexString(id: string, startIndex: number, len: number) {\n if (len === 0)\n return false;\n\n // No leading zeroes...\n if (!isLowerCaseNonZeroHexDigit(id, startIndex))\n return false;\n\n // ...followed by len-1 lowercase hexadecimal digits.\n for (let i = 1; i < len; i++)\n if (!isLowerCaseHexDigit(id, startIndex + i))\n return false;\n\n return true;\n}\n\n/**\n * The Id64 namespace provides facilities for working with 64-bit identifiers. These Ids are stored as 64-bit integers inside an [[IModelDb]], but must be represented\n * as strings in JavaScript because JavaScript does not intrinsically support 64-bit integers.\n *\n * The [[Id64String]] type alias is used to indicate function arguments, return types, and variables which are known to contain a well-formed representation of a 64-bit Id.\n *\n * See [Working with Ids]($docs/learning/common/Id64.md) for a detailed description and code examples.\n * @public\n */\nexport namespace Id64 {\n /** Extract the \"local\" Id portion of an Id64String, contained in the lower 40 bits of the 64-bit value. */\n export function getLocalId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n const start = (len > 12) ? (len - 10) : 2;\n return toHex(id.slice(start));\n }\n\n /** Extract the briefcase Id portion of an Id64String, contained in the upper 24 bits of the 64-bit value. */\n export function getBriefcaseId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n return (len <= 12) ? 0 : toHex(id.slice(2, len - 10));\n }\n\n /** Create an Id64String from its JSON representation.\n * @param prop The JSON representation of an Id.\n * @returns A well-formed Id string.\n * @note if the input is undefined, the result is \"0\", indicating an invalid Id.\n * @note if the input is not undefined, the result is the same as that of [[Id64.fromString]].\n */\n export function fromJSON(prop?: string): Id64String {\n return typeof prop === \"string\" ? Id64.fromString(prop) : Id64.invalid;\n }\n\n /** Given a string value, attempt to normalize it into a well-formed Id string.\n * If the input is already a well-formed Id string, it is returned unmodified.\n * Otherwise, the input is trimmed of leading and trailing whitespace, converted to lowercase, and an attempt is made to parse it as a 64-bit hexadecimal integer.\n * If parsing succeeds the normalized result is returned; otherwise the result is \"0\", indicating an invalid Id.\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n */\n export function fromString(val: string): Id64String {\n // NB: in case this is called from JavaScript, we must check the run-time type...\n if (typeof val !== \"string\")\n return invalid;\n\n // Skip the common case in which the input is already a well-formed Id string\n if (Id64.isId64(val))\n return val;\n\n // Attempt to normalize the input into a well-formed Id string\n val = val.toLowerCase().trim();\n const len = val.length;\n if (len < 2 || val[0] !== \"0\" || val[1] !== \"x\")\n return invalid;\n\n let low = 0;\n let high = 0;\n let start = 2;\n if (len > 12) {\n start = (len - 10);\n high = toHex(val.slice(2, start));\n }\n\n low = toHex(val.slice(start));\n return fromLocalAndBriefcaseIds(low, high);\n }\n\n // Used when constructing local ID portion of Id64String. Performance optimization.\n const _localIdPrefixByLocalIdLength = [\n \"0000000000\",\n \"000000000\",\n \"00000000\",\n \"0000000\",\n \"000000\",\n \"00000\",\n \"0000\",\n \"000\",\n \"00\",\n \"0\",\n \"\",\n ];\n\n /** Produce an Id string from a local and briefcase Id.\n * @param localId The non-zero local Id as an unsigned 40-bit integer.\n * @param briefcaseId The briefcase Id as an unsigned 24-bit integer.\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `localId | (briefcaseId << 40)`, or an invalid Id \"0\" if the inputs are invalid.\n */\n export function fromLocalAndBriefcaseIds(localId: number, briefcaseId: number): Id64String {\n // NB: Yes, we must check the run-time type...\n if (typeof localId !== \"number\" || typeof briefcaseId !== \"number\")\n return invalid;\n\n localId = Math.floor(localId);\n if (0 === localId)\n return invalid;\n\n briefcaseId = Math.floor(briefcaseId);\n const lowStr = localId.toString(16);\n return `0x${(briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr))}`;\n }\n\n // Used as a buffer when converting a pair of 32-bit integers to an Id64String. Significant performance optimization.\n const scratchCharCodes = [\n 0x30, // \"0\"\n 0x78, // \"x\"\n 0x30, // \"0\"\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n ];\n\n // Convert 4-bit unsigned integer to char code representing lower-case hexadecimal digit.\n function uint4ToCharCode(uint4: number): number {\n return uint4 + (uint4 < 10 ? 0x30 : 0x57);\n }\n\n // Convert char code representing lower-case hexadecimal digit to 4-bit unsigned integer.\n function charCodeToUint4(char: number): number {\n return char - (char >= 0x57 ? 0x57 : 0x30);\n }\n\n // Convert a substring to a uint32. This is twice as fast as using Number.parseInt().\n function substringToUint32(id: Id64String, start: number, end: number): number {\n let uint32 = 0;\n for (let i = start; i < end; i++) {\n const uint4 = charCodeToUint4(id.charCodeAt(i));\n const shift = (end - i - 1) << 2;\n const mask = uint4 << shift;\n uint32 = (uint32 | mask) >>> 0; // >>> 0 to force unsigned because javascript\n }\n\n return uint32;\n }\n\n /** Create an Id64String from a pair of unsigned 32-bit integers.\n * @param lowBytes The lower 4 bytes of the Id\n * @param highBytes The upper 4 bytes of the Id\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `lowBytes | (highBytes << 32)`.\n * @see [[Id64.fromUint32PairObject]] if you have a [[Id64.Uint32Pair]] object.\n */\n export function fromUint32Pair(lowBytes: number, highBytes: number): Id64String {\n const localIdLow = lowBytes >>> 0;\n const localIdHigh = (highBytes & 0x000000ff) * (0xffffffff + 1); // aka (highBytes & 0xff) << 32\n const localId = localIdLow + localIdHigh; // aka localIdLow | localIdHigh\n if (0 === localId)\n return invalid;\n\n // Need to omit or preserve leading zeroes...\n const buffer = scratchCharCodes;\n let index = 2;\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (highBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (lowBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n if (buffer.length !== index)\n buffer.length = index;\n\n return String.fromCharCode(...scratchCharCodes);\n }\n\n /** Create an Id64String from a [[Id64.Uint32Pair]].\n * @see [[Id64.fromUint32Pair]].\n */\n export function fromUint32PairObject(pair: Uint32Pair): Id64String {\n return fromUint32Pair(pair.lower, pair.upper);\n }\n\n /** Returns true if the inputs represent two halves of a valid 64-bit Id.\n * @see [[Id64.Uint32Pair]].\n */\n export function isValidUint32Pair(lowBytes: number, highBytes: number): boolean {\n // Detect local ID of zero\n return 0 !== lowBytes || 0 !== (highBytes & 0x000000ff);\n }\n\n /** Represents an [[Id64]] as a pair of unsigned 32-bit integers. Because Javascript lacks efficient support for 64-bit integers,\n * this representation can be useful in performance-sensitive code like the render loop.\n * @see [[Id64.getUint32Pair]] to convert an [[Id64String]] to a Uint32Pair.\n * @see [[Id64.fromUint32Pair]] to convert a Uint32Pair to an [[Id64String]].\n * @see [[Id64.Uint32Set]] and [[Id64.Uint32Map]] for collections based on Uint32Pairs.\n */\n export interface Uint32Pair {\n /** The lower 4 bytes of the 64-bit integer. */\n lower: number;\n /** The upper 4 bytes of the 64-bit integer. */\n upper: number;\n }\n\n /** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.\n * @param id The well-formed string representation of a 64-bit Id.\n * @param out Used as the return value if supplied; otherwise a new object is returned.\n * @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.\n */\n export function getUint32Pair(id: Id64String, out?: Uint32Pair): Uint32Pair {\n if (!out)\n out = { lower: 0, upper: 0 };\n\n out.lower = getLowerUint32(id);\n out.upper = getUpperUint32(id);\n return out;\n }\n\n /** Extract an unsigned 32-bit integer from the lower 4 bytes of an Id64String. */\n export function getLowerUint32(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const end = id.length;\n const start = end > 10 ? end - 8 : 2;\n return substringToUint32(id, start, end);\n }\n\n /** Extract an unsigned 32-bit integer from the upper 4 bytes of an Id64String. */\n export function getUpperUint32(id: Id64String): number {\n const len = id.length;\n if (len <= 10 || isInvalid(id))\n return 0;\n\n return substringToUint32(id, 2, len - 8);\n }\n\n /** Convert an [[Id64Arg]] into an [[Id64Set]].\n *\n * This method can be used by functions that accept an Id64Arg to conveniently process the value(s). For example:\n * ```ts\n * public addCategories(arg: Id64Arg) { Id64.toIdSet(arg).forEach((id) => this.categories.add(id)); }\n * ```\n *\n * Alternatively, to avoid allocating a new Id64Set, use [[Id64.iterable]].\n *\n * @param arg The Ids to convert to an Id64Set.\n * @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input.\n * @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg.\n */\n export function toIdSet(arg: Id64Arg, makeCopy: boolean = false): Id64Set {\n if (arg instanceof Set)\n return makeCopy ? new Set<string>(arg) : arg;\n\n const ids = new Set<Id64String>();\n if (typeof arg === \"string\")\n ids.add(arg);\n else if (Array.isArray(arg)) {\n arg.forEach((id: Id64String) => {\n if (typeof id === \"string\")\n ids.add(id);\n });\n }\n\n return ids;\n }\n\n /** Obtain iterator over the specified Ids.\n * @see [[Id64.iterable]].\n */\n export function* iterator(ids: Id64Arg): Iterator<Id64String> {\n if (typeof ids === \"string\") {\n yield ids;\n } else {\n for (const id of ids)\n yield id;\n }\n }\n\n /** Obtain an iterable over the specified Ids. Example usage:\n * ```ts\n * const ids = [\"0x123\", \"0xfed\"];\n * for (const id of Id64.iterable(ids))\n * console.log(id);\n * ```\n */\n export function iterable(ids: Id64Arg): Iterable<Id64String> {\n return {\n [Symbol.iterator]: () => iterator(ids),\n };\n }\n\n /** Return the first [[Id64String]] of an [[Id64Arg]]. */\n export function getFirst(arg: Id64Arg): Id64String {\n return typeof arg === \"string\" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value) ?? Id64.invalid;\n }\n\n /** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */\n export function sizeOf(arg: Id64Arg): number {\n return typeof arg === \"string\" ? 1 : (Array.isArray(arg) ? arg.length : arg.size);\n }\n\n /** Returns true if the [[Id64Arg]] contains the specified Id. */\n export function has(arg: Id64Arg, id: Id64String): boolean {\n if (typeof arg === \"string\")\n return arg === id;\n if (Array.isArray(arg))\n return -1 !== arg.indexOf(id);\n\n return arg.has(id);\n }\n\n /** The string representation of an invalid Id. */\n export const invalid = \"0\";\n\n /** Determine if the supplied id string represents a transient Id.\n * @param id A well-formed Id string.\n * @returns true if the Id represents a transient Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isTransientId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransient(id: Id64String): boolean {\n // A transient Id is of the format \"0xffffffxxxxxxxxxx\" where the leading 6 digits indicate an invalid briefcase Id.\n return 18 === id.length && id.startsWith(\"0xffffff\");\n }\n\n /** Determine if the input is a well-formed [[Id64String]] and represents a transient Id.\n * @see [[Id64.isTransient]]\n * @see [[Id64.isId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransientId64(id: string): boolean {\n return isValidId64(id) && isTransient(id);\n }\n\n /** Determine if the input is a well-formed [[Id64String]].\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n * @see [[Id64.isValidId64]]\n */\n export function isId64(id: string): boolean {\n const len = id.length;\n if (0 === len || 18 < len)\n return false;\n\n if (\"0\" !== id[0])\n return false;\n\n // Well-formed invalid Id: \"0\"\n if (1 === len)\n return true;\n\n // Valid Ids begin with \"0x\" followed by at least one lower-case hexadecimal digit.\n if (2 === len || \"x\" !== id[1])\n return false;\n\n // If briefcase Id is present, it occupies at least one digit, followed by 10 digits for local Id\n let localIdStart = 2;\n if (len > 12) {\n localIdStart = len - 10;\n\n // Verify briefcase Id\n if (!isValidHexString(id, 2, localIdStart - 2))\n return false;\n\n // Skip leading zeroes in local Id\n for (let i = localIdStart; i < len; i++) {\n if (0x30 !== id.charCodeAt(i)) // '0'\n break;\n else\n localIdStart++;\n }\n\n if (localIdStart >= len)\n return false;\n }\n\n return isValidHexString(id, localIdStart, len - localIdStart);\n }\n\n /** Returns true if the input is not equal to the representation of an invalid Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isInvalid]]\n * @see [[Id64.isValidId64]]\n */\n export function isValid(id: Id64String): boolean {\n return Id64.invalid !== id;\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing a valid Id.\n * @see [[Id64.isValid]]\n * @see [[Id64.isId64]]\n */\n export function isValidId64(id: string): boolean {\n return Id64.invalid !== id && Id64.isId64(id);\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing an invalid Id.\n * @see [[Id64.isValid]]\n */\n export function isInvalid(id: Id64String): boolean {\n return Id64.invalid === id;\n }\n\n /** A specialized replacement for Set<Id64String> optimized for performance-critical code which represents large sets of [[Id64]]s as pairs of\n * 32-bit integers.\n * The internal representation is a Map<number, Set<number>> where the Map key is the upper 4 bytes of the IDs and the Set elements are the lower 4 bytes of the IDs.\n * Because the upper 4 bytes store the 24-bit briefcase ID plus the upper 8 bits of the local ID, there will be a very small distribution of unique Map keys.\n * To further optimize this data type, the following assumptions are made regarding the { lower, upper } inputs, and no validation is performed to confirm them:\n * - The inputs are unsigned 32-bit integers;\n * - The inputs represent a valid Id64String (e.g., local ID is not zero).\n * @see [[Id64.Uint32Map]] for a similarly-optimized replacement for Map<Id64String, T>\n * @public\n */\n export class Uint32Set {\n protected readonly _map = new Map<number, Set<number>>();\n\n /** Construct a new Uint32Set.\n * @param ids If supplied, all of the specified Ids will be added to the new set.\n */\n public constructor(ids?: Id64Arg) {\n if (undefined !== ids)\n this.addIds(ids);\n }\n\n /** Return true if `this` and `other` contain the same set of Ids. */\n public equals(other: Uint32Set): boolean {\n if (this === other) {\n return true;\n }\n\n if (this.size !== other.size) {\n return false;\n }\n\n for (const [key, thisValue] of this._map) {\n const otherValue = other._map.get(key);\n if (!otherValue || thisValue.size !== otherValue.size) {\n return false;\n }\n\n for (const value of thisValue) {\n if (!otherValue.has(value)) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /** Remove all contents of this set. */\n public clear(): void {\n this._map.clear();\n }\n\n /** Add an Id to the set. */\n public addId(id: Id64String): void {\n this.add(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Add any number of Ids to the set. */\n public addIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.addId(id);\n }\n\n /** Returns true if the set contains the specified Id. */\n public hasId(id: Id64String): boolean { return this.has(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n\n /** Add an Id to the set. */\n public add(low: number, high: number): void {\n let set = this._map.get(high);\n if (undefined === set) {\n set = new Set<number>();\n this._map.set(high, set);\n }\n\n set.add(low);\n }\n\n /** Remove an Id from the set. */\n public deleteId(id: Id64String): void {\n this.delete(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Remove any number of Ids from the set. */\n public deleteIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.deleteId(id);\n }\n\n /** Remove an Id from the set. */\n public delete(low: number, high: number): void {\n const set = this._map.get(high);\n if (undefined !== set) {\n set.delete(low);\n if (set.size === 0)\n this._map.delete(high);\n }\n }\n\n /** Returns true if the set contains the specified Id. */\n public has(low: number, high: number): boolean {\n const set = this._map.get(high);\n return undefined !== set && set.has(low);\n }\n\n /** Returns true if the set contains the Id specified by `pair`. */\n public hasPair(pair: Uint32Pair): boolean {\n return this.has(pair.lower, pair.upper);\n }\n\n /** Returns true if the set contains no Ids. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n\n /** Returns the number of Ids contained in the set. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Populates and returns an array of all Ids contained in the set. */\n public toId64Array(): Id64Array {\n const ids: Id64Array = [];\n for (const entry of this._map)\n for (const low of entry[1])\n ids.push(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Populates and returns a set of all Ids contained in the set. */\n public toId64Set(): Id64Set {\n const ids = new Set<string>();\n for (const entry of this._map)\n for (const low of entry[1])\n ids.add(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Execute a function against each Id in this set. */\n public forEach(func: (lo: number, hi: number) => void): void {\n for (const entry of this._map)\n for (const lo of entry[1])\n func(lo, entry[0]);\n }\n }\n\n /** A specialized replacement for Map<Id64String, T> optimized for performance-critical code.\n * @see [[Id64.Uint32Set]] for implementation details.\n * @public\n */\n export class Uint32Map<T> {\n protected readonly _map = new Map<number, Map<number, T>>();\n\n /** Remove all entries from the map. */\n public clear(): void { this._map.clear(); }\n /** Find an entry in the map by Id. */\n public getById(id: Id64String): T | undefined { return this.get(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n /** Set an entry in the map by Id. */\n public setById(id: Id64String, value: T): void { this.set(Id64.getLowerUint32(id), Id64.getUpperUint32(id), value); }\n\n /** Set an entry in the map by Id components. */\n public set(low: number, high: number, value: T): void {\n let map = this._map.get(high);\n if (undefined === map) {\n map = new Map<number, T>();\n this._map.set(high, map);\n }\n\n map.set(low, value);\n }\n\n /** Get an entry from the map by Id components. */\n public get(low: number, high: number): T | undefined {\n const map = this._map.get(high);\n return undefined !== map ? map.get(low) : undefined;\n }\n\n /** Returns true if the map contains no entries. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n /** Returns the number of entries in the map. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Execute a function against each entry in this map. */\n public forEach(func: (lo: number, hi: number, value: T) => void): void {\n for (const outerEntry of this._map)\n for (const innerEntry of outerEntry[1])\n func(innerEntry[0], outerEntry[0], innerEntry[1]);\n }\n }\n}\n\n/** JSON representation of a [[TransientIdSequence]], primarily useful for transferring sequences to and from a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * It stores two \"local\" 40-bit Ids describing the range of [Id64String]($docs/learning/common/Id64.md)s generated by the sequence.\n * @public\n */\nexport interface TransientIdSequenceProps {\n /** The starting local Id. The sequence begins at `initialLocalId + 1`. */\n initialLocalId: number;\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * The next local Id generated by the sequence will be `currentLocalId + 1`.\n */\n currentLocalId: number;\n}\n\nfunction validateLocalId(num: number): void {\n if (num < 0 || Math.round(num) !== num) {\n throw new Error(\"Local Id must be a non-negative integer\");\n }\n}\n\n/** A function returned by [[TransientIdSequence.merge]] that remaps the local Id portion of an [Id64String]($docs/learning/common/Id64.md) generated by\n * the source sequence to the corresponding local Id in the target sequence.\n * It returns `sourceLocalId` if the input did not originate from the source sequence.\n* @public\n*/\nexport type RemapTransientLocalId = (sourceLocalId: number) => number;\n\n/**\n * Generates unique [[Id64String]] values in sequence, which are guaranteed not to conflict with Ids associated with persistent elements or models.\n * This is useful for associating stable, non-persistent identifiers with things like [Decorator]($frontend)s.\n * A TransientIdSequence can generate a maximum of (2^40)-2 unique Ids.\n * @public\n */\nexport class TransientIdSequence {\n /** The starting local Id provided to the constructor. The sequence begins at `initialLocalId + 1`. */\n public readonly initialLocalId: number;\n private _localId: number;\n\n /** Constructor.\n * @param initialLocalId The starting local Id. The local Id of the first [[Id64String]] generated by [[getNext]] will be `initialLocalId + 1`.\n */\n public constructor(initialLocalId = 0) {\n validateLocalId(initialLocalId);\n this.initialLocalId = initialLocalId;\n this._localId = initialLocalId;\n }\n\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * Each call to [[getNext]] increments this by 1 and uses it as the local Id of the generated [[Id64String]].\n */\n public get currentLocalId(): number {\n return this._localId;\n }\n\n /** Generate and return the next transient Id64String in the sequence. */\n public getNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(++this._localId, 0xffffff);\n }\n\n /** Preview the transient Id64String that will be returned by the next call to [[getNext]].\n * This is primarily useful for tests.\n */\n public peekNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(this._localId + 1, 0xffffff);\n }\n\n /** Convert this sequence to its JSON representation. */\n public toJSON(): TransientIdSequenceProps {\n return {\n initialLocalId: this.initialLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Create a sequence from its JSON representation. */\n public static fromJSON(props: TransientIdSequenceProps): TransientIdSequence {\n validateLocalId(props.currentLocalId);\n const sequence = new TransientIdSequence(props.initialLocalId);\n sequence._localId = props.currentLocalId;\n return sequence;\n }\n\n /** Obtain the JSON representation of a new sequence that diverges from this sequence, with its [[initialLocalId]] set to this sequence's [[currentLocalId]].\n * The two sequences can generate Ids independently. Later, you can [[merge]] the sequences, resolving conflicts where the two sequences generated identical Ids.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n */\n public fork(): TransientIdSequenceProps {\n return {\n initialLocalId: this.currentLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Integrate the Ids generated by a [[fork]] of this sequence. All of the Ids generated by `source` will be remapped to Ids at the end of this sequence.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * @param source The JSON representation of the [[fork]]ed sequence to be merged with this one.\n * @returns a function that permits you to remap the local Ids generated by `source` into the corresponding local Ids assigned by this sequence.\n * @throws Error if `source` is not a fork of this sequence or is malformed (e.g., contains negative and/or non-integer local Ids).\n */\n public merge(source: TransientIdSequenceProps): (sourceLocalId: number) => number {\n const { initialLocalId, currentLocalId } = source;\n\n validateLocalId(initialLocalId);\n validateLocalId(currentLocalId);\n\n if (initialLocalId > this.currentLocalId) {\n throw new Error(\"Transient Id sequences do not intersect\");\n }\n\n if (initialLocalId > currentLocalId) {\n throw new Error(\"Current local Id cannot be less than initial local Id\");\n }\n\n const delta = this.currentLocalId - initialLocalId;\n this._localId += currentLocalId - initialLocalId;\n\n return (sourceLocalId: number) => {\n if (sourceLocalId > initialLocalId && sourceLocalId <= currentLocalId) {\n return sourceLocalId + delta;\n }\n\n return sourceLocalId;\n };\n }\n}\n\n/**\n * The Guid namespace provides facilities for working with GUID strings using the \"8-4-4-4-12\" pattern.\n *\n * The [[GuidString]] type alias is used to indicate function arguments, return types, and variables which are known to\n * be in the GUID format.\n * @public\n */\nexport namespace Guid {\n const uuidPattern = new RegExp(\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\");\n\n /** Represents the empty Guid 00000000-0000-0000-0000-000000000000 */\n export const empty: GuidString = \"00000000-0000-0000-0000-000000000000\";\n\n /** Determine whether the input string is \"guid-like\". That is, it follows the 8-4-4-4-12 pattern. This does not enforce\n * that the string is actually in valid UUID format.\n */\n export function isGuid(value: string): boolean {\n return uuidPattern.test(value);\n }\n\n /** Determine whether the input string is a valid V4 Guid string */\n export function isV4Guid(value: string): boolean {\n return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(value);\n }\n\n /** Create a new V4 Guid value */\n export function createValue(): GuidString {\n // https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = Math.random() * 16 | 0;\n const v = c === \"x\" ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n\n /**\n * Normalize a Guid string if possible. Normalization consists of:\n * - Convert all characters to lower case\n * - Trim any leading or trailing whitespace\n * - Convert to the standard Guid format \"8-4-4-4-12\", repositioning the '-' characters as necessary, presuming there are exactly 32 hexadecimal digits.\n * @param value Input value that represents a Guid\n * @returns Normalized representation of the Guid string. If the normalization fails, return the *original* value unmodified (Note: it is *not* a valid Guid)\n */\n export function normalize(value: GuidString): GuidString {\n const lowerValue = value.toLowerCase().trim();\n\n // Return if it's already formatted to be a Guid\n if (isGuid(lowerValue))\n return lowerValue;\n\n // Remove any existing \"-\" characters and position them properly, if there remains exactly 32 hexadecimal digits\n const noDashValue = lowerValue.replace(/-/g, \"\");\n const noDashPattern = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/;\n if (noDashPattern.test(noDashValue)) {\n return noDashValue.replace(noDashPattern,\n (_match: string, p1: string, p2: string, p3: string, p4: string, p5: string) =>\n `${p1}-${p2}-${p3}-${p4}-${p5}`);\n }\n\n // Return unmodified string - (note: it is *not* a valid Guid)\n return value;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Id.js","sourceRoot":"","sources":["../../src/Id.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AA4BH,SAAS,KAAK,CAAC,GAAW;IACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW,EAAE,KAAa;IAC5D,OAAO,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW,EAAE,KAAa,EAAE,YAAqB,IAAI;IAChF,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,gBAAgB;IACjE,OAAO,CAAC,QAAQ,IAAI,eAAe,IAAI,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,CAAC,CA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A;IAED,mEAAmE;IACnE,SAAgB,QAAQ,CAAC,KAAa;QACpC,OAAO,wFAAwF,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9G,CAAC;IAFe,aAAQ,WAEvB,CAAA;IAED,iCAAiC;IACjC,SAAgB,WAAW;QACzB,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;IAFe,gBAAW,cAE1B,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,SAAS,CAAC,KAAiB;QACzC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAE9C,gDAAgD;QAChD,IAAI,MAAM,CAAC,UAAU,CAAC;YACpB,OAAO,UAAU,CAAC;QAEpB,gHAAgH;QAChH,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,sEAAsE,CAAC;QAC7F,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACpC,OAAO,WAAW,CAAC,OAAO,CAAC,aAAa,EACtC,CAAC,MAAc,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CAC7E,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,8DAA8D;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAlBe,cAAS,YAkBxB,CAAA;AACH,CAAC,EAlDgB,IAAI,KAAJ,IAAI,QAkDpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Ids\n */\n\n/** A string containing a well-formed string representation of an [Id64]($core-bentley).\n * See [Working with Ids]($docs/learning/common/Id64.md).\n * @public\n */\nexport type Id64String = string;\n\n/** A string containing a well-formed string representation of a [Guid]($core-bentley).\n * @public\n */\nexport type GuidString = string;\n\n/** A set of [[Id64String]]s.\n * @public\n */\nexport type Id64Set = Set<Id64String>;\n\n/** An array of [[Id64String]]s.\n * @public\n */\nexport type Id64Array = Id64String[];\n\n/** Used as an argument to a function that can accept one or more [[Id64String]]s.\n * @public\n */\nexport type Id64Arg = Id64String | Id64Set | Id64Array;\n\nfunction toHex(str: string): number {\n const v = parseInt(str, 16);\n return Number.isNaN(v) ? 0 : v;\n}\n\nfunction isLowerCaseNonZeroHexDigit(str: string, index: number) {\n return isLowerCaseHexDigit(str, index, false);\n}\n\nfunction isLowerCaseHexDigit(str: string, index: number, allowZero: boolean = true): boolean {\n const charCode = str.charCodeAt(index);\n const minDecimalDigit = allowZero ? 0x30 : 0x31; // '0' or '1'...\n return (charCode >= minDecimalDigit && charCode <= 0x39) || (charCode >= 0x61 && charCode <= 0x66); // '0'-'9, 'a' -'f'\n}\n\nfunction isValidHexString(id: string, startIndex: number, len: number) {\n if (len === 0)\n return false;\n\n // No leading zeroes...\n if (!isLowerCaseNonZeroHexDigit(id, startIndex))\n return false;\n\n // ...followed by len-1 lowercase hexadecimal digits.\n for (let i = 1; i < len; i++)\n if (!isLowerCaseHexDigit(id, startIndex + i))\n return false;\n\n return true;\n}\n\n/**\n * The Id64 namespace provides facilities for working with 64-bit identifiers. These Ids are stored as 64-bit integers inside an [[IModelDb]], but must be represented\n * as strings in JavaScript because JavaScript does not intrinsically support 64-bit integers.\n *\n * The [[Id64String]] type alias is used to indicate function arguments, return types, and variables which are known to contain a well-formed representation of a 64-bit Id.\n *\n * See [Working with Ids]($docs/learning/common/Id64.md) for a detailed description and code examples.\n * @public\n */\nexport namespace Id64 {\n /** Extract the \"local\" Id portion of an Id64String, contained in the lower 40 bits of the 64-bit value. */\n export function getLocalId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n const start = (len > 12) ? (len - 10) : 2;\n return toHex(id.slice(start));\n }\n\n /** Extract the briefcase Id portion of an Id64String, contained in the upper 24 bits of the 64-bit value. */\n export function getBriefcaseId(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const len = id.length;\n return (len <= 12) ? 0 : toHex(id.slice(2, len - 10));\n }\n\n /** Create an Id64String from its JSON representation.\n * @param prop The JSON representation of an Id.\n * @returns A well-formed Id string.\n * @note if the input is undefined, the result is \"0\", indicating an invalid Id.\n * @note if the input is not undefined, the result is the same as that of [[Id64.fromString]].\n */\n export function fromJSON(prop?: string): Id64String {\n return typeof prop === \"string\" ? Id64.fromString(prop) : Id64.invalid;\n }\n\n /** Given a string value, attempt to normalize it into a well-formed Id string.\n * If the input is already a well-formed Id string, it is returned unmodified.\n * Otherwise, the input is trimmed of leading and trailing whitespace, converted to lowercase, and an attempt is made to parse it as a 64-bit hexadecimal integer.\n * If parsing succeeds the normalized result is returned; otherwise the result is \"0\", indicating an invalid Id.\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n */\n export function fromString(val: string): Id64String {\n // NB: in case this is called from JavaScript, we must check the run-time type...\n if (typeof val !== \"string\")\n return invalid;\n\n // Skip the common case in which the input is already a well-formed Id string\n if (Id64.isId64(val))\n return val;\n\n // Attempt to normalize the input into a well-formed Id string\n val = val.toLowerCase().trim();\n const len = val.length;\n if (len < 2 || val[0] !== \"0\" || val[1] !== \"x\")\n return invalid;\n\n let low = 0;\n let high = 0;\n let start = 2;\n if (len > 12) {\n start = (len - 10);\n high = toHex(val.slice(2, start));\n }\n\n low = toHex(val.slice(start));\n return fromLocalAndBriefcaseIds(low, high);\n }\n\n // Used when constructing local ID portion of Id64String. Performance optimization.\n const _localIdPrefixByLocalIdLength = [\n \"0000000000\",\n \"000000000\",\n \"00000000\",\n \"0000000\",\n \"000000\",\n \"00000\",\n \"0000\",\n \"000\",\n \"00\",\n \"0\",\n \"\",\n ];\n\n /** Produce an Id string from a local and briefcase Id.\n * @param localId The non-zero local Id as an unsigned 40-bit integer.\n * @param briefcaseId The briefcase Id as an unsigned 24-bit integer.\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `localId | (briefcaseId << 40)`, or an invalid Id \"0\" if the inputs are invalid.\n */\n export function fromLocalAndBriefcaseIds(localId: number, briefcaseId: number): Id64String {\n // NB: Yes, we must check the run-time type...\n if (typeof localId !== \"number\" || typeof briefcaseId !== \"number\")\n return invalid;\n\n localId = Math.floor(localId);\n if (0 === localId)\n return invalid;\n\n briefcaseId = Math.floor(briefcaseId);\n const lowStr = localId.toString(16);\n return `0x${(briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr))}`;\n }\n\n // Used as a buffer when converting a pair of 32-bit integers to an Id64String. Significant performance optimization.\n const scratchCharCodes = [\n 0x30, // \"0\"\n 0x78, // \"x\"\n 0x30, // \"0\"\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n 0x30,\n ];\n\n // Convert 4-bit unsigned integer to char code representing lower-case hexadecimal digit.\n function uint4ToCharCode(uint4: number): number {\n return uint4 + (uint4 < 10 ? 0x30 : 0x57);\n }\n\n // Convert char code representing lower-case hexadecimal digit to 4-bit unsigned integer.\n function charCodeToUint4(char: number): number {\n return char - (char >= 0x57 ? 0x57 : 0x30);\n }\n\n // Convert a substring to a uint32. This is twice as fast as using Number.parseInt().\n function substringToUint32(id: Id64String, start: number, end: number): number {\n let uint32 = 0;\n for (let i = start; i < end; i++) {\n const uint4 = charCodeToUint4(id.charCodeAt(i));\n const shift = (end - i - 1) << 2;\n const mask = uint4 << shift;\n uint32 = (uint32 | mask) >>> 0; // >>> 0 to force unsigned because javascript\n }\n\n return uint32;\n }\n\n /** Create an Id64String from a pair of unsigned 32-bit integers.\n * @param lowBytes The lower 4 bytes of the Id\n * @param highBytes The upper 4 bytes of the Id\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\n * operation `lowBytes | (highBytes << 32)`.\n * @see [[Id64.fromUint32PairObject]] if you have a [[Id64.Uint32Pair]] object.\n */\n export function fromUint32Pair(lowBytes: number, highBytes: number): Id64String {\n const localIdLow = lowBytes >>> 0;\n const localIdHigh = (highBytes & 0x000000ff) * (0xffffffff + 1); // aka (highBytes & 0xff) << 32\n const localId = localIdLow + localIdHigh; // aka localIdLow | localIdHigh\n if (0 === localId)\n return invalid;\n\n // Need to omit or preserve leading zeroes...\n const buffer = scratchCharCodes;\n let index = 2;\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (highBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n for (let i = 7; i >= 0; i--) {\n const shift = i << 2;\n const mask = 0xf << shift;\n const uint4 = (lowBytes & mask) >>> shift;\n if (index > 2 || 0 !== uint4)\n buffer[index++] = uint4ToCharCode(uint4);\n }\n\n if (buffer.length !== index)\n buffer.length = index;\n\n return String.fromCharCode(...scratchCharCodes);\n }\n\n /** Create an Id64String from a [[Id64.Uint32Pair]].\n * @see [[Id64.fromUint32Pair]].\n */\n export function fromUint32PairObject(pair: Uint32Pair): Id64String {\n return fromUint32Pair(pair.lower, pair.upper);\n }\n\n /** Returns true if the inputs represent two halves of a valid 64-bit Id.\n * @see [[Id64.Uint32Pair]].\n */\n export function isValidUint32Pair(lowBytes: number, highBytes: number): boolean {\n // Detect local ID of zero\n return 0 !== lowBytes || 0 !== (highBytes & 0x000000ff);\n }\n\n /** Represents an [[Id64]] as a pair of unsigned 32-bit integers. Because Javascript lacks efficient support for 64-bit integers,\n * this representation can be useful in performance-sensitive code like the render loop.\n * @see [[Id64.getUint32Pair]] to convert an [[Id64String]] to a Uint32Pair.\n * @see [[Id64.fromUint32Pair]] to convert a Uint32Pair to an [[Id64String]].\n * @see [[Id64.Uint32Set]] and [[Id64.Uint32Map]] for collections based on Uint32Pairs.\n */\n export interface Uint32Pair {\n /** The lower 4 bytes of the 64-bit integer. */\n lower: number;\n /** The upper 4 bytes of the 64-bit integer. */\n upper: number;\n }\n\n /** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.\n * @param id The well-formed string representation of a 64-bit Id.\n * @param out Used as the return value if supplied; otherwise a new object is returned.\n * @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.\n */\n export function getUint32Pair(id: Id64String, out?: Uint32Pair): Uint32Pair {\n if (!out)\n out = { lower: 0, upper: 0 };\n\n out.lower = getLowerUint32(id);\n out.upper = getUpperUint32(id);\n return out;\n }\n\n /** Extract an unsigned 32-bit integer from the lower 4 bytes of an Id64String. */\n export function getLowerUint32(id: Id64String): number {\n if (isInvalid(id))\n return 0;\n\n const end = id.length;\n const start = end > 10 ? end - 8 : 2;\n return substringToUint32(id, start, end);\n }\n\n /** Extract an unsigned 32-bit integer from the upper 4 bytes of an Id64String. */\n export function getUpperUint32(id: Id64String): number {\n const len = id.length;\n if (len <= 10 || isInvalid(id))\n return 0;\n\n return substringToUint32(id, 2, len - 8);\n }\n\n /** Convert an [[Id64Arg]] into an [[Id64Set]].\n *\n * This method can be used by functions that accept an Id64Arg to conveniently process the value(s). For example:\n * ```ts\n * public addCategories(arg: Id64Arg) { Id64.toIdSet(arg).forEach((id) => this.categories.add(id)); }\n * ```\n *\n * Alternatively, to avoid allocating a new Id64Set, use [[Id64.iterable]].\n *\n * @param arg The Ids to convert to an Id64Set.\n * @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input.\n * @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg.\n */\n export function toIdSet(arg: Id64Arg, makeCopy: boolean = false): Id64Set {\n if (arg instanceof Set)\n return makeCopy ? new Set<string>(arg) : arg;\n\n const ids = new Set<Id64String>();\n if (typeof arg === \"string\")\n ids.add(arg);\n else if (Array.isArray(arg)) {\n arg.forEach((id: Id64String) => {\n if (typeof id === \"string\")\n ids.add(id);\n });\n }\n\n return ids;\n }\n\n /** Obtain iterator over the specified Ids.\n * @see [[Id64.iterable]].\n */\n export function* iterator(ids: Id64Arg): Iterator<Id64String> {\n if (typeof ids === \"string\") {\n yield ids;\n } else {\n for (const id of ids)\n yield id;\n }\n }\n\n /** Obtain an iterable over the specified Ids. Example usage:\n * ```ts\n * const ids = [\"0x123\", \"0xfed\"];\n * for (const id of Id64.iterable(ids))\n * console.log(id);\n * ```\n */\n export function iterable(ids: Id64Arg): Iterable<Id64String> {\n return {\n [Symbol.iterator]: () => iterator(ids),\n };\n }\n\n /** Return the first [[Id64String]] of an [[Id64Arg]]. */\n export function getFirst(arg: Id64Arg): Id64String {\n return typeof arg === \"string\" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value) ?? Id64.invalid;\n }\n\n /** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */\n export function sizeOf(arg: Id64Arg): number {\n return typeof arg === \"string\" ? 1 : (Array.isArray(arg) ? arg.length : arg.size);\n }\n\n /** Returns true if the [[Id64Arg]] contains the specified Id. */\n export function has(arg: Id64Arg, id: Id64String): boolean {\n if (typeof arg === \"string\")\n return arg === id;\n if (Array.isArray(arg))\n return -1 !== arg.indexOf(id);\n\n return arg.has(id);\n }\n\n /** The string representation of an invalid Id. */\n export const invalid = \"0\";\n\n /** Determine if the supplied id string represents a transient Id.\n * @param id A well-formed Id string.\n * @returns true if the Id represents a transient Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isTransientId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransient(id: Id64String): boolean {\n // A transient Id is of the format \"0xffffffxxxxxxxxxx\" where the leading 6 digits indicate an invalid briefcase Id.\n return 18 === id.length && id.startsWith(\"0xffffff\");\n }\n\n /** Determine if the input is a well-formed [[Id64String]] and represents a transient Id.\n * @see [[Id64.isTransient]]\n * @see [[Id64.isId64]]\n * @see [[TransientIdSequence]]\n */\n export function isTransientId64(id: string): boolean {\n return isValidId64(id) && isTransient(id);\n }\n\n /** Determine if the input is a well-formed [[Id64String]].\n *\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\n * @see [[Id64.isValidId64]]\n */\n export function isId64(id: string): boolean {\n const len = id.length;\n if (0 === len || 18 < len)\n return false;\n\n if (\"0\" !== id[0])\n return false;\n\n // Well-formed invalid Id: \"0\"\n if (1 === len)\n return true;\n\n // Valid Ids begin with \"0x\" followed by at least one lower-case hexadecimal digit.\n if (2 === len || \"x\" !== id[1])\n return false;\n\n // If briefcase Id is present, it occupies at least one digit, followed by 10 digits for local Id\n let localIdStart = 2;\n if (len > 12) {\n localIdStart = len - 10;\n\n // Verify briefcase Id\n if (!isValidHexString(id, 2, localIdStart - 2))\n return false;\n\n // Skip leading zeroes in local Id\n for (let i = localIdStart; i < len; i++) {\n if (0x30 !== id.charCodeAt(i)) // '0'\n break;\n else\n localIdStart++;\n }\n\n if (localIdStart >= len)\n return false;\n }\n\n return isValidHexString(id, localIdStart, len - localIdStart);\n }\n\n /** Returns true if the input is not equal to the representation of an invalid Id.\n * @note This method assumes the input is a well-formed Id string.\n * @see [[Id64.isInvalid]]\n * @see [[Id64.isValidId64]]\n */\n export function isValid(id: Id64String): boolean {\n return Id64.invalid !== id;\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing a valid Id.\n * @see [[Id64.isValid]]\n * @see [[Id64.isId64]]\n */\n export function isValidId64(id: string): boolean {\n return Id64.invalid !== id && Id64.isId64(id);\n }\n\n /** Returns true if the input is a well-formed [[Id64String]] representing an invalid Id.\n * @see [[Id64.isValid]]\n */\n export function isInvalid(id: Id64String): boolean {\n return Id64.invalid === id;\n }\n\n /** A specialized replacement for Set<Id64String> optimized for performance-critical code which represents large sets of [[Id64]]s as pairs of\n * 32-bit integers.\n * The internal representation is a Map<number, Set<number>> where the Map key is the upper 4 bytes of the IDs and the Set elements are the lower 4 bytes of the IDs.\n * Because the upper 4 bytes store the 24-bit briefcase ID plus the upper 8 bits of the local ID, there will be a very small distribution of unique Map keys.\n * To further optimize this data type, the following assumptions are made regarding the { lower, upper } inputs, and no validation is performed to confirm them:\n * - The inputs are unsigned 32-bit integers;\n * - The inputs represent a valid Id64String (e.g., local ID is not zero).\n * @see [[Id64.Uint32Map]] for a similarly-optimized replacement for Map<Id64String, T>\n * @public\n */\n export class Uint32Set {\n protected readonly _map = new Map<number, Set<number>>();\n\n /** Construct a new Uint32Set.\n * @param ids If supplied, all of the specified Ids will be added to the new set.\n */\n public constructor(ids?: Id64Arg) {\n if (undefined !== ids)\n this.addIds(ids);\n }\n\n /** Return true if `this` and `other` contain the same set of Ids. */\n public equals(other: Uint32Set): boolean {\n if (this === other) {\n return true;\n }\n\n if (this.size !== other.size) {\n return false;\n }\n\n for (const [key, thisValue] of this._map) {\n const otherValue = other._map.get(key);\n if (!otherValue || thisValue.size !== otherValue.size) {\n return false;\n }\n\n for (const value of thisValue) {\n if (!otherValue.has(value)) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /** Remove all contents of this set. */\n public clear(): void {\n this._map.clear();\n }\n\n /** Add an Id to the set. */\n public addId(id: Id64String): void {\n this.add(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Add any number of Ids to the set. */\n public addIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.addId(id);\n }\n\n /** Returns true if the set contains the specified Id. */\n public hasId(id: Id64String): boolean { return this.has(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n\n /** Add an Id to the set. */\n public add(low: number, high: number): void {\n let set = this._map.get(high);\n if (undefined === set) {\n set = new Set<number>();\n this._map.set(high, set);\n }\n\n set.add(low);\n }\n\n /** Remove an Id from the set. */\n public deleteId(id: Id64String): void {\n this.delete(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\n }\n\n /** Remove any number of Ids from the set. */\n public deleteIds(ids: Id64Arg): void {\n for (const id of Id64.iterable(ids))\n this.deleteId(id);\n }\n\n /** Remove an Id from the set. */\n public delete(low: number, high: number): void {\n const set = this._map.get(high);\n if (undefined !== set) {\n set.delete(low);\n if (set.size === 0)\n this._map.delete(high);\n }\n }\n\n /** Returns true if the set contains the specified Id. */\n public has(low: number, high: number): boolean {\n const set = this._map.get(high);\n return undefined !== set && set.has(low);\n }\n\n /** Returns true if the set contains the Id specified by `pair`. */\n public hasPair(pair: Uint32Pair): boolean {\n return this.has(pair.lower, pair.upper);\n }\n\n /** Returns true if the set contains no Ids. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n\n /** Returns the number of Ids contained in the set. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Populates and returns an array of all Ids contained in the set. */\n public toId64Array(): Id64Array {\n const ids: Id64Array = [];\n for (const entry of this._map)\n for (const low of entry[1])\n ids.push(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Populates and returns a set of all Ids contained in the set. */\n public toId64Set(): Id64Set {\n const ids = new Set<string>();\n for (const entry of this._map)\n for (const low of entry[1])\n ids.add(Id64.fromUint32Pair(low, entry[0]));\n\n return ids;\n }\n\n /** Execute a function against each Id in this set. */\n public forEach(func: (lo: number, hi: number) => void): void {\n for (const entry of this._map)\n for (const lo of entry[1])\n func(lo, entry[0]);\n }\n }\n\n /** A specialized replacement for Map<Id64String, T> optimized for performance-critical code.\n * @see [[Id64.Uint32Set]] for implementation details.\n * @public\n */\n export class Uint32Map<T> {\n protected readonly _map = new Map<number, Map<number, T>>();\n\n /** Remove all entries from the map. */\n public clear(): void { this._map.clear(); }\n /** Find an entry in the map by Id. */\n public getById(id: Id64String): T | undefined { return this.get(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\n /** Set an entry in the map by Id. */\n public setById(id: Id64String, value: T): void { this.set(Id64.getLowerUint32(id), Id64.getUpperUint32(id), value); }\n\n /** Set an entry in the map by Id components. */\n public set(low: number, high: number, value: T): void {\n let map = this._map.get(high);\n if (undefined === map) {\n map = new Map<number, T>();\n this._map.set(high, map);\n }\n\n map.set(low, value);\n }\n\n /** Get an entry from the map by Id components. */\n public get(low: number, high: number): T | undefined {\n const map = this._map.get(high);\n return undefined !== map ? map.get(low) : undefined;\n }\n\n /** Returns true if the map contains no entries. */\n public get isEmpty(): boolean { return 0 === this._map.size; }\n /** Returns the number of entries in the map. */\n public get size(): number {\n let size = 0;\n for (const entry of this._map)\n size += entry[1].size;\n\n return size;\n }\n\n /** Execute a function against each entry in this map. */\n public forEach(func: (lo: number, hi: number, value: T) => void): void {\n for (const outerEntry of this._map)\n for (const innerEntry of outerEntry[1])\n func(innerEntry[0], outerEntry[0], innerEntry[1]);\n }\n }\n}\n\n/** JSON representation of a [[TransientIdSequence]], primarily useful for transferring sequences to and from a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * It stores two \"local\" 40-bit Ids describing the range of [Id64String]($docs/learning/common/Id64.md)s generated by the sequence.\n * @public\n */\nexport interface TransientIdSequenceProps {\n /** The starting local Id. The sequence begins at `initialLocalId + 1`. */\n initialLocalId: number;\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * The next local Id generated by the sequence will be `currentLocalId + 1`.\n */\n currentLocalId: number;\n}\n\nfunction validateLocalId(num: number): void {\n if (num < 0 || Math.round(num) !== num) {\n throw new Error(\"Local Id must be a non-negative integer\");\n }\n}\n\n/** A function returned by [[TransientIdSequence.merge]] that remaps the local Id portion of an [Id64String]($docs/learning/common/Id64.md) generated by\n * the source sequence to the corresponding local Id in the target sequence.\n * It returns `sourceLocalId` if the input did not originate from the source sequence.\n* @public\n*/\nexport type RemapTransientLocalId = (sourceLocalId: number) => number;\n\n/**\n * Generates unique [[Id64String]] values in sequence, which are guaranteed not to conflict with Ids associated with persistent elements or models.\n * This is useful for associating stable, non-persistent identifiers with things like [Decorator]($frontend)s.\n * A TransientIdSequence can generate a maximum of (2^40)-2 unique Ids.\n * @public\n */\nexport class TransientIdSequence {\n /** The starting local Id provided to the constructor. The sequence begins at `initialLocalId + 1`. */\n public readonly initialLocalId: number;\n private _localId: number;\n\n /** Constructor.\n * @param initialLocalId The starting local Id. The local Id of the first [[Id64String]] generated by [[getNext]] will be `initialLocalId + 1`.\n */\n public constructor(initialLocalId = 0) {\n validateLocalId(initialLocalId);\n this.initialLocalId = initialLocalId;\n this._localId = initialLocalId;\n }\n\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\n * not yet generated any Ids.\n * Each call to [[getNext]] increments this by 1 and uses it as the local Id of the generated [[Id64String]].\n */\n public get currentLocalId(): number {\n return this._localId;\n }\n\n /** Generate and return the next transient Id64String in the sequence. */\n public getNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(++this._localId, 0xffffff);\n }\n\n /** Preview the transient Id64String that will be returned by the next call to [[getNext]].\n * This is primarily useful for tests.\n */\n public peekNext(): Id64String {\n return Id64.fromLocalAndBriefcaseIds(this._localId + 1, 0xffffff);\n }\n\n /** Convert this sequence to its JSON representation. */\n public toJSON(): TransientIdSequenceProps {\n return {\n initialLocalId: this.initialLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Create a sequence from its JSON representation. */\n public static fromJSON(props: TransientIdSequenceProps): TransientIdSequence {\n validateLocalId(props.currentLocalId);\n const sequence = new TransientIdSequence(props.initialLocalId);\n sequence._localId = props.currentLocalId;\n return sequence;\n }\n\n /** Obtain the JSON representation of a new sequence that diverges from this sequence, with its [[initialLocalId]] set to this sequence's [[currentLocalId]].\n * The two sequences can generate Ids independently. Later, you can [[merge]] the sequences, resolving conflicts where the two sequences generated identical Ids.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n */\n public fork(): TransientIdSequenceProps {\n return {\n initialLocalId: this.currentLocalId,\n currentLocalId: this.currentLocalId,\n };\n }\n\n /** Integrate the Ids generated by a [[fork]] of this sequence. All of the Ids generated by `source` will be remapped to Ids at the end of this sequence.\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\n * @param source The JSON representation of the [[fork]]ed sequence to be merged with this one.\n * @returns a function that permits you to remap the local Ids generated by `source` into the corresponding local Ids assigned by this sequence.\n * @throws Error if `source` is not a fork of this sequence or is malformed (e.g., contains negative and/or non-integer local Ids).\n */\n public merge(source: TransientIdSequenceProps): (sourceLocalId: number) => number {\n const { initialLocalId, currentLocalId } = source;\n\n validateLocalId(initialLocalId);\n validateLocalId(currentLocalId);\n\n if (initialLocalId > this.currentLocalId) {\n throw new Error(\"Transient Id sequences do not intersect\");\n }\n\n if (initialLocalId > currentLocalId) {\n throw new Error(\"Current local Id cannot be less than initial local Id\");\n }\n\n const delta = this.currentLocalId - initialLocalId;\n this._localId += currentLocalId - initialLocalId;\n\n return (sourceLocalId: number) => {\n if (sourceLocalId > initialLocalId && sourceLocalId <= currentLocalId) {\n return sourceLocalId + delta;\n }\n\n return sourceLocalId;\n };\n }\n}\n\n/**\n * The Guid namespace provides facilities for working with GUID strings using the \"8-4-4-4-12\" pattern.\n *\n * The [[GuidString]] type alias is used to indicate function arguments, return types, and variables which are known to\n * be in the GUID format.\n * @public\n */\nexport namespace Guid {\n const uuidPattern = new RegExp(\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\");\n\n /** Represents the empty Guid 00000000-0000-0000-0000-000000000000 */\n export const empty: GuidString = \"00000000-0000-0000-0000-000000000000\";\n\n /** Determine whether the input string is \"guid-like\". That is, it follows the 8-4-4-4-12 pattern. This does not enforce\n * that the string is actually in valid UUID format.\n */\n export function isGuid(value: string): boolean {\n return uuidPattern.test(value);\n }\n\n /** Determine whether the input string is a valid V4 Guid string */\n export function isV4Guid(value: string): boolean {\n return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(value);\n }\n\n /** Create a new V4 Guid value */\n export function createValue(): GuidString {\n return crypto.randomUUID();\n }\n\n /**\n * Normalize a Guid string if possible. Normalization consists of:\n * - Convert all characters to lower case\n * - Trim any leading or trailing whitespace\n * - Convert to the standard Guid format \"8-4-4-4-12\", repositioning the '-' characters as necessary, presuming there are exactly 32 hexadecimal digits.\n * @param value Input value that represents a Guid\n * @returns Normalized representation of the Guid string. If the normalization fails, return the *original* value unmodified (Note: it is *not* a valid Guid)\n */\n export function normalize(value: GuidString): GuidString {\n const lowerValue = value.toLowerCase().trim();\n\n // Return if it's already formatted to be a Guid\n if (isGuid(lowerValue))\n return lowerValue;\n\n // Remove any existing \"-\" characters and position them properly, if there remains exactly 32 hexadecimal digits\n const noDashValue = lowerValue.replace(/-/g, \"\");\n const noDashPattern = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/;\n if (noDashPattern.test(noDashValue)) {\n return noDashValue.replace(noDashPattern,\n (_match: string, p1: string, p2: string, p3: string, p4: string, p5: string) =>\n `${p1}-${p2}-${p3}-${p4}-${p5}`);\n }\n\n // Return unmodified string - (note: it is *not* a valid Guid)\n return value;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-bentley",
|
|
3
|
-
"version": "5.3.0-dev.
|
|
3
|
+
"version": "5.3.0-dev.21",
|
|
4
4
|
"description": "Bentley JavaScript core components",
|
|
5
5
|
"main": "lib/cjs/core-bentley.js",
|
|
6
6
|
"module": "lib/esm/core-bentley.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"rimraf": "^6.0.1",
|
|
31
31
|
"typescript": "~5.6.2",
|
|
32
32
|
"vitest": "^3.0.6",
|
|
33
|
-
"@itwin/build-tools": "5.3.0-dev.
|
|
33
|
+
"@itwin/build-tools": "5.3.0-dev.21"
|
|
34
34
|
},
|
|
35
35
|
"nyc": {
|
|
36
36
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|