@wovin/connect-nftstorage 0.0.14 → 0.0.15

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,3 +1,3 @@
1
1
  var I=Object.create;var w=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var $=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),M=(t,e)=>{for(var r in e)w(t,r,{get:e[r],enumerable:!0})},k=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!J.call(t,n)&&n!==r&&w(t,n,{get:()=>e[n],enumerable:!(o=j(e,n))||o.enumerable});return t};var L=(t,e,r)=>(r=t!=null?I(A(t)):{},k(e||!t||!t.__esModule?w(r,"default",{value:t,enumerable:!0}):r,t));var E=b(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});var P=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W=typeof window<"u"&&typeof window.document<"u",_=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,T=(typeof self>"u"?"undefined":P(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",C=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),U=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";f.isBrowser=W;f.isWebWorker=T;f.isNode=_;f.isJsDom=C;f.isDeno=U});var F=b((H,S)=>{"use strict";S.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,o=e.cmp&&function(c){return function(i){return function(a,s){var g={key:a,value:i[a]},u={key:s,value:i[s]};return c(g,u)}}}(e.cmp),n=[];return function c(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var a,s;if(Array.isArray(i)){for(s="[",a=0;a<i.length;a++)a&&(s+=","),s+=c(i[a])||"null";return s+"]"}if(i===null)return"null";if(n.indexOf(i)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var g=n.push(i)-1,u=Object.keys(i).sort(o&&o(i));for(s="",a=0;a<u.length;a++){var m=u[a],d=c(i[m]);d&&(s&&(s+=","),s+=JSON.stringify(m)+":"+d)}return n.splice(g,1),"{"+s+"}"}}(t)}});var p=L(E(),1),R=L(F(),1),D=!1,G=!1;p.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(D=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(G=process?.env?.LOGGER_PERF_PREFIX==="true"));var V={prefix:void 0,time:D,delta:G,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},h=[],N=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(t,e,r,o){Object.assign(this,{sinceFirst:t,sinceLast:e,time:r,delta:o})}toString(){let t=this.sinceFirst*.001,e=t.toFixed(t<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?e:null,this.delta?r:null].filter(o=>o!=null).join(",")}]`}},B=class{constructor(t,e){Object.assign(this,{style:t,string:e})}},y=!1,X=class l{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(e=l.INFO,r={}){r=Object.assign({},V,r),e>10&&console.debug("setup logger",{config:r});let o=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),n=(...s)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&o(...s)};n.isDisabled=!0,n.isEnabled=!1;let c=this.wrapLog(console.groupCollapsed,r),i=(s,g)=>{function u(...d){let v=d[d.length-1];return v===n?v():(c(...d.slice(0,-1)),(async()=>{try{let O=v();return O instanceof Promise?await O:O}finally{console.groupEnd()}})())}let m=Object.assign(g.bind({}),{isEnabled:s,isDisabled:!s,group:u,force:g});return s?m:Object.assign(n.bind({}),{isEnabled:s,isDisabled:!s,group:u,force:m})},a=i(e>=l.ERROR,this.wrapLog(console.error,r));return{ERROR:(...s)=>(a(...s),new Error((0,R.default)(s))),WARN:i(e>=l.WARN,this.wrapLog(console.warn,r)),LOG:i(e>=l.INFO,this.wrapLog(console.log,r)),DEBUG:i(e>=l.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:i(e>=l.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(e,r){if(p.isNode)return e.bind(console);{let o=[];if(r.time||r.delta){let n=p.isBrowser&&navigator.userAgent.includes("Chrome")?["",l.timeStr(!!r.time,!!r.delta)]:[];o.push(...n)}return r.prefix&&(y?o.push(new B("dim",r.prefix)):o.push(r.prefix)),e.bind(console,...o)}}static timeStr(e,r,o=0){if(!performance.now)return;let n=performance.now();l.firstLog||(l.firstLog=n,l.lastLog=n);let c=new N(n-l.firstLog,n-l.lastLog,e,r);return l.lastLog=n,o?c.toString():c}static getOriginFromStack(e){let r=!1;for(let o of e.split(`
2
2
  `)){let n=o.match(/^\s+at\s+(.*)/);if(n){if(r)return n[1].trim().replace(__dirname,"");r=!0}}}};p.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:t=>{if(h&&h.length){for(let e of h)if(e.match(t))return["span",{},e.format(t)]}return null},hasBody:()=>!0},{header:t=>{if(!(t instanceof N))return null;y||(y=!0);let e=X.timeStr(t.time,t.delta);return["span",{style:"font-weight: light; color: grey"},e?.toString()]},hasBody:()=>!1},{header:t=>t instanceof B?(y||(y=!0),["span",{style:"font-weight: light; color: grey; "},t.string]):null,hasBody:()=>!1}));export{$ as a,b,M as c,L as d,X as e};
3
- //# sourceMappingURL=chunk-WJCHHT2E.min.js.map
3
+ //# sourceMappingURL=chunk-BKKH6BET.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js","../../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js","../../../../node_modules/.pnpm/besonders-logger@1.0.1/node_modules/besonders-logger/src/lib/logger.ts"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\nvar isNode = typeof process !== \"undefined\" && process.versions != null && process.versions.node != null;\n\nvar isWebWorker = (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === \"object\" && self.constructor && self.constructor.name === \"DedicatedWorkerGlobalScope\";\n\n/**\n * @see https://github.com/jsdom/jsdom/releases/tag/12.0.0\n * @see https://github.com/jsdom/jsdom/issues/1537\n */\nvar isJsDom = typeof window !== \"undefined\" && window.name === \"nodejs\" || typeof navigator !== \"undefined\" && (navigator.userAgent.includes(\"Node.js\") || navigator.userAgent.includes(\"jsdom\"));\n\nvar isDeno = typeof Deno !== \"undefined\" && typeof Deno.version !== \"undefined\" && typeof Deno.version.deno !== \"undefined\";\n\nexports.isBrowser = isBrowser;\nexports.isWebWorker = isWebWorker;\nexports.isNode = isNode;\nexports.isJsDom = isJsDom;\nexports.isDeno = isDeno;","'use strict';\n\nmodule.exports = function (data, opts) {\n if (!opts) opts = {};\n if (typeof opts === 'function') opts = { cmp: opts };\n var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;\n\n var cmp = opts.cmp && (function (f) {\n return function (node) {\n return function (a, b) {\n var aobj = { key: a, value: node[a] };\n var bobj = { key: b, value: node[b] };\n return f(aobj, bobj);\n };\n };\n })(opts.cmp);\n\n var seen = [];\n return (function stringify (node) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n\n if (node === undefined) return;\n if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object') return JSON.stringify(node);\n\n var i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i) out += ',';\n out += stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n\n if (node === null) return 'null';\n\n if (seen.indexOf(node) !== -1) {\n if (cycles) return JSON.stringify('__cycle__');\n throw new TypeError('Converting circular structure to JSON');\n }\n\n var seenIndex = seen.push(node) - 1;\n var keys = Object.keys(node).sort(cmp && cmp(node));\n out = '';\n for (i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = stringify(node[key]);\n\n if (!value) continue;\n if (out) out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return '{' + out + '}';\n })(data);\n};\n","import { isBrowser, isNode } from 'browser-or-node'\nimport stringify from 'fast-json-stable-stringify'\n\n////////////\n// CONFIG //\n////////////\n\n//(i) disabled by default bc. the detection logic has disappeared after the refactor.\n//TODO: Find it and check if it works\nlet TIME_PREFIX_ENABLED = false\nlet PERFORMANCE_PREFIX_ENABLED = false\nif (isNode) {\n // console.debug('isNode checking', { process })\n if (process?.env?.LOGGER_TIME_PREFIX) TIME_PREFIX_ENABLED = process?.env?.LOGGER_TIME_PREFIX === 'true'\n if (process?.env?.LOGGER_PERF_PREFIX) PERFORMANCE_PREFIX_ENABLED = process?.env?.LOGGER_PERF_PREFIX === 'true'\n}\nexport let LOGGER_DEFAULT_CONFIG ={\n prefix: undefined as string | undefined,\n time: TIME_PREFIX_ENABLED,\n delta: PERFORMANCE_PREFIX_ENABLED,\n dimDebugOnServer: true,\n printOriginOnServer: true,\n serverInspectOptions: {},\n customFormattersOnServer: true,\n // Depth of stacktrace to show on server\n // - integer saying how many lines\n // - false to disable, true for all\n printStackLinesOnServer: false as boolean | number,\n dim: true,\n}\n\nexport type Config = Partial<typeof LOGGER_DEFAULT_CONFIG>\nexport type ConsoleFx = (...data: any[]) => void\nexport const StringFormatters = [\n // Format to string (Client console - currently not on server)\n // {\n // match: obj => obj instanceof Model,\n // format: m => {\n // const { displayName } = m\n // return `${m.constructor.name}#${m.ID}${displayName ? `{${displayName}}` : ''}`\n // },\n // },\n] as unknown as {\n match: (obj: any) => boolean\n format: (m: any) => string\n}[]\n\n// let applyCustomFormatters;\n// applyCustomFormatters = (value, config) => {\n// for (const formatter of StringFormatters) {\n// if (formatter.match(value)) return formatter.format(value);\n// }\n// if (!_.isString(value)) {\n// return util.inspect(value, config.inspectOptionsOnServer);\n// }\n// return value;\n// };\n\n/// ////////////////\n// RUNTIME STUFF //\n/// ////////////////\n\nexport class LoggerTime {\n sinceFirst = 0\n sinceLast = 0\n time = false\n delta = false\n constructor(sinceFirst: number, sinceLast: number, time: boolean, delta: boolean) {\n Object.assign(this, { sinceFirst, sinceLast, time, delta })\n }\n\n toString() {\n const sinceFirstNum = (this.sinceFirst * 0.001)\n const sinceFirst = sinceFirstNum.toFixed(sinceFirstNum < 5 ? 2 : 1) /* .padStart(3, ' ') */\n const sinceLast\n = this.sinceLast < 1000 // when >= 1s, format as seconds\n ? `${this.sinceLast.toFixed(0)}`.padStart(5, ' ')\n : `${`${(this.sinceLast * 0.001).toFixed(this.sinceLast < 10000 ? 1 : 0)}`.padStart(4, ' ')}s`\n return `[${[this.time ? sinceFirst : null, this.delta ? sinceLast : null]\n .filter(t => t!=null)\n .join(',')}]`\n }\n}\n\nexport class Style {\n constructor(style: string, string: string) {\n Object.assign(this, { style, string })\n }\n}\nlet formattersEnabled = false // for tracking if chrome formatters are enabled (don't change manually)\n\nexport class Logger {\n static ERROR = 2 as const\n static WARN = 4 as const\n static INFO = 6 as const // alias for LOG\n static LOG = 6 as const\n static DEBUG = 8 as const\n static VERBOSE = 10 as const\n\n static firstLog = 0\n static lastLog = 0\n\n /**\n * This is a clever way to log without the extra check on each log line.\n * Use it like this:\n * ```\n * const { WARN, LOG, DEBUG, VERBOSE } = Logger.setup(Logger.INFO); // eslint-disable-line no-unused-vars\n * LOG('message', data);\n * DEBUG(this.collectionName, '...')\n * if (!VERBOSE.isDisabled) {\n * const verboseStuff = generateVerboseStuff(); // computationally intensive\n * VERBOSE('Here it is:', verboseStuff)\n * }\n * ```\n *\n * @ param {number} level See {@link LVs}\n * @ param {object} config see LOGGER_DEFAULT_CONFIG\n * @ typedef {Function & {isDisabled: boolean, isEnabled: boolean, ...}} LogFunc\n * @ returns {{LOG: LogFunc, VERBOSE: LogFunc, DEBUG: LogFunc, WARN: LogFunc, ERROR: LogFunc}}\n */\n static setup(level: 2 | 4 | 6 | 8 | 10 = Logger.INFO, config: Config = {}) {\n config = Object.assign({}, LOGGER_DEFAULT_CONFIG, config) // defaults(config, LOGGER_DEFAULT_CONFIG) // fyi this is like the reverse of Object.assign\n if (level > 10) console.debug('setup logger', { config }) // manual overide to level:11 to show this trace\n\n const debugLogForStub = this.wrapLog(console.debug, { ...config, dim: config.dimDebugOnServer })\n const stub = (...args: any[]) => {\n // @ts-expect-error hack to enable DEBUG logging EVERYWHERE\n if (typeof window !== 'undefined' && window?.FORCE_DISABLE_LOGLEVEL)\n debugLogForStub(...args)\n } // For disabled log-levels, we just return a stub function\n stub.isDisabled = true // this makes it possible to check, e.g. `DEBUG.isDisabled`\n stub.isEnabled = false // depending on syntactic preference\n const groupCollapsed = this.wrapLog(console.groupCollapsed, config)\n\n const addExtraFxs = (enabled: boolean, func: (...T: any) => void) =>/* : ((...T) => void & {isDisabled: boolean}) */ {\n // warning - weird TS hacks approaching:\n function group<T extends Func>(\n ...args: [...any[], T]\n ): ReturnType<T> extends Promise<any> ? Promise<ReturnType<T>> : ReturnType<T> {\n const functionToWrap = args[args.length - 1] as T\n\n if (functionToWrap as Func === stub)\n return functionToWrap() as ReturnType<T>\n\n groupCollapsed(...args.slice(0, -1)) // except last\n\n const asyncWrapper = async () => {\n try {\n const result = functionToWrap()\n return result instanceof Promise ? await result : result\n } finally {\n console.groupEnd()\n }\n }\n\n return asyncWrapper() as ReturnType<T> // Cast to bypass the Promise type inference\n }\n\n const realFunc = Object.assign(\n func.bind({}), // clone function - https://stackoverflow.com/a/6772648\n {\n isEnabled: enabled,\n isDisabled: !enabled,\n group,\n force: func,\n },\n )\n if (enabled) {\n return realFunc\n } else {\n return Object.assign(\n stub.bind({}), // clone stub function - https://stackoverflow.com/a/6772648\n {\n isEnabled: enabled,\n isDisabled: !enabled,\n group,\n force: realFunc,\n },\n )\n }\n }\n\n const ERRFX = addExtraFxs(level >= Logger.ERROR, this.wrapLog(console.error, config))\n const ERROR = (...params: any[]) => {\n ERRFX(...params)\n return new Error(stringify(params)) // return so we can throw it, stringify is fast & safe with circular references\n }\n\n // console.debug(\"Logger init:\", config)\n return {\n ERROR,\n WARN: addExtraFxs(level >= Logger.WARN, this.wrapLog(console.warn, config)),\n LOG: addExtraFxs(level >= Logger.INFO, this.wrapLog(console.log, config)),\n DEBUG: addExtraFxs(level >= Logger.DEBUG, this.wrapLog(console.log, { ...config, dim: config.dimDebugOnServer })), // not using console.debug as that requires dev tools verbose to be enabled\n VERBOSE: addExtraFxs(level >= Logger.VERBOSE, this.wrapLog(console.debug, { ...config, dim: config.dimDebugOnServer })),\n }\n }\n\n static wrapLog(logFunc: ConsoleFx, config: Config) {\n if (!isNode) {\n // ℹ In browser we can only do some of the fancy things, because we cannot call console.log ourselves,\n // as that would pollute the stacktrace\n\n // ℹ Would be nice to get formtted links in devtools, but <a> tags are not allowed:\n // const stack = new Error().stack;\n // const origin = Logger.getOriginFromStack(stack);\n // const originFilename = origin.split('\\\\').pop().split('/').pop(); // eslint-disable-line\n // if (origin) fixedArgs.push({ link: originFilename, href: `http://localhost:63342/api/file/${origin}` });\n\n // on the client, we need to return the original log function, as otherwise the origin of the log is set to here\n // But luckily we can bind fixed parameters on the function:\n const fixedArgs = []\n // if the custom formatters are enabled, and we want performance logging - we add an instance of P as a static prefix\n if (config.time || config.delta) {\n const isChrome = isBrowser && navigator.userAgent.includes('Chrome')\n\n const p = isChrome\n ? ['', Logger.timeStr(!!config.time, !!config.delta)] // this is a placeholder that gets replaced by the custom formatter\n : [] // [{ get perfNiceTry () { return Logger.timeStr(,,true) } }] // this (of course) shows the time when you click the getter\n fixedArgs.push(...p) // if we start with a non-string, all strings are rendered with quotes :/\n }\n if (config.prefix) {\n if (formattersEnabled)\n fixedArgs.push(new Style('dim', config.prefix))\n else fixedArgs.push(config.prefix)\n }\n // console.log('logger-log', { config, fixedArgs })\n return logFunc.bind(console, ...fixedArgs)\n } else {\n // ℹ in nodejs we print the stack trace origin ourselves, so we can do a lot more things\n // TODO: re-import removed code - https://gitlab.com/onezoomin/ztax/ztax/-/commit/f6f9bde617cd9ae93d1bc4bc49a4b5275e4cbff2#b1d1e091ca27ae560becf7ae1b27a4d53d39c061\n return logFunc.bind(console)\n }\n }\n\n // static log(msg, logPerformance = true) {\n // const p = this.perf();\n // return logPerformance ? `${p} ${msg}` : msg;\n // }\n\n static timeStr(time: boolean, delta: boolean, returnAsString = 0): LoggerTime | string | undefined {\n if (!performance.now)\n return undefined // TODO: server? p = { now: require('performance-now') };\n const now = performance.now()\n if (!Logger.firstLog) {\n Logger.firstLog = now\n Logger.lastLog = now\n }\n const p = new LoggerTime(now - Logger.firstLog, now - Logger.lastLog, time, delta)\n Logger.lastLog = now\n return returnAsString ? p.toString() : p\n }\n\n // (for nodejs) ~ https://stackoverflow.com/a/47296370/1633985\n static getOriginFromStack(stack: any): string | undefined {\n let skippedFirst = false // the first one is Logger.js\n for (const line of stack.split('\\n')) {\n const matches = line.match(/^\\s+at\\s+(.*)/)\n if (matches) {\n if (skippedFirst) {\n // first line - current function\n // second line - caller (what we are looking for)\n return (\n matches[1]\n .trim() // Removes spaces\n // .replace(/^module /, '') // Removes 'module ' at beginning\n // .replace(/^at /, '') // Removes 'at ' at beginning\n // .replace(/^ \\(/, '') // Removes parentheseses around file\n // .replace(/\\)$/, '') // -||-\n .replace(__dirname, '') // Removes script folder path (if exists)\n )\n }\n skippedFirst = true\n }\n }\n }\n}\n\nif (isBrowser) { // isBrowser is not true for web workers\n // CLIENT or Worker //\n\n // @ts-expect-error window hack\n window.devtoolsFormatters = window.devtoolsFormatters ?? []\n // noinspection JSUnusedGlobalSymbols\n // @ts-expect-error window hack\n window.devtoolsFormatters.push(\n {\n // Custom formatters\n header: (obj: any) => {\n if (StringFormatters && StringFormatters.length) {\n for (const formatter of StringFormatters) {\n if (formatter.match(obj))\n return ['span', {}, formatter.format(obj)]\n }\n }\n return null\n },\n hasBody: () => true,\n },\n {\n // Performance object //\n // This is a sneaky way to show performance info withouth any extra calls when logging:\n // LOG(`...`)\n // it would work without this if we would have some way to intercept the call:\n // L.INFO('...') - a getter on L that adds the current time as prefix\n // LOG('...')() - returns the log function with all argumends bound\n // But instead we are adding a custom formatter that replaced the placeholder object of class P with the performance info\n header: (obj: any) => {\n if (!(obj instanceof LoggerTime))\n return null\n if (!formattersEnabled)\n formattersEnabled = true\n const p = Logger.timeStr(obj.time, obj.delta)\n return [\n 'span',\n { style: 'font-weight: light; color: grey' },\n p?.toString(),\n // ['a', { href: 'vscodium://file/home/manu/dev/tamera/bookr/imports/lib/utils/Logger.js' }, 'WOW'],\n ]\n },\n hasBody: () => false,\n },\n {\n // Style object\n header: (obj: { string: any }) => {\n if (!(obj instanceof Style))\n return null\n if (!formattersEnabled)\n formattersEnabled = true\n return ['span', { style: 'font-weight: light; color: grey; '/* font-style: italic; */ }, obj.string]\n },\n hasBody: () => false,\n },\n )\n}\nelse if (isNode) {\n // SERVER //\n // node stuff removed as it breaks/bloats webworker build\n}\n\nexport function logriniTest(): string {\n return 'logrini'\n}\n\ntype Func<T = any> = () => T\n"],"mappings":"wzBAAA,IAAAA,EAAAC,EAAAC,GAAA,cAEA,OAAO,eAAeA,EAAS,aAAc,CAC3C,MAAO,EACT,CAAC,EAED,IAAIC,EAAU,OAAO,QAAW,YAAc,OAAO,OAAO,UAAa,SAAW,SAAUC,EAAK,CAAE,OAAO,OAAOA,CAAK,EAAI,SAAUA,EAAK,CAAE,OAAOA,GAAO,OAAO,QAAW,YAAcA,EAAI,cAAgB,QAAUA,IAAQ,OAAO,UAAY,SAAW,OAAOA,CAAK,EAEvQC,EAAY,OAAO,OAAW,KAAe,OAAO,OAAO,SAAa,IAExEC,EAAS,OAAO,QAAY,KAAe,QAAQ,UAAY,MAAQ,QAAQ,SAAS,MAAQ,KAEhGC,GAAe,OAAO,KAAS,IAAc,YAAcJ,EAAQ,IAAI,KAAO,UAAY,KAAK,aAAe,KAAK,YAAY,OAAS,6BAMxIK,EAAU,OAAO,OAAW,KAAe,OAAO,OAAS,UAAY,OAAO,UAAc,MAAgB,UAAU,UAAU,SAAS,SAAS,GAAK,UAAU,UAAU,SAAS,OAAO,GAE3LC,EAAS,OAAO,KAAS,KAAe,OAAO,KAAK,QAAY,KAAe,OAAO,KAAK,QAAQ,KAAS,IAEhHP,EAAQ,UAAYG,EACpBH,EAAQ,YAAcK,EACtBL,EAAQ,OAASI,EACjBJ,EAAQ,QAAUM,EAClBN,EAAQ,OAASO,IC1BjB,IAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAA,cAEAA,EAAO,QAAU,SAAUC,EAAMC,EAAM,CAC9BA,IAAMA,EAAO,CAAC,GACf,OAAOA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AAA,GAAAD,EAAA,KAAA,QAAA,GAAAE,CAAA,CAAA,CAAA,CAAA,OAAA,QAAAF,EAAAC,EAAAC,EAAA,EAAA,CAAA,GAAA,CAAA,YAAA,IAAA,OAAA,IAAAC,EAAA,YAAA,IAAA,EAAAY,EAAA,WAAAA,EAAA,SAAAZ,EAAAY,EAAA,QAAAZ,GAAA,IAAAqB,EAAA,IAAA3B,EAAAM,EAAAY,EAAA,SAAAZ,EAAAY,EAAA,QAAAf,EAAAC,CAAA,EAAA,OAAAc,EAAA,QAAAZ,EAAAD,EAAAsB,EAAA,SAAA,EAAAA,CAAA,CAAA,OAAA,mBAAAxB,EAAA;","names":["require_lib","__commonJSMin","exports","_typeof","obj","isBrowser","isNode","isWebWorker","isJsDom","isDeno","require_fast_json_stable_stringify","__commonJSMin","exports","module","data","opts","cycles","cmp","f","node","b","aobj","bobj","seen","stringify","i","out","seenIndex","keys","key","value","import_browser_or_node","stringify","O","isNode","y","g","PERFORMANCE_PREFIX_ENABLED","m","l","time","delta","s","t","n","r","sinceFirstNum","sinceLast","string","formattersEnabled","Logger","u","level","_Logger","c","config","E","e","matches","skippedFirst","obj","StringFormatters","x","formatter","o","p","i","a","R","h","logriniTest","f","F","w","b","L"]}
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js","../../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js","../../../../node_modules/.pnpm/besonders-logger@1.0.1/node_modules/besonders-logger/src/lib/logger.ts"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\nvar isNode = typeof process !== \"undefined\" && process.versions != null && process.versions.node != null;\n\nvar isWebWorker = (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === \"object\" && self.constructor && self.constructor.name === \"DedicatedWorkerGlobalScope\";\n\n/**\n * @see https://github.com/jsdom/jsdom/releases/tag/12.0.0\n * @see https://github.com/jsdom/jsdom/issues/1537\n */\nvar isJsDom = typeof window !== \"undefined\" && window.name === \"nodejs\" || typeof navigator !== \"undefined\" && (navigator.userAgent.includes(\"Node.js\") || navigator.userAgent.includes(\"jsdom\"));\n\nvar isDeno = typeof Deno !== \"undefined\" && typeof Deno.version !== \"undefined\" && typeof Deno.version.deno !== \"undefined\";\n\nexports.isBrowser = isBrowser;\nexports.isWebWorker = isWebWorker;\nexports.isNode = isNode;\nexports.isJsDom = isJsDom;\nexports.isDeno = isDeno;","'use strict';\n\nmodule.exports = function (data, opts) {\n if (!opts) opts = {};\n if (typeof opts === 'function') opts = { cmp: opts };\n var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;\n\n var cmp = opts.cmp && (function (f) {\n return function (node) {\n return function (a, b) {\n var aobj = { key: a, value: node[a] };\n var bobj = { key: b, value: node[b] };\n return f(aobj, bobj);\n };\n };\n })(opts.cmp);\n\n var seen = [];\n return (function stringify (node) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n\n if (node === undefined) return;\n if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object') return JSON.stringify(node);\n\n var i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i) out += ',';\n out += stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n\n if (node === null) return 'null';\n\n if (seen.indexOf(node) !== -1) {\n if (cycles) return JSON.stringify('__cycle__');\n throw new TypeError('Converting circular structure to JSON');\n }\n\n var seenIndex = seen.push(node) - 1;\n var keys = Object.keys(node).sort(cmp && cmp(node));\n out = '';\n for (i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = stringify(node[key]);\n\n if (!value) continue;\n if (out) out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return '{' + out + '}';\n })(data);\n};\n","import { isBrowser, isNode } from 'browser-or-node'\nimport stringify from 'fast-json-stable-stringify'\n\n////////////\n// CONFIG //\n////////////\n\n//(i) disabled by default bc. the detection logic has disappeared after the refactor.\n//TODO: Find it and check if it works\nlet TIME_PREFIX_ENABLED = false\nlet PERFORMANCE_PREFIX_ENABLED = false\nif (isNode) {\n // console.debug('isNode checking', { process })\n if (process?.env?.LOGGER_TIME_PREFIX) TIME_PREFIX_ENABLED = process?.env?.LOGGER_TIME_PREFIX === 'true'\n if (process?.env?.LOGGER_PERF_PREFIX) PERFORMANCE_PREFIX_ENABLED = process?.env?.LOGGER_PERF_PREFIX === 'true'\n}\nexport let LOGGER_DEFAULT_CONFIG ={\n prefix: undefined as string | undefined,\n time: TIME_PREFIX_ENABLED,\n delta: PERFORMANCE_PREFIX_ENABLED,\n dimDebugOnServer: true,\n printOriginOnServer: true,\n serverInspectOptions: {},\n customFormattersOnServer: true,\n // Depth of stacktrace to show on server\n // - integer saying how many lines\n // - false to disable, true for all\n printStackLinesOnServer: false as boolean | number,\n dim: true,\n}\n\nexport type Config = Partial<typeof LOGGER_DEFAULT_CONFIG>\nexport type ConsoleFx = (...data: any[]) => void\nexport const StringFormatters = [\n // Format to string (Client console - currently not on server)\n // {\n // match: obj => obj instanceof Model,\n // format: m => {\n // const { displayName } = m\n // return `${m.constructor.name}#${m.ID}${displayName ? `{${displayName}}` : ''}`\n // },\n // },\n] as unknown as {\n match: (obj: any) => boolean\n format: (m: any) => string\n}[]\n\n// let applyCustomFormatters;\n// applyCustomFormatters = (value, config) => {\n// for (const formatter of StringFormatters) {\n// if (formatter.match(value)) return formatter.format(value);\n// }\n// if (!_.isString(value)) {\n// return util.inspect(value, config.inspectOptionsOnServer);\n// }\n// return value;\n// };\n\n/// ////////////////\n// RUNTIME STUFF //\n/// ////////////////\n\nexport class LoggerTime {\n sinceFirst = 0\n sinceLast = 0\n time = false\n delta = false\n constructor(sinceFirst: number, sinceLast: number, time: boolean, delta: boolean) {\n Object.assign(this, { sinceFirst, sinceLast, time, delta })\n }\n\n toString() {\n const sinceFirstNum = (this.sinceFirst * 0.001)\n const sinceFirst = sinceFirstNum.toFixed(sinceFirstNum < 5 ? 2 : 1) /* .padStart(3, ' ') */\n const sinceLast\n = this.sinceLast < 1000 // when >= 1s, format as seconds\n ? `${this.sinceLast.toFixed(0)}`.padStart(5, ' ')\n : `${`${(this.sinceLast * 0.001).toFixed(this.sinceLast < 10000 ? 1 : 0)}`.padStart(4, ' ')}s`\n return `[${[this.time ? sinceFirst : null, this.delta ? sinceLast : null]\n .filter(t => t!=null)\n .join(',')}]`\n }\n}\n\nexport class Style {\n constructor(style: string, string: string) {\n Object.assign(this, { style, string })\n }\n}\nlet formattersEnabled = false // for tracking if chrome formatters are enabled (don't change manually)\n\nexport class Logger {\n static ERROR = 2 as const\n static WARN = 4 as const\n static INFO = 6 as const // alias for LOG\n static LOG = 6 as const\n static DEBUG = 8 as const\n static VERBOSE = 10 as const\n\n static firstLog = 0\n static lastLog = 0\n\n /**\n * This is a clever way to log without the extra check on each log line.\n * Use it like this:\n * ```\n * const { WARN, LOG, DEBUG, VERBOSE } = Logger.setup(Logger.INFO); // eslint-disable-line no-unused-vars\n * LOG('message', data);\n * DEBUG(this.collectionName, '...')\n * if (!VERBOSE.isDisabled) {\n * const verboseStuff = generateVerboseStuff(); // computationally intensive\n * VERBOSE('Here it is:', verboseStuff)\n * }\n * ```\n *\n * @ param {number} level See {@link LVs}\n * @ param {object} config see LOGGER_DEFAULT_CONFIG\n * @ typedef {Function & {isDisabled: boolean, isEnabled: boolean, ...}} LogFunc\n * @ returns {{LOG: LogFunc, VERBOSE: LogFunc, DEBUG: LogFunc, WARN: LogFunc, ERROR: LogFunc}}\n */\n static setup(level: 2 | 4 | 6 | 8 | 10 = Logger.INFO, config: Config = {}) {\n config = Object.assign({}, LOGGER_DEFAULT_CONFIG, config) // defaults(config, LOGGER_DEFAULT_CONFIG) // fyi this is like the reverse of Object.assign\n if (level > 10) console.debug('setup logger', { config }) // manual overide to level:11 to show this trace\n\n const debugLogForStub = this.wrapLog(console.debug, { ...config, dim: config.dimDebugOnServer })\n const stub = (...args: any[]) => {\n // @ts-expect-error hack to enable DEBUG logging EVERYWHERE\n if (typeof window !== 'undefined' && window?.FORCE_DISABLE_LOGLEVEL)\n debugLogForStub(...args)\n } // For disabled log-levels, we just return a stub function\n stub.isDisabled = true // this makes it possible to check, e.g. `DEBUG.isDisabled`\n stub.isEnabled = false // depending on syntactic preference\n const groupCollapsed = this.wrapLog(console.groupCollapsed, config)\n\n const addExtraFxs = (enabled: boolean, func: (...T: any) => void) =>/* : ((...T) => void & {isDisabled: boolean}) */ {\n // warning - weird TS hacks approaching:\n function group<T extends Func>(\n ...args: [...any[], T]\n ): ReturnType<T> extends Promise<any> ? Promise<ReturnType<T>> : ReturnType<T> {\n const functionToWrap = args[args.length - 1] as T\n\n if (functionToWrap as Func === stub)\n return functionToWrap() as ReturnType<T>\n\n groupCollapsed(...args.slice(0, -1)) // except last\n\n const asyncWrapper = async () => {\n try {\n const result = functionToWrap()\n return result instanceof Promise ? await result : result\n } finally {\n console.groupEnd()\n }\n }\n\n return asyncWrapper() as ReturnType<T> // Cast to bypass the Promise type inference\n }\n\n const realFunc = Object.assign(\n func.bind({}), // clone function - https://stackoverflow.com/a/6772648\n {\n isEnabled: enabled,\n isDisabled: !enabled,\n group,\n force: func,\n },\n )\n if (enabled) {\n return realFunc\n } else {\n return Object.assign(\n stub.bind({}), // clone stub function - https://stackoverflow.com/a/6772648\n {\n isEnabled: enabled,\n isDisabled: !enabled,\n group,\n force: realFunc,\n },\n )\n }\n }\n\n const ERRFX = addExtraFxs(level >= Logger.ERROR, this.wrapLog(console.error, config))\n const ERROR = (...params: any[]) => {\n ERRFX(...params)\n return new Error(stringify(params)) // return so we can throw it, stringify is fast & safe with circular references\n }\n\n // console.debug(\"Logger init:\", config)\n return {\n ERROR,\n WARN: addExtraFxs(level >= Logger.WARN, this.wrapLog(console.warn, config)),\n LOG: addExtraFxs(level >= Logger.INFO, this.wrapLog(console.log, config)),\n DEBUG: addExtraFxs(level >= Logger.DEBUG, this.wrapLog(console.log, { ...config, dim: config.dimDebugOnServer })), // not using console.debug as that requires dev tools verbose to be enabled\n VERBOSE: addExtraFxs(level >= Logger.VERBOSE, this.wrapLog(console.debug, { ...config, dim: config.dimDebugOnServer })),\n }\n }\n\n static wrapLog(logFunc: ConsoleFx, config: Config) {\n if (!isNode) {\n // ℹ In browser we can only do some of the fancy things, because we cannot call console.log ourselves,\n // as that would pollute the stacktrace\n\n // ℹ Would be nice to get formtted links in devtools, but <a> tags are not allowed:\n // const stack = new Error().stack;\n // const origin = Logger.getOriginFromStack(stack);\n // const originFilename = origin.split('\\\\').pop().split('/').pop(); // eslint-disable-line\n // if (origin) fixedArgs.push({ link: originFilename, href: `http://localhost:63342/api/file/${origin}` });\n\n // on the client, we need to return the original log function, as otherwise the origin of the log is set to here\n // But luckily we can bind fixed parameters on the function:\n const fixedArgs = []\n // if the custom formatters are enabled, and we want performance logging - we add an instance of P as a static prefix\n if (config.time || config.delta) {\n const isChrome = isBrowser && navigator.userAgent.includes('Chrome')\n\n const p = isChrome\n ? ['', Logger.timeStr(!!config.time, !!config.delta)] // this is a placeholder that gets replaced by the custom formatter\n : [] // [{ get perfNiceTry () { return Logger.timeStr(,,true) } }] // this (of course) shows the time when you click the getter\n fixedArgs.push(...p) // if we start with a non-string, all strings are rendered with quotes :/\n }\n if (config.prefix) {\n if (formattersEnabled)\n fixedArgs.push(new Style('dim', config.prefix))\n else fixedArgs.push(config.prefix)\n }\n // console.log('logger-log', { config, fixedArgs })\n return logFunc.bind(console, ...fixedArgs)\n } else {\n // ℹ in nodejs we print the stack trace origin ourselves, so we can do a lot more things\n // TODO: re-import removed code - https://gitlab.com/onezoomin/ztax/ztax/-/commit/f6f9bde617cd9ae93d1bc4bc49a4b5275e4cbff2#b1d1e091ca27ae560becf7ae1b27a4d53d39c061\n return logFunc.bind(console)\n }\n }\n\n // static log(msg, logPerformance = true) {\n // const p = this.perf();\n // return logPerformance ? `${p} ${msg}` : msg;\n // }\n\n static timeStr(time: boolean, delta: boolean, returnAsString = 0): LoggerTime | string | undefined {\n if (!performance.now)\n return undefined // TODO: server? p = { now: require('performance-now') };\n const now = performance.now()\n if (!Logger.firstLog) {\n Logger.firstLog = now\n Logger.lastLog = now\n }\n const p = new LoggerTime(now - Logger.firstLog, now - Logger.lastLog, time, delta)\n Logger.lastLog = now\n return returnAsString ? p.toString() : p\n }\n\n // (for nodejs) ~ https://stackoverflow.com/a/47296370/1633985\n static getOriginFromStack(stack: any): string | undefined {\n let skippedFirst = false // the first one is Logger.js\n for (const line of stack.split('\\n')) {\n const matches = line.match(/^\\s+at\\s+(.*)/)\n if (matches) {\n if (skippedFirst) {\n // first line - current function\n // second line - caller (what we are looking for)\n return (\n matches[1]\n .trim() // Removes spaces\n // .replace(/^module /, '') // Removes 'module ' at beginning\n // .replace(/^at /, '') // Removes 'at ' at beginning\n // .replace(/^ \\(/, '') // Removes parentheseses around file\n // .replace(/\\)$/, '') // -||-\n .replace(__dirname, '') // Removes script folder path (if exists)\n )\n }\n skippedFirst = true\n }\n }\n }\n}\n\nif (isBrowser) { // isBrowser is not true for web workers\n // CLIENT or Worker //\n\n // @ts-expect-error window hack\n window.devtoolsFormatters = window.devtoolsFormatters ?? []\n // noinspection JSUnusedGlobalSymbols\n // @ts-expect-error window hack\n window.devtoolsFormatters.push(\n {\n // Custom formatters\n header: (obj: any) => {\n if (StringFormatters && StringFormatters.length) {\n for (const formatter of StringFormatters) {\n if (formatter.match(obj))\n return ['span', {}, formatter.format(obj)]\n }\n }\n return null\n },\n hasBody: () => true,\n },\n {\n // Performance object //\n // This is a sneaky way to show performance info withouth any extra calls when logging:\n // LOG(`...`)\n // it would work without this if we would have some way to intercept the call:\n // L.INFO('...') - a getter on L that adds the current time as prefix\n // LOG('...')() - returns the log function with all argumends bound\n // But instead we are adding a custom formatter that replaced the placeholder object of class P with the performance info\n header: (obj: any) => {\n if (!(obj instanceof LoggerTime))\n return null\n if (!formattersEnabled)\n formattersEnabled = true\n const p = Logger.timeStr(obj.time, obj.delta)\n return [\n 'span',\n { style: 'font-weight: light; color: grey' },\n p?.toString(),\n // ['a', { href: 'vscodium://file/home/manu/dev/tamera/bookr/imports/lib/utils/Logger.js' }, 'WOW'],\n ]\n },\n hasBody: () => false,\n },\n {\n // Style object\n header: (obj: { string: any }) => {\n if (!(obj instanceof Style))\n return null\n if (!formattersEnabled)\n formattersEnabled = true\n return ['span', { style: 'font-weight: light; color: grey; '/* font-style: italic; */ }, obj.string]\n },\n hasBody: () => false,\n },\n )\n}\nelse if (isNode) {\n // SERVER //\n // node stuff removed as it breaks/bloats webworker build\n}\n\nexport function logriniTest(): string {\n return 'logrini'\n}\n\ntype Func<T = any> = () => T\n"],"mappings":"wzBAAA,IAAAA,EAAAC,EAAAC,GAAA,cAEA,OAAO,eAAeA,EAAS,aAAc,CAC3C,MAAO,EACT,CAAC,EAED,IAAIC,EAAU,OAAO,QAAW,YAAc,OAAO,OAAO,UAAa,SAAW,SAAUC,EAAK,CAAE,OAAO,OAAOA,CAAK,EAAI,SAAUA,EAAK,CAAE,OAAOA,GAAO,OAAO,QAAW,YAAcA,EAAI,cAAgB,QAAUA,IAAQ,OAAO,UAAY,SAAW,OAAOA,CAAK,EAEvQC,EAAY,OAAO,OAAW,KAAe,OAAO,OAAO,SAAa,IAExEC,EAAS,OAAO,QAAY,KAAe,QAAQ,UAAY,MAAQ,QAAQ,SAAS,MAAQ,KAEhGC,GAAe,OAAO,KAAS,IAAc,YAAcJ,EAAQ,IAAI,KAAO,UAAY,KAAK,aAAe,KAAK,YAAY,OAAS,6BAMxIK,EAAU,OAAO,OAAW,KAAe,OAAO,OAAS,UAAY,OAAO,UAA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,CAAC,EAAGC,EAAU,OAAOD,CAAG,CAAC,EAG/C,OAAO,IACT,EACA,QAAS,IAAM,EACjB,EACA,CAQE,OAASA,GAAa,CACpB,GAAI,EAAEA,aAAevC,GACnB,OAAO,KACJU,IACHA,EAAoB,IACtB,IAAMqB,EAAIpB,EAAO,QAAQ4B,EAAI,KAAMA,EAAI,KAAK,EAC5C,MAAO,CACL,OACA,CAAE,MAAO,iCAAkC,EAC3CR,GAAG,SAAS,CAEd,CACF,EACA,QAAS,IAAM,EACjB,EACA,CAEE,OAASQ,GACDA,aAAehC,GAEhBG,IACHA,EAAoB,IACf,CAAC,OAAQ,CAAE,MAAO,mCAA6D,EAAG6B,EAAI,MAAM,GAH1F,KAKX,QAAS,IAAM,EACjB,CACF","names":["require_lib","__commonJSMin","exports","_typeof","obj","isBrowser","isNode","isWebWorker","isJsDom","isDeno","require_fast_json_stable_stringify","__commonJSMin","exports","module","data","opts","cycles","cmp","f","node","b","aobj","bobj","seen","stringify","i","out","seenIndex","keys","key","value","import_browser_or_node","import_fast_json_stable_stringify","TIME_PREFIX_ENABLED","PERFORMANCE_PREFIX_ENABLED","isNode","LOGGER_DEFAULT_CONFIG","StringFormatters","LoggerTime","sinceFirst","sinceLast","time","delta","sinceFirstNum","t","Style","style","string","formattersEnabled","Logger","_Logger","level","config","debugLogForStub","stub","args","groupCollapsed","addExtraFxs","enabled","func","group","functionToWrap","result","realFunc","ERRFX","params","stringify","logFunc","fixedArgs","p","isBrowser","returnAsString","now","stack","skippedFirst","line","matches","obj","formatter"]}