Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
125 KiB

1 year ago
{"version":3,"file":"index.cjs","sources":["../native.js","../caching.js","../util/ArrayLikeIterable.js","../keys.js","../query.js","../util/when.js","../writer.js","../index.js"],"sourcesContent":["import { createRequire } from 'module';\r\nconst require = createRequire(import.meta.url)\r\nimport { fileURLToPath } from 'url'\r\nimport { dirname } from 'path'\r\nlet nativeMethods, dirName = dirname(fileURLToPath(import.meta.url)).replace(/dist$/, '')\r\ntry {\r\n\tconsole.log(dirName)\r\n\tnativeMethods = require('node-gyp-build')(dirName)\r\n\tif (process.versions.modules == 93)\r\n\t\trequire('v8').setFlagsFromString('--turbo-fast-api-calls')\r\n} catch(error) {\r\n\tif (process.versions.modules == 93) {\r\n\t\t// use this abi version as the backup version without turbo-fast-api-calls enabled\r\n\t\tObject.defineProperty(process.versions, 'modules', { value: '92' })\r\n\t\ttry {\r\n\t\t\tnativeMethods = require('node-gyp-build')(dirName)\r\n\t\t} catch(secondError) {\r\n\t\t\tthrow error\r\n\t\t} finally {\r\n\t\t\tObject.defineProperty(process.versions, 'modules', { value: '93' })\r\n\t\t}\r\n\t} else\r\n\t\tthrow error\r\n}\r\nexport const { Env, Cursor, Compression, getBufferForAddress, getAddress } = nativeMethods","import { WeakLRUCache } from 'weak-lru-cache/index.js'\r\nlet getLastVersion\r\nconst mapGet = Map.prototype.get\r\nexport const CachingStore = Store => class extends Store {\r\n\tconstructor(dbName, options) {\r\n\t\tsuper(dbName, options)\r\n\t\tif (!this.env.cacheCommitter) {\r\n\t\t\tthis.env.cacheCommitter = true\r\n\t\t\tthis.on('aftercommit', ({ next, last }) => {\r\n\t\t\t\tdo {\r\n\t\t\t\t\tlet store = next.store\r\n\t\t\t\t\tif (store) {\r\n\t\t\t\t\t\tif (next.flag & 1)\r\n\t\t\t\t\t\t\tnext.store.cache.delete(next.key) // just delete it from the map\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tlet expirationPriority = next.valueSize >> 10\r\n\t\t\t\t\t\t\tlet cache = next.store.cache\r\n\t\t\t\t\t\t\tlet entry = mapGet.call(cache, next.key)\r\n\t\t\t\t\t\t\tif (entry)\r\n\t\t\t\t\t\t\t\tcache.used(entry, expirationPriority) // this will enter it into the LRFU\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} while (next != last && (next = next.next))\r\n\t\t\t})\r\n\t\t}\r\n\t\tthis.db.cachingDb = this\r\n\t\tthis.cache = new WeakLRUCache(options.cache)\r\n\t}\r\n\tget(id, cacheMode) {\r\n\t\tlet value = this.cache.getValue(id)\r\n\t\tif (value !== undefined)\r\n\t\t\treturn value\r\n\t\tvalue = super.get(id)\r\n\t\tif (value && typeof value === 'object' && !cacheMode && typeof id !== 'object') {\r\n\t\t\tlet entry = this.cache.setValue(id, value, this.lastSize >> 10)\r\n\t\t\tif (this.useVersions) {\r\n\t\t\t\tentry.version = getLastVersion()\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn value\r\n\t}\r\n\tgetEntry(id, cacheMode) {\r\n\t\tlet entry = this.cache.get(id)\r\n\t\tif (entry)\r\n\t\t\treturn entry\r\n\t\tlet value = super.get(id)\r\n\t\tif (value === undefined)\r\n\t\t\treturn\r\n\t\tif (value && typeof value === 'object' && !cacheMode && typeof id !== 'object') {\r\n\t\t\tentry = this.cache.setValue(id, value, this.lastSize >> 10)\r\n\t\t} else {\r\n\t\t\tentry = { value }\r\n\t\t}\r\n\t\tif (this.useVersions) {\r\n\t\t\tentry.version = getLastVersion()\r\n\t\t}\r\n\t\treturn entry\r\n\t}\r\n\tputEntry(id, entry, ifVersion) {\r\n\t\tlet result = super.put(id, entry.value, entry.version, ifVersion)\r\n\t\tif (typeof id === 'object')\r\n\t\t\treturn result\r\n\t\tif (result && result.then)\r\n\t\t\tthis.cache.setManually(id, entry) // set manually so we can keep it pinned in memory until it is committed\r\n\t\telse // sync operation, immediately add to cache\r\n\t\t\tthis.cache.set(id, entry)\r\n\t}\r\n\tput(id, value, version, ifVersion) {\r\n\t\t// if (this.cache.get(id)) // if there is a cache entry, remove it from scheduledEntries and \r\n\t\tlet result = super.put(id, value, version, ifVersion)\r\n\t\tif (typeof id !== 'object') {\r\n\t\t\t// sync operation, immediately add to cache, otherwise keep it pinned in memory until it is committed\r\n\t\t\tlet entry = this.cache.setValue(id, value, result.