{"version":3,"sources":["jsdelivr-header.js","/npm/seenreq-repo-redis@1.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACLA,aAEA,MAAM,KAAO,QAAQ,gBACf,MAAQ,QAAQ,WAEtB,MAAM,kBAAkB,KACvB,WAAA,CAAY,GACX,MAAM,GASN,KAAK,QAAU,EAAU,OAAO,OAAO,CAAC,EAPjB,CACtB,KAAM,KACN,KAAM,YACN,OAAQ,EACR,SAAU,IAG+C,GAC1D,KAAK,MAAQ,IAAI,MAAM,GACvB,KAAK,QAAU,EAAQ,SAAW,UAClC,KAAK,aAAsC,IAAxB,EAAQ,WAC5B,CAMA,SAAA,CAAU,GACT,OAAO,KAAK,MAAM,MAAM,KAAK,QAAS,EACvC,CAEA,SAAA,CAAU,GACT,MAAM,EAAe,EAAK,QAAQ,CAAC,EAAO,KACzC,EAAM,KAAK,EAAK,GACT,IACL,IAEH,OAA4B,IAAxB,EAAa,OACT,QAAQ,UAGT,KAAK,MAAM,MAAM,KAAK,QAAS,EACvC,CAEA,OAAA,GACC,OAAI,KAAK,YACD,KAAK,MAAM,IAAI,KAAK,SAAS,MAAK,IAAM,KAAK,MAAM,UAE1D,KAAK,MAAM,OACJ,QAAQ,UAEjB,EAGD,OAAO,QAAU","file":"/npm/seenreq-repo-redis@1.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/seenreq-repo-redis@1.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\n'use strict';\n\nconst Repo = require('seenreq/repo');\nconst Redis = require('ioredis');\n\nclass RedisRepo extends Repo{\n\tconstructor(options) {\n\t\tsuper(options);\n\t\t\n\t\tconst defaultOptions = {\n\t\t\tport: 6379, // Redis port\n\t\t\thost: '127.0.0.1', // Redis host\n\t\t\tfamily: 4, // 4 (IPv4) or 6 (IPv6)\n\t\t\tpassword: ''\n\t\t};\n\n\t\tthis.options = options = Object.assign({},defaultOptions, options);\n\t\tthis.redis = new Redis(options);\n\t\tthis.appName = options.appName || 'seenreq';\n\t\tthis.clearOnQuit = options.clearOnQuit !== false;\n\t}\n\t\n\t/* \n\t * \n\t * @return Array represent if hit. e.g. [1,1,0,0,1,0]\n\t */\n\tgetByKeys(keys) {\n\t\treturn this.redis.hmget(this.appName, keys);\n\t}\n\n\tsetByKeys(keys) {\n\t\tconst keysToInsert = keys.reduce( (total, key) => {\n\t\t\ttotal.push(key, 1);\n\t\t\treturn total;\n\t\t}, []);\n\n\t\tif (keysToInsert.length === 0) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t\n\t\treturn this.redis.hmset(this.appName, keysToInsert);\n\t}\n\t\n\tdispose() {\n\t\tif (this.clearOnQuit) {\n\t\t\treturn this.redis.del(this.appName).then(() => this.redis.quit() );\n\t\t} else {\n\t\t\tthis.redis.quit();\n\t\t\treturn Promise.resolve();\n\t\t}\n\t}\n}\n\nmodule.exports = RedisRepo;\n"]}