dd-trace
Version:
Datadog APM tracing client for JavaScript
1 lines • 4.27 kB
JavaScript
(()=>{"use strict";var e={"./crypto-randomuuid/index.js"(e,t,o){let r=o("crypto");e.exports="function"==typeof r.randomUUID?r.randomUUID:o("./crypto-randomuuid/polyfill.js")},"./crypto-randomuuid/polyfill.js"(e,t,o){let r,n,i,s=o("crypto"),{validateBoolean:c,validateObject:u,codes:{ERR_OPERATION_FAILED:a}}=o("./crypto-randomuuid/validators.js"),{randomFillSync:l}=s;function secureBuffer(e){return l(Buffer.alloc(e))}let f=0;function getHexBytes(){if(void 0===i){i=Array(256);for(let e=0;e<i.length;e++){let t=e.toString(16);i[e]=t.padStart(2,"0")}}return i}function serializeUUID(e,t=0){let o=getHexBytes();return o[e[t]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[15&e[t+6]|64]+o[e[t+7]]+"-"+o[63&e[t+8]|128]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]}function getBufferedUUID(){if(r||(r=secureBuffer(2048)),void 0===r)throw new a("Out of memory");return 0===f&&l(r),serializeUUID(r,16*(f=(f+1)%128))}function getUnbufferedUUID(){if(n||(n=secureBuffer(2048)),void 0===n)throw new a("Out of memory");return l(n),serializeUUID(n)}e.exports=function(e){void 0!==e&&u(e,"options");let{disableEntropyCache:t=!1}=e||{};return c(t,"options.disableEntropyCache"),t?getUnbufferedUUID():getBufferedUUID()}},"./crypto-randomuuid/validators.js"(e,t,o){let r=o("assert"),n=o("util"),i=["string","function","number","object","Function","Object","boolean","bigint","symbol"];let ERR_OPERATION_FAILED=class ERR_OPERATION_FAILED extends TypeError{constructor(e){super(`Operation failed: ${e}`),this.code=this.constructor.name,Object.defineProperties(this,{toString:{value(){return`${this.name} [${this.code}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}})}};let ERR_INVALID_ARG_TYPE=class ERR_INVALID_ARG_TYPE extends TypeError{constructor(e,t,o){super(),r("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let s="The ";if(e.endsWith(" argument"))s+=`${e} `;else{const t=e.includes(".")?"property":"argument";s+=`"${e}" ${t} `}s+="must be ";const c=[],u=[],a=[];for(const e of t)r("string"==typeof e,"All expected entries have to be of type string"),i.includes(e)?c.push(e.toLowerCase()):classRegExp.test(e)?u.push(e):(r("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(u.length>0){const e=c.indexOf("object");-1!==e&&(c.splice(e,1),u.push("Object"))}if(c.length>0){if(c.length>2){const e=c.pop();s+=`one of type ${c.join(", ")}, or ${e}`}else 2===c.length?s+=`one of type ${c[0]} or ${c[1]}`:s+=`of type ${c[0]}`;(u.length>0||a.length>0)&&(s+=" or ")}if(u.length>0){if(u.length>2){const e=u.pop();s+=`an instance of ${u.join(", ")}, or ${e}`}else s+=`an instance of ${u[0]}`,2===u.length&&(s+=` or ${u[1]}`);a.length>0&&(s+=" or ")}if(a.length>0)if(a.length>2){const e=a.pop();s+=`one of ${a.join(", ")}, or ${e}`}else 2===a.length?s+=`one of ${a[0]} or ${a[1]}`:(a[0].toLowerCase()!==a[0]&&(s+="an "),s+=`${a[0]}`);if(null==o)s+=`. Received ${o}`;else if("function"==typeof o&&o.name)s+=`. Received function ${o.name}`;else if("object"==typeof o)if(o.constructor&&o.constructor.name)s+=`. Received an instance of ${o.constructor.name}`;else{const e=n.inspect(o,{depth:-1});s+=`. Received ${e}`}else{let e=n.inspect(o,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),s+=`. Received type ${typeof o} (${e})`}this.code=this.constructor.name,Object.defineProperties(this,{message:{value:s,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${this.code}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}})}};e.exports={validateBoolean:function(e,t){if("boolean"!=typeof e)throw new ERR_INVALID_ARG_TYPE(t,"boolean",e)},validateObject:function(e,t,{nullable:o=!1,allowArray:r=!1,allowFunction:n=!1}={}){if(!o&&null===e||!r&&Array.isArray(e)||"object"!=typeof e&&(!n||"function"!=typeof e))throw new ERR_INVALID_ARG_TYPE(t,"Object",e)},codes:{ERR_OPERATION_FAILED}}},assert(e){e.exports=require("assert")},crypto(e){e.exports=require("crypto")},util(e){e.exports=require("util")}},t={};function __webpack_require__(o){var r=t[o];if(void 0!==r)return r.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,__webpack_require__),n.exports}var o=__webpack_require__("./crypto-randomuuid/index.js");module.exports=o})();