@player-ui/partial-match-registry 0.15.0-next.7 → 0.15.0
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,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2215/execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/dist/index.global.js","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dlv@1.1.3/node_modules/dlv/index.js","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/deep-partial-matcher.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/index.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/sorted-array@2.0.4/node_modules/sorted-array/sorted-array.js"],"names":["Registry","dlv_es_default","obj","key","def","p","undef","split","length","createObjectMatcher","partialObj","pairs","traverseObj","matchFunction","searchObj","Array","from","entry","path","value","count","size","createBasicMatcher","seed","matcher","match","__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__commonJS","cb","mod","__require","exports","__export","target","all","name","get","enumerable","__copyProps","to","except","desc","call","__toESM","isNodeMode","__esModule","__toCommonJS","require_sorted_array","module","SortedArray","defclass","array","compare","compareDefault","index","insert","element","high","low","pos","ordering","push","search","remove","splice","comparing","property","a","b","constructor","define","amd","src_exports","import_sorted_array","object","Map","keys","val","nestedPath","set","createSortedArray","c","initialSet","store","forEach","query","callbackfn","clear","isRegistryEmpty"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n ));\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/sorted-array@2.0.4/node_modules/sorted-array/sorted-array.js\n var require_sorted_array = __commonJS({\n \"../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/sorted-array@2.0.4/node_modules/sorted-array/sorted-array.js\"(exports, module) {\n \"use strict\";\n var SortedArray2 = function() {\n var SortedArray3 = defclass({\n constructor: function(array, compare) {\n this.array = [];\n this.compare = compare || compareDefault;\n var length = array.length, index = 0;\n while (index < length)\n this.insert(array[index++]);\n },\n insert: function(element) {\n var array = this.array, compare = this.compare, high = array.length - 1, low = 0, pos = -1, index, ordering;\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element);\n if (ordering < 0)\n low = index + 1;\n else if (ordering > 0)\n high = index - 1;\n else {\n pos = index;\n break;\n }\n ;\n }\n if (pos === -1) {\n pos = high;\n }\n pos++;\n high = array.length - 1;\n while (pos < high && compare(element, array[pos]) === 0) {\n pos++;\n }\n index = array.length;\n array.push(element);\n while (index > pos) {\n array[index] = array[--index];\n }\n array[pos] = element;\n return this;\n },\n search: function(element) {\n var array = this.array, compare = this.compare, high = array.length - 1, low = 0, index, ordering;\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element);\n if (ordering < 0)\n low = index + 1;\n else if (ordering > 0)\n high = index - 1;\n else\n return index;\n }\n return -1;\n },\n remove: function(element) {\n var index = this.search(element);\n if (index >= 0)\n this.array.splice(index, 1);\n return this;\n }\n });\n SortedArray3.comparing = function(property, array) {\n return new SortedArray3(array, function(a, b) {\n return compareDefault(a[property], b[property]);\n });\n };\n return SortedArray3;\n function defclass(prototype) {\n var constructor = prototype.constructor;\n constructor.prototype = prototype;\n return constructor;\n }\n function compareDefault(a, b) {\n if (a < b)\n return -1;\n else if (a > b)\n return 1;\n else\n return 0;\n }\n }();\n if (typeof module === \"object\")\n module.exports = SortedArray2;\n if (typeof define === \"function\" && define.amd)\n define(function() {\n return SortedArray2;\n });\n }\n });\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n Registry: () => Registry,\n createObjectMatcher: () => createObjectMatcher\n });\n var import_sorted_array = __toESM(require_sorted_array());\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dlv@1.1.3/node_modules/dlv/dist/dlv.es.js\n function dlv_es_default(t, e, l, n, r) {\n for (e = e.split ? e.split(\".\") : e, n = 0; n < e.length; n++)\n t = t ? t[e[n]] : r;\n return t === r ? l : t;\n }\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/deep-partial-matcher.ts\n function traverseObj(object, path = [], pairs = /* @__PURE__ */ new Map()) {\n for (const key of Object.keys(object)) {\n const val = object[key];\n const nestedPath = [...path, key];\n if (typeof val === \"object\") {\n traverseObj(val, nestedPath, pairs);\n } else {\n pairs.set(nestedPath, val);\n }\n }\n return pairs;\n }\n function createObjectMatcher(partialObj) {\n const pairs = traverseObj(partialObj);\n const matchFunction = (searchObj) => {\n for (const entry of Array.from(pairs)) {\n const [path, value] = entry;\n if (dlv_es_default(searchObj, path) !== value) {\n return false;\n }\n }\n return true;\n };\n matchFunction.count = pairs.size;\n return matchFunction;\n }\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/index.ts\n function createBasicMatcher(seed) {\n const matcher = (match) => seed === match;\n matcher.count = 1;\n return matcher;\n }\n var createSortedArray = () => new import_sorted_array.default([], (c) => c.matcher.count);\n var Registry = class {\n constructor(initialSet) {\n this.store = createSortedArray();\n initialSet?.forEach(([match, value]) => {\n this.set(match, value);\n });\n }\n /** Add match -> value mapping to the registry */\n set(match, value) {\n const matcher = typeof match === \"object\" ? createObjectMatcher(match) : createBasicMatcher(match);\n this.store.insert({\n key: match,\n value,\n matcher\n });\n }\n /** Fetch the best match in the registry */\n get(query) {\n for (const entry of this.store.array) {\n if (entry.matcher(query)) {\n return entry.value;\n }\n }\n }\n /** Loop over all entries and run callback */\n forEach(callbackfn) {\n for (const entry of this.store.array) {\n callbackfn(entry);\n }\n }\n /** Reset the items in the registry */\n clear() {\n this.store = createSortedArray();\n }\n /** Check if the registry is empty*/\n isRegistryEmpty() {\n return this.store.array.length === 0;\n }\n };\n return __toCommonJS(src_exports);\n})();\n","export default function dlv(obj, key, def, p, undef) {\n\tkey = key.split ? key.split('.') : key;\n\tfor (p = 0; p < key.length; p++) {\n\t\tobj = obj ? obj[key[p]] : undef;\n\t}\n\treturn obj === undef ? def : obj;\n}\n","import dlv from \"dlv\";\n\n/** A function that checks overlapping properties against a reference value */\nexport type Matcher = ((searchObj: object) => boolean) & {\n /** The count represents the specificity of this matcher */\n count: number;\n};\n\n/** Traverse an object and collect any key/value pairs including nested keys */\nfunction traverseObj(\n object: Record<any, any>,\n path: string[] = [],\n pairs: Map<string[], any> = new Map(),\n): Map<string[], any> {\n for (const key of Object.keys(object)) {\n const val: any = object[key];\n const nestedPath = [...path, key];\n\n if (typeof val === \"object\") {\n traverseObj(val, nestedPath, pairs);\n } else {\n pairs.set(nestedPath, val);\n }\n }\n\n return pairs;\n}\n\n/**\n * Given a partial object, create a matcher function that checks if another object matches the specified properties\n * @param partialObj The partial object to match against\n * @returns A matcher function that checks if an object matches the partial object\n */\nexport function createObjectMatcher(partialObj: object): Matcher {\n // Convert the partial object into a list of [key, value] pairs;\n const pairs = traverseObj(partialObj);\n\n /** Generate a function to match against all of the properties we care about */\n const matchFunction = (searchObj: object) => {\n for (const entry of Array.from(pairs)) {\n const [path, value] = entry;\n\n if (dlv(searchObj, path) !== value) {\n return false;\n }\n }\n\n return true;\n };\n\n // Keep track of the specificity of the comparator\n matchFunction.count = pairs.size;\n\n return matchFunction;\n}\n","import SortedArray from \"sorted-array\";\nimport type { Matcher } from \"./deep-partial-matcher\";\nimport { createObjectMatcher } from \"./deep-partial-matcher\";\n\nexport { createObjectMatcher } from \"./deep-partial-matcher\";\n\n/** create a matcher function that matches exactly */\nfunction createBasicMatcher(seed: any): Matcher {\n /** a simple matcher function that only matches itself */\n const matcher = (match: any) => seed === match;\n matcher.count = 1;\n\n return matcher;\n}\n\ninterface RegistryIndex<V> {\n /** The original object we wanted to match on */\n key: object;\n\n /** The value to return */\n value: V;\n\n /** The matcher function for this entry */\n matcher: Matcher;\n}\n\n/** create an empty sorted array using the matcher count */\nconst createSortedArray = <V>() =>\n new SortedArray<RegistryIndex<V>>([], (c) => c.matcher.count);\n\n/**\n * A partial match registry is a map that uses an object to \"match\" against keys.\n * More specific matches take precedence over less specific ones.\n */\nexport class Registry<V> {\n private store = createSortedArray<V>();\n\n constructor(initialSet?: Array<[any, V]>) {\n initialSet?.forEach(([match, value]) => {\n this.set(match, value);\n });\n }\n\n /** Add match -> value mapping to the registry */\n set(match: any, value: V) {\n const matcher =\n typeof match === \"object\"\n ? createObjectMatcher(match)\n : createBasicMatcher(match);\n\n this.store.insert({\n key: match,\n value,\n matcher,\n });\n }\n\n /** Fetch the best match in the registry */\n get(query: any): V | undefined {\n for (const entry of this.store.array) {\n if (entry.matcher(query)) {\n return entry.value;\n }\n }\n }\n\n /** Loop over all entries and run callback */\n forEach(callbackfn: (value: RegistryIndex<V>) => void): void {\n for (const entry of this.store.array) {\n callbackfn(entry);\n }\n }\n\n /** Reset the items in the registry */\n clear() {\n this.store = createSortedArray<V>();\n }\n\n /** Check if the registry is empty*/\n isRegistryEmpty() {\n return this.store.array.length === 0;\n }\n}\n","var SortedArray = (function () {\n var SortedArray = defclass({\n\n constructor: function (array, compare) {\n this.array = [];\n this.compare = compare || compareDefault;\n var length = array.length,\n index = 0;\n while (index < length) this.insert(array[index++]);\n },\n insert: function (element) {\n var array = this.array,\n compare = this.compare,\n high = array.length-1,\n low = 0,\n pos = -1,\n index,\n ordering;\n\n // The array is sorted. You must find the position of new element in O(log(n)), not O(n).\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element); \n if (ordering < 0) low = index + 1;\n else if (ordering > 0) high = index - 1;\n else {\n pos = index;\n break;\n };\n }\n\n if (pos === -1) {\n // if element was not found, high < low.\n pos = high;\n }\n // This assures that equal elements inserted after will be in a higher position in array.\n // They can be equal for comparison purposes, but different objects with different data.\n // Respecting the chronological order can be important for many applications.\n pos++;\n high = array.length-1;\n while ((pos < high) && (compare(element, array[pos]) === 0)){\n pos++;\n }\n index = array.length;\n // Just to increase array size.\n array.push(element); \n // Much faster. No need to elements swap.\n while (index > pos) {\n array[index] = array[--index];\n }\n // Set the new element on its correct position.\n array[pos] = element;\n\n return this;\n },\n search: function (element) {\n var array = this.array,\n compare = this.compare,\n high = array.length-1,\n low = 0,\n // In most languages, inner variable declaration makes the code slower.\n index,\n ordering;\n\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element);\n\n if (ordering < 0) low = index + 1;\n else if (ordering > 0) high = index - 1;\n else return index;\n }\n\n return -1;\n },\n remove: function (element) {\n var index = this.search(element);\n if (index >= 0) this.array.splice(index, 1);\n return this;\n }\n });\n\n SortedArray.comparing = function (property, array) {\n return new SortedArray(array, function (a, b) {\n // This should be faster than calling functions.\n // Besides, this way it is not needed to create useless function to return property value.\n return compareDefault(a[property], b[property]);\n });\n };\n\n return SortedArray;\n\n function defclass(prototype) {\n var constructor = prototype.constructor;\n constructor.prototype = prototype;\n return constructor;\n }\n\n function compareDefault(a, b) {\n // Equality has a very low chance to happen. It should be the last option.\n if (a < b)\n return -1;\n else if (a > b)\n return 1;\n else\n return 0;\n }\n}());\n\nif (typeof module === \"object\") module.exports = SortedArray;\nif (typeof define === \"function\" && define.amd)\n define(function () { return SortedArray; });\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2409/execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/dist/index.global.js","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dlv@1.1.3/node_modules/dlv/index.js","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/deep-partial-matcher.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/index.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/sorted-array@2.0.4/node_modules/sorted-array/sorted-array.js"],"names":["Registry","dlv_es_default","obj","key","def","p","undef","split","length","createObjectMatcher","partialObj","pairs","traverseObj","matchFunction","searchObj","Array","from","entry","path","value","count","size","createBasicMatcher","seed","matcher","match","__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__commonJS","cb","mod","__require","exports","__export","target","all","name","get","enumerable","__copyProps","to","except","desc","call","__toESM","isNodeMode","__esModule","__toCommonJS","require_sorted_array","module","SortedArray","defclass","array","compare","compareDefault","index","insert","element","high","low","pos","ordering","push","search","remove","splice","comparing","property","a","b","constructor","define","amd","src_exports","import_sorted_array","object","Map","keys","val","nestedPath","set","createSortedArray","c","initialSet","store","forEach","query","callbackfn","clear","isRegistryEmpty"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAIA,WAAW,AAAC;QCDDC,iBDuIb,kJAAkJ;ICvIrI,SAAAA,eAAaC,CAAAA,EAAKC,CAAAA,EAAKC,CAAAA,EAAKC,CAAAA,EAAGC,CAAAA;QAAAA,IAC7CH,IAAMA,EAAII,KAAAA,GAAQJ,EAAII,KAAAA,CAAM,OAAOJ,GAC9BE,IAAI,GAAGA,IAAIF,EAAIK,MAAAA,EAAQH,IAC3BH,IAAMA,IAAMA,CAAAA,CAAIC,CAAAA,CAAIE,EAAAA,CAAAA,GAAMC;QAAAA,OAEpBJ,MAAQI,IAAQF,IAAMF;IAAAA;QC4BdO,sBAAT,SAASA,oBAAoBC,UAAA;QAElC,IAAMC,QAAQC,YAAYF;QAG1B,IAAMG,gBAAgB,SAACC;gBACrB,kCAAA,2BAAA;;gBAAA,QAAA,YAAoBC,MAAMC,IAAA,CAAKL,2BAA/B,SAAA,6BAAA,QAAA,yBAAA,iCAAuC;oBAAvC,IAAWM,QAAX;oBACE,IAAsBA,0BAAAA,WAAfC,OAAeD,WAATE,QAASF;oBAEtB,IAAIhB,e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BACN,kCAAA,2BAAA;;wBAAA,QAAA,YAAoB,IAAA,CAAKH,KAAA,CAAMhC,KAAA,qBAA/B,SAAA,6BAAA,QAAA,yBAAA,iCAAsC;4BAAtC,IAAW/C,QAAX;4BACEkF,WAAWlF;wBACb;;wBAFA;wBAAA;;;iCAAA,6BAAA;gCAAA;;;gCAAA;sCAAA;;;;gBAGF;;;gBAAA,oCAAA,GAGAmF,KAAAA;uBAAAA,SAAAA;oBACE,IAAA,CAAKJ,KAAA,GAAQH;gBACf;;;gBAAA,kCAAA,GAGAQ,KAAAA;uBAAAA,SAAAA;oBACE,OAAO,IAAA,CAAKL,KAAA,CAAMhC,KAAA,CAAMxD,MAAA,KAAW;gBACrC;;;;;IHuIA,OAAOmD,aAAa0B;AACtB","sourcesContent":["\"use strict\";\nvar Registry = (() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n ));\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/sorted-array@2.0.4/node_modules/sorted-array/sorted-array.js\n var require_sorted_array = __commonJS({\n \"../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/sorted-array@2.0.4/node_modules/sorted-array/sorted-array.js\"(exports, module) {\n \"use strict\";\n var SortedArray2 = function() {\n var SortedArray3 = defclass({\n constructor: function(array, compare) {\n this.array = [];\n this.compare = compare || compareDefault;\n var length = array.length, index = 0;\n while (index < length)\n this.insert(array[index++]);\n },\n insert: function(element) {\n var array = this.array, compare = this.compare, high = array.length - 1, low = 0, pos = -1, index, ordering;\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element);\n if (ordering < 0)\n low = index + 1;\n else if (ordering > 0)\n high = index - 1;\n else {\n pos = index;\n break;\n }\n ;\n }\n if (pos === -1) {\n pos = high;\n }\n pos++;\n high = array.length - 1;\n while (pos < high && compare(element, array[pos]) === 0) {\n pos++;\n }\n index = array.length;\n array.push(element);\n while (index > pos) {\n array[index] = array[--index];\n }\n array[pos] = element;\n return this;\n },\n search: function(element) {\n var array = this.array, compare = this.compare, high = array.length - 1, low = 0, index, ordering;\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element);\n if (ordering < 0)\n low = index + 1;\n else if (ordering > 0)\n high = index - 1;\n else\n return index;\n }\n return -1;\n },\n remove: function(element) {\n var index = this.search(element);\n if (index >= 0)\n this.array.splice(index, 1);\n return this;\n }\n });\n SortedArray3.comparing = function(property, array) {\n return new SortedArray3(array, function(a, b) {\n return compareDefault(a[property], b[property]);\n });\n };\n return SortedArray3;\n function defclass(prototype) {\n var constructor = prototype.constructor;\n constructor.prototype = prototype;\n return constructor;\n }\n function compareDefault(a, b) {\n if (a < b)\n return -1;\n else if (a > b)\n return 1;\n else\n return 0;\n }\n }();\n if (typeof module === \"object\")\n module.exports = SortedArray2;\n if (typeof define === \"function\" && define.amd)\n define(function() {\n return SortedArray2;\n });\n }\n });\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n Registry: () => Registry,\n createObjectMatcher: () => createObjectMatcher\n });\n var import_sorted_array = __toESM(require_sorted_array());\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dlv@1.1.3/node_modules/dlv/dist/dlv.es.js\n function dlv_es_default(t, e, l, n, r) {\n for (e = e.split ? e.split(\".\") : e, n = 0; n < e.length; n++)\n t = t ? t[e[n]] : r;\n return t === r ? l : t;\n }\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/deep-partial-matcher.ts\n function traverseObj(object, path = [], pairs = /* @__PURE__ */ new Map()) {\n for (const key of Object.keys(object)) {\n const val = object[key];\n const nestedPath = [...path, key];\n if (typeof val === \"object\") {\n traverseObj(val, nestedPath, pairs);\n } else {\n pairs.set(nestedPath, val);\n }\n }\n return pairs;\n }\n function createObjectMatcher(partialObj) {\n const pairs = traverseObj(partialObj);\n const matchFunction = (searchObj) => {\n for (const entry of Array.from(pairs)) {\n const [path, value] = entry;\n if (dlv_es_default(searchObj, path) !== value) {\n return false;\n }\n }\n return true;\n };\n matchFunction.count = pairs.size;\n return matchFunction;\n }\n\n // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/partial-match-registry/src/index.ts\n function createBasicMatcher(seed) {\n const matcher = (match) => seed === match;\n matcher.count = 1;\n return matcher;\n }\n var createSortedArray = () => new import_sorted_array.default([], (c) => c.matcher.count);\n var Registry = class {\n constructor(initialSet) {\n this.store = createSortedArray();\n initialSet?.forEach(([match, value]) => {\n this.set(match, value);\n });\n }\n /** Add match -> value mapping to the registry */\n set(match, value) {\n const matcher = typeof match === \"object\" ? createObjectMatcher(match) : createBasicMatcher(match);\n this.store.insert({\n key: match,\n value,\n matcher\n });\n }\n /** Fetch the best match in the registry */\n get(query) {\n for (const entry of this.store.array) {\n if (entry.matcher(query)) {\n return entry.value;\n }\n }\n }\n /** Loop over all entries and run callback */\n forEach(callbackfn) {\n for (const entry of this.store.array) {\n callbackfn(entry);\n }\n }\n /** Reset the items in the registry */\n clear() {\n this.store = createSortedArray();\n }\n /** Check if the registry is empty*/\n isRegistryEmpty() {\n return this.store.array.length === 0;\n }\n };\n return __toCommonJS(src_exports);\n})();\n","export default function dlv(obj, key, def, p, undef) {\n\tkey = key.split ? key.split('.') : key;\n\tfor (p = 0; p < key.length; p++) {\n\t\tobj = obj ? obj[key[p]] : undef;\n\t}\n\treturn obj === undef ? def : obj;\n}\n","import dlv from \"dlv\";\n\n/** A function that checks overlapping properties against a reference value */\nexport type Matcher = ((searchObj: object) => boolean) & {\n /** The count represents the specificity of this matcher */\n count: number;\n};\n\n/** Traverse an object and collect any key/value pairs including nested keys */\nfunction traverseObj(\n object: Record<any, any>,\n path: string[] = [],\n pairs: Map<string[], any> = new Map(),\n): Map<string[], any> {\n for (const key of Object.keys(object)) {\n const val: any = object[key];\n const nestedPath = [...path, key];\n\n if (typeof val === \"object\") {\n traverseObj(val, nestedPath, pairs);\n } else {\n pairs.set(nestedPath, val);\n }\n }\n\n return pairs;\n}\n\n/**\n * Given a partial object, create a matcher function that checks if another object matches the specified properties\n * @param partialObj The partial object to match against\n * @returns A matcher function that checks if an object matches the partial object\n */\nexport function createObjectMatcher(partialObj: object): Matcher {\n // Convert the partial object into a list of [key, value] pairs;\n const pairs = traverseObj(partialObj);\n\n /** Generate a function to match against all of the properties we care about */\n const matchFunction = (searchObj: object) => {\n for (const entry of Array.from(pairs)) {\n const [path, value] = entry;\n\n if (dlv(searchObj, path) !== value) {\n return false;\n }\n }\n\n return true;\n };\n\n // Keep track of the specificity of the comparator\n matchFunction.count = pairs.size;\n\n return matchFunction;\n}\n","import SortedArray from \"sorted-array\";\nimport type { Matcher } from \"./deep-partial-matcher\";\nimport { createObjectMatcher } from \"./deep-partial-matcher\";\n\nexport { createObjectMatcher } from \"./deep-partial-matcher\";\n\n/** create a matcher function that matches exactly */\nfunction createBasicMatcher(seed: any): Matcher {\n /** a simple matcher function that only matches itself */\n const matcher = (match: any) => seed === match;\n matcher.count = 1;\n\n return matcher;\n}\n\ninterface RegistryIndex<V> {\n /** The original object we wanted to match on */\n key: object;\n\n /** The value to return */\n value: V;\n\n /** The matcher function for this entry */\n matcher: Matcher;\n}\n\n/** create an empty sorted array using the matcher count */\nconst createSortedArray = <V>() =>\n new SortedArray<RegistryIndex<V>>([], (c) => c.matcher.count);\n\n/**\n * A partial match registry is a map that uses an object to \"match\" against keys.\n * More specific matches take precedence over less specific ones.\n */\nexport class Registry<V> {\n private store = createSortedArray<V>();\n\n constructor(initialSet?: Array<[any, V]>) {\n initialSet?.forEach(([match, value]) => {\n this.set(match, value);\n });\n }\n\n /** Add match -> value mapping to the registry */\n set(match: any, value: V) {\n const matcher =\n typeof match === \"object\"\n ? createObjectMatcher(match)\n : createBasicMatcher(match);\n\n this.store.insert({\n key: match,\n value,\n matcher,\n });\n }\n\n /** Fetch the best match in the registry */\n get(query: any): V | undefined {\n for (const entry of this.store.array) {\n if (entry.matcher(query)) {\n return entry.value;\n }\n }\n }\n\n /** Loop over all entries and run callback */\n forEach(callbackfn: (value: RegistryIndex<V>) => void): void {\n for (const entry of this.store.array) {\n callbackfn(entry);\n }\n }\n\n /** Reset the items in the registry */\n clear() {\n this.store = createSortedArray<V>();\n }\n\n /** Check if the registry is empty*/\n isRegistryEmpty() {\n return this.store.array.length === 0;\n }\n}\n","var SortedArray = (function () {\n var SortedArray = defclass({\n\n constructor: function (array, compare) {\n this.array = [];\n this.compare = compare || compareDefault;\n var length = array.length,\n index = 0;\n while (index < length) this.insert(array[index++]);\n },\n insert: function (element) {\n var array = this.array,\n compare = this.compare,\n high = array.length-1,\n low = 0,\n pos = -1,\n index,\n ordering;\n\n // The array is sorted. You must find the position of new element in O(log(n)), not O(n).\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element); \n if (ordering < 0) low = index + 1;\n else if (ordering > 0) high = index - 1;\n else {\n pos = index;\n break;\n };\n }\n\n if (pos === -1) {\n // if element was not found, high < low.\n pos = high;\n }\n // This assures that equal elements inserted after will be in a higher position in array.\n // They can be equal for comparison purposes, but different objects with different data.\n // Respecting the chronological order can be important for many applications.\n pos++;\n high = array.length-1;\n while ((pos < high) && (compare(element, array[pos]) === 0)){\n pos++;\n }\n index = array.length;\n // Just to increase array size.\n array.push(element); \n // Much faster. No need to elements swap.\n while (index > pos) {\n array[index] = array[--index];\n }\n // Set the new element on its correct position.\n array[pos] = element;\n\n return this;\n },\n search: function (element) {\n var array = this.array,\n compare = this.compare,\n high = array.length-1,\n low = 0,\n // In most languages, inner variable declaration makes the code slower.\n index,\n ordering;\n\n while (high >= low) {\n index = (high + low) / 2 >>> 0;\n ordering = compare(array[index], element);\n\n if (ordering < 0) low = index + 1;\n else if (ordering > 0) high = index - 1;\n else return index;\n }\n\n return -1;\n },\n remove: function (element) {\n var index = this.search(element);\n if (index >= 0) this.array.splice(index, 1);\n return this;\n }\n });\n\n SortedArray.comparing = function (property, array) {\n return new SortedArray(array, function (a, b) {\n // This should be faster than calling functions.\n // Besides, this way it is not needed to create useless function to return property value.\n return compareDefault(a[property], b[property]);\n });\n };\n\n return SortedArray;\n\n function defclass(prototype) {\n var constructor = prototype.constructor;\n constructor.prototype = prototype;\n return constructor;\n }\n\n function compareDefault(a, b) {\n // Equality has a very low chance to happen. It should be the last option.\n if (a < b)\n return -1;\n else if (a > b)\n return 1;\n else\n return 0;\n }\n}());\n\nif (typeof module === \"object\") module.exports = SortedArray;\nif (typeof define === \"function\" && define.amd)\n define(function () { return SortedArray; });\n"]}
|