{"version":3,"sources":["../../../node_modules/ms/index.js","../../../node_modules/debug/src/common.js","../../../node_modules/debug/src/browser.js","../../../node_modules/has-flag/index.js","../../../node_modules/supports-color/index.js","../../../node_modules/debug/src/node.js","../../../node_modules/debug/src/index.js","../../../node_modules/@feathersjs/errors/lib/index.js","../src/utility/Service.ts","../src/config.ts","../src/models/index.ts","../src/models/ShopModel.ts","../src/providers/ServiceModel.ts","../src/providers/PaginatedServiceModel.ts","../src/utility/Helpers.ts","../src/models/CategoryModel.ts","../src/models/CustomerBlacklistModel.ts","../src/models/GatewayModel.ts","../src/interfaces/documents/GatewayDocument.ts","../src/models/IpnModel.ts","../src/models/OrderEventModel.ts","../src/models/OrderFeedbackModel.ts","../src/models/OrderModel.ts","../src/providers/OrderURL.ts","../src/models/ProductModel.ts","../src/models/ProductStockModel.ts","../src/models/UserModel.ts","../src/models/ProductGroupModel.ts","../src/models/OrderReplacementModel.ts","../src/models/CouponModel.ts"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n *  - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n  options = options || {};\n  var type = typeof val;\n  if (type === 'string' && val.length > 0) {\n    return parse(val);\n  } else if (type === 'number' && isFinite(val)) {\n    return options.long ? fmtLong(val) : fmtShort(val);\n  }\n  throw new Error(\n    'val is not a non-empty string or a valid number. val=' +\n      JSON.stringify(val)\n  );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n  str = String(str);\n  if (str.length > 100) {\n    return;\n  }\n  var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n    str\n  );\n  if (!match) {\n    return;\n  }\n  var n = parseFloat(match[1]);\n  var type = (match[2] || 'ms').toLowerCase();\n  switch (type) {\n    case 'years':\n    case 'year':\n    case 'yrs':\n    case 'yr':\n    case 'y':\n      return n * y;\n    case 'weeks':\n    case 'week':\n    case 'w':\n      return n * w;\n    case 'days':\n    case 'day':\n    case 'd':\n      return n * d;\n    case 'hours':\n    case 'hour':\n    case 'hrs':\n    case 'hr':\n    case 'h':\n      return n * h;\n    case 'minutes':\n    case 'minute':\n    case 'mins':\n    case 'min':\n    case 'm':\n      return n * m;\n    case 'seconds':\n    case 'second':\n    case 'secs':\n    case 'sec':\n    case 's':\n      return n * s;\n    case 'milliseconds':\n    case 'millisecond':\n    case 'msecs':\n    case 'msec':\n    case 'ms':\n      return n;\n    default:\n      return undefined;\n  }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n  var msAbs = Math.abs(ms);\n  if (msAbs >= d) {\n    return Math.round(ms / d) + 'd';\n  }\n  if (msAbs >= h) {\n    return Math.round(ms / h) + 'h';\n  }\n  if (msAbs >= m) {\n    return Math.round(ms / m) + 'm';\n  }\n  if (msAbs >= s) {\n    return Math.round(ms / s) + 's';\n  }\n  return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n  var msAbs = Math.abs(ms);\n  if (msAbs >= d) {\n    return plural(ms, msAbs, d, 'day');\n  }\n  if (msAbs >= h) {\n    return plural(ms, msAbs, h, 'hour');\n  }\n  if (msAbs >= m) {\n    return plural(ms, msAbs, m, 'minute');\n  }\n  if (msAbs >= s) {\n    return plural(ms, msAbs, s, 'second');\n  }\n  return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n  var isPlural = msAbs >= n * 1.5;\n  return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","'use strict';\nmodule.exports = (flag, argv) => {\n\targv = argv || process.argv;\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst pos = argv.indexOf(prefix + flag);\n\tconst terminatorPos = argv.indexOf('--');\n\treturn pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);\n};\n","'use strict';\nconst os = require('os');\nconst hasFlag = require('has-flag');\n\nconst env = process.env;\n\nlet forceColor;\nif (hasFlag('no-color') ||\n\thasFlag('no-colors') ||\n\thasFlag('color=false')) {\n\tforceColor = false;\n} else if (hasFlag('color') ||\n\thasFlag('colors') ||\n\thasFlag('color=true') ||\n\thasFlag('color=always')) {\n\tforceColor = true;\n}\nif ('FORCE_COLOR' in env) {\n\tforceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3\n\t};\n}\n\nfunction supportsColor(stream) {\n\tif (forceColor === false) {\n\t\treturn 0;\n\t}\n\n\tif (hasFlag('color=16m') ||\n\t\thasFlag('color=full') ||\n\t\thasFlag('color=truecolor')) {\n\t\treturn 3;\n\t}\n\n\tif (hasFlag('color=256')) {\n\t\treturn 2;\n\t}\n\n\tif (stream && !stream.isTTY && forceColor !== true) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor ? 1 : 0;\n\n\tif (process.platform === 'win32') {\n\t\t// Node.js 7.5.0 is the first version of Node.js to include a patch to\n\t\t// libuv that enables 256 color output on Windows. Anything earlier and it\n\t\t// won't work. However, here we target Node.js 8 at minimum as it is an LTS\n\t\t// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows\n\t\t// release that supports 256 colors. Windows 10 build 14931 is the first release\n\t\t// that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(process.versions.node.split('.')[0]) >= 8 &&\n\t\t\tNumber(osRelease[0]) >= 10 &&\n\t\t\tNumber(osRelease[2]) >= 10586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\tcase 'Apple_Terminal':\n\t\t\t\treturn 2;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\treturn min;\n}\n\nfunction getSupportLevel(stream) {\n\tconst level = supportsColor(stream);\n\treturn translateLevel(level);\n}\n\nmodule.exports = {\n\tsupportsColor: getSupportLevel,\n\tstdout: getSupportLevel(process.stdout),\n\tstderr: getSupportLevel(process.stderr)\n};\n","/**\n * Module dependencies.\n */\n\nconst tty = require('tty');\nconst util = require('util');\n\n/**\n * This is the Node.js implementation of `debug()`.\n */\n\nexports.init = init;\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.destroy = util.deprecate(\n\t() => {},\n\t'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'\n);\n\n/**\n * Colors.\n */\n\nexports.colors = [6, 2, 3, 4, 5, 1];\n\ntry {\n\t// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)\n\t// eslint-disable-next-line import/no-extraneous-dependencies\n\tconst supportsColor = require('supports-color');\n\n\tif (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {\n\t\texports.colors = [\n\t\t\t20,\n\t\t\t21,\n\t\t\t26,\n\t\t\t27,\n\t\t\t32,\n\t\t\t33,\n\t\t\t38,\n\t\t\t39,\n\t\t\t40,\n\t\t\t41,\n\t\t\t42,\n\t\t\t43,\n\t\t\t44,\n\t\t\t45,\n\t\t\t56,\n\t\t\t57,\n\t\t\t62,\n\t\t\t63,\n\t\t\t68,\n\t\t\t69,\n\t\t\t74,\n\t\t\t75,\n\t\t\t76,\n\t\t\t77,\n\t\t\t78,\n\t\t\t79,\n\t\t\t80,\n\t\t\t81,\n\t\t\t92,\n\t\t\t93,\n\t\t\t98,\n\t\t\t99,\n\t\t\t112,\n\t\t\t113,\n\t\t\t128,\n\t\t\t129,\n\t\t\t134,\n\t\t\t135,\n\t\t\t148,\n\t\t\t149,\n\t\t\t160,\n\t\t\t161,\n\t\t\t162,\n\t\t\t163,\n\t\t\t164,\n\t\t\t165,\n\t\t\t166,\n\t\t\t167,\n\t\t\t168,\n\t\t\t169,\n\t\t\t170,\n\t\t\t171,\n\t\t\t172,\n\t\t\t173,\n\t\t\t178,\n\t\t\t179,\n\t\t\t184,\n\t\t\t185,\n\t\t\t196,\n\t\t\t197,\n\t\t\t198,\n\t\t\t199,\n\t\t\t200,\n\t\t\t201,\n\t\t\t202,\n\t\t\t203,\n\t\t\t204,\n\t\t\t205,\n\t\t\t206,\n\t\t\t207,\n\t\t\t208,\n\t\t\t209,\n\t\t\t214,\n\t\t\t215,\n\t\t\t220,\n\t\t\t221\n\t\t];\n\t}\n} catch (error) {\n\t// Swallow - we only care if `supports-color` is available; it doesn't have to be.\n}\n\n/**\n * Build up the default `inspectOpts` object from the environment variables.\n *\n *   $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js\n */\n\nexports.inspectOpts = Object.keys(process.env).filter(key => {\n\treturn /^debug_/i.test(key);\n}).reduce((obj, key) => {\n\t// Camel-case\n\tconst prop = key\n\t\t.substring(6)\n\t\t.toLowerCase()\n\t\t.replace(/_([a-z])/g, (_, k) => {\n\t\t\treturn k.toUpperCase();\n\t\t});\n\n\t// Coerce string value into JS value\n\tlet val = process.env[key];\n\tif (/^(yes|on|true|enabled)$/i.test(val)) {\n\t\tval = true;\n\t} else if (/^(no|off|false|disabled)$/i.test(val)) {\n\t\tval = false;\n\t} else if (val === 'null') {\n\t\tval = null;\n\t} else {\n\t\tval = Number(val);\n\t}\n\n\tobj[prop] = val;\n\treturn obj;\n}, {});\n\n/**\n * Is stdout a TTY? Colored output is enabled when `true`.\n */\n\nfunction useColors() {\n\treturn 'colors' in exports.inspectOpts ?\n\t\tBoolean(exports.inspectOpts.colors) :\n\t\ttty.isatty(process.stderr.fd);\n}\n\n/**\n * Adds ANSI color escape codes if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\tconst {namespace: name, useColors} = this;\n\n\tif (useColors) {\n\t\tconst c = this.color;\n\t\tconst colorCode = '\\u001B[3' + (c < 8 ? c : '8;5;' + c);\n\t\tconst prefix = `  ${colorCode};1m${name} \\u001B[0m`;\n\n\t\targs[0] = prefix + args[0].split('\\n').join('\\n' + prefix);\n\t\targs.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\\u001B[0m');\n\t} else {\n\t\targs[0] = getDate() + name + ' ' + args[0];\n\t}\n}\n\nfunction getDate() {\n\tif (exports.inspectOpts.hideDate) {\n\t\treturn '';\n\t}\n\treturn new Date().toISOString() + ' ';\n}\n\n/**\n * Invokes `util.format()` with the specified arguments and writes to stderr.\n */\n\nfunction log(...args) {\n\treturn process.stderr.write(util.format(...args) + '\\n');\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\tif (namespaces) {\n\t\tprocess.env.DEBUG = namespaces;\n\t} else {\n\t\t// If you set a process.env field to null or undefined, it gets cast to the\n\t\t// string 'null' or 'undefined'. Just delete instead.\n\t\tdelete process.env.DEBUG;\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n\treturn process.env.DEBUG;\n}\n\n/**\n * Init logic for `debug` instances.\n *\n * Create a new `inspectOpts` object in case `useColors` is set\n * differently for a particular `debug` instance.\n */\n\nfunction init(debug) {\n\tdebug.inspectOpts = {};\n\n\tconst keys = Object.keys(exports.inspectOpts);\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tdebug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %o to `util.inspect()`, all on a single line.\n */\n\nformatters.o = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts)\n\t\t.split('\\n')\n\t\t.map(str => str.trim())\n\t\t.join(' ');\n};\n\n/**\n * Map %O to `util.inspect()`, allowing multiple lines if needed.\n */\n\nformatters.O = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts);\n};\n","/**\n * Detect Electron renderer / nwjs process, which is node, but we should\n * treat as a browser.\n */\n\nif (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {\n\tmodule.exports = require('./browser.js');\n} else {\n\tmodule.exports = require('./node.js');\n}\n","const debug = require('debug')('@feathersjs/errors');\n\nfunction FeathersError (msg, name, code, className, data) {\n  msg = msg || 'Error';\n\n  let errors;\n  let message;\n  let newData;\n\n  if (msg instanceof Error) {\n    message = msg.message || 'Error';\n\n    // NOTE (EK): This is typically to handle validation errors\n    if (msg.errors) {\n      errors = msg.errors;\n    }\n  } else if (typeof msg === 'object') { // Support plain old objects\n    message = msg.message || 'Error';\n    data = msg;\n  } else { // message is just a string\n    message = msg;\n  }\n\n  if (data) {\n    // NOTE(EK): To make sure that we are not messing\n    // with immutable data, just make a copy.\n    // https://github.com/feathersjs/errors/issues/19\n    newData = JSON.parse(JSON.stringify(data));\n\n    if (newData.errors) {\n      errors = newData.errors;\n      delete newData.errors;\n    } else if (data.errors) {\n      // The errors property from data could be\n      // stripped away while cloning resulting newData not to have it\n      // For example: when cloning arrays this property\n      errors = JSON.parse(JSON.stringify(data.errors));\n    }\n  }\n\n  // NOTE (EK): Babel doesn't support this so\n  // we have to pass in the class name manually.\n  // this.name = this.constructor.name;\n  this.type = 'FeathersError';\n  this.name = name;\n  this.message = message;\n  this.code = code;\n  this.className = className;\n  this.data = newData;\n  this.errors = errors || {};\n\n  debug(`${this.name}(${this.code}): ${this.message}`);\n  debug(this.errors);\n\n  if (Error.captureStackTrace) {\n    Error.captureStackTrace(this, FeathersError);\n  } else {\n    this.stack = (new Error()).stack;\n  }\n}\n\nfunction inheritsFrom (Child, Parent) {\n  Child.prototype = Object.create(Parent.prototype);\n  Child.prototype.constructor = Child;\n}\n\ninheritsFrom(FeathersError, Error);\n\n// NOTE (EK): A little hack to get around `message` not\n// being included in the default toJSON call.\nObject.defineProperty(FeathersError.prototype, 'toJSON', {\n  value: function () {\n    return {\n      name: this.name,\n      message: this.message,\n      code: this.code,\n      className: this.className,\n      data: this.data,\n      errors: this.errors\n    };\n  }\n});\n\n// 400 - Bad Request\nfunction BadRequest (message, data) {\n  FeathersError.call(this, message, 'BadRequest', 400, 'bad-request', data);\n}\n\ninheritsFrom(BadRequest, FeathersError);\n\n// 401 - Not Authenticated\nfunction NotAuthenticated (message, data) {\n  FeathersError.call(this, message, 'NotAuthenticated', 401, 'not-authenticated', data);\n}\n\ninheritsFrom(NotAuthenticated, FeathersError);\n\n// 402 - Payment Error\nfunction PaymentError (message, data) {\n  FeathersError.call(this, message, 'PaymentError', 402, 'payment-error', data);\n}\n\ninheritsFrom(PaymentError, FeathersError);\n\n// 403 - Forbidden\nfunction Forbidden (message, data) {\n  FeathersError.call(this, message, 'Forbidden', 403, 'forbidden', data);\n}\n\ninheritsFrom(Forbidden, FeathersError);\n\n// 404 - Not Found\nfunction NotFound (message, data) {\n  FeathersError.call(this, message, 'NotFound', 404, 'not-found', data);\n}\n\ninheritsFrom(NotFound, FeathersError);\n\n// 405 - Method Not Allowed\nfunction MethodNotAllowed (message, data) {\n  FeathersError.call(this, message, 'MethodNotAllowed', 405, 'method-not-allowed', data);\n}\n\ninheritsFrom(MethodNotAllowed, FeathersError);\n\n// 406 - Not Acceptable\nfunction NotAcceptable (message, data) {\n  FeathersError.call(this, message, 'NotAcceptable', 406, 'not-acceptable', data);\n}\n\ninheritsFrom(NotAcceptable, FeathersError);\n\n// 408 - Timeout\nfunction Timeout (message, data) {\n  FeathersError.call(this, message, 'Timeout', 408, 'timeout', data);\n}\n\ninheritsFrom(Timeout, FeathersError);\n\n// 409 - Conflict\nfunction Conflict (message, data) {\n  FeathersError.call(this, message, 'Conflict', 409, 'conflict', data);\n}\n\ninheritsFrom(Conflict, FeathersError);\n\n// 410 - Gone\nfunction Gone (message, data) {\n  FeathersError(this, message, 'Gone', 410, 'gone', data);\n}\n\ninheritsFrom(Gone, FeathersError);\n\n// 411 - Length Required\nfunction LengthRequired (message, data) {\n  FeathersError.call(this, message, 'LengthRequired', 411, 'length-required', data);\n}\n\ninheritsFrom(LengthRequired, FeathersError);\n\n// 422 Unprocessable\nfunction Unprocessable (message, data) {\n  FeathersError.call(this, message, 'Unprocessable', 422, 'unprocessable', data);\n}\n\ninheritsFrom(Unprocessable, FeathersError);\n\n// 429 Too Many Requests\nfunction TooManyRequests (message, data) {\n  FeathersError.call(this, message, 'TooManyRequests', 429, 'too-many-requests', data);\n}\n\ninheritsFrom(TooManyRequests, FeathersError);\n\n// 500 - General Error\nfunction GeneralError (message, data) {\n  FeathersError.call(this, message, 'GeneralError', 500, 'general-error', data);\n}\n\ninheritsFrom(GeneralError, FeathersError);\n\n// 501 - Not Implemented\nfunction NotImplemented (message, data) {\n  FeathersError.call(this, message, 'NotImplemented', 501, 'not-implemented', data);\n}\n\ninheritsFrom(NotImplemented, FeathersError);\n\n// 502 - Bad Gateway\nfunction BadGateway (message, data) {\n  FeathersError.call(this, message, 'BadGateway', 502, 'bad-gateway', data);\n}\n\ninheritsFrom(BadGateway, FeathersError);\n\n// 503 - Unavailable\nfunction Unavailable (message, data) {\n  FeathersError.call(this, message, 'Unavailable', 503, 'unavailable', data);\n}\n\ninheritsFrom(Unavailable, FeathersError);\n\nconst errors = {\n  FeathersError,\n  BadRequest,\n  NotAuthenticated,\n  PaymentError,\n  Forbidden,\n  NotFound,\n  MethodNotAllowed,\n  NotAcceptable,\n  Timeout,\n  Conflict,\n  Gone,\n  LengthRequired,\n  Unprocessable,\n  TooManyRequests,\n  GeneralError,\n  NotImplemented,\n  BadGateway,\n  Unavailable,\n  400: BadRequest,\n  401: NotAuthenticated,\n  402: PaymentError,\n  403: Forbidden,\n  404: NotFound,\n  405: MethodNotAllowed,\n  406: NotAcceptable,\n  408: Timeout,\n  409: Conflict,\n  410: Gone,\n  411: LengthRequired,\n  422: Unprocessable,\n  429: TooManyRequests,\n  500: GeneralError,\n  501: NotImplemented,\n  502: BadGateway,\n  503: Unavailable\n};\n\nfunction convert (error) {\n  if (!error) {\n    return error;\n  }\n\n  const FeathersError = errors[error.name];\n  const result = FeathersError\n    ? new FeathersError(error.message, error.data)\n    : new Error(error.message || error);\n\n  if (typeof error === 'object') {\n    Object.assign(result, error);\n  }\n\n  return result;\n}\n\nmodule.exports = Object.assign({ convert }, errors);\n","import { Application } from '@feathersjs/feathers';\nimport StaticModels from '../interfaces/StaticModels';\n\nexport interface HostConfig {\n    host: string;\n    protocol: 'http' | 'https';\n}\n\nexport interface ConfigOptions {\n    app: Application;\n    models?: Partial<StaticModels>;\n    frontend?: Partial<HostConfig>;\n    legacyFrontend?: Partial<HostConfig>;\n    permalinkService?: Partial<HostConfig>;\n}\n\n/**\n * Feathers Application.\n */\nexport let App: Application;\n\n/**\n * Configure Feathers Service Models.\n */\nexport const config = (options: ConfigOptions) => {\n    App = options.app;\n\n    if (options.frontend || !App.get('frontend')) {\n        App.set('frontend', {\n            host: 'ats.gg',\n            protocol: 'https',\n            ...options.frontend,\n        });\n    }\n\n    if (options.legacyFrontend || !App.get('legacyFrontend')) {\n        App.set('legacyFrontend', {\n            host: 'atshop.io',\n            protocol: 'https',\n            ...options.legacyFrontend,\n        });\n    }\n\n    if (options.permalinkService || !App.get('permalinkService')) {\n        App.set('permalinkService', {\n            host: 'redirect.atshop.io',\n            protocol: 'https',\n            ...options.permalinkService,\n        })\n    }\n\n    if (options.models) {\n        Object.entries(options.models).forEach(([modelName, model]) => {\n            App.set(`atshop-service-models.model.${modelName}`, model);\n        });\n    }\n};","import { Application } from '@feathersjs/feathers';\nimport { config, ConfigOptions } from './utility/Service';\nimport { Omit } from './utility/TS';\n\n/**\n * Configure package using existing Feathers instance.\n */\nexport default function ConfigureATShopServiceModels(options?: Omit<ConfigOptions, 'app'>) {\n    return (app: Application) => {\n        config({ app, ...options });\n    }\n}","import ShopModel from './ShopModel';\nimport CategoryModel from './CategoryModel';\nimport CustomerBlacklistModel from './CustomerBlacklistModel';\nimport IpnModel from './IpnModel';\nimport OrderEventModel from './OrderEventModel';\nimport OrderFeedbackModel from './OrderFeedbackModel';\nimport OrderModel from './OrderModel';\nimport ProductModel from './ProductModel';\nimport ProductStockModel from './ProductStockModel';\nimport UserModel from './UserModel';\nimport GatewayModel from './GatewayModel';\nimport ProductGroupModel from './ProductGroupModel';\nimport OrderReplacementModel from './OrderReplacementModel';\nimport CouponModel from './CouponModel';\n\nexport {\n    CategoryModel,\n    GatewayModel,\n    CustomerBlacklistModel,\n    IpnModel,\n    OrderEventModel,\n    OrderReplacementModel,\n    OrderFeedbackModel,\n    OrderModel,\n    ProductModel,\n    ProductGroupModel,\n    ProductStockModel,\n    CouponModel,\n    ShopModel,\n    UserModel,\n}","import { get } from 'lodash';\nimport ShopDocument from '../interfaces/documents/ShopDocument';\nimport ServiceModel from '../providers/ServiceModel';\nimport Helpers from '../utility/Helpers';\nimport FeedbackSummary from '../interfaces/FeedbackSummary';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass ShopModel extends ServiceModel implements FeedbackSummary {\n\n    /**\n     * Service path for the \"shops\" service.\n     */\n    public static servicePath = '/shops';\n\n    /**\n     * A shop has many blacklisted customers.\n     */\n    public get blacklist() {\n        return this.hasMany('CustomerBlacklistModel', 'shopId', this.entry._id);\n    }\n\n    /**\n     * A shop has many gateways.\n     */\n    public get gateways() {\n        return this.hasMany('GatewayModel', 'shopId', this.entry._id);\n    }\n\n    /**\n     * A shop can have many products.\n     */\n    public get products() {\n        return this.hasMany('ProductModel', 'shopId', this.entry._id);\n    }\n\n    /**\n     * A shop can have many categories.\n     */\n    public get categories() {\n        return this.hasMany('CategoryModel', 'shopId', this.entry._id);\n    }\n\n    /**\n     * Check if the given email is blacklisted from the current shop.\n     *\n     * @param email\n     */\n    public async isBlacklisted(email: string) {\n        const results = await this.blacklist.find({ email }).fetch();\n\n        return results.total > 0;\n    }\n\n    /**\n     * Whether or not this shop has an available Discord webhook.\n     */\n    public get hasDiscord(): boolean {\n        return !!(this.webhooks && this.webhooks.discord);\n    }\n\n    /**\n     * Max permitted fraud percentage for this shop.\n     */\n    public get maxFraud() {\n        return this.entry.maxFraud || 30;\n    }\n\n    /**\n     * Build a full-fledged URL to a page on the given path for the current shop.\n     */\n    public urlTo(path: string, legacy?: boolean) {\n        let frontend = this._App.get('frontend');\n\n        if (legacy) {\n            frontend = this._App.get('legacyFrontend') || frontend;\n        }\n\n        let host = `${this.domain}.${frontend.host}`;\n\n        if (this.customDomain && this.enforceCustomDomain) {\n            host = this.customDomain;\n        }\n\n        return Helpers.urlTo(frontend.protocol, host, path);\n    }\n\n    /**\n     * Build a URL to the admin dashboard.\n     */\n    public adminUrl(path: string) {\n        return this.urlTo('/admin/' + path.replace(/^\\/+/, ''), true);\n    }\n\n    /**\n     * Legal name of the current shop.\n     */\n    public get legalName() {\n        return this.companyName || this.name;\n    }\n\n    /**\n     * Summary of feedback for this product.\n     */\n    public get feedbackSummary() {\n        return {\n            count: get(this.entry, 'feedback.count', 0),\n            percentage: get(this.entry, 'feedback.score', 0),\n            stars: get(this.entry, 'feedback.score', 0) / 20,\n        }\n    }\n}\n\ninterface ShopModel extends Omit<ShopDocument, ModelTimestamps> {\n    entry: ShopDocument;\n}\n\nexport default ShopModel;","import { Application, Id, Paginated, Params, Service } from '@feathersjs/feathers';\nimport { NotFound } from '@feathersjs/errors';\nimport ModelDocument from '../interfaces/documents/ModelDocument';\nimport ServiceModelStatic from '../interfaces/ServiceModelStatic';\nimport StaticModels, { ModelName } from '../interfaces/StaticModels';\nimport PaginatedServiceModel from './PaginatedServiceModel';\nimport { App } from '../utility/Service';\nimport * as Models from '../models';\n\ntype Query = Params['query'];\n\nclass ServiceModel {\n\n    /**\n     * Model index signature.\n     */\n    [s: string]: any;\n\n    /**\n     * Feathers application.\n     */\n    public static get App(): Application {\n        return App;\n    };\n\n    /**\n     * Find a list of entries from the current service.\n     */\n    public static _find(query: Query): Promise<Paginated<ModelDocument>> {\n        return this.service.find({ query });\n    }\n\n    /**\n     * Update the models on the current collection.\n     */\n    public static _patch(id: string | null, data: any, params?: Params) {\n        return this.service.patch(id, data, params);\n    }\n\n    /**\n     * Find and format a list of entries from the current service.\n     */\n    public static find<Self extends typeof ServiceModel = typeof this>(this: Self, query: Query): PaginatedServiceModel<Self> {\n        return new PaginatedServiceModel(this, query) as PaginatedServiceModel<Self>;\n    }\n\n    /**\n     * Fetch a single entry from the current service.\n     */\n    public static async get<Self extends typeof ServiceModel>(this: Self, id: AsyncKey, query?: Query) {\n        const result = await this.service.get(await id, query);\n\n        if (!result) {\n            throw new NotFound(`The requested entry could not be located!`, {\n                id,\n                query,\n                service: this.servicePath,\n            });\n        }\n\n        return new this(result) as InstanceType<Self>;\n    }\n\n    /**\n     * Insert an entry into the database.\n     */\n    public static async create(data: any, params?: Params) {\n        return new this(\n            // @ts-ignore\n            await this.service.create(data, params)\n        );\n    }\n\n    /**\n     * Feathers service path.\n     */\n    public static servicePath: string;\n\n    /**\n     * Feathers service instance for this model.\n     */\n    public static get service(): Service<any> {\n        return this.App.service(this.servicePath);\n    }\n\n    /**\n     * Model constructor.\n     */\n    public constructor(data: ModelDocument) {\n        this._renewEntry(data);\n    }\n\n    /**\n     * Dynamic accessor for Feathers application.\n     */\n    public get _App() {\n        // @ts-ignore\n        return this.constructor.App;\n    }\n\n    /**\n     * Dynamic accessor for current service.\n     */\n    public get service() {\n        // @ts-ignore\n        return this.constructor.service;\n    }\n\n    /**\n     * FeathersVuex Model for the current service.\n     */\n    public get vuex() {\n        // @ts-ignore\n        const model = this.constructor.service.FeathersVuexModel;\n\n        if (!model) {\n            console.warn('[atshop-service-models] No FeathersVuexModel available for this service.', this.constructor.name)\n        }\n\n        return model;\n    }\n\n    /**\n     * Entry creation date.\n     */\n    public get createdAt(): Date {\n        return new Date(this.entry.createdAt);\n    }\n\n    /**\n     * Timestamp of entry's last update.\n     */\n    public get updatedAt(): Date {\n        return new Date(this.entry.updatedAt);\n    }\n\n    /**\n     * Entry soft-deletion timestamp.\n     */\n    public get deletedAt(): Date | undefined {\n        const deletedAt = this.entry.deletedAt;\n\n        if (!deletedAt) {\n            return undefined;\n        }\n\n        return new Date(deletedAt);\n    }\n\n    /**\n     * Merge and store the ServiceModel's in-database data with the given data.\n     */\n    public async patch(data: any): Promise<void> {\n        // @ts-ignore\n        const service = this.constructor.service;\n\n        await this._renew(await service.patch(this._id, data));\n    }\n\n    /**\n     * Remove the current model from the database.\n     */\n    public remove() {\n        return this.service.remove(this._id);\n    }\n\n    /**\n     * Query the database to re-fetch data for this model.\n     */\n    public async _renew(data?: ModelDocument) {\n        // @ts-ignore\n        this._renewEntry(data || await this.constructor.service.get(this._id));\n        return this;\n    }\n\n    /**\n     * Register has-many relationship for the current model.\n     */\n    protected hasMany<Name extends ModelName>(model: Name, foreignKey: string, localKey = this.entry._id) {\n        const query: Params['query'] = {};\n        query[foreignKey] = localKey;\n\n        return new PaginatedServiceModel(this.getModel(model), query);\n    }\n\n    /**\n     * Register a has-one relationship for the current model.\n     */\n    protected hasOne<Name extends ModelName>(model: Name, foreignKey: string, localKey: AsyncKey = this._id) {\n        const query: Params['query'] = {};\n        query[foreignKey] = localKey;\n\n        return new PaginatedServiceModel(this.getModel(model), query).fetchOne();\n    }\n\n    /**\n     * Registers a relationship between the current model instance and the given ServiceModel instance.\n     */\n    protected belongsTo<Name extends ModelName>(modelName: Name, foreignKey: AsyncKey) {\n        return this.getModel(modelName).get(foreignKey);\n    }\n\n    /**\n     * Register a belongs-to-many relationship for the current model.\n     */\n    protected async belongsToMany<Name extends ModelName>(modelName: Name, foreignKeys: AsyncKey[]) {\n        const query: Params['query'] = {\n            _id: {\n                $in: await Promise.all(foreignKeys),\n            },\n        };\n\n        return new PaginatedServiceModel(this.getModel(modelName), query);\n    }\n\n    /**\n     * Merge entry data with the current model.\n     */\n    protected _renewEntry(entry: ModelDocument) {\n        this.entry = entry;\n\n        Object.entries(entry).forEach(([key, value]) => {\n            const set = () => { this[key] = value };\n            let descriptorTarget = this;\n            let descriptor;\n\n            while(!descriptor && (descriptorTarget = Object.getPrototypeOf(descriptorTarget))) {\n                descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, key);\n            }\n\n            if (!descriptor) {\n                return set();\n            }\n\n            if (typeof descriptor.set === 'function') {\n                descriptor.set(value);\n                return;\n            }\n\n            if (typeof descriptor.get === 'function') {\n                return;\n            }\n\n            if (typeof descriptor.value === 'function') {\n                return;\n            }\n\n            set();\n        });\n\n        this.entry = entry;\n        return this;\n    }\n\n    /**\n     * Fetch a model by name.\n     */\n    private getModel<Name extends ModelName>(modelName: Name): ServiceModelStatic<InstanceType<StaticModels[Name]>> {\n        const model = this._App.get(`atshop-service-models.model.${modelName}`) || Models[modelName];\n        if (!model) {\n            console.warn(`${modelName} is not an available model! Available models are: ${Object.keys(Models)}`);\n            throw new Error(`[ServiceModel] Could not locate model \"${modelName}\"!`)\n        }\n        \n        return model;\n    }\n}\n\ninterface ServiceModel extends ModelDocument {\n    entry: ModelDocument;\n}\n\nexport type AsyncKey = Id | Promise<Id>;\nexport default ServiceModel;","import { Paginated, Params } from '@feathersjs/feathers';\nimport ServiceModelStatic, { ModelDocumentType, ModelInstance } from '../interfaces/ServiceModelStatic';\nimport { NotFound } from '@feathersjs/errors';\n\nexport default class PaginatedServiceModel<Model extends ServiceModelStatic> {\n\n    /**\n     * Model to be paginated\n     */\n    private readonly model: Model;\n\n    /**\n     * Service query.\n     */\n    private readonly query: Params['query'];\n\n    /**\n     * Cached pagination result.\n     */\n    private _result: PaginatedModels<Model> = { total: -1, limit: -1,  skip: -1, data: [] };\n\n    /**\n     * Paginated model constructor.\n     *\n     * @param model\n     * @param query\n     */\n    constructor(model: Model, query: Params['query']) {\n        this.model = model;\n        this.query = query;\n    }\n\n    /**\n     * Format a raw paginated response into a model\"-ified\" response.\n     *\n     * @param result\n     */\n    private formatResult(result: PaginatedDocuments<Model>): PaginatedModels<Model> {\n        const data = (result?.data || result).map((document: any) => {\n            return new this.model(document) as ModelInstance<Model>;\n        });\n        \n        if (Array.isArray(result)) {\n            return {\n                total: result.length,\n                limit: 0,\n                skip: 0,\n                data,\n            }\n        }\n        \n        return {\n            ...result,\n            data,\n        }\n    }\n\n    /**\n     * Fetch the pagination result.\n     */\n    public async fetch(query: Params['query'] = {}) {\n        if (this._result.total !== -1) {\n            return this._result;\n        }\n\n        const result = await this.fetchRaw(query);\n        this._result = this.formatResult(result);\n        return this._result;\n    }\n\n    /**\n     * Fire a raw FeathersJS fetch request to the current model.\n     */\n    public async fetchRaw(query: Params['query'] = {}) {\n        return await this.model._find({\n            ...query,\n            ...this.query\n        });\n    }\n\n    /**\n     * Fetch a single entry from the paginated model.\n     *\n     * @param query\n     */\n    public async fetchOne(query: Params['query'] = {}) {\n        const result = await this.fetch(query);\n\n        if (result.data.length) {\n            return result.data[0];\n        }\n\n        throw new NotFound('[PaginatedServiceModel] fetchOne() could not locate any entries!', {\n            query,\n        })\n    }\n\n    /**\n     * Further dig through the pagination with additional search query.\n     *\n     * @param query\n     */\n    public find(query?: Params['query']): PaginatedServiceModel<Model> {\n        return new PaginatedServiceModel(this.model, { ...query, ...this.query, });\n    }\n\n    /**\n     * Patch all matched models.\n     */\n    public patch(data: any, params?: Params) {\n        return this.model._patch(null, data, {\n            ...params,\n            query: {\n                ...(params && params.query),\n                ...this.query,\n            }\n        });\n    }\n\n    /**\n     * Fetch result count.\n     */\n    public async count(): Promise<number> {\n        const result = await this.fetch({ $limit: 0 });\n        return result.total;\n    }\n\n    /**\n     * Create a new model entry using the current query (likely relationship data) as the document base.\n     *\n     * @param data\n     * @param query\n     */\n    public create(data: any, query?: Params['query']) {\n        return this.model.create({\n            ...this.query,\n            ...data,\n        }, query)\n    }\n\n}\n\ntype PaginatedDocuments<Model extends ServiceModelStatic> = Paginated<ModelDocumentType<Model>>\ntype PaginatedModels<Model extends ServiceModelStatic> = Paginated<ModelInstance<Model>>;","import { KeyValue } from './TS';\n\nexport default {\n\n    /**\n     * Create a full URL using the given protocol and host to the given path.\n     */\n    urlTo(protocol: 'http' | 'https', host: string, path: string, query: KeyValue<string | undefined | null> = {}) {\n        return `${protocol}://${host}/${path.replace(/^\\/+/, '')}${this.objectToQuerystring(query)}`;\n    },\n\n    /**\n     * Convert a normal JavaScript Key-Value object to querystring.\n     * @param object\n     */\n    objectToQuerystring(object: KeyValue<string | undefined | null>) {\n        const params: string[] = [];\n\n        Object.entries(object).forEach(([key, value]) => {\n            if (value === undefined) {\n                return;\n            }\n\n            if (value === null) {\n                return params.push(key);\n            }\n\n            params.push(`${key}=${encodeURIComponent(value)}`);\n        });\n\n        if (!params.length) {\n            return '';\n        }\n\n        return `?${params.join('&')}`;\n    },\n\n}","import ServiceModel from '../providers/ServiceModel';\nimport CategoryDocument from '../interfaces/documents/CategoryDocument';\nimport ShopModel from './ShopModel';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass CategoryModel extends ServiceModel {\n\n    /**\n     * Service path for Category Model.\n     */\n    public static readonly servicePath = '/shop/categories';\n\n    /**\n     * A category belongs to a shop.\n     */\n    public get shop() {\n        return this.belongsTo('ShopModel', this.shopId);\n    }\n\n    /**\n     * Whether or not the given path matches this category's slug.\n     */\n    public matchesPath(path: string) {\n        return path.replace(/^\\/+/, '') === this.slug;\n    }\n}\n\ninterface CategoryModel extends Omit<CategoryDocument, ModelTimestamps> {\n    entry: CategoryDocument;\n}\n\nexport default CategoryModel;","import ServiceModel from '../providers/ServiceModel';\nimport CustomerBlacklistDocument from '../interfaces/documents/CustomerBlacklistDocument';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass CustomerBlacklistModel extends ServiceModel {\n\n    /**\n     * Service path for Customer Blacklist Model.\n     */\n    public static readonly servicePath = '/shop/blacklist';\n\n}\n\ninterface CustomerBlacklistModel extends Omit<CustomerBlacklistDocument, ModelTimestamps> {\n    entry: CustomerBlacklistDocument;\n}\nexport default CustomerBlacklistModel;","import { omit, startCase } from 'lodash';\nimport GatewayDocument, {\n    GatewayBaseDocument,\n    type GatewayConfiguration,\n    type GatewayConfigVersion,\n    GatewaySpecification,\n    PaymentGateway,\n} from '../interfaces/documents/GatewayDocument';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\nimport ServiceModel from '../providers/ServiceModel';\n\nclass GatewayModel<\n    GatewayName extends PaymentGateway = PaymentGateway\n> extends ServiceModel {\n\n    /**\n     * Gateway Model service path.\n     */\n    public static readonly servicePath = '/shop/gateways';\n    \n    /**\n     * Gateway credentials.\n     */\n    public get credentials(): GatewayConfiguration<GatewayName, 'v2'> {\n        if (this.is({ version: 'v2' })) {\n            return this.entry.config;\n        }\n        \n        if (this.is({ version: 'v1', name: 'crypto-payments' })) {\n            const { userId, payoutPreference, ...addresses } = omitGatewayV1RootFields<GatewayDocument<'crypto-payments', 'v1'>>(this.entry);\n            const config: GatewayConfiguration<'crypto-payments', 'v2'> = {\n                addresses,\n                payoutPreference,\n                userId,\n            };\n            \n            return config as GatewayConfiguration<GatewayName, 'v2'>;\n        }\n        \n        return omitGatewayV1RootFields(this.entry) as GatewayConfiguration<GatewayName, 'v2'>;\n    }\n    \n    public is<\n        TVersion extends GatewayConfigVersion,\n        TName extends PaymentGateway = GatewayName\n    >({ version, name = this.name as any }: { version: TVersion, name?: TName }): this is { entry: GatewayDocument<TName, TVersion> } {\n        // @ts-expect-error The name entry prop is too wide for this to not emit an error.\n        if (this.entry.name !== name) {\n            return false;\n        }\n        if ('config' in this.entry) {\n            return version === 'v2';\n        }\n        if ('version' in this.entry) {\n            return this.entry.version === version;\n        }\n        if (version === 'v2') {\n            return false;\n        }\n        return true;\n    }\n    \n    /**\n     * A gateway belongs to a shop.\n     */\n    public get shop() {\n        return this.belongsTo('ShopModel', this.shopId);\n    }\n\n    /**\n     * Humanize a payment gateway name.\n     */\n    public static humanizeName(name?: PaymentGateway) {\n        if (!name) {\n            return 'N/A';\n        }\n        \n        if (name in GatewaySpecification) {\n            return GatewaySpecification[name].humanName;\n        }\n        \n        return startCase(name);\n    }\n}\n\nconst GATEWAY_V1_ROOT_FIELDS = [\n    '__v',\n    '_id',\n    'name',\n    'mode',\n    'shopId',\n    'enabled',\n    'multiplier',\n    'createdAt',\n    'updatedAt',\n    'deletedAt',\n] satisfies (keyof GatewayDocument | 'config')[];\ntype GatewayV1RootField = typeof GATEWAY_V1_ROOT_FIELDS[number];\n\nfunction omitGatewayV1RootFields<TDocument extends GatewayDocument>(document: TDocument): Omit<TDocument, GatewayV1RootField> {\n    return omit(document, GATEWAY_V1_ROOT_FIELDS);\n}\n\ninterface GatewayModel<GatewayName extends PaymentGateway> extends Omit<GatewayBaseDocument<GatewayName>, ModelTimestamps> {\n    entry: GatewayDocument<GatewayName>;\n}\n\nexport default GatewayModel;","import ModelDocument from './ModelDocument';\n\n/**\n * Names of all available gateways.\n */\nexport type PaymentGateway = keyof PaymentGatewayConfigurations;\nexport type PaymentGatewayMode =\n    | 'production'  // Default mode - accepts only real payments.\n    | 'sandbox';    // Use for testing your payment config - accepts fake payments.\n\n/**\n * Base model document for a gateway.\n */\nexport interface GatewayBaseDocument<TName extends PaymentGateway> extends ModelDocument {\n    /**\n     * Name of the payment gateway.\n     */\n    name: TName;\n\n    /**\n     * Whether or not this payment gateway is enabled.\n     */\n    enabled: boolean;\n\n    /**\n     * Pricing multiplier for orders paid through this gateway.\n     */\n    multiplier?: number;\n\n    /**\n     * ID of the shop these gateway settings belong to.\n     */\n    shopId: string;\n    \n    /**\n     * Set mode to 'sandbox' to test payments. Only some payment gateways support this. It is intended to test whether\n     * the gateway has been properly configured. Leaving the gateway in sandbox mode could potentially allow customers\n     * to send fake payments for orders. Use with caution.\n     */\n    mode?: PaymentGatewayMode;\n}\n\n/**\n * All available configuration properties for the provided gateway.\n */\nexport type GatewayConfiguration<\n    GatewayName extends PaymentGateway = PaymentGateway,\n    TVersion extends GatewayConfigVersion = GatewayConfigVersion,\n> = PaymentGatewayConfigurations<TVersion>[GatewayName];\n\n/**\n * Gateway document for the provided gateway.\n */\nexport type GatewayDocument<\n    TName extends PaymentGateway = PaymentGateway,\n    TVersion extends GatewayConfigVersion = GatewayConfigVersion,\n> = {\n    /**\n     * Legacy gateway configuration format\n     * All settings would be stored in a flat document.\n     */\n    v1: GatewayBaseDocument<TName> & GatewayConfiguration<TName, 'v1'>;\n    \n    /**\n     * New gateway configuration format\n     * Any gateway-specific settings are kept under a 'config' property\n     * Common settings like the price multiplier and shopId are stored at the root of the document.\n     */\n    v2: GatewayBaseDocument<TName> & {\n        version: 'v2',\n        config: GatewayConfiguration<TName, 'v2'>\n    }\n}[TVersion];\n\n\nexport type GatewayConfigVersion = 'v1' | 'v2';\nexport type CryptoCurrency =\n    | 'btc' | 'ltc' | 'eth' | 'usdc';\n\nexport const GatewaySpecification: {\n    [key in PaymentGateway]: {\n        /**\n         * Official name of the payment gateway. E.g. PayPal, Coinbase Commerce, G2A PAY\n         * Used when rendering the gateway to admins and users when checking out or configuring the gateway.\n         */\n        humanName: string;\n    }\n} = {\n    'coinbase-commerce': {\n        humanName: 'Coinbase Commerce'\n    },\n    'g2apay': {\n        humanName: 'G2A PAY'\n    },\n    'coinpayments': {\n        humanName: 'CoinPayments'\n    },\n    'paypal': {\n        humanName: 'PayPal'\n    },\n    'xsolla': {\n        humanName: 'Xsolla'\n    },\n    'lex-payments': {\n        humanName: 'Lex Payments'\n    },\n    'cash-payments': {\n        humanName: 'Cash Payments'\n    },\n    'stripe': {\n        humanName: 'Stripe'\n    },\n    'yoomoney': {\n        humanName: 'YooMoney'\n    },\n    'flutterwave': {\n        humanName: 'FlutterWave'\n    },\n    'authorize.net': {\n        humanName: 'Authorize.net'\n    },\n    'paydash': {\n        humanName: 'PayDash'\n    },\n    'crypto-payments': {\n        humanName: 'Crypto Payments'\n    },\n    'non-implemented-gateway': {\n        humanName: 'Non-implemented payment gateway',\n    },\n    'test': {\n        humanName: 'Test gateway'\n    }\n}\n\n/**\n * All available payment gateways and their respective configurations.\n */\nexport interface PaymentGatewayConfigurations<TVersion extends GatewayConfigVersion = GatewayConfigVersion> {\n    xsolla: {\n        merchantId: number;\n        projectId: number;\n        apiKey: string;\n    },\n    paypal: {\n        email: string;\n    }\n    coinpayments: {\n        merchantId: string;\n        secret: string;\n    }\n    'coinbase-commerce': {\n        apiKey: string;\n        sharedSecret: string;\n    }\n    'lex-payments': {\n        apiKey: string;\n    }\n    'cash-payments': {\n        secret: string;\n        cashCode: string;\n    }\n    stripe: {\n        publishableKey: string;\n        secretKey: string;\n        paymentMethodTypes?: Array<'alipay' | 'bacs_debit' | 'bancontact' | 'card' | 'eps' | 'fpx' | 'giropay' | 'grabpay' | 'ideal' | 'p24' | 'sepa_debit' | 'sofort'>,\n    }\n    yoomoney: {\n        secret: string;\n        walletId: string;\n    }\n    flutterwave: {\n        secret: string;\n        secretHash: string;\n    }\n    'authorize.net': {\n        apiLoginId: string;\n        transactionKey: string;\n        signatureKey: string;\n    }\n    paydash: {\n        apiKey: string;\n    },\n    g2apay: {\n        merchantEmail: string;\n        apiHash: string;\n        apiSecret: string;\n    }\n    'crypto-payments': CryptoPaymentsConfig<TVersion>;\n    'non-implemented-gateway': unknown;\n    test: unknown;\n}\n\ntype CryptoPaymentsConfigBase = {\n    /**\n     * Merchant account user ID that is automatically\n     * created for you when configuring Crypto Payments\n     */\n    merchantId?: string;\n    \n    /**\n     * Merchant provided override for the merchant account ID.\n     * This lets you ensure payments are handled through a Crypto Payments\n     * account that you create/manage yourself.\n     */\n    userId?: string;\n    \n    /**\n     * Whether funds should be paid out immediately, or held in a custody\n     * account until a manual withdrawal is requested.\n     */\n    payoutPreference?: string;\n}\n\ntype CryptoPaymentsConfig<\n    TVersion extends GatewayConfigVersion = GatewayConfigVersion\n> = {\n    v1: CryptoPaymentsConfigBase & Record<CryptoCurrency, string>;\n    v2: CryptoPaymentsConfigBase & {\n        addresses: Record<CryptoCurrency, string>;\n    }\n}[TVersion];\n\nexport default GatewayDocument;","import ServiceModel from '../providers/ServiceModel';\nimport IpnDocument from '../interfaces/documents/IpnDocument';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\nimport GatewayModel from './GatewayModel';\n\nclass IpnModel extends ServiceModel {\n\n    /**\n     * Ipn Model service path.\n     */\n    public static readonly servicePath = '/shop/ipn';\n\n    /**\n     * Human friendly name for the payment gateway associated with this IPN.\n     */\n    public get humanName() {\n        return GatewayModel.humanizeName(this.gateway);\n    }\n\n}\n\ninterface IpnModel extends Omit<IpnDocument, ModelTimestamps> {\n    entry: IpnDocument;\n}\n\nexport default IpnModel;","import ServiceModel from '../providers/ServiceModel';\nimport OrderEventDocument, { OrderEventLabel, OrderEventName } from '../interfaces/documents/OrderEventDocument';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass OrderEventModel extends ServiceModel {\n\n    /**\n     * Order event service path.\n     */\n    public static readonly servicePath = '/shop/order/events';\n\n    /**\n     * Notifiable events.\n     */\n    protected readonly notifiable: OrderEventName[] = [\n        'order_on_hold',\n        'order_fulfilled',\n        'order_manually_approved',\n        'order_status_reversed',\n        'order_status_discarded'\n    ];\n\n    /**\n     * Events that can trigger a notification to the customer.\n     */\n    protected readonly customerNotifiable: OrderEventName[] = [\n        'order_fulfilled',\n    ];\n\n    /**\n     * Event base metadata.\n     */\n    public readonly baseData: { [key: string]: OrderEventLabel } = {\n        order_fulfilled: {\n            title: 'Order Paid',\n            level: 'success',\n        },\n        order_on_hold: {\n            title: 'Order on Hold',\n            level: 'warning',\n        },\n        order_manually_approved: {\n            title: 'Order Approved',\n            level: 'success',\n        },\n        order_status_discarded: {\n            title: 'Order Discarded',\n            level: 'warning',\n        },\n        order_status_reversed: {\n            title: 'Order Reversed',\n            level: 'danger',\n        },\n    };\n\n    /**\n     * An order event belongs to an order.\n     */\n    public get order() {\n        return this.belongsTo('OrderModel', this.orderId);\n    }\n\n    /**\n     * An order event belongs to a shop.\n     */\n    public get shop() {\n        const shopId = this.order\n            .then((order) => order.shop)\n            .then((shop) => shop._id);\n        return this.belongsTo('ShopModel', shopId);\n    }\n\n    /**\n     * Whether or not this event is notifiable.\n     */\n    protected get isNotifiable() {\n        return this.notifiable.indexOf(this.name) !== -1\n    }\n\n    /**\n     * Whether or not the customer can be notified of the current event.\n     */\n    protected get isCustomerNotifiable(): boolean {\n        return this.customerNotifiable.indexOf(this.name) !== -1;\n    }\n\n}\n\ninterface OrderEventModel extends Omit<OrderEventDocument, ModelTimestamps> {\n    entry: OrderEventDocument;\n}\n\nexport default OrderEventModel;","import ServiceModel from '../providers/ServiceModel';\nimport OrderFeedbackDocument from '../interfaces/documents/OrderFeedbackDocument';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass OrderFeedbackModel extends ServiceModel {\n\n    /**\n     * Order Feedback Model service path.\n     */\n    public static readonly servicePath = '/shop/order/feedback';\n\n    /**\n     * Order feedback belongs to an order.\n     */\n    public get order() {\n        return this.belongsTo('OrderModel', this.orderId);\n    }\n\n    /**\n     * Order feedback belongs to a product.\n     */\n    public get product() {\n        return this.belongsTo('ProductModel', this.productId);\n    }\n\n    /**\n     * Fetch the rating for one or more products.\n     */\n    public static async rating(productIds: string[]) {\n        const feedback = await this.find({\n            productId: {\n                $in: productIds\n            },\n            $limit: -1,\n        }).fetch();\n\n        const ratings: number[] = feedback.data.map((feedback) => feedback.f ? 1 : 0);\n        let sum = 0;\n\n        if (ratings.length) {\n            sum = ratings.reduce((previous, current) => previous + current);\n        }\n\n        return {\n            count: ratings.length,\n            score: Math.round((sum / ratings.length) * 100) || -1,\n        }\n    }\n\n}\n\ninterface OrderFeedbackModel extends Omit<OrderFeedbackDocument, ModelTimestamps> {\n    entry: OrderFeedbackDocument;\n}\n\nexport default OrderFeedbackModel;","import { NotFound, Unprocessable } from '@feathersjs/errors';\nimport Dinero from 'dinero.js';\nimport Gravatar from 'gravatar';\nimport { GatewayModel } from '../index';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\nimport OrderDocument from '../interfaces/documents/OrderDocument';\nimport OrderURL from '../providers/OrderURL';\nimport ServiceModel from '../providers/ServiceModel';\nimport { CurrencyCode } from '../utility/AvailableCurrencies';\nimport { Omit } from '../utility/TS';\n\nclass OrderModel extends ServiceModel {\n\n    /**\n     * Order Model service path.\n     */\n    public static readonly servicePath = '/shop/orders';\n\n    /**\n     * Whether or not the given secret allows the user to view stock content/data.\n     *\n     * @param secret\n     */\n    public canViewStockData(secret?: string) {\n        if (!this.entry.secret) {\n            return true;\n        }\n\n        return secret === this.entry.secret;\n    }\n\n    /**\n     * An order has many ordered items.\n     */\n    public get items() {\n        return this.hasMany('ProductStockModel', 'orderId');\n    }\n\n    /**\n     * An order belongs to a shop.\n     */\n    public get shop() {\n        return this.belongsTo('ShopModel', this.shopId);\n    }\n\n    /**\n     * An order belongs to a product.\n     */\n    public get product() {\n        return this.belongsTo('ProductModel', this.productId);\n    }\n\n    /**\n     * An order can have feedback.\n     */\n    public get feedback() {\n        return this.hasOne('OrderFeedbackModel', 'orderId')\n    }\n\n    /**\n     * An order belongs to an IPN.\n     */\n    public get ipn() {\n        if (!this.ipnId) {\n            throw new Unprocessable(`Order #${this._id} does not yet have an attached IPN.`);\n        }\n        return this.belongsTo('IpnModel', this.ipnId);\n    }\n\n    /**\n     * Whether or not this order was created in ATShop v1.\n     */\n    public get isLegacy() {\n        return typeof this.entry.__v === 'undefined';\n    }\n\n    /**\n     * Original order value without any discounts.\n     */\n    public async originalValue() {\n        const product = await this.product;\n\n        return Dinero({\n            ...product.value.toObject(),\n            currency: await this.currency,\n        }).multiply(this.quantity);\n    }\n\n    /**\n     * Order value as a Dinero object. This includes any applicable discounts.\n     */\n    public async value(gateway?: GatewayModel<any> | Promise<GatewayModel<any>>) {\n        const paymentGateway = await (gateway || this.paymentGateway());\n        let value = await this.originalValue();\n\n        if (this.entry.toPay) {\n            value = Dinero({\n                amount: this.entry.toPay,\n                currency: await this.currency,\n            });\n        }\n\n        if (paymentGateway && paymentGateway.multiplier) {\n            value = value.multiply(paymentGateway.multiplier);\n        }\n\n        return value;\n    }\n\n    /**\n     * Amount of funds transmitted as payment for this order as a Dinero object.\n     */\n    public async paidAmount() {\n        return Dinero({\n            amount: this.entry.paidAmount || 0,\n            currency: await this.currency,\n        })\n    }\n\n    /**\n     * Currency of order.\n     */\n    public get currency(): Promise<CurrencyCode> {\n        return this.shop.then((shop) => {\n            return shop.currency || 'USD';\n        });\n    }\n\n    /**\n     * Customer identifier.\n     */\n    public get customerId() {\n        // For the time being, we'll just use the order ID.\n        return this._id;\n    }\n    /**\n     * Order product name.\n     */\n    public get name() {\n        return this.product.then((product) => {\n            if (product.useOrderIdAsItemName) {\n                return `Order: ${this._id}`\n            }\n\n            return product.name;\n        });\n    }\n\n    /**\n     * Order description.\n     */\n    public get description() {\n        return `Payment for order #${this._id}`;\n    }\n\n    /**\n     * Product ID passed to payment gateway.\n     */\n    public get gatewayProductId() {\n        return this.product.then((product) => {\n            if (product.useOrderIdAsItemName) {\n                return undefined;\n            }\n\n            return product._id;\n        });\n    }\n\n    /**\n     * Full order value, in human readable decimal.\n     */\n    public async humanValue() {\n        return (await this.value()).toFormat();\n    }\n\n    /**\n     * Fetch the payment method used to complete this order.\n     */\n    public async paymentMethod() {\n        const gateway = this.entry.paymentMethod;\n\n        if (!gateway && this.ipnId) {\n            return (await this.ipn).humanName;\n        }\n\n        return GatewayModel.humanizeName(gateway);\n    }\n\n    /**\n     * Whether or not the order has been fulfilled.\n     */\n    public get isFulfilled(): boolean {\n        return this.entry.fulfilled || false;\n    }\n\n    /**\n     * Whether or not the current order has feedback attached.\n     */\n    public get hasFeedback(): Promise<boolean> {\n        return this.feedback.then(() => true).catch((exception) => {\n            if (exception instanceof NotFound !== true) {\n                throw exception;\n            }\n\n            return false;\n        });\n    }\n\n    /**\n     * Gravatar image URL for the customer.\n     */\n    public get customerAvatar() {\n        return Gravatar.url(this.email, {\n            size: '300',\n            protocol: 'https',\n            default: 'identicon',\n            rating: 'x',\n        });\n    }\n\n    /**\n     * Whether or not the given secret is valid for the current order.\n     */\n    public isValidSecret(secret: string) {\n        return this.secret === secret;\n    }\n\n    /**\n     * Amount of stock currently assigned to this order.\n     */\n    public stockAssignedCount(): Promise<number> {\n        return this.items.count();\n    }\n\n    /**\n     * Amount of stock that needs to be assigned to this order on fulfill().\n     */\n    public async missingStockCount() {\n        return this.quantity - await this.stockAssignedCount();\n    }\n\n    /**\n     * Whether or not the ordered product has enough stock to be fulfilled.\n     */\n    public async hasEnoughStock() {\n        const missingStock = this.missingStockCount();\n        const product = await this.product;\n        return (await missingStock) <= (await product.stockForSale.count())\n    }\n\n    /**\n     * Order-specific links for different stages in the checkout process.\n     * These links are intended to be permanent and safe, even in instances where a merchant changes their shop URL.\n     */\n    public get url() {\n        return new OrderURL(this);\n    }\n\n    /**\n     * Link to view this order as an administrator.\n     */\n    public async adminLink() {\n        const shop = await this.shop;\n        return shop.adminUrl('/orders/' + this._id);\n    }\n\n    /**\n     * An order may have a coupon code.\n     */\n    public coupon() {\n        if (!this.couponId) {\n            return null;\n        }\n        return this.belongsTo('CouponModel', this.couponId);\n    }\n\n    /**\n     * The payment gateway used to pay for this order.\n     */\n    public async paymentGateway() {\n        const gatewayName = await this.entry.paymentMethod;\n\n        if (!gatewayName) {\n            return null;\n        }\n\n        return (await this.shop).gateways.fetchOne({ name: gatewayName }).catch(() => null);\n    }\n\n}\n\ninterface OrderModel extends Omit<OrderDocument, 'currency' | 'paymentMethod' | 'paidAmount' | ModelTimestamps> {\n    entry: OrderDocument;\n}\n\nexport default OrderModel;","import OrderModel from '../models/OrderModel';\nimport { KeyValue } from '../utility/TS';\nimport { HostConfig } from '../utility/Service';\nimport Helpers from '../utility/Helpers';\nimport { PaymentRedirectOverrides } from '../interfaces/documents/OrderDocument';\n\nexport type OrderLinkType =\n    'waiting' | // Gateway payment process completed - waiting for payment to be confirmed.\n    'cancelled' | // Customer cancelled the gateway's checkout process. (prompts customer to select another payment method)\n    'completed'; // The payment process was completed and ATShop has verified the payment. Skips the 'waiting' state. Try to avoid using this for anything other than confirmation emails.\n\ninterface LinkOptions {\n    type: OrderLinkType;\n    secret?: string;\n}\n\ninterface PermalinkServiceParams {\n    orderId: string;\n    type: OrderLinkType;\n    secret?: string;\n}\n\nexport default class OrderURL {\n\n    /**\n     * Current Order\n     * @protected\n     */\n    protected readonly order: OrderModel;\n\n    /**\n     * Permalink service configuration\n     * @protected\n     */\n    protected readonly permalinkConfig: HostConfig\n\n    /**\n     * Order Link constructor.\n     * @param order\n     */\n    public constructor(order: OrderModel) {\n        this.order = order;\n        this.permalinkConfig = order._App.get('permalinkService');\n    }\n\n    /**\n     * URLs provided by the client that started the checkout process to override the order's return URIs.\n     * Read more {@link PaymentRedirectOverrides}\n     */\n    protected get redirectOverrides(): PaymentRedirectOverrides {\n        return {\n            completed: this.order.paymentRedirects?.completed || null,\n            cancelled: this.order.paymentRedirects?.cancelled || null,\n            waiting: this.order.paymentRedirects?.waiting || null,\n        }\n    }\n\n    /**\n     * Retrieve a redirect override for the provided link type.\n     * @param type\n     * @protected\n     */\n    protected getRedirectOverride(type: OrderLinkType): string | null  {\n        return this.redirectOverrides[type];\n    }\n\n    /**\n     * Create a safe permanent link for the current order.\n     * This works around issues that may occur if a merchant changes their domain while a customer is checking out.\n     * @param type\n     * @param secret\n     * @protected\n     */\n    protected createLink({ type, secret }: LinkOptions) {\n        const override = this.getRedirectOverride(type);\n        const query: PermalinkServiceParams = {\n            orderId: this.order._id,\n            type,\n            secret,\n        };\n\n        if (override) {\n            return override;\n        }\n\n        return Helpers.urlTo(\n            this.permalinkConfig.protocol,\n            this.permalinkConfig.host,\n            '/shop/order/return',\n            <KeyValue>query,\n        )\n    }\n\n    /**\n     * Redirect the customer to this URL after they have completed the checkout process with any gateway.\n     */\n    public get checkoutCompleted() {\n        return this.createLink({\n            type: 'waiting',\n        });\n    }\n\n    /**\n     * Redirect the customer to this URL after they have cancelled the checkout process with any gateway.\n     */\n    public get checkoutCancelled() {\n        return this.createLink({\n            type: 'cancelled',\n        });\n    }\n\n    /**\n     * Link emailed to the customer after their order has been completed and fulfilled.\n     */\n    public get confirmationEmail() {\n        return this.createLink({\n            type: 'completed',\n            secret: this.order.secret,\n        })\n    }\n\n\n}","import Dinero from 'dinero.js';\nimport { escapeRegExp, get } from 'lodash';\nimport ProductDocument from '../interfaces/documents/ProductDocument';\nimport ServiceModel from '../providers/ServiceModel';\nimport { Omit } from '../utility/TS';\nimport FeedbackSummary from '../interfaces/FeedbackSummary';\nimport { ProductInterface } from '../interfaces/ProductInterface';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\nimport { PaymentGateway } from '../interfaces/documents/GatewayDocument';\n\nclass ProductModel extends ServiceModel implements FeedbackSummary, ProductInterface {\n\n    /**\n     * Service path for Product Model.\n     */\n    public static readonly servicePath = '/shop/products';\n\n    /**\n     * Fetch stock count for the current product.\n     */\n    public async getStock(): Promise<number> {\n        return (await this.stock().fetch({ $limit: 0 })).total;\n    }\n\n    /**\n     * A product has many stock entries.\n     */\n    public stock() {\n        return this.hasMany('ProductStockModel', 'productId', this.entry._id);\n    }\n\n    /**\n     * Check if the current product has enough stock to create a sale of the given quantity.\n     */\n    public async hasStockForSale(count: number): Promise<boolean> {\n        return (await this.stockForSale.count()) >= count;\n    }\n\n    /**\n     * Dinero instance of product value.\n     */\n    public get value() {\n        return Dinero({ amount: this.entry.value });\n    }\n\n    /**\n     * Minimum order quantity.\n     */\n    public get minQuantity() {\n        return this.entry.minQuantity;\n    }\n\n    /**\n     * A product belongs to a shop.\n     */\n    public get shop() {\n        return this.belongsTo('ShopModel', this.entry.shopId);\n    }\n\n    /**\n     * A product can belong to a category.\n     */\n    public get category() {\n        return this.belongsTo('CategoryModel', this.entry.category);\n    }\n\n    /**\n     * Stock for sale query object.\n     */\n    protected get stockForSaleQuery() {\n        return { productId: this._id, forSale: true }\n    }\n\n    /**\n     * Product stock that is for sale.\n     */\n    public get stockForSale() {\n        return this.stock().find(this.stockForSaleQuery);\n    }\n\n    /**\n     * Product rating in stars.\n     * (Float between 0 - 5).\n     */\n    public get stars() {\n        const summary = this.feedbackSummary;\n\n        if (!summary.count) {\n            return 'N/A';\n        }\n\n        return summary.stars;\n    }\n\n    /**\n     * Summary of feedback for this product.\n     */\n    public get feedbackSummary() {\n        return {\n            count: get(this.entry, 'feedback.count', 0),\n            percentage: get(this.entry, 'feedback.score', 0),\n            stars: get(this.entry, 'feedback.score', 0) / 20,\n        }\n    }\n\n    /**\n     * Whether or not the given payment gateway is acceptable for paying for this product.\n     */\n    public isPermittedGateway(gateway: PaymentGateway): boolean {\n        if (!this.paymentMethods) {\n            return true;\n        }\n\n        if (!this.paymentMethods.length) {\n            return true;\n        }\n\n        return this.paymentMethods.indexOf(gateway) !== -1;\n    }\n\n    /**\n     * Build a search query for a product using the given string.\n     */\n    static buildSearch(search: string) {\n        const fuzzy = { $regex: new RegExp(`${escapeRegExp(search)}`, 'i') };\n        const anchored = { $regex: new RegExp(`^${escapeRegExp(search)}`, 'i') };\n\n        return {\n            $or: [\n                { _id: anchored, },\n                { name: fuzzy },\n                { description: fuzzy },\n                { productIds: anchored, },\n            ]\n        }\n    }\n\n}\n\ninterface ProductModel extends Omit<ProductDocument, 'value' | 'category' | ModelTimestamps> {\n    entry: ProductDocument;\n}\n\nexport default ProductModel;","import ServiceModel from '../providers/ServiceModel';\nimport ProductStockDocument from '../interfaces/documents/ProductStockDocument';\nimport { Omit } from '../utility/TS';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass ProductStockModel extends ServiceModel {\n\n    /**\n     * Service path for Product Stock Model\n     */\n    public static readonly servicePath = '/shop/product/stock'\n\n}\n\ninterface ProductStockModel extends Omit<ProductStockDocument, 'entry' | ModelTimestamps> {\n    entry: ProductStockDocument;\n}\n\nexport default ProductStockModel;","import ServiceModel from '../providers/ServiceModel';\nimport { UserDocument } from '../interfaces/documents/UserDocument';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass UserModel extends ServiceModel {\n\n    /**\n     * User Model service path.\n     */\n    public static readonly servicePath = '/users';\n\n}\n\ninterface UserModel extends Omit<UserDocument, ModelTimestamps> {\n    entry: UserDocument;\n}\n\nexport default UserModel;","import Dinero from 'dinero.js';\nimport { get } from 'lodash';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\nimport ProductDocument from '../interfaces/documents/ProductDocument';\nimport ProductGroupDocument from '../interfaces/documents/ProductGroupDocument';\nimport FeedbackSummary from '../interfaces/FeedbackSummary';\nimport { ProductInterface } from '../interfaces/ProductInterface';\nimport ServiceModel from '../providers/ServiceModel';\nimport { SupplementalRelationalData } from '../utility/SupplementalRelationalData';\nimport { Omit } from '../utility/TS';\n\nclass ProductGroupModel extends ServiceModel implements FeedbackSummary, ProductInterface {\n\n    /**\n     * Product groups service path.\n     */\n    public static readonly servicePath = '/shop/product/groups';\n\n    /**\n     * A product group belongs to many products.\n     */\n    public get products() {\n        return this.belongsToMany('ProductModel', this.productIds);\n    }\n\n    /**\n     * A product group belongs to a category.\n     */\n    public get category() {\n        return this.belongsTo('CategoryModel', this.entry.category);\n    }\n\n    /**\n     * A product group belongs to a shop.\n     */\n    public get shop() {\n        return this.belongsTo('ShopModel', this.entry.shopId);\n    }\n\n    /**\n     * Whether this product group has enough stock to create a sale.\n     */\n    public hasStockForSale(count: number): Promise<boolean> {\n        return new Promise((resolve, reject) => {\n            this.products\n                .then((products) => products.fetch({ query: { $limit: -1 } }))\n                .then(async ({ data: products }) => {\n                    for (const product of products) {\n                        if (await product.hasStockForSale(count)) {\n                            return resolve(true);\n                        }\n                    }\n        \n                    return resolve(false);\n                })\n                .catch(reject)\n        })\n    }\n\n    /**\n     * Summary of feedback for this product group.\n     */\n    public get feedbackSummary() {\n        return {\n            count: get(this.entry, 'feedback.count', 0),\n            percentage: get(this.entry, 'feedback.score', 0),\n            stars: get(this.entry, 'feedback.score', 0) / 20,\n        }\n    }\n\n    /**\n     * Product group value.\n     */\n    public get value() {\n        const products = [...this.entry._belongsToMany['/shop/products']]\n            .sort((productA, productB) => productA.value - productB.value);\n\n        if (!products.length || !products[0]) {\n            return Dinero({ amount: 0 });\n        }\n\n        return Dinero({ amount: products[0].value });\n    }\n\n    /**\n     * Total stock count for this product group.\n     */\n    public get stockCount() {\n        return this.entry._belongsToMany['/shop/products']\n            .reduce((sum, product) => sum + (product.stockCount || 0), 0);\n    }\n\n}\n\ninterface ProductGroupModel extends Omit<ProductGroupDocument, 'category' | ModelTimestamps> {\n    entry: ProductGroupDocument & SupplementalRelationalData<{\n        belongsToMany: {\n            '/shop/products': ProductDocument,\n        }\n    }>;\n}\n\nexport default ProductGroupModel;","import ServiceModel from '../providers/ServiceModel';\nimport OrderFeedbackDocument from '../interfaces/documents/OrderFeedbackDocument';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\n\nclass OrderReplacementModel extends ServiceModel {\n\n    /**\n     * Service path for order replacements.\n     */\n    public static readonly servicePath = '/shop/order/replacements';\n\n    /**\n     * A replacement belongs to an order.\n     */\n    public get order() {\n        return this.belongsTo('OrderModel', this.orderId);\n    }\n\n}\n\ninterface OrderReplacementModel extends Omit<OrderFeedbackDocument, ModelTimestamps> {\n    entry: OrderFeedbackDocument;\n}\n\nexport default OrderReplacementModel;","import ServiceModel from '../providers/ServiceModel';\nimport { ModelTimestamps } from '../interfaces/documents/ModelDocument';\nimport CouponDocument from '../interfaces/documents/CouponDocument';\n\nclass CouponModel extends ServiceModel {\n\n    /**\n     * Service path for the shop coupons service.\n     */\n    public static readonly servicePath = '/shop/coupons';\n\n    /**\n     * Orders that are using this coupon code.\n     */\n    public orders() {\n        return this.hasMany('OrderModel', 'couponId');\n    }\n\n    /**\n     * A coupon belongs to a shop.\n     */\n    public shop() {\n        return this.belongsTo('ShopModel', this.shopId);\n    }\n\n    /**\n     * Update the number of uses this coupon has received.\n     */\n    public async updateUsage() {\n        await this.patch({\n            uses: await this.orders().find({ paid: true }).count()\n        })\n    }\n\n}\n\ninterface CouponModel extends Omit<CouponDocument, ModelTimestamps> {\n    entry: CouponDocument;\n}\n\nexport default CouponModel;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAA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;AAAA,MACb,MAAM,MAAM,KAAK,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,MAAM;AAAA,IACzD,CAAC;AAAA,EACL;AAEJ;AAAA;AAAA;AAAA;AA9BM,YAKqB,cAAc;AA+BzC,IAAO,sBAAQ;","names":["useColors","errors","NotFound","Unprocessable","FeathersError","import_errors","document","config","document","feedback","import_errors","Dinero","get","Dinero","get","Dinero","get","get","Dinero"]}