@fluid-experimental/property-common 2.0.0-dev.5.3.2.178189 → 2.0.0-dev.6.4.0.191258

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.
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,4DAA4D;AAC5D;;GAEG;AACH,oDAAuB;AAEvB,MAAM,IAAI,GAAG;IACZ,aAAa,EAAE,0CAA0C;IACzD,kBAAkB,EAAE,iCAAiC;IACrD,kBAAkB,EAAE,mDAAmD;IACvE,aAAa,EAAE,yBAAyB;IACxC,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,sCAAsC;CACrD,CAAC;AAEF,MAAa,UAAU;IAItB;;;;;OAKG;IACH,YAAsB,QAAQ,qBAAqB,EAAY,KAAqB;QAA9D,UAAK,GAAL,KAAK,CAAwB;QAAY,UAAK,GAAL,KAAK,CAAgB;QAT1E,WAAM,GAAyB,EAAE,CAAC;QAClC,WAAM,GAAwB,EAAE,CAAC;IAQ4C,CAAC;IAExF,4BAA4B;IAC5B,KAAK,CAAC,MAAM,EAAE,QAAQ,IAAG,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,IAAG,CAAC;IAC7B,OAAO,CAAC,QAAQ,IAAG,CAAC;IAEpB,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAW,IAAI;QACd,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,MAAuB,EAAE,QAAW;QACvC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,C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AAC;QAE1B,uEAAuE;QACvE,uBAAuB;QAEvB,gBAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;YAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACJ,MAAM,MAAM,GAAG,IAAI,UAAU,CAAI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,aAA4B;QAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC;QAEhC,gBAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC1B,CAAC;CACD;AA5ZD,gCA4ZC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n\tTYPE_MISMATCH: \"Type does not match this collection type\",\n\tKEY_ALREADY_EXISTS: \"Collection key already exists. \",\n\tKEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n\tMUST_GIVE_KEY: \"Collection missing key.\",\n\tMUST_GIVE_VALUE: \"Collection missing value.\",\n\tKEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n\tprotected _items: { [key: string]: T } = {};\n\tprotected _order: (string | number)[] = [];\n\n\t/**\n\t * @param _name - a friendly name to describe this collection. If undefined\n\t * the collection will have a default \"Untitled Collection\" assigned to its name.\n\t * @param _type - optional parameter pointing to the constructor\n\t * of a type this Collection will host.\n\t */\n\tconstructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {}\n\n\t// Pass-thru binding handles\n\tonAdd(in_key, in_value) {}\n\tonRemove(in_key, in_value) {}\n\tonClear(in_items) {}\n\n\tpublic get items() {\n\t\treturn this._items;\n\t}\n\n\tpublic get keys() {\n\t\treturn Object.keys(this._items);\n\t}\n\n\t/**\n\t * @param in_key - Key to store the value under\n\t * @param in_value - Value to store in the collection\n\t * @returns Return the value passed in\n\t */\n\tadd(in_key: number | string, in_value: T): T {\n\t\tthis._checkType(in_value);\n\t\tthis._checkIsNewKey(in_key);\n\n\t\tthis._items[in_key] = in_value;\n\t\tthis._order.push(in_key);\n\n\t\tthis.onAdd(in_key, in_value);\n\n\t\treturn in_value;\n\t}\n\n\t/**\n\t * Checks if in_value's type is equal to this Collection type. If this collection\n\t * has no type set, the check will pass.\n\t *\n\t * @param in_value - A value that is equal to the type managed by this collection.\n\t * @returns Return true if the type is a valid type for this\n\t * collection, throw otherwise.\n\t */\n\tprivate _checkType(in_value: T) {\n\t\tif (this._type && !(in_value instanceof this._type)) {\n\t\t\tthrow new Error(MSGS.TYPE_MISMATCH);\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/**\n\t * Bulk add items.\n\t * @param in_items - List of key-value pairs to be stored in the collection\n\t * @returns this collection after add\n\t */\n\tbulkAdd(in_items: { [key: string]: T }) {\n\t\t_.each(in_items, (item, key) => {\n\t\t\tthis.add(key, item);\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Bulk remove items.\n\t * @param in_items - List of key-value items to be removed\n\t * @returns this collection after add\n\t */\n\tbulkRemove(in_items: { [key: string]: T }) {\n\t\t_.each(in_items, (item, key) => {\n\t\t\tthis.remove(key);\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Test if this collection is empty\n\t * @returns true if empty, false otherwise\n\t * */\n\tisEmpty() {\n\t\treturn _.isEmpty(this._items);\n\t}\n\n\t/**\n\t * Return the first item in the collection, null if empty\n\t * @returns first item, or undefined if empty\n\t * */\n\tgetFirstItem(): T | undefined {\n\t\tconst index = _.first(this._order);\n\t\treturn index === undefined ? index : this._items[index];\n\t}\n\n\t/**\n\t * Return the last item in the collection, null if empty\n\t * @returns - last item, or undefined if empty\n\t * */\n\tgetLastItem(): T | undefined {\n\t\tconst index = _.last(this._order);\n\t\treturn index === undefined ? index : this._items[index];\n\t}\n\n\t/**\n\t * @returns Returns the type of collection (Array, etc.)\n\t */\n\tgetType() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * @returns Returns the name of the collection\n\t */\n\tgetName(): string {\n\t\treturn this._name;\n\t}\n\n\t/**\n\t * Filter out by function\n\t * @param in_filterFunction - with arguments key and item\n\t * @returns A new filtered collection\n\t */\n\tfilter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = function (in_key, in_item) {\n\t\t\tconst keeper = in_filterFunction(in_key, in_item);\n\t\t\tif (keeper) {\n\t\t\t\trtn.add(in_key, in_item);\n\t\t\t}\n\t\t};\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Filter out all keys NOT matching the in_filterKey\n\t * @param in_filterKey - a single key or an array of keys, if the\n\t * item matches any of the keys it will be filtered in.\n\t * @returns New filtered collection with all the items\n\t * matching at least one key.\n\t */\n\tfilterByKey(in_filterKey: string | string[]): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = _.isArray(in_filterKey)\n\t\t\t? function (in_key, in_item) {\n\t\t\t\t\tif (in_filterKey.includes(in_key)) {\n\t\t\t\t\t\trtn.add(in_key, in_item);\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: function (in_key, in_item) {\n\t\t\t\t\tif (in_key === in_filterKey) {\n\t\t\t\t\t\trtn.add(in_key, in_item);\n\t\t\t\t\t}\n\t\t\t };\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Filter out all keys NOT matching the in_filterValue\n\t * @param in_filterValue - Value to filter on\n\t * @returns Return a filtered collection\n\t */\n\tfilterByValue(in_filterValue: T): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = function (in_key, in_item) {\n\t\t\tif (in_item === in_filterValue) {\n\t\t\t\trtn.add(in_key, in_item);\n\t\t\t}\n\t\t};\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Remove an item from this Collection. This method returns a Boolean indicating\n\t * the success or failure of the removal. This is practical because if we were\n\t * to throw an error when the key doesn't exist, it would require additional\n\t * checks by the caller to make sure this key exists prior to removal. Which\n\t * would make the attempt of removal more verbose and also costly because the\n\t * caller would have to keep a list – somewhere else – of the things he can\n\t * and cannot remove.\n\t *\n\t * @param in_key - the key we wish to remove\n\t * @returns true if the key exists and was removed, false otherwise.\n\t */\n\tremove(in_key: number | string): boolean {\n\t\tif (!this.has(in_key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst remember = this._items[in_key];\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\tdelete this._items[in_key];\n\t\tthis._order.splice(this._order.indexOf(in_key), 1);\n\n\t\tthis.onRemove(in_key, remember);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Return the number of items in this Collection\n\t * @returns the number of items in the collection\n\t */\n\tgetCount(): number {\n\t\treturn this._order.length;\n\t}\n\n\t/**\n\t * Returns this collection as an ordered Array\n\t * @returns Array including the values\n\t */\n\tgetAsArray() {\n\t\tconst rtnArr: T[] = new Array(this.getCount());\n\n\t\tfor (let i = 0; i < this._order.length; i++) {\n\t\t\trtnArr[i] = this._items[this._order[i]];\n\t\t}\n\n\t\treturn rtnArr;\n\t}\n\n\t/**\n\t * @param in_key - the key we are looking for\n\t * @returns true if the item exists\n\t */\n\thas(in_key: string | number): boolean {\n\t\treturn Object.prototype.hasOwnProperty.call(this._items, in_key);\n\t}\n\n\t/**\n\t * Return an item associated with the given key\n\t * @param in_key - the key for the item in this\n\t * Collection\n\t * @returns The item\n\t */\n\titem(in_key: number | string) {\n\t\treturn this._items[in_key];\n\t}\n\n\t/**\n\t * Checks if this is a new key in the collection. Throw if already exists.\n\t * @param in_key - The key to check against\n\t * @returns true if key is new\n\t */\n\tprivate _checkIsNewKey(in_key: number | string) {\n\t\tif (this.has(in_key)) {\n\t\t\tthrow new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Checks if the key exists in the collection. Throw if not.\n\t * @param in_key - the key to check against\n\t * @returns true if key exists\n\t */\n\tprivate _checkKeyExists(in_key: number | string) {\n\t\tif (!this.has(in_key)) {\n\t\t\tthrow new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Set an existing key to a value. If key doesn't exist this call will throw\n\t * an error.\n\t * @param in_key - The key we want to modify\n\t * @param in_value - The value we are to set at this key\n\t * @returns The value passed in\n\t */\n\tset(in_key: string, in_value: T) {\n\t\tthis._checkKeyExists(in_key);\n\n\t\tthis._items[in_key] = in_value;\n\n\t\treturn in_value;\n\t}\n\n\t/**\n\t * Iterate over this collection and run the callback with passing the key and\n\t * item in the iteration loop.\n\t * @param in_callback - A function that we will call on each item\n\t * of this collection. If the callback returns false then the iteration will exit early.\n\t */\n\titerate(in_callback) {\n\t\tfor (const key of this._order) {\n\t\t\tconst continu = in_callback(key, this._items[key]);\n\t\t\tif (continu === false) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Iterate over this collection starting from the tail and run the callback with passing the key and\n\t * item in the iteration loop.\n\t * @param in_callback - a function that we will call on each item\n\t * of this collection. If the callback returns false then the iteration will exit early.\n\t */\n\titerateFromTail(in_callback) {\n\t\tlet key;\n\t\tlet continu;\n\t\tfor (let i = this._order.length - 1; i >= 0; i--) {\n\t\t\tkey = this._order[i];\n\t\t\tcontinu = in_callback(key, this._items[key]);\n\t\t\tif (continu === false) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @returns Return an object containing the items of this collection\n\t */\n\tgetItems(): { [key: string]: T } {\n\t\tconst result = {};\n\n\t\t_.each(this._items, function (item, key) {\n\t\t\tresult[key] = item;\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Return the list of keys\n\t * @returns List of keys\n\t */\n\tgetKeys(): string[] {\n\t\treturn Object.keys(this._items);\n\t}\n\n\t/**\n\t * Method used to get the first element in the collection along with its key.\n\t */\n\tpeak() {\n\t\treturn {\n\t\t\titem: this._items[this._order[0]],\n\t\t\tkey: this._order[0],\n\t\t};\n\t}\n\n\t/**\n\t * Clear this collection\n\t * @returns this collection\n\t */\n\tclear() {\n\t\tif (_.isEmpty(this._items)) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.onClear(this._items);\n\n\t\t// Best to just iterate through and remove everything, so that OnRemove\n\t\t// handlers are called.\n\n\t\t_.each(this.getKeys(), (key) => {\n\t\t\tthis.remove(key);\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @param in_collection - the collection we want to\n\t * copy from.\n\t * @returns new Collection\n\t */\n\tclone(): Collection<T> {\n\t\tconst newCol = new Collection<T>(this._name, this._type);\n\t\tnewCol.bulkAdd(this._items);\n\t\treturn newCol;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @param in_collection - the collection we want to\n\t * copy from.\n\t */\n\tcopy(in_collection: Collection<T>) {\n\t\tthis.clear();\n\t\tconst its = in_collection.items;\n\n\t\t_.each(its, (item, key) => {\n\t\t\tthis.add(key, item);\n\t\t});\n\t}\n\n\tget values() {\n\t\treturn this.getAsArray();\n\t}\n}\n"]}
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,4DAA4D;AAC5D;;GAEG;AACH,oDAAuB;AAEvB,MAAM,IAAI,GAAG;IACZ,aAAa,EAAE,0CAA0C;IACzD,kBAAkB,EAAE,iCAAiC;IACrD,kBAAkB,EAAE,mDAAmD;IACvE,aAAa,EAAE,yBAAyB;IACxC,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,sCAAsC;CACrD,CAAC;AAEF,MAAa,UAAU;IAItB;;;;;OAKG;IACH,YAAsB,QAAQ,qBAAqB,EAAY,KAAqB;QAA9D,UAAK,GAAL,KAAK,CAAwB;QAAY,UAAK,GAAL,KAAK,CAAgB;QAT1E,WAAM,GAAyB,EAAE,CAAC;QAClC,WAAM,GAAwB,EAAE,CAAC;IAQ4C,CAAC;IAExF,4BAA4B;IAC5B,KAAK,CAAC,MAAM,EAAE,QAAQ,IAAG,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,IAAG,CAAC;IAC7B,OAAO,CAAC,QAAQ,IAAG,CAAC;IAEpB,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAW,IAAI;QACd,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,MAAuB,EAAE,QAAW;QACvC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,MAAM,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AuB;QAEvB,gBAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;YAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACJ,MAAM,MAAM,GAAG,IAAI,UAAU,CAAI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,aAA4B;QAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC;QAEhC,gBAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC1B,CAAC;CACD;AA5ZD,gCA4ZC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n\tTYPE_MISMATCH: \"Type does not match this collection type\",\n\tKEY_ALREADY_EXISTS: \"Collection key already exists. \",\n\tKEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n\tMUST_GIVE_KEY: \"Collection missing key.\",\n\tMUST_GIVE_VALUE: \"Collection missing value.\",\n\tKEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n\tprotected _items: { [key: string]: T } = {};\n\tprotected _order: (string | number)[] = [];\n\n\t/**\n\t * @param _name - a friendly name to describe this collection. If undefined\n\t * the collection will have a default \"Untitled Collection\" assigned to its name.\n\t * @param _type - optional parameter pointing to the constructor\n\t * of a type this Collection will host.\n\t */\n\tconstructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {}\n\n\t// Pass-thru binding handles\n\tonAdd(in_key, in_value) {}\n\tonRemove(in_key, in_value) {}\n\tonClear(in_items) {}\n\n\tpublic get items() {\n\t\treturn this._items;\n\t}\n\n\tpublic get keys() {\n\t\treturn Object.keys(this._items);\n\t}\n\n\t/**\n\t * @param in_key - Key to store the value under\n\t * @param in_value - Value to store in the collection\n\t * @returns Return the value passed in\n\t */\n\tadd(in_key: number | string, in_value: T): T {\n\t\tthis._checkType(in_value);\n\t\tthis._checkIsNewKey(in_key);\n\n\t\tthis._items[in_key] = in_value;\n\t\tthis._order.push(in_key);\n\n\t\tthis.onAdd(in_key, in_value);\n\n\t\treturn in_value;\n\t}\n\n\t/**\n\t * Checks if in_value's type is equal to this Collection type. If this collection\n\t * has no type set, the check will pass.\n\t *\n\t * @param in_value - A value that is equal to the type managed by this collection.\n\t * @returns Return true if the type is a valid type for this\n\t * collection, throw otherwise.\n\t */\n\tprivate _checkType(in_value: T) {\n\t\tif (this._type && !(in_value instanceof this._type)) {\n\t\t\tthrow new Error(MSGS.TYPE_MISMATCH);\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/**\n\t * Bulk add items.\n\t * @param in_items - List of key-value pairs to be stored in the collection\n\t * @returns this collection after add\n\t */\n\tbulkAdd(in_items: { [key: string]: T }) {\n\t\t_.each(in_items, (item, key) => {\n\t\t\tthis.add(key, item);\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Bulk remove items.\n\t * @param in_items - List of key-value items to be removed\n\t * @returns this collection after add\n\t */\n\tbulkRemove(in_items: { [key: string]: T }) {\n\t\t_.each(in_items, (item, key) => {\n\t\t\tthis.remove(key);\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Test if this collection is empty\n\t * @returns true if empty, false otherwise\n\t * */\n\tisEmpty() {\n\t\treturn _.isEmpty(this._items);\n\t}\n\n\t/**\n\t * Return the first item in the collection, null if empty\n\t * @returns first item, or undefined if empty\n\t * */\n\tgetFirstItem(): T | undefined {\n\t\tconst index = _.first(this._order);\n\t\treturn index === undefined ? index : this._items[index];\n\t}\n\n\t/**\n\t * Return the last item in the collection, undefined if empty\n\t * @returns The last item, or undefined if empty\n\t * */\n\tgetLastItem(): T | undefined {\n\t\tconst index = _.last(this._order);\n\t\treturn index === undefined ? index : this._items[index];\n\t}\n\n\t/**\n\t * @returns Returns the type of collection (Array, etc.)\n\t */\n\tgetType() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * @returns Returns the name of the collection\n\t */\n\tgetName(): string {\n\t\treturn this._name;\n\t}\n\n\t/**\n\t * Filter out by function\n\t * @param in_filterFunction - with arguments key and item\n\t * @returns A new filtered collection\n\t */\n\tfilter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = function (in_key, in_item) {\n\t\t\tconst keeper = in_filterFunction(in_key, in_item);\n\t\t\tif (keeper) {\n\t\t\t\trtn.add(in_key, in_item);\n\t\t\t}\n\t\t};\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Filter out all keys NOT matching the in_filterKey\n\t * @param in_filterKey - a single key or an array of keys, if the\n\t * item matches any of the keys it will be filtered in.\n\t * @returns New filtered collection with all the items\n\t * matching at least one key.\n\t */\n\tfilterByKey(in_filterKey: string | string[]): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = _.isArray(in_filterKey)\n\t\t\t? function (in_key, in_item) {\n\t\t\t\t\tif (in_filterKey.includes(in_key)) {\n\t\t\t\t\t\trtn.add(in_key, in_item);\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: function (in_key, in_item) {\n\t\t\t\t\tif (in_key === in_filterKey) {\n\t\t\t\t\t\trtn.add(in_key, in_item);\n\t\t\t\t\t}\n\t\t\t };\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Filter out all keys NOT matching the in_filterValue\n\t * @param in_filterValue - Value to filter on\n\t * @returns Return a filtered collection\n\t */\n\tfilterByValue(in_filterValue: T): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = function (in_key, in_item) {\n\t\t\tif (in_item === in_filterValue) {\n\t\t\t\trtn.add(in_key, in_item);\n\t\t\t}\n\t\t};\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Remove an item from this Collection. This method returns a Boolean indicating\n\t * the success or failure of the removal. This is practical because if we were\n\t * to throw an error when the key doesn't exist, it would require additional\n\t * checks by the caller to make sure this key exists prior to removal. Which\n\t * would make the attempt of removal more verbose and also costly because the\n\t * caller would have to keep a list – somewhere else – of the things he can\n\t * and cannot remove.\n\t *\n\t * @param in_key - the key we wish to remove\n\t * @returns true if the key exists and was removed, false otherwise.\n\t */\n\tremove(in_key: number | string): boolean {\n\t\tif (!this.has(in_key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst remember = this._items[in_key];\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\tdelete this._items[in_key];\n\t\tthis._order.splice(this._order.indexOf(in_key), 1);\n\n\t\tthis.onRemove(in_key, remember);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Return the number of items in this Collection\n\t * @returns the number of items in the collection\n\t */\n\tgetCount(): number {\n\t\treturn this._order.length;\n\t}\n\n\t/**\n\t * Returns this collection as an ordered Array\n\t * @returns Array including the values\n\t */\n\tgetAsArray() {\n\t\tconst rtnArr: T[] = new Array(this.getCount());\n\n\t\tfor (let i = 0; i < this._order.length; i++) {\n\t\t\trtnArr[i] = this._items[this._order[i]];\n\t\t}\n\n\t\treturn rtnArr;\n\t}\n\n\t/**\n\t * @param in_key - the key we are looking for\n\t * @returns true if the item exists\n\t */\n\thas(in_key: string | number): boolean {\n\t\treturn Object.prototype.hasOwnProperty.call(this._items, in_key);\n\t}\n\n\t/**\n\t * Return an item associated with the given key\n\t * @param in_key - the key for the item in this\n\t * Collection\n\t * @returns The item\n\t */\n\titem(in_key: number | string) {\n\t\treturn this._items[in_key];\n\t}\n\n\t/**\n\t * Checks if this is a new key in the collection. Throw if already exists.\n\t * @param in_key - The key to check against\n\t * @returns true if key is new\n\t */\n\tprivate _checkIsNewKey(in_key: number | string) {\n\t\tif (this.has(in_key)) {\n\t\t\tthrow new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Checks if the key exists in the collection. Throw if not.\n\t * @param in_key - the key to check against\n\t * @returns true if key exists\n\t */\n\tprivate _checkKeyExists(in_key: number | string) {\n\t\tif (!this.has(in_key)) {\n\t\t\tthrow new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Set an existing key to a value. If key doesn't exist this call will throw\n\t * an error.\n\t * @param in_key - The key we want to modify\n\t * @param in_value - The value we are to set at this key\n\t * @returns The value passed in\n\t */\n\tset(in_key: string, in_value: T) {\n\t\tthis._checkKeyExists(in_key);\n\n\t\tthis._items[in_key] = in_value;\n\n\t\treturn in_value;\n\t}\n\n\t/**\n\t * Iterate over this collection and run the callback with passing the key and\n\t * item in the iteration loop.\n\t * @param in_callback - A function that we will call on each item\n\t * of this collection. If the callback returns false then the iteration will exit early.\n\t */\n\titerate(in_callback) {\n\t\tfor (const key of this._order) {\n\t\t\tconst continu = in_callback(key, this._items[key]);\n\t\t\tif (continu === false) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Iterate over this collection starting from the tail and run the callback with passing the key and\n\t * item in the iteration loop.\n\t * @param in_callback - a function that we will call on each item\n\t * of this collection. If the callback returns false then the iteration will exit early.\n\t */\n\titerateFromTail(in_callback) {\n\t\tlet key;\n\t\tlet continu;\n\t\tfor (let i = this._order.length - 1; i >= 0; i--) {\n\t\t\tkey = this._order[i];\n\t\t\tcontinu = in_callback(key, this._items[key]);\n\t\t\tif (continu === false) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @returns Return an object containing the items of this collection\n\t */\n\tgetItems(): { [key: string]: T } {\n\t\tconst result = {};\n\n\t\t_.each(this._items, function (item, key) {\n\t\t\tresult[key] = item;\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Return the list of keys\n\t * @returns List of keys\n\t */\n\tgetKeys(): string[] {\n\t\treturn Object.keys(this._items);\n\t}\n\n\t/**\n\t * Method used to get the first element in the collection along with its key.\n\t */\n\tpeak() {\n\t\treturn {\n\t\t\titem: this._items[this._order[0]],\n\t\t\tkey: this._order[0],\n\t\t};\n\t}\n\n\t/**\n\t * Clear this collection\n\t * @returns this collection\n\t */\n\tclear() {\n\t\tif (_.isEmpty(this._items)) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.onClear(this._items);\n\n\t\t// Best to just iterate through and remove everything, so that OnRemove\n\t\t// handlers are called.\n\n\t\t_.each(this.getKeys(), (key) => {\n\t\t\tthis.remove(key);\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @param in_collection - the collection we want to\n\t * copy from.\n\t * @returns new Collection\n\t */\n\tclone(): Collection<T> {\n\t\tconst newCol = new Collection<T>(this._name, this._type);\n\t\tnewCol.bulkAdd(this._items);\n\t\treturn newCol;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @param in_collection - the collection we want to\n\t * copy from.\n\t */\n\tcopy(in_collection: Collection<T>) {\n\t\tthis.clear();\n\t\tconst its = in_collection.items;\n\n\t\t_.each(its, (item, key) => {\n\t\t\tthis.add(key, item);\n\t\t});\n\t}\n\n\tget values() {\n\t\treturn this.getAsArray();\n\t}\n}\n"]}
package/dist/guidUtils.js CHANGED
@@ -100,7 +100,7 @@ const isBase64 = (GUID) => GUID.length === 22;
100
100
  *
101
101
  * @param a - unsigned int32 value
102
102
  * @param b - unsigned int32 value
103
- * @returns - result of unsigned integer multiplication
103
+ * @returns The result of the unsigned integer multiplication.
104
104
  */
105
105
  function multiply_uint32(a, b) {
106
106
  let n = a;
@@ -1 +1 @@
1
- {"version":3,"file":"guidUtils.js","sourceRoot":"","sources":["../src/guidUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+BAA+B;AAE/B;;GAEG;AAEH,0DAAiC;AACjC,8DAAkE;AAClE,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,GAAG;IACf,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,aAAa,EAAE,KAAK;IAEpB;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,OAAgB,EAAE,6BAAsC,KAAK;QACvE,6DAA6D;QAC7D,sDAAsD;QACtD,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,0BAA0B,EAAE;YACtD,OAAO,CAAC,CAAC;SACT;aAAM;YACN,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAE1B,IAAI,OAAO,KAAK,SAAS,EAAE;gBAC1B,MAAM,YAAY,GAAG,IAAA,8CAAyB,EAAC,CAAC,CAAC,CAAC;gBAClD,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,EAAE,GA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KAAK,CAAC,CAAC;IAC7E,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7E,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE7E,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,UAAU,QAAgB,EAAE,QAAgB,EAAE,MAAM,GAAG,KAAK;IAChF,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC9D,OAAO,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,mCAAmC;AACnC,OAAO,CAAC,UAAU,EAAE,CAAC;AAErB,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE;IAC3C,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEW,QAAA,SAAS,GAAG;IACxB,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,uBAAuB;IACvB,YAAY;IACZ,MAAM;IACN,YAAY;IACZ,mBAAmB;CACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\n/**\n * @fileoverview Utility functions related to handling GUIDs\n */\n\nimport base64js from \"base64-js\";\nimport { generateRandomUInt32Array } from \"../platform-dependent\";\nconst UINT_32HASH_PRIME = 16777619;\n\n/**\n * Fast high quality 32 bit RNG for consistent GUID.\n *\n * Good \"randomness\" (distribution); Period is approximately equal to 3.11*10^37\n * Implementation was take from \"Numerical recipes. The Art of Scientific Computing.\", 3rd edition.\n * Page 357, algorithm name: Ranlim32\n */\nconst guidRNG = {\n\tu: 0,\n\tv: 0,\n\tw1: 0,\n\tw2: 0,\n\tisInitialized: false,\n\n\t/**\n\t * Initialize RNG.\n\t * This function need to be called once, before the first GUID gets created.\n\t *\n\t * @param in_seed - Optional 32-bit seed for GUID RNG.\n\t * If no seed is given, a combination of system's local time and `Math.random()` is used.\n\t * @param in_enforceReInitialization - Optionally enforce re-initialization with another seed.\n\t *\n\t * @returns The seed used to initialize the RNG;\n\t * If re-initialization is not enforced, a zero indicates that the RNG was not re-seeded.\n\t *\n\t * @alias property-common.initializeGUIDGenerator\n\t */\n\tinitialize(in_seed?: number, in_enforceReInitialization: boolean = false): number {\n\t\t// Quit if the RNG has already been initialized and we do not\n\t\t// want to enforce a re-initialization with a new seed\n\t\tif (this.isInitialized && !in_enforceReInitialization) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\tthis.isInitialized = true;\n\n\t\t\tif (in_seed === undefined) {\n\t\t\t\tconst randomValues = generateRandomUInt32Array(4);\n\t\t\t\tthis.u = randomValues[0];\n\t\t\t\tthis.v = randomValues[1];\n\t\t\t\tthis.w1 = randomValues[2];\n\t\t\t\tthis.w2 = randomValues[3];\n\t\t\t} else {\n\t\t\t\tthis.v = 224461437;\n\t\t\t\tthis.w1 = 521288629;\n\t\t\t\tthis.w2 = 362436069;\n\n\t\t\t\tthis.u = in_seed ^ this.v;\n\t\t\t\tthis.genRandUInt32();\n\t\t\t\tthis.v = this.u;\n\t\t\t\tthis.genRandUInt32();\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\t},\n\n\t/**\n\t * @returns 32-bit random number based on the RNGs internal state\n\t */\n\tgenRandUInt32(): number {\n\t\tthis.u = multiply_uint32(this.u, 2891336453) + 1640531513;\n\t\tthis.v ^= this.v >>> 13;\n\t\tthis.v ^= this.v << 17;\n\t\tthis.v = ((this.v >>> 5) ^ this.v) >>> 0;\n\n\t\tthis.w1 = multiply_uint32(33378, this.w1 & 0xffff) + (this.w1 >>> 16);\n\t\tthis.w2 = multiply_uint32(57225, this.w2 & 0xffff) + (this.w2 >>> 16);\n\n\t\tlet x = this.u ^ (this.u << 9);\n\t\tx ^= x >>> 17;\n\t\tx ^= x << 6;\n\n\t\tlet y = this.w1 ^ (this.w1 << 17);\n\t\ty ^= y >>> 15;\n\t\ty ^= y << 5;\n\t\treturn (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;\n\t},\n};\n\n/**\n * Check if GUID is base64 based on the length\n * The length of base16 GUID is 36, base64 - 22\n *\n * @param GUID - Input GUID\n * @returns True if GUID is base64\n */\nconst isBase64 = (GUID: string): boolean => GUID.length === 22;\n\n/**\n * Allows for 32-bit integer multiplication with C-like semantics\n *\n * @param a - unsigned int32 value\n * @param b - unsigned int32 value\n * @returns - result of unsigned integer multiplication\n */\nfunction multiply_uint32(a: number, b: number): number {\n\tlet n = a;\n\tlet m = b;\n\n\tn >>>= 0;\n\tm >>>= 0;\n\tconst nlo = n & 0xffff;\n\treturn ((((n - nlo) * m) >>> 0) + nlo * m) >>> 0;\n}\n\n/**\n * Helper function to convert base64 encoding to url friendly format\n *\n * @param base64 - Base64 string\n *\n * @returns Url-friendly base64 encoding.\n */\nconst toUrlBase64 = (base64: string): string =>\n\tbase64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").split(\"=\")[0];\n\n/**\n * Helper function to recover padding of base64 encoding\n *\n * @param x - Base64 string\n *\n * @returns Padded base64 encoding.\n */\nconst toPaddedBase64 = function (x: string): string {\n\tlet base64 = x;\n\tconst padLength = 4 - (base64.length % 4);\n\tbase64 += \"=\".repeat(padLength);\n\treturn base64;\n};\n\n/**\n * Helper function to create a GUID string from an array with 32Bit values\n *\n * @param in_guidArray - Array with the 32 bit values\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The GUID\n */\nconst uint32x4ToGUID = function (\n\tin_guidArray: Uint32Array | Int32Array | number[],\n\tbase64: boolean = false,\n): string {\n\tif (base64) {\n\t\tconst intArray = new Uint32Array(in_guidArray);\n\t\tconst byteArray = new Uint8Array(intArray.buffer);\n\t\tconst base64guid = base64js.fromByteArray(byteArray);\n\t\t// return url-friendly base64\n\t\treturn toUrlBase64(base64guid);\n\t} else {\n\t\t// Convert to hexadecimal string\n\t\tlet str = \"\";\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tconst hex = in_guidArray[i].toString(16);\n\t\t\tstr += \"0\".repeat(8 - hex.length) + hex;\n\t\t}\n\t\treturn `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(\n\t\t\t16,\n\t\t\t4,\n\t\t)}-${str.substr(20, 12)}`;\n\t}\n};\n\n/**\n * Convert GUID to four 32Bit values.\n *\n * @param in_guid - The GUID to convert\n * @param io_result - An optional array to write the result to.\n * If no array is given, a new one gets created.\n * @returns Four 32-bit values\n *\n */\nconst guidToUint32x4 = function (\n\tin_guid: string,\n\tresult: Uint32Array = new Uint32Array(4),\n): Uint32Array {\n\tif (isBase64(in_guid)) {\n\t\tconst GUID = toPaddedBase64(in_guid);\n\t\tconst bytes = base64js.toByteArray(GUID);\n\t\tconst intArray = new Uint32Array(bytes.buffer);\n\t\tresult.set(intArray);\n\t} else {\n\t\tresult[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);\n\t\tresult[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);\n\t\tresult[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);\n\t\tresult[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);\n\t}\n\treturn result;\n};\n\n/**\n * Convert base64 GUID into base16.\n *\n * @param in_guid - Base64 GUID to convert\n * @returns Base16 GUID\n *\n */\nconst base64Tobase16 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid));\n\n/**\n * Convert base16 into base64 GUID.\n *\n * @param in_guid - Base16 GUID to convert\n * @returns Base64 GUID\n *\n */\nconst base16ToBase64 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid), true);\n\n/**\n * Based on the boolean parameter generate either\n * a 128 bit base16 GUID with the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx\n * or url-friendly base64 string GUID of length 22\n *\n * This function is *not* thread safe!\n *\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The GUID\n */\nconst generateGUID = function (base64 = false): string {\n\tconst rnds = new Uint32Array(4);\n\n\t// Random numbers for GUID (4x32 bit)\n\trnds[0] = guidRNG.genRandUInt32();\n\trnds[1] = guidRNG.genRandUInt32();\n\trnds[2] = guidRNG.genRandUInt32();\n\trnds[3] = guidRNG.genRandUInt32();\n\treturn uint32x4ToGUID(rnds, base64);\n};\n\n// The last character is checked this way because last 4 bits of 22nd character are ignored\n// by decoder, e.g. \"+Q\" and \"+Z\" result in the same decoding.\n// The only characters with last 4 bits set to 0 are A, Q, g, w.\nconst reBase64 = /^[\\w-]{21}[AQgw]$/;\n// eslint-disable-next-line unicorn/no-unsafe-regex\nconst reBase16 = /^[\\dA-Fa-f]{8}(?:-[\\dA-Fa-f]{4}){3}-[\\dA-Fa-f]{12}$/;\n\n/**\n * Routine used to check whether the given string is a valid GUID\n *\n * @param in_guid - The GUID to test.\n * @returns True if the parameter is a valid GUID, false otherwise.\n */\nconst isGUID = (in_guid: string) => reBase16.test(in_guid) || reBase64.test(in_guid);\n\n/**\n * Performs a hash combination operation on the two supplied Uint32 arrays of length 4 (using\n * a variant of the algorithm from boost::hash_combine\n *\n * @param in_array1 - First array\n * @param in_array2 - Second array\n * @returns New combined hash\n */\nconst hashCombine4xUint32 = function (\n\tin_array1: Uint32Array,\n\tin_array2: Uint32Array,\n\tio_result?: Uint32Array,\n): Uint32Array {\n\tlet accumulated = io_result;\n\tif (accumulated === undefined) {\n\t\taccumulated = new Uint32Array(in_array2);\n\t} else {\n\t\taccumulated[0] = in_array2[0];\n\t\taccumulated[1] = in_array2[1];\n\t\taccumulated[2] = in_array2[2];\n\t\taccumulated[3] = in_array2[3];\n\t}\n\n\taccumulated[0] += 0x9e3779b9;\n\taccumulated[1] += 0x638f227;\n\taccumulated[2] += 0x1aff2bad;\n\taccumulated[3] += 0x3a8f05c5;\n\n\taccumulated[0] += in_array1[3] << 6;\n\taccumulated[1] += in_array1[0] << 6;\n\taccumulated[2] += in_array1[1] << 6;\n\taccumulated[3] += in_array1[2] << 6;\n\n\taccumulated[0] += in_array1[2] >> 2;\n\taccumulated[1] += in_array1[3] >> 2;\n\taccumulated[2] += in_array1[0] >> 2;\n\taccumulated[3] += in_array1[1] >> 2;\n\n\taccumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;\n\taccumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;\n\taccumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;\n\taccumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;\n\n\treturn accumulated;\n};\n\n/**\n * Takes two guids and generates a new derived GUID.\n *\n * @remarks Note: You should only use this helper function when you need only one combination.\n * Otherwise, it is more efficient to work on the uint8 arrays directly.\n *\n * @param in_guid1 - Input GUID\n * @param in_guid2 - Input GUID\n * @param base64 - Use base64 encoding instead of standart GUIDs\n * @returns Combined GUID\n */\nconst combineGuids = function (in_guid1: string, in_guid2: string, base64 = false): string {\n\tconst firstArray = guidToUint32x4(in_guid1);\n\tconst secondArray = guidToUint32x4(in_guid2);\n\tconst combined = hashCombine4xUint32(firstArray, secondArray);\n\treturn uint32x4ToGUID(combined, base64);\n};\n\n// Make sure the RNG is initialized\nguidRNG.initialize();\n\nconst initializeGUIDGenerator = (...args) => {\n\tguidRNG.initialize(...args);\n};\n\nexport const GuidUtils = {\n\tuint32x4ToGUID,\n\tguidToUint32x4,\n\tbase64Tobase16,\n\tbase16ToBase64,\n\tinitializeGUIDGenerator,\n\tgenerateGUID,\n\tisGUID,\n\tcombineGuids,\n\thashCombine4xUint32,\n};\n"]}
1
+ {"version":3,"file":"guidUtils.js","sourceRoot":"","sources":["../src/guidUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+BAA+B;AAE/B;;GAEG;AAEH,0DAAiC;AACjC,8DAAkE;AAClE,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,GAAG;IACf,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,aAAa,EAAE,KAAK;IAEpB;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,OAAgB,EAAE,6BAAsC,KAAK;QACvE,6DAA6D;QAC7D,sDAAsD;QACtD,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,0BAA0B,EAAE;YACtD,OAAO,CAAC,CAAC;SACT;aAAM;YACN,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAE1B,IAAI,OAAO,KAAK,SAAS,EAAE;gBAC1B,MAAM,YAAY,GAAG,IAAA,8CAAyB,EAAC,CAAC,CAAC,CAAC;gBAClD,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;aAC1B;iBAAM;gBACN,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;gBACnB,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC;gBACpB,IAA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AC,KAAK,CAAC,CAAC;IAC7E,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE7E,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,UAAU,QAAgB,EAAE,QAAgB,EAAE,MAAM,GAAG,KAAK;IAChF,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC9D,OAAO,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,mCAAmC;AACnC,OAAO,CAAC,UAAU,EAAE,CAAC;AAErB,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE;IAC3C,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEW,QAAA,SAAS,GAAG;IACxB,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,uBAAuB;IACvB,YAAY;IACZ,MAAM;IACN,YAAY;IACZ,mBAAmB;CACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\n/**\n * @fileoverview Utility functions related to handling GUIDs\n */\n\nimport base64js from \"base64-js\";\nimport { generateRandomUInt32Array } from \"../platform-dependent\";\nconst UINT_32HASH_PRIME = 16777619;\n\n/**\n * Fast high quality 32 bit RNG for consistent GUID.\n *\n * Good \"randomness\" (distribution); Period is approximately equal to 3.11*10^37\n * Implementation was take from \"Numerical recipes. The Art of Scientific Computing.\", 3rd edition.\n * Page 357, algorithm name: Ranlim32\n */\nconst guidRNG = {\n\tu: 0,\n\tv: 0,\n\tw1: 0,\n\tw2: 0,\n\tisInitialized: false,\n\n\t/**\n\t * Initialize RNG.\n\t * This function need to be called once, before the first GUID gets created.\n\t *\n\t * @param in_seed - Optional 32-bit seed for GUID RNG.\n\t * If no seed is given, a combination of system's local time and `Math.random()` is used.\n\t * @param in_enforceReInitialization - Optionally enforce re-initialization with another seed.\n\t *\n\t * @returns The seed used to initialize the RNG;\n\t * If re-initialization is not enforced, a zero indicates that the RNG was not re-seeded.\n\t *\n\t * @alias property-common.initializeGUIDGenerator\n\t */\n\tinitialize(in_seed?: number, in_enforceReInitialization: boolean = false): number {\n\t\t// Quit if the RNG has already been initialized and we do not\n\t\t// want to enforce a re-initialization with a new seed\n\t\tif (this.isInitialized && !in_enforceReInitialization) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\tthis.isInitialized = true;\n\n\t\t\tif (in_seed === undefined) {\n\t\t\t\tconst randomValues = generateRandomUInt32Array(4);\n\t\t\t\tthis.u = randomValues[0];\n\t\t\t\tthis.v = randomValues[1];\n\t\t\t\tthis.w1 = randomValues[2];\n\t\t\t\tthis.w2 = randomValues[3];\n\t\t\t} else {\n\t\t\t\tthis.v = 224461437;\n\t\t\t\tthis.w1 = 521288629;\n\t\t\t\tthis.w2 = 362436069;\n\n\t\t\t\tthis.u = in_seed ^ this.v;\n\t\t\t\tthis.genRandUInt32();\n\t\t\t\tthis.v = this.u;\n\t\t\t\tthis.genRandUInt32();\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\t},\n\n\t/**\n\t * @returns 32-bit random number based on the RNGs internal state\n\t */\n\tgenRandUInt32(): number {\n\t\tthis.u = multiply_uint32(this.u, 2891336453) + 1640531513;\n\t\tthis.v ^= this.v >>> 13;\n\t\tthis.v ^= this.v << 17;\n\t\tthis.v = ((this.v >>> 5) ^ this.v) >>> 0;\n\n\t\tthis.w1 = multiply_uint32(33378, this.w1 & 0xffff) + (this.w1 >>> 16);\n\t\tthis.w2 = multiply_uint32(57225, this.w2 & 0xffff) + (this.w2 >>> 16);\n\n\t\tlet x = this.u ^ (this.u << 9);\n\t\tx ^= x >>> 17;\n\t\tx ^= x << 6;\n\n\t\tlet y = this.w1 ^ (this.w1 << 17);\n\t\ty ^= y >>> 15;\n\t\ty ^= y << 5;\n\t\treturn (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;\n\t},\n};\n\n/**\n * Check if GUID is base64 based on the length\n * The length of base16 GUID is 36, base64 - 22\n *\n * @param GUID - Input GUID\n * @returns True if GUID is base64\n */\nconst isBase64 = (GUID: string): boolean => GUID.length === 22;\n\n/**\n * Allows for 32-bit integer multiplication with C-like semantics\n *\n * @param a - unsigned int32 value\n * @param b - unsigned int32 value\n * @returns The result of the unsigned integer multiplication.\n */\nfunction multiply_uint32(a: number, b: number): number {\n\tlet n = a;\n\tlet m = b;\n\n\tn >>>= 0;\n\tm >>>= 0;\n\tconst nlo = n & 0xffff;\n\treturn ((((n - nlo) * m) >>> 0) + nlo * m) >>> 0;\n}\n\n/**\n * Helper function to convert base64 encoding to url friendly format\n *\n * @param base64 - Base64 string\n *\n * @returns Url-friendly base64 encoding.\n */\nconst toUrlBase64 = (base64: string): string =>\n\tbase64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").split(\"=\")[0];\n\n/**\n * Helper function to recover padding of base64 encoding\n *\n * @param x - Base64 string\n *\n * @returns Padded base64 encoding.\n */\nconst toPaddedBase64 = function (x: string): string {\n\tlet base64 = x;\n\tconst padLength = 4 - (base64.length % 4);\n\tbase64 += \"=\".repeat(padLength);\n\treturn base64;\n};\n\n/**\n * Helper function to create a GUID string from an array with 32Bit values\n *\n * @param in_guidArray - Array with the 32 bit values\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The GUID\n */\nconst uint32x4ToGUID = function (\n\tin_guidArray: Uint32Array | Int32Array | number[],\n\tbase64: boolean = false,\n): string {\n\tif (base64) {\n\t\tconst intArray = new Uint32Array(in_guidArray);\n\t\tconst byteArray = new Uint8Array(intArray.buffer);\n\t\tconst base64guid = base64js.fromByteArray(byteArray);\n\t\t// return url-friendly base64\n\t\treturn toUrlBase64(base64guid);\n\t} else {\n\t\t// Convert to hexadecimal string\n\t\tlet str = \"\";\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tconst hex = in_guidArray[i].toString(16);\n\t\t\tstr += \"0\".repeat(8 - hex.length) + hex;\n\t\t}\n\t\treturn `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(\n\t\t\t16,\n\t\t\t4,\n\t\t)}-${str.substr(20, 12)}`;\n\t}\n};\n\n/**\n * Convert GUID to four 32Bit values.\n *\n * @param in_guid - The GUID to convert\n * @param io_result - An optional array to write the result to.\n * If no array is given, a new one gets created.\n * @returns Four 32-bit values\n *\n */\nconst guidToUint32x4 = function (\n\tin_guid: string,\n\tresult: Uint32Array = new Uint32Array(4),\n): Uint32Array {\n\tif (isBase64(in_guid)) {\n\t\tconst GUID = toPaddedBase64(in_guid);\n\t\tconst bytes = base64js.toByteArray(GUID);\n\t\tconst intArray = new Uint32Array(bytes.buffer);\n\t\tresult.set(intArray);\n\t} else {\n\t\tresult[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);\n\t\tresult[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);\n\t\tresult[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);\n\t\tresult[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);\n\t}\n\treturn result;\n};\n\n/**\n * Convert base64 GUID into base16.\n *\n * @param in_guid - Base64 GUID to convert\n * @returns Base16 GUID\n *\n */\nconst base64Tobase16 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid));\n\n/**\n * Convert base16 into base64 GUID.\n *\n * @param in_guid - Base16 GUID to convert\n * @returns Base64 GUID\n *\n */\nconst base16ToBase64 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid), true);\n\n/**\n * Based on the boolean parameter generate either\n * a 128 bit base16 GUID with the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx\n * or url-friendly base64 string GUID of length 22\n *\n * This function is *not* thread safe!\n *\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The GUID\n */\nconst generateGUID = function (base64 = false): string {\n\tconst rnds = new Uint32Array(4);\n\n\t// Random numbers for GUID (4x32 bit)\n\trnds[0] = guidRNG.genRandUInt32();\n\trnds[1] = guidRNG.genRandUInt32();\n\trnds[2] = guidRNG.genRandUInt32();\n\trnds[3] = guidRNG.genRandUInt32();\n\treturn uint32x4ToGUID(rnds, base64);\n};\n\n// The last character is checked this way because last 4 bits of 22nd character are ignored\n// by decoder, e.g. \"+Q\" and \"+Z\" result in the same decoding.\n// The only characters with last 4 bits set to 0 are A, Q, g, w.\nconst reBase64 = /^[\\w-]{21}[AQgw]$/;\n// eslint-disable-next-line unicorn/no-unsafe-regex\nconst reBase16 = /^[\\dA-Fa-f]{8}(?:-[\\dA-Fa-f]{4}){3}-[\\dA-Fa-f]{12}$/;\n\n/**\n * Routine used to check whether the given string is a valid GUID\n *\n * @param in_guid - The GUID to test.\n * @returns True if the parameter is a valid GUID, false otherwise.\n */\nconst isGUID = (in_guid: string) => reBase16.test(in_guid) || reBase64.test(in_guid);\n\n/**\n * Performs a hash combination operation on the two supplied Uint32 arrays of length 4 (using\n * a variant of the algorithm from boost::hash_combine\n *\n * @param in_array1 - First array\n * @param in_array2 - Second array\n * @returns New combined hash\n */\nconst hashCombine4xUint32 = function (\n\tin_array1: Uint32Array,\n\tin_array2: Uint32Array,\n\tio_result?: Uint32Array,\n): Uint32Array {\n\tlet accumulated = io_result;\n\tif (accumulated === undefined) {\n\t\taccumulated = new Uint32Array(in_array2);\n\t} else {\n\t\taccumulated[0] = in_array2[0];\n\t\taccumulated[1] = in_array2[1];\n\t\taccumulated[2] = in_array2[2];\n\t\taccumulated[3] = in_array2[3];\n\t}\n\n\taccumulated[0] += 0x9e3779b9;\n\taccumulated[1] += 0x638f227;\n\taccumulated[2] += 0x1aff2bad;\n\taccumulated[3] += 0x3a8f05c5;\n\n\taccumulated[0] += in_array1[3] << 6;\n\taccumulated[1] += in_array1[0] << 6;\n\taccumulated[2] += in_array1[1] << 6;\n\taccumulated[3] += in_array1[2] << 6;\n\n\taccumulated[0] += in_array1[2] >> 2;\n\taccumulated[1] += in_array1[3] >> 2;\n\taccumulated[2] += in_array1[0] >> 2;\n\taccumulated[3] += in_array1[1] >> 2;\n\n\taccumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;\n\taccumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;\n\taccumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;\n\taccumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;\n\n\treturn accumulated;\n};\n\n/**\n * Takes two guids and generates a new derived GUID.\n *\n * @remarks Note: You should only use this helper function when you need only one combination.\n * Otherwise, it is more efficient to work on the uint8 arrays directly.\n *\n * @param in_guid1 - Input GUID\n * @param in_guid2 - Input GUID\n * @param base64 - Use base64 encoding instead of standart GUIDs\n * @returns Combined GUID\n */\nconst combineGuids = function (in_guid1: string, in_guid2: string, base64 = false): string {\n\tconst firstArray = guidToUint32x4(in_guid1);\n\tconst secondArray = guidToUint32x4(in_guid2);\n\tconst combined = hashCombine4xUint32(firstArray, secondArray);\n\treturn uint32x4ToGUID(combined, base64);\n};\n\n// Make sure the RNG is initialized\nguidRNG.initialize();\n\nconst initializeGUIDGenerator = (...args) => {\n\tguidRNG.initialize(...args);\n};\n\nexport const GuidUtils = {\n\tuint32x4ToGUID,\n\tguidToUint32x4,\n\tbase64Tobase16,\n\tbase16ToBase64,\n\tinitializeGUIDGenerator,\n\tgenerateGUID,\n\tisGUID,\n\tcombineGuids,\n\thashCombine4xUint32,\n};\n"]}
@@ -145,6 +145,7 @@ export declare const constants: {
145
145
  * Your property template should include a typeid attribute.
146
146
  *
147
147
  * @example
148
+ *
148
149
  *```json
149
150
  * {
150
151
  * "typeid": "my.example:point2d-1.0.0",
@@ -161,7 +162,9 @@ export declare const constants: {
161
162
  *
162
163
  * Typeid should contain a template version number.
163
164
  *
164
- * @example “typeid: my.example:point2d-1.0.0”
165
+ * @example
166
+ *
167
+ * “typeid: my.example:point2d-1.0.0”
165
168
  */
166
169
  MISSING_VERSION: string;
167
170
  /**
@@ -308,6 +311,7 @@ export declare const constants: {
308
311
  * When using ‘inherits’ in your property template, it must be a string or an array.
309
312
  *
310
313
  * @example
314
+ *
311
315
  * ```json
312
316
  * {
313
317
  * typeid:'my.example:point2d-1.0.0',
@@ -471,6 +475,7 @@ export declare const constants: {
471
475
  * You need a ‘typeid’ field in your template schema.
472
476
  *
473
477
  * @example
478
+ *
474
479
  * ```json
475
480
  * {
476
481
  * ‘typeid’: 'autodesk.test:set.set-1.0.0',
@@ -496,6 +501,7 @@ export declare const constants: {
496
501
  * Each entry in your enum property array must have an id.
497
502
  *
498
503
  * @example
504
+ *
499
505
  * ```json
500
506
  * {
501
507
  * "typeid": "Adsk.Core:Units.Metric-1.0.0",
@@ -516,6 +522,7 @@ export declare const constants: {
516
522
  * Each entry in your enum property must have a value that is a number.
517
523
  *
518
524
  * @example
525
+ *
519
526
  * ```json
520
527
  * {
521
528
  * "typeid": "Adsk.Core:Units.Metric-1.0.0",
@@ -871,6 +878,7 @@ export declare const constants: {
871
878
  * Workspace.get and Property.get take in an id (string or number) or an array of ids.
872
879
  *
873
880
  * @example
881
+ *
874
882
  * ```typescript
875
883
  *.get(‘position’).get(‘x’) or .get([‘property’, ‘x’])
876
884
  * ```
@@ -1236,12 +1244,14 @@ export declare const constants: {
1236
1244
  * The token DEREFERENCE_TOKEN should only be used with .get when the in_ids passed to .get is an array.
1237
1245
  * the DEREFERENCE_TOKEN should follow a path to a reference.
1238
1246
  *
1239
- * @example Valid:
1247
+ * @example Valid
1248
+ *
1240
1249
  * ```typescript
1241
1250
  * myProp.get(['myReference', TOKENS.DEREFERENCE_TOKEN])
1242
1251
  * ```
1243
1252
  *
1244
- * @example Not valid:
1253
+ * @example Not valid
1254
+ *
1245
1255
  * ```typescript
1246
1256
  * myProp.get('myReference').get(TOKENS.DEREFERENCE_TOKEN)
1247
1257
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0rDH,eAAO,MAAM,SAAS;;QA1LrB;;WAEG;;QAGH;;WAEG;;QAn4CH;;WAEG;;;QAk6CH;;;;;WAKG;;QAGH;;WAEG;;QAIH;;WAEG;;QAGH;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;QAKH;;WAEG;;QAGH;;WAEG;;QAIH;;WAEG;;QAIH;;WAEG;;QAIH;;WAEG;;QAIH;;WAEG;;QAIH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAIH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAlqDH;;;;;;;;WAQG;;QAIH;;;;;WAKG;;QAGH;;;;WAIG;;QAGH;;;;;;;;;;;;;;;WAeG;;QAIH;;;;;;WAMG;;QAGH;;;;;;;;;;;WAWG;;QAGH;;;;;;;WAOG;;QAIH;;;;WAIG;;QAGH;;;;WAIG;;QAIH;;WAEG;;QAGH;;;;WAIG;;QAIH;;WAEG;;QAGH;;WAEG;;QAGH;;WAEG;;QAs0CH;;;;;WAKG;;QAGH;;;;;WAKG;;QAIH;;;;;WAKG;;QAGH;;WAEG;;QAGH;;WAEG;;QAGH;;;;WAIG;;QAGH;;;WAGG;;QAGH;;WAEG;;QAGH;;WAEG;;QA1fH;;;;;;WAMG;;Q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WAQG;;QAGH;;;;;WAKG;;QAIH;;;;;;WAMG;;QAIH;;;;WAIG;;QAIH;;;;WAIG;;QAIH;;;;WAIG;;QAIH;;;;WAIG;;QAIH;;;;WAIG;;QAIH;;;;;WAKG;;QAGH;;;;WAIG;;QAIH;;;;WAIG;;QAGH;;;;WAIG;;;QAKH;;;;WAIG;;QAGH;;;;;;WAMG;;QAIH;;;;;;;WAOG;;;;QAyhBH;;WAEG;;QAGH;;WAEG;;QAGH;;;WAGG;;;;;;;CAoKH,CAAC"}
package/lib/constants.js CHANGED
@@ -35,6 +35,7 @@ const SchemaValidatorError = {
35
35
  * Your property template should include a typeid attribute.
36
36
  *
37
37
  * @example
38
+ *
38
39
  *```json
39
40
  * {
40
41
  * "typeid": "my.example:point2d-1.0.0",
@@ -51,7 +52,9 @@ const SchemaValidatorError = {
51
52
  *
52
53
  * Typeid should contain a template version number.
53
54
  *
54
- * @example “typeid: my.example:point2d-1.0.0”
55
+ * @example
56
+ *
57
+ * “typeid: my.example:point2d-1.0.0”
55
58
  */
56
59
  MISSING_VERSION: "SV-005: Missing template version in 'typeid' attribute: ",
57
60
  /**
@@ -350,6 +353,7 @@ const PropertyError = {
350
353
  * Workspace.get and Property.get take in an id (string or number) or an array of ids.
351
354
  *
352
355
  * @example
356
+ *
353
357
  * ```typescript
354
358
  *.get(‘position’).get(‘x’) or .get([‘property’, ‘x’])
355
359
  * ```
@@ -730,12 +734,14 @@ const PropertyError = {
730
734
  * The token DEREFERENCE_TOKEN should only be used with .get when the in_ids passed to .get is an array.
731
735
  * the DEREFERENCE_TOKEN should follow a path to a reference.
732
736
  *
733
- * @example Valid:
737
+ * @example Valid
738
+ *
734
739
  * ```typescript
735
740
  * myProp.get(['myReference', TOKENS.DEREFERENCE_TOKEN])
736
741
  * ```
737
742
  *
738
- * @example Not valid:
743
+ * @example Not valid
744
+ *
739
745
  * ```typescript
740
746
  * myProp.get('myReference').get(TOKENS.DEREFERENCE_TOKEN)
741
747
  * ```
@@ -896,6 +902,7 @@ const PropertyFactoryError = {
896
902
  * When using ‘inherits’ in your property template, it must be a string or an array.
897
903
  *
898
904
  * @example
905
+ *
899
906
  * ```json
900
907
  * {
901
908
  * typeid:'my.example:point2d-1.0.0',
@@ -1060,6 +1067,7 @@ const PropertyFactoryError = {
1060
1067
  * You need a ‘typeid’ field in your template schema.
1061
1068
  *
1062
1069
  * @example
1070
+ *
1063
1071
  * ```json
1064
1072
  * {
1065
1073
  * ‘typeid’: 'autodesk.test:set.set-1.0.0',
@@ -1086,6 +1094,7 @@ const PropertyFactoryError = {
1086
1094
  * Each entry in your enum property array must have an id.
1087
1095
  *
1088
1096
  * @example
1097
+ *
1089
1098
  * ```json
1090
1099
  * {
1091
1100
  * "typeid": "Adsk.Core:Units.Metric-1.0.0",
@@ -1106,6 +1115,7 @@ const PropertyFactoryError = {
1106
1115
  * Each entry in your enum property must have a value that is a number.
1107
1116
  *
1108
1117
  * @example
1118
+ *
1109
1119
  * ```json
1110
1120
  * {
1111
1121
  * "typeid": "Adsk.Core:Units.Metric-1.0.0",
@@ -1419,7 +1429,17 @@ const PssClientError = {
1419
1429
  FAILED_TO_GET_SQUASHED_COMMIT_RANGE: "PC-018: Server error: Failed to get squashed commit range. Branch guid: ",
1420
1430
  };
1421
1431
  const PROPERTY_PATH_DELIMITER = ".";
1422
- const MESSAGE_CONSTANTS = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ChangeSetError), PropertyError), PropertyFactoryError), RepositoryError), SchemaValidatorError), PssClientError), UtilsError), TypeidHelperError), ServerError);
1432
+ const MESSAGE_CONSTANTS = {
1433
+ ...ChangeSetError,
1434
+ ...PropertyError,
1435
+ ...PropertyFactoryError,
1436
+ ...RepositoryError,
1437
+ ...SchemaValidatorError,
1438
+ ...PssClientError,
1439
+ ...UtilsError,
1440
+ ...TypeidHelperError,
1441
+ ...ServerError,
1442
+ };
1423
1443
  export const constants = {
1424
1444
  MSG: MESSAGE_CONSTANTS,
1425
1445
  PROPERTY_PATH_DELIMITER,