示例#1
0
test('basic error; 0 context', _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
  var error, frames;
  return _regeneratorRuntime.wrap(function _callee$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          expect.assertions(1);
          error = 'TypeError: document.body.missing is not a function\n    at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)\n    at http://localhost:3000/static/js/bundle.js:30091:25\n    at measureLifeCyclePerf (http://localhost:3000/static/js/bundle.js:29901:12)\n    at http://localhost:3000/static/js/bundle.js:30090:11\n    at CallbackQueue.notifyAll (http://localhost:3000/static/js/bundle.js:13256:22)\n    at ReactReconcileTransaction.close (http://localhost:3000/static/js/bundle.js:35124:26)\n    at ReactReconcileTransaction.closeAll (http://localhost:3000/static/js/bundle.js:7390:25)\n    at ReactReconcileTransaction.perform (http://localhost:3000/static/js/bundle.js:7337:16)\n    at batchedMountComponentIntoNode (http://localhost:3000/static/js/bundle.js:14204:15)\n    at ReactDefaultBatchingStrategyTransaction.perform (http://localhost:3000/static/js/bundle.js:7324:20)\n    at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:33900:26)\n    at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:2181:27)\n    at Object._renderNewRootComponent (http://localhost:3000/static/js/bundle.js:14398:18)\n    at Object._renderSubtreeIntoContainer (http://localhost:3000/static/js/bundle.js:14479:32)\n    at Object.render (http://localhost:3000/static/js/bundle.js:14500:23)\n    at Object.friendlySyntaxErrorLabel (http://localhost:3000/static/js/bundle.js:17287:20)\n    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n    at fn (http://localhost:3000/static/js/bundle.js:84:20)\n    at Object.<anonymous> (http://localhost:3000/static/js/bundle.js:41219:18)\n    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n    at validateFormat (http://localhost:3000/static/js/bundle.js:709:39)\n    at http://localhost:3000/static/js/bundle.js:712:10';


          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle.mjs')).toString('utf8'));
          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle.mjs.map')).toString('utf8'));
          _context.next = 6;
          return map(parse(error), 0);

        case 6:
          frames = _context.sent;

          expect(frames).toEqual(JSON.parse(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle.json')).toString('utf8')));

        case 8:
        case 'end':
          return _context.stop();
      }
    }
  }, _callee, _this);
})));
示例#2
0
test('default context (3)', _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
  var error, frames;
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
    while (1) {
      switch (_context2.prev = _context2.next) {
        case 0:
          expect.assertions(1);
          error = 'TypeError: document.body.missing is not a function\n    at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)';


          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle.mjs')).toString('utf8'));
          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle.mjs.map')).toString('utf8'));
          _context2.next = 6;
          return map(parse(error));

        case 6:
          frames = _context2.sent;

          expect(frames).toEqual(JSON.parse(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle-default.json')).toString('utf8')));

        case 8:
        case 'end':
          return _context2.stop();
      }
    }
  }, _callee2, _this);
})));
示例#3
0
function fn1() {
  var res;
  return _regeneratorRuntime.wrap(function fn1$(_context2) {
    while (1) {
      switch (_context2.prev = _context2.next) {
        case 0:
          _context2.t0 = invokCall;
          _context2.next = 3;
          return param1();

        case 3:
          _context2.t1 = _context2.sent;
          _context2.next = 6;
          return param2();

        case 6:
          _context2.t2 = _context2.sent;
          res = (0, _context2.t0)(_context2.t1, _context2.t2);

          console.info('res', res);
          return _context2.abrupt('return', res);

        case 10:
        case 'end':
          return _context2.stop();
      }
    }
  }, _marked2, this);
}
示例#4
0
test('default context & unfound source', _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
  var error, frames;
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
    while (1) {
      switch (_context2.prev = _context2.next) {
        case 0:
          expect.assertions(1);
          error = 'Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `B`. See https://fb.me/react-warning-keys for more information.\n    in div (at B.js:8)\n    in unknown (at blabla.js:10)';


          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle_u.mjs')).toString('utf8'));
          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle_u.mjs.map')).toString('utf8'));
          _context2.next = 6;
          return unmap('/static/js/bundle.js', parse(error));

        case 6:
          frames = _context2.sent;

          expect(frames).toMatchSnapshot();

        case 8:
        case 'end':
          return _context2.stop();
      }
    }
  }, _callee2, _this);
})));
示例#5
0
文件: util.js 项目: vinchu/rxdb
    var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
        var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
        return _regeneratorRuntime.wrap(function _callee2$(_context2) {
            while (1) {
                switch (_context2.prev = _context2.next) {
                    case 0:
                        if (!(typeof window === 'object' && window.requestIdleCallback)) {
                            _context2.next = 4;
                            break;
                        }

                        return _context2.abrupt('return', new Promise(function (res) {
                            return window.requestIdleCallback(res, {
                                timeout: timeout
                            });
                        }));

                    case 4:
                        return _context2.abrupt('return', Promise.resolve());

                    case 5:
                    case 'end':
                        return _context2.stop();
                }
            }
        }, _callee2, this);
    }));
示例#6
0
文件: socket.js 项目: vinchu/rxdb
                            _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
                                return _regeneratorRuntime.wrap(function _callee$(_context) {
                                    while (1) {
                                        switch (_context.prev = _context.next) {
                                            case 0:
                                                if (_this._destroyed) {
                                                    _context.next = 8;
                                                    break;
                                                }

                                                _context.next = 3;
                                                return util.promiseWait(PULL_TIME);

                                            case 3:
                                                if (!(_this.messages$.observers.length > 0 && !_this._destroyed)) {
                                                    _context.next = 6;
                                                    break;
                                                }

                                                _context.next = 6;
                                                return _this.pull();

                                            case 6:
                                                _context.next = 0;
                                                break;

                                            case 8:
                                            case 'end':
                                                return _context.stop();
                                        }
                                    }
                                }, _callee, _this);
                            }))();
示例#7
0
        var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
            return _regeneratorRuntime.wrap(function _callee12$(_context12) {
                while (1) {
                    switch (_context12.prev = _context12.next) {
                        case 0:
                            this.destroyed = true;
                            this.subs.map(function (sub) {
                                return sub.unsubscribe();
                            });
                            this.unloads.map(function (fn) {
                                return fn();
                            });
                            _context12.next = 5;
                            return this.die();

                        case 5:
                            this.bc && this.bc.destroy();

                        case 6:
                        case 'end':
                            return _context12.stop();
                    }
                }
            }, _callee12, this);
        }));
示例#8
0
文件: socket.js 项目: vinchu/rxdb
        var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(doc) {
            var _this5 = this;

            var success;
            return _regeneratorRuntime.wrap(function _callee6$(_context6) {
                while (1) {
                    switch (_context6.prev = _context6.next) {
                        case 0:
                            success = true;
                            _context6.prev = 1;
                            _context6.next = 4;
                            return this.database.lockedRun(function () {
                                return _this5.pouch.remove(doc);
                            });

                        case 4:
                            _context6.next = 9;
                            break;

                        case 6:
                            _context6.prev = 6;
                            _context6.t0 = _context6['catch'](1);

                            success = false;

                        case 9:
                            return _context6.abrupt('return', success);

                        case 10:
                        case 'end':
                            return _context6.stop();
                    }
                }
            }, _callee6, this, [[1, 6]]);
        }));
示例#9
0
    value: /*#__PURE__*/_regeneratorRuntime.mark(function value() {
      var i;
      return _regeneratorRuntime.wrap(function value$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              console.info('@@@@@@@@@@@@');
              i = 0;

            case 2:
              if (!(i < this.arr.length)) {
                _context2.next = 8;
                break;
              }

              _context2.next = 5;
              return i;

            case 5:
              i++;
              _context2.next = 2;
              break;

            case 8:
            case 'end':
              return _context2.stop();
          }
        }
      }, value, this);
    })
示例#10
0
文件: json-dump.js 项目: vinchu/rxdb
                            var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(doc) {
                                var primary, emitEvent;
                                return _regeneratorRuntime.wrap(function _callee4$(_context4) {
                                    while (1) {
                                        switch (_context4.prev = _context4.next) {
                                            case 0:
                                                _context4.next = 2;
                                                return _this3._pouchPut(doc);

                                            case 2:
                                                primary = doc[_this3.schema.primaryPath];
                                                // emit changeEvents

                                                emitEvent = RxChangeEvent.create('INSERT', _this3.database, _this3, null, doc);

                                                emitEvent.data.doc = primary;
                                                _this3.$emit(emitEvent);

                                            case 6:
                                            case 'end':
                                                return _context4.stop();
                                        }
                                    }
                                }, _callee4, _this3);
                            }));
        return context$1$0.delegateYield(_regeneratorRuntime.mark(function callee$1$0() {
          var j, ref1, results;
          return _regeneratorRuntime.wrap(function callee$1$0$(context$2$0) {
            while (1) switch (context$2$0.prev = context$2$0.next) {
              case 0:
                results = [];
                part = j = 1, ref1 = numberOfTableNameParts;

              case 2:
                if (!(1 <= ref1 ? j <= ref1 : j >= ref1)) {
                  context$2$0.next = 10;
                  break;
                }

                context$2$0.t0 = results;
                return context$2$0.delegateYield(parser.readUsVarChar(), 't1', 5);

              case 5:
                context$2$0.t2 = context$2$0.t1;
                context$2$0.t0.push.call(context$2$0.t0, context$2$0.t2);

              case 7:
                part = 1 <= ref1 ? ++j : --j;
                context$2$0.next = 2;
                break;

              case 10:
                return context$2$0.abrupt('return', results);

              case 11:
              case 'end':
                return context$2$0.stop();
            }
          }, callee$1$0, this);
        })(), 't1', 14);
示例#12
0
文件: rx-query.js 项目: vinchu/rxdb
        var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
            var _this = this;

            var ret;
            return _regeneratorRuntime.wrap(function _callee$(_context) {
                while (1) {
                    switch (_context.prev = _context.next) {
                        case 0:
                            _context.next = 2;
                            return this._ensureEqualQueue.requestIdlePromise();

                        case 2:
                            _context.next = 4;
                            return this._ensureEqualQueue.wrapCall(function () {
                                return _this.__ensureEqual();
                            });

                        case 4:
                            ret = _context.sent;
                            return _context.abrupt('return', ret);

                        case 6:
                        case 'end':
                            return _context.stop();
                    }
                }
            }, _callee, this);
        }));
示例#13
0
文件: rx-query.js 项目: vinchu/rxdb
                    var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(results) {
                        var hasChanged;
                        return _regeneratorRuntime.wrap(function _callee5$(_context5) {
                            while (1) {
                                switch (_context5.prev = _context5.next) {
                                    case 0:
                                        _context5.next = 2;
                                        return _this2._ensureEqual();

                                    case 2:
                                        hasChanged = _context5.sent;

                                        if (!hasChanged) {
                                            _context5.next = 7;
                                            break;
                                        }

                                        return _context5.abrupt('return', 'WAITFORNEXTEMIT');

                                    case 7:
                                        return _context5.abrupt('return', results);

                                    case 8:
                                    case 'end':
                                        return _context5.stop();
                                }
                            }
                        }, _callee5, _this2);
                    }));
示例#14
0
文件: rx-query.js 项目: vinchu/rxdb
        var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
            var changed;
            return _regeneratorRuntime.wrap(function _callee4$(_context4) {
                while (1) {
                    switch (_context4.prev = _context4.next) {
                        case 0:
                            changed = true;

                            // we run _ensureEqual() until we are in sync with the database-state

                        case 1:
                            if (!changed) {
                                _context4.next = 7;
                                break;
                            }

                            _context4.next = 4;
                            return this._ensureEqual();

                        case 4:
                            changed = _context4.sent;
                            _context4.next = 1;
                            break;

                        case 7:
                            return _context4.abrupt('return', this._results$.getValue());

                        case 8:
                        case 'end':
                            return _context4.stop();
                    }
                }
            }, _callee4, this);
        }));
示例#15
0
文件: rx-query.js 项目: vinchu/rxdb
        var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(newResultData) {
            var docs, newResultDocs;
            return _regeneratorRuntime.wrap(function _callee3$(_context3) {
                while (1) {
                    switch (_context3.prev = _context3.next) {
                        case 0:
                            this._resultsData = newResultData;

                            _context3.next = 3;
                            return this.collection._createDocuments(this._resultsData);

                        case 3:
                            docs = _context3.sent;
                            newResultDocs = docs;

                            if (this.op === 'findOne') {
                                if (docs.length === 0) newResultDocs = null;else newResultDocs = docs[0];
                            }

                            this._results$.next(newResultDocs);

                        case 7:
                        case 'end':
                            return _context3.stop();
                    }
                }
            }, _callee3, this);
        }));
module.exports = _regeneratorRuntime.mark(function callee$0$0(parser, columnsMetaData, options) {
  var column, columnMetaData, columns, i, len, value;
  return _regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
    while (1) switch (context$1$0.prev = context$1$0.next) {
      case 0:
        columns = options.useColumnNames ? {} : [];
        i = 0, len = columnsMetaData.length;

      case 2:
        if (!(i < len)) {
          context$1$0.next = 11;
          break;
        }

        columnMetaData = columnsMetaData[i];
        return context$1$0.delegateYield(valueParse(parser, columnMetaData, options), 't0', 5);

      case 5:
        value = context$1$0.t0;

        column = {
          value: value,
          metadata: columnMetaData
        };
        if (options.useColumnNames) {
          if (columns[columnMetaData.colName] == null) {
            columns[columnMetaData.colName] = column;
          }
        } else {
          columns.push(column);
        }

      case 8:
        i++;
        context$1$0.next = 2;
        break;

      case 11:
        return context$1$0.abrupt('return', {
          name: 'ROW',
          event: 'row',
          columns: columns
        });

      case 12:
      case 'end':
        return context$1$0.stop();
    }
  }, callee$0$0, this);
});
module.exports = _regeneratorRuntime.mark(function callee$0$0(parser) {
  var c, columnCount, i, orderColumns, ref;
  return _regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
    while (1) switch (context$1$0.prev = context$1$0.next) {
      case 0:
        context$1$0.next = 2;
        return parser.readUInt16LE("length");

      case 2:
        context$1$0.t0 = context$1$0.sent;
        columnCount = context$1$0.t0 / 2;

        orderColumns = [];
        c = i = 1, ref = columnCount;

      case 6:
        if (!(1 <= ref ? i <= ref : i >= ref)) {
          context$1$0.next = 15;
          break;
        }

        context$1$0.t1 = orderColumns;
        context$1$0.next = 10;
        return parser.readUInt16LE();

      case 10:
        context$1$0.t2 = context$1$0.sent;
        context$1$0.t1.push.call(context$1$0.t1, context$1$0.t2);

      case 12:
        c = 1 <= ref ? ++i : --i;
        context$1$0.next = 6;
        break;

      case 15:
        return context$1$0.abrupt('return', {
          name: 'ORDER',
          event: 'order',
          orderColumns: orderColumns
        });

      case 16:
      case 'end':
        return context$1$0.stop();
    }
  }, callee$0$0, this);
});
示例#18
0
                            _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
                                return _regeneratorRuntime.wrap(function _callee10$(_context10) {
                                    while (1) {
                                        switch (_context10.prev = _context10.next) {
                                            case 0:
                                                if (!(!_this3.destroyed && !_this3.isLeader)) {
                                                    _context10.next = 16;
                                                    break;
                                                }

                                                _context10.next = 3;
                                                return util.promiseWait(fallbackIntervalTime);

                                            case 3:
                                                _context10.t0 = _this3.electionChannel;
                                                _context10.next = _context10.t0 === 'broadcast' ? 6 : _context10.t0 === 'socket' ? 9 : 12;
                                                break;

                                            case 6:
                                                _context10.next = 8;
                                                return util.requestIdlePromise(fallbackIntervalTime);

                                            case 8:
                                                return _context10.abrupt('break', 12);

                                            case 9:
                                                _context10.next = 11;
                                                return _this3.database.requestIdlePromise(fallbackIntervalTime);

                                            case 11:
                                                return _context10.abrupt('break', 12);

                                            case 12:
                                                _context10.next = 14;
                                                return _this3.applyOnce();

                                            case 14:
                                                _context10.next = 0;
                                                break;

                                            case 16:
                                            case 'end':
                                                return _context10.stop();
                                        }
                                    }
                                }, _callee10, _this3);
                            }))();
示例#19
0
文件: json-dump.js 项目: vinchu/rxdb
    var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
        var _this = this;

        var decrypted = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
        var collections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
        var json, useCollections;
        return _regeneratorRuntime.wrap(function _callee$(_context) {
            while (1) {
                switch (_context.prev = _context.next) {
                    case 0:
                        json = {
                            name: this.name,
                            instanceToken: this.token,
                            encrypted: false,
                            passwordHash: null,
                            collections: []
                        };


                        if (this.password) {
                            json.passwordHash = util.hash(this.password);
                            if (decrypted) json.encrypted = false;else json.encrypted = true;
                        }

                        useCollections = Object.keys(this.collections).filter(function (colName) {
                            return !collections || collections.includes(colName);
                        }).filter(function (colName) {
                            return colName.charAt(0) !== '_';
                        }).map(function (colName) {
                            return _this.collections[colName];
                        });
                        _context.next = 5;
                        return Promise.all(useCollections.map(function (col) {
                            return col.dump(decrypted);
                        }));

                    case 5:
                        json.collections = _context.sent;
                        return _context.abrupt('return', json);

                    case 7:
                    case 'end':
                        return _context.stop();
                }
            }
        }, _callee, this);
    }));
示例#20
0
文件: util.js 项目: vinchu/rxdb
    var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
        var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
        return _regeneratorRuntime.wrap(function _callee$(_context) {
            while (1) {
                switch (_context.prev = _context.next) {
                    case 0:
                        return _context.abrupt('return', new Promise(function (res) {
                            return setTimeout(res, ms);
                        }));

                    case 1:
                    case 'end':
                        return _context.stop();
                }
            }
        }, _callee, this);
    }));
示例#21
0
文件: socket.js 项目: vinchu/rxdb
        var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(changeEvent) {
            var _this2 = this;

            var socketDoc;
            return _regeneratorRuntime.wrap(function _callee3$(_context3) {
                while (1) {
                    switch (_context3.prev = _context3.next) {
                        case 0:
                            socketDoc = changeEvent.toJSON();

                            delete socketDoc.db;

                            // TODO find a way to getAll on local documents
                            //  socketDoc._id = '_local/' + util.fastUnsecureHash(socketDoc);
                            socketDoc._id = '' + util.fastUnsecureHash(socketDoc) + socketDoc.t;
                            _context3.next = 5;
                            return this.database.lockedRun(function () {
                                return _this2.pouch.put(socketDoc);
                            });

                        case 5:
                            _context3.next = 7;
                            return this._updateLastTimestamp();

                        case 7:
                            _context3.t0 = this.bc;

                            if (!_context3.t0) {
                                _context3.next = 11;
                                break;
                            }

                            _context3.next = 11;
                            return this.bc.write('pull');

                        case 11:
                            return _context3.abrupt('return', true);

                        case 12:
                        case 'end':
                            return _context3.stop();
                    }
                }
            }, _callee3, this);
        }));
示例#22
0
文件: socket.js 项目: vinchu/rxdb
        var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
            return _regeneratorRuntime.wrap(function _callee8$(_context8) {
                while (1) {
                    switch (_context8.prev = _context8.next) {
                        case 0:
                            this._destroyed = true;
                            this.subs.map(function (sub) {
                                return sub.unsubscribe();
                            });
                            this.bc && this.bc.destroy();

                        case 3:
                        case 'end':
                            return _context8.stop();
                    }
                }
            }, _callee8, this);
        }));
示例#23
0
文件: socket.js 项目: vinchu/rxdb
        var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
            var _this4 = this;

            var lastTimeDoc, lastTime, result;
            return _regeneratorRuntime.wrap(function _callee5$(_context5) {
                while (1) {
                    switch (_context5.prev = _context5.next) {
                        case 0:
                            _context5.next = 2;
                            return this._getLastTimeDoc();

                        case 2:
                            lastTimeDoc = _context5.sent;
                            lastTime = lastTimeDoc ? lastTimeDoc.time : 0;

                            if (!(this.lastTimestamp >= lastTime)) {
                                _context5.next = 8;
                                break;
                            }

                            return _context5.abrupt('return', []);

                        case 8:
                            this.lastTimestamp = lastTime;
                            _context5.next = 11;
                            return this.database.lockedRun(function () {
                                return _this4.pouch.allDocs({
                                    include_docs: true
                                });
                            });

                        case 11:
                            result = _context5.sent;
                            return _context5.abrupt('return', result.rows.map(function (row) {
                                return row.doc;
                            }));

                        case 13:
                        case 'end':
                            return _context5.stop();
                    }
                }
            }, _callee5, this);
        }));
示例#24
0
文件: json-dump.js 项目: vinchu/rxdb
    var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
        var decrypted = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
        var encrypted, json, query, docs;
        return _regeneratorRuntime.wrap(function _callee3$(_context3) {
            while (1) {
                switch (_context3.prev = _context3.next) {
                    case 0:
                        encrypted = !decrypted;
                        json = {
                            name: this.name,
                            schemaHash: this.schema.hash,
                            encrypted: false,
                            passwordHash: null,
                            docs: []
                        };


                        if (this.database.password && encrypted) {
                            json.passwordHash = util.hash(this.database.password);
                            json.encrypted = true;
                        }

                        query = RxQuery.create('find', {}, this);
                        _context3.next = 6;
                        return this._pouchFind(query, null, encrypted);

                    case 6:
                        docs = _context3.sent;

                        json.docs = docs.map(function (docData) {
                            delete docData._rev;
                            return docData;
                        });
                        return _context3.abrupt('return', json);

                    case 9:
                    case 'end':
                        return _context3.stop();
                }
            }
        }, _callee3, this);
    }));
infoParser = _regeneratorRuntime.mark(function callee$0$0(parser, colMetadata, options) {
  var token;
  return _regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
    while (1) switch (context$1$0.prev = context$1$0.next) {
      case 0:
        return context$1$0.delegateYield(parseToken(parser, options), 't0', 1);

      case 1:
        token = context$1$0.t0;

        token.name = 'INFO';
        token.event = 'infoMessage';
        return context$1$0.abrupt('return', token);

      case 5:
      case 'end':
        return context$1$0.stop();
    }
  }, callee$0$0, this);
});
示例#26
0
文件: json-dump.js 项目: vinchu/rxdb
    var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(dump) {
        var _this2 = this;

        var missingCollections;
        return _regeneratorRuntime.wrap(function _callee2$(_context2) {
            while (1) {
                switch (_context2.prev = _context2.next) {
                    case 0:
                        /**
                         * collections must be created before the import
                         * because we do not know about the other collection-settings here
                         */
                        missingCollections = dump.collections.filter(function (col) {
                            return !_this2.collections[col.name];
                        }).map(function (col) {
                            return col.name;
                        });

                        if (!(missingCollections.length > 0)) {
                            _context2.next = 3;
                            break;
                        }

                        throw RxError.newRxError('JD1', {
                            missingCollections: missingCollections
                        });

                    case 3:
                        return _context2.abrupt('return', Promise.all(dump.collections.map(function (colDump) {
                            return _this2.collections[colDump.name].importDump(colDump);
                        })));

                    case 4:
                    case 'end':
                        return _context2.stop();
                }
            }
        }, _callee2, this);
    }));
示例#27
0
文件: socket.js 项目: vinchu/rxdb
        var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
            var done;
            return _regeneratorRuntime.wrap(function _callee4$(_context4) {
                while (1) {
                    switch (_context4.prev = _context4.next) {
                        case 0:
                            // run until sucess
                            done = false;

                        case 1:
                            if (done) {
                                _context4.next = 12;
                                break;
                            }

                            _context4.prev = 2;
                            _context4.next = 5;
                            return this._updateLastTimestampRun();

                        case 5:
                            done = true;
                            _context4.next = 10;
                            break;

                        case 8:
                            _context4.prev = 8;
                            _context4.t0 = _context4['catch'](2);

                        case 10:
                            _context4.next = 1;
                            break;

                        case 12:
                        case 'end':
                            return _context4.stop();
                    }
                }
            }, _callee4, this, [[2, 8]]);
        }));
示例#28
0
        var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
            var obj, ret;
            return _regeneratorRuntime.wrap(function _callee$(_context) {
                while (1) {
                    switch (_context.prev = _context.next) {
                        case 0:
                            obj = void 0;
                            _context.prev = 1;
                            _context.next = 4;
                            return this.database._adminPouch.get(documentID);

                        case 4:
                            obj = _context.sent;
                            _context.next = 14;
                            break;

                        case 7:
                            _context.prev = 7;
                            _context.t0 = _context['catch'](1);

                            obj = this.createLeaderObject();
                            _context.next = 12;
                            return this.database._adminPouch.put(obj);

                        case 12:
                            ret = _context.sent;

                            obj._rev = ret.rev;

                        case 14:
                            return _context.abrupt('return', obj);

                        case 15:
                        case 'end':
                            return _context.stop();
                    }
                }
            }, _callee, this, [[1, 7]]);
        }));
示例#29
0
function genFn() {
  var obj;
  return _regeneratorRuntime.wrap(function genFn$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          _context.next = 2;
          return timer();

        case 2:
          obj = _context.sent;

          console.info(obj);
          return _context.abrupt('return', obj);

        case 5:
        case 'end':
          return _context.stop();
      }
    }
  }, _marked, this);
}
示例#30
0
test('basic warning', _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
  var error, frames, expected;
  return _regeneratorRuntime.wrap(function _callee$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          expect.assertions(2);
          error = 'Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `B`. See https://fb.me/react-warning-keys for more information.\n    in div (at B.js:8)\n    in B (at A.js:6)\n    in A (at App.js:8)\n    in div (at App.js:10)\n    in App (at index.js:6)';


          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle_u.mjs')).toString('utf8'));
          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle_u.mjs.map')).toString('utf8'));
          _context.next = 6;
          return unmap('/static/js/bundle.js', parse(error), 0);

        case 6:
          frames = _context.sent;
          expected = JSON.parse(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle2.json')).toString('utf8'));

          expect(frames).toEqual(expected);

          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle_u.mjs')).toString('utf8'));
          fetch.mockResponseOnce(fs.readFileSync(resolve(__dirname, '../../fixtures/bundle_u.mjs.map')).toString('utf8'));
          _context.t0 = expect;
          _context.next = 14;
          return unmap('/static/js/bundle.js', expected);

        case 14:
          _context.t1 = _context.sent;
          _context.t2 = expected;
          (0, _context.t0)(_context.t1).toEqual(_context.t2);

        case 17:
        case 'end':
          return _context.stop();
      }
    }
  }, _callee, _this);
})));