wallaby-cash 1.2.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -39
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/auth/index.d.ts +4 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/merchants/index.d.ts +59 -0
- package/dist/routes/merchants.d.ts +50 -0
- package/dist/tests/data/index.d.ts +1 -0
- package/dist/tests/data/merchants.d.ts +8 -0
- package/dist/types/common.d.ts +2 -4
- package/dist/types/merchants.d.ts +4 -0
- package/package.json +2 -2
- package/src/lib/auth/index.ts +4 -4
- package/src/lib/index.ts +1 -0
- package/src/lib/merchants/index.ts +166 -0
- package/src/routes/merchants.ts +39 -0
- package/src/tests/data/index.ts +1 -0
- package/src/tests/data/merchants.ts +8 -0
- package/src/tests/merchants.spec.ts +72 -0
- package/src/tests/system.spec.ts +0 -2
- package/src/types/common.ts +2 -4
- package/src/types/merchants.ts +5 -0
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../node_modules/ms/index.js","../node_modules/debug/src/common.js","../node_modules/debug/src/browser.js","../node_modules/uuid/dist/esm-browser/rng.js","../node_modules/uuid/dist/esm-browser/stringify.js","../node_modules/uuid/dist/esm-browser/native.js","../node_modules/uuid/dist/esm-browser/v4.js"],"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","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;"],"names":["s","m","h","d","ms","val","options","type","length","str","String","match","exec","n","parseFloat","toLowerCase","parse","isFinite","long","msAbs","Math","abs","plural","fmtLong","round","fmtShort","Error","JSON","stringify","name","isPlural","exports","formatArgs","args","this","useColors","namespace","module","humanize","diff","c","color","splice","index","lastC","replace","save","namespaces","storage","setItem","removeItem","error","load","r","getItem","process","env","DEBUG","window","__nwjs","navigator","userAgent","document","documentElement","style","WebkitAppearance","console","firebug","exception","table","parseInt","RegExp","$1","localStorage","localstorage","destroy","warned","warn","colors","log","debug","createDebug","prevTime","namespacesCache","enabledCache","enableOverride","enabled","self","curr","Number","Date","prev","coerce","unshift","format","formatter","formatters","call","apply","selectColor","extend","Object","defineProperty","enumerable","configurable","get","set","v","init","delimiter","newDebug","toNamespace","regexp","toString","substring","default","stack","message","disable","names","map","skips","join","enable","i","split","len","push","slice","test","require$$0","keys","forEach","key","hash","charCodeAt","j","getRandomValues","rnds8","Uint8Array","rng","crypto","bind","byteToHex","native","randomUUID","v4","buf","offset","rnds","random","arr","unsafeStringify"],"mappings":"i+DAIA,IAAIA,EAAI,IACJC,EAAQ,GAAJD,EACJE,EAAQ,GAAJD,EACJE,EAAQ,GAAJD,EAkBRE,EAAiB,SAASC,EAAKC,GAC7BA,EAAUA,GAAW,GACrB,IAAIC,SAAcF,EAClB,GAAa,WAATE,GAAqBF,EAAIG,OAAS,EACpC,OAkBJ,SAAeC,GAEb,MADAA,EAAMC,OAAOD,IACLD,OAAS,KAAjB,CAGA,IAAIG,EAAQ,mIAAmIC,KAC7IH,GAEF,GAAKE,EAAL,CAGA,IAAIE,EAAIC,WAAWH,EAAM,IAEzB,QADYA,EAAM,IAAM,MAAMI,eAE5B,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAzDEZ,SAyDKU,EACT,IAAK,QACL,IAAK,OACL,IAAK,IACH,OA9DEV,OA8DKU,EACT,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOA,EAAIV,EACb,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAOU,EAAIX,EACb,IAAK,UACL,IAAK,SACL,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOW,EAAIZ,EACb,IAAK,UACL,IAAK,SACL,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOY,EAAIb,EACb,IAAK,eACL,I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AIH,EAAS,IAAML,EAAUQ,EAAIH,EAAS,IAAM,IAAML,EAAUQ,EAAIH,EAAS,IAAML,EAAUQ,EAAIH,EAAS,IAAM,IAAML,EAAUQ,EAAIH,EAAS,IAAML,EAAUQ,EAAIH,EAAS,IAAM,IAAML,EAAUQ,EAAIH,EAAS,KAAOL,EAAUQ,EAAIH,EAAS,KAAOL,EAAUQ,EAAIH,EAAS,KAAOL,EAAUQ,EAAIH,EAAS,KAAOL,EAAUQ,EAAIH,EAAS,KAAOL,EAAUQ,EAAIH,EAAS,MAAMrI,aACvf,CESSyI,CAAgBH,EACzB"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../node_modules/ms/index.js","../node_modules/debug/src/common.js","../node_modules/debug/src/browser.js","../node_modules/uuid/dist/esm-browser/rng.js","../node_modules/uuid/dist/esm-browser/stringify.js","../node_modules/uuid/dist/esm-browser/native.js","../node_modules/uuid/dist/esm-browser/v4.js"],"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","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;"],"names":["s","m","h","d","ms","val","options","type","length","str","String","match","exec","n","parseFloat","toLowerCase","parse","isFinite","long","msAbs","Math","abs","plural","fmtLong","round","fmtShort","Error","JSON","stringify","name","isPlural","exports","formatArgs","args","this","useColors","namespace","module","humanize","diff","c","color","splice","index","lastC","replace","save","namespaces","storage","setItem","removeItem","error","load","r","getItem","process","env","DEBUG","window","__nwjs","navigator","userAgent","document","documentElement","style","WebkitAppearance","console","firebug","exception","table","parseInt","RegExp","$1","localStorage","localstorage","destroy","warned","warn","colors","log","debug","createDebug","prevTime","namespacesCache","enabledCache","enableOverride","enabled","self","curr","Number","Date","prev","coerce","unshift","format","formatter","formatters","call","apply","selectColor","extend","Object","defineProperty","enumerable","configurable","get","set","v","init","delimiter","newDebug","toNamespace","regexp","toString","substring","default","stack","message","disable","names","map","skips","join","enable","i","split","len","push","slice","test","require$$0","keys","forEach","key","hash","charCodeAt","j","getRandomValues","rnds8","Uint8Array","rng","crypto","bind","byteToHex","native","randomUUID","v4","buf","offset","rnds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ts
CHANGED
|
@@ -44,9 +44,11 @@ export declare class Auth extends Base {
|
|
|
44
44
|
* @param {string} userId
|
|
45
45
|
* @returns {User} User object
|
|
46
46
|
*/
|
|
47
|
-
updateClientAuthPubKey({ hashKey,
|
|
47
|
+
updateClientAuthPubKey({ hashKey, }: Pick<ClientAuthPubKeyRequest, 'hashKey' | 'userId'>): Promise<ClientAuthPubKeyResponse | undefined>;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
*
|
|
50
|
+
* @deprecated
|
|
51
|
+
* @description This function is used to get back Wallaby's Auth Public Key. Public key is stored in localStorage so this function is getting deprecated.
|
|
50
52
|
* @param {string} clientAuthPubKey
|
|
51
53
|
* @returns {WallabyAuthPubKeyResponse} Returns user's Wallaby WallabyAuthPubKey
|
|
52
54
|
*/
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Base } from '../../base';
|
|
2
|
+
import { WallabyConfig } from '../../types';
|
|
3
|
+
import { ListMerchantsResponse, Merchant, MerchantStatus } from '../../types/merchants';
|
|
4
|
+
export declare class Merchants extends Base {
|
|
5
|
+
constructor(config: WallabyConfig);
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
* @description List of all merchants in the system
|
|
10
|
+
* @returns { ListMerchantsResponse } Array of all merchants
|
|
11
|
+
*/
|
|
12
|
+
list(): Promise<ListMerchantsResponse>;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* @description Allows to create a new merchant
|
|
17
|
+
* @returns { Merchant } Merchant data
|
|
18
|
+
*/
|
|
19
|
+
create({ name }: {
|
|
20
|
+
name: string;
|
|
21
|
+
}): Promise<Merchant>;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
* @description Allows to update merchant data
|
|
26
|
+
* @returns { Merchant } Merchant data
|
|
27
|
+
*/
|
|
28
|
+
update({ merchantId, name, status }: {
|
|
29
|
+
merchantId: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
status?: MerchantStatus;
|
|
32
|
+
}): Promise<Merchant>;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
* @param merchantId Merchant ID
|
|
37
|
+
* @returns { Merchant } Merchant data
|
|
38
|
+
*/
|
|
39
|
+
getMerchantData({ merchantId }: {
|
|
40
|
+
merchantId: string;
|
|
41
|
+
}): Promise<Merchant>;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
* @param merchantId Merchant ID
|
|
46
|
+
* @returns { Merchant } Merchant data
|
|
47
|
+
*/
|
|
48
|
+
getAssets({ merchantId }: {
|
|
49
|
+
merchantId: string;
|
|
50
|
+
}): Promise<any>;
|
|
51
|
+
addAsset({ merchantId, configId }: {
|
|
52
|
+
merchantId: string;
|
|
53
|
+
configId: string;
|
|
54
|
+
}): Promise<any>;
|
|
55
|
+
deleteAsset({ merchantId, configId }: {
|
|
56
|
+
merchantId: string;
|
|
57
|
+
configId: string;
|
|
58
|
+
}): Promise<any>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { RequestMothod } from '../types';
|
|
2
|
+
export declare const MerchantsRoutes: {
|
|
3
|
+
create: {
|
|
4
|
+
fullPath: string;
|
|
5
|
+
method: RequestMothod;
|
|
6
|
+
accessTokenRequired: boolean;
|
|
7
|
+
};
|
|
8
|
+
update: {
|
|
9
|
+
fullPath: ({ id }: {
|
|
10
|
+
id: string;
|
|
11
|
+
}) => string;
|
|
12
|
+
method: RequestMothod;
|
|
13
|
+
accessTokenRequired: boolean;
|
|
14
|
+
};
|
|
15
|
+
getMerchantData: {
|
|
16
|
+
fullPath: ({ id }: {
|
|
17
|
+
id: string;
|
|
18
|
+
}) => string;
|
|
19
|
+
method: RequestMothod;
|
|
20
|
+
accessTokenRequired: boolean;
|
|
21
|
+
};
|
|
22
|
+
list: {
|
|
23
|
+
fullPath: string;
|
|
24
|
+
method: RequestMothod;
|
|
25
|
+
accessTokenRequired: boolean;
|
|
26
|
+
};
|
|
27
|
+
getAssets: {
|
|
28
|
+
fullPath: ({ id }: {
|
|
29
|
+
id: string;
|
|
30
|
+
}) => string;
|
|
31
|
+
method: RequestMothod;
|
|
32
|
+
accessTokenRequired: boolean;
|
|
33
|
+
};
|
|
34
|
+
addAsset: {
|
|
35
|
+
fullPath: ({ id, configId }: {
|
|
36
|
+
id: string;
|
|
37
|
+
configId: string;
|
|
38
|
+
}) => string;
|
|
39
|
+
method: RequestMothod;
|
|
40
|
+
accessTokenRequired: boolean;
|
|
41
|
+
};
|
|
42
|
+
deleteAsset: {
|
|
43
|
+
fullPath: ({ id, configId }: {
|
|
44
|
+
id: string;
|
|
45
|
+
configId: string;
|
|
46
|
+
}) => string;
|
|
47
|
+
method: RequestMothod;
|
|
48
|
+
accessTokenRequired: boolean;
|
|
49
|
+
};
|
|
50
|
+
};
|
package/dist/types/common.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ export declare type WallabyConfig = {
|
|
|
17
17
|
};
|
|
18
18
|
export declare type User = {
|
|
19
19
|
id: string;
|
|
20
|
-
firstName?: string;
|
|
21
|
-
lastName?: string;
|
|
22
20
|
externalUserId: string;
|
|
23
21
|
clientAuthPubKey: string;
|
|
24
22
|
wallabyAuthPubKey: string;
|
|
@@ -148,10 +146,10 @@ export declare enum BlockchainSlip44 {
|
|
|
148
146
|
MATIC = 966
|
|
149
147
|
}
|
|
150
148
|
export declare enum BlockchainName {
|
|
151
|
-
Bitcoin = "BITCOIN",
|
|
152
|
-
Ethereum = "ETHEREUM",
|
|
153
149
|
Algorand = "ALGORAND",
|
|
154
150
|
Avalanche = "AVALANCHE",
|
|
151
|
+
Bitcoin = "BITCOIN",
|
|
152
|
+
Ethereum = "ETHEREUM",
|
|
155
153
|
Polygon = "POLYGON"
|
|
156
154
|
}
|
|
157
155
|
export declare enum RequestMothod {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wallaby-cash",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "https://github.com/republic-crypto/ncw-sdk-js.git",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
],
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"axios": "^1.6.5",
|
|
87
|
-
"crypto-js": "
|
|
87
|
+
"crypto-js": "4.2.0",
|
|
88
88
|
"eth-crypto": "2.6.0"
|
|
89
89
|
}
|
|
90
90
|
}
|
package/src/lib/auth/index.ts
CHANGED
|
@@ -42,7 +42,6 @@ export class Auth extends Base {
|
|
|
42
42
|
// If local storage doesn't already have data for the user, we create new key pair and save it
|
|
43
43
|
decryptedClientAuthPrivKey = Utils.getDecryptedPrivateKey(userId, hashKey);
|
|
44
44
|
if (!decryptedClientAuthPrivKey) {
|
|
45
|
-
logger('if statement')
|
|
46
45
|
const { publicKey, privateKey } = createIdentity();
|
|
47
46
|
clientAuthPubKey = publicKey;
|
|
48
47
|
decryptedClientAuthPrivKey = privateKey;
|
|
@@ -182,7 +181,6 @@ export class Auth extends Base {
|
|
|
182
181
|
*/
|
|
183
182
|
async updateClientAuthPubKey({
|
|
184
183
|
hashKey,
|
|
185
|
-
userId,
|
|
186
184
|
}: Pick<ClientAuthPubKeyRequest, 'hashKey' | 'userId'>): Promise<ClientAuthPubKeyResponse | undefined> {
|
|
187
185
|
try {
|
|
188
186
|
const signatureMessage = await this.signatureMessage({ hashKey, userId: this.userId });
|
|
@@ -207,7 +205,7 @@ export class Auth extends Base {
|
|
|
207
205
|
throw new Error(response.error);
|
|
208
206
|
}
|
|
209
207
|
// Updating private key from the newly generate key pair.
|
|
210
|
-
Utils.setEncryptedPrivateKey(userId, privateKey, hashKey);
|
|
208
|
+
Utils.setEncryptedPrivateKey(this.userId, privateKey, hashKey);
|
|
211
209
|
return response;
|
|
212
210
|
} catch (error) {
|
|
213
211
|
logger('SDK::Auth::clientAuthPubKey::error', error);
|
|
@@ -216,7 +214,9 @@ export class Auth extends Base {
|
|
|
216
214
|
}
|
|
217
215
|
|
|
218
216
|
/**
|
|
219
|
-
*
|
|
217
|
+
*
|
|
218
|
+
* @deprecated
|
|
219
|
+
* @description This function is used to get back Wallaby's Auth Public Key. Public key is stored in localStorage so this function is getting deprecated.
|
|
220
220
|
* @param {string} clientAuthPubKey
|
|
221
221
|
* @returns {WallabyAuthPubKeyResponse} Returns user's Wallaby WallabyAuthPubKey
|
|
222
222
|
*/
|
package/src/lib/index.ts
CHANGED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Base } from '../../base';
|
|
2
|
+
import logger from '../../helpers/logger';
|
|
3
|
+
import { MerchantsRoutes } from '../../routes/merchants';
|
|
4
|
+
import { WallabyConfig } from '../../types';
|
|
5
|
+
import { ListMerchantsResponse, Merchant, MerchantStatus } from '../../types/merchants';
|
|
6
|
+
|
|
7
|
+
export class Merchants extends Base {
|
|
8
|
+
constructor(config: WallabyConfig) {
|
|
9
|
+
super(config);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @description List of all merchants in the system
|
|
16
|
+
* @returns { ListMerchantsResponse } Array of all merchants
|
|
17
|
+
*/
|
|
18
|
+
async list(): Promise<ListMerchantsResponse> {
|
|
19
|
+
try {
|
|
20
|
+
const response = await this.request(MerchantsRoutes.list, {
|
|
21
|
+
method: MerchantsRoutes.list.method,
|
|
22
|
+
payload: {},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (!response || response.error) {
|
|
26
|
+
throw new Error(response.error);
|
|
27
|
+
}
|
|
28
|
+
return response;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
logger('SDK::Merchants::list::error', error);
|
|
31
|
+
return Promise.reject(error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @description Allows to create a new merchant
|
|
39
|
+
* @returns { Merchant } Merchant data
|
|
40
|
+
*/
|
|
41
|
+
async create({ name }: { name: string }): Promise<Merchant> {
|
|
42
|
+
try {
|
|
43
|
+
const response = await this.request(MerchantsRoutes.create, {
|
|
44
|
+
method: MerchantsRoutes.create.method,
|
|
45
|
+
payload: { name },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (!response || response.error) {
|
|
49
|
+
throw new Error(response.error);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return response;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
logger('SDK::Merchants::list::error', error);
|
|
55
|
+
return Promise.reject(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
* @description Allows to update merchant data
|
|
63
|
+
* @returns { Merchant } Merchant data
|
|
64
|
+
*/
|
|
65
|
+
async update({ merchantId, name, status }: { merchantId: string; name?: string; status?: MerchantStatus }): Promise<Merchant> {
|
|
66
|
+
try {
|
|
67
|
+
const response = await this.request(MerchantsRoutes.update, {
|
|
68
|
+
method: MerchantsRoutes.update.method,
|
|
69
|
+
payload: { merchantId, name, status },
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (!response || response.error) {
|
|
73
|
+
throw new Error(response.error);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return response;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
logger('SDK::Merchants::list::error', error);
|
|
79
|
+
return Promise.reject(error);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
* @param merchantId Merchant ID
|
|
87
|
+
* @returns { Merchant } Merchant data
|
|
88
|
+
*/
|
|
89
|
+
async getMerchantData({ merchantId }: { merchantId: string }): Promise<Merchant> {
|
|
90
|
+
try {
|
|
91
|
+
const response = await this.request(MerchantsRoutes.getMerchantData, {
|
|
92
|
+
method: MerchantsRoutes.getMerchantData.method,
|
|
93
|
+
payload: { merchantId },
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if (!response || response.error) {
|
|
97
|
+
throw new Error(response.error);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return response;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
logger('SDK::Merchants::list::error', error);
|
|
103
|
+
return Promise.reject(error);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
* @param merchantId Merchant ID
|
|
111
|
+
* @returns { Merchant } Merchant data
|
|
112
|
+
*/
|
|
113
|
+
async getAssets({ merchantId }: { merchantId: string }) {
|
|
114
|
+
try {
|
|
115
|
+
const response = await this.request(MerchantsRoutes.getAssets, {
|
|
116
|
+
method: MerchantsRoutes.getAssets.method,
|
|
117
|
+
payload: { merchantId },
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
if (!response || response.error) {
|
|
121
|
+
throw new Error(response.error);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return response;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
logger('SDK::Merchants::list::error', error);
|
|
127
|
+
return Promise.reject(error);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async addAsset({ merchantId, configId }: { merchantId: string; configId: string }) {
|
|
132
|
+
try {
|
|
133
|
+
const response = await this.request(MerchantsRoutes.addAsset, {
|
|
134
|
+
method: MerchantsRoutes.addAsset.method,
|
|
135
|
+
payload: { merchantId, configId },
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
if (!response || response.error) {
|
|
139
|
+
throw new Error(response.error);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return response;
|
|
143
|
+
} catch (error) {
|
|
144
|
+
logger('SDK::Merchants::list::error', error);
|
|
145
|
+
return Promise.reject(error);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async deleteAsset({ merchantId, configId }: { merchantId: string; configId: string }) {
|
|
150
|
+
try {
|
|
151
|
+
const response = await this.request(MerchantsRoutes.deleteAsset, {
|
|
152
|
+
method: MerchantsRoutes.deleteAsset.method,
|
|
153
|
+
payload: { merchantId, configId },
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
if (!response || response.error) {
|
|
157
|
+
throw new Error(response.error);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return response;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
logger('SDK::Merchants::list::error', error);
|
|
163
|
+
return Promise.reject(error);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RequestMothod } from '../types';
|
|
2
|
+
|
|
3
|
+
export const MerchantsRoutes = {
|
|
4
|
+
create: {
|
|
5
|
+
fullPath: '/merchants',
|
|
6
|
+
method: RequestMothod.Post,
|
|
7
|
+
accessTokenRequired: false,
|
|
8
|
+
},
|
|
9
|
+
update: {
|
|
10
|
+
fullPath: ({ id }: { id: string }) => `/merchants/${id}`,
|
|
11
|
+
method: RequestMothod.Put,
|
|
12
|
+
accessTokenRequired: false,
|
|
13
|
+
},
|
|
14
|
+
getMerchantData: {
|
|
15
|
+
fullPath: ({ id }: { id: string }) => `/merchants/${id}`,
|
|
16
|
+
method: RequestMothod.Get,
|
|
17
|
+
accessTokenRequired: false,
|
|
18
|
+
},
|
|
19
|
+
list: {
|
|
20
|
+
fullPath: '/merchants',
|
|
21
|
+
method: RequestMothod.Get,
|
|
22
|
+
accessTokenRequired: false,
|
|
23
|
+
},
|
|
24
|
+
getAssets: {
|
|
25
|
+
fullPath: ({ id }: { id: string }) => `/merchants/${id}/assets`,
|
|
26
|
+
method: RequestMothod.Get,
|
|
27
|
+
accessTokenRequired: false,
|
|
28
|
+
},
|
|
29
|
+
addAsset: {
|
|
30
|
+
fullPath: ({ id, configId }: { id: string; configId: string }) => `/merchants/${id}/assets${configId}`,
|
|
31
|
+
method: RequestMothod.Post,
|
|
32
|
+
accessTokenRequired: false,
|
|
33
|
+
},
|
|
34
|
+
deleteAsset: {
|
|
35
|
+
fullPath: ({ id, configId }: { id: string; configId: string }) => `/merchants/${id}/assets${configId}`,
|
|
36
|
+
method: RequestMothod.Delete,
|
|
37
|
+
accessTokenRequired: false,
|
|
38
|
+
},
|
|
39
|
+
};
|
package/src/tests/data/index.ts
CHANGED