From 15205c1a6d8c359b162fa06fff61f1f5ada192cc Mon Sep 17 00:00:00 2001 From: David Fahlander Date: Wed, 26 Oct 2016 10:21:20 +0200 Subject: [PATCH 1/6] Fixed webpack bundling. (Not tested) --- dist/dexie-relationships.js | 1448 ++++++++++++++++++++++++++++--- dist/dexie-relationships.js.map | 1 + package.json | 11 +- src/index.js | 3 + webpack.config.js | 2 + 5 files changed, 1339 insertions(+), 126 deletions(-) create mode 100644 dist/dexie-relationships.js.map diff --git a/dist/dexie-relationships.js b/dist/dexie-relationships.js index beecbee..e1da540 100644 --- a/dist/dexie-relationships.js +++ b/dist/dexie-relationships.js @@ -1,122 +1,1326 @@ -'use strict'; - -var _promise = require('babel-runtime/core-js/promise'); - -var _promise2 = _interopRequireDefault(_promise); - -var _keys = require('babel-runtime/core-js/object/keys'); - -var _keys2 = _interopRequireDefault(_keys); - -var _dexie = require('dexie'); - -var _dexie2 = _interopRequireDefault(_dexie); - -var _schemaParser = require('./schema-parser'); - -var _schemaParser2 = _interopRequireDefault(_schemaParser); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Relationships = function Relationships(db) { - /** - * Iterate through all items and collect related records - * - * @param relationships - * - * @returns {Dexie.Promise} - */ - db.Table.prototype.with = function (relationships) { - return this.toCollection().with(relationships); - }; - - /** - * Iterate through all items and collect related records - * - * @param relationships - * - * @returns {Dexie.Promise} - */ - db.Collection.prototype.with = function (relationships) { - var self = this; - var baseTable = this._ctx.table.name; - var databaseTables = db._allTables; - - // this holds tables that have foreign keys pointing at the current table - var usableForeignTables = {}; - - // validate target tables and add them into our usable tables object - (0, _keys2.default)(relationships).forEach(function (column) { - var table = relationships[column]; - - if (!databaseTables.hasOwnProperty(table)) { - throw new Error('Relationship table ' + table + ' doesn\'t exist.'); - } - - if (!databaseTables[table].schema.hasOwnProperty('foreignKeys')) { - throw new Error('Relationship table ' + table + ' doesn\'t have foreign keys set.'); - } - - // remove the foreign keys that don't link to the base table - var columns = databaseTables[table].schema.foreignKeys.filter(function (column) { - return column.targetTable === baseTable; - }); - - if (columns.length > 0) { - usableForeignTables[table] = { - column: column, - foreign: columns[0] - }; - } - }); - - return new _dexie2.default.Promise(function (resolve) { - self.toArray().then(function (rows) { - var queue = []; - - // loop through all rows and collect all data from the related table - rows.forEach(function (row) { - var tables = (0, _keys2.default)(usableForeignTables); - - tables.forEach(function (table) { - var relatedTable = usableForeignTables[table]; - - var promise = databaseTables[table].where(relatedTable.foreign.index).equals(row[relatedTable.foreign.targetIndex]).toArray().then(function (relations) { - row[relatedTable.column] = relations; - }); - - queue.push(promise); - }); - }); - - // we need to wait until all data is retrieved - // once it's there we can resolve the promise - _promise2.default.all(queue).then(function () { - resolve(rows); - }); - }); - }); - }; - - db.Version.prototype._parseStoresSpec = _dexie2.default.override(db.Version.prototype._parseStoresSpec, function (parseStoresSpec) { - return function (storesSpec, outDbSchema) { - var parser = new _schemaParser2.default(storesSpec); - - var foreignKeys = parser.getForeignKeys(); - // call the original method - var rv = parseStoresSpec.call(this, parser.getCleanedSchema(), outDbSchema); - - // set foreign keys into database table objects - // to use later in 'with' method - (0, _keys2.default)(outDbSchema).forEach(function (table) { - if (foreignKeys.hasOwnProperty(table)) { - outDbSchema[table].foreignKeys = foreignKeys[table]; - } - }); - - return rv; - }; - }); -}; - -_dexie2.default.addons.push(Relationships); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _keys = __webpack_require__(1); + + var _keys2 = _interopRequireDefault(_keys); + + var _dexie = __webpack_require__(36); + + var _dexie2 = _interopRequireDefault(_dexie); + + var _schemaParser = __webpack_require__(37); + + var _schemaParser2 = _interopRequireDefault(_schemaParser); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var Relationships = function Relationships(db) { + + var Promise = _dexie2.default.Promise; // Safe to use within transactions. + + /** + * Iterate through all items and collect related records + * + * @param relationships + * + * @returns {Dexie.Promise} + */ + db.Table.prototype.with = function (relationships) { + return this.toCollection().with(relationships); + }; + + /** + * Iterate through all items and collect related records + * + * @param relationships + * + * @returns {Dexie.Promise} + */ + db.Collection.prototype.with = function (relationships) { + var self = this; + var baseTable = this._ctx.table.name; + var databaseTables = db._allTables; + + // this holds tables that have foreign keys pointing at the current table + var usableForeignTables = {}; + + // validate target tables and add them into our usable tables object + (0, _keys2.default)(relationships).forEach(function (column) { + var table = relationships[column]; + + if (!databaseTables.hasOwnProperty(table)) { + throw new Error('Relationship table ' + table + ' doesn\'t exist.'); + } + + if (!databaseTables[table].schema.hasOwnProperty('foreignKeys')) { + throw new Error('Relationship table ' + table + ' doesn\'t have foreign keys set.'); + } + + // remove the foreign keys that don't link to the base table + var columns = databaseTables[table].schema.foreignKeys.filter(function (column) { + return column.targetTable === baseTable; + }); + + if (columns.length > 0) { + usableForeignTables[table] = { + column: column, + foreign: columns[0] + }; + } + }); + + return new _dexie2.default.Promise(function (resolve) { + self.toArray().then(function (rows) { + var queue = []; + + // loop through all rows and collect all data from the related table + rows.forEach(function (row) { + var tables = (0, _keys2.default)(usableForeignTables); + + tables.forEach(function (table) { + var relatedTable = usableForeignTables[table]; + + var promise = databaseTables[table].where(relatedTable.foreign.index).equals(row[relatedTable.foreign.targetIndex]).toArray().then(function (relations) { + row[relatedTable.column] = relations; + }); + + queue.push(promise); + }); + }); + + // we need to wait until all data is retrieved + // once it's there we can resolve the promise + Promise.all(queue).then(function () { + resolve(rows); + }); + }); + }); + }; + + db.Version.prototype._parseStoresSpec = _dexie2.default.override(db.Version.prototype._parseStoresSpec, function (parseStoresSpec) { + return function (storesSpec, outDbSchema) { + var parser = new _schemaParser2.default(storesSpec); + + var foreignKeys = parser.getForeignKeys(); + // call the original method + var rv = parseStoresSpec.call(this, parser.getCleanedSchema(), outDbSchema); + + // set foreign keys into database table objects + // to use later in 'with' method + (0, _keys2.default)(outDbSchema).forEach(function (table) { + if (foreignKeys.hasOwnProperty(table)) { + outDbSchema[table].foreignKeys = foreignKeys[table]; + } + }); + + return rv; + }; + }); + }; + + _dexie2.default.addons.push(Relationships); + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(2), __esModule: true }; + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(3); + module.exports = __webpack_require__(23).Object.keys; + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(4) + , $keys = __webpack_require__(6); + + __webpack_require__(21)('keys', function(){ + return function keys(it){ + return $keys(toObject(it)); + }; + }); + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(5); + module.exports = function(it){ + return Object(defined(it)); + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; + }; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.14 / 15.2.3.14 Object.keys(O) + var $keys = __webpack_require__(7) + , enumBugKeys = __webpack_require__(20); + + module.exports = Object.keys || function keys(O){ + return $keys(O, enumBugKeys); + }; + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + var has = __webpack_require__(8) + , toIObject = __webpack_require__(9) + , arrayIndexOf = __webpack_require__(12)(false) + , IE_PROTO = __webpack_require__(16)('IE_PROTO'); + + module.exports = function(object, names){ + var O = toIObject(object) + , i = 0 + , result = [] + , key; + for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while(names.length > i)if(has(O, key = names[i++])){ + ~arrayIndexOf(result, key) || result.push(key); + } + return result; + }; + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + var hasOwnProperty = {}.hasOwnProperty; + module.exports = function(it, key){ + return hasOwnProperty.call(it, key); + }; + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + // to indexed object, toObject with fallback for non-array-like ES3 strings + var IObject = __webpack_require__(10) + , defined = __webpack_require__(5); + module.exports = function(it){ + return IObject(defined(it)); + }; + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var cof = __webpack_require__(11); + module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ + return cof(it) == 'String' ? it.split('') : Object(it); + }; + +/***/ }, +/* 11 */ +/***/ function(module, exports) { + + var toString = {}.toString; + + module.exports = function(it){ + return toString.call(it).slice(8, -1); + }; + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + // false -> Array#indexOf + // true -> Array#includes + var toIObject = __webpack_require__(9) + , toLength = __webpack_require__(13) + , toIndex = __webpack_require__(15); + module.exports = function(IS_INCLUDES){ + return function($this, el, fromIndex){ + var O = toIObject($this) + , length = toLength(O.length) + , index = toIndex(fromIndex, length) + , value; + // Array#includes uses SameValueZero equality algorithm + if(IS_INCLUDES && el != el)while(length > index){ + value = O[index++]; + if(value != value)return true; + // Array#toIndex ignores holes, Array#includes - not + } else for(;length > index; index++)if(IS_INCLUDES || index in O){ + if(O[index] === el)return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + // 7.1.15 ToLength + var toInteger = __webpack_require__(14) + , min = Math.min; + module.exports = function(it){ + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 + }; + +/***/ }, +/* 14 */ +/***/ function(module, exports) { + + // 7.1.4 ToInteger + var ceil = Math.ceil + , floor = Math.floor; + module.exports = function(it){ + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); + }; + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + var toInteger = __webpack_require__(14) + , max = Math.max + , min = Math.min; + module.exports = function(index, length){ + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); + }; + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + var shared = __webpack_require__(17)('keys') + , uid = __webpack_require__(19); + module.exports = function(key){ + return shared[key] || (shared[key] = uid(key)); + }; + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + var global = __webpack_require__(18) + , SHARED = '__core-js_shared__' + , store = global[SHARED] || (global[SHARED] = {}); + module.exports = function(key){ + return store[key] || (store[key] = {}); + }; + +/***/ }, +/* 18 */ +/***/ function(module, exports) { + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }, +/* 19 */ +/***/ function(module, exports) { + + var id = 0 + , px = Math.random(); + module.exports = function(key){ + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); + }; + +/***/ }, +/* 20 */ +/***/ function(module, exports) { + + // IE 8- don't enum bug keys + module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' + ).split(','); + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(22) + , core = __webpack_require__(23) + , fails = __webpack_require__(32); + module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); + }; + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + var global = __webpack_require__(18) + , core = __webpack_require__(23) + , ctx = __webpack_require__(24) + , hide = __webpack_require__(26) + , PROTOTYPE = 'prototype'; + + var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , expProto = exports[PROTOTYPE] + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(a, b, c){ + if(this instanceof C){ + switch(arguments.length){ + case 0: return new C; + case 1: return new C(a); + case 2: return new C(a, b); + } return new C(a, b, c); + } return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if(IS_PROTO){ + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); + } + } + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + $export.U = 64; // safe + $export.R = 128; // real proto method for `library` + module.exports = $export; + +/***/ }, +/* 23 */ +/***/ function(module, exports) { + + var core = module.exports = {version: '2.4.0'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(25); + module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */){ + return fn.apply(that, arguments); + }; + }; + +/***/ }, +/* 25 */ +/***/ function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + var dP = __webpack_require__(27) + , createDesc = __webpack_require__(35); + module.exports = __webpack_require__(31) ? function(object, key, value){ + return dP.f(object, key, createDesc(1, value)); + } : function(object, key, value){ + object[key] = value; + return object; + }; + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + var anObject = __webpack_require__(28) + , IE8_DOM_DEFINE = __webpack_require__(30) + , toPrimitive = __webpack_require__(34) + , dP = Object.defineProperty; + + exports.f = __webpack_require__(31) ? Object.defineProperty : function defineProperty(O, P, Attributes){ + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if(IE8_DOM_DEFINE)try { + return dP(O, P, Attributes); + } catch(e){ /* empty */ } + if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); + if('value' in Attributes)O[P] = Attributes.value; + return O; + }; + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + var isObject = __webpack_require__(29); + module.exports = function(it){ + if(!isObject(it))throw TypeError(it + ' is not an object!'); + return it; + }; + +/***/ }, +/* 29 */ +/***/ function(module, exports) { + + module.exports = function(it){ + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + +/***/ }, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = !__webpack_require__(31) && !__webpack_require__(32)(function(){ + return Object.defineProperty(__webpack_require__(33)('div'), 'a', {get: function(){ return 7; }}).a != 7; + }); + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + // Thank's IE8 for his funny defineProperty + module.exports = !__webpack_require__(32)(function(){ + return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; + }); + +/***/ }, +/* 32 */ +/***/ function(module, exports) { + + module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } + }; + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + var isObject = __webpack_require__(29) + , document = __webpack_require__(18).document + // in old IE typeof document.createElement is 'object' + , is = isObject(document) && isObject(document.createElement); + module.exports = function(it){ + return is ? document.createElement(it) : {}; + }; + +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { + + // 7.1.1 ToPrimitive(input [, PreferredType]) + var isObject = __webpack_require__(29); + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + module.exports = function(it, S){ + if(!isObject(it))return it; + var fn, val; + if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; + if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + throw TypeError("Can't convert object to primitive value"); + }; + +/***/ }, +/* 35 */ +/***/ function(module, exports) { + + module.exports = function(bitmap, value){ + return { + enumerable : !(bitmap & 1), + configurable: !(bitmap & 2), + writable : !(bitmap & 4), + value : value + }; + }; + +/***/ }, +/* 36 */ +/***/ function(module, exports) { + + module.exports = dexie; + +/***/ }, +/* 37 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _slicedToArray2 = __webpack_require__(38); + + var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); + + var _keys = __webpack_require__(1); + + var _keys2 = _interopRequireDefault(_keys); + + var _classCallCheck2 = __webpack_require__(64); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _createClass2 = __webpack_require__(65); + + var _createClass3 = _interopRequireDefault(_createClass2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var SchemaParser = function () { + + /** + * Schema parser + * + * @param schema + */ + function SchemaParser(schema) { + (0, _classCallCheck3.default)(this, SchemaParser); + + this.schema = schema; + } + + /** + * Extracts foreign keys from the schema + * + * @returns Object + */ + + + (0, _createClass3.default)(SchemaParser, [{ + key: 'getForeignKeys', + value: function getForeignKeys() { + var _this = this; + + var foreignKeys = {}; + + (0, _keys2.default)(this.schema).forEach(function (table) { + var indexes = _this.schema[table].split(','); + + foreignKeys[table] = indexes.filter(function (idx) { + return idx.indexOf('->') !== -1; + }).map(function (idx) { + // split the column and foreign table info + var _idx$split$map = idx.split('->').map(function (x) { + return x.trim(); + }), + _idx$split$map2 = (0, _slicedToArray3.default)(_idx$split$map, 2), + column = _idx$split$map2[0], + target = _idx$split$map2[1]; + + return { + index: column, + targetTable: target.split('.')[0], + targetIndex: target.split('.')[1] + }; + }); + }); + + return foreignKeys; + } + + /** + * Get schema without the foreign key definitions + * + * @returns Object + */ + + }, { + key: 'getCleanedSchema', + value: function getCleanedSchema() { + var _this2 = this; + + var schema = {}; + + (0, _keys2.default)(this.schema).forEach(function (table) { + var indexes = _this2.schema[table].split(','); + + // Remove foreign keys syntax before calling the original method + schema[table] = indexes.map(function (idx) { + return idx.split('->')[0].trim(); + }).join(','); + }); + + return schema; + } + }]); + return SchemaParser; + }(); + + exports.default = SchemaParser; + +/***/ }, +/* 38 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _isIterable2 = __webpack_require__(39); + + var _isIterable3 = _interopRequireDefault(_isIterable2); + + var _getIterator2 = __webpack_require__(60); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if ((0, _isIterable3.default)(Object(arr))) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; + }(); + +/***/ }, +/* 39 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(40), __esModule: true }; + +/***/ }, +/* 40 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(41); + __webpack_require__(56); + module.exports = __webpack_require__(58); + +/***/ }, +/* 41 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(42); + var global = __webpack_require__(18) + , hide = __webpack_require__(26) + , Iterators = __webpack_require__(45) + , TO_STRING_TAG = __webpack_require__(54)('toStringTag'); + + for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ + var NAME = collections[i] + , Collection = global[NAME] + , proto = Collection && Collection.prototype; + if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; + } + +/***/ }, +/* 42 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var addToUnscopables = __webpack_require__(43) + , step = __webpack_require__(44) + , Iterators = __webpack_require__(45) + , toIObject = __webpack_require__(9); + + // 22.1.3.4 Array.prototype.entries() + // 22.1.3.13 Array.prototype.keys() + // 22.1.3.29 Array.prototype.values() + // 22.1.3.30 Array.prototype[@@iterator]() + module.exports = __webpack_require__(46)(Array, 'Array', function(iterated, kind){ + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind + // 22.1.5.2.1 %ArrayIteratorPrototype%.next() + }, function(){ + var O = this._t + , kind = this._k + , index = this._i++; + if(!O || index >= O.length){ + this._t = undefined; + return step(1); + } + if(kind == 'keys' )return step(0, index); + if(kind == 'values')return step(0, O[index]); + return step(0, [index, O[index]]); + }, 'values'); + + // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) + Iterators.Arguments = Iterators.Array; + + addToUnscopables('keys'); + addToUnscopables('values'); + addToUnscopables('entries'); + +/***/ }, +/* 43 */ +/***/ function(module, exports) { + + module.exports = function(){ /* empty */ }; + +/***/ }, +/* 44 */ +/***/ function(module, exports) { + + module.exports = function(done, value){ + return {value: value, done: !!done}; + }; + +/***/ }, +/* 45 */ +/***/ function(module, exports) { + + module.exports = {}; + +/***/ }, +/* 46 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var LIBRARY = __webpack_require__(47) + , $export = __webpack_require__(22) + , redefine = __webpack_require__(48) + , hide = __webpack_require__(26) + , has = __webpack_require__(8) + , Iterators = __webpack_require__(45) + , $iterCreate = __webpack_require__(49) + , setToStringTag = __webpack_require__(53) + , getPrototypeOf = __webpack_require__(55) + , ITERATOR = __webpack_require__(54)('iterator') + , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` + , FF_ITERATOR = '@@iterator' + , KEYS = 'keys' + , VALUES = 'values'; + + var returnThis = function(){ return this; }; + + module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ + $iterCreate(Constructor, NAME, next); + var getMethod = function(kind){ + if(!BUGGY && kind in proto)return proto[kind]; + switch(kind){ + case KEYS: return function keys(){ return new Constructor(this, kind); }; + case VALUES: return function values(){ return new Constructor(this, kind); }; + } return function entries(){ return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator' + , DEF_VALUES = DEFAULT == VALUES + , VALUES_BUG = false + , proto = Base.prototype + , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] + , $default = $native || getMethod(DEFAULT) + , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined + , $anyNative = NAME == 'Array' ? proto.entries || $native : $native + , methods, key, IteratorPrototype; + // Fix native + if($anyNative){ + IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); + if(IteratorPrototype !== Object.prototype){ + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if(DEF_VALUES && $native && $native.name !== VALUES){ + VALUES_BUG = true; + $default = function values(){ return $native.call(this); }; + } + // Define iterator + if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if(DEFAULT){ + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if(FORCED)for(key in methods){ + if(!(key in proto))redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; + }; + +/***/ }, +/* 47 */ +/***/ function(module, exports) { + + module.exports = true; + +/***/ }, +/* 48 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(26); + +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var create = __webpack_require__(50) + , descriptor = __webpack_require__(35) + , setToStringTag = __webpack_require__(53) + , IteratorPrototype = {}; + + // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + __webpack_require__(26)(IteratorPrototype, __webpack_require__(54)('iterator'), function(){ return this; }); + + module.exports = function(Constructor, NAME, next){ + Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); + setToStringTag(Constructor, NAME + ' Iterator'); + }; + +/***/ }, +/* 50 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + var anObject = __webpack_require__(28) + , dPs = __webpack_require__(51) + , enumBugKeys = __webpack_require__(20) + , IE_PROTO = __webpack_require__(16)('IE_PROTO') + , Empty = function(){ /* empty */ } + , PROTOTYPE = 'prototype'; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var createDict = function(){ + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(33)('iframe') + , i = enumBugKeys.length + , lt = '<' + , gt = '>' + , iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(52).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); + }; + + module.exports = Object.create || function create(O, Properties){ + var result; + if(O !== null){ + Empty[PROTOTYPE] = anObject(O); + result = new Empty; + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); + }; + + +/***/ }, +/* 51 */ +/***/ function(module, exports, __webpack_require__) { + + var dP = __webpack_require__(27) + , anObject = __webpack_require__(28) + , getKeys = __webpack_require__(6); + + module.exports = __webpack_require__(31) ? Object.defineProperties : function defineProperties(O, Properties){ + anObject(O); + var keys = getKeys(Properties) + , length = keys.length + , i = 0 + , P; + while(length > i)dP.f(O, P = keys[i++], Properties[P]); + return O; + }; + +/***/ }, +/* 52 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(18).document && document.documentElement; + +/***/ }, +/* 53 */ +/***/ function(module, exports, __webpack_require__) { + + var def = __webpack_require__(27).f + , has = __webpack_require__(8) + , TAG = __webpack_require__(54)('toStringTag'); + + module.exports = function(it, tag, stat){ + if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); + }; + +/***/ }, +/* 54 */ +/***/ function(module, exports, __webpack_require__) { + + var store = __webpack_require__(17)('wks') + , uid = __webpack_require__(19) + , Symbol = __webpack_require__(18).Symbol + , USE_SYMBOL = typeof Symbol == 'function'; + + var $exports = module.exports = function(name){ + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); + }; + + $exports.store = store; + +/***/ }, +/* 55 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) + var has = __webpack_require__(8) + , toObject = __webpack_require__(4) + , IE_PROTO = __webpack_require__(16)('IE_PROTO') + , ObjectProto = Object.prototype; + + module.exports = Object.getPrototypeOf || function(O){ + O = toObject(O); + if(has(O, IE_PROTO))return O[IE_PROTO]; + if(typeof O.constructor == 'function' && O instanceof O.constructor){ + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; + }; + +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var $at = __webpack_require__(57)(true); + + // 21.1.3.27 String.prototype[@@iterator]() + __webpack_require__(46)(String, 'String', function(iterated){ + this._t = String(iterated); // target + this._i = 0; // next index + // 21.1.5.2.1 %StringIteratorPrototype%.next() + }, function(){ + var O = this._t + , index = this._i + , point; + if(index >= O.length)return {value: undefined, done: true}; + point = $at(O, index); + this._i += point.length; + return {value: point, done: false}; + }); + +/***/ }, +/* 57 */ +/***/ function(module, exports, __webpack_require__) { + + var toInteger = __webpack_require__(14) + , defined = __webpack_require__(5); + // true -> String#at + // false -> String#codePointAt + module.exports = function(TO_STRING){ + return function(that, pos){ + var s = String(defined(that)) + , i = toInteger(pos) + , l = s.length + , a, b; + if(i < 0 || i >= l)return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; + }; + +/***/ }, +/* 58 */ +/***/ function(module, exports, __webpack_require__) { + + var classof = __webpack_require__(59) + , ITERATOR = __webpack_require__(54)('iterator') + , Iterators = __webpack_require__(45); + module.exports = __webpack_require__(23).isIterable = function(it){ + var O = Object(it); + return O[ITERATOR] !== undefined + || '@@iterator' in O + || Iterators.hasOwnProperty(classof(O)); + }; + +/***/ }, +/* 59 */ +/***/ function(module, exports, __webpack_require__) { + + // getting tag from 19.1.3.6 Object.prototype.toString() + var cof = __webpack_require__(11) + , TAG = __webpack_require__(54)('toStringTag') + // ES3 wrong here + , ARG = cof(function(){ return arguments; }()) == 'Arguments'; + + // fallback for IE11 Script Access Denied error + var tryGet = function(it, key){ + try { + return it[key]; + } catch(e){ /* empty */ } + }; + + module.exports = function(it){ + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; + }; + +/***/ }, +/* 60 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(61), __esModule: true }; + +/***/ }, +/* 61 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(41); + __webpack_require__(56); + module.exports = __webpack_require__(62); + +/***/ }, +/* 62 */ +/***/ function(module, exports, __webpack_require__) { + + var anObject = __webpack_require__(28) + , get = __webpack_require__(63); + module.exports = __webpack_require__(23).getIterator = function(it){ + var iterFn = get(it); + if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); + return anObject(iterFn.call(it)); + }; + +/***/ }, +/* 63 */ +/***/ function(module, exports, __webpack_require__) { + + var classof = __webpack_require__(59) + , ITERATOR = __webpack_require__(54)('iterator') + , Iterators = __webpack_require__(45); + module.exports = __webpack_require__(23).getIteratorMethod = function(it){ + if(it != undefined)return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; + }; + +/***/ }, +/* 64 */ +/***/ function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + +/***/ }, +/* 65 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _defineProperty = __webpack_require__(66); + + var _defineProperty2 = _interopRequireDefault(_defineProperty); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + (0, _defineProperty2.default)(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + +/***/ }, +/* 66 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(67), __esModule: true }; + +/***/ }, +/* 67 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(68); + var $Object = __webpack_require__(23).Object; + module.exports = function defineProperty(it, key, desc){ + return $Object.defineProperty(it, key, desc); + }; + +/***/ }, +/* 68 */ +/***/ function(module, exports, __webpack_require__) { + + var $export = __webpack_require__(22); + // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) + $export($export.S + $export.F * !__webpack_require__(31), 'Object', {defineProperty: __webpack_require__(27).f}); + +/***/ } +/******/ ]); +//# sourceMappingURL=dexie-relationships.js.map \ No newline at end of file diff --git a/dist/dexie-relationships.js.map b/dist/dexie-relationships.js.map new file mode 100644 index 0000000..ebf4200 --- /dev/null +++ b/dist/dexie-relationships.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap 72d92c1e58549155e0c7","webpack:///./src/index.js","webpack:///./~/babel-runtime/core-js/object/keys.js","webpack:///./~/core-js/library/fn/object/keys.js","webpack:///./~/core-js/library/modules/es6.object.keys.js","webpack:///./~/core-js/library/modules/_to-object.js","webpack:///./~/core-js/library/modules/_defined.js","webpack:///./~/core-js/library/modules/_object-keys.js","webpack:///./~/core-js/library/modules/_object-keys-internal.js","webpack:///./~/core-js/library/modules/_has.js","webpack:///./~/core-js/library/modules/_to-iobject.js","webpack:///./~/core-js/library/modules/_iobject.js","webpack:///./~/core-js/library/modules/_cof.js","webpack:///./~/core-js/library/modules/_array-includes.js","webpack:///./~/core-js/library/modules/_to-length.js","webpack:///./~/core-js/library/modules/_to-integer.js","webpack:///./~/core-js/library/modules/_to-index.js","webpack:///./~/core-js/library/modules/_shared-key.js","webpack:///./~/core-js/library/modules/_shared.js","webpack:///./~/core-js/library/modules/_global.js","webpack:///./~/core-js/library/modules/_uid.js","webpack:///./~/core-js/library/modules/_enum-bug-keys.js","webpack:///./~/core-js/library/modules/_object-sap.js","webpack:///./~/core-js/library/modules/_export.js","webpack:///./~/core-js/library/modules/_core.js","webpack:///./~/core-js/library/modules/_ctx.js","webpack:///./~/core-js/library/modules/_a-function.js","webpack:///./~/core-js/library/modules/_hide.js","webpack:///./~/core-js/library/modules/_object-dp.js","webpack:///./~/core-js/library/modules/_an-object.js","webpack:///./~/core-js/library/modules/_is-object.js","webpack:///./~/core-js/library/modules/_ie8-dom-define.js","webpack:///./~/core-js/library/modules/_descriptors.js","webpack:///./~/core-js/library/modules/_fails.js","webpack:///./~/core-js/library/modules/_dom-create.js","webpack:///./~/core-js/library/modules/_to-primitive.js","webpack:///./~/core-js/library/modules/_property-desc.js","webpack:///external \"dexie\"","webpack:///./src/schema-parser.js","webpack:///./~/babel-runtime/helpers/slicedToArray.js","webpack:///./~/babel-runtime/core-js/is-iterable.js","webpack:///./~/core-js/library/fn/is-iterable.js","webpack:///./~/core-js/library/modules/web.dom.iterable.js","webpack:///./~/core-js/library/modules/es6.array.iterator.js","webpack:///./~/core-js/library/modules/_add-to-unscopables.js","webpack:///./~/core-js/library/modules/_iter-step.js","webpack:///./~/core-js/library/modules/_iterators.js","webpack:///./~/core-js/library/modules/_iter-define.js","webpack:///./~/core-js/library/modules/_library.js","webpack:///./~/core-js/library/modules/_redefine.js","webpack:///./~/core-js/library/modules/_iter-create.js","webpack:///./~/core-js/library/modules/_object-create.js","webpack:///./~/core-js/library/modules/_object-dps.js","webpack:///./~/core-js/library/modules/_html.js","webpack:///./~/core-js/library/modules/_set-to-string-tag.js","webpack:///./~/core-js/library/modules/_wks.js","webpack:///./~/core-js/library/modules/_object-gpo.js","webpack:///./~/core-js/library/modules/es6.string.iterator.js","webpack:///./~/core-js/library/modules/_string-at.js","webpack:///./~/core-js/library/modules/core.is-iterable.js","webpack:///./~/core-js/library/modules/_classof.js","webpack:///./~/babel-runtime/core-js/get-iterator.js","webpack:///./~/core-js/library/fn/get-iterator.js","webpack:///./~/core-js/library/modules/core.get-iterator.js","webpack:///./~/core-js/library/modules/core.get-iterator-method.js","webpack:///./~/babel-runtime/helpers/classCallCheck.js","webpack:///./~/babel-runtime/helpers/createClass.js","webpack:///./~/babel-runtime/core-js/object/define-property.js","webpack:///./~/core-js/library/fn/object/define-property.js","webpack:///./~/core-js/library/modules/es6.object.define-property.js"],"names":["Relationships","db","Promise","Table","prototype","with","relationships","toCollection","Collection","self","baseTable","_ctx","table","name","databaseTables","_allTables","usableForeignTables","forEach","column","hasOwnProperty","Error","schema","columns","foreignKeys","filter","targetTable","length","foreign","resolve","toArray","then","queue","rows","row","tables","relatedTable","promise","where","index","equals","targetIndex","relations","push","all","Version","_parseStoresSpec","override","storesSpec","outDbSchema","parser","getForeignKeys","rv","parseStoresSpec","call","getCleanedSchema","addons","SchemaParser","indexes","split","idx","indexOf","map","x","trim","target","join"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACtCA;;;;AACA;;;;;;AAEA,KAAMA,gBAAgB,SAAhBA,aAAgB,CAACC,EAAD,EAAQ;;AAE5B,OAAIC,UAAU,gBAAMA,OAApB,CAF4B,CAEC;;AAE7B;;;;;;;AAOAD,MAAGE,KAAH,CAASC,SAAT,CAAmBC,IAAnB,GAA0B,UAAUC,aAAV,EAAyB;AACjD,YAAO,KAAKC,YAAL,GAAoBF,IAApB,CAAyBC,aAAzB,CAAP;AACD,IAFD;;AAIA;;;;;;;AAOAL,MAAGO,UAAH,CAAcJ,SAAd,CAAwBC,IAAxB,GAA+B,UAAUC,aAAV,EAAyB;AACtD,SAAMG,OAAO,IAAb;AACA,SAAMC,YAAY,KAAKC,IAAL,CAAUC,KAAV,CAAgBC,IAAlC;AACA,SAAMC,iBAAiBb,GAAGc,UAA1B;;AAEA;AACA,SAAIC,sBAAsB,EAA1B;;AAEA;AACA,yBAAYV,aAAZ,EAA2BW,OAA3B,CAAmC,UAACC,MAAD,EAAY;AAC7C,WAAIN,QAAQN,cAAcY,MAAd,CAAZ;;AAEA,WAAI,CAACJ,eAAeK,cAAf,CAA8BP,KAA9B,CAAL,EAA2C;AACzC,eAAM,IAAIQ,KAAJ,CAAU,wBAAwBR,KAAxB,GAAgC,kBAA1C,CAAN;AACD;;AAED,WAAI,CAACE,eAAeF,KAAf,EAAsBS,MAAtB,CAA6BF,cAA7B,CAA4C,aAA5C,CAAL,EAAiE;AAC/D,eAAM,IAAIC,KAAJ,CAAU,wBAAwBR,KAAxB,GAAgC,kCAA1C,CAAN;AACD;;AAED;AACA,WAAIU,UAAUR,eAAeF,KAAf,EAAsBS,MAAtB,CAA6BE,WAA7B,CAAyCC,MAAzC,CAAgD;AAAA,gBAAUN,OAAOO,WAAP,KAAuBf,SAAjC;AAAA,QAAhD,CAAd;;AAEA,WAAIY,QAAQI,MAAR,GAAiB,CAArB,EAAwB;AACtBV,6BAAoBJ,KAApB,IAA6B;AAC3BM,mBAAQA,MADmB;AAE3BS,oBAASL,QAAQ,CAAR;AAFkB,UAA7B;AAID;AACF,MApBD;;AAsBA,YAAO,IAAI,gBAAMpB,OAAV,CAAkB,UAAC0B,OAAD,EAAa;AACpCnB,YAAKoB,OAAL,GAAeC,IAAf,CAAoB,gBAAQ;AAC1B,aAAIC,QAAQ,EAAZ;;AAEA;AACAC,cAAKf,OAAL,CAAa,UAACgB,GAAD,EAAS;AACpB,eAAIC,SAAS,oBAAYlB,mBAAZ,CAAb;;AAEAkB,kBAAOjB,OAAP,CAAe,iBAAS;AACtB,iBAAIkB,eAAenB,oBAAoBJ,KAApB,CAAnB;;AAEA,iBAAIwB,UAAUtB,eAAeF,KAAf,EACXyB,KADW,CACLF,aAAaR,OAAb,CAAqBW,KADhB,EAEXC,MAFW,CAEJN,IAAIE,aAAaR,OAAb,CAAqBa,WAAzB,CAFI,EAGXX,OAHW,GAIXC,IAJW,CAIN,qBAAa;AACjBG,mBAAIE,aAAajB,MAAjB,IAA2BuB,SAA3B;AACD,cANW,CAAd;;AAQAV,mBAAMW,IAAN,CAAWN,OAAX;AACD,YAZD;AAaD,UAhBD;;AAkBA;AACA;AACAlC,iBAAQyC,GAAR,CAAYZ,KAAZ,EAAmBD,IAAnB,CAAwB,YAAM;AAC5BF,mBAAQI,IAAR;AACD,UAFD;AAGD,QA3BD;AA4BD,MA7BM,CAAP;AA8BD,IA7DD;;AA+DA/B,MAAG2C,OAAH,CAAWxC,SAAX,CAAqByC,gBAArB,GAAwC,gBAAMC,QAAN,CACtC7C,GAAG2C,OAAH,CAAWxC,SAAX,CAAqByC,gBADiB,EAEtC;AAAA,YAAmB,UAAUE,UAAV,EAAsBC,WAAtB,EAAmC;AACpD,WAAMC,SAAS,2BAAiBF,UAAjB,CAAf;;AAEA,WAAIxB,cAAc0B,OAAOC,cAAP,EAAlB;AACA;AACA,WAAIC,KAAKC,gBAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,OAAOK,gBAAP,EAA3B,EAAsDN,WAAtD,CAAT;;AAEA;AACA;AACA,2BAAYA,WAAZ,EAAyB/B,OAAzB,CAAiC,iBAAS;AACxC,aAAIM,YAAYJ,cAAZ,CAA2BP,KAA3B,CAAJ,EAAuC;AACrCoC,uBAAYpC,KAAZ,EAAmBW,WAAnB,GAAiCA,YAAYX,KAAZ,CAAjC;AACD;AACF,QAJD;;AAMA,cAAOuC,EAAP;AACD,MAhBD;AAAA,IAFsC,CAAxC;AAmBD,EAxGD;;AA0GA,iBAAMI,MAAN,CAAab,IAAb,CAAkB1C,aAAlB,E;;;;;;AC7GA,mBAAkB,uD;;;;;;ACAlB;AACA,sD;;;;;;ACDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAC,E;;;;;;ACRD;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;;AAEA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA,wBAAuB;AACvB;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA,G;;;;;;ACJA,kBAAiB;;AAEjB;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK,WAAW,eAAe;AAC/B;AACA,MAAK;AACL;AACA,G;;;;;;ACpBA;AACA;AACA;AACA;AACA,4DAA2D;AAC3D,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,oDAAmD;AACnD;AACA,wCAAuC;AACvC,G;;;;;;ACLA;AACA;AACA;AACA,wCAAuC,gC;;;;;;ACHvC;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA,c;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,+BAA8B;AAC9B;AACA;AACA,oDAAmD,OAAO,EAAE;AAC5D,G;;;;;;ACTA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAmE;AACnE;AACA,sFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,gDAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd,eAAc;AACd,eAAc;AACd,eAAc;AACd,gBAAe;AACf,gBAAe;AACf,gBAAe;AACf,iBAAgB;AAChB,0B;;;;;;AC5DA,8BAA6B;AAC7B,sCAAqC,gC;;;;;;ACDrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACnBA;AACA;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA,G;;;;;;ACPA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;AACA;AACA;AACA,G;;;;;;ACfA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,G;;;;;;ACFA;AACA,sEAAsE,gBAAgB,UAAU,GAAG;AACnG,EAAC,E;;;;;;ACFD;AACA;AACA,kCAAiC,QAAQ,gBAAgB,UAAU,GAAG;AACtE,EAAC,E;;;;;;ACHD;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACPA,wB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCAMwD,Y;;AAEJ;;;;;AAKA,yBAAanC,MAAb,EAAqB;AAAA;;AACnB,UAAKA,MAAL,GAAcA,MAAd;AACD;;AAED;;;;;;;;;sCAKkB;AAAA;;AAChB,WAAIE,cAAc,EAAlB;;AAEA,2BAAY,KAAKF,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAIwC,UAAU,MAAKpC,MAAL,CAAYT,KAAZ,EAAmB8C,KAAnB,CAAyB,GAAzB,CAAd;;AAEAnC,qBAAYX,KAAZ,IAAqB6C,QAClBjC,MADkB,CACX;AAAA,kBAAOmC,IAAIC,OAAJ,CAAY,IAAZ,MAAsB,CAAC,CAA9B;AAAA,UADW,EAElBC,GAFkB,CAEd,eAAO;AACV;AADU,gCAEaF,IAAID,KAAJ,CAAU,IAAV,EAAgBG,GAAhB,CAAoB;AAAA,oBAAKC,EAAEC,IAAF,EAAL;AAAA,YAApB,CAFb;AAAA;AAAA,eAEL7C,MAFK;AAAA,eAEG8C,MAFH;;AAIV,kBAAO;AACL1B,oBAAOpB,MADF;AAELO,0BAAauC,OAAON,KAAP,CAAa,GAAb,EAAkB,CAAlB,CAFR;AAGLlB,0BAAawB,OAAON,KAAP,CAAa,GAAb,EAAkB,CAAlB;AAHR,YAAP;AAKD,UAXkB,CAArB;AAYD,QAfD;;AAiBA,cAAOnC,WAAP;AACD;;AAED;;;;;;;;wCAKoB;AAAA;;AAClB,WAAIF,SAAS,EAAb;;AAEA,2BAAY,KAAKA,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAIwC,UAAU,OAAKpC,MAAL,CAAYT,KAAZ,EAAmB8C,KAAnB,CAAyB,GAAzB,CAAd;;AAEA;AACArC,gBAAOT,KAAP,IAAgB6C,QAAQI,GAAR,CAAY;AAAA,kBAAOF,IAAID,KAAJ,CAAU,IAAV,EAAgB,CAAhB,EAAmBK,IAAnB,EAAP;AAAA,UAAZ,EAA8CE,IAA9C,CAAmD,GAAnD,CAAhB;AACD,QALD;;AAOA,cAAO5C,MAAP;AACD;;;;;mBAGYmC,Y;;;;;;AC1Df;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yDAAwD,+BAA+B;AACvF;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA,EAAC,G;;;;;;AClDD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;;AAEA,yGAAwG,OAAO;AAC/G;AACA;AACA;AACA;AACA;AACA,E;;;;;;ACZA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAgC;AAChC,eAAc;AACd,kBAAiB;AACjB;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;;AAEA;AACA;AACA,6B;;;;;;ACjCA,6BAA4B,e;;;;;;ACA5B;AACA,WAAU;AACV,G;;;;;;ACFA,qB;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA4B,aAAa;;AAEzC;AACA;AACA;AACA;AACA;AACA,yCAAwC,oCAAoC;AAC5E,6CAA4C,oCAAoC;AAChF,MAAK,2BAA2B,oCAAoC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB,mBAAmB;AACnC;AACA;AACA,kCAAiC,2BAA2B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,G;;;;;;ACrEA,uB;;;;;;ACAA,0C;;;;;;ACAA;AACA;AACA;AACA;AACA;;AAEA;AACA,4FAAgF,aAAa,EAAE;;AAE/F;AACA,sDAAqD,0BAA0B;AAC/E;AACA,G;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;;;;;;ACxCA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACZA,+E;;;;;;ACAA;AACA;AACA;;AAEA;AACA,mEAAkE,+BAA+B;AACjG,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wB;;;;;;ACVA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH,G;;;;;;ACZA;AACA;;AAEA;AACA;AACA,8BAA6B;AAC7B,eAAc;AACd;AACA,EAAC;AACD;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,WAAU;AACV,EAAC,E;;;;;;AChBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;AACA;AACA;AACA;AACA,0BAAyB,kBAAkB,EAAE;;AAE7C;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACtBA,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA,oBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAC,G;;;;;;AC1BD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,sEAAuE,0CAA0C,E","file":"dexie-relationships.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 72d92c1e58549155e0c7\n **/","import Dexie from 'dexie'\r\nimport SchemaParser from './schema-parser'\r\n\r\nconst Relationships = (db) => {\r\n\r\n let Promise = Dexie.Promise; // Safe to use within transactions. \r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Table.prototype.with = function (relationships) {\r\n return this.toCollection().with(relationships)\r\n }\r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Collection.prototype.with = function (relationships) {\r\n const self = this\r\n const baseTable = this._ctx.table.name\r\n const databaseTables = db._allTables\r\n\r\n // this holds tables that have foreign keys pointing at the current table\r\n let usableForeignTables = {}\r\n\r\n // validate target tables and add them into our usable tables object\r\n Object.keys(relationships).forEach((column) => {\r\n let table = relationships[column]\r\n\r\n if (!databaseTables.hasOwnProperty(table)) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t exist.')\r\n }\r\n\r\n if (!databaseTables[table].schema.hasOwnProperty('foreignKeys')) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t have foreign keys set.')\r\n }\r\n\r\n // remove the foreign keys that don't link to the base table\r\n let columns = databaseTables[table].schema.foreignKeys.filter(column => column.targetTable === baseTable)\r\n\r\n if (columns.length > 0) {\r\n usableForeignTables[table] = {\r\n column: column,\r\n foreign: columns[0]\r\n }\r\n }\r\n })\r\n\r\n return new Dexie.Promise((resolve) => {\r\n self.toArray().then(rows => {\r\n let queue = []\r\n\r\n // loop through all rows and collect all data from the related table\r\n rows.forEach((row) => {\r\n let tables = Object.keys(usableForeignTables)\r\n\r\n tables.forEach(table => {\r\n let relatedTable = usableForeignTables[table]\r\n\r\n let promise = databaseTables[table]\r\n .where(relatedTable.foreign.index)\r\n .equals(row[relatedTable.foreign.targetIndex])\r\n .toArray()\r\n .then(relations => {\r\n row[relatedTable.column] = relations\r\n })\r\n\r\n queue.push(promise)\r\n })\r\n })\r\n\r\n // we need to wait until all data is retrieved\r\n // once it's there we can resolve the promise\r\n Promise.all(queue).then(() => {\r\n resolve(rows)\r\n })\r\n })\r\n })\r\n }\r\n\r\n db.Version.prototype._parseStoresSpec = Dexie.override(\r\n db.Version.prototype._parseStoresSpec,\r\n parseStoresSpec => function (storesSpec, outDbSchema) {\r\n const parser = new SchemaParser(storesSpec)\r\n\r\n let foreignKeys = parser.getForeignKeys()\r\n // call the original method\r\n let rv = parseStoresSpec.call(this, parser.getCleanedSchema(), outDbSchema)\r\n\r\n // set foreign keys into database table objects\r\n // to use later in 'with' method\r\n Object.keys(outDbSchema).forEach(table => {\r\n if (foreignKeys.hasOwnProperty(table)) {\r\n outDbSchema[table].foreignKeys = foreignKeys[table]\r\n }\r\n })\r\n\r\n return rv\r\n })\r\n}\r\n\r\nDexie.addons.push(Relationships)\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/keys\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/object/keys.js\n ** module id = 1\n ** module chunks = 0\n **/","require('../../modules/es6.object.keys');\nmodule.exports = require('../../modules/_core').Object.keys;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/object/keys.js\n ** module id = 2\n ** module chunks = 0\n **/","// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object')\n , $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function(){\n return function keys(it){\n return $keys(toObject(it));\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.object.keys.js\n ** module id = 3\n ** module chunks = 0\n **/","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function(it){\n return Object(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-object.js\n ** module id = 4\n ** module chunks = 0\n **/","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function(it){\n if(it == undefined)throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_defined.js\n ** module id = 5\n ** module chunks = 0\n **/","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal')\n , enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O){\n return $keys(O, enumBugKeys);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-keys.js\n ** module id = 6\n ** module chunks = 0\n **/","var has = require('./_has')\n , toIObject = require('./_to-iobject')\n , arrayIndexOf = require('./_array-includes')(false)\n , IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function(object, names){\n var O = toIObject(object)\n , i = 0\n , result = []\n , key;\n for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while(names.length > i)if(has(O, key = names[i++])){\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-keys-internal.js\n ** module id = 7\n ** module chunks = 0\n **/","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function(it, key){\n return hasOwnProperty.call(it, key);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_has.js\n ** module id = 8\n ** module chunks = 0\n **/","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject')\n , defined = require('./_defined');\nmodule.exports = function(it){\n return IObject(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-iobject.js\n ** module id = 9\n ** module chunks = 0\n **/","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iobject.js\n ** module id = 10\n ** module chunks = 0\n **/","var toString = {}.toString;\n\nmodule.exports = function(it){\n return toString.call(it).slice(8, -1);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_cof.js\n ** module id = 11\n ** module chunks = 0\n **/","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject')\n , toLength = require('./_to-length')\n , toIndex = require('./_to-index');\nmodule.exports = function(IS_INCLUDES){\n return function($this, el, fromIndex){\n var O = toIObject($this)\n , length = toLength(O.length)\n , index = toIndex(fromIndex, length)\n , value;\n // Array#includes uses SameValueZero equality algorithm\n if(IS_INCLUDES && el != el)while(length > index){\n value = O[index++];\n if(value != value)return true;\n // Array#toIndex ignores holes, Array#includes - not\n } else for(;length > index; index++)if(IS_INCLUDES || index in O){\n if(O[index] === el)return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_array-includes.js\n ** module id = 12\n ** module chunks = 0\n **/","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer')\n , min = Math.min;\nmodule.exports = function(it){\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-length.js\n ** module id = 13\n ** module chunks = 0\n **/","// 7.1.4 ToInteger\nvar ceil = Math.ceil\n , floor = Math.floor;\nmodule.exports = function(it){\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-integer.js\n ** module id = 14\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , max = Math.max\n , min = Math.min;\nmodule.exports = function(index, length){\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-index.js\n ** module id = 15\n ** module chunks = 0\n **/","var shared = require('./_shared')('keys')\n , uid = require('./_uid');\nmodule.exports = function(key){\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_shared-key.js\n ** module id = 16\n ** module chunks = 0\n **/","var global = require('./_global')\n , SHARED = '__core-js_shared__'\n , store = global[SHARED] || (global[SHARED] = {});\nmodule.exports = function(key){\n return store[key] || (store[key] = {});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_shared.js\n ** module id = 17\n ** module chunks = 0\n **/","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();\nif(typeof __g == 'number')__g = global; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_global.js\n ** module id = 18\n ** module chunks = 0\n **/","var id = 0\n , px = Math.random();\nmodule.exports = function(key){\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_uid.js\n ** module id = 19\n ** module chunks = 0\n **/","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_enum-bug-keys.js\n ** module id = 20\n ** module chunks = 0\n **/","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export')\n , core = require('./_core')\n , fails = require('./_fails');\nmodule.exports = function(KEY, exec){\n var fn = (core.Object || {})[KEY] || Object[KEY]\n , exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-sap.js\n ** module id = 21\n ** module chunks = 0\n **/","var global = require('./_global')\n , core = require('./_core')\n , ctx = require('./_ctx')\n , hide = require('./_hide')\n , PROTOTYPE = 'prototype';\n\nvar $export = function(type, name, source){\n var IS_FORCED = type & $export.F\n , IS_GLOBAL = type & $export.G\n , IS_STATIC = type & $export.S\n , IS_PROTO = type & $export.P\n , IS_BIND = type & $export.B\n , IS_WRAP = type & $export.W\n , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})\n , expProto = exports[PROTOTYPE]\n , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]\n , key, own, out;\n if(IS_GLOBAL)source = name;\n for(key in source){\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if(own && key in exports)continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function(C){\n var F = function(a, b, c){\n if(this instanceof C){\n switch(arguments.length){\n case 0: return new C;\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if(IS_PROTO){\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library` \nmodule.exports = $export;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_export.js\n ** module id = 22\n ** module chunks = 0\n **/","var core = module.exports = {version: '2.4.0'};\nif(typeof __e == 'number')__e = core; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_core.js\n ** module id = 23\n ** module chunks = 0\n **/","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function(fn, that, length){\n aFunction(fn);\n if(that === undefined)return fn;\n switch(length){\n case 1: return function(a){\n return fn.call(that, a);\n };\n case 2: return function(a, b){\n return fn.call(that, a, b);\n };\n case 3: return function(a, b, c){\n return fn.call(that, a, b, c);\n };\n }\n return function(/* ...args */){\n return fn.apply(that, arguments);\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_ctx.js\n ** module id = 24\n ** module chunks = 0\n **/","module.exports = function(it){\n if(typeof it != 'function')throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_a-function.js\n ** module id = 25\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function(object, key, value){\n return dP.f(object, key, createDesc(1, value));\n} : function(object, key, value){\n object[key] = value;\n return object;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_hide.js\n ** module id = 26\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , IE8_DOM_DEFINE = require('./_ie8-dom-define')\n , toPrimitive = require('./_to-primitive')\n , dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if(IE8_DOM_DEFINE)try {\n return dP(O, P, Attributes);\n } catch(e){ /* empty */ }\n if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');\n if('value' in Attributes)O[P] = Attributes.value;\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-dp.js\n ** module id = 27\n ** module chunks = 0\n **/","var isObject = require('./_is-object');\nmodule.exports = function(it){\n if(!isObject(it))throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_an-object.js\n ** module id = 28\n ** module chunks = 0\n **/","module.exports = function(it){\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_is-object.js\n ** module id = 29\n ** module chunks = 0\n **/","module.exports = !require('./_descriptors') && !require('./_fails')(function(){\n return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_ie8-dom-define.js\n ** module id = 30\n ** module chunks = 0\n **/","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function(){\n return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_descriptors.js\n ** module id = 31\n ** module chunks = 0\n **/","module.exports = function(exec){\n try {\n return !!exec();\n } catch(e){\n return true;\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_fails.js\n ** module id = 32\n ** module chunks = 0\n **/","var isObject = require('./_is-object')\n , document = require('./_global').document\n // in old IE typeof document.createElement is 'object'\n , is = isObject(document) && isObject(document.createElement);\nmodule.exports = function(it){\n return is ? document.createElement(it) : {};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_dom-create.js\n ** module id = 33\n ** module chunks = 0\n **/","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function(it, S){\n if(!isObject(it))return it;\n var fn, val;\n if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;\n if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-primitive.js\n ** module id = 34\n ** module chunks = 0\n **/","module.exports = function(bitmap, value){\n return {\n enumerable : !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable : !(bitmap & 4),\n value : value\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_property-desc.js\n ** module id = 35\n ** module chunks = 0\n **/","module.exports = dexie;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"dexie\"\n ** module id = 36\n ** module chunks = 0\n **/","class SchemaParser {\r\n\r\n /**\r\n * Schema parser\r\n *\r\n * @param schema\r\n */\r\n constructor (schema) {\r\n this.schema = schema\r\n }\r\n\r\n /**\r\n * Extracts foreign keys from the schema\r\n *\r\n * @returns Object\r\n */\r\n getForeignKeys () {\r\n let foreignKeys = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n foreignKeys[table] = indexes\r\n .filter(idx => idx.indexOf('->') !== -1)\r\n .map(idx => {\r\n // split the column and foreign table info\r\n let [column, target] = idx.split('->').map(x => x.trim())\r\n\r\n return {\r\n index: column,\r\n targetTable: target.split('.')[0],\r\n targetIndex: target.split('.')[1]\r\n }\r\n })\r\n })\r\n\r\n return foreignKeys\r\n }\r\n\r\n /**\r\n * Get schema without the foreign key definitions\r\n *\r\n * @returns Object\r\n */\r\n getCleanedSchema () {\r\n let schema = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n // Remove foreign keys syntax before calling the original method\r\n schema[table] = indexes.map(idx => idx.split('->')[0].trim()).join(',')\r\n })\r\n\r\n return schema\r\n }\r\n}\r\n\r\nexport default SchemaParser\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/schema-parser.js\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _isIterable2 = require(\"../core-js/is-iterable\");\n\nvar _isIterable3 = _interopRequireDefault(_isIterable2);\n\nvar _getIterator2 = require(\"../core-js/get-iterator\");\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if ((0, _isIterable3.default)(Object(arr))) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/slicedToArray.js\n ** module id = 38\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/is-iterable\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/is-iterable.js\n ** module id = 39\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.is-iterable');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/is-iterable.js\n ** module id = 40\n ** module chunks = 0\n **/","require('./es6.array.iterator');\nvar global = require('./_global')\n , hide = require('./_hide')\n , Iterators = require('./_iterators')\n , TO_STRING_TAG = require('./_wks')('toStringTag');\n\nfor(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){\n var NAME = collections[i]\n , Collection = global[NAME]\n , proto = Collection && Collection.prototype;\n if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/web.dom.iterable.js\n ** module id = 41\n ** module chunks = 0\n **/","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables')\n , step = require('./_iter-step')\n , Iterators = require('./_iterators')\n , toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function(iterated, kind){\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , kind = this._k\n , index = this._i++;\n if(!O || index >= O.length){\n this._t = undefined;\n return step(1);\n }\n if(kind == 'keys' )return step(0, index);\n if(kind == 'values')return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.array.iterator.js\n ** module id = 42\n ** module chunks = 0\n **/","module.exports = function(){ /* empty */ };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_add-to-unscopables.js\n ** module id = 43\n ** module chunks = 0\n **/","module.exports = function(done, value){\n return {value: value, done: !!done};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-step.js\n ** module id = 44\n ** module chunks = 0\n **/","module.exports = {};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iterators.js\n ** module id = 45\n ** module chunks = 0\n **/","'use strict';\nvar LIBRARY = require('./_library')\n , $export = require('./_export')\n , redefine = require('./_redefine')\n , hide = require('./_hide')\n , has = require('./_has')\n , Iterators = require('./_iterators')\n , $iterCreate = require('./_iter-create')\n , setToStringTag = require('./_set-to-string-tag')\n , getPrototypeOf = require('./_object-gpo')\n , ITERATOR = require('./_wks')('iterator')\n , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`\n , FF_ITERATOR = '@@iterator'\n , KEYS = 'keys'\n , VALUES = 'values';\n\nvar returnThis = function(){ return this; };\n\nmodule.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){\n $iterCreate(Constructor, NAME, next);\n var getMethod = function(kind){\n if(!BUGGY && kind in proto)return proto[kind];\n switch(kind){\n case KEYS: return function keys(){ return new Constructor(this, kind); };\n case VALUES: return function values(){ return new Constructor(this, kind); };\n } return function entries(){ return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator'\n , DEF_VALUES = DEFAULT == VALUES\n , VALUES_BUG = false\n , proto = Base.prototype\n , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]\n , $default = $native || getMethod(DEFAULT)\n , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined\n , $anyNative = NAME == 'Array' ? proto.entries || $native : $native\n , methods, key, IteratorPrototype;\n // Fix native\n if($anyNative){\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base));\n if(IteratorPrototype !== Object.prototype){\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if(DEF_VALUES && $native && $native.name !== VALUES){\n VALUES_BUG = true;\n $default = function values(){ return $native.call(this); };\n }\n // Define iterator\n if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if(DEFAULT){\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if(FORCED)for(key in methods){\n if(!(key in proto))redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-define.js\n ** module id = 46\n ** module chunks = 0\n **/","module.exports = true;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_library.js\n ** module id = 47\n ** module chunks = 0\n **/","module.exports = require('./_hide');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_redefine.js\n ** module id = 48\n ** module chunks = 0\n **/","'use strict';\nvar create = require('./_object-create')\n , descriptor = require('./_property-desc')\n , setToStringTag = require('./_set-to-string-tag')\n , IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function(){ return this; });\n\nmodule.exports = function(Constructor, NAME, next){\n Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-create.js\n ** module id = 49\n ** module chunks = 0\n **/","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object')\n , dPs = require('./_object-dps')\n , enumBugKeys = require('./_enum-bug-keys')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , Empty = function(){ /* empty */ }\n , PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function(){\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe')\n , i = enumBugKeys.length\n , lt = '<'\n , gt = '>'\n , iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties){\n var result;\n if(O !== null){\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty;\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-create.js\n ** module id = 50\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , anObject = require('./_an-object')\n , getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties){\n anObject(O);\n var keys = getKeys(Properties)\n , length = keys.length\n , i = 0\n , P;\n while(length > i)dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-dps.js\n ** module id = 51\n ** module chunks = 0\n **/","module.exports = require('./_global').document && document.documentElement;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_html.js\n ** module id = 52\n ** module chunks = 0\n **/","var def = require('./_object-dp').f\n , has = require('./_has')\n , TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function(it, tag, stat){\n if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_set-to-string-tag.js\n ** module id = 53\n ** module chunks = 0\n **/","var store = require('./_shared')('wks')\n , uid = require('./_uid')\n , Symbol = require('./_global').Symbol\n , USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function(name){\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_wks.js\n ** module id = 54\n ** module chunks = 0\n **/","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has')\n , toObject = require('./_to-object')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function(O){\n O = toObject(O);\n if(has(O, IE_PROTO))return O[IE_PROTO];\n if(typeof O.constructor == 'function' && O instanceof O.constructor){\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-gpo.js\n ** module id = 55\n ** module chunks = 0\n **/","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function(iterated){\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , index = this._i\n , point;\n if(index >= O.length)return {value: undefined, done: true};\n point = $at(O, index);\n this._i += point.length;\n return {value: point, done: false};\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.string.iterator.js\n ** module id = 56\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function(TO_STRING){\n return function(that, pos){\n var s = String(defined(that))\n , i = toInteger(pos)\n , l = s.length\n , a, b;\n if(i < 0 || i >= l)return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_string-at.js\n ** module id = 57\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').isIterable = function(it){\n var O = Object(it);\n return O[ITERATOR] !== undefined\n || '@@iterator' in O\n || Iterators.hasOwnProperty(classof(O));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.is-iterable.js\n ** module id = 58\n ** module chunks = 0\n **/","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof')\n , TAG = require('./_wks')('toStringTag')\n // ES3 wrong here\n , ARG = cof(function(){ return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function(it, key){\n try {\n return it[key];\n } catch(e){ /* empty */ }\n};\n\nmodule.exports = function(it){\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_classof.js\n ** module id = 59\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/get-iterator\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/get-iterator.js\n ** module id = 60\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.get-iterator');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/get-iterator.js\n ** module id = 61\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , get = require('./core.get-iterator-method');\nmodule.exports = require('./_core').getIterator = function(it){\n var iterFn = get(it);\n if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');\n return anObject(iterFn.call(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.get-iterator.js\n ** module id = 62\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function(it){\n if(it != undefined)return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.get-iterator-method.js\n ** module id = 63\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nexports.default = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/classCallCheck.js\n ** module id = 64\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _defineProperty = require(\"../core-js/object/define-property\");\n\nvar _defineProperty2 = _interopRequireDefault(_defineProperty);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n (0, _defineProperty2.default)(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/createClass.js\n ** module id = 65\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/define-property\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/object/define-property.js\n ** module id = 66\n ** module chunks = 0\n **/","require('../../modules/es6.object.define-property');\nvar $Object = require('../../modules/_core').Object;\nmodule.exports = function defineProperty(it, key, desc){\n return $Object.defineProperty(it, key, desc);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/object/define-property.js\n ** module id = 67\n ** module chunks = 0\n **/","var $export = require('./_export');\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !require('./_descriptors'), 'Object', {defineProperty: require('./_object-dp').f});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.object.define-property.js\n ** module id = 68\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index d5ea1e9..d83b80e 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,12 @@ "directories": { "test": "tests" }, - "dependencies": { - }, + "dependencies": {}, "devDependencies": { "babel-cli": "^6.16.0", + "babel-core": "^6.18.0", "babel-loader": "^6.2.5", + "babel-plugin-transform-runtime": "^6.15.0", "babel-preset-es2015": "^6.16.0", "chai": "^3.5.0", "eslint": "^3.8.1", @@ -21,13 +22,15 @@ "webpack": "^1.13.2" }, "scripts": { - "build": "babel --presets es2015 src/index.js -o dist/dexie-relationships.js", + "build": "webpack", "test": "npm run eslint && npm run mocha", "eslint": "eslint src", "mocha": "./node_modules/.bin/mocha --compilers js:babel-core/register --reporter spec" }, "babel": { - "presets": ["es2015"] + "presets": [ + "es2015" + ] }, "repository": { "type": "git", diff --git a/src/index.js b/src/index.js index 0e3894e..0dcbdd2 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,9 @@ import Dexie from 'dexie' import SchemaParser from './schema-parser' const Relationships = (db) => { + + let Promise = Dexie.Promise; // Safe to use within transactions. + /** * Iterate through all items and collect related records * diff --git a/webpack.config.js b/webpack.config.js index d05b32d..a4c4b92 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,6 +3,7 @@ var webpack = require('webpack'); module.exports = { entry: './src/index.js', + externals: ['dexie'], output: { path: path.resolve(__dirname, 'dist'), filename: 'dexie-relationships.js' @@ -11,6 +12,7 @@ module.exports = { loaders: [ { test: /\.js$/, + exclude: /(node_modules|bower_components)/, loader: 'babel-loader', query: { presets: ['es2015'] From 829b46500b9171468212956c5de1a1d764cbac06 Mon Sep 17 00:00:00 2001 From: David Fahlander Date: Wed, 26 Oct 2016 10:46:26 +0200 Subject: [PATCH 2/6] Fixed eslint issues. npm test succeeds. --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 0dcbdd2..e34c26a 100644 --- a/src/index.js +++ b/src/index.js @@ -2,8 +2,8 @@ import Dexie from 'dexie' import SchemaParser from './schema-parser' const Relationships = (db) => { - - let Promise = Dexie.Promise; // Safe to use within transactions. + // Use Dexie.Promise to ensure transaction safety. + let Promise = Dexie.Promise /** * Iterate through all items and collect related records @@ -54,7 +54,7 @@ const Relationships = (db) => { } }) - return new Dexie.Promise((resolve) => { + return new Promise((resolve) => { self.toArray().then(rows => { let queue = [] From 5dedffb5bdbcb803aa5bc4eca4161fe664029c8b Mon Sep 17 00:00:00 2001 From: David Fahlander Date: Wed, 26 Oct 2016 11:55:00 +0200 Subject: [PATCH 3/6] wip: non-compling code. In the midst of optimizing --- src/index.js | 44 +++++++++++++++++++++++++++++++++++++++++++- src/utils.js | 9 +++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/utils.js diff --git a/src/index.js b/src/index.js index e34c26a..454d60d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ import Dexie from 'dexie' import SchemaParser from './schema-parser' +import {isIndexableType} from './utils' const Relationships = (db) => { // Use Dexie.Promise to ensure transaction safety. @@ -24,7 +25,6 @@ const Relationships = (db) => { * @returns {Dexie.Promise} */ db.Collection.prototype.with = function (relationships) { - const self = this const baseTable = this._ctx.table.name const databaseTables = db._allTables @@ -54,6 +54,48 @@ const Relationships = (db) => { } }) + let foreignTableNames = Object.keys(usableForeignTables) + + return this.toArray().then(rows => { + // + // Extract the mix of all related keys in all rows + // + let queries = foreignTableNames + .map (tableName => { + // For each foreign table, query all items that any row refers to + let foreignTable = usableForeignTables[tableName] + let allRelatedKeys = rows + .map(row => row[foreignTable.foreign.targetIndex]) + .filter (isIndexableType) + + // Build the Collection to retrieve all related items + return databaseTables[table] + .where (foreignTable.foreign.index) + .anyOf (allRelatedKeys) + }) + + // Execute queries in parallell + let queryPromises = queries.map(query => query.toArray()); + + // + // Await all results and then try mapping each response + // with its corresponding row and attach related items onto each row + // + return Promise.all(queryPromises).then (queryResults => { + foreignTableNames.forEach((tableName, idx) => { + let foreignTable = usableForeignTables[tableName] + let result = queryResults[idx] + let targetIndex = foreignTable.foreign.targetIndex + let foreignIndex = foreignTable.foreign.index + + }); + }); + return Promise.all (queries.map(query => query.toArray())).then(results => { + let {table, allRelatedObjs} = results; + + }) + }) + return new Promise((resolve) => { self.toArray().then(rows => { let queue = [] diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..5cb27ed --- /dev/null +++ b/src/utils.js @@ -0,0 +1,9 @@ + +export function isIndexableType (value) { + return value != null && (// Using "!=" instead of "!==" to check for both null and undefined! + typeof value === 'string' || + typeof value === 'number' || + value instanceof Date || + (Array.isArray(value) && value.every(isIndexableType)) + ) +} From 22ef63066d4196fae182c0d9ca0835cca5619298 Mon Sep 17 00:00:00 2001 From: David Fahlander Date: Wed, 26 Oct 2016 17:24:13 +0200 Subject: [PATCH 4/6] Added browser-based tests and verified it works. npm test will still only test the non-browser unit tests. Must install http-server and do 'http-server .', then browse to localhost/test/browser/test-runner.html --- dist/dexie-relationships.js | 521 +++--- dist/dexie-relationships.js.map | 2 +- package.json | 6 +- src/index.js | 84 +- src/utils.js | 12 +- test/browser/all-browser-tests.js | 2 + test/browser/bundle.js | 2797 +++++++++++++++++++++++++++++ test/browser/bundle.js.map | 1 + test/browser/simple.js | 79 + test/browser/testrunner.html | 18 + test/browser/webpack.config.js | 27 + 11 files changed, 3261 insertions(+), 288 deletions(-) create mode 100644 test/browser/all-browser-tests.js create mode 100644 test/browser/bundle.js create mode 100644 test/browser/bundle.js.map create mode 100644 test/browser/simple.js create mode 100644 test/browser/testrunner.html create mode 100644 test/browser/webpack.config.js diff --git a/dist/dexie-relationships.js b/dist/dexie-relationships.js index e1da540..24d89d4 100644 --- a/dist/dexie-relationships.js +++ b/dist/dexie-relationships.js @@ -46,23 +46,26 @@ 'use strict'; - var _keys = __webpack_require__(1); + var _stringify = __webpack_require__(1); - var _keys2 = _interopRequireDefault(_keys); + var _stringify2 = _interopRequireDefault(_stringify); - var _dexie = __webpack_require__(36); + var _keys = __webpack_require__(4); - var _dexie2 = _interopRequireDefault(_dexie); + var _keys2 = _interopRequireDefault(_keys); - var _schemaParser = __webpack_require__(37); + var _schemaParser = __webpack_require__(38); var _schemaParser2 = _interopRequireDefault(_schemaParser); + var _utils = __webpack_require__(70); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Relationships = function Relationships(db) { - - var Promise = _dexie2.default.Promise; // Safe to use within transactions. + var Dexie = db.constructor; + // Use Dexie.Promise to ensure transaction safety. + var Promise = Dexie.Promise; /** * Iterate through all items and collect related records @@ -83,7 +86,6 @@ * @returns {Dexie.Promise} */ db.Collection.prototype.with = function (relationships) { - var self = this; var baseTable = this._ctx.table.name; var databaseTables = db._allTables; @@ -115,35 +117,67 @@ } }); - return new _dexie2.default.Promise(function (resolve) { - self.toArray().then(function (rows) { - var queue = []; + var foreignTableNames = (0, _keys2.default)(usableForeignTables); + + return this.toArray().then(function (rows) { + // + // Extract the mix of all related keys in all rows + // + var queries = foreignTableNames.map(function (tableName) { + // For each foreign table, query all items that any row refers to + var foreignTable = usableForeignTables[tableName]; + var allRelatedKeys = rows.map(function (row) { + return row[foreignTable.foreign.targetIndex]; + }).filter(_utils.isIndexableType); + + // Build the Collection to retrieve all related items + return databaseTables[tableName].where(foreignTable.foreign.index).anyOf(allRelatedKeys); + }); - // loop through all rows and collect all data from the related table - rows.forEach(function (row) { - var tables = (0, _keys2.default)(usableForeignTables); + // Execute queries in parallell + var queryPromises = queries.map(function (query) { + return query.toArray(); + }); - tables.forEach(function (table) { - var relatedTable = usableForeignTables[table]; + // + // Await all results and then try mapping each response + // with its corresponding row and attach related items onto each row + // + return Promise.all(queryPromises).then(function (queryResults) { + foreignTableNames.forEach(function (tableName, idx) { + var foreignTable = usableForeignTables[tableName]; + var result = queryResults[idx]; + var targetIndex = foreignTable.foreign.targetIndex; + var foreignIndex = foreignTable.foreign.index; + var column = foreignTable.column; + + // Create a lookup by targetIndex (normally 'id') + // and set the column onto the target + var lookup = {}; + rows.forEach(function (row) { + var arrayProperty = []; + row[column] = arrayProperty; + lookup[row[targetIndex]] = arrayProperty; + }); - var promise = databaseTables[table].where(relatedTable.foreign.index).equals(row[relatedTable.foreign.targetIndex]).toArray().then(function (relations) { - row[relatedTable.column] = relations; - }); + // Populate column on each row + result.forEach(function (record) { + var foreignKey = record[foreignIndex]; + var arrayProperty = lookup[foreignKey]; + if (!arrayProperty) { + throw new Error('Could not lookup foreign key where ' + (tableName + '.' + foreignIndex + ' == ' + baseTable + '.' + column + '. ') + ('The content of the failing key was: ' + (0, _stringify2.default)(foreignKey) + '.')); + } - queue.push(promise); + arrayProperty.push(record); }); }); - - // we need to wait until all data is retrieved - // once it's there we can resolve the promise - Promise.all(queue).then(function () { - resolve(rows); - }); + }).then(function () { + return rows; }); }); }; - db.Version.prototype._parseStoresSpec = _dexie2.default.override(db.Version.prototype._parseStoresSpec, function (parseStoresSpec) { + db.Version.prototype._parseStoresSpec = Dexie.override(db.Version.prototype._parseStoresSpec, function (parseStoresSpec) { return function (storesSpec, outDbSchema) { var parser = new _schemaParser2.default(storesSpec); @@ -164,7 +198,7 @@ }); }; - _dexie2.default.addons.push(Relationships); + module.exports = Relationships; /***/ }, /* 1 */ @@ -176,35 +210,58 @@ /* 2 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(3); - module.exports = __webpack_require__(23).Object.keys; + var core = __webpack_require__(3) + , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify}); + module.exports = function stringify(it){ // eslint-disable-line no-unused-vars + return $JSON.stringify.apply($JSON, arguments); + }; /***/ }, /* 3 */ +/***/ function(module, exports) { + + var core = module.exports = {version: '2.4.0'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(5), __esModule: true }; + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(6); + module.exports = __webpack_require__(3).Object.keys; + +/***/ }, +/* 6 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.14 Object.keys(O) - var toObject = __webpack_require__(4) - , $keys = __webpack_require__(6); + var toObject = __webpack_require__(7) + , $keys = __webpack_require__(9); - __webpack_require__(21)('keys', function(){ + __webpack_require__(24)('keys', function(){ return function keys(it){ return $keys(toObject(it)); }; }); /***/ }, -/* 4 */ +/* 7 */ /***/ function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) - var defined = __webpack_require__(5); + var defined = __webpack_require__(8); module.exports = function(it){ return Object(defined(it)); }; /***/ }, -/* 5 */ +/* 8 */ /***/ function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) @@ -214,25 +271,25 @@ }; /***/ }, -/* 6 */ +/* 9 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) - var $keys = __webpack_require__(7) - , enumBugKeys = __webpack_require__(20); + var $keys = __webpack_require__(10) + , enumBugKeys = __webpack_require__(23); module.exports = Object.keys || function keys(O){ return $keys(O, enumBugKeys); }; /***/ }, -/* 7 */ +/* 10 */ /***/ function(module, exports, __webpack_require__) { - var has = __webpack_require__(8) - , toIObject = __webpack_require__(9) - , arrayIndexOf = __webpack_require__(12)(false) - , IE_PROTO = __webpack_require__(16)('IE_PROTO'); + var has = __webpack_require__(11) + , toIObject = __webpack_require__(12) + , arrayIndexOf = __webpack_require__(15)(false) + , IE_PROTO = __webpack_require__(19)('IE_PROTO'); module.exports = function(object, names){ var O = toIObject(object) @@ -248,7 +305,7 @@ }; /***/ }, -/* 8 */ +/* 11 */ /***/ function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; @@ -257,28 +314,28 @@ }; /***/ }, -/* 9 */ +/* 12 */ /***/ function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings - var IObject = __webpack_require__(10) - , defined = __webpack_require__(5); + var IObject = __webpack_require__(13) + , defined = __webpack_require__(8); module.exports = function(it){ return IObject(defined(it)); }; /***/ }, -/* 10 */ +/* 13 */ /***/ function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings - var cof = __webpack_require__(11); + var cof = __webpack_require__(14); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }, -/* 11 */ +/* 14 */ /***/ function(module, exports) { var toString = {}.toString; @@ -288,14 +345,14 @@ }; /***/ }, -/* 12 */ +/* 15 */ /***/ function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes - var toIObject = __webpack_require__(9) - , toLength = __webpack_require__(13) - , toIndex = __webpack_require__(15); + var toIObject = __webpack_require__(12) + , toLength = __webpack_require__(16) + , toIndex = __webpack_require__(18); module.exports = function(IS_INCLUDES){ return function($this, el, fromIndex){ var O = toIObject($this) @@ -314,18 +371,18 @@ }; /***/ }, -/* 13 */ +/* 16 */ /***/ function(module, exports, __webpack_require__) { // 7.1.15 ToLength - var toInteger = __webpack_require__(14) + var toInteger = __webpack_require__(17) , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }, -/* 14 */ +/* 17 */ /***/ function(module, exports) { // 7.1.4 ToInteger @@ -336,10 +393,10 @@ }; /***/ }, -/* 15 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { - var toInteger = __webpack_require__(14) + var toInteger = __webpack_require__(17) , max = Math.max , min = Math.min; module.exports = function(index, length){ @@ -348,20 +405,20 @@ }; /***/ }, -/* 16 */ +/* 19 */ /***/ function(module, exports, __webpack_require__) { - var shared = __webpack_require__(17)('keys') - , uid = __webpack_require__(19); + var shared = __webpack_require__(20)('keys') + , uid = __webpack_require__(22); module.exports = function(key){ return shared[key] || (shared[key] = uid(key)); }; /***/ }, -/* 17 */ +/* 20 */ /***/ function(module, exports, __webpack_require__) { - var global = __webpack_require__(18) + var global = __webpack_require__(21) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ @@ -369,7 +426,7 @@ }; /***/ }, -/* 18 */ +/* 21 */ /***/ function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 @@ -378,7 +435,7 @@ if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef /***/ }, -/* 19 */ +/* 22 */ /***/ function(module, exports) { var id = 0 @@ -388,7 +445,7 @@ }; /***/ }, -/* 20 */ +/* 23 */ /***/ function(module, exports) { // IE 8- don't enum bug keys @@ -397,13 +454,13 @@ ).split(','); /***/ }, -/* 21 */ +/* 24 */ /***/ function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(22) - , core = __webpack_require__(23) - , fails = __webpack_require__(32); + var $export = __webpack_require__(25) + , core = __webpack_require__(3) + , fails = __webpack_require__(34); module.exports = function(KEY, exec){ var fn = (core.Object || {})[KEY] || Object[KEY] , exp = {}; @@ -412,13 +469,13 @@ }; /***/ }, -/* 22 */ +/* 25 */ /***/ function(module, exports, __webpack_require__) { - var global = __webpack_require__(18) - , core = __webpack_require__(23) - , ctx = __webpack_require__(24) - , hide = __webpack_require__(26) + var global = __webpack_require__(21) + , core = __webpack_require__(3) + , ctx = __webpack_require__(26) + , hide = __webpack_require__(28) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ @@ -478,18 +535,11 @@ module.exports = $export; /***/ }, -/* 23 */ -/***/ function(module, exports) { - - var core = module.exports = {version: '2.4.0'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - -/***/ }, -/* 24 */ +/* 26 */ /***/ function(module, exports, __webpack_require__) { // optional / simple context binding - var aFunction = __webpack_require__(25); + var aFunction = __webpack_require__(27); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; @@ -510,7 +560,7 @@ }; /***/ }, -/* 25 */ +/* 27 */ /***/ function(module, exports) { module.exports = function(it){ @@ -519,12 +569,12 @@ }; /***/ }, -/* 26 */ +/* 28 */ /***/ function(module, exports, __webpack_require__) { - var dP = __webpack_require__(27) - , createDesc = __webpack_require__(35); - module.exports = __webpack_require__(31) ? function(object, key, value){ + var dP = __webpack_require__(29) + , createDesc = __webpack_require__(37); + module.exports = __webpack_require__(33) ? function(object, key, value){ return dP.f(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; @@ -532,15 +582,15 @@ }; /***/ }, -/* 27 */ +/* 29 */ /***/ function(module, exports, __webpack_require__) { - var anObject = __webpack_require__(28) - , IE8_DOM_DEFINE = __webpack_require__(30) - , toPrimitive = __webpack_require__(34) + var anObject = __webpack_require__(30) + , IE8_DOM_DEFINE = __webpack_require__(32) + , toPrimitive = __webpack_require__(36) , dP = Object.defineProperty; - exports.f = __webpack_require__(31) ? Object.defineProperty : function defineProperty(O, P, Attributes){ + exports.f = __webpack_require__(33) ? Object.defineProperty : function defineProperty(O, P, Attributes){ anObject(O); P = toPrimitive(P, true); anObject(Attributes); @@ -553,17 +603,17 @@ }; /***/ }, -/* 28 */ +/* 30 */ /***/ function(module, exports, __webpack_require__) { - var isObject = __webpack_require__(29); + var isObject = __webpack_require__(31); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; /***/ }, -/* 29 */ +/* 31 */ /***/ function(module, exports) { module.exports = function(it){ @@ -571,24 +621,24 @@ }; /***/ }, -/* 30 */ +/* 32 */ /***/ function(module, exports, __webpack_require__) { - module.exports = !__webpack_require__(31) && !__webpack_require__(32)(function(){ - return Object.defineProperty(__webpack_require__(33)('div'), 'a', {get: function(){ return 7; }}).a != 7; + module.exports = !__webpack_require__(33) && !__webpack_require__(34)(function(){ + return Object.defineProperty(__webpack_require__(35)('div'), 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }, -/* 31 */ +/* 33 */ /***/ function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty - module.exports = !__webpack_require__(32)(function(){ + module.exports = !__webpack_require__(34)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }, -/* 32 */ +/* 34 */ /***/ function(module, exports) { module.exports = function(exec){ @@ -600,11 +650,11 @@ }; /***/ }, -/* 33 */ +/* 35 */ /***/ function(module, exports, __webpack_require__) { - var isObject = __webpack_require__(29) - , document = __webpack_require__(18).document + var isObject = __webpack_require__(31) + , document = __webpack_require__(21).document // in old IE typeof document.createElement is 'object' , is = isObject(document) && isObject(document.createElement); module.exports = function(it){ @@ -612,11 +662,11 @@ }; /***/ }, -/* 34 */ +/* 36 */ /***/ function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) - var isObject = __webpack_require__(29); + var isObject = __webpack_require__(31); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function(it, S){ @@ -629,7 +679,7 @@ }; /***/ }, -/* 35 */ +/* 37 */ /***/ function(module, exports) { module.exports = function(bitmap, value){ @@ -642,13 +692,7 @@ }; /***/ }, -/* 36 */ -/***/ function(module, exports) { - - module.exports = dexie; - -/***/ }, -/* 37 */ +/* 38 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -657,19 +701,19 @@ value: true }); - var _slicedToArray2 = __webpack_require__(38); + var _slicedToArray2 = __webpack_require__(39); var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); - var _keys = __webpack_require__(1); + var _keys = __webpack_require__(4); var _keys2 = _interopRequireDefault(_keys); - var _classCallCheck2 = __webpack_require__(64); + var _classCallCheck2 = __webpack_require__(65); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _createClass2 = __webpack_require__(65); + var _createClass2 = __webpack_require__(66); var _createClass3 = _interopRequireDefault(_createClass2); @@ -758,18 +802,18 @@ exports.default = SchemaParser; /***/ }, -/* 38 */ +/* 39 */ /***/ function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; - var _isIterable2 = __webpack_require__(39); + var _isIterable2 = __webpack_require__(40); var _isIterable3 = _interopRequireDefault(_isIterable2); - var _getIterator2 = __webpack_require__(60); + var _getIterator2 = __webpack_require__(61); var _getIterator3 = _interopRequireDefault(_getIterator2); @@ -814,28 +858,28 @@ }(); /***/ }, -/* 39 */ +/* 40 */ /***/ function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(40), __esModule: true }; + module.exports = { "default": __webpack_require__(41), __esModule: true }; /***/ }, -/* 40 */ +/* 41 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(41); - __webpack_require__(56); - module.exports = __webpack_require__(58); + __webpack_require__(42); + __webpack_require__(57); + module.exports = __webpack_require__(59); /***/ }, -/* 41 */ +/* 42 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(42); - var global = __webpack_require__(18) - , hide = __webpack_require__(26) - , Iterators = __webpack_require__(45) - , TO_STRING_TAG = __webpack_require__(54)('toStringTag'); + __webpack_require__(43); + var global = __webpack_require__(21) + , hide = __webpack_require__(28) + , Iterators = __webpack_require__(46) + , TO_STRING_TAG = __webpack_require__(55)('toStringTag'); for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ var NAME = collections[i] @@ -846,20 +890,20 @@ } /***/ }, -/* 42 */ +/* 43 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var addToUnscopables = __webpack_require__(43) - , step = __webpack_require__(44) - , Iterators = __webpack_require__(45) - , toIObject = __webpack_require__(9); + var addToUnscopables = __webpack_require__(44) + , step = __webpack_require__(45) + , Iterators = __webpack_require__(46) + , toIObject = __webpack_require__(12); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() - module.exports = __webpack_require__(46)(Array, 'Array', function(iterated, kind){ + module.exports = __webpack_require__(47)(Array, 'Array', function(iterated, kind){ this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind @@ -885,13 +929,13 @@ addToUnscopables('entries'); /***/ }, -/* 43 */ +/* 44 */ /***/ function(module, exports) { module.exports = function(){ /* empty */ }; /***/ }, -/* 44 */ +/* 45 */ /***/ function(module, exports) { module.exports = function(done, value){ @@ -899,26 +943,26 @@ }; /***/ }, -/* 45 */ +/* 46 */ /***/ function(module, exports) { module.exports = {}; /***/ }, -/* 46 */ +/* 47 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var LIBRARY = __webpack_require__(47) - , $export = __webpack_require__(22) - , redefine = __webpack_require__(48) - , hide = __webpack_require__(26) - , has = __webpack_require__(8) - , Iterators = __webpack_require__(45) - , $iterCreate = __webpack_require__(49) - , setToStringTag = __webpack_require__(53) - , getPrototypeOf = __webpack_require__(55) - , ITERATOR = __webpack_require__(54)('iterator') + var LIBRARY = __webpack_require__(48) + , $export = __webpack_require__(25) + , redefine = __webpack_require__(49) + , hide = __webpack_require__(28) + , has = __webpack_require__(11) + , Iterators = __webpack_require__(46) + , $iterCreate = __webpack_require__(50) + , setToStringTag = __webpack_require__(54) + , getPrototypeOf = __webpack_require__(56) + , ITERATOR = __webpack_require__(55)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' , KEYS = 'keys' @@ -980,29 +1024,29 @@ }; /***/ }, -/* 47 */ +/* 48 */ /***/ function(module, exports) { module.exports = true; /***/ }, -/* 48 */ +/* 49 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(26); + module.exports = __webpack_require__(28); /***/ }, -/* 49 */ +/* 50 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var create = __webpack_require__(50) - , descriptor = __webpack_require__(35) - , setToStringTag = __webpack_require__(53) + var create = __webpack_require__(51) + , descriptor = __webpack_require__(37) + , setToStringTag = __webpack_require__(54) , IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() - __webpack_require__(26)(IteratorPrototype, __webpack_require__(54)('iterator'), function(){ return this; }); + __webpack_require__(28)(IteratorPrototype, __webpack_require__(55)('iterator'), function(){ return this; }); module.exports = function(Constructor, NAME, next){ Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); @@ -1010,27 +1054,27 @@ }; /***/ }, -/* 50 */ +/* 51 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) - var anObject = __webpack_require__(28) - , dPs = __webpack_require__(51) - , enumBugKeys = __webpack_require__(20) - , IE_PROTO = __webpack_require__(16)('IE_PROTO') + var anObject = __webpack_require__(30) + , dPs = __webpack_require__(52) + , enumBugKeys = __webpack_require__(23) + , IE_PROTO = __webpack_require__(19)('IE_PROTO') , Empty = function(){ /* empty */ } , PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function(){ // Thrash, waste and sodomy: IE GC bug - var iframe = __webpack_require__(33)('iframe') + var iframe = __webpack_require__(35)('iframe') , i = enumBugKeys.length , lt = '<' , gt = '>' , iframeDocument; iframe.style.display = 'none'; - __webpack_require__(52).appendChild(iframe); + __webpack_require__(53).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); @@ -1057,14 +1101,14 @@ /***/ }, -/* 51 */ +/* 52 */ /***/ function(module, exports, __webpack_require__) { - var dP = __webpack_require__(27) - , anObject = __webpack_require__(28) - , getKeys = __webpack_require__(6); + var dP = __webpack_require__(29) + , anObject = __webpack_require__(30) + , getKeys = __webpack_require__(9); - module.exports = __webpack_require__(31) ? Object.defineProperties : function defineProperties(O, Properties){ + module.exports = __webpack_require__(33) ? Object.defineProperties : function defineProperties(O, Properties){ anObject(O); var keys = getKeys(Properties) , length = keys.length @@ -1075,30 +1119,30 @@ }; /***/ }, -/* 52 */ +/* 53 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(18).document && document.documentElement; + module.exports = __webpack_require__(21).document && document.documentElement; /***/ }, -/* 53 */ +/* 54 */ /***/ function(module, exports, __webpack_require__) { - var def = __webpack_require__(27).f - , has = __webpack_require__(8) - , TAG = __webpack_require__(54)('toStringTag'); + var def = __webpack_require__(29).f + , has = __webpack_require__(11) + , TAG = __webpack_require__(55)('toStringTag'); module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); }; /***/ }, -/* 54 */ +/* 55 */ /***/ function(module, exports, __webpack_require__) { - var store = __webpack_require__(17)('wks') - , uid = __webpack_require__(19) - , Symbol = __webpack_require__(18).Symbol + var store = __webpack_require__(20)('wks') + , uid = __webpack_require__(22) + , Symbol = __webpack_require__(21).Symbol , USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function(name){ @@ -1109,13 +1153,13 @@ $exports.store = store; /***/ }, -/* 55 */ +/* 56 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) - var has = __webpack_require__(8) - , toObject = __webpack_require__(4) - , IE_PROTO = __webpack_require__(16)('IE_PROTO') + var has = __webpack_require__(11) + , toObject = __webpack_require__(7) + , IE_PROTO = __webpack_require__(19)('IE_PROTO') , ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function(O){ @@ -1127,14 +1171,14 @@ }; /***/ }, -/* 56 */ +/* 57 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var $at = __webpack_require__(57)(true); + var $at = __webpack_require__(58)(true); // 21.1.3.27 String.prototype[@@iterator]() - __webpack_require__(46)(String, 'String', function(iterated){ + __webpack_require__(47)(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() @@ -1149,11 +1193,11 @@ }); /***/ }, -/* 57 */ +/* 58 */ /***/ function(module, exports, __webpack_require__) { - var toInteger = __webpack_require__(14) - , defined = __webpack_require__(5); + var toInteger = __webpack_require__(17) + , defined = __webpack_require__(8); // true -> String#at // false -> String#codePointAt module.exports = function(TO_STRING){ @@ -1171,13 +1215,13 @@ }; /***/ }, -/* 58 */ +/* 59 */ /***/ function(module, exports, __webpack_require__) { - var classof = __webpack_require__(59) - , ITERATOR = __webpack_require__(54)('iterator') - , Iterators = __webpack_require__(45); - module.exports = __webpack_require__(23).isIterable = function(it){ + var classof = __webpack_require__(60) + , ITERATOR = __webpack_require__(55)('iterator') + , Iterators = __webpack_require__(46); + module.exports = __webpack_require__(3).isIterable = function(it){ var O = Object(it); return O[ITERATOR] !== undefined || '@@iterator' in O @@ -1185,12 +1229,12 @@ }; /***/ }, -/* 59 */ +/* 60 */ /***/ function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() - var cof = __webpack_require__(11) - , TAG = __webpack_require__(54)('toStringTag') + var cof = __webpack_require__(14) + , TAG = __webpack_require__(55)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; @@ -1213,46 +1257,46 @@ }; /***/ }, -/* 60 */ +/* 61 */ /***/ function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(61), __esModule: true }; + module.exports = { "default": __webpack_require__(62), __esModule: true }; /***/ }, -/* 61 */ +/* 62 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(41); - __webpack_require__(56); - module.exports = __webpack_require__(62); + __webpack_require__(42); + __webpack_require__(57); + module.exports = __webpack_require__(63); /***/ }, -/* 62 */ +/* 63 */ /***/ function(module, exports, __webpack_require__) { - var anObject = __webpack_require__(28) - , get = __webpack_require__(63); - module.exports = __webpack_require__(23).getIterator = function(it){ + var anObject = __webpack_require__(30) + , get = __webpack_require__(64); + module.exports = __webpack_require__(3).getIterator = function(it){ var iterFn = get(it); if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); return anObject(iterFn.call(it)); }; /***/ }, -/* 63 */ +/* 64 */ /***/ function(module, exports, __webpack_require__) { - var classof = __webpack_require__(59) - , ITERATOR = __webpack_require__(54)('iterator') - , Iterators = __webpack_require__(45); - module.exports = __webpack_require__(23).getIteratorMethod = function(it){ + var classof = __webpack_require__(60) + , ITERATOR = __webpack_require__(55)('iterator') + , Iterators = __webpack_require__(46); + module.exports = __webpack_require__(3).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }, -/* 64 */ +/* 65 */ /***/ function(module, exports) { "use strict"; @@ -1266,14 +1310,14 @@ }; /***/ }, -/* 65 */ +/* 66 */ /***/ function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; - var _defineProperty = __webpack_require__(66); + var _defineProperty = __webpack_require__(67); var _defineProperty2 = _interopRequireDefault(_defineProperty); @@ -1298,28 +1342,43 @@ }(); /***/ }, -/* 66 */ +/* 67 */ /***/ function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(67), __esModule: true }; + module.exports = { "default": __webpack_require__(68), __esModule: true }; /***/ }, -/* 67 */ +/* 68 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(68); - var $Object = __webpack_require__(23).Object; + __webpack_require__(69); + var $Object = __webpack_require__(3).Object; module.exports = function defineProperty(it, key, desc){ return $Object.defineProperty(it, key, desc); }; /***/ }, -/* 68 */ +/* 69 */ /***/ function(module, exports, __webpack_require__) { - var $export = __webpack_require__(22); + var $export = __webpack_require__(25); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) - $export($export.S + $export.F * !__webpack_require__(31), 'Object', {defineProperty: __webpack_require__(27).f}); + $export($export.S + $export.F * !__webpack_require__(33), 'Object', {defineProperty: __webpack_require__(29).f}); + +/***/ }, +/* 70 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.isIndexableType = isIndexableType; + function isIndexableType(value) { + return value != null && ( // Using "!=" instead of "!==" to check for both null and undefined! + typeof value === 'string' || typeof value === 'number' || value instanceof Date || Array.isArray(value) && value.every(isIndexableType)); + } /***/ } /******/ ]); diff --git a/dist/dexie-relationships.js.map b/dist/dexie-relationships.js.map index ebf4200..dc507d0 100644 --- a/dist/dexie-relationships.js.map +++ b/dist/dexie-relationships.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 72d92c1e58549155e0c7","webpack:///./src/index.js","webpack:///./~/babel-runtime/core-js/object/keys.js","webpack:///./~/core-js/library/fn/object/keys.js","webpack:///./~/core-js/library/modules/es6.object.keys.js","webpack:///./~/core-js/library/modules/_to-object.js","webpack:///./~/core-js/library/modules/_defined.js","webpack:///./~/core-js/library/modules/_object-keys.js","webpack:///./~/core-js/library/modules/_object-keys-internal.js","webpack:///./~/core-js/library/modules/_has.js","webpack:///./~/core-js/library/modules/_to-iobject.js","webpack:///./~/core-js/library/modules/_iobject.js","webpack:///./~/core-js/library/modules/_cof.js","webpack:///./~/core-js/library/modules/_array-includes.js","webpack:///./~/core-js/library/modules/_to-length.js","webpack:///./~/core-js/library/modules/_to-integer.js","webpack:///./~/core-js/library/modules/_to-index.js","webpack:///./~/core-js/library/modules/_shared-key.js","webpack:///./~/core-js/library/modules/_shared.js","webpack:///./~/core-js/library/modules/_global.js","webpack:///./~/core-js/library/modules/_uid.js","webpack:///./~/core-js/library/modules/_enum-bug-keys.js","webpack:///./~/core-js/library/modules/_object-sap.js","webpack:///./~/core-js/library/modules/_export.js","webpack:///./~/core-js/library/modules/_core.js","webpack:///./~/core-js/library/modules/_ctx.js","webpack:///./~/core-js/library/modules/_a-function.js","webpack:///./~/core-js/library/modules/_hide.js","webpack:///./~/core-js/library/modules/_object-dp.js","webpack:///./~/core-js/library/modules/_an-object.js","webpack:///./~/core-js/library/modules/_is-object.js","webpack:///./~/core-js/library/modules/_ie8-dom-define.js","webpack:///./~/core-js/library/modules/_descriptors.js","webpack:///./~/core-js/library/modules/_fails.js","webpack:///./~/core-js/library/modules/_dom-create.js","webpack:///./~/core-js/library/modules/_to-primitive.js","webpack:///./~/core-js/library/modules/_property-desc.js","webpack:///external \"dexie\"","webpack:///./src/schema-parser.js","webpack:///./~/babel-runtime/helpers/slicedToArray.js","webpack:///./~/babel-runtime/core-js/is-iterable.js","webpack:///./~/core-js/library/fn/is-iterable.js","webpack:///./~/core-js/library/modules/web.dom.iterable.js","webpack:///./~/core-js/library/modules/es6.array.iterator.js","webpack:///./~/core-js/library/modules/_add-to-unscopables.js","webpack:///./~/core-js/library/modules/_iter-step.js","webpack:///./~/core-js/library/modules/_iterators.js","webpack:///./~/core-js/library/modules/_iter-define.js","webpack:///./~/core-js/library/modules/_library.js","webpack:///./~/core-js/library/modules/_redefine.js","webpack:///./~/core-js/library/modules/_iter-create.js","webpack:///./~/core-js/library/modules/_object-create.js","webpack:///./~/core-js/library/modules/_object-dps.js","webpack:///./~/core-js/library/modules/_html.js","webpack:///./~/core-js/library/modules/_set-to-string-tag.js","webpack:///./~/core-js/library/modules/_wks.js","webpack:///./~/core-js/library/modules/_object-gpo.js","webpack:///./~/core-js/library/modules/es6.string.iterator.js","webpack:///./~/core-js/library/modules/_string-at.js","webpack:///./~/core-js/library/modules/core.is-iterable.js","webpack:///./~/core-js/library/modules/_classof.js","webpack:///./~/babel-runtime/core-js/get-iterator.js","webpack:///./~/core-js/library/fn/get-iterator.js","webpack:///./~/core-js/library/modules/core.get-iterator.js","webpack:///./~/core-js/library/modules/core.get-iterator-method.js","webpack:///./~/babel-runtime/helpers/classCallCheck.js","webpack:///./~/babel-runtime/helpers/createClass.js","webpack:///./~/babel-runtime/core-js/object/define-property.js","webpack:///./~/core-js/library/fn/object/define-property.js","webpack:///./~/core-js/library/modules/es6.object.define-property.js"],"names":["Relationships","db","Promise","Table","prototype","with","relationships","toCollection","Collection","self","baseTable","_ctx","table","name","databaseTables","_allTables","usableForeignTables","forEach","column","hasOwnProperty","Error","schema","columns","foreignKeys","filter","targetTable","length","foreign","resolve","toArray","then","queue","rows","row","tables","relatedTable","promise","where","index","equals","targetIndex","relations","push","all","Version","_parseStoresSpec","override","storesSpec","outDbSchema","parser","getForeignKeys","rv","parseStoresSpec","call","getCleanedSchema","addons","SchemaParser","indexes","split","idx","indexOf","map","x","trim","target","join"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACtCA;;;;AACA;;;;;;AAEA,KAAMA,gBAAgB,SAAhBA,aAAgB,CAACC,EAAD,EAAQ;;AAE5B,OAAIC,UAAU,gBAAMA,OAApB,CAF4B,CAEC;;AAE7B;;;;;;;AAOAD,MAAGE,KAAH,CAASC,SAAT,CAAmBC,IAAnB,GAA0B,UAAUC,aAAV,EAAyB;AACjD,YAAO,KAAKC,YAAL,GAAoBF,IAApB,CAAyBC,aAAzB,CAAP;AACD,IAFD;;AAIA;;;;;;;AAOAL,MAAGO,UAAH,CAAcJ,SAAd,CAAwBC,IAAxB,GAA+B,UAAUC,aAAV,EAAyB;AACtD,SAAMG,OAAO,IAAb;AACA,SAAMC,YAAY,KAAKC,IAAL,CAAUC,KAAV,CAAgBC,IAAlC;AACA,SAAMC,iBAAiBb,GAAGc,UAA1B;;AAEA;AACA,SAAIC,sBAAsB,EAA1B;;AAEA;AACA,yBAAYV,aAAZ,EAA2BW,OAA3B,CAAmC,UAACC,MAAD,EAAY;AAC7C,WAAIN,QAAQN,cAAcY,MAAd,CAAZ;;AAEA,WAAI,CAACJ,eAAeK,cAAf,CAA8BP,KAA9B,CAAL,EAA2C;AACzC,eAAM,IAAIQ,KAAJ,CAAU,wBAAwBR,KAAxB,GAAgC,kBAA1C,CAAN;AACD;;AAED,WAAI,CAACE,eAAeF,KAAf,EAAsBS,MAAtB,CAA6BF,cAA7B,CAA4C,aAA5C,CAAL,EAAiE;AAC/D,eAAM,IAAIC,KAAJ,CAAU,wBAAwBR,KAAxB,GAAgC,kCAA1C,CAAN;AACD;;AAED;AACA,WAAIU,UAAUR,eAAeF,KAAf,EAAsBS,MAAtB,CAA6BE,WAA7B,CAAyCC,MAAzC,CAAgD;AAAA,gBAAUN,OAAOO,WAAP,KAAuBf,SAAjC;AAAA,QAAhD,CAAd;;AAEA,WAAIY,QAAQI,MAAR,GAAiB,CAArB,EAAwB;AACtBV,6BAAoBJ,KAApB,IAA6B;AAC3BM,mBAAQA,MADmB;AAE3BS,oBAASL,QAAQ,CAAR;AAFkB,UAA7B;AAID;AACF,MApBD;;AAsBA,YAAO,IAAI,gBAAMpB,OAAV,CAAkB,UAAC0B,OAAD,EAAa;AACpCnB,YAAKoB,OAAL,GAAeC,IAAf,CAAoB,gBAAQ;AAC1B,aAAIC,QAAQ,EAAZ;;AAEA;AACAC,cAAKf,OAAL,CAAa,UAACgB,GAAD,EAAS;AACpB,eAAIC,SAAS,oBAAYlB,mBAAZ,CAAb;;AAEAkB,kBAAOjB,OAAP,CAAe,iBAAS;AACtB,iBAAIkB,eAAenB,oBAAoBJ,KAApB,CAAnB;;AAEA,iBAAIwB,UAAUtB,eAAeF,KAAf,EACXyB,KADW,CACLF,aAAaR,OAAb,CAAqBW,KADhB,EAEXC,MAFW,CAEJN,IAAIE,aAAaR,OAAb,CAAqBa,WAAzB,CAFI,EAGXX,OAHW,GAIXC,IAJW,CAIN,qBAAa;AACjBG,mBAAIE,aAAajB,MAAjB,IAA2BuB,SAA3B;AACD,cANW,CAAd;;AAQAV,mBAAMW,IAAN,CAAWN,OAAX;AACD,YAZD;AAaD,UAhBD;;AAkBA;AACA;AACAlC,iBAAQyC,GAAR,CAAYZ,KAAZ,EAAmBD,IAAnB,CAAwB,YAAM;AAC5BF,mBAAQI,IAAR;AACD,UAFD;AAGD,QA3BD;AA4BD,MA7BM,CAAP;AA8BD,IA7DD;;AA+DA/B,MAAG2C,OAAH,CAAWxC,SAAX,CAAqByC,gBAArB,GAAwC,gBAAMC,QAAN,CACtC7C,GAAG2C,OAAH,CAAWxC,SAAX,CAAqByC,gBADiB,EAEtC;AAAA,YAAmB,UAAUE,UAAV,EAAsBC,WAAtB,EAAmC;AACpD,WAAMC,SAAS,2BAAiBF,UAAjB,CAAf;;AAEA,WAAIxB,cAAc0B,OAAOC,cAAP,EAAlB;AACA;AACA,WAAIC,KAAKC,gBAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,OAAOK,gBAAP,EAA3B,EAAsDN,WAAtD,CAAT;;AAEA;AACA;AACA,2BAAYA,WAAZ,EAAyB/B,OAAzB,CAAiC,iBAAS;AACxC,aAAIM,YAAYJ,cAAZ,CAA2BP,KAA3B,CAAJ,EAAuC;AACrCoC,uBAAYpC,KAAZ,EAAmBW,WAAnB,GAAiCA,YAAYX,KAAZ,CAAjC;AACD;AACF,QAJD;;AAMA,cAAOuC,EAAP;AACD,MAhBD;AAAA,IAFsC,CAAxC;AAmBD,EAxGD;;AA0GA,iBAAMI,MAAN,CAAab,IAAb,CAAkB1C,aAAlB,E;;;;;;AC7GA,mBAAkB,uD;;;;;;ACAlB;AACA,sD;;;;;;ACDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAC,E;;;;;;ACRD;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;;AAEA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA,wBAAuB;AACvB;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA,G;;;;;;ACJA,kBAAiB;;AAEjB;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK,WAAW,eAAe;AAC/B;AACA,MAAK;AACL;AACA,G;;;;;;ACpBA;AACA;AACA;AACA;AACA,4DAA2D;AAC3D,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,oDAAmD;AACnD;AACA,wCAAuC;AACvC,G;;;;;;ACLA;AACA;AACA;AACA,wCAAuC,gC;;;;;;ACHvC;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA,c;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,+BAA8B;AAC9B;AACA;AACA,oDAAmD,OAAO,EAAE;AAC5D,G;;;;;;ACTA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAmE;AACnE;AACA,sFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,gDAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd,eAAc;AACd,eAAc;AACd,eAAc;AACd,gBAAe;AACf,gBAAe;AACf,gBAAe;AACf,iBAAgB;AAChB,0B;;;;;;AC5DA,8BAA6B;AAC7B,sCAAqC,gC;;;;;;ACDrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACnBA;AACA;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA,G;;;;;;ACPA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;AACA;AACA;AACA,G;;;;;;ACfA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,G;;;;;;ACFA;AACA,sEAAsE,gBAAgB,UAAU,GAAG;AACnG,EAAC,E;;;;;;ACFD;AACA;AACA,kCAAiC,QAAQ,gBAAgB,UAAU,GAAG;AACtE,EAAC,E;;;;;;ACHD;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACPA,wB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCAMwD,Y;;AAEJ;;;;;AAKA,yBAAanC,MAAb,EAAqB;AAAA;;AACnB,UAAKA,MAAL,GAAcA,MAAd;AACD;;AAED;;;;;;;;;sCAKkB;AAAA;;AAChB,WAAIE,cAAc,EAAlB;;AAEA,2BAAY,KAAKF,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAIwC,UAAU,MAAKpC,MAAL,CAAYT,KAAZ,EAAmB8C,KAAnB,CAAyB,GAAzB,CAAd;;AAEAnC,qBAAYX,KAAZ,IAAqB6C,QAClBjC,MADkB,CACX;AAAA,kBAAOmC,IAAIC,OAAJ,CAAY,IAAZ,MAAsB,CAAC,CAA9B;AAAA,UADW,EAElBC,GAFkB,CAEd,eAAO;AACV;AADU,gCAEaF,IAAID,KAAJ,CAAU,IAAV,EAAgBG,GAAhB,CAAoB;AAAA,oBAAKC,EAAEC,IAAF,EAAL;AAAA,YAApB,CAFb;AAAA;AAAA,eAEL7C,MAFK;AAAA,eAEG8C,MAFH;;AAIV,kBAAO;AACL1B,oBAAOpB,MADF;AAELO,0BAAauC,OAAON,KAAP,CAAa,GAAb,EAAkB,CAAlB,CAFR;AAGLlB,0BAAawB,OAAON,KAAP,CAAa,GAAb,EAAkB,CAAlB;AAHR,YAAP;AAKD,UAXkB,CAArB;AAYD,QAfD;;AAiBA,cAAOnC,WAAP;AACD;;AAED;;;;;;;;wCAKoB;AAAA;;AAClB,WAAIF,SAAS,EAAb;;AAEA,2BAAY,KAAKA,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAIwC,UAAU,OAAKpC,MAAL,CAAYT,KAAZ,EAAmB8C,KAAnB,CAAyB,GAAzB,CAAd;;AAEA;AACArC,gBAAOT,KAAP,IAAgB6C,QAAQI,GAAR,CAAY;AAAA,kBAAOF,IAAID,KAAJ,CAAU,IAAV,EAAgB,CAAhB,EAAmBK,IAAnB,EAAP;AAAA,UAAZ,EAA8CE,IAA9C,CAAmD,GAAnD,CAAhB;AACD,QALD;;AAOA,cAAO5C,MAAP;AACD;;;;;mBAGYmC,Y;;;;;;AC1Df;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yDAAwD,+BAA+B;AACvF;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA,EAAC,G;;;;;;AClDD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;;AAEA,yGAAwG,OAAO;AAC/G;AACA;AACA;AACA;AACA;AACA,E;;;;;;ACZA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAgC;AAChC,eAAc;AACd,kBAAiB;AACjB;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;;AAEA;AACA;AACA,6B;;;;;;ACjCA,6BAA4B,e;;;;;;ACA5B;AACA,WAAU;AACV,G;;;;;;ACFA,qB;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA4B,aAAa;;AAEzC;AACA;AACA;AACA;AACA;AACA,yCAAwC,oCAAoC;AAC5E,6CAA4C,oCAAoC;AAChF,MAAK,2BAA2B,oCAAoC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB,mBAAmB;AACnC;AACA;AACA,kCAAiC,2BAA2B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,G;;;;;;ACrEA,uB;;;;;;ACAA,0C;;;;;;ACAA;AACA;AACA;AACA;AACA;;AAEA;AACA,4FAAgF,aAAa,EAAE;;AAE/F;AACA,sDAAqD,0BAA0B;AAC/E;AACA,G;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;;;;;;ACxCA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACZA,+E;;;;;;ACAA;AACA;AACA;;AAEA;AACA,mEAAkE,+BAA+B;AACjG,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wB;;;;;;ACVA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH,G;;;;;;ACZA;AACA;;AAEA;AACA;AACA,8BAA6B;AAC7B,eAAc;AACd;AACA,EAAC;AACD;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,WAAU;AACV,EAAC,E;;;;;;AChBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;AACA;AACA;AACA;AACA,0BAAyB,kBAAkB,EAAE;;AAE7C;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACtBA,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA,oBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAC,G;;;;;;AC1BD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,sEAAuE,0CAA0C,E","file":"dexie-relationships.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 72d92c1e58549155e0c7\n **/","import Dexie from 'dexie'\r\nimport SchemaParser from './schema-parser'\r\n\r\nconst Relationships = (db) => {\r\n\r\n let Promise = Dexie.Promise; // Safe to use within transactions. \r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Table.prototype.with = function (relationships) {\r\n return this.toCollection().with(relationships)\r\n }\r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Collection.prototype.with = function (relationships) {\r\n const self = this\r\n const baseTable = this._ctx.table.name\r\n const databaseTables = db._allTables\r\n\r\n // this holds tables that have foreign keys pointing at the current table\r\n let usableForeignTables = {}\r\n\r\n // validate target tables and add them into our usable tables object\r\n Object.keys(relationships).forEach((column) => {\r\n let table = relationships[column]\r\n\r\n if (!databaseTables.hasOwnProperty(table)) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t exist.')\r\n }\r\n\r\n if (!databaseTables[table].schema.hasOwnProperty('foreignKeys')) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t have foreign keys set.')\r\n }\r\n\r\n // remove the foreign keys that don't link to the base table\r\n let columns = databaseTables[table].schema.foreignKeys.filter(column => column.targetTable === baseTable)\r\n\r\n if (columns.length > 0) {\r\n usableForeignTables[table] = {\r\n column: column,\r\n foreign: columns[0]\r\n }\r\n }\r\n })\r\n\r\n return new Dexie.Promise((resolve) => {\r\n self.toArray().then(rows => {\r\n let queue = []\r\n\r\n // loop through all rows and collect all data from the related table\r\n rows.forEach((row) => {\r\n let tables = Object.keys(usableForeignTables)\r\n\r\n tables.forEach(table => {\r\n let relatedTable = usableForeignTables[table]\r\n\r\n let promise = databaseTables[table]\r\n .where(relatedTable.foreign.index)\r\n .equals(row[relatedTable.foreign.targetIndex])\r\n .toArray()\r\n .then(relations => {\r\n row[relatedTable.column] = relations\r\n })\r\n\r\n queue.push(promise)\r\n })\r\n })\r\n\r\n // we need to wait until all data is retrieved\r\n // once it's there we can resolve the promise\r\n Promise.all(queue).then(() => {\r\n resolve(rows)\r\n })\r\n })\r\n })\r\n }\r\n\r\n db.Version.prototype._parseStoresSpec = Dexie.override(\r\n db.Version.prototype._parseStoresSpec,\r\n parseStoresSpec => function (storesSpec, outDbSchema) {\r\n const parser = new SchemaParser(storesSpec)\r\n\r\n let foreignKeys = parser.getForeignKeys()\r\n // call the original method\r\n let rv = parseStoresSpec.call(this, parser.getCleanedSchema(), outDbSchema)\r\n\r\n // set foreign keys into database table objects\r\n // to use later in 'with' method\r\n Object.keys(outDbSchema).forEach(table => {\r\n if (foreignKeys.hasOwnProperty(table)) {\r\n outDbSchema[table].foreignKeys = foreignKeys[table]\r\n }\r\n })\r\n\r\n return rv\r\n })\r\n}\r\n\r\nDexie.addons.push(Relationships)\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/keys\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/object/keys.js\n ** module id = 1\n ** module chunks = 0\n **/","require('../../modules/es6.object.keys');\nmodule.exports = require('../../modules/_core').Object.keys;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/object/keys.js\n ** module id = 2\n ** module chunks = 0\n **/","// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object')\n , $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function(){\n return function keys(it){\n return $keys(toObject(it));\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.object.keys.js\n ** module id = 3\n ** module chunks = 0\n **/","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function(it){\n return Object(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-object.js\n ** module id = 4\n ** module chunks = 0\n **/","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function(it){\n if(it == undefined)throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_defined.js\n ** module id = 5\n ** module chunks = 0\n **/","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal')\n , enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O){\n return $keys(O, enumBugKeys);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-keys.js\n ** module id = 6\n ** module chunks = 0\n **/","var has = require('./_has')\n , toIObject = require('./_to-iobject')\n , arrayIndexOf = require('./_array-includes')(false)\n , IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function(object, names){\n var O = toIObject(object)\n , i = 0\n , result = []\n , key;\n for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while(names.length > i)if(has(O, key = names[i++])){\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-keys-internal.js\n ** module id = 7\n ** module chunks = 0\n **/","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function(it, key){\n return hasOwnProperty.call(it, key);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_has.js\n ** module id = 8\n ** module chunks = 0\n **/","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject')\n , defined = require('./_defined');\nmodule.exports = function(it){\n return IObject(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-iobject.js\n ** module id = 9\n ** module chunks = 0\n **/","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iobject.js\n ** module id = 10\n ** module chunks = 0\n **/","var toString = {}.toString;\n\nmodule.exports = function(it){\n return toString.call(it).slice(8, -1);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_cof.js\n ** module id = 11\n ** module chunks = 0\n **/","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject')\n , toLength = require('./_to-length')\n , toIndex = require('./_to-index');\nmodule.exports = function(IS_INCLUDES){\n return function($this, el, fromIndex){\n var O = toIObject($this)\n , length = toLength(O.length)\n , index = toIndex(fromIndex, length)\n , value;\n // Array#includes uses SameValueZero equality algorithm\n if(IS_INCLUDES && el != el)while(length > index){\n value = O[index++];\n if(value != value)return true;\n // Array#toIndex ignores holes, Array#includes - not\n } else for(;length > index; index++)if(IS_INCLUDES || index in O){\n if(O[index] === el)return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_array-includes.js\n ** module id = 12\n ** module chunks = 0\n **/","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer')\n , min = Math.min;\nmodule.exports = function(it){\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-length.js\n ** module id = 13\n ** module chunks = 0\n **/","// 7.1.4 ToInteger\nvar ceil = Math.ceil\n , floor = Math.floor;\nmodule.exports = function(it){\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-integer.js\n ** module id = 14\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , max = Math.max\n , min = Math.min;\nmodule.exports = function(index, length){\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-index.js\n ** module id = 15\n ** module chunks = 0\n **/","var shared = require('./_shared')('keys')\n , uid = require('./_uid');\nmodule.exports = function(key){\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_shared-key.js\n ** module id = 16\n ** module chunks = 0\n **/","var global = require('./_global')\n , SHARED = '__core-js_shared__'\n , store = global[SHARED] || (global[SHARED] = {});\nmodule.exports = function(key){\n return store[key] || (store[key] = {});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_shared.js\n ** module id = 17\n ** module chunks = 0\n **/","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();\nif(typeof __g == 'number')__g = global; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_global.js\n ** module id = 18\n ** module chunks = 0\n **/","var id = 0\n , px = Math.random();\nmodule.exports = function(key){\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_uid.js\n ** module id = 19\n ** module chunks = 0\n **/","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_enum-bug-keys.js\n ** module id = 20\n ** module chunks = 0\n **/","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export')\n , core = require('./_core')\n , fails = require('./_fails');\nmodule.exports = function(KEY, exec){\n var fn = (core.Object || {})[KEY] || Object[KEY]\n , exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-sap.js\n ** module id = 21\n ** module chunks = 0\n **/","var global = require('./_global')\n , core = require('./_core')\n , ctx = require('./_ctx')\n , hide = require('./_hide')\n , PROTOTYPE = 'prototype';\n\nvar $export = function(type, name, source){\n var IS_FORCED = type & $export.F\n , IS_GLOBAL = type & $export.G\n , IS_STATIC = type & $export.S\n , IS_PROTO = type & $export.P\n , IS_BIND = type & $export.B\n , IS_WRAP = type & $export.W\n , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})\n , expProto = exports[PROTOTYPE]\n , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]\n , key, own, out;\n if(IS_GLOBAL)source = name;\n for(key in source){\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if(own && key in exports)continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function(C){\n var F = function(a, b, c){\n if(this instanceof C){\n switch(arguments.length){\n case 0: return new C;\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if(IS_PROTO){\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library` \nmodule.exports = $export;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_export.js\n ** module id = 22\n ** module chunks = 0\n **/","var core = module.exports = {version: '2.4.0'};\nif(typeof __e == 'number')__e = core; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_core.js\n ** module id = 23\n ** module chunks = 0\n **/","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function(fn, that, length){\n aFunction(fn);\n if(that === undefined)return fn;\n switch(length){\n case 1: return function(a){\n return fn.call(that, a);\n };\n case 2: return function(a, b){\n return fn.call(that, a, b);\n };\n case 3: return function(a, b, c){\n return fn.call(that, a, b, c);\n };\n }\n return function(/* ...args */){\n return fn.apply(that, arguments);\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_ctx.js\n ** module id = 24\n ** module chunks = 0\n **/","module.exports = function(it){\n if(typeof it != 'function')throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_a-function.js\n ** module id = 25\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function(object, key, value){\n return dP.f(object, key, createDesc(1, value));\n} : function(object, key, value){\n object[key] = value;\n return object;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_hide.js\n ** module id = 26\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , IE8_DOM_DEFINE = require('./_ie8-dom-define')\n , toPrimitive = require('./_to-primitive')\n , dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if(IE8_DOM_DEFINE)try {\n return dP(O, P, Attributes);\n } catch(e){ /* empty */ }\n if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');\n if('value' in Attributes)O[P] = Attributes.value;\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-dp.js\n ** module id = 27\n ** module chunks = 0\n **/","var isObject = require('./_is-object');\nmodule.exports = function(it){\n if(!isObject(it))throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_an-object.js\n ** module id = 28\n ** module chunks = 0\n **/","module.exports = function(it){\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_is-object.js\n ** module id = 29\n ** module chunks = 0\n **/","module.exports = !require('./_descriptors') && !require('./_fails')(function(){\n return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_ie8-dom-define.js\n ** module id = 30\n ** module chunks = 0\n **/","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function(){\n return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_descriptors.js\n ** module id = 31\n ** module chunks = 0\n **/","module.exports = function(exec){\n try {\n return !!exec();\n } catch(e){\n return true;\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_fails.js\n ** module id = 32\n ** module chunks = 0\n **/","var isObject = require('./_is-object')\n , document = require('./_global').document\n // in old IE typeof document.createElement is 'object'\n , is = isObject(document) && isObject(document.createElement);\nmodule.exports = function(it){\n return is ? document.createElement(it) : {};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_dom-create.js\n ** module id = 33\n ** module chunks = 0\n **/","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function(it, S){\n if(!isObject(it))return it;\n var fn, val;\n if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;\n if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-primitive.js\n ** module id = 34\n ** module chunks = 0\n **/","module.exports = function(bitmap, value){\n return {\n enumerable : !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable : !(bitmap & 4),\n value : value\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_property-desc.js\n ** module id = 35\n ** module chunks = 0\n **/","module.exports = dexie;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"dexie\"\n ** module id = 36\n ** module chunks = 0\n **/","class SchemaParser {\r\n\r\n /**\r\n * Schema parser\r\n *\r\n * @param schema\r\n */\r\n constructor (schema) {\r\n this.schema = schema\r\n }\r\n\r\n /**\r\n * Extracts foreign keys from the schema\r\n *\r\n * @returns Object\r\n */\r\n getForeignKeys () {\r\n let foreignKeys = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n foreignKeys[table] = indexes\r\n .filter(idx => idx.indexOf('->') !== -1)\r\n .map(idx => {\r\n // split the column and foreign table info\r\n let [column, target] = idx.split('->').map(x => x.trim())\r\n\r\n return {\r\n index: column,\r\n targetTable: target.split('.')[0],\r\n targetIndex: target.split('.')[1]\r\n }\r\n })\r\n })\r\n\r\n return foreignKeys\r\n }\r\n\r\n /**\r\n * Get schema without the foreign key definitions\r\n *\r\n * @returns Object\r\n */\r\n getCleanedSchema () {\r\n let schema = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n // Remove foreign keys syntax before calling the original method\r\n schema[table] = indexes.map(idx => idx.split('->')[0].trim()).join(',')\r\n })\r\n\r\n return schema\r\n }\r\n}\r\n\r\nexport default SchemaParser\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/schema-parser.js\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _isIterable2 = require(\"../core-js/is-iterable\");\n\nvar _isIterable3 = _interopRequireDefault(_isIterable2);\n\nvar _getIterator2 = require(\"../core-js/get-iterator\");\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if ((0, _isIterable3.default)(Object(arr))) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/slicedToArray.js\n ** module id = 38\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/is-iterable\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/is-iterable.js\n ** module id = 39\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.is-iterable');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/is-iterable.js\n ** module id = 40\n ** module chunks = 0\n **/","require('./es6.array.iterator');\nvar global = require('./_global')\n , hide = require('./_hide')\n , Iterators = require('./_iterators')\n , TO_STRING_TAG = require('./_wks')('toStringTag');\n\nfor(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){\n var NAME = collections[i]\n , Collection = global[NAME]\n , proto = Collection && Collection.prototype;\n if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/web.dom.iterable.js\n ** module id = 41\n ** module chunks = 0\n **/","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables')\n , step = require('./_iter-step')\n , Iterators = require('./_iterators')\n , toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function(iterated, kind){\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , kind = this._k\n , index = this._i++;\n if(!O || index >= O.length){\n this._t = undefined;\n return step(1);\n }\n if(kind == 'keys' )return step(0, index);\n if(kind == 'values')return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.array.iterator.js\n ** module id = 42\n ** module chunks = 0\n **/","module.exports = function(){ /* empty */ };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_add-to-unscopables.js\n ** module id = 43\n ** module chunks = 0\n **/","module.exports = function(done, value){\n return {value: value, done: !!done};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-step.js\n ** module id = 44\n ** module chunks = 0\n **/","module.exports = {};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iterators.js\n ** module id = 45\n ** module chunks = 0\n **/","'use strict';\nvar LIBRARY = require('./_library')\n , $export = require('./_export')\n , redefine = require('./_redefine')\n , hide = require('./_hide')\n , has = require('./_has')\n , Iterators = require('./_iterators')\n , $iterCreate = require('./_iter-create')\n , setToStringTag = require('./_set-to-string-tag')\n , getPrototypeOf = require('./_object-gpo')\n , ITERATOR = require('./_wks')('iterator')\n , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`\n , FF_ITERATOR = '@@iterator'\n , KEYS = 'keys'\n , VALUES = 'values';\n\nvar returnThis = function(){ return this; };\n\nmodule.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){\n $iterCreate(Constructor, NAME, next);\n var getMethod = function(kind){\n if(!BUGGY && kind in proto)return proto[kind];\n switch(kind){\n case KEYS: return function keys(){ return new Constructor(this, kind); };\n case VALUES: return function values(){ return new Constructor(this, kind); };\n } return function entries(){ return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator'\n , DEF_VALUES = DEFAULT == VALUES\n , VALUES_BUG = false\n , proto = Base.prototype\n , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]\n , $default = $native || getMethod(DEFAULT)\n , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined\n , $anyNative = NAME == 'Array' ? proto.entries || $native : $native\n , methods, key, IteratorPrototype;\n // Fix native\n if($anyNative){\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base));\n if(IteratorPrototype !== Object.prototype){\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if(DEF_VALUES && $native && $native.name !== VALUES){\n VALUES_BUG = true;\n $default = function values(){ return $native.call(this); };\n }\n // Define iterator\n if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if(DEFAULT){\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if(FORCED)for(key in methods){\n if(!(key in proto))redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-define.js\n ** module id = 46\n ** module chunks = 0\n **/","module.exports = true;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_library.js\n ** module id = 47\n ** module chunks = 0\n **/","module.exports = require('./_hide');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_redefine.js\n ** module id = 48\n ** module chunks = 0\n **/","'use strict';\nvar create = require('./_object-create')\n , descriptor = require('./_property-desc')\n , setToStringTag = require('./_set-to-string-tag')\n , IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function(){ return this; });\n\nmodule.exports = function(Constructor, NAME, next){\n Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-create.js\n ** module id = 49\n ** module chunks = 0\n **/","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object')\n , dPs = require('./_object-dps')\n , enumBugKeys = require('./_enum-bug-keys')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , Empty = function(){ /* empty */ }\n , PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function(){\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe')\n , i = enumBugKeys.length\n , lt = '<'\n , gt = '>'\n , iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties){\n var result;\n if(O !== null){\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty;\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-create.js\n ** module id = 50\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , anObject = require('./_an-object')\n , getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties){\n anObject(O);\n var keys = getKeys(Properties)\n , length = keys.length\n , i = 0\n , P;\n while(length > i)dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-dps.js\n ** module id = 51\n ** module chunks = 0\n **/","module.exports = require('./_global').document && document.documentElement;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_html.js\n ** module id = 52\n ** module chunks = 0\n **/","var def = require('./_object-dp').f\n , has = require('./_has')\n , TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function(it, tag, stat){\n if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_set-to-string-tag.js\n ** module id = 53\n ** module chunks = 0\n **/","var store = require('./_shared')('wks')\n , uid = require('./_uid')\n , Symbol = require('./_global').Symbol\n , USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function(name){\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_wks.js\n ** module id = 54\n ** module chunks = 0\n **/","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has')\n , toObject = require('./_to-object')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function(O){\n O = toObject(O);\n if(has(O, IE_PROTO))return O[IE_PROTO];\n if(typeof O.constructor == 'function' && O instanceof O.constructor){\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-gpo.js\n ** module id = 55\n ** module chunks = 0\n **/","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function(iterated){\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , index = this._i\n , point;\n if(index >= O.length)return {value: undefined, done: true};\n point = $at(O, index);\n this._i += point.length;\n return {value: point, done: false};\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.string.iterator.js\n ** module id = 56\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function(TO_STRING){\n return function(that, pos){\n var s = String(defined(that))\n , i = toInteger(pos)\n , l = s.length\n , a, b;\n if(i < 0 || i >= l)return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_string-at.js\n ** module id = 57\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').isIterable = function(it){\n var O = Object(it);\n return O[ITERATOR] !== undefined\n || '@@iterator' in O\n || Iterators.hasOwnProperty(classof(O));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.is-iterable.js\n ** module id = 58\n ** module chunks = 0\n **/","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof')\n , TAG = require('./_wks')('toStringTag')\n // ES3 wrong here\n , ARG = cof(function(){ return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function(it, key){\n try {\n return it[key];\n } catch(e){ /* empty */ }\n};\n\nmodule.exports = function(it){\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_classof.js\n ** module id = 59\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/get-iterator\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/get-iterator.js\n ** module id = 60\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.get-iterator');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/get-iterator.js\n ** module id = 61\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , get = require('./core.get-iterator-method');\nmodule.exports = require('./_core').getIterator = function(it){\n var iterFn = get(it);\n if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');\n return anObject(iterFn.call(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.get-iterator.js\n ** module id = 62\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function(it){\n if(it != undefined)return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.get-iterator-method.js\n ** module id = 63\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nexports.default = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/classCallCheck.js\n ** module id = 64\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _defineProperty = require(\"../core-js/object/define-property\");\n\nvar _defineProperty2 = _interopRequireDefault(_defineProperty);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n (0, _defineProperty2.default)(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/createClass.js\n ** module id = 65\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/define-property\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/object/define-property.js\n ** module id = 66\n ** module chunks = 0\n **/","require('../../modules/es6.object.define-property');\nvar $Object = require('../../modules/_core').Object;\nmodule.exports = function defineProperty(it, key, desc){\n return $Object.defineProperty(it, key, desc);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/object/define-property.js\n ** module id = 67\n ** module chunks = 0\n **/","var $export = require('./_export');\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !require('./_descriptors'), 'Object', {defineProperty: require('./_object-dp').f});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.object.define-property.js\n ** module id = 68\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 0d8c00060df734096a6e","webpack:///./src/index.js","webpack:///./~/babel-runtime/core-js/json/stringify.js","webpack:///./~/core-js/library/fn/json/stringify.js","webpack:///./~/core-js/library/modules/_core.js","webpack:///./~/babel-runtime/core-js/object/keys.js","webpack:///./~/core-js/library/fn/object/keys.js","webpack:///./~/core-js/library/modules/es6.object.keys.js","webpack:///./~/core-js/library/modules/_to-object.js","webpack:///./~/core-js/library/modules/_defined.js","webpack:///./~/core-js/library/modules/_object-keys.js","webpack:///./~/core-js/library/modules/_object-keys-internal.js","webpack:///./~/core-js/library/modules/_has.js","webpack:///./~/core-js/library/modules/_to-iobject.js","webpack:///./~/core-js/library/modules/_iobject.js","webpack:///./~/core-js/library/modules/_cof.js","webpack:///./~/core-js/library/modules/_array-includes.js","webpack:///./~/core-js/library/modules/_to-length.js","webpack:///./~/core-js/library/modules/_to-integer.js","webpack:///./~/core-js/library/modules/_to-index.js","webpack:///./~/core-js/library/modules/_shared-key.js","webpack:///./~/core-js/library/modules/_shared.js","webpack:///./~/core-js/library/modules/_global.js","webpack:///./~/core-js/library/modules/_uid.js","webpack:///./~/core-js/library/modules/_enum-bug-keys.js","webpack:///./~/core-js/library/modules/_object-sap.js","webpack:///./~/core-js/library/modules/_export.js","webpack:///./~/core-js/library/modules/_ctx.js","webpack:///./~/core-js/library/modules/_a-function.js","webpack:///./~/core-js/library/modules/_hide.js","webpack:///./~/core-js/library/modules/_object-dp.js","webpack:///./~/core-js/library/modules/_an-object.js","webpack:///./~/core-js/library/modules/_is-object.js","webpack:///./~/core-js/library/modules/_ie8-dom-define.js","webpack:///./~/core-js/library/modules/_descriptors.js","webpack:///./~/core-js/library/modules/_fails.js","webpack:///./~/core-js/library/modules/_dom-create.js","webpack:///./~/core-js/library/modules/_to-primitive.js","webpack:///./~/core-js/library/modules/_property-desc.js","webpack:///./src/schema-parser.js","webpack:///./~/babel-runtime/helpers/slicedToArray.js","webpack:///./~/babel-runtime/core-js/is-iterable.js","webpack:///./~/core-js/library/fn/is-iterable.js","webpack:///./~/core-js/library/modules/web.dom.iterable.js","webpack:///./~/core-js/library/modules/es6.array.iterator.js","webpack:///./~/core-js/library/modules/_add-to-unscopables.js","webpack:///./~/core-js/library/modules/_iter-step.js","webpack:///./~/core-js/library/modules/_iterators.js","webpack:///./~/core-js/library/modules/_iter-define.js","webpack:///./~/core-js/library/modules/_library.js","webpack:///./~/core-js/library/modules/_redefine.js","webpack:///./~/core-js/library/modules/_iter-create.js","webpack:///./~/core-js/library/modules/_object-create.js","webpack:///./~/core-js/library/modules/_object-dps.js","webpack:///./~/core-js/library/modules/_html.js","webpack:///./~/core-js/library/modules/_set-to-string-tag.js","webpack:///./~/core-js/library/modules/_wks.js","webpack:///./~/core-js/library/modules/_object-gpo.js","webpack:///./~/core-js/library/modules/es6.string.iterator.js","webpack:///./~/core-js/library/modules/_string-at.js","webpack:///./~/core-js/library/modules/core.is-iterable.js","webpack:///./~/core-js/library/modules/_classof.js","webpack:///./~/babel-runtime/core-js/get-iterator.js","webpack:///./~/core-js/library/fn/get-iterator.js","webpack:///./~/core-js/library/modules/core.get-iterator.js","webpack:///./~/core-js/library/modules/core.get-iterator-method.js","webpack:///./~/babel-runtime/helpers/classCallCheck.js","webpack:///./~/babel-runtime/helpers/createClass.js","webpack:///./~/babel-runtime/core-js/object/define-property.js","webpack:///./~/core-js/library/fn/object/define-property.js","webpack:///./~/core-js/library/modules/es6.object.define-property.js","webpack:///./src/utils.js"],"names":["Relationships","db","Dexie","constructor","Promise","Table","prototype","with","relationships","toCollection","Collection","baseTable","_ctx","table","name","databaseTables","_allTables","usableForeignTables","forEach","column","hasOwnProperty","Error","schema","columns","foreignKeys","filter","targetTable","length","foreign","foreignTableNames","toArray","then","queries","map","foreignTable","tableName","allRelatedKeys","rows","row","targetIndex","where","index","anyOf","queryPromises","query","all","idx","result","queryResults","foreignIndex","lookup","arrayProperty","foreignKey","record","push","Version","_parseStoresSpec","override","storesSpec","outDbSchema","parser","getForeignKeys","rv","parseStoresSpec","call","getCleanedSchema","module","exports","SchemaParser","indexes","split","indexOf","x","trim","target","join","isIndexableType","value","Date","Array","isArray","every"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;ACtCA;;;;AACA;;;;AAEA,KAAMA,gBAAgB,SAAhBA,aAAgB,CAACC,EAAD,EAAQ;AAC5B,OAAMC,QAAQD,GAAGE,WAAjB;AACA;AACA,OAAMC,UAAUF,MAAME,OAAtB;;AAEA;;;;;;;AAOAH,MAAGI,KAAH,CAASC,SAAT,CAAmBC,IAAnB,GAA0B,UAAUC,aAAV,EAAyB;AACjD,YAAO,KAAKC,YAAL,GAAoBF,IAApB,CAAyBC,aAAzB,CAAP;AACD,IAFD;;AAIA;;;;;;;AAOAP,MAAGS,UAAH,CAAcJ,SAAd,CAAwBC,IAAxB,GAA+B,UAAUC,aAAV,EAAyB;AACtD,SAAMG,YAAY,KAAKC,IAAL,CAAUC,KAAV,CAAgBC,IAAlC;AACA,SAAMC,iBAAiBd,GAAGe,UAA1B;;AAEA;AACA,SAAIC,sBAAsB,EAA1B;;AAEA;AACA,yBAAYT,aAAZ,EAA2BU,OAA3B,CAAmC,UAACC,MAAD,EAAY;AAC7C,WAAIN,QAAQL,cAAcW,MAAd,CAAZ;;AAEA,WAAI,CAACJ,eAAeK,cAAf,CAA8BP,KAA9B,CAAL,EAA2C;AACzC,eAAM,IAAIQ,KAAJ,CAAU,wBAAwBR,KAAxB,GAAgC,kBAA1C,CAAN;AACD;;AAED,WAAI,CAACE,eAAeF,KAAf,EAAsBS,MAAtB,CAA6BF,cAA7B,CAA4C,aAA5C,CAAL,EAAiE;AAC/D,eAAM,IAAIC,KAAJ,CAAU,wBAAwBR,KAAxB,GAAgC,kCAA1C,CAAN;AACD;;AAED;AACA,WAAIU,UAAUR,eAAeF,KAAf,EAAsBS,MAAtB,CAA6BE,WAA7B,CAAyCC,MAAzC,CAAgD;AAAA,gBAAUN,OAAOO,WAAP,KAAuBf,SAAjC;AAAA,QAAhD,CAAd;;AAEA,WAAIY,QAAQI,MAAR,GAAiB,CAArB,EAAwB;AACtBV,6BAAoBJ,KAApB,IAA6B;AAC3BM,mBAAQA,MADmB;AAE3BS,oBAASL,QAAQ,CAAR;AAFkB,UAA7B;AAID;AACF,MApBD;;AAsBA,SAAIM,oBAAoB,oBAAYZ,mBAAZ,CAAxB;;AAEA,YAAO,KAAKa,OAAL,GAAeC,IAAf,CAAoB,gBAAQ;AACjC;AACA;AACA;AACA,WAAIC,UAAUH,kBACXI,GADW,CACP,qBAAa;AAChB;AACA,aAAIC,eAAejB,oBAAoBkB,SAApB,CAAnB;AACA,aAAIC,iBAAiBC,KAClBJ,GADkB,CACd;AAAA,kBAAOK,IAAIJ,aAAaN,OAAb,CAAqBW,WAAzB,CAAP;AAAA,UADc,EAElBd,MAFkB,wBAArB;;AAIA;AACA,gBAAOV,eAAeoB,SAAf,EACJK,KADI,CACEN,aAAaN,OAAb,CAAqBa,KADvB,EAEJC,KAFI,CAEEN,cAFF,CAAP;AAGD,QAZW,CAAd;;AAcA;AACA,WAAIO,gBAAgBX,QAAQC,GAAR,CAAY;AAAA,gBAASW,MAAMd,OAAN,EAAT;AAAA,QAAZ,CAApB;;AAEA;AACA;AACA;AACA;AACA,cAAO1B,QAAQyC,GAAR,CAAYF,aAAZ,EAA2BZ,IAA3B,CAAgC,wBAAgB;AACrDF,2BAAkBX,OAAlB,CAA0B,UAACiB,SAAD,EAAYW,GAAZ,EAAoB;AAC5C,eAAIZ,eAAejB,oBAAoBkB,SAApB,CAAnB;AACA,eAAIY,SAASC,aAAaF,GAAb,CAAb;AACA,eAAIP,cAAcL,aAAaN,OAAb,CAAqBW,WAAvC;AACA,eAAIU,eAAef,aAAaN,OAAb,CAAqBa,KAAxC;AACA,eAAItB,SAASe,aAAaf,MAA1B;;AAEA;AACA;AACA,eAAI+B,SAAS,EAAb;AACAb,gBAAKnB,OAAL,CAAa,eAAO;AAClB,iBAAIiC,gBAAgB,EAApB;AACAb,iBAAInB,MAAJ,IAAcgC,aAAd;AACAD,oBAAOZ,IAAIC,WAAJ,CAAP,IAA2BY,aAA3B;AACD,YAJD;;AAMA;AACAJ,kBAAO7B,OAAP,CAAe,kBAAU;AACvB,iBAAIkC,aAAaC,OAAOJ,YAAP,CAAjB;AACA,iBAAIE,gBAAgBD,OAAOE,UAAP,CAApB;AACA,iBAAI,CAACD,aAAL,EAAoB;AAClB,qBAAM,IAAI9B,KAAJ,CACJ,yCACGc,SADH,SACgBc,YADhB,YACmCtC,SADnC,SACgDQ,MADhD,qDAEuC,yBAAeiC,UAAf,CAFvC,OADI,CAAN;AAID;;AAEDD,2BAAcG,IAAd,CAAmBD,MAAnB;AACD,YAXD;AAYD,UA7BD;AA8BD,QA/BM,EA+BJtB,IA/BI,CA+BC;AAAA,gBAAMM,IAAN;AAAA,QA/BD,CAAP;AAgCD,MAzDM,CAAP;AA0DD,IA1FD;;AA4FApC,MAAGsD,OAAH,CAAWjD,SAAX,CAAqBkD,gBAArB,GAAwCtD,MAAMuD,QAAN,CACtCxD,GAAGsD,OAAH,CAAWjD,SAAX,CAAqBkD,gBADiB,EAEtC;AAAA,YAAmB,UAAUE,UAAV,EAAsBC,WAAtB,EAAmC;AACpD,WAAMC,SAAS,2BAAiBF,UAAjB,CAAf;;AAEA,WAAIlC,cAAcoC,OAAOC,cAAP,EAAlB;AACA;AACA,WAAIC,KAAKC,gBAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,OAAOK,gBAAP,EAA3B,EAAsDN,WAAtD,CAAT;;AAEA;AACA;AACA,2BAAYA,WAAZ,EAAyBzC,OAAzB,CAAiC,iBAAS;AACxC,aAAIM,YAAYJ,cAAZ,CAA2BP,KAA3B,CAAJ,EAAuC;AACrC8C,uBAAY9C,KAAZ,EAAmBW,WAAnB,GAAiCA,YAAYX,KAAZ,CAAjC;AACD;AACF,QAJD;;AAMA,cAAOiD,EAAP;AACD,MAhBD;AAAA,IAFsC,CAAxC;AAmBD,EAtID;;AAwIAI,QAAOC,OAAP,GAAiBnE,aAAjB,C;;;;;;AC3IA,mBAAkB,uD;;;;;;ACAlB;AACA,wCAAuC,0BAA0B;AACjE,yCAAwC;AACxC;AACA,G;;;;;;ACJA,8BAA6B;AAC7B,sCAAqC,gC;;;;;;ACDrC,mBAAkB,uD;;;;;;ACAlB;AACA,qD;;;;;;ACDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAC,E;;;;;;ACRD;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;;AAEA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA,wBAAuB;AACvB;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA,G;;;;;;ACJA,kBAAiB;;AAEjB;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK,WAAW,eAAe;AAC/B;AACA,MAAK;AACL;AACA,G;;;;;;ACpBA;AACA;AACA;AACA;AACA,4DAA2D;AAC3D,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,oDAAmD;AACnD;AACA,wCAAuC;AACvC,G;;;;;;ACLA;AACA;AACA;AACA,wCAAuC,gC;;;;;;ACHvC;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA,c;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,+BAA8B;AAC9B;AACA;AACA,oDAAmD,OAAO,EAAE;AAC5D,G;;;;;;ACTA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAmE;AACnE;AACA,sFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,gDAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd,eAAc;AACd,eAAc;AACd,eAAc;AACd,gBAAe;AACf,gBAAe;AACf,gBAAe;AACf,iBAAgB;AAChB,0B;;;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACnBA;AACA;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA,G;;;;;;ACPA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;AACA;AACA;AACA,G;;;;;;ACfA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,G;;;;;;ACFA;AACA,sEAAsE,gBAAgB,UAAU,GAAG;AACnG,EAAC,E;;;;;;ACFD;AACA;AACA,kCAAiC,QAAQ,gBAAgB,UAAU,GAAG;AACtE,EAAC,E;;;;;;ACHD;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCPMoE,Y;;AAEJ;;;;;AAKA,yBAAa9C,MAAb,EAAqB;AAAA;;AACnB,UAAKA,MAAL,GAAcA,MAAd;AACD;;AAED;;;;;;;;;sCAKkB;AAAA;;AAChB,WAAIE,cAAc,EAAlB;;AAEA,2BAAY,KAAKF,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAImD,UAAU,MAAK/C,MAAL,CAAYT,KAAZ,EAAmByD,KAAnB,CAAyB,GAAzB,CAAd;;AAEA9C,qBAAYX,KAAZ,IAAqBwD,QAClB5C,MADkB,CACX;AAAA,kBAAOqB,IAAIyB,OAAJ,CAAY,IAAZ,MAAsB,CAAC,CAA9B;AAAA,UADW,EAElBtC,GAFkB,CAEd,eAAO;AACV;AADU,gCAEaa,IAAIwB,KAAJ,CAAU,IAAV,EAAgBrC,GAAhB,CAAoB;AAAA,oBAAKuC,EAAEC,IAAF,EAAL;AAAA,YAApB,CAFb;AAAA;AAAA,eAELtD,MAFK;AAAA,eAEGuD,MAFH;;AAIV,kBAAO;AACLjC,oBAAOtB,MADF;AAELO,0BAAagD,OAAOJ,KAAP,CAAa,GAAb,EAAkB,CAAlB,CAFR;AAGL/B,0BAAamC,OAAOJ,KAAP,CAAa,GAAb,EAAkB,CAAlB;AAHR,YAAP;AAKD,UAXkB,CAArB;AAYD,QAfD;;AAiBA,cAAO9C,WAAP;AACD;;AAED;;;;;;;;wCAKoB;AAAA;;AAClB,WAAIF,SAAS,EAAb;;AAEA,2BAAY,KAAKA,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAImD,UAAU,OAAK/C,MAAL,CAAYT,KAAZ,EAAmByD,KAAnB,CAAyB,GAAzB,CAAd;;AAEA;AACAhD,gBAAOT,KAAP,IAAgBwD,QAAQpC,GAAR,CAAY;AAAA,kBAAOa,IAAIwB,KAAJ,CAAU,IAAV,EAAgB,CAAhB,EAAmBG,IAAnB,EAAP;AAAA,UAAZ,EAA8CE,IAA9C,CAAmD,GAAnD,CAAhB;AACD,QALD;;AAOA,cAAOrD,MAAP;AACD;;;;;mBAGY8C,Y;;;;;;AC1Df;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yDAAwD,+BAA+B;AACvF;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA,EAAC,G;;;;;;AClDD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;;AAEA,yGAAwG,OAAO;AAC/G;AACA;AACA;AACA;AACA;AACA,E;;;;;;ACZA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAgC;AAChC,eAAc;AACd,kBAAiB;AACjB;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;;AAEA;AACA;AACA,6B;;;;;;ACjCA,6BAA4B,e;;;;;;ACA5B;AACA,WAAU;AACV,G;;;;;;ACFA,qB;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA4B,aAAa;;AAEzC;AACA;AACA;AACA;AACA;AACA,yCAAwC,oCAAoC;AAC5E,6CAA4C,oCAAoC;AAChF,MAAK,2BAA2B,oCAAoC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB,mBAAmB;AACnC;AACA;AACA,kCAAiC,2BAA2B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,G;;;;;;ACrEA,uB;;;;;;ACAA,0C;;;;;;ACAA;AACA;AACA;AACA;AACA;;AAEA;AACA,4FAAgF,aAAa,EAAE;;AAE/F;AACA,sDAAqD,0BAA0B;AAC/E;AACA,G;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;;;;;;ACxCA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACZA,+E;;;;;;ACAA;AACA;AACA;;AAEA;AACA,mEAAkE,+BAA+B;AACjG,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wB;;;;;;ACVA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH,G;;;;;;ACZA;AACA;;AAEA;AACA;AACA,8BAA6B;AAC7B,eAAc;AACd;AACA,EAAC;AACD;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,WAAU;AACV,EAAC,E;;;;;;AChBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;AACA;AACA;AACA;AACA,0BAAyB,kBAAkB,EAAE;;AAE7C;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACtBA,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA,oBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAC,G;;;;;;AC1BD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,sEAAuE,0CAA0C,E;;;;;;;;;;;SCDjGQ,e,GAAAA,e;AAAT,UAASA,eAAT,CAA0BC,KAA1B,EAAiC;AACtC,UAAOA,SAAS,IAAT,MAAkB;AACvB,UAAOA,KAAP,KAAiB,QAAjB,IACA,OAAOA,KAAP,KAAiB,QADjB,IAEAA,iBAAiBC,IAFjB,IAGCC,MAAMC,OAAN,CAAcH,KAAd,KAAwBA,MAAMI,KAAN,CAAYL,eAAZ,CAJpB,CAAP;AAMD,E","file":"dexie-relationships.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 0d8c00060df734096a6e\n **/","import SchemaParser from './schema-parser'\r\nimport {isIndexableType} from './utils'\r\n\r\nconst Relationships = (db) => {\r\n const Dexie = db.constructor\r\n // Use Dexie.Promise to ensure transaction safety.\r\n const Promise = Dexie.Promise\r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Table.prototype.with = function (relationships) {\r\n return this.toCollection().with(relationships)\r\n }\r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Collection.prototype.with = function (relationships) {\r\n const baseTable = this._ctx.table.name\r\n const databaseTables = db._allTables\r\n\r\n // this holds tables that have foreign keys pointing at the current table\r\n let usableForeignTables = {}\r\n\r\n // validate target tables and add them into our usable tables object\r\n Object.keys(relationships).forEach((column) => {\r\n let table = relationships[column]\r\n\r\n if (!databaseTables.hasOwnProperty(table)) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t exist.')\r\n }\r\n\r\n if (!databaseTables[table].schema.hasOwnProperty('foreignKeys')) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t have foreign keys set.')\r\n }\r\n\r\n // remove the foreign keys that don't link to the base table\r\n let columns = databaseTables[table].schema.foreignKeys.filter(column => column.targetTable === baseTable)\r\n\r\n if (columns.length > 0) {\r\n usableForeignTables[table] = {\r\n column: column,\r\n foreign: columns[0]\r\n }\r\n }\r\n })\r\n\r\n let foreignTableNames = Object.keys(usableForeignTables)\r\n\r\n return this.toArray().then(rows => {\r\n //\r\n // Extract the mix of all related keys in all rows\r\n //\r\n let queries = foreignTableNames\r\n .map(tableName => {\r\n // For each foreign table, query all items that any row refers to\r\n let foreignTable = usableForeignTables[tableName]\r\n let allRelatedKeys = rows\r\n .map(row => row[foreignTable.foreign.targetIndex])\r\n .filter(isIndexableType)\r\n\r\n // Build the Collection to retrieve all related items\r\n return databaseTables[tableName]\r\n .where(foreignTable.foreign.index)\r\n .anyOf(allRelatedKeys)\r\n })\r\n\r\n // Execute queries in parallell\r\n let queryPromises = queries.map(query => query.toArray())\r\n\r\n //\r\n // Await all results and then try mapping each response\r\n // with its corresponding row and attach related items onto each row\r\n //\r\n return Promise.all(queryPromises).then(queryResults => {\r\n foreignTableNames.forEach((tableName, idx) => {\r\n let foreignTable = usableForeignTables[tableName]\r\n let result = queryResults[idx]\r\n let targetIndex = foreignTable.foreign.targetIndex\r\n let foreignIndex = foreignTable.foreign.index\r\n let column = foreignTable.column\r\n\r\n // Create a lookup by targetIndex (normally 'id')\r\n // and set the column onto the target\r\n let lookup = {}\r\n rows.forEach(row => {\r\n let arrayProperty = []\r\n row[column] = arrayProperty\r\n lookup[row[targetIndex]] = arrayProperty\r\n })\r\n\r\n // Populate column on each row\r\n result.forEach(record => {\r\n let foreignKey = record[foreignIndex]\r\n let arrayProperty = lookup[foreignKey]\r\n if (!arrayProperty) {\r\n throw new Error(\r\n `Could not lookup foreign key where ` +\r\n `${tableName}.${foreignIndex} == ${baseTable}.${column}. ` +\r\n `The content of the failing key was: ${JSON.stringify(foreignKey)}.`)\r\n }\r\n\r\n arrayProperty.push(record)\r\n })\r\n })\r\n }).then(() => rows)\r\n })\r\n }\r\n\r\n db.Version.prototype._parseStoresSpec = Dexie.override(\r\n db.Version.prototype._parseStoresSpec,\r\n parseStoresSpec => function (storesSpec, outDbSchema) {\r\n const parser = new SchemaParser(storesSpec)\r\n\r\n let foreignKeys = parser.getForeignKeys()\r\n // call the original method\r\n let rv = parseStoresSpec.call(this, parser.getCleanedSchema(), outDbSchema)\r\n\r\n // set foreign keys into database table objects\r\n // to use later in 'with' method\r\n Object.keys(outDbSchema).forEach(table => {\r\n if (foreignKeys.hasOwnProperty(table)) {\r\n outDbSchema[table].foreignKeys = foreignKeys[table]\r\n }\r\n })\r\n\r\n return rv\r\n })\r\n}\r\n\r\nmodule.exports = Relationships\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","module.exports = { \"default\": require(\"core-js/library/fn/json/stringify\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/json/stringify.js\n ** module id = 1\n ** module chunks = 0\n **/","var core = require('../../modules/_core')\n , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});\nmodule.exports = function stringify(it){ // eslint-disable-line no-unused-vars\n return $JSON.stringify.apply($JSON, arguments);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/json/stringify.js\n ** module id = 2\n ** module chunks = 0\n **/","var core = module.exports = {version: '2.4.0'};\nif(typeof __e == 'number')__e = core; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_core.js\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/keys\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/object/keys.js\n ** module id = 4\n ** module chunks = 0\n **/","require('../../modules/es6.object.keys');\nmodule.exports = require('../../modules/_core').Object.keys;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/object/keys.js\n ** module id = 5\n ** module chunks = 0\n **/","// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object')\n , $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function(){\n return function keys(it){\n return $keys(toObject(it));\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.object.keys.js\n ** module id = 6\n ** module chunks = 0\n **/","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function(it){\n return Object(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-object.js\n ** module id = 7\n ** module chunks = 0\n **/","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function(it){\n if(it == undefined)throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_defined.js\n ** module id = 8\n ** module chunks = 0\n **/","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal')\n , enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O){\n return $keys(O, enumBugKeys);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-keys.js\n ** module id = 9\n ** module chunks = 0\n **/","var has = require('./_has')\n , toIObject = require('./_to-iobject')\n , arrayIndexOf = require('./_array-includes')(false)\n , IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function(object, names){\n var O = toIObject(object)\n , i = 0\n , result = []\n , key;\n for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while(names.length > i)if(has(O, key = names[i++])){\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-keys-internal.js\n ** module id = 10\n ** module chunks = 0\n **/","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function(it, key){\n return hasOwnProperty.call(it, key);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_has.js\n ** module id = 11\n ** module chunks = 0\n **/","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject')\n , defined = require('./_defined');\nmodule.exports = function(it){\n return IObject(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-iobject.js\n ** module id = 12\n ** module chunks = 0\n **/","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iobject.js\n ** module id = 13\n ** module chunks = 0\n **/","var toString = {}.toString;\n\nmodule.exports = function(it){\n return toString.call(it).slice(8, -1);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_cof.js\n ** module id = 14\n ** module chunks = 0\n **/","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject')\n , toLength = require('./_to-length')\n , toIndex = require('./_to-index');\nmodule.exports = function(IS_INCLUDES){\n return function($this, el, fromIndex){\n var O = toIObject($this)\n , length = toLength(O.length)\n , index = toIndex(fromIndex, length)\n , value;\n // Array#includes uses SameValueZero equality algorithm\n if(IS_INCLUDES && el != el)while(length > index){\n value = O[index++];\n if(value != value)return true;\n // Array#toIndex ignores holes, Array#includes - not\n } else for(;length > index; index++)if(IS_INCLUDES || index in O){\n if(O[index] === el)return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_array-includes.js\n ** module id = 15\n ** module chunks = 0\n **/","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer')\n , min = Math.min;\nmodule.exports = function(it){\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-length.js\n ** module id = 16\n ** module chunks = 0\n **/","// 7.1.4 ToInteger\nvar ceil = Math.ceil\n , floor = Math.floor;\nmodule.exports = function(it){\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-integer.js\n ** module id = 17\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , max = Math.max\n , min = Math.min;\nmodule.exports = function(index, length){\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-index.js\n ** module id = 18\n ** module chunks = 0\n **/","var shared = require('./_shared')('keys')\n , uid = require('./_uid');\nmodule.exports = function(key){\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_shared-key.js\n ** module id = 19\n ** module chunks = 0\n **/","var global = require('./_global')\n , SHARED = '__core-js_shared__'\n , store = global[SHARED] || (global[SHARED] = {});\nmodule.exports = function(key){\n return store[key] || (store[key] = {});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_shared.js\n ** module id = 20\n ** module chunks = 0\n **/","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();\nif(typeof __g == 'number')__g = global; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_global.js\n ** module id = 21\n ** module chunks = 0\n **/","var id = 0\n , px = Math.random();\nmodule.exports = function(key){\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_uid.js\n ** module id = 22\n ** module chunks = 0\n **/","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_enum-bug-keys.js\n ** module id = 23\n ** module chunks = 0\n **/","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export')\n , core = require('./_core')\n , fails = require('./_fails');\nmodule.exports = function(KEY, exec){\n var fn = (core.Object || {})[KEY] || Object[KEY]\n , exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-sap.js\n ** module id = 24\n ** module chunks = 0\n **/","var global = require('./_global')\n , core = require('./_core')\n , ctx = require('./_ctx')\n , hide = require('./_hide')\n , PROTOTYPE = 'prototype';\n\nvar $export = function(type, name, source){\n var IS_FORCED = type & $export.F\n , IS_GLOBAL = type & $export.G\n , IS_STATIC = type & $export.S\n , IS_PROTO = type & $export.P\n , IS_BIND = type & $export.B\n , IS_WRAP = type & $export.W\n , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})\n , expProto = exports[PROTOTYPE]\n , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]\n , key, own, out;\n if(IS_GLOBAL)source = name;\n for(key in source){\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if(own && key in exports)continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function(C){\n var F = function(a, b, c){\n if(this instanceof C){\n switch(arguments.length){\n case 0: return new C;\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if(IS_PROTO){\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library` \nmodule.exports = $export;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_export.js\n ** module id = 25\n ** module chunks = 0\n **/","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function(fn, that, length){\n aFunction(fn);\n if(that === undefined)return fn;\n switch(length){\n case 1: return function(a){\n return fn.call(that, a);\n };\n case 2: return function(a, b){\n return fn.call(that, a, b);\n };\n case 3: return function(a, b, c){\n return fn.call(that, a, b, c);\n };\n }\n return function(/* ...args */){\n return fn.apply(that, arguments);\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_ctx.js\n ** module id = 26\n ** module chunks = 0\n **/","module.exports = function(it){\n if(typeof it != 'function')throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_a-function.js\n ** module id = 27\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function(object, key, value){\n return dP.f(object, key, createDesc(1, value));\n} : function(object, key, value){\n object[key] = value;\n return object;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_hide.js\n ** module id = 28\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , IE8_DOM_DEFINE = require('./_ie8-dom-define')\n , toPrimitive = require('./_to-primitive')\n , dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if(IE8_DOM_DEFINE)try {\n return dP(O, P, Attributes);\n } catch(e){ /* empty */ }\n if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');\n if('value' in Attributes)O[P] = Attributes.value;\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-dp.js\n ** module id = 29\n ** module chunks = 0\n **/","var isObject = require('./_is-object');\nmodule.exports = function(it){\n if(!isObject(it))throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_an-object.js\n ** module id = 30\n ** module chunks = 0\n **/","module.exports = function(it){\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_is-object.js\n ** module id = 31\n ** module chunks = 0\n **/","module.exports = !require('./_descriptors') && !require('./_fails')(function(){\n return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_ie8-dom-define.js\n ** module id = 32\n ** module chunks = 0\n **/","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function(){\n return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_descriptors.js\n ** module id = 33\n ** module chunks = 0\n **/","module.exports = function(exec){\n try {\n return !!exec();\n } catch(e){\n return true;\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_fails.js\n ** module id = 34\n ** module chunks = 0\n **/","var isObject = require('./_is-object')\n , document = require('./_global').document\n // in old IE typeof document.createElement is 'object'\n , is = isObject(document) && isObject(document.createElement);\nmodule.exports = function(it){\n return is ? document.createElement(it) : {};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_dom-create.js\n ** module id = 35\n ** module chunks = 0\n **/","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function(it, S){\n if(!isObject(it))return it;\n var fn, val;\n if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;\n if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_to-primitive.js\n ** module id = 36\n ** module chunks = 0\n **/","module.exports = function(bitmap, value){\n return {\n enumerable : !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable : !(bitmap & 4),\n value : value\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_property-desc.js\n ** module id = 37\n ** module chunks = 0\n **/","class SchemaParser {\r\n\r\n /**\r\n * Schema parser\r\n *\r\n * @param schema\r\n */\r\n constructor (schema) {\r\n this.schema = schema\r\n }\r\n\r\n /**\r\n * Extracts foreign keys from the schema\r\n *\r\n * @returns Object\r\n */\r\n getForeignKeys () {\r\n let foreignKeys = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n foreignKeys[table] = indexes\r\n .filter(idx => idx.indexOf('->') !== -1)\r\n .map(idx => {\r\n // split the column and foreign table info\r\n let [column, target] = idx.split('->').map(x => x.trim())\r\n\r\n return {\r\n index: column,\r\n targetTable: target.split('.')[0],\r\n targetIndex: target.split('.')[1]\r\n }\r\n })\r\n })\r\n\r\n return foreignKeys\r\n }\r\n\r\n /**\r\n * Get schema without the foreign key definitions\r\n *\r\n * @returns Object\r\n */\r\n getCleanedSchema () {\r\n let schema = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n // Remove foreign keys syntax before calling the original method\r\n schema[table] = indexes.map(idx => idx.split('->')[0].trim()).join(',')\r\n })\r\n\r\n return schema\r\n }\r\n}\r\n\r\nexport default SchemaParser\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/schema-parser.js\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _isIterable2 = require(\"../core-js/is-iterable\");\n\nvar _isIterable3 = _interopRequireDefault(_isIterable2);\n\nvar _getIterator2 = require(\"../core-js/get-iterator\");\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if ((0, _isIterable3.default)(Object(arr))) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/slicedToArray.js\n ** module id = 39\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/is-iterable\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/is-iterable.js\n ** module id = 40\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.is-iterable');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/is-iterable.js\n ** module id = 41\n ** module chunks = 0\n **/","require('./es6.array.iterator');\nvar global = require('./_global')\n , hide = require('./_hide')\n , Iterators = require('./_iterators')\n , TO_STRING_TAG = require('./_wks')('toStringTag');\n\nfor(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){\n var NAME = collections[i]\n , Collection = global[NAME]\n , proto = Collection && Collection.prototype;\n if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/web.dom.iterable.js\n ** module id = 42\n ** module chunks = 0\n **/","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables')\n , step = require('./_iter-step')\n , Iterators = require('./_iterators')\n , toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function(iterated, kind){\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , kind = this._k\n , index = this._i++;\n if(!O || index >= O.length){\n this._t = undefined;\n return step(1);\n }\n if(kind == 'keys' )return step(0, index);\n if(kind == 'values')return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.array.iterator.js\n ** module id = 43\n ** module chunks = 0\n **/","module.exports = function(){ /* empty */ };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_add-to-unscopables.js\n ** module id = 44\n ** module chunks = 0\n **/","module.exports = function(done, value){\n return {value: value, done: !!done};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-step.js\n ** module id = 45\n ** module chunks = 0\n **/","module.exports = {};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iterators.js\n ** module id = 46\n ** module chunks = 0\n **/","'use strict';\nvar LIBRARY = require('./_library')\n , $export = require('./_export')\n , redefine = require('./_redefine')\n , hide = require('./_hide')\n , has = require('./_has')\n , Iterators = require('./_iterators')\n , $iterCreate = require('./_iter-create')\n , setToStringTag = require('./_set-to-string-tag')\n , getPrototypeOf = require('./_object-gpo')\n , ITERATOR = require('./_wks')('iterator')\n , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`\n , FF_ITERATOR = '@@iterator'\n , KEYS = 'keys'\n , VALUES = 'values';\n\nvar returnThis = function(){ return this; };\n\nmodule.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){\n $iterCreate(Constructor, NAME, next);\n var getMethod = function(kind){\n if(!BUGGY && kind in proto)return proto[kind];\n switch(kind){\n case KEYS: return function keys(){ return new Constructor(this, kind); };\n case VALUES: return function values(){ return new Constructor(this, kind); };\n } return function entries(){ return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator'\n , DEF_VALUES = DEFAULT == VALUES\n , VALUES_BUG = false\n , proto = Base.prototype\n , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]\n , $default = $native || getMethod(DEFAULT)\n , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined\n , $anyNative = NAME == 'Array' ? proto.entries || $native : $native\n , methods, key, IteratorPrototype;\n // Fix native\n if($anyNative){\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base));\n if(IteratorPrototype !== Object.prototype){\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if(DEF_VALUES && $native && $native.name !== VALUES){\n VALUES_BUG = true;\n $default = function values(){ return $native.call(this); };\n }\n // Define iterator\n if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if(DEFAULT){\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if(FORCED)for(key in methods){\n if(!(key in proto))redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-define.js\n ** module id = 47\n ** module chunks = 0\n **/","module.exports = true;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_library.js\n ** module id = 48\n ** module chunks = 0\n **/","module.exports = require('./_hide');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_redefine.js\n ** module id = 49\n ** module chunks = 0\n **/","'use strict';\nvar create = require('./_object-create')\n , descriptor = require('./_property-desc')\n , setToStringTag = require('./_set-to-string-tag')\n , IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function(){ return this; });\n\nmodule.exports = function(Constructor, NAME, next){\n Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_iter-create.js\n ** module id = 50\n ** module chunks = 0\n **/","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object')\n , dPs = require('./_object-dps')\n , enumBugKeys = require('./_enum-bug-keys')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , Empty = function(){ /* empty */ }\n , PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function(){\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe')\n , i = enumBugKeys.length\n , lt = '<'\n , gt = '>'\n , iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties){\n var result;\n if(O !== null){\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty;\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-create.js\n ** module id = 51\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , anObject = require('./_an-object')\n , getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties){\n anObject(O);\n var keys = getKeys(Properties)\n , length = keys.length\n , i = 0\n , P;\n while(length > i)dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-dps.js\n ** module id = 52\n ** module chunks = 0\n **/","module.exports = require('./_global').document && document.documentElement;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_html.js\n ** module id = 53\n ** module chunks = 0\n **/","var def = require('./_object-dp').f\n , has = require('./_has')\n , TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function(it, tag, stat){\n if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_set-to-string-tag.js\n ** module id = 54\n ** module chunks = 0\n **/","var store = require('./_shared')('wks')\n , uid = require('./_uid')\n , Symbol = require('./_global').Symbol\n , USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function(name){\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_wks.js\n ** module id = 55\n ** module chunks = 0\n **/","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has')\n , toObject = require('./_to-object')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function(O){\n O = toObject(O);\n if(has(O, IE_PROTO))return O[IE_PROTO];\n if(typeof O.constructor == 'function' && O instanceof O.constructor){\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_object-gpo.js\n ** module id = 56\n ** module chunks = 0\n **/","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function(iterated){\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , index = this._i\n , point;\n if(index >= O.length)return {value: undefined, done: true};\n point = $at(O, index);\n this._i += point.length;\n return {value: point, done: false};\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.string.iterator.js\n ** module id = 57\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function(TO_STRING){\n return function(that, pos){\n var s = String(defined(that))\n , i = toInteger(pos)\n , l = s.length\n , a, b;\n if(i < 0 || i >= l)return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_string-at.js\n ** module id = 58\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').isIterable = function(it){\n var O = Object(it);\n return O[ITERATOR] !== undefined\n || '@@iterator' in O\n || Iterators.hasOwnProperty(classof(O));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.is-iterable.js\n ** module id = 59\n ** module chunks = 0\n **/","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof')\n , TAG = require('./_wks')('toStringTag')\n // ES3 wrong here\n , ARG = cof(function(){ return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function(it, key){\n try {\n return it[key];\n } catch(e){ /* empty */ }\n};\n\nmodule.exports = function(it){\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/_classof.js\n ** module id = 60\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/get-iterator\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/get-iterator.js\n ** module id = 61\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.get-iterator');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/get-iterator.js\n ** module id = 62\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , get = require('./core.get-iterator-method');\nmodule.exports = require('./_core').getIterator = function(it){\n var iterFn = get(it);\n if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');\n return anObject(iterFn.call(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.get-iterator.js\n ** module id = 63\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function(it){\n if(it != undefined)return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/core.get-iterator-method.js\n ** module id = 64\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nexports.default = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/classCallCheck.js\n ** module id = 65\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _defineProperty = require(\"../core-js/object/define-property\");\n\nvar _defineProperty2 = _interopRequireDefault(_defineProperty);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n (0, _defineProperty2.default)(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/helpers/createClass.js\n ** module id = 66\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/define-property\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/babel-runtime/core-js/object/define-property.js\n ** module id = 67\n ** module chunks = 0\n **/","require('../../modules/es6.object.define-property');\nvar $Object = require('../../modules/_core').Object;\nmodule.exports = function defineProperty(it, key, desc){\n return $Object.defineProperty(it, key, desc);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/fn/object/define-property.js\n ** module id = 68\n ** module chunks = 0\n **/","var $export = require('./_export');\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !require('./_descriptors'), 'Object', {defineProperty: require('./_object-dp').f});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/core-js/library/modules/es6.object.define-property.js\n ** module id = 69\n ** module chunks = 0\n **/","\r\nexport function isIndexableType (value) {\r\n return value != null && (// Using \"!=\" instead of \"!==\" to check for both null and undefined!\r\n typeof value === 'string' ||\r\n typeof value === 'number' ||\r\n value instanceof Date ||\r\n (Array.isArray(value) && value.every(isIndexableType))\r\n )\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index d83b80e..9129dcd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "directories": { "test": "tests" }, - "dependencies": {}, + "peerDependencies": { + "dexie": "^2.0.0-beta.3" + }, "devDependencies": { "babel-cli": "^6.16.0", "babel-core": "^6.18.0", @@ -22,7 +24,7 @@ "webpack": "^1.13.2" }, "scripts": { - "build": "webpack", + "build": "webpack && cd test/browser && webpack", "test": "npm run eslint && npm run mocha", "eslint": "eslint src", "mocha": "./node_modules/.bin/mocha --compilers js:babel-core/register --reporter spec" diff --git a/src/index.js b/src/index.js index 454d60d..079f4af 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,10 @@ -import Dexie from 'dexie' import SchemaParser from './schema-parser' import {isIndexableType} from './utils' const Relationships = (db) => { + const Dexie = db.constructor // Use Dexie.Promise to ensure transaction safety. - let Promise = Dexie.Promise + const Promise = Dexie.Promise /** * Iterate through all items and collect related records @@ -61,70 +61,58 @@ const Relationships = (db) => { // Extract the mix of all related keys in all rows // let queries = foreignTableNames - .map (tableName => { + .map(tableName => { // For each foreign table, query all items that any row refers to let foreignTable = usableForeignTables[tableName] let allRelatedKeys = rows .map(row => row[foreignTable.foreign.targetIndex]) - .filter (isIndexableType) + .filter(isIndexableType) - // Build the Collection to retrieve all related items - return databaseTables[table] - .where (foreignTable.foreign.index) - .anyOf (allRelatedKeys) + // Build the Collection to retrieve all related items + return databaseTables[tableName] + .where(foreignTable.foreign.index) + .anyOf(allRelatedKeys) }) - + // Execute queries in parallell - let queryPromises = queries.map(query => query.toArray()); + let queryPromises = queries.map(query => query.toArray()) // // Await all results and then try mapping each response // with its corresponding row and attach related items onto each row - // - return Promise.all(queryPromises).then (queryResults => { + // + return Promise.all(queryPromises).then(queryResults => { foreignTableNames.forEach((tableName, idx) => { let foreignTable = usableForeignTables[tableName] let result = queryResults[idx] let targetIndex = foreignTable.foreign.targetIndex let foreignIndex = foreignTable.foreign.index - - }); - }); - return Promise.all (queries.map(query => query.toArray())).then(results => { - let {table, allRelatedObjs} = results; - - }) - }) - - return new Promise((resolve) => { - self.toArray().then(rows => { - let queue = [] - - // loop through all rows and collect all data from the related table - rows.forEach((row) => { - let tables = Object.keys(usableForeignTables) - - tables.forEach(table => { - let relatedTable = usableForeignTables[table] - - let promise = databaseTables[table] - .where(relatedTable.foreign.index) - .equals(row[relatedTable.foreign.targetIndex]) - .toArray() - .then(relations => { - row[relatedTable.column] = relations - }) - - queue.push(promise) + let column = foreignTable.column + + // Create a lookup by targetIndex (normally 'id') + // and set the column onto the target + let lookup = {} + rows.forEach(row => { + let arrayProperty = [] + row[column] = arrayProperty + lookup[row[targetIndex]] = arrayProperty }) - }) - // we need to wait until all data is retrieved - // once it's there we can resolve the promise - Promise.all(queue).then(() => { - resolve(rows) + // Populate column on each row + result.forEach(record => { + let foreignKey = record[foreignIndex] + let arrayProperty = lookup[foreignKey] + if (!arrayProperty) { + throw new Error( + `Could not lookup foreign key where ` + + `${tableName}.${foreignIndex} == ${baseTable}.${column}. ` + + `The content of the failing key was: ${JSON.stringify(foreignKey)}.`) + } + + arrayProperty.push(record) + }) }) - }) + }).then(() => rows) }) } @@ -149,4 +137,4 @@ const Relationships = (db) => { }) } -Dexie.addons.push(Relationships) +module.exports = Relationships diff --git a/src/utils.js b/src/utils.js index 5cb27ed..7f94811 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,9 +1,9 @@ export function isIndexableType (value) { - return value != null && (// Using "!=" instead of "!==" to check for both null and undefined! - typeof value === 'string' || - typeof value === 'number' || - value instanceof Date || - (Array.isArray(value) && value.every(isIndexableType)) - ) + return value != null && (// Using "!=" instead of "!==" to check for both null and undefined! + typeof value === 'string' || + typeof value === 'number' || + value instanceof Date || + (Array.isArray(value) && value.every(isIndexableType)) + ) } diff --git a/test/browser/all-browser-tests.js b/test/browser/all-browser-tests.js new file mode 100644 index 0000000..518c312 --- /dev/null +++ b/test/browser/all-browser-tests.js @@ -0,0 +1,2 @@ +require ('./simple') +// TODO list more tests here diff --git a/test/browser/bundle.js b/test/browser/bundle.js new file mode 100644 index 0000000..6ab557f --- /dev/null +++ b/test/browser/bundle.js @@ -0,0 +1,2797 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(1); + // TODO list more tests here + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _assert = __webpack_require__(2); + + var _assert2 = _interopRequireDefault(_assert); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var DexieRelationships = __webpack_require__(7); + + describe('simple', function () { + var Promise = Dexie.Promise; + var db = new Dexie('bands-simple', { addons: [DexieRelationships] }); + db.version(1).stores({ + bands: '\n id,\n name', + albums: '\n id,\n name,\n bandId -> bands.id,\n year' + }); + + beforeEach(function () { + return db.delete().then(function () { + return db.open(); + }).then(function () { + return db.transaction('rw', db.bands, db.albums, function () { + // Bands + db.bands.bulkAdd([{ + id: 1, + name: 'Beatles' + }, { + id: 2, + name: 'Abba' + }]); + + // Albums + db.albums.bulkAdd([{ + id: 1, + name: 'Abbey Road', + year: 1969, + bandId: 1 + }, { + id: 2, + name: 'Let It Be', + year: 1970, + bandId: 1 + }, { + id: 3, + name: 'Super Trouper', + bandId: 2, + year: 1980 + }, { + id: 4, + name: 'Waterloo', + bandId: 2, + year: 1974 + }]); + }); + }); + }); + + describe('sample', function () { + it('should be possible to retrieve an entity with a collection of referring entities attached to it', function () { + return db.bands.where('name').equals('Beatles').with({ + albums: 'albums' + }).then(function (bands) { + _assert2.default.deepEqual([{ + id: 1, + name: 'Beatles', + albums: [{ + id: 1, + name: 'Abbey Road', + year: 1969, + bandId: 1 + }, { + id: 2, + name: 'Let It Be', + year: 1970, + bandId: 1 + }] + }], bands); + }); + }); + }); + }); + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js + // original notice: + + /*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + function compare(a, b) { + if (a === b) { + return 0; + } + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) { + return -1; + } + if (y < x) { + return 1; + } + return 0; + } + function isBuffer(b) { + if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { + return global.Buffer.isBuffer(b); + } + return !!(b != null && b._isBuffer); + } + + // based on node assert, original notice: + + // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 + // + // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! + // + // Originally from narwhal.js (http://narwhaljs.org) + // Copyright (c) 2009 Thomas Robinson <280north.com> + // + // Permission is hereby granted, free of charge, to any person obtaining a copy + // of this software and associated documentation files (the 'Software'), to + // deal in the Software without restriction, including without limitation the + // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + // sell copies of the Software, and to permit persons to whom the Software is + // furnished to do so, subject to the following conditions: + // + // The above copyright notice and this permission notice shall be included in + // all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + var util = __webpack_require__(3); + var hasOwn = Object.prototype.hasOwnProperty; + var pSlice = Array.prototype.slice; + var functionsHaveNames = (function () { + return function foo() {}.name === 'foo'; + }()); + function pToString (obj) { + return Object.prototype.toString.call(obj); + } + function isView(arrbuf) { + if (isBuffer(arrbuf)) { + return false; + } + if (typeof global.ArrayBuffer !== 'function') { + return false; + } + if (typeof ArrayBuffer.isView === 'function') { + return ArrayBuffer.isView(arrbuf); + } + if (!arrbuf) { + return false; + } + if (arrbuf instanceof DataView) { + return true; + } + if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { + return true; + } + return false; + } + // 1. The assert module provides functions that throw + // AssertionError's when particular conditions are not met. The + // assert module must conform to the following interface. + + var assert = module.exports = ok; + + // 2. The AssertionError is defined in assert. + // new assert.AssertionError({ message: message, + // actual: actual, + // expected: expected }) + + var regex = /\s*function\s+([^\(\s]*)\s*/; + // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js + function getName(func) { + if (!util.isFunction(func)) { + return; + } + if (functionsHaveNames) { + return func.name; + } + var str = func.toString(); + var match = str.match(regex); + return match && match[1]; + } + assert.AssertionError = function AssertionError(options) { + this.name = 'AssertionError'; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + if (options.message) { + this.message = options.message; + this.generatedMessage = false; + } else { + this.message = getMessage(this); + this.generatedMessage = true; + } + var stackStartFunction = options.stackStartFunction || fail; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } else { + // non v8 browsers so we can have a stacktrace + var err = new Error(); + if (err.stack) { + var out = err.stack; + + // try to strip useless frames + var fn_name = getName(stackStartFunction); + var idx = out.indexOf('\n' + fn_name); + if (idx >= 0) { + // once we have located the function frame + // we need to strip out everything before it (and its line) + var next_line = out.indexOf('\n', idx + 1); + out = out.substring(next_line + 1); + } + + this.stack = out; + } + } + }; + + // assert.AssertionError instanceof Error + util.inherits(assert.AssertionError, Error); + + function truncate(s, n) { + if (typeof s === 'string') { + return s.length < n ? s : s.slice(0, n); + } else { + return s; + } + } + function inspect(something) { + if (functionsHaveNames || !util.isFunction(something)) { + return util.inspect(something); + } + var rawname = getName(something); + var name = rawname ? ': ' + rawname : ''; + return '[Function' + name + ']'; + } + function getMessage(self) { + return truncate(inspect(self.actual), 128) + ' ' + + self.operator + ' ' + + truncate(inspect(self.expected), 128); + } + + // At present only the three keys mentioned above are used and + // understood by the spec. Implementations or sub modules can pass + // other keys to the AssertionError's constructor - they will be + // ignored. + + // 3. All of the following functions must throw an AssertionError + // when a corresponding condition is not met, with a message that + // may be undefined if not provided. All assertion methods provide + // both the actual and expected values to the assertion error for + // display purposes. + + function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); + } + + // EXTENSION! allows for well behaved errors defined elsewhere. + assert.fail = fail; + + // 4. Pure assertion tests whether a value is truthy, as determined + // by !!guard. + // assert.ok(guard, message_opt); + // This statement is equivalent to assert.equal(true, !!guard, + // message_opt);. To test strictly for the value true, use + // assert.strictEqual(true, guard, message_opt);. + + function ok(value, message) { + if (!value) fail(value, true, message, '==', assert.ok); + } + assert.ok = ok; + + // 5. The equality assertion tests shallow, coercive equality with + // ==. + // assert.equal(actual, expected, message_opt); + + assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, '==', assert.equal); + }; + + // 6. The non-equality assertion tests for whether two objects are not equal + // with != assert.notEqual(actual, expected, message_opt); + + assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, '!=', assert.notEqual); + } + }; + + // 7. The equivalence assertion tests a deep equality relation. + // assert.deepEqual(actual, expected, message_opt); + + assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'deepEqual', assert.deepEqual); + } + }; + + assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); + } + }; + + function _deepEqual(actual, expected, strict, memos) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if (isBuffer(actual) && isBuffer(expected)) { + return compare(actual, expected) === 0; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (util.isDate(actual) && util.isDate(expected)) { + return actual.getTime() === expected.getTime(); + + // 7.3 If the expected value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object with the same source and + // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). + } else if (util.isRegExp(actual) && util.isRegExp(expected)) { + return actual.source === expected.source && + actual.global === expected.global && + actual.multiline === expected.multiline && + actual.lastIndex === expected.lastIndex && + actual.ignoreCase === expected.ignoreCase; + + // 7.4. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if ((actual === null || typeof actual !== 'object') && + (expected === null || typeof expected !== 'object')) { + return strict ? actual === expected : actual == expected; + + // If both values are instances of typed arrays, wrap their underlying + // ArrayBuffers in a Buffer each to increase performance + // This optimization requires the arrays to have the same type as checked by + // Object.prototype.toString (aka pToString). Never perform binary + // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their + // bit patterns are not identical. + } else if (isView(actual) && isView(expected) && + pToString(actual) === pToString(expected) && + !(actual instanceof Float32Array || + actual instanceof Float64Array)) { + return compare(new Uint8Array(actual.buffer), + new Uint8Array(expected.buffer)) === 0; + + // 7.5 For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else if (isBuffer(actual) !== isBuffer(expected)) { + return false; + } else { + memos = memos || {actual: [], expected: []}; + + var actualIndex = memos.actual.indexOf(actual); + if (actualIndex !== -1) { + if (actualIndex === memos.expected.indexOf(expected)) { + return true; + } + } + + memos.actual.push(actual); + memos.expected.push(expected); + + return objEquiv(actual, expected, strict, memos); + } + } + + function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; + } + + function objEquiv(a, b, strict, actualVisitedObjects) { + if (a === null || a === undefined || b === null || b === undefined) + return false; + // if one is a primitive, the other must be same + if (util.isPrimitive(a) || util.isPrimitive(b)) + return a === b; + if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) + return false; + var aIsArgs = isArguments(a); + var bIsArgs = isArguments(b); + if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) + return false; + if (aIsArgs) { + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b, strict); + } + var ka = objectKeys(a); + var kb = objectKeys(b); + var key, i; + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length !== kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] !== kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) + return false; + } + return true; + } + + // 8. The non-equivalence assertion tests for any deep inequality. + // assert.notDeepEqual(actual, expected, message_opt); + + assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + } + }; + + assert.notDeepStrictEqual = notDeepStrictEqual; + function notDeepStrictEqual(actual, expected, message) { + if (_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); + } + } + + + // 9. The strict equality assertion tests strict equality, as determined by ===. + // assert.strictEqual(actual, expected, message_opt); + + assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, '===', assert.strictEqual); + } + }; + + // 10. The strict non-equality assertion tests for strict inequality, as + // determined by !==. assert.notStrictEqual(actual, expected, message_opt); + + assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, '!==', assert.notStrictEqual); + } + }; + + function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (Object.prototype.toString.call(expected) == '[object RegExp]') { + return expected.test(actual); + } + + try { + if (actual instanceof expected) { + return true; + } + } catch (e) { + // Ignore. The instanceof check doesn't work for arrow functions. + } + + if (Error.isPrototypeOf(expected)) { + return false; + } + + return expected.call({}, actual) === true; + } + + function _tryBlock(block) { + var error; + try { + block(); + } catch (e) { + error = e; + } + return error; + } + + function _throws(shouldThrow, block, expected, message) { + var actual; + + if (typeof block !== 'function') { + throw new TypeError('"block" argument must be a function'); + } + + if (typeof expected === 'string') { + message = expected; + expected = null; + } + + actual = _tryBlock(block); + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail(actual, expected, 'Missing expected exception' + message); + } + + var userProvidedMessage = typeof message === 'string'; + var isUnwantedException = !shouldThrow && util.isError(actual); + var isUnexpectedException = !shouldThrow && actual && !expected; + + if ((isUnwantedException && + userProvidedMessage && + expectedException(actual, expected)) || + isUnexpectedException) { + fail(actual, expected, 'Got unwanted exception' + message); + } + + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } + } + + // 11. Expected to throw an error: + // assert.throws(block, Error_opt, message_opt); + + assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws(true, block, error, message); + }; + + // EXTENSION! This is annoying to write outside this module. + assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { + _throws(false, block, error, message); + }; + + assert.ifError = function(err) { if (err) throw err; }; + + var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + if (hasOwn.call(obj, key)) keys.push(key); + } + return keys; + }; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var formatRegExp = /%[sdj%]/g; + exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; + }; + + + // Mark that a method should not be used. + // Returns a modified function which warns once by default. + // If --no-deprecation is set, then it is a no-op. + exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; + }; + + + var debugs = {}; + var debugEnviron; + exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; + }; + + + /** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ + /* legacy: obj, showHidden, depth, colors*/ + function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); + } + exports.inspect = inspect; + + + // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics + inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] + }; + + // Don't use 'blue' not visible on cmd.exe + inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' + }; + + + function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } + } + + + function stylizeNoColor(str, styleType) { + return str; + } + + + function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; + } + + + function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); + } + + + function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); + } + + + function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; + } + + + function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; + } + + + function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; + } + + + function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; + } + + + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + function isArray(ar) { + return Array.isArray(ar); + } + exports.isArray = isArray; + + function isBoolean(arg) { + return typeof arg === 'boolean'; + } + exports.isBoolean = isBoolean; + + function isNull(arg) { + return arg === null; + } + exports.isNull = isNull; + + function isNullOrUndefined(arg) { + return arg == null; + } + exports.isNullOrUndefined = isNullOrUndefined; + + function isNumber(arg) { + return typeof arg === 'number'; + } + exports.isNumber = isNumber; + + function isString(arg) { + return typeof arg === 'string'; + } + exports.isString = isString; + + function isSymbol(arg) { + return typeof arg === 'symbol'; + } + exports.isSymbol = isSymbol; + + function isUndefined(arg) { + return arg === void 0; + } + exports.isUndefined = isUndefined; + + function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; + } + exports.isRegExp = isRegExp; + + function isObject(arg) { + return typeof arg === 'object' && arg !== null; + } + exports.isObject = isObject; + + function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; + } + exports.isDate = isDate; + + function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); + } + exports.isError = isError; + + function isFunction(arg) { + return typeof arg === 'function'; + } + exports.isFunction = isFunction; + + function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; + } + exports.isPrimitive = isPrimitive; + + exports.isBuffer = __webpack_require__(5); + + function objectToString(o) { + return Object.prototype.toString.call(o); + } + + + function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); + } + + + var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + + // 26 Feb 16:19:34 + function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); + } + + + // log is just a thin wrapper to console.log that prepends a timestamp + exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); + }; + + + /** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ + exports.inherits = __webpack_require__(6); + + exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; + }; + + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(4))) + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; + } + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; + } else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _stringify = __webpack_require__(8); + + var _stringify2 = _interopRequireDefault(_stringify); + + var _keys = __webpack_require__(11); + + var _keys2 = _interopRequireDefault(_keys); + + var _schemaParser = __webpack_require__(45); + + var _schemaParser2 = _interopRequireDefault(_schemaParser); + + var _utils = __webpack_require__(77); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var Relationships = function Relationships(db) { + var Dexie = db.constructor; + // Use Dexie.Promise to ensure transaction safety. + var Promise = Dexie.Promise; + + /** + * Iterate through all items and collect related records + * + * @param relationships + * + * @returns {Dexie.Promise} + */ + db.Table.prototype.with = function (relationships) { + return this.toCollection().with(relationships); + }; + + /** + * Iterate through all items and collect related records + * + * @param relationships + * + * @returns {Dexie.Promise} + */ + db.Collection.prototype.with = function (relationships) { + var baseTable = this._ctx.table.name; + var databaseTables = db._allTables; + + // this holds tables that have foreign keys pointing at the current table + var usableForeignTables = {}; + + // validate target tables and add them into our usable tables object + (0, _keys2.default)(relationships).forEach(function (column) { + var table = relationships[column]; + + if (!databaseTables.hasOwnProperty(table)) { + throw new Error('Relationship table ' + table + ' doesn\'t exist.'); + } + + if (!databaseTables[table].schema.hasOwnProperty('foreignKeys')) { + throw new Error('Relationship table ' + table + ' doesn\'t have foreign keys set.'); + } + + // remove the foreign keys that don't link to the base table + var columns = databaseTables[table].schema.foreignKeys.filter(function (column) { + return column.targetTable === baseTable; + }); + + if (columns.length > 0) { + usableForeignTables[table] = { + column: column, + foreign: columns[0] + }; + } + }); + + var foreignTableNames = (0, _keys2.default)(usableForeignTables); + + return this.toArray().then(function (rows) { + // + // Extract the mix of all related keys in all rows + // + var queries = foreignTableNames.map(function (tableName) { + // For each foreign table, query all items that any row refers to + var foreignTable = usableForeignTables[tableName]; + var allRelatedKeys = rows.map(function (row) { + return row[foreignTable.foreign.targetIndex]; + }).filter(_utils.isIndexableType); + + // Build the Collection to retrieve all related items + return databaseTables[tableName].where(foreignTable.foreign.index).anyOf(allRelatedKeys); + }); + + // Execute queries in parallell + var queryPromises = queries.map(function (query) { + return query.toArray(); + }); + + // + // Await all results and then try mapping each response + // with its corresponding row and attach related items onto each row + // + return Promise.all(queryPromises).then(function (queryResults) { + foreignTableNames.forEach(function (tableName, idx) { + var foreignTable = usableForeignTables[tableName]; + var result = queryResults[idx]; + var targetIndex = foreignTable.foreign.targetIndex; + var foreignIndex = foreignTable.foreign.index; + var column = foreignTable.column; + + // Create a lookup by targetIndex (normally 'id') + // and set the column onto the target + var lookup = {}; + rows.forEach(function (row) { + var arrayProperty = []; + row[column] = arrayProperty; + lookup[row[targetIndex]] = arrayProperty; + }); + + // Populate column on each row + result.forEach(function (record) { + var foreignKey = record[foreignIndex]; + var arrayProperty = lookup[foreignKey]; + if (!arrayProperty) { + throw new Error('Could not lookup foreign key where ' + (tableName + '.' + foreignIndex + ' == ' + baseTable + '.' + column + '. ') + ('The content of the failing key was: ' + (0, _stringify2.default)(foreignKey) + '.')); + } + + arrayProperty.push(record); + }); + }); + }).then(function () { + return rows; + }); + }); + }; + + db.Version.prototype._parseStoresSpec = Dexie.override(db.Version.prototype._parseStoresSpec, function (parseStoresSpec) { + return function (storesSpec, outDbSchema) { + var parser = new _schemaParser2.default(storesSpec); + + var foreignKeys = parser.getForeignKeys(); + // call the original method + var rv = parseStoresSpec.call(this, parser.getCleanedSchema(), outDbSchema); + + // set foreign keys into database table objects + // to use later in 'with' method + (0, _keys2.default)(outDbSchema).forEach(function (table) { + if (foreignKeys.hasOwnProperty(table)) { + outDbSchema[table].foreignKeys = foreignKeys[table]; + } + }); + + return rv; + }; + }); + }; + + module.exports = Relationships; + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(9), __esModule: true }; + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + var core = __webpack_require__(10) + , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify}); + module.exports = function stringify(it){ // eslint-disable-line no-unused-vars + return $JSON.stringify.apply($JSON, arguments); + }; + +/***/ }, +/* 10 */ +/***/ function(module, exports) { + + var core = module.exports = {version: '2.4.0'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(12), __esModule: true }; + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(13); + module.exports = __webpack_require__(10).Object.keys; + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(14) + , $keys = __webpack_require__(16); + + __webpack_require__(31)('keys', function(){ + return function keys(it){ + return $keys(toObject(it)); + }; + }); + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(15); + module.exports = function(it){ + return Object(defined(it)); + }; + +/***/ }, +/* 15 */ +/***/ function(module, exports) { + + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; + }; + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.14 / 15.2.3.14 Object.keys(O) + var $keys = __webpack_require__(17) + , enumBugKeys = __webpack_require__(30); + + module.exports = Object.keys || function keys(O){ + return $keys(O, enumBugKeys); + }; + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + var has = __webpack_require__(18) + , toIObject = __webpack_require__(19) + , arrayIndexOf = __webpack_require__(22)(false) + , IE_PROTO = __webpack_require__(26)('IE_PROTO'); + + module.exports = function(object, names){ + var O = toIObject(object) + , i = 0 + , result = [] + , key; + for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while(names.length > i)if(has(O, key = names[i++])){ + ~arrayIndexOf(result, key) || result.push(key); + } + return result; + }; + +/***/ }, +/* 18 */ +/***/ function(module, exports) { + + var hasOwnProperty = {}.hasOwnProperty; + module.exports = function(it, key){ + return hasOwnProperty.call(it, key); + }; + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + // to indexed object, toObject with fallback for non-array-like ES3 strings + var IObject = __webpack_require__(20) + , defined = __webpack_require__(15); + module.exports = function(it){ + return IObject(defined(it)); + }; + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var cof = __webpack_require__(21); + module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ + return cof(it) == 'String' ? it.split('') : Object(it); + }; + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + var toString = {}.toString; + + module.exports = function(it){ + return toString.call(it).slice(8, -1); + }; + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + // false -> Array#indexOf + // true -> Array#includes + var toIObject = __webpack_require__(19) + , toLength = __webpack_require__(23) + , toIndex = __webpack_require__(25); + module.exports = function(IS_INCLUDES){ + return function($this, el, fromIndex){ + var O = toIObject($this) + , length = toLength(O.length) + , index = toIndex(fromIndex, length) + , value; + // Array#includes uses SameValueZero equality algorithm + if(IS_INCLUDES && el != el)while(length > index){ + value = O[index++]; + if(value != value)return true; + // Array#toIndex ignores holes, Array#includes - not + } else for(;length > index; index++)if(IS_INCLUDES || index in O){ + if(O[index] === el)return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + // 7.1.15 ToLength + var toInteger = __webpack_require__(24) + , min = Math.min; + module.exports = function(it){ + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 + }; + +/***/ }, +/* 24 */ +/***/ function(module, exports) { + + // 7.1.4 ToInteger + var ceil = Math.ceil + , floor = Math.floor; + module.exports = function(it){ + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); + }; + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + var toInteger = __webpack_require__(24) + , max = Math.max + , min = Math.min; + module.exports = function(index, length){ + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); + }; + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + var shared = __webpack_require__(27)('keys') + , uid = __webpack_require__(29); + module.exports = function(key){ + return shared[key] || (shared[key] = uid(key)); + }; + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + var global = __webpack_require__(28) + , SHARED = '__core-js_shared__' + , store = global[SHARED] || (global[SHARED] = {}); + module.exports = function(key){ + return store[key] || (store[key] = {}); + }; + +/***/ }, +/* 28 */ +/***/ function(module, exports) { + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }, +/* 29 */ +/***/ function(module, exports) { + + var id = 0 + , px = Math.random(); + module.exports = function(key){ + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); + }; + +/***/ }, +/* 30 */ +/***/ function(module, exports) { + + // IE 8- don't enum bug keys + module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' + ).split(','); + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(32) + , core = __webpack_require__(10) + , fails = __webpack_require__(41); + module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); + }; + +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { + + var global = __webpack_require__(28) + , core = __webpack_require__(10) + , ctx = __webpack_require__(33) + , hide = __webpack_require__(35) + , PROTOTYPE = 'prototype'; + + var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , expProto = exports[PROTOTYPE] + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(a, b, c){ + if(this instanceof C){ + switch(arguments.length){ + case 0: return new C; + case 1: return new C(a); + case 2: return new C(a, b); + } return new C(a, b, c); + } return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if(IS_PROTO){ + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); + } + } + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + $export.U = 64; // safe + $export.R = 128; // real proto method for `library` + module.exports = $export; + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(34); + module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */){ + return fn.apply(that, arguments); + }; + }; + +/***/ }, +/* 34 */ +/***/ function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }, +/* 35 */ +/***/ function(module, exports, __webpack_require__) { + + var dP = __webpack_require__(36) + , createDesc = __webpack_require__(44); + module.exports = __webpack_require__(40) ? function(object, key, value){ + return dP.f(object, key, createDesc(1, value)); + } : function(object, key, value){ + object[key] = value; + return object; + }; + +/***/ }, +/* 36 */ +/***/ function(module, exports, __webpack_require__) { + + var anObject = __webpack_require__(37) + , IE8_DOM_DEFINE = __webpack_require__(39) + , toPrimitive = __webpack_require__(43) + , dP = Object.defineProperty; + + exports.f = __webpack_require__(40) ? Object.defineProperty : function defineProperty(O, P, Attributes){ + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if(IE8_DOM_DEFINE)try { + return dP(O, P, Attributes); + } catch(e){ /* empty */ } + if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); + if('value' in Attributes)O[P] = Attributes.value; + return O; + }; + +/***/ }, +/* 37 */ +/***/ function(module, exports, __webpack_require__) { + + var isObject = __webpack_require__(38); + module.exports = function(it){ + if(!isObject(it))throw TypeError(it + ' is not an object!'); + return it; + }; + +/***/ }, +/* 38 */ +/***/ function(module, exports) { + + module.exports = function(it){ + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + +/***/ }, +/* 39 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = !__webpack_require__(40) && !__webpack_require__(41)(function(){ + return Object.defineProperty(__webpack_require__(42)('div'), 'a', {get: function(){ return 7; }}).a != 7; + }); + +/***/ }, +/* 40 */ +/***/ function(module, exports, __webpack_require__) { + + // Thank's IE8 for his funny defineProperty + module.exports = !__webpack_require__(41)(function(){ + return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; + }); + +/***/ }, +/* 41 */ +/***/ function(module, exports) { + + module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } + }; + +/***/ }, +/* 42 */ +/***/ function(module, exports, __webpack_require__) { + + var isObject = __webpack_require__(38) + , document = __webpack_require__(28).document + // in old IE typeof document.createElement is 'object' + , is = isObject(document) && isObject(document.createElement); + module.exports = function(it){ + return is ? document.createElement(it) : {}; + }; + +/***/ }, +/* 43 */ +/***/ function(module, exports, __webpack_require__) { + + // 7.1.1 ToPrimitive(input [, PreferredType]) + var isObject = __webpack_require__(38); + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + module.exports = function(it, S){ + if(!isObject(it))return it; + var fn, val; + if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; + if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + throw TypeError("Can't convert object to primitive value"); + }; + +/***/ }, +/* 44 */ +/***/ function(module, exports) { + + module.exports = function(bitmap, value){ + return { + enumerable : !(bitmap & 1), + configurable: !(bitmap & 2), + writable : !(bitmap & 4), + value : value + }; + }; + +/***/ }, +/* 45 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _slicedToArray2 = __webpack_require__(46); + + var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); + + var _keys = __webpack_require__(11); + + var _keys2 = _interopRequireDefault(_keys); + + var _classCallCheck2 = __webpack_require__(72); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _createClass2 = __webpack_require__(73); + + var _createClass3 = _interopRequireDefault(_createClass2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var SchemaParser = function () { + + /** + * Schema parser + * + * @param schema + */ + function SchemaParser(schema) { + (0, _classCallCheck3.default)(this, SchemaParser); + + this.schema = schema; + } + + /** + * Extracts foreign keys from the schema + * + * @returns Object + */ + + + (0, _createClass3.default)(SchemaParser, [{ + key: 'getForeignKeys', + value: function getForeignKeys() { + var _this = this; + + var foreignKeys = {}; + + (0, _keys2.default)(this.schema).forEach(function (table) { + var indexes = _this.schema[table].split(','); + + foreignKeys[table] = indexes.filter(function (idx) { + return idx.indexOf('->') !== -1; + }).map(function (idx) { + // split the column and foreign table info + var _idx$split$map = idx.split('->').map(function (x) { + return x.trim(); + }), + _idx$split$map2 = (0, _slicedToArray3.default)(_idx$split$map, 2), + column = _idx$split$map2[0], + target = _idx$split$map2[1]; + + return { + index: column, + targetTable: target.split('.')[0], + targetIndex: target.split('.')[1] + }; + }); + }); + + return foreignKeys; + } + + /** + * Get schema without the foreign key definitions + * + * @returns Object + */ + + }, { + key: 'getCleanedSchema', + value: function getCleanedSchema() { + var _this2 = this; + + var schema = {}; + + (0, _keys2.default)(this.schema).forEach(function (table) { + var indexes = _this2.schema[table].split(','); + + // Remove foreign keys syntax before calling the original method + schema[table] = indexes.map(function (idx) { + return idx.split('->')[0].trim(); + }).join(','); + }); + + return schema; + } + }]); + return SchemaParser; + }(); + + exports.default = SchemaParser; + +/***/ }, +/* 46 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _isIterable2 = __webpack_require__(47); + + var _isIterable3 = _interopRequireDefault(_isIterable2); + + var _getIterator2 = __webpack_require__(68); + + var _getIterator3 = _interopRequireDefault(_getIterator2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if ((0, _isIterable3.default)(Object(arr))) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; + }(); + +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(48), __esModule: true }; + +/***/ }, +/* 48 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(49); + __webpack_require__(64); + module.exports = __webpack_require__(66); + +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(50); + var global = __webpack_require__(28) + , hide = __webpack_require__(35) + , Iterators = __webpack_require__(53) + , TO_STRING_TAG = __webpack_require__(62)('toStringTag'); + + for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ + var NAME = collections[i] + , Collection = global[NAME] + , proto = Collection && Collection.prototype; + if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; + } + +/***/ }, +/* 50 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var addToUnscopables = __webpack_require__(51) + , step = __webpack_require__(52) + , Iterators = __webpack_require__(53) + , toIObject = __webpack_require__(19); + + // 22.1.3.4 Array.prototype.entries() + // 22.1.3.13 Array.prototype.keys() + // 22.1.3.29 Array.prototype.values() + // 22.1.3.30 Array.prototype[@@iterator]() + module.exports = __webpack_require__(54)(Array, 'Array', function(iterated, kind){ + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind + // 22.1.5.2.1 %ArrayIteratorPrototype%.next() + }, function(){ + var O = this._t + , kind = this._k + , index = this._i++; + if(!O || index >= O.length){ + this._t = undefined; + return step(1); + } + if(kind == 'keys' )return step(0, index); + if(kind == 'values')return step(0, O[index]); + return step(0, [index, O[index]]); + }, 'values'); + + // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) + Iterators.Arguments = Iterators.Array; + + addToUnscopables('keys'); + addToUnscopables('values'); + addToUnscopables('entries'); + +/***/ }, +/* 51 */ +/***/ function(module, exports) { + + module.exports = function(){ /* empty */ }; + +/***/ }, +/* 52 */ +/***/ function(module, exports) { + + module.exports = function(done, value){ + return {value: value, done: !!done}; + }; + +/***/ }, +/* 53 */ +/***/ function(module, exports) { + + module.exports = {}; + +/***/ }, +/* 54 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var LIBRARY = __webpack_require__(55) + , $export = __webpack_require__(32) + , redefine = __webpack_require__(56) + , hide = __webpack_require__(35) + , has = __webpack_require__(18) + , Iterators = __webpack_require__(53) + , $iterCreate = __webpack_require__(57) + , setToStringTag = __webpack_require__(61) + , getPrototypeOf = __webpack_require__(63) + , ITERATOR = __webpack_require__(62)('iterator') + , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` + , FF_ITERATOR = '@@iterator' + , KEYS = 'keys' + , VALUES = 'values'; + + var returnThis = function(){ return this; }; + + module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ + $iterCreate(Constructor, NAME, next); + var getMethod = function(kind){ + if(!BUGGY && kind in proto)return proto[kind]; + switch(kind){ + case KEYS: return function keys(){ return new Constructor(this, kind); }; + case VALUES: return function values(){ return new Constructor(this, kind); }; + } return function entries(){ return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator' + , DEF_VALUES = DEFAULT == VALUES + , VALUES_BUG = false + , proto = Base.prototype + , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] + , $default = $native || getMethod(DEFAULT) + , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined + , $anyNative = NAME == 'Array' ? proto.entries || $native : $native + , methods, key, IteratorPrototype; + // Fix native + if($anyNative){ + IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); + if(IteratorPrototype !== Object.prototype){ + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if(DEF_VALUES && $native && $native.name !== VALUES){ + VALUES_BUG = true; + $default = function values(){ return $native.call(this); }; + } + // Define iterator + if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if(DEFAULT){ + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if(FORCED)for(key in methods){ + if(!(key in proto))redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; + }; + +/***/ }, +/* 55 */ +/***/ function(module, exports) { + + module.exports = true; + +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(35); + +/***/ }, +/* 57 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var create = __webpack_require__(58) + , descriptor = __webpack_require__(44) + , setToStringTag = __webpack_require__(61) + , IteratorPrototype = {}; + + // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + __webpack_require__(35)(IteratorPrototype, __webpack_require__(62)('iterator'), function(){ return this; }); + + module.exports = function(Constructor, NAME, next){ + Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); + setToStringTag(Constructor, NAME + ' Iterator'); + }; + +/***/ }, +/* 58 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + var anObject = __webpack_require__(37) + , dPs = __webpack_require__(59) + , enumBugKeys = __webpack_require__(30) + , IE_PROTO = __webpack_require__(26)('IE_PROTO') + , Empty = function(){ /* empty */ } + , PROTOTYPE = 'prototype'; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var createDict = function(){ + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(42)('iframe') + , i = enumBugKeys.length + , lt = '<' + , gt = '>' + , iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(60).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); + }; + + module.exports = Object.create || function create(O, Properties){ + var result; + if(O !== null){ + Empty[PROTOTYPE] = anObject(O); + result = new Empty; + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); + }; + + +/***/ }, +/* 59 */ +/***/ function(module, exports, __webpack_require__) { + + var dP = __webpack_require__(36) + , anObject = __webpack_require__(37) + , getKeys = __webpack_require__(16); + + module.exports = __webpack_require__(40) ? Object.defineProperties : function defineProperties(O, Properties){ + anObject(O); + var keys = getKeys(Properties) + , length = keys.length + , i = 0 + , P; + while(length > i)dP.f(O, P = keys[i++], Properties[P]); + return O; + }; + +/***/ }, +/* 60 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(28).document && document.documentElement; + +/***/ }, +/* 61 */ +/***/ function(module, exports, __webpack_require__) { + + var def = __webpack_require__(36).f + , has = __webpack_require__(18) + , TAG = __webpack_require__(62)('toStringTag'); + + module.exports = function(it, tag, stat){ + if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); + }; + +/***/ }, +/* 62 */ +/***/ function(module, exports, __webpack_require__) { + + var store = __webpack_require__(27)('wks') + , uid = __webpack_require__(29) + , Symbol = __webpack_require__(28).Symbol + , USE_SYMBOL = typeof Symbol == 'function'; + + var $exports = module.exports = function(name){ + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); + }; + + $exports.store = store; + +/***/ }, +/* 63 */ +/***/ function(module, exports, __webpack_require__) { + + // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) + var has = __webpack_require__(18) + , toObject = __webpack_require__(14) + , IE_PROTO = __webpack_require__(26)('IE_PROTO') + , ObjectProto = Object.prototype; + + module.exports = Object.getPrototypeOf || function(O){ + O = toObject(O); + if(has(O, IE_PROTO))return O[IE_PROTO]; + if(typeof O.constructor == 'function' && O instanceof O.constructor){ + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; + }; + +/***/ }, +/* 64 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + var $at = __webpack_require__(65)(true); + + // 21.1.3.27 String.prototype[@@iterator]() + __webpack_require__(54)(String, 'String', function(iterated){ + this._t = String(iterated); // target + this._i = 0; // next index + // 21.1.5.2.1 %StringIteratorPrototype%.next() + }, function(){ + var O = this._t + , index = this._i + , point; + if(index >= O.length)return {value: undefined, done: true}; + point = $at(O, index); + this._i += point.length; + return {value: point, done: false}; + }); + +/***/ }, +/* 65 */ +/***/ function(module, exports, __webpack_require__) { + + var toInteger = __webpack_require__(24) + , defined = __webpack_require__(15); + // true -> String#at + // false -> String#codePointAt + module.exports = function(TO_STRING){ + return function(that, pos){ + var s = String(defined(that)) + , i = toInteger(pos) + , l = s.length + , a, b; + if(i < 0 || i >= l)return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; + }; + +/***/ }, +/* 66 */ +/***/ function(module, exports, __webpack_require__) { + + var classof = __webpack_require__(67) + , ITERATOR = __webpack_require__(62)('iterator') + , Iterators = __webpack_require__(53); + module.exports = __webpack_require__(10).isIterable = function(it){ + var O = Object(it); + return O[ITERATOR] !== undefined + || '@@iterator' in O + || Iterators.hasOwnProperty(classof(O)); + }; + +/***/ }, +/* 67 */ +/***/ function(module, exports, __webpack_require__) { + + // getting tag from 19.1.3.6 Object.prototype.toString() + var cof = __webpack_require__(21) + , TAG = __webpack_require__(62)('toStringTag') + // ES3 wrong here + , ARG = cof(function(){ return arguments; }()) == 'Arguments'; + + // fallback for IE11 Script Access Denied error + var tryGet = function(it, key){ + try { + return it[key]; + } catch(e){ /* empty */ } + }; + + module.exports = function(it){ + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; + }; + +/***/ }, +/* 68 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(69), __esModule: true }; + +/***/ }, +/* 69 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(49); + __webpack_require__(64); + module.exports = __webpack_require__(70); + +/***/ }, +/* 70 */ +/***/ function(module, exports, __webpack_require__) { + + var anObject = __webpack_require__(37) + , get = __webpack_require__(71); + module.exports = __webpack_require__(10).getIterator = function(it){ + var iterFn = get(it); + if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); + return anObject(iterFn.call(it)); + }; + +/***/ }, +/* 71 */ +/***/ function(module, exports, __webpack_require__) { + + var classof = __webpack_require__(67) + , ITERATOR = __webpack_require__(62)('iterator') + , Iterators = __webpack_require__(53); + module.exports = __webpack_require__(10).getIteratorMethod = function(it){ + if(it != undefined)return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; + }; + +/***/ }, +/* 72 */ +/***/ function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + exports.default = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + +/***/ }, +/* 73 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + + var _defineProperty = __webpack_require__(74); + + var _defineProperty2 = _interopRequireDefault(_defineProperty); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + (0, _defineProperty2.default)(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + +/***/ }, +/* 74 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(75), __esModule: true }; + +/***/ }, +/* 75 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(76); + var $Object = __webpack_require__(10).Object; + module.exports = function defineProperty(it, key, desc){ + return $Object.defineProperty(it, key, desc); + }; + +/***/ }, +/* 76 */ +/***/ function(module, exports, __webpack_require__) { + + var $export = __webpack_require__(32); + // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) + $export($export.S + $export.F * !__webpack_require__(40), 'Object', {defineProperty: __webpack_require__(36).f}); + +/***/ }, +/* 77 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.isIndexableType = isIndexableType; + function isIndexableType(value) { + return value != null && ( // Using "!=" instead of "!==" to check for both null and undefined! + typeof value === 'string' || typeof value === 'number' || value instanceof Date || Array.isArray(value) && value.every(isIndexableType)); + } + +/***/ } +/******/ ]); +//# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/test/browser/bundle.js.map b/test/browser/bundle.js.map new file mode 100644 index 0000000..fcbdc63 --- /dev/null +++ b/test/browser/bundle.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap 56f143b3b4a25f90623a","webpack:///./all-browser-tests.js","webpack:///./simple.js","webpack:///C:/repos/dexie-relationships/~/assert/assert.js","webpack:///C:/repos/dexie-relationships/~/util/util.js","webpack:///C:/repos/dexie-relationships/~/process/browser.js","webpack:///C:/repos/dexie-relationships/~/util/support/isBufferBrowser.js","webpack:///C:/repos/dexie-relationships/~/util/~/inherits/inherits_browser.js","webpack:///./../../src/index.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/core-js/json/stringify.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/fn/json/stringify.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_core.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/core-js/object/keys.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/fn/object/keys.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/es6.object.keys.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_to-object.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_defined.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_object-keys.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_object-keys-internal.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_has.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_to-iobject.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_iobject.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_cof.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_array-includes.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_to-length.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_to-integer.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_to-index.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_shared-key.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_shared.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_global.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_uid.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_enum-bug-keys.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_object-sap.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_export.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_ctx.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_a-function.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_hide.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_object-dp.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_an-object.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_is-object.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_ie8-dom-define.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_descriptors.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_fails.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_dom-create.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_to-primitive.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_property-desc.js","webpack:///./../../src/schema-parser.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/helpers/slicedToArray.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/core-js/is-iterable.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/fn/is-iterable.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/web.dom.iterable.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/es6.array.iterator.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_add-to-unscopables.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_iter-step.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_iterators.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_iter-define.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_library.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_redefine.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_iter-create.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_object-create.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_object-dps.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_html.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_set-to-string-tag.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_wks.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_object-gpo.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/es6.string.iterator.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_string-at.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/core.is-iterable.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/_classof.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/core-js/get-iterator.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/fn/get-iterator.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/core.get-iterator.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/core.get-iterator-method.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/helpers/classCallCheck.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/helpers/createClass.js","webpack:///C:/repos/dexie-relationships/~/babel-runtime/core-js/object/define-property.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/fn/object/define-property.js","webpack:///C:/repos/dexie-relationships/~/core-js/library/modules/es6.object.define-property.js","webpack:///./../../src/utils.js"],"names":["require","DexieRelationships","describe","Promise","Dexie","db","addons","version","stores","bands","albums","beforeEach","delete","then","open","transaction","bulkAdd","id","name","year","bandId","it","where","equals","with","deepEqual","Relationships","constructor","Table","prototype","relationships","toCollection","Collection","baseTable","_ctx","table","databaseTables","_allTables","usableForeignTables","forEach","column","hasOwnProperty","Error","schema","columns","foreignKeys","filter","targetTable","length","foreign","foreignTableNames","toArray","queries","map","foreignTable","tableName","allRelatedKeys","rows","row","targetIndex","index","anyOf","queryPromises","query","all","idx","result","queryResults","foreignIndex","lookup","arrayProperty","foreignKey","record","push","Version","_parseStoresSpec","override","storesSpec","outDbSchema","parser","getForeignKeys","rv","parseStoresSpec","call","getCleanedSchema","module","exports","SchemaParser","indexes","split","indexOf","x","trim","target","join","isIndexableType","value","Date","Array","isArray","every"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;ACtCA,oBAAAA,CAAS,CAAT;AACA,6B;;;;;;;;ACDA;;;;;;AACA,KAAMC,qBAAqB,mBAAAD,CAAQ,CAAR,CAA3B;;AAEAE,UAAS,QAAT,EAAmB,YAAY;AAC3B,SAAIC,UAAUC,MAAMD,OAApB;AACA,SAAIE,KAAK,IAAID,KAAJ,CAAU,cAAV,EAA0B,EAACE,QAAQ,CAACL,kBAAD,CAAT,EAA1B,CAAT;AACAI,QAAGE,OAAH,CAAW,CAAX,EAAcC,MAAd,CAAqB;AACjBC,qDADiB;AAIjBC;AAJiB,MAArB;;AAWAC,gBAAW,YAAW;AAClB,gBAAON,GAAGO,MAAH,GAAYC,IAAZ,CAAiB;AAAA,oBAAIR,GAAGS,IAAH,EAAJ;AAAA,UAAjB,EAAgCD,IAAhC,CAAqC,YAAW;AACnD,oBAAOR,GAAGU,WAAH,CAAe,IAAf,EAAqBV,GAAGI,KAAxB,EAA+BJ,GAAGK,MAAlC,EAA0C,YAAI;AACjD;AACAL,oBAAGI,KAAH,CAASO,OAAT,CAAiB,CAAC;AACdC,yBAAI,CADU;AAEdC,2BAAM;AAFQ,kBAAD,EAGf;AACED,yBAAI,CADN;AAEEC,2BAAM;AAFR,kBAHe,CAAjB;;AAQA;AACAb,oBAAGK,MAAH,CAAUM,OAAV,CAAkB,CAAC;AACfC,yBAAI,CADW;AAEfC,2BAAM,YAFS;AAGfC,2BAAM,IAHS;AAIfC,6BAAQ;AAJO,kBAAD,EAKf;AACCH,yBAAI,CADL;AAECC,2BAAM,WAFP;AAGCC,2BAAM,IAHP;AAICC,6BAAQ;AAJT,kBALe,EAUf;AACCH,yBAAI,CADL;AAECC,2BAAM,eAFP;AAGCE,6BAAQ,CAHT;AAICD,2BAAM;AAJP,kBAVe,EAef;AACCF,yBAAI,CADL;AAECC,2BAAM,UAFP;AAGCE,6BAAQ,CAHT;AAICD,2BAAM;AAJP,kBAfe,CAAlB;AAqBH,cAhCM,CAAP;AAiCH,UAlCM,CAAP;AAmCH,MApCD;;AAsCAjB,cAAS,QAAT,EAAmB,YAAY;AAC3BmB,YAAG,iGAAH,EAAsG,YAAY;AAC9G,oBAAOhB,GAAGI,KAAH,CAASa,KAAT,CAAe,MAAf,EAAuBC,MAAvB,CAA8B,SAA9B,EAAyCC,IAAzC,CAA8C;AACjDd,yBAAQ;AADyC,cAA9C,EAEJG,IAFI,CAEE,iBAAS;AACd,kCAAOY,SAAP,CAAiB,CAAC;AACdR,yBAAI,CADU;AAEdC,2BAAM,SAFQ;AAGdR,6BAAQ,CAAC;AACLO,6BAAI,CADC;AAELC,+BAAM,YAFD;AAGLC,+BAAM,IAHD;AAILC,iCAAQ;AAJH,sBAAD,EAKL;AACCH,6BAAI,CADL;AAECC,+BAAM,WAFP;AAGCC,+BAAM,IAHP;AAICC,iCAAQ;AAJT,sBALK;AAHM,kBAAD,CAAjB,EAcIX,KAdJ;AAeH,cAlBM,CAAP;AAmBH,UApBD;AAqBH,MAtBD;AAuBH,EA3ED,E;;;;;;ACHA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,wCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+BAA8B;AAC9B;AACA,oDAAmD;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAgB;AAChB,iDAAgD;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH,uBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAAyB,QAAQ;AACjC;AACA;AACA;AACA;AACA;AACA,0BAAyB,QAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA,0BAAyB;AACzB;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iCAAgC,oBAAoB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,IAAG;AACH,wBAAuB,SAAS;AAChC;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6CAA4C,KAAK;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,MAAK;AACL;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;;AAGA;AACA;AACA,0DAAyD;AACzD;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA,YAAW;AACX;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;ACzkBA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,MAAK;AACL;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA2B;AAC3B;AACA;AACA;AACA,6BAA4B,UAAU;;;;;;;ACnLtC;AACA;AACA;AACA;AACA;AACA,E;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACtBA;;;;AACA;;;;AAEA,KAAMiB,gBAAgB,SAAhBA,aAAgB,CAACrB,EAAD,EAAQ;AAC5B,OAAMD,QAAQC,GAAGsB,WAAjB;AACA;AACA,OAAMxB,UAAUC,MAAMD,OAAtB;;AAEA;;;;;;;AAOAE,MAAGuB,KAAH,CAASC,SAAT,CAAmBL,IAAnB,GAA0B,UAAUM,aAAV,EAAyB;AACjD,YAAO,KAAKC,YAAL,GAAoBP,IAApB,CAAyBM,aAAzB,CAAP;AACD,IAFD;;AAIA;;;;;;;AAOAzB,MAAG2B,UAAH,CAAcH,SAAd,CAAwBL,IAAxB,GAA+B,UAAUM,aAAV,EAAyB;AACtD,SAAMG,YAAY,KAAKC,IAAL,CAAUC,KAAV,CAAgBjB,IAAlC;AACA,SAAMkB,iBAAiB/B,GAAGgC,UAA1B;;AAEA;AACA,SAAIC,sBAAsB,EAA1B;;AAEA;AACA,yBAAYR,aAAZ,EAA2BS,OAA3B,CAAmC,UAACC,MAAD,EAAY;AAC7C,WAAIL,QAAQL,cAAcU,MAAd,CAAZ;;AAEA,WAAI,CAACJ,eAAeK,cAAf,CAA8BN,KAA9B,CAAL,EAA2C;AACzC,eAAM,IAAIO,KAAJ,CAAU,wBAAwBP,KAAxB,GAAgC,kBAA1C,CAAN;AACD;;AAED,WAAI,CAACC,eAAeD,KAAf,EAAsBQ,MAAtB,CAA6BF,cAA7B,CAA4C,aAA5C,CAAL,EAAiE;AAC/D,eAAM,IAAIC,KAAJ,CAAU,wBAAwBP,KAAxB,GAAgC,kCAA1C,CAAN;AACD;;AAED;AACA,WAAIS,UAAUR,eAAeD,KAAf,EAAsBQ,MAAtB,CAA6BE,WAA7B,CAAyCC,MAAzC,CAAgD;AAAA,gBAAUN,OAAOO,WAAP,KAAuBd,SAAjC;AAAA,QAAhD,CAAd;;AAEA,WAAIW,QAAQI,MAAR,GAAiB,CAArB,EAAwB;AACtBV,6BAAoBH,KAApB,IAA6B;AAC3BK,mBAAQA,MADmB;AAE3BS,oBAASL,QAAQ,CAAR;AAFkB,UAA7B;AAID;AACF,MApBD;;AAsBA,SAAIM,oBAAoB,oBAAYZ,mBAAZ,CAAxB;;AAEA,YAAO,KAAKa,OAAL,GAAetC,IAAf,CAAoB,gBAAQ;AACjC;AACA;AACA;AACA,WAAIuC,UAAUF,kBACXG,GADW,CACP,qBAAa;AAChB;AACA,aAAIC,eAAehB,oBAAoBiB,SAApB,CAAnB;AACA,aAAIC,iBAAiBC,KAClBJ,GADkB,CACd;AAAA,kBAAOK,IAAIJ,aAAaL,OAAb,CAAqBU,WAAzB,CAAP;AAAA,UADc,EAElBb,MAFkB,wBAArB;;AAIA;AACA,gBAAOV,eAAemB,SAAf,EACJjC,KADI,CACEgC,aAAaL,OAAb,CAAqBW,KADvB,EAEJC,KAFI,CAEEL,cAFF,CAAP;AAGD,QAZW,CAAd;;AAcA;AACA,WAAIM,gBAAgBV,QAAQC,GAAR,CAAY;AAAA,gBAASU,MAAMZ,OAAN,EAAT;AAAA,QAAZ,CAApB;;AAEA;AACA;AACA;AACA;AACA,cAAOhD,QAAQ6D,GAAR,CAAYF,aAAZ,EAA2BjD,IAA3B,CAAgC,wBAAgB;AACrDqC,2BAAkBX,OAAlB,CAA0B,UAACgB,SAAD,EAAYU,GAAZ,EAAoB;AAC5C,eAAIX,eAAehB,oBAAoBiB,SAApB,CAAnB;AACA,eAAIW,SAASC,aAAaF,GAAb,CAAb;AACA,eAAIN,cAAcL,aAAaL,OAAb,CAAqBU,WAAvC;AACA,eAAIS,eAAed,aAAaL,OAAb,CAAqBW,KAAxC;AACA,eAAIpB,SAASc,aAAad,MAA1B;;AAEA;AACA;AACA,eAAI6B,SAAS,EAAb;AACAZ,gBAAKlB,OAAL,CAAa,eAAO;AAClB,iBAAI+B,gBAAgB,EAApB;AACAZ,iBAAIlB,MAAJ,IAAc8B,aAAd;AACAD,oBAAOX,IAAIC,WAAJ,CAAP,IAA2BW,aAA3B;AACD,YAJD;;AAMA;AACAJ,kBAAO3B,OAAP,CAAe,kBAAU;AACvB,iBAAIgC,aAAaC,OAAOJ,YAAP,CAAjB;AACA,iBAAIE,gBAAgBD,OAAOE,UAAP,CAApB;AACA,iBAAI,CAACD,aAAL,EAAoB;AAClB,qBAAM,IAAI5B,KAAJ,CACJ,yCACGa,SADH,SACgBa,YADhB,YACmCnC,SADnC,SACgDO,MADhD,qDAEuC,yBAAe+B,UAAf,CAFvC,OADI,CAAN;AAID;;AAEDD,2BAAcG,IAAd,CAAmBD,MAAnB;AACD,YAXD;AAYD,UA7BD;AA8BD,QA/BM,EA+BJ3D,IA/BI,CA+BC;AAAA,gBAAM4C,IAAN;AAAA,QA/BD,CAAP;AAgCD,MAzDM,CAAP;AA0DD,IA1FD;;AA4FApD,MAAGqE,OAAH,CAAW7C,SAAX,CAAqB8C,gBAArB,GAAwCvE,MAAMwE,QAAN,CACtCvE,GAAGqE,OAAH,CAAW7C,SAAX,CAAqB8C,gBADiB,EAEtC;AAAA,YAAmB,UAAUE,UAAV,EAAsBC,WAAtB,EAAmC;AACpD,WAAMC,SAAS,2BAAiBF,UAAjB,CAAf;;AAEA,WAAIhC,cAAckC,OAAOC,cAAP,EAAlB;AACA;AACA,WAAIC,KAAKC,gBAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,OAAOK,gBAAP,EAA3B,EAAsDN,WAAtD,CAAT;;AAEA;AACA;AACA,2BAAYA,WAAZ,EAAyBvC,OAAzB,CAAiC,iBAAS;AACxC,aAAIM,YAAYJ,cAAZ,CAA2BN,KAA3B,CAAJ,EAAuC;AACrC2C,uBAAY3C,KAAZ,EAAmBU,WAAnB,GAAiCA,YAAYV,KAAZ,CAAjC;AACD;AACF,QAJD;;AAMA,cAAO8C,EAAP;AACD,MAhBD;AAAA,IAFsC,CAAxC;AAmBD,EAtID;;AAwIAI,QAAOC,OAAP,GAAiB5D,aAAjB,C;;;;;;AC3IA,mBAAkB,uD;;;;;;ACAlB;AACA,wCAAuC,0BAA0B;AACjE,yCAAwC;AACxC;AACA,G;;;;;;ACJA,8BAA6B;AAC7B,sCAAqC,gC;;;;;;ACDrC,mBAAkB,wD;;;;;;ACAlB;AACA,sD;;;;;;ACDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAC,E;;;;;;ACRD;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;;AAEA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA,wBAAuB;AACvB;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA,G;;;;;;ACJA,kBAAiB;;AAEjB;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK,WAAW,eAAe;AAC/B;AACA,MAAK;AACL;AACA,G;;;;;;ACpBA;AACA;AACA;AACA;AACA,4DAA2D;AAC3D,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,oDAAmD;AACnD;AACA,wCAAuC;AACvC,G;;;;;;ACLA;AACA;AACA;AACA,wCAAuC,gC;;;;;;ACHvC;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA;AACA,c;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA,+BAA8B;AAC9B;AACA;AACA,oDAAmD,OAAO,EAAE;AAC5D,G;;;;;;ACTA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAmE;AACnE;AACA,sFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,gDAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd,eAAc;AACd,eAAc;AACd,eAAc;AACd,gBAAe;AACf,gBAAe;AACf,gBAAe;AACf,iBAAgB;AAChB,0B;;;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACnBA;AACA;AACA;AACA,G;;;;;;ACHA;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA,G;;;;;;ACPA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;AACA;AACA;AACA,G;;;;;;ACfA;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,G;;;;;;ACFA;AACA,sEAAsE,gBAAgB,UAAU,GAAG;AACnG,EAAC,E;;;;;;ACFD;AACA;AACA,kCAAiC,QAAQ,gBAAgB,UAAU,GAAG;AACtE,EAAC,E;;;;;;ACHD;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCPM6D,Y;;AAEJ;;;;;AAKA,yBAAa5C,MAAb,EAAqB;AAAA;;AACnB,UAAKA,MAAL,GAAcA,MAAd;AACD;;AAED;;;;;;;;;sCAKkB;AAAA;;AAChB,WAAIE,cAAc,EAAlB;;AAEA,2BAAY,KAAKF,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAIiD,UAAU,MAAK7C,MAAL,CAAYR,KAAZ,EAAmBsD,KAAnB,CAAyB,GAAzB,CAAd;;AAEA5C,qBAAYV,KAAZ,IAAqBqD,QAClB1C,MADkB,CACX;AAAA,kBAAOmB,IAAIyB,OAAJ,CAAY,IAAZ,MAAsB,CAAC,CAA9B;AAAA,UADW,EAElBrC,GAFkB,CAEd,eAAO;AACV;AADU,gCAEaY,IAAIwB,KAAJ,CAAU,IAAV,EAAgBpC,GAAhB,CAAoB;AAAA,oBAAKsC,EAAEC,IAAF,EAAL;AAAA,YAApB,CAFb;AAAA;AAAA,eAELpD,MAFK;AAAA,eAEGqD,MAFH;;AAIV,kBAAO;AACLjC,oBAAOpB,MADF;AAELO,0BAAa8C,OAAOJ,KAAP,CAAa,GAAb,EAAkB,CAAlB,CAFR;AAGL9B,0BAAakC,OAAOJ,KAAP,CAAa,GAAb,EAAkB,CAAlB;AAHR,YAAP;AAKD,UAXkB,CAArB;AAYD,QAfD;;AAiBA,cAAO5C,WAAP;AACD;;AAED;;;;;;;;wCAKoB;AAAA;;AAClB,WAAIF,SAAS,EAAb;;AAEA,2BAAY,KAAKA,MAAjB,EAAyBJ,OAAzB,CAAiC,iBAAS;AACxC,aAAIiD,UAAU,OAAK7C,MAAL,CAAYR,KAAZ,EAAmBsD,KAAnB,CAAyB,GAAzB,CAAd;;AAEA;AACA9C,gBAAOR,KAAP,IAAgBqD,QAAQnC,GAAR,CAAY;AAAA,kBAAOY,IAAIwB,KAAJ,CAAU,IAAV,EAAgB,CAAhB,EAAmBG,IAAnB,EAAP;AAAA,UAAZ,EAA8CE,IAA9C,CAAmD,GAAnD,CAAhB;AACD,QALD;;AAOA,cAAOnD,MAAP;AACD;;;;;mBAGY4C,Y;;;;;;AC1Df;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yDAAwD,+BAA+B;AACvF;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA,EAAC,G;;;;;;AClDD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;;AAEA,yGAAwG,OAAO;AAC/G;AACA;AACA;AACA;AACA;AACA,E;;;;;;ACZA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAgC;AAChC,eAAc;AACd,kBAAiB;AACjB;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;;AAEA;AACA;AACA,6B;;;;;;ACjCA,6BAA4B,e;;;;;;ACA5B;AACA,WAAU;AACV,G;;;;;;ACFA,qB;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA4B,aAAa;;AAEzC;AACA;AACA;AACA;AACA;AACA,yCAAwC,oCAAoC;AAC5E,6CAA4C,oCAAoC;AAChF,MAAK,2BAA2B,oCAAoC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB,mBAAmB;AACnC;AACA;AACA,kCAAiC,2BAA2B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,G;;;;;;ACrEA,uB;;;;;;ACAA,0C;;;;;;ACAA;AACA;AACA;AACA;AACA;;AAEA;AACA,4FAAgF,aAAa,EAAE;;AAE/F;AACA,sDAAqD,0BAA0B;AAC/E;AACA,G;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;;;;;;ACxCA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACZA,+E;;;;;;ACAA;AACA;AACA;;AAEA;AACA,mEAAkE,+BAA+B;AACjG,G;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wB;;;;;;ACVA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH,G;;;;;;ACZA;AACA;;AAEA;AACA;AACA,8BAA6B;AAC7B,eAAc;AACd;AACA,EAAC;AACD;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,WAAU;AACV,EAAC,E;;;;;;AChBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;AACA;AACA;AACA;AACA,0BAAyB,kBAAkB,EAAE;;AAE7C;AACA;AACA;AACA;AACA,IAAG,UAAU;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACtBA,mBAAkB,wD;;;;;;ACAlB;AACA;AACA,0C;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,G;;;;;;ACRA;;AAEA;;AAEA;;AAEA;;AAEA,uCAAsC,uCAAuC,gBAAgB;;AAE7F;AACA;AACA,oBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAC,G;;;;;;AC1BD,mBAAkB,wD;;;;;;ACAlB;AACA;AACA;AACA;AACA,G;;;;;;ACJA;AACA;AACA,sEAAuE,0CAA0C,E;;;;;;;;;;;SCDjGQ,e,GAAAA,e;AAAT,UAASA,eAAT,CAA0BC,KAA1B,EAAiC;AACtC,UAAOA,SAAS,IAAT,MAAkB;AACvB,UAAOA,KAAP,KAAiB,QAAjB,IACA,OAAOA,KAAP,KAAiB,QADjB,IAEAA,iBAAiBC,IAFjB,IAGCC,MAAMC,OAAN,CAAcH,KAAd,KAAwBA,MAAMI,KAAN,CAAYL,eAAZ,CAJpB,CAAP;AAMD,E","file":"bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 56f143b3b4a25f90623a\n **/","require ('./simple')\r\n// TODO list more tests here\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./all-browser-tests.js\n **/","import assert from 'assert'\r\nconst DexieRelationships = require('../../src/index.js')\r\n\r\ndescribe('simple', function () {\r\n var Promise = Dexie.Promise;\r\n var db = new Dexie('bands-simple', {addons: [DexieRelationships]});\r\n db.version(1).stores({\r\n bands: `\r\n id,\r\n name`,\r\n albums: `\r\n id,\r\n name,\r\n bandId -> bands.id,\r\n year`\r\n });\r\n \r\n beforeEach(function() {\r\n return db.delete().then(()=>db.open()).then(function() {\r\n return db.transaction('rw', db.bands, db.albums, ()=>{\r\n // Bands\r\n db.bands.bulkAdd([{\r\n id: 1,\r\n name: 'Beatles'\r\n },{\r\n id: 2,\r\n name: 'Abba'\r\n }])\r\n \r\n // Albums\r\n db.albums.bulkAdd([{\r\n id: 1,\r\n name: 'Abbey Road',\r\n year: 1969,\r\n bandId: 1\r\n }, {\r\n id: 2,\r\n name: 'Let It Be',\r\n year: 1970,\r\n bandId: 1\r\n }, {\r\n id: 3,\r\n name: 'Super Trouper',\r\n bandId: 2,\r\n year: 1980\r\n }, {\r\n id: 4,\r\n name: 'Waterloo',\r\n bandId: 2,\r\n year: 1974\r\n }])\r\n })\r\n })\r\n })\r\n\r\n describe('sample', function () {\r\n it('should be possible to retrieve an entity with a collection of referring entities attached to it', function () {\r\n return db.bands.where('name').equals('Beatles').with({\r\n albums: 'albums'\r\n }).then (bands => {\r\n assert.deepEqual([{\r\n id: 1,\r\n name: 'Beatles',\r\n albums: [{\r\n id: 1,\r\n name: 'Abbey Road',\r\n year: 1969,\r\n bandId: 1\r\n }, {\r\n id: 2,\r\n name: 'Let It Be',\r\n year: 1970,\r\n bandId: 1\r\n }]\r\n }], bands)\r\n })\r\n })\r\n })\r\n})\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./simple.js\n **/","'use strict';\n\n// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js\n// original notice:\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\nfunction compare(a, b) {\n if (a === b) {\n return 0;\n }\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) {\n return -1;\n }\n if (y < x) {\n return 1;\n }\n return 0;\n}\nfunction isBuffer(b) {\n if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {\n return global.Buffer.isBuffer(b);\n }\n return !!(b != null && b._isBuffer);\n}\n\n// based on node assert, original notice:\n\n// http://wiki.commonjs.org/wiki/Unit_Testing/1.0\n//\n// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!\n//\n// Originally from narwhal.js (http://narwhaljs.org)\n// Copyright (c) 2009 Thomas Robinson <280north.com>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar util = require('util/');\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar pSlice = Array.prototype.slice;\nvar functionsHaveNames = (function () {\n return function foo() {}.name === 'foo';\n}());\nfunction pToString (obj) {\n return Object.prototype.toString.call(obj);\n}\nfunction isView(arrbuf) {\n if (isBuffer(arrbuf)) {\n return false;\n }\n if (typeof global.ArrayBuffer !== 'function') {\n return false;\n }\n if (typeof ArrayBuffer.isView === 'function') {\n return ArrayBuffer.isView(arrbuf);\n }\n if (!arrbuf) {\n return false;\n }\n if (arrbuf instanceof DataView) {\n return true;\n }\n if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {\n return true;\n }\n return false;\n}\n// 1. The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\n\n// 2. The AssertionError is defined in assert.\n// new assert.AssertionError({ message: message,\n// actual: actual,\n// expected: expected })\n\nvar regex = /\\s*function\\s+([^\\(\\s]*)\\s*/;\n// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js\nfunction getName(func) {\n if (!util.isFunction(func)) {\n return;\n }\n if (functionsHaveNames) {\n return func.name;\n }\n var str = func.toString();\n var match = str.match(regex);\n return match && match[1];\n}\nassert.AssertionError = function AssertionError(options) {\n this.name = 'AssertionError';\n this.actual = options.actual;\n this.expected = options.expected;\n this.operator = options.operator;\n if (options.message) {\n this.message = options.message;\n this.generatedMessage = false;\n } else {\n this.message = getMessage(this);\n this.generatedMessage = true;\n }\n var stackStartFunction = options.stackStartFunction || fail;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, stackStartFunction);\n } else {\n // non v8 browsers so we can have a stacktrace\n var err = new Error();\n if (err.stack) {\n var out = err.stack;\n\n // try to strip useless frames\n var fn_name = getName(stackStartFunction);\n var idx = out.indexOf('\\n' + fn_name);\n if (idx >= 0) {\n // once we have located the function frame\n // we need to strip out everything before it (and its line)\n var next_line = out.indexOf('\\n', idx + 1);\n out = out.substring(next_line + 1);\n }\n\n this.stack = out;\n }\n }\n};\n\n// assert.AssertionError instanceof Error\nutil.inherits(assert.AssertionError, Error);\n\nfunction truncate(s, n) {\n if (typeof s === 'string') {\n return s.length < n ? s : s.slice(0, n);\n } else {\n return s;\n }\n}\nfunction inspect(something) {\n if (functionsHaveNames || !util.isFunction(something)) {\n return util.inspect(something);\n }\n var rawname = getName(something);\n var name = rawname ? ': ' + rawname : '';\n return '[Function' + name + ']';\n}\nfunction getMessage(self) {\n return truncate(inspect(self.actual), 128) + ' ' +\n self.operator + ' ' +\n truncate(inspect(self.expected), 128);\n}\n\n// At present only the three keys mentioned above are used and\n// understood by the spec. Implementations or sub modules can pass\n// other keys to the AssertionError's constructor - they will be\n// ignored.\n\n// 3. All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction fail(actual, expected, message, operator, stackStartFunction) {\n throw new assert.AssertionError({\n message: message,\n actual: actual,\n expected: expected,\n operator: operator,\n stackStartFunction: stackStartFunction\n });\n}\n\n// EXTENSION! allows for well behaved errors defined elsewhere.\nassert.fail = fail;\n\n// 4. Pure assertion tests whether a value is truthy, as determined\n// by !!guard.\n// assert.ok(guard, message_opt);\n// This statement is equivalent to assert.equal(true, !!guard,\n// message_opt);. To test strictly for the value true, use\n// assert.strictEqual(true, guard, message_opt);.\n\nfunction ok(value, message) {\n if (!value) fail(value, true, message, '==', assert.ok);\n}\nassert.ok = ok;\n\n// 5. The equality assertion tests shallow, coercive equality with\n// ==.\n// assert.equal(actual, expected, message_opt);\n\nassert.equal = function equal(actual, expected, message) {\n if (actual != expected) fail(actual, expected, message, '==', assert.equal);\n};\n\n// 6. The non-equality assertion tests for whether two objects are not equal\n// with != assert.notEqual(actual, expected, message_opt);\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (actual == expected) {\n fail(actual, expected, message, '!=', assert.notEqual);\n }\n};\n\n// 7. The equivalence assertion tests a deep equality relation.\n// assert.deepEqual(actual, expected, message_opt);\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (!_deepEqual(actual, expected, false)) {\n fail(actual, expected, message, 'deepEqual', assert.deepEqual);\n }\n};\n\nassert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (!_deepEqual(actual, expected, true)) {\n fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);\n }\n};\n\nfunction _deepEqual(actual, expected, strict, memos) {\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n } else if (isBuffer(actual) && isBuffer(expected)) {\n return compare(actual, expected) === 0;\n\n // 7.2. If the expected value is a Date object, the actual value is\n // equivalent if it is also a Date object that refers to the same time.\n } else if (util.isDate(actual) && util.isDate(expected)) {\n return actual.getTime() === expected.getTime();\n\n // 7.3 If the expected value is a RegExp object, the actual value is\n // equivalent if it is also a RegExp object with the same source and\n // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).\n } else if (util.isRegExp(actual) && util.isRegExp(expected)) {\n return actual.source === expected.source &&\n actual.global === expected.global &&\n actual.multiline === expected.multiline &&\n actual.lastIndex === expected.lastIndex &&\n actual.ignoreCase === expected.ignoreCase;\n\n // 7.4. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if ((actual === null || typeof actual !== 'object') &&\n (expected === null || typeof expected !== 'object')) {\n return strict ? actual === expected : actual == expected;\n\n // If both values are instances of typed arrays, wrap their underlying\n // ArrayBuffers in a Buffer each to increase performance\n // This optimization requires the arrays to have the same type as checked by\n // Object.prototype.toString (aka pToString). Never perform binary\n // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their\n // bit patterns are not identical.\n } else if (isView(actual) && isView(expected) &&\n pToString(actual) === pToString(expected) &&\n !(actual instanceof Float32Array ||\n actual instanceof Float64Array)) {\n return compare(new Uint8Array(actual.buffer),\n new Uint8Array(expected.buffer)) === 0;\n\n // 7.5 For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else if (isBuffer(actual) !== isBuffer(expected)) {\n return false;\n } else {\n memos = memos || {actual: [], expected: []};\n\n var actualIndex = memos.actual.indexOf(actual);\n if (actualIndex !== -1) {\n if (actualIndex === memos.expected.indexOf(expected)) {\n return true;\n }\n }\n\n memos.actual.push(actual);\n memos.expected.push(expected);\n\n return objEquiv(actual, expected, strict, memos);\n }\n}\n\nfunction isArguments(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n}\n\nfunction objEquiv(a, b, strict, actualVisitedObjects) {\n if (a === null || a === undefined || b === null || b === undefined)\n return false;\n // if one is a primitive, the other must be same\n if (util.isPrimitive(a) || util.isPrimitive(b))\n return a === b;\n if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))\n return false;\n var aIsArgs = isArguments(a);\n var bIsArgs = isArguments(b);\n if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))\n return false;\n if (aIsArgs) {\n a = pSlice.call(a);\n b = pSlice.call(b);\n return _deepEqual(a, b, strict);\n }\n var ka = objectKeys(a);\n var kb = objectKeys(b);\n var key, i;\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length !== kb.length)\n return false;\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] !== kb[i])\n return false;\n }\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))\n return false;\n }\n return true;\n}\n\n// 8. The non-equivalence assertion tests for any deep inequality.\n// assert.notDeepEqual(actual, expected, message_opt);\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (_deepEqual(actual, expected, false)) {\n fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);\n }\n};\n\nassert.notDeepStrictEqual = notDeepStrictEqual;\nfunction notDeepStrictEqual(actual, expected, message) {\n if (_deepEqual(actual, expected, true)) {\n fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);\n }\n}\n\n\n// 9. The strict equality assertion tests strict equality, as determined by ===.\n// assert.strictEqual(actual, expected, message_opt);\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (actual !== expected) {\n fail(actual, expected, message, '===', assert.strictEqual);\n }\n};\n\n// 10. The strict non-equality assertion tests for strict inequality, as\n// determined by !==. assert.notStrictEqual(actual, expected, message_opt);\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (actual === expected) {\n fail(actual, expected, message, '!==', assert.notStrictEqual);\n }\n};\n\nfunction expectedException(actual, expected) {\n if (!actual || !expected) {\n return false;\n }\n\n if (Object.prototype.toString.call(expected) == '[object RegExp]') {\n return expected.test(actual);\n }\n\n try {\n if (actual instanceof expected) {\n return true;\n }\n } catch (e) {\n // Ignore. The instanceof check doesn't work for arrow functions.\n }\n\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n\n return expected.call({}, actual) === true;\n}\n\nfunction _tryBlock(block) {\n var error;\n try {\n block();\n } catch (e) {\n error = e;\n }\n return error;\n}\n\nfunction _throws(shouldThrow, block, expected, message) {\n var actual;\n\n if (typeof block !== 'function') {\n throw new TypeError('\"block\" argument must be a function');\n }\n\n if (typeof expected === 'string') {\n message = expected;\n expected = null;\n }\n\n actual = _tryBlock(block);\n\n message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +\n (message ? ' ' + message : '.');\n\n if (shouldThrow && !actual) {\n fail(actual, expected, 'Missing expected exception' + message);\n }\n\n var userProvidedMessage = typeof message === 'string';\n var isUnwantedException = !shouldThrow && util.isError(actual);\n var isUnexpectedException = !shouldThrow && actual && !expected;\n\n if ((isUnwantedException &&\n userProvidedMessage &&\n expectedException(actual, expected)) ||\n isUnexpectedException) {\n fail(actual, expected, 'Got unwanted exception' + message);\n }\n\n if ((shouldThrow && actual && expected &&\n !expectedException(actual, expected)) || (!shouldThrow && actual)) {\n throw actual;\n }\n}\n\n// 11. Expected to throw an error:\n// assert.throws(block, Error_opt, message_opt);\n\nassert.throws = function(block, /*optional*/error, /*optional*/message) {\n _throws(true, block, error, message);\n};\n\n// EXTENSION! This is annoying to write outside this module.\nassert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {\n _throws(false, block, error, message);\n};\n\nassert.ifError = function(err) { if (err) throw err; };\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n if (hasOwn.call(obj, key)) keys.push(key);\n }\n return keys;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/assert/assert.js\n ** module id = 2\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/util/util.js\n ** module id = 3\n ** module chunks = 0\n **/","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/process/browser.js\n ** module id = 4\n ** module chunks = 0\n **/","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/util/support/isBufferBrowser.js\n ** module id = 5\n ** module chunks = 0\n **/","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/util/~/inherits/inherits_browser.js\n ** module id = 6\n ** module chunks = 0\n **/","import SchemaParser from './schema-parser'\r\nimport {isIndexableType} from './utils'\r\n\r\nconst Relationships = (db) => {\r\n const Dexie = db.constructor\r\n // Use Dexie.Promise to ensure transaction safety.\r\n const Promise = Dexie.Promise\r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Table.prototype.with = function (relationships) {\r\n return this.toCollection().with(relationships)\r\n }\r\n\r\n /**\r\n * Iterate through all items and collect related records\r\n *\r\n * @param relationships\r\n *\r\n * @returns {Dexie.Promise}\r\n */\r\n db.Collection.prototype.with = function (relationships) {\r\n const baseTable = this._ctx.table.name\r\n const databaseTables = db._allTables\r\n\r\n // this holds tables that have foreign keys pointing at the current table\r\n let usableForeignTables = {}\r\n\r\n // validate target tables and add them into our usable tables object\r\n Object.keys(relationships).forEach((column) => {\r\n let table = relationships[column]\r\n\r\n if (!databaseTables.hasOwnProperty(table)) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t exist.')\r\n }\r\n\r\n if (!databaseTables[table].schema.hasOwnProperty('foreignKeys')) {\r\n throw new Error('Relationship table ' + table + ' doesn\\'t have foreign keys set.')\r\n }\r\n\r\n // remove the foreign keys that don't link to the base table\r\n let columns = databaseTables[table].schema.foreignKeys.filter(column => column.targetTable === baseTable)\r\n\r\n if (columns.length > 0) {\r\n usableForeignTables[table] = {\r\n column: column,\r\n foreign: columns[0]\r\n }\r\n }\r\n })\r\n\r\n let foreignTableNames = Object.keys(usableForeignTables)\r\n\r\n return this.toArray().then(rows => {\r\n //\r\n // Extract the mix of all related keys in all rows\r\n //\r\n let queries = foreignTableNames\r\n .map(tableName => {\r\n // For each foreign table, query all items that any row refers to\r\n let foreignTable = usableForeignTables[tableName]\r\n let allRelatedKeys = rows\r\n .map(row => row[foreignTable.foreign.targetIndex])\r\n .filter(isIndexableType)\r\n\r\n // Build the Collection to retrieve all related items\r\n return databaseTables[tableName]\r\n .where(foreignTable.foreign.index)\r\n .anyOf(allRelatedKeys)\r\n })\r\n\r\n // Execute queries in parallell\r\n let queryPromises = queries.map(query => query.toArray())\r\n\r\n //\r\n // Await all results and then try mapping each response\r\n // with its corresponding row and attach related items onto each row\r\n //\r\n return Promise.all(queryPromises).then(queryResults => {\r\n foreignTableNames.forEach((tableName, idx) => {\r\n let foreignTable = usableForeignTables[tableName]\r\n let result = queryResults[idx]\r\n let targetIndex = foreignTable.foreign.targetIndex\r\n let foreignIndex = foreignTable.foreign.index\r\n let column = foreignTable.column\r\n\r\n // Create a lookup by targetIndex (normally 'id')\r\n // and set the column onto the target\r\n let lookup = {}\r\n rows.forEach(row => {\r\n let arrayProperty = []\r\n row[column] = arrayProperty\r\n lookup[row[targetIndex]] = arrayProperty\r\n })\r\n\r\n // Populate column on each row\r\n result.forEach(record => {\r\n let foreignKey = record[foreignIndex]\r\n let arrayProperty = lookup[foreignKey]\r\n if (!arrayProperty) {\r\n throw new Error(\r\n `Could not lookup foreign key where ` +\r\n `${tableName}.${foreignIndex} == ${baseTable}.${column}. ` +\r\n `The content of the failing key was: ${JSON.stringify(foreignKey)}.`)\r\n }\r\n\r\n arrayProperty.push(record)\r\n })\r\n })\r\n }).then(() => rows)\r\n })\r\n }\r\n\r\n db.Version.prototype._parseStoresSpec = Dexie.override(\r\n db.Version.prototype._parseStoresSpec,\r\n parseStoresSpec => function (storesSpec, outDbSchema) {\r\n const parser = new SchemaParser(storesSpec)\r\n\r\n let foreignKeys = parser.getForeignKeys()\r\n // call the original method\r\n let rv = parseStoresSpec.call(this, parser.getCleanedSchema(), outDbSchema)\r\n\r\n // set foreign keys into database table objects\r\n // to use later in 'with' method\r\n Object.keys(outDbSchema).forEach(table => {\r\n if (foreignKeys.hasOwnProperty(table)) {\r\n outDbSchema[table].foreignKeys = foreignKeys[table]\r\n }\r\n })\r\n\r\n return rv\r\n })\r\n}\r\n\r\nmodule.exports = Relationships\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./../../src/index.js\n **/","module.exports = { \"default\": require(\"core-js/library/fn/json/stringify\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/core-js/json/stringify.js\n ** module id = 8\n ** module chunks = 0\n **/","var core = require('../../modules/_core')\n , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});\nmodule.exports = function stringify(it){ // eslint-disable-line no-unused-vars\n return $JSON.stringify.apply($JSON, arguments);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/fn/json/stringify.js\n ** module id = 9\n ** module chunks = 0\n **/","var core = module.exports = {version: '2.4.0'};\nif(typeof __e == 'number')__e = core; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_core.js\n ** module id = 10\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/keys\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/core-js/object/keys.js\n ** module id = 11\n ** module chunks = 0\n **/","require('../../modules/es6.object.keys');\nmodule.exports = require('../../modules/_core').Object.keys;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/fn/object/keys.js\n ** module id = 12\n ** module chunks = 0\n **/","// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object')\n , $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function(){\n return function keys(it){\n return $keys(toObject(it));\n };\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/es6.object.keys.js\n ** module id = 13\n ** module chunks = 0\n **/","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function(it){\n return Object(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_to-object.js\n ** module id = 14\n ** module chunks = 0\n **/","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function(it){\n if(it == undefined)throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_defined.js\n ** module id = 15\n ** module chunks = 0\n **/","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal')\n , enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O){\n return $keys(O, enumBugKeys);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_object-keys.js\n ** module id = 16\n ** module chunks = 0\n **/","var has = require('./_has')\n , toIObject = require('./_to-iobject')\n , arrayIndexOf = require('./_array-includes')(false)\n , IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function(object, names){\n var O = toIObject(object)\n , i = 0\n , result = []\n , key;\n for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while(names.length > i)if(has(O, key = names[i++])){\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_object-keys-internal.js\n ** module id = 17\n ** module chunks = 0\n **/","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function(it, key){\n return hasOwnProperty.call(it, key);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_has.js\n ** module id = 18\n ** module chunks = 0\n **/","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject')\n , defined = require('./_defined');\nmodule.exports = function(it){\n return IObject(defined(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_to-iobject.js\n ** module id = 19\n ** module chunks = 0\n **/","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_iobject.js\n ** module id = 20\n ** module chunks = 0\n **/","var toString = {}.toString;\n\nmodule.exports = function(it){\n return toString.call(it).slice(8, -1);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_cof.js\n ** module id = 21\n ** module chunks = 0\n **/","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject')\n , toLength = require('./_to-length')\n , toIndex = require('./_to-index');\nmodule.exports = function(IS_INCLUDES){\n return function($this, el, fromIndex){\n var O = toIObject($this)\n , length = toLength(O.length)\n , index = toIndex(fromIndex, length)\n , value;\n // Array#includes uses SameValueZero equality algorithm\n if(IS_INCLUDES && el != el)while(length > index){\n value = O[index++];\n if(value != value)return true;\n // Array#toIndex ignores holes, Array#includes - not\n } else for(;length > index; index++)if(IS_INCLUDES || index in O){\n if(O[index] === el)return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_array-includes.js\n ** module id = 22\n ** module chunks = 0\n **/","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer')\n , min = Math.min;\nmodule.exports = function(it){\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_to-length.js\n ** module id = 23\n ** module chunks = 0\n **/","// 7.1.4 ToInteger\nvar ceil = Math.ceil\n , floor = Math.floor;\nmodule.exports = function(it){\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_to-integer.js\n ** module id = 24\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , max = Math.max\n , min = Math.min;\nmodule.exports = function(index, length){\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_to-index.js\n ** module id = 25\n ** module chunks = 0\n **/","var shared = require('./_shared')('keys')\n , uid = require('./_uid');\nmodule.exports = function(key){\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_shared-key.js\n ** module id = 26\n ** module chunks = 0\n **/","var global = require('./_global')\n , SHARED = '__core-js_shared__'\n , store = global[SHARED] || (global[SHARED] = {});\nmodule.exports = function(key){\n return store[key] || (store[key] = {});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_shared.js\n ** module id = 27\n ** module chunks = 0\n **/","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();\nif(typeof __g == 'number')__g = global; // eslint-disable-line no-undef\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_global.js\n ** module id = 28\n ** module chunks = 0\n **/","var id = 0\n , px = Math.random();\nmodule.exports = function(key){\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_uid.js\n ** module id = 29\n ** module chunks = 0\n **/","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_enum-bug-keys.js\n ** module id = 30\n ** module chunks = 0\n **/","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export')\n , core = require('./_core')\n , fails = require('./_fails');\nmodule.exports = function(KEY, exec){\n var fn = (core.Object || {})[KEY] || Object[KEY]\n , exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_object-sap.js\n ** module id = 31\n ** module chunks = 0\n **/","var global = require('./_global')\n , core = require('./_core')\n , ctx = require('./_ctx')\n , hide = require('./_hide')\n , PROTOTYPE = 'prototype';\n\nvar $export = function(type, name, source){\n var IS_FORCED = type & $export.F\n , IS_GLOBAL = type & $export.G\n , IS_STATIC = type & $export.S\n , IS_PROTO = type & $export.P\n , IS_BIND = type & $export.B\n , IS_WRAP = type & $export.W\n , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})\n , expProto = exports[PROTOTYPE]\n , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]\n , key, own, out;\n if(IS_GLOBAL)source = name;\n for(key in source){\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if(own && key in exports)continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function(C){\n var F = function(a, b, c){\n if(this instanceof C){\n switch(arguments.length){\n case 0: return new C;\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if(IS_PROTO){\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library` \nmodule.exports = $export;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_export.js\n ** module id = 32\n ** module chunks = 0\n **/","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function(fn, that, length){\n aFunction(fn);\n if(that === undefined)return fn;\n switch(length){\n case 1: return function(a){\n return fn.call(that, a);\n };\n case 2: return function(a, b){\n return fn.call(that, a, b);\n };\n case 3: return function(a, b, c){\n return fn.call(that, a, b, c);\n };\n }\n return function(/* ...args */){\n return fn.apply(that, arguments);\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_ctx.js\n ** module id = 33\n ** module chunks = 0\n **/","module.exports = function(it){\n if(typeof it != 'function')throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_a-function.js\n ** module id = 34\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function(object, key, value){\n return dP.f(object, key, createDesc(1, value));\n} : function(object, key, value){\n object[key] = value;\n return object;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_hide.js\n ** module id = 35\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , IE8_DOM_DEFINE = require('./_ie8-dom-define')\n , toPrimitive = require('./_to-primitive')\n , dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if(IE8_DOM_DEFINE)try {\n return dP(O, P, Attributes);\n } catch(e){ /* empty */ }\n if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');\n if('value' in Attributes)O[P] = Attributes.value;\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_object-dp.js\n ** module id = 36\n ** module chunks = 0\n **/","var isObject = require('./_is-object');\nmodule.exports = function(it){\n if(!isObject(it))throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_an-object.js\n ** module id = 37\n ** module chunks = 0\n **/","module.exports = function(it){\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_is-object.js\n ** module id = 38\n ** module chunks = 0\n **/","module.exports = !require('./_descriptors') && !require('./_fails')(function(){\n return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_ie8-dom-define.js\n ** module id = 39\n ** module chunks = 0\n **/","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function(){\n return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_descriptors.js\n ** module id = 40\n ** module chunks = 0\n **/","module.exports = function(exec){\n try {\n return !!exec();\n } catch(e){\n return true;\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_fails.js\n ** module id = 41\n ** module chunks = 0\n **/","var isObject = require('./_is-object')\n , document = require('./_global').document\n // in old IE typeof document.createElement is 'object'\n , is = isObject(document) && isObject(document.createElement);\nmodule.exports = function(it){\n return is ? document.createElement(it) : {};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_dom-create.js\n ** module id = 42\n ** module chunks = 0\n **/","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function(it, S){\n if(!isObject(it))return it;\n var fn, val;\n if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;\n if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_to-primitive.js\n ** module id = 43\n ** module chunks = 0\n **/","module.exports = function(bitmap, value){\n return {\n enumerable : !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable : !(bitmap & 4),\n value : value\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_property-desc.js\n ** module id = 44\n ** module chunks = 0\n **/","class SchemaParser {\r\n\r\n /**\r\n * Schema parser\r\n *\r\n * @param schema\r\n */\r\n constructor (schema) {\r\n this.schema = schema\r\n }\r\n\r\n /**\r\n * Extracts foreign keys from the schema\r\n *\r\n * @returns Object\r\n */\r\n getForeignKeys () {\r\n let foreignKeys = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n foreignKeys[table] = indexes\r\n .filter(idx => idx.indexOf('->') !== -1)\r\n .map(idx => {\r\n // split the column and foreign table info\r\n let [column, target] = idx.split('->').map(x => x.trim())\r\n\r\n return {\r\n index: column,\r\n targetTable: target.split('.')[0],\r\n targetIndex: target.split('.')[1]\r\n }\r\n })\r\n })\r\n\r\n return foreignKeys\r\n }\r\n\r\n /**\r\n * Get schema without the foreign key definitions\r\n *\r\n * @returns Object\r\n */\r\n getCleanedSchema () {\r\n let schema = {}\r\n\r\n Object.keys(this.schema).forEach(table => {\r\n let indexes = this.schema[table].split(',')\r\n\r\n // Remove foreign keys syntax before calling the original method\r\n schema[table] = indexes.map(idx => idx.split('->')[0].trim()).join(',')\r\n })\r\n\r\n return schema\r\n }\r\n}\r\n\r\nexport default SchemaParser\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./../../src/schema-parser.js\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _isIterable2 = require(\"../core-js/is-iterable\");\n\nvar _isIterable3 = _interopRequireDefault(_isIterable2);\n\nvar _getIterator2 = require(\"../core-js/get-iterator\");\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if ((0, _isIterable3.default)(Object(arr))) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/helpers/slicedToArray.js\n ** module id = 46\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/is-iterable\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/core-js/is-iterable.js\n ** module id = 47\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.is-iterable');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/fn/is-iterable.js\n ** module id = 48\n ** module chunks = 0\n **/","require('./es6.array.iterator');\nvar global = require('./_global')\n , hide = require('./_hide')\n , Iterators = require('./_iterators')\n , TO_STRING_TAG = require('./_wks')('toStringTag');\n\nfor(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){\n var NAME = collections[i]\n , Collection = global[NAME]\n , proto = Collection && Collection.prototype;\n if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/web.dom.iterable.js\n ** module id = 49\n ** module chunks = 0\n **/","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables')\n , step = require('./_iter-step')\n , Iterators = require('./_iterators')\n , toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function(iterated, kind){\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , kind = this._k\n , index = this._i++;\n if(!O || index >= O.length){\n this._t = undefined;\n return step(1);\n }\n if(kind == 'keys' )return step(0, index);\n if(kind == 'values')return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/es6.array.iterator.js\n ** module id = 50\n ** module chunks = 0\n **/","module.exports = function(){ /* empty */ };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_add-to-unscopables.js\n ** module id = 51\n ** module chunks = 0\n **/","module.exports = function(done, value){\n return {value: value, done: !!done};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_iter-step.js\n ** module id = 52\n ** module chunks = 0\n **/","module.exports = {};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_iterators.js\n ** module id = 53\n ** module chunks = 0\n **/","'use strict';\nvar LIBRARY = require('./_library')\n , $export = require('./_export')\n , redefine = require('./_redefine')\n , hide = require('./_hide')\n , has = require('./_has')\n , Iterators = require('./_iterators')\n , $iterCreate = require('./_iter-create')\n , setToStringTag = require('./_set-to-string-tag')\n , getPrototypeOf = require('./_object-gpo')\n , ITERATOR = require('./_wks')('iterator')\n , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`\n , FF_ITERATOR = '@@iterator'\n , KEYS = 'keys'\n , VALUES = 'values';\n\nvar returnThis = function(){ return this; };\n\nmodule.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){\n $iterCreate(Constructor, NAME, next);\n var getMethod = function(kind){\n if(!BUGGY && kind in proto)return proto[kind];\n switch(kind){\n case KEYS: return function keys(){ return new Constructor(this, kind); };\n case VALUES: return function values(){ return new Constructor(this, kind); };\n } return function entries(){ return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator'\n , DEF_VALUES = DEFAULT == VALUES\n , VALUES_BUG = false\n , proto = Base.prototype\n , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]\n , $default = $native || getMethod(DEFAULT)\n , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined\n , $anyNative = NAME == 'Array' ? proto.entries || $native : $native\n , methods, key, IteratorPrototype;\n // Fix native\n if($anyNative){\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base));\n if(IteratorPrototype !== Object.prototype){\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if(DEF_VALUES && $native && $native.name !== VALUES){\n VALUES_BUG = true;\n $default = function values(){ return $native.call(this); };\n }\n // Define iterator\n if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if(DEFAULT){\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if(FORCED)for(key in methods){\n if(!(key in proto))redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_iter-define.js\n ** module id = 54\n ** module chunks = 0\n **/","module.exports = true;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_library.js\n ** module id = 55\n ** module chunks = 0\n **/","module.exports = require('./_hide');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_redefine.js\n ** module id = 56\n ** module chunks = 0\n **/","'use strict';\nvar create = require('./_object-create')\n , descriptor = require('./_property-desc')\n , setToStringTag = require('./_set-to-string-tag')\n , IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function(){ return this; });\n\nmodule.exports = function(Constructor, NAME, next){\n Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_iter-create.js\n ** module id = 57\n ** module chunks = 0\n **/","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object')\n , dPs = require('./_object-dps')\n , enumBugKeys = require('./_enum-bug-keys')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , Empty = function(){ /* empty */ }\n , PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function(){\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe')\n , i = enumBugKeys.length\n , lt = '<'\n , gt = '>'\n , iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties){\n var result;\n if(O !== null){\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty;\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_object-create.js\n ** module id = 58\n ** module chunks = 0\n **/","var dP = require('./_object-dp')\n , anObject = require('./_an-object')\n , getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties){\n anObject(O);\n var keys = getKeys(Properties)\n , length = keys.length\n , i = 0\n , P;\n while(length > i)dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_object-dps.js\n ** module id = 59\n ** module chunks = 0\n **/","module.exports = require('./_global').document && document.documentElement;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_html.js\n ** module id = 60\n ** module chunks = 0\n **/","var def = require('./_object-dp').f\n , has = require('./_has')\n , TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function(it, tag, stat){\n if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_set-to-string-tag.js\n ** module id = 61\n ** module chunks = 0\n **/","var store = require('./_shared')('wks')\n , uid = require('./_uid')\n , Symbol = require('./_global').Symbol\n , USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function(name){\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_wks.js\n ** module id = 62\n ** module chunks = 0\n **/","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has')\n , toObject = require('./_to-object')\n , IE_PROTO = require('./_shared-key')('IE_PROTO')\n , ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function(O){\n O = toObject(O);\n if(has(O, IE_PROTO))return O[IE_PROTO];\n if(typeof O.constructor == 'function' && O instanceof O.constructor){\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_object-gpo.js\n ** module id = 63\n ** module chunks = 0\n **/","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function(iterated){\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function(){\n var O = this._t\n , index = this._i\n , point;\n if(index >= O.length)return {value: undefined, done: true};\n point = $at(O, index);\n this._i += point.length;\n return {value: point, done: false};\n});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/es6.string.iterator.js\n ** module id = 64\n ** module chunks = 0\n **/","var toInteger = require('./_to-integer')\n , defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function(TO_STRING){\n return function(that, pos){\n var s = String(defined(that))\n , i = toInteger(pos)\n , l = s.length\n , a, b;\n if(i < 0 || i >= l)return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_string-at.js\n ** module id = 65\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').isIterable = function(it){\n var O = Object(it);\n return O[ITERATOR] !== undefined\n || '@@iterator' in O\n || Iterators.hasOwnProperty(classof(O));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/core.is-iterable.js\n ** module id = 66\n ** module chunks = 0\n **/","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof')\n , TAG = require('./_wks')('toStringTag')\n // ES3 wrong here\n , ARG = cof(function(){ return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function(it, key){\n try {\n return it[key];\n } catch(e){ /* empty */ }\n};\n\nmodule.exports = function(it){\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/_classof.js\n ** module id = 67\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/get-iterator\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/core-js/get-iterator.js\n ** module id = 68\n ** module chunks = 0\n **/","require('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.get-iterator');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/fn/get-iterator.js\n ** module id = 69\n ** module chunks = 0\n **/","var anObject = require('./_an-object')\n , get = require('./core.get-iterator-method');\nmodule.exports = require('./_core').getIterator = function(it){\n var iterFn = get(it);\n if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');\n return anObject(iterFn.call(it));\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/core.get-iterator.js\n ** module id = 70\n ** module chunks = 0\n **/","var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function(it){\n if(it != undefined)return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/core.get-iterator-method.js\n ** module id = 71\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nexports.default = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/helpers/classCallCheck.js\n ** module id = 72\n ** module chunks = 0\n **/","\"use strict\";\n\nexports.__esModule = true;\n\nvar _defineProperty = require(\"../core-js/object/define-property\");\n\nvar _defineProperty2 = _interopRequireDefault(_defineProperty);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n (0, _defineProperty2.default)(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/helpers/createClass.js\n ** module id = 73\n ** module chunks = 0\n **/","module.exports = { \"default\": require(\"core-js/library/fn/object/define-property\"), __esModule: true };\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/babel-runtime/core-js/object/define-property.js\n ** module id = 74\n ** module chunks = 0\n **/","require('../../modules/es6.object.define-property');\nvar $Object = require('../../modules/_core').Object;\nmodule.exports = function defineProperty(it, key, desc){\n return $Object.defineProperty(it, key, desc);\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/fn/object/define-property.js\n ** module id = 75\n ** module chunks = 0\n **/","var $export = require('./_export');\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !require('./_descriptors'), 'Object', {defineProperty: require('./_object-dp').f});\n\n\n/*****************\n ** WEBPACK FOOTER\n ** C:/repos/dexie-relationships/~/core-js/library/modules/es6.object.define-property.js\n ** module id = 76\n ** module chunks = 0\n **/","\r\nexport function isIndexableType (value) {\r\n return value != null && (// Using \"!=\" instead of \"!==\" to check for both null and undefined!\r\n typeof value === 'string' ||\r\n typeof value === 'number' ||\r\n value instanceof Date ||\r\n (Array.isArray(value) && value.every(isIndexableType))\r\n )\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./../../src/utils.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/test/browser/simple.js b/test/browser/simple.js new file mode 100644 index 0000000..67af811 --- /dev/null +++ b/test/browser/simple.js @@ -0,0 +1,79 @@ +import assert from 'assert' +const DexieRelationships = require('../../src/index.js') + +describe('simple', function () { + var Promise = Dexie.Promise; + var db = new Dexie('bands-simple', {addons: [DexieRelationships]}); + db.version(1).stores({ + bands: ` + id, + name`, + albums: ` + id, + name, + bandId -> bands.id, + year` + }); + + beforeEach(function() { + return db.delete().then(()=>db.open()).then(function() { + return db.transaction('rw', db.bands, db.albums, ()=>{ + // Bands + db.bands.bulkAdd([{ + id: 1, + name: 'Beatles' + },{ + id: 2, + name: 'Abba' + }]) + + // Albums + db.albums.bulkAdd([{ + id: 1, + name: 'Abbey Road', + year: 1969, + bandId: 1 + }, { + id: 2, + name: 'Let It Be', + year: 1970, + bandId: 1 + }, { + id: 3, + name: 'Super Trouper', + bandId: 2, + year: 1980 + }, { + id: 4, + name: 'Waterloo', + bandId: 2, + year: 1974 + }]) + }) + }) + }) + + describe('sample', function () { + it('should be possible to retrieve an entity with a collection of referring entities attached to it', function () { + return db.bands.where('name').equals('Beatles').with({ + albums: 'albums' + }).then (bands => { + assert.deepEqual([{ + id: 1, + name: 'Beatles', + albums: [{ + id: 1, + name: 'Abbey Road', + year: 1969, + bandId: 1 + }, { + id: 2, + name: 'Let It Be', + year: 1970, + bandId: 1 + }] + }], bands) + }) + }) + }) +}) diff --git a/test/browser/testrunner.html b/test/browser/testrunner.html new file mode 100644 index 0000000..629223a --- /dev/null +++ b/test/browser/testrunner.html @@ -0,0 +1,18 @@ + + + + Mocha Tests + + + +
+ + + + + + + + \ No newline at end of file diff --git a/test/browser/webpack.config.js b/test/browser/webpack.config.js new file mode 100644 index 0000000..387e654 --- /dev/null +++ b/test/browser/webpack.config.js @@ -0,0 +1,27 @@ +var path = require('path'); +var webpack = require('webpack'); + +module.exports = { + entry: './all-browser-tests.js', + externals: ['dexie'], + output: { + path: __dirname, + filename: 'bundle.js' + }, + module: { + loaders: [ + { + test: /\.js$/, + exclude: /(node_modules|bower_components)/, + loader: 'babel-loader', + query: { + presets: ['es2015'] + } + } + ] + }, + stats: { + colors: true + }, + devtool: 'source-map' +}; From 4c65ce45a8f8ca7c70be7d1327ded07095cd2d85 Mon Sep 17 00:00:00 2001 From: David Fahlander Date: Wed, 26 Oct 2016 17:29:24 +0200 Subject: [PATCH 5/6] Added dexie to devDependencies So that 'npm install' is enough to set things up for testing. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9129dcd..f1eaee0 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "babel-plugin-transform-runtime": "^6.15.0", "babel-preset-es2015": "^6.16.0", "chai": "^3.5.0", + "dexie": "^2.0.0-beta.3", "eslint": "^3.8.1", "eslint-config-standard": "^6.2.0", "eslint-plugin-promise": "^3.3.0", From ccb214ffd3cf247988fbe5e74a179491bd294762 Mon Sep 17 00:00:00 2001 From: David Fahlander Date: Wed, 26 Oct 2016 17:32:47 +0200 Subject: [PATCH 6/6] Fixed a typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 297ec94..f334761 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ db.project_members.add({name: 'Member #3', project_id: 1}) #### Usage ```javascript -db.with({ +db.projects.with({ 'settings': 'project_settings', 'members': 'project_members' }).then(rows => console.log(rows))