rittenhop-ghost/versions/5.94.2/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.js.map

1 line
8.5 KiB
Plaintext

{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOH,MAAM,UAAU,YAAY,CAAI,IAAc;IAC5C,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,UAA4B;IACzD,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjC,gDAAgD;IAChD,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACnB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,EAAtB,CAAsB,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,oBAA0C;;IAE1C,OAAU,oBAAoB,CAAC,IAAI,UAAI,MAAA,oBAAoB,CAAC,OAAO,mCAAI,EAAE,WACvE,MAAA,oBAAoB,CAAC,SAAS,mCAAI,EAAE,CACpC,CAAC;AACL,CAAC;AAED;;GAEG;AACH;IAAkC,gCAAK;IACrC,sBAAY,OAAgB;QAA5B,YACE,kBAAM,OAAO,CAAC,SAKf;QAHC,0FAA0F;QAC1F,6IAA6I;QAC7I,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;;IACtD,CAAC;IACH,mBAAC;AA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B,CAAC,GAAW,EAAE,GAAW;IAC5D,OAAO,GAAG,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,WAAW,EAAE,CAAC;AACjD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MetricAttributes } from '@opentelemetry/api';\nimport { InstrumentationScope } from '@opentelemetry/core';\n\nexport type Maybe<T> = T | undefined;\n\nexport function isNotNullish<T>(item: Maybe<T>): item is T {\n return item !== undefined && item !== null;\n}\n\n/**\n * Converting the unordered attributes into unique identifier string.\n * @param attributes user provided unordered MetricAttributes.\n */\nexport function hashAttributes(attributes: MetricAttributes): string {\n let keys = Object.keys(attributes);\n if (keys.length === 0) return '';\n\n // Return a string that is stable on key orders.\n keys = keys.sort();\n return JSON.stringify(keys.map(key => [key, attributes[key]]));\n}\n\n/**\n * Converting the instrumentation scope object to a unique identifier string.\n * @param instrumentationScope\n */\nexport function instrumentationScopeId(\n instrumentationScope: InstrumentationScope\n): string {\n return `${instrumentationScope.name}:${instrumentationScope.version ?? ''}:${\n instrumentationScope.schemaUrl ?? ''\n }`;\n}\n\n/**\n * Error that is thrown on timeouts.\n */\nexport class TimeoutError extends Error {\n constructor(message?: string) {\n super(message);\n\n // manually adjust prototype to retain `instanceof` functionality when targeting ES5, see:\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\n/**\n * Adds a timeout to a promise and rejects if the specified timeout has elapsed. Also rejects if the specified promise\n * rejects, and resolves if the specified promise resolves.\n *\n * <p> NOTE: this operation will continue even after it throws a {@link TimeoutError}.\n *\n * @param promise promise to use with timeout.\n * @param timeout the timeout in milliseconds until the returned promise is rejected.\n */\nexport function callWithTimeout<T>(\n promise: Promise<T>,\n timeout: number\n): Promise<T> {\n let timeoutHandle: ReturnType<typeof setTimeout>;\n\n const timeoutPromise = new Promise<never>(function timeoutFunction(\n _resolve,\n reject\n ) {\n timeoutHandle = setTimeout(function timeoutHandler() {\n reject(new TimeoutError('Operation timed out.'));\n }, timeout);\n });\n\n return Promise.race([promise, timeoutPromise]).then(\n result => {\n clearTimeout(timeoutHandle);\n return result;\n },\n reason => {\n clearTimeout(timeoutHandle);\n throw reason;\n }\n );\n}\n\nexport interface PromiseAllSettledFulfillResult<T> {\n status: 'fulfilled';\n value: T;\n}\n\nexport interface PromiseAllSettledRejectionResult {\n status: 'rejected';\n reason: unknown;\n}\n\nexport type PromiseAllSettledResult<T> =\n | PromiseAllSettledFulfillResult<T>\n | PromiseAllSettledRejectionResult;\n\n/**\n * Node.js v12.9 lower and browser compatible `Promise.allSettled`.\n */\nexport async function PromiseAllSettled<T>(\n promises: Promise<T>[]\n): Promise<PromiseAllSettledResult<T>[]> {\n return Promise.all(\n promises.map<Promise<PromiseAllSettledResult<T>>>(async p => {\n try {\n const ret = await p;\n return {\n status: 'fulfilled',\n value: ret,\n };\n } catch (e) {\n return {\n status: 'rejected',\n reason: e,\n };\n }\n })\n );\n}\n\nexport function isPromiseAllSettledRejectionResult(\n it: PromiseAllSettledResult<unknown>\n): it is PromiseAllSettledRejectionResult {\n return it.status === 'rejected';\n}\n\n/**\n * Node.js v11.0 lower and browser compatible `Array.prototype.flatMap`.\n */\nexport function FlatMap<T, R>(arr: T[], fn: (it: T) => R[]): R[] {\n const result: R[] = [];\n arr.forEach(it => {\n result.push(...fn(it));\n });\n return result;\n}\n\nexport function setEquals(lhs: Set<unknown>, rhs: Set<unknown>): boolean {\n if (lhs.size !== rhs.size) {\n return false;\n }\n for (const item of lhs) {\n if (!rhs.has(item)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Binary search the sorted array to the find lower bound for the value.\n * @param arr\n * @param value\n * @returns\n */\nexport function binarySearchLB(arr: number[], value: number): number {\n let lo = 0;\n let hi = arr.length - 1;\n\n while (hi - lo > 1) {\n const mid = Math.trunc((hi + lo) / 2);\n if (arr[mid] <= value) {\n lo = mid;\n } else {\n hi = mid - 1;\n }\n }\n\n if (arr[hi] <= value) {\n return hi;\n } else if (arr[lo] <= value) {\n return lo;\n }\n return -1;\n}\n\nexport function equalsCaseInsensitive(lhs: string, rhs: string): boolean {\n return lhs.toLowerCase() === rhs.toLowerCase();\n}\n"]}