Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

marsdb

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marsdb - npm Package Compare versions

Comparing version 0.5.15 to 0.5.16

30

dist/Collection.js

@@ -42,2 +42,6 @@ 'use strict';

var _CursorObservable = require('./CursorObservable');
var _CursorObservable2 = _interopRequireDefault(_CursorObservable);
var _Random = require('./Random');

@@ -61,2 +65,3 @@

var _defaultUpgradeEmitter = new _eventemitter2.default();
var _defaultCursor = _CursorObservable2.default;
var _defaultDelegate = _CollectionDelegate2.default;

@@ -91,2 +96,3 @@ var _defaultStorageManager = _StorageManager2.default;

_this.idGenerator = options.idGenerator || _defaultIdGenerator;
_this.cursorClass = options.cursorClass || _defaultCursor;
_this.indexManager = new indexManagerClass(_this, options);

@@ -330,2 +336,7 @@ _this.storageManager = new storageManagerClass(_this, options);

}
if (!options.cursorClass) {
_defaultUpgradeEmitter.on('cursor', function () {
return _this6.cursorClass = _defaultCursor;
});
}
}

@@ -357,2 +368,21 @@ }, {

}], [{
key: 'defaultCursor',
value: function defaultCursor() {
if (arguments.length > 0) {
_defaultCursor = arguments[0];
_defaultUpgradeEmitter.emit('cursor');
} else {
return _defaultCursor;
}
}
/**
* Wihout arguments it returns current default storage manager.
* If arguments provided, then first argument will be set as default
* storage manager and all collections, who uses default storage manager,
* will be upgraded to a new strage manager.
* @return {undefined|Class}
*/
}, {
key: 'defaultStorageManager',

@@ -359,0 +389,0 @@ value: function defaultStorageManager() {

7

dist/CollectionDelegate.js

@@ -18,6 +18,2 @@ 'use strict';

var _CursorObservable = require('./CursorObservable');
var _CursorObservable2 = _interopRequireDefault(_CursorObservable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -118,3 +114,4 @@

return new _CursorObservable2.default(this.db, query, options);
var cursorClass = this.db.cursorClass;
return new cursorClass(this.db, query, options);
}

@@ -121,0 +118,0 @@ }, {

@@ -9,2 +9,3 @@ import _map from 'fast.js/map';

import CollectionDelegate from './CollectionDelegate';
import CursorObservable from './CursorObservable';
import Random from './Random';

@@ -16,2 +17,3 @@ import EJSON from './EJSON';

const _defaultUpgradeEmitter = new EventEmitter();
let _defaultCursor = CursorObservable;
let _defaultDelegate = CollectionDelegate;

@@ -40,2 +42,3 @@ let _defaultStorageManager = StorageManager;

this.idGenerator = options.idGenerator || _defaultIdGenerator;
this.cursorClass = options.cursorClass || _defaultCursor;
this.indexManager = new indexManagerClass(this, options);

@@ -67,2 +70,18 @@ this.storageManager = new storageManagerClass(this, options);

*/
static defaultCursor() {
if (arguments.length > 0) {
_defaultCursor = arguments[0];
_defaultUpgradeEmitter.emit('cursor');
} else {
return _defaultCursor;
}
}
/**
* Wihout arguments it returns current default storage manager.
* If arguments provided, then first argument will be set as default
* storage manager and all collections, who uses default storage manager,
* will be upgraded to a new strage manager.
* @return {undefined|Class}
*/
static defaultStorageManager() {

@@ -293,2 +312,7 @@ if (arguments.length > 0) {

}
if (!options.cursorClass) {
_defaultUpgradeEmitter.on('cursor', () =>
this.cursorClass = _defaultCursor
);
}
}

@@ -295,0 +319,0 @@ }

import _map from 'fast.js/map';
import DocumentModifier from './DocumentModifier';
import CursorObservable from './CursorObservable';

@@ -69,3 +68,4 @@

find(query, options = {}) {
return new CursorObservable(this.db, query, options);
const cursorClass = this.db.cursorClass;
return new cursorClass(this.db, query, options);
}

@@ -72,0 +72,0 @@

{
"name": "marsdb",
"version": "0.5.15",
"version": "0.5.16",
"author": {

@@ -5,0 +5,0 @@ "name": "Artem Artemev",

@@ -19,3 +19,5 @@ import {Document} from '../../lib/Document';

const _defaultIndexManager = Collection.defaultIndexManager();
const _defaultCursor = Collection.defaultCursor();
beforeEach(function () {
Collection.defaultCursor(_defaultCursor);
Collection.defaultDelegate(_defaultDelegate);

@@ -64,2 +66,17 @@ Collection.defaultStorageManager(_defaultStorageManager);

describe('#defaultCursor', function () {
it('should set default cursor', function () {
class NewCursor {}
Collection.defaultCursor(NewCursor);
Collection.defaultCursor().should.be.equal(NewCursor);
});
it('should upgrade all collections uses defaults', function () {
const defColl = new Collection('test', {upgradeDefaults: true});
defColl.cursorClass.should.be.equal(Collection.defaultCursor());
class NewCursor {}
Collection.defaultCursor(NewCursor);
defColl.cursorClass.should.be.equal(NewCursor);
});
});
describe('#defaultStorageManager', function () {

@@ -66,0 +83,0 @@ it('should set default storage manager', function () {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc