diff --git a/.gitignore b/.gitignore index f6289398..8ea917e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -node_modules +node_modules/ +dist/ .node_modules .idea typings diff --git a/.travis.yml b/.travis.yml index 2dae3001..477aa9f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,11 @@ sudo: required -language: node_js -node_js: - - "6" -services: - - mongodb +addons: + chrome: stable before_install: - curl https://install.meteor.com | /bin/sh - - rm -rf node_modules install: - - git clean -fXd - - npm install -g phantomjs-prebuilt tslint typescript rollup - - npm install - - cd tests && meteor npm rebuild && cd .. + - meteor npm install script: - - npm run test-ci + - meteor npm run test-ci diff --git a/dist/MeteorObservable.d.ts b/dist/MeteorObservable.d.ts index 8830b6f1..2fb47cd4 100644 --- a/dist/MeteorObservable.d.ts +++ b/dist/MeteorObservable.d.ts @@ -1,4 +1,5 @@ import { Observable } from 'rxjs'; +import { Tracker } from 'meteor/tracker'; /** * This is a class with static methods that wrap Meteor's API and return RxJS * Observables. The methods' signatures are the same as Meteor's, with the ] diff --git a/dist/MeteorObservable.js b/dist/MeteorObservable.js index eb82d2e4..b0ac3fa3 100644 --- a/dist/MeteorObservable.js +++ b/dist/MeteorObservable.js @@ -1,8 +1,12 @@ import { Observable } from 'rxjs'; import { isMeteorCallbacks, forkZone, removeObserver } from './utils'; -var liveSubscriptions = []; +import { Meteor } from 'meteor/meteor'; +import { Tracker } from 'meteor/tracker'; +let liveSubscriptions = []; function throwInvalidCallback(method) { - throw new Error("Invalid " + method + " arguments:\n your last param can't be a callback function,\n please remove it and use \".subscribe\" of the Observable!"); + throw new Error(`Invalid ${method} arguments: + your last param can't be a callback function, + please remove it and use ".subscribe" of the Observable!`); } /** * This is a class with static methods that wrap Meteor's API and return RxJS @@ -14,9 +18,7 @@ function throwInvalidCallback(method) { * [Meteor.autorun](https://docs.meteor.com/api/tracker.html#Tracker-autorun) * and [Meteor.subscribe](https://docs.meteor.com/api/pubsub.html#Meteor-subscribe). */ -var MeteorObservable = /** @class */ (function () { - function MeteorObservable() { - } +export class MeteorObservable { /** * Invokes a [Meteor Method](https://docs.meteor.com/api/methods.html) * defined on the server, passing any number of arguments. This method has @@ -47,28 +49,24 @@ var MeteorObservable = /** @class */ (function () { * } * } */ - MeteorObservable.call = function (name) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var lastParam = args[args.length - 1]; + static call(name, ...args) { + const lastParam = args[args.length - 1]; if (isMeteorCallbacks(lastParam)) { throwInvalidCallback('MeteorObservable.call'); } - var zone = forkZone(); - return Observable.create(function (observer) { - Meteor.call.apply(Meteor, [name].concat(args.concat([ - function (error, result) { - zone.run(function () { + let zone = forkZone(); + return Observable.create((observer) => { + Meteor.call(name, ...args.concat([ + (error, result) => { + zone.run(() => { error ? observer.error(error) : observer.next(result); observer.complete(); }); } - ]))); + ])); }); - }; + } /** * When you subscribe to a collection, it tells the server to send records to * the client. This method has the same signature as @@ -125,39 +123,35 @@ var MeteorObservable = /** @class */ (function () { * * @see {@link http://docs.meteor.com/api/pubsub.html|Publications in Meteor documentation} */ - MeteorObservable.subscribe = function (name) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var lastParam = args[args.length - 1]; + static subscribe(name, ...args) { + let lastParam = args[args.length - 1]; if (isMeteorCallbacks(lastParam)) { throwInvalidCallback('MeteorObservable.subscribe'); } - var zone = forkZone(); - var observers = []; - var subscribe = function () { - return Meteor.subscribe.apply(Meteor, [name].concat(args.concat([{ - onError: function (error) { - zone.run(function () { - observers.forEach(function (observer) { return observer.error(error); }); + let zone = forkZone(); + let observers = []; + let subscribe = () => { + return Meteor.subscribe(name, ...args.concat([{ + onError: (error) => { + zone.run(() => { + observers.forEach(observer => observer.error(error)); }); }, - onReady: function () { - zone.run(function () { - observers.forEach(function (observer) { return observer.next(); }); + onReady: () => { + zone.run(() => { + observers.forEach(observer => observer.next()); }); } } - ]))); + ])); }; - var subHandler = null; - return Observable.create(function (observer) { + let subHandler = null; + return Observable.create((observer) => { observers.push(observer); // Execute subscribe lazily. if (subHandler === null) { subHandler = subscribe(); - if (liveSubscriptions.find(function (sub) { return sub === subHandler.subscriptionId; })) { + if (liveSubscriptions.find(sub => sub === subHandler.subscriptionId)) { // subscription already exists, call observer.next() since Meteor won't. observer.next(); } @@ -165,10 +159,10 @@ var MeteorObservable = /** @class */ (function () { liveSubscriptions.push(subHandler.subscriptionId); } } - return function () { - removeObserver(observers, observer, function () { + return () => { + removeObserver(observers, observer, () => { // remove subscription from liveSubscriptions list - var i = liveSubscriptions.findIndex(function (sub) { return sub === subHandler.subscriptionId; }); + let i = liveSubscriptions.findIndex(sub => sub === subHandler.subscriptionId); if (i > -1) { liveSubscriptions.splice(i, 1); } @@ -176,7 +170,7 @@ var MeteorObservable = /** @class */ (function () { }); }; }); - }; + } /** * Allows you to run a function every time there is a change is a reactive * data sources. This method has the same signature as @@ -199,29 +193,27 @@ var MeteorObservable = /** @class */ (function () { * } * } */ - MeteorObservable.autorun = function () { - var zone = forkZone(); - var observers = []; - var autorun = function () { - return Tracker.autorun(function (computation) { - zone.run(function () { - observers.forEach(function (observer) { return observer.next(computation); }); + static autorun() { + let zone = forkZone(); + let observers = []; + let autorun = () => { + return Tracker.autorun((computation) => { + zone.run(() => { + observers.forEach(observer => observer.next(computation)); }); }); }; - var handler = null; - return Observable.create(function (observer) { + let handler = null; + return Observable.create((observer) => { observers.push(observer); // Execute autorun lazily. if (handler === null) { handler = autorun(); } - return function () { - removeObserver(observers, observer, function () { return handler.stop(); }); + return () => { + removeObserver(observers, observer, () => handler.stop()); }; }); - }; - return MeteorObservable; -}()); -export { MeteorObservable }; + } +} //# sourceMappingURL=MeteorObservable.js.map \ No newline at end of file diff --git a/dist/MeteorObservable.js.map b/dist/MeteorObservable.js.map index 0b314bad..283f69a2 100644 --- a/dist/MeteorObservable.js.map +++ b/dist/MeteorObservable.js.map @@ -1 +1 @@ -{"version":3,"file":"Me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C,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBACjC,CAAC;oBAED,UAAU,CAAC,IAAI,EAAE,CAAC;gBAEpB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACI,MAAM,CAAC,OAAO;QACnB,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;QACtB,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,OAAO,GAAG,GAAG,EAAE;YACjB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAgC,EAAE,EAAE;gBAC1D,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;oBACZ,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC5D,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,QAAwD,EAAE,EAAE;YACpF,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzB,0BAA0B;YAC1B,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC;gBACrB,OAAO,GAAG,OAAO,EAAE,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,GAAG,EAAE;gBACV,cAAc,CAAC,SAAS,EACtB,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YACpC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"} \ No newline at end of file diff --git a/dist/ObservableCollection.d.ts b/dist/ObservableCollection.d.ts index eeae053f..ddcd2524 100644 --- a/dist/ObservableCollection.d.ts +++ b/dist/ObservableCollection.d.ts @@ -1,10 +1,6 @@ import { Observable } from 'rxjs'; import { ObservableCursor } from './ObservableCursor'; -import Selector = Mongo.Selector; -import ObjectID = Mongo.ObjectID; -import SortSpecifier = Mongo.SortSpecifier; -import FieldSpecifier = Mongo.FieldSpecifier; -import Modifier = Mongo.Modifier; +import { Mongo } from 'meteor/mongo'; export declare module MongoObservable { interface ConstructorOptions { connection?: Object; @@ -93,16 +89,16 @@ export declare module MongoObservable { /** * Remove documents from the collection. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @returns {Observable} Observable which completes with the number of affected rows * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-remove|remove on Meteor documentation} */ - remove(selector: Selector | ObjectID | string): Observable; + remove(selector: Mongo.Selector | Mongo.ObjectID | string): Observable; /** * Modify one or more documents in the collection. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @param {Modifier} modifier - Specifies how to modify the documents * @param {MongoUpdateOptions} options - Update options * first argument and, if no error, the number of affected documents as the second @@ -110,14 +106,14 @@ export declare module MongoObservable { * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-update|update on Meteor documentation} */ - update(selector: Selector | ObjectID | string, modifier: Modifier, options?: { + update(selector: Mongo.Selector | Mongo.ObjectID | string, modifier: Mongo.Modifier, options?: { multi?: boolean; upsert?: boolean; }): Observable; /** * Finds the first document that matches the selector, as ordered by sort and skip options. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @param {Modifier} modifier - Specifies how to modify the documents * @param {MongoUpsertOptions} options - Upsert options * first argument and, if no error, the number of affected documents as the second. @@ -126,13 +122,13 @@ export declare module MongoObservable { * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-upsert|upsert on Meteor documentation} */ - upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: { + upsert(selector: Mongo.Selector | Mongo.ObjectID | string, modifier: Mongo.Modifier, options?: { multi?: boolean; }): Observable; /** * Method has the same notation as Mongo.Collection.find, only returns Observable. * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. * @returns {ObservableCursor} RxJS Observable wrapped with Meteor features. * @example Using Angular2 Component @@ -148,27 +144,27 @@ export declare module MongoObservable { * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-find|find on Meteor documentation} */ - find(selector?: Selector | ObjectID | string, options?: { - sort?: SortSpecifier; + find(selector?: Mongo.Selector | Mongo.ObjectID | string, options?: { + sort?: Mongo.SortSpecifier; skip?: number; limit?: number; - fields?: FieldSpecifier; + fields?: Mongo.FieldSpecifier; reactive?: boolean; transform?: Function; }): ObservableCursor; /** * Finds the first document that matches the selector, as ordered by sort and skip options. * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. * @returns {any} The first object, or `undefined` in case of non-existing object. * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-findOne|findOne on Meteor documentation} */ - findOne(selector?: Selector | ObjectID | string, options?: { - sort?: SortSpecifier; + findOne(selector?: Mongo.Selector | Mongo.ObjectID | string, options?: { + sort?: Mongo.SortSpecifier; skip?: number; - fields?: FieldSpecifier; + fields?: Mongo.FieldSpecifier; reactive?: boolean; transform?: Function; }): T; diff --git a/dist/ObservableCollection.js b/dist/ObservableCollection.js index 084806c1..2ceecafa 100644 --- a/dist/ObservableCollection.js +++ b/dist/ObservableCollection.js @@ -1,9 +1,9 @@ import { Observable } from 'rxjs'; import { ObservableCursor } from './ObservableCursor'; import { removeObserver } from './utils'; +import { Mongo } from 'meteor/mongo'; export var MongoObservable; (function (MongoObservable) { - 'use strict'; /** * Creates a new MongoObservable.Collection from an existing of predefined Mongo.Collection. * Use this feature to wrap existing collections such as Meteor.users. @@ -23,7 +23,7 @@ export var MongoObservable; * * T is a generic type - should be used with the type of the objects inside the collection. */ - var Collection = /** @class */ (function () { + class Collection { /** * Creates a new Mongo.Collection instance wrapped with Observable features. * @param {String | Mongo.Collection} nameOrExisting - The name of the collection. If null, creates an @@ -32,7 +32,7 @@ export var MongoObservable; * @param {ConstructorOptions} options - Creation options. * @constructor */ - function Collection(nameOrExisting, options) { + constructor(nameOrExisting, options) { if (nameOrExisting instanceof Mongo.Collection) { this._collection = nameOrExisting; } @@ -40,33 +40,29 @@ export var MongoObservable; this._collection = new Mongo.Collection(nameOrExisting, options); } } - Object.defineProperty(Collection.prototype, "collection", { - /** - * Returns the Mongo.Collection object that wrapped with the MongoObservable.Collection. - * @returns {Mongo.Collection} The Collection instance - */ - get: function () { - return this._collection; - }, - enumerable: true, - configurable: true - }); + /** + * Returns the Mongo.Collection object that wrapped with the MongoObservable.Collection. + * @returns {Mongo.Collection} The Collection instance + */ + get collection() { + return this._collection; + } /** * Allow users to write directly to this collection from client code, subject to limitations you define. * * @returns {Boolean} */ - Collection.prototype.allow = function (options) { + allow(options) { return this._collection.allow(options); - }; + } /** * Override allow rules. * * @returns {Boolean} */ - Collection.prototype.deny = function (options) { + deny(options) { return this._collection.deny(options); - }; + } /** * Returns the Collection object corresponding to this collection from the npm * mongodb driver module which is wrapped by Mongo.Collection. @@ -75,9 +71,9 @@ export var MongoObservable; * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-rawCollection|rawCollection on Meteor documentation} */ - Collection.prototype.rawCollection = function () { + rawCollection() { return this._collection.rawCollection(); - }; + } /** * Returns the Db object corresponding to this collection's database connection from the * npm mongodb driver module which is wrapped by Mongo.Collection. @@ -86,9 +82,9 @@ export var MongoObservable; * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-rawDatabase|rawDatabase on Meteor documentation} */ - Collection.prototype.rawDatabase = function () { + rawDatabase() { return this._collection.rawDatabase(); - }; + } /** * Insert a document in the collection. * @@ -98,42 +94,42 @@ export var MongoObservable; * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-insert|insert on Meteor documentation} */ - Collection.prototype.insert = function (doc) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.insert(doc, function (error, docId) { - observers.forEach(function (observer) { + insert(doc) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.insert(doc, (error, docId) => { + observers.forEach(observer => { error ? observer.error(error) : observer.next(docId); observer.complete(); }); }); return obs; - }; + } /** * Remove documents from the collection. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @returns {Observable} Observable which completes with the number of affected rows * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-remove|remove on Meteor documentation} */ - Collection.prototype.remove = function (selector) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.remove(selector, function (error, removed) { - observers.forEach(function (observer) { + remove(selector) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.remove(selector, (error, removed) => { + observers.forEach(observer => { error ? observer.error(error) : observer.next(removed); observer.complete(); }); }); return obs; - }; + } /** * Modify one or more documents in the collection. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @param {Modifier} modifier - Specifies how to modify the documents * @param {MongoUpdateOptions} options - Update options * first argument and, if no error, the number of affected documents as the second @@ -141,22 +137,22 @@ export var MongoObservable; * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-update|update on Meteor documentation} */ - Collection.prototype.update = function (selector, modifier, options) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.update(selector, modifier, options, function (error, updated) { - observers.forEach(function (observer) { + update(selector, modifier, options) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.update(selector, modifier, options, (error, updated) => { + observers.forEach(observer => { error ? observer.error(error) : observer.next(updated); observer.complete(); }); }); return obs; - }; + } /** * Finds the first document that matches the selector, as ordered by sort and skip options. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @param {Modifier} modifier - Specifies how to modify the documents * @param {MongoUpsertOptions} options - Upsert options * first argument and, if no error, the number of affected documents as the second. @@ -165,22 +161,22 @@ export var MongoObservable; * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-upsert|upsert on Meteor documentation} */ - Collection.prototype.upsert = function (selector, modifier, options) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.upsert(selector, modifier, options, function (error, affected) { - observers.forEach(function (observer) { + upsert(selector, modifier, options) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.upsert(selector, modifier, options, (error, affected) => { + observers.forEach(observer => { error ? observer.error(error) : observer.next(affected); observer.complete(); }); }); return obs; - }; + } /** * Method has the same notation as Mongo.Collection.find, only returns Observable. * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. * @returns {ObservableCursor} RxJS Observable wrapped with Meteor features. * @example Using Angular2 Component @@ -196,32 +192,31 @@ export var MongoObservable; * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-find|find on Meteor documentation} */ - Collection.prototype.find = function (selector, options) { - var cursor = this._collection.find.apply(this._collection, arguments); + find(selector, options) { + const cursor = this._collection.find.apply(this._collection, arguments); return ObservableCursor.create(cursor); - }; + } /** * Finds the first document that matches the selector, as ordered by sort and skip options. * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. * @returns {any} The first object, or `undefined` in case of non-existing object. * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-findOne|findOne on Meteor documentation} */ - Collection.prototype.findOne = function (selector, options) { + findOne(selector, options) { return this._collection.findOne.apply(this._collection, arguments); - }; - Collection.prototype._createObservable = function (observers) { - return Observable.create(function (observer) { + } + _createObservable(observers) { + return Observable.create((observer) => { observers.push(observer); - return function () { + return () => { removeObserver(observers, observer); }; }); - }; - return Collection; - }()); + } + } MongoObservable.Collection = Collection; })(MongoObservable || (MongoObservable = {})); /** @@ -235,7 +230,7 @@ export var MongoObservable; */ /** * A MongoDB query selector representation. - * @typedef {(Mongo.Selector|Mongo.ObjectID|string)} Collection~MongoQuerySelector + * @typedef {(Mongo.Mongo.Selector|Mongo.Mongo.ObjectID|string)} Collection~MongoQueryMongo.Selector */ /** * A MongoDB query options for upsert action diff --git a/dist/ObservableCollection.js.map b/dist/ObservableCollection.js.map index f47744be..04998d0b 100644 --- a/dist/ObservableCollection.js.map +++ b/dist/ObservableCollection.js.map @@ -1 +1 @@ -{"version":3,"file":"ObservableCollection.js","sourceRoot":"","sources":["../src/ObservableCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQzC,MAAM,KAAQ,eAAe,CAkR5B;AAlRD,WAAc,eAAe;IAC3B,YAAY,CAAC;IAgBb;;;;;;OAMG;IACH,sBAAgC,UAA+B;QAC7D,MAAM,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;IAFe,4BAAY,eAE3B,CAAA;IAED;;;;;;;OAOG;IACH;QAGE;;;;;;;WAOG;QACH,oBAAY,cAA4C,EAC5C,OAA4B;YACtC,EAAE,CAAC,CAAC,cAAc,YAAY,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;gBAC/C,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC;YACpC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,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,iBAAC;IAAD,CAAC,AA7OD,IA6OC;IA7OY,0BAAU,aA6OtB,CAAA;AACH,CAAC,EAlRa,eAAe,KAAf,eAAe,QAkR5B;AAGD;;;;;;;;GAQG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;GAKG"} \ No newline at end of file +{"version":3,"file":"ObservableCollection.js","sourceRoot":"","sources":["../src/ObservableCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,KAAQ,eAAe,CAiR5B;AAjRD,WAAc,eAAe;IAgB3B;;;;;;OAMG;IACH,sBAAgC,UAA+B;QAC7D,MAAM,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;IAFe,4BAAY,eAE3B,CAAA;IAED;;;;;;;OAOG;IACH;QAGE;;;;;;;WAOG;QACH,YAAY,cAA4C,EAC5C,OAA4B;YACtC,EAAE,CAAC,CAAC,cAAc,YAAY,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;gBAC/C,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC;YACpC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,IAAI,CAAC,WAAW,GAAG,IAAI,KAAK,CAAC,UAAU,CAAY,cAAc,EAAE,OAAO,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;QAED;;;WAGG;QACH,IAAI,UAAU;YACZ,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;QAED;;;;WAIG;QACH,KAAK,CAAC,OAAkC;YACtC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QAED;;;;WAIG;QACH,I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Q,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC1B,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACtB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEL,MAAM,CAAC,GAAG,CAAC;QACb,CAAC;QAED;;;;;;;;;;;;;;;;;;WAkBG;QACH,IAAI,CAAC,QAAmD,EAAE,OAOzD;YACC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CACxC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;YAC/B,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAI,MAAM,CAAC,CAAC;QAC5C,CAAC;QAED;;;;;;;;WAQG;QACH,OAAO,CAAC,QAAmD,EAAE,OAM5D;YACC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CACnC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACjC,CAAC;QAEO,iBAAiB,CAAI,SAA0B;YACrD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,QAAuB,EAAE,EAAE;gBACnD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACzB,MAAM,CAAC,GAAG,EAAE;oBACV,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBACtC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF;IA7OY,0BAAU,aA6OtB,CAAA;AACH,CAAC,EAjRa,eAAe,KAAf,eAAe,QAiR5B;AAGD;;;;;;;;GAQG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;GAKG"} \ No newline at end of file diff --git a/dist/ObservableCursor.d.ts b/dist/ObservableCursor.d.ts index c5909110..ed77c352 100644 --- a/dist/ObservableCursor.d.ts +++ b/dist/ObservableCursor.d.ts @@ -1,4 +1,5 @@ import { Observable } from 'rxjs'; +import { Mongo } from 'meteor/mongo'; export declare class ObservableCursor extends Observable { private _zone; private _data; diff --git a/dist/ObservableCursor.js b/dist/ObservableCursor.js index 8297fab6..772b8f15 100644 --- a/dist/ObservableCursor.js +++ b/dist/ObservableCursor.js @@ -1,49 +1,41 @@ -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); import { Observable, Subject } from 'rxjs'; import { gZone, forkZone, removeObserver } from './utils'; -var ObservableCursor = /** @class */ (function (_super) { - __extends(ObservableCursor, _super); +export class ObservableCursor extends Observable { /** * @constructor * @extends Observable * @param {Mongo.Cursor} cursor - The Mongo.Cursor to wrap. */ - function ObservableCursor(cursor) { - var _this = _super.call(this, function (observer) { - _this._observers.push(observer); - if (!_this._hCursor) { - _this._hCursor = _this._observeCursor(cursor); + constructor(cursor) { + super((observer) => { + this._observers.push(observer); + if (!this._hCursor) { + this._hCursor = this._observeCursor(cursor); } - Meteor.setTimeout(function () { - if (_this._isDataInitinialized) { - observer.next(_this._data); + Meteor.setTimeout(() => { + if (this._isDataInitinialized) { + observer.next(this._data); } else if (cursor.count() === 0) { - _this._isDataInitinialized = true; - observer.next(_this._data); + this._isDataInitinialized = true; + observer.next(this._data); } }, 0); - return function () { - removeObserver(_this._observers, observer, function () { return _this.stop(); }); + return () => { + removeObserver(this._observers, observer, () => this.stop()); }; - }) || this; - _this._data = []; - _this._observers = []; - _this._countObserver = new Subject(); - _this._isDataInitinialized = false; - _.extend(_this, _.omit(cursor, 'count', 'map')); - _this._cursor = cursor; - _this._zone = forkZone(); - return _this; + }); + this._data = []; + this._observers = []; + this._countObserver = new Subject(); + this._isDataInitinialized = false; + for (const key in cursor) { + if (key !== 'count' && key !== 'map') { + this[key] = cursor[key]; + } + } + this._cursor = cursor; + this._zone = forkZone(); } /** * Static method which creates an ObservableCursor from Mongo.Cursor. @@ -54,20 +46,16 @@ var ObservableCursor = /** @class */ (function (_super) { * @static * @returns {ObservableCursor} Wrapped Cursor. */ - ObservableCursor.create = function (cursor) { + static create(cursor) { return new ObservableCursor(cursor); - }; - Object.defineProperty(ObservableCursor.prototype, "cursor", { - /** - * Returns the actual Mongo.Cursor that wrapped by current ObservableCursor instance. - * @return {Mongo.Cursor} The actual MongoDB Cursor. - */ - get: function () { - return this._cursor; - }, - enumerable: true, - configurable: true - }); + } + /** + * Returns the actual Mongo.Cursor that wrapped by current ObservableCursor instance. + * @return {Mongo.Cursor} The actual MongoDB Cursor. + */ + get cursor() { + return this._cursor; + } /** * A wrapper for Mongo.Cursor.count() method - returns an Observable of number, which * triggers each time there is a change in the collection, and exposes the number of @@ -75,102 +63,97 @@ var ObservableCursor = /** @class */ (function (_super) { * @returns {Observable} Observable which trigger the callback when the * count of the object changes. */ - ObservableCursor.prototype.collectionCount = function () { + collectionCount() { return this._countObserver.asObservable(); - }; + } /** * Stops the observation on the cursor. */ - ObservableCursor.prototype.stop = function () { - var _this = this; - this._zone.run(function () { - _this._runComplete(); + stop() { + this._zone.run(() => { + this._runComplete(); }); if (this._hCursor) { this._hCursor.stop(); } this._data = []; this._hCursor = null; - }; + } /** * Clears the Observable definition. * Use this method only when the Observable is still cold, and there are no active subscriptions yet. */ - ObservableCursor.prototype.dispose = function () { + dispose() { this._observers = null; this._cursor = null; - }; + } /** * Return all matching documents as an Array. * * @return {Array} The array with the matching documents. */ - ObservableCursor.prototype.fetch = function () { + fetch() { return this._cursor.fetch(); - }; + } /** * Watch a query. Receive callbacks as the result set changes. * @param {Mongo.ObserveCallbacks} callbacks - The callbacks object. * @return {Meteor.LiveQueryHandle} The array with the matching documents. */ - ObservableCursor.prototype.observe = function (callbacks) { + observe(callbacks) { return this._cursor.observe(callbacks); - }; + } /** * Watch a query. Receive callbacks as the result set changes. * Only the differences between the old and new documents are passed to the callbacks. * @param {Mongo.ObserveChangesCallbacks} callbacks - The callbacks object. * @return {Meteor.LiveQueryHandle} The array with the matching documents. */ - ObservableCursor.prototype.observeChanges = function (callbacks) { + observeChanges(callbacks) { return this._cursor.observeChanges(callbacks); - }; - ObservableCursor.prototype._runComplete = function () { + } + _runComplete() { this._countObserver.complete(); - this._observers.forEach(function (observer) { + this._observers.forEach(observer => { observer.complete(); }); - }; - ObservableCursor.prototype._runNext = function (data) { + } + _runNext(data) { this._countObserver.next(this._data.length); - this._observers.forEach(function (observer) { + this._observers.forEach(observer => { observer.next(data); }); - }; - ObservableCursor.prototype._addedAt = function (doc, at, before) { + } + _addedAt(doc, at, before) { this._data.splice(at, 0, doc); this._handleChange(); - }; - ObservableCursor.prototype._changedAt = function (doc, old, at) { + } + _changedAt(doc, old, at) { this._data[at] = doc; this._handleChange(); - }; - ObservableCursor.prototype._removedAt = function (doc, at) { + } + _removedAt(doc, at) { this._data.splice(at, 1); this._handleChange(); - }; - ObservableCursor.prototype._movedTo = function (doc, fromIndex, toIndex) { + } + _movedTo(doc, fromIndex, toIndex) { this._data.splice(fromIndex, 1); this._data.splice(toIndex, 0, doc); this._handleChange(); - }; - ObservableCursor.prototype._handleChange = function () { - var _this = this; + } + _handleChange() { this._isDataInitinialized = true; - this._zone.run(function () { - _this._runNext(_this._data); + this._zone.run(() => { + this._runNext(this._data); }); - }; - ObservableCursor.prototype._observeCursor = function (cursor) { - var _this = this; - return gZone.run(function () { return cursor.observe({ - addedAt: _this._addedAt.bind(_this), - changedAt: _this._changedAt.bind(_this), - movedTo: _this._movedTo.bind(_this), - removedAt: _this._removedAt.bind(_this) - }); }); - }; - return ObservableCursor; -}(Observable)); -export { ObservableCursor }; + } + _observeCursor(cursor) { + return gZone.run(() => cursor.observe({ + addedAt: this._addedAt.bind(this), + changedAt: this._changedAt.bind(this), + movedTo: this._movedTo.bind(this), + removedAt: this._removedAt.bind(this) + })); + } +} //# sourceMappingURL=ObservableCursor.js.map \ No newline at end of file diff --git a/dist/ObservableCursor.js.map b/dist/ObservableCursor.js.map index 6f168806..40342497 100644 --- a/dist/ObservableCursor.js.map +++ b/dist/ObservableCursor.js.map @@ -1 +1 @@ -{"version":3,"file":"ObservableCursor.js","sourceRoot":"","sources":["../src/ObservableCursor.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAkB,OAAO,EAAE,MAAM,MAAM,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI1D;IAAyC,oCAAe;IAsBtD;;;;OAIG;IACH,0BAAY,MAAuB;QAAnC,YACE,kBAAM,UAAC,QAAyB;YAC9B,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAE/B,EAAE,CAAC,CAAC,CAAC,KAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACnB,KAAI,CAAC,QAAQ,GAAG,KAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC9C,CAAC;YAED,MAAM,CAAC,UAAU,CAAC;gBAChB,EAAE,CAAC,CAAC,KAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;oBAC9B,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;gBAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;oBAChC,KAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;oBACjC,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC,EAAE,CAAC,CAAC,CAAC;YAEN,MAAM,CAAC;gBACL,cAAc,CAAC,KAAI,CAAC,UAAU,EAC5B,QAAQ,EAAE,cAAM,OAAA,KAAI,CAAC,IAAI,EAAE,EAAX,CAAW,CAAC,CAAC;YACjC,CAAC,CAAC;QACJ,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,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEjC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,cAAc,CAAC,MAAuB;QACpC,MAAM,CAAC,KAAK,CAAC,GAAG,CACd,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;YACnB,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;YACrC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;SACtC,CAAC,CAAC,CAAC;IACR,CAAC;CACF"} \ No newline at end of file diff --git a/dist/bundles/index.umd.js b/dist/bundles/index.umd.js index c8d621b8..e43a0dc0 100644 --- a/dist/bundles/index.umd.js +++ b/dist/bundles/index.umd.js @@ -1,757 +1,712 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs')) : - typeof define === 'function' && define.amd ? define(['exports', 'rxjs'], factory) : - (factory((global.meteor = global.meteor || {}, global.meteor.rxjs = {}),global.rxjs)); -}(this, (function (exports,rxjs) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('meteor/mongo'), require('meteor/meteor'), require('meteor/tracker')) : + typeof define === 'function' && define.amd ? define(['exports', 'rxjs', 'meteor/mongo', 'meteor/meteor', 'meteor/tracker'], factory) : + (factory((global.meteor = global.meteor || {}, global.meteor.rxjs = {}),null,global.Package.mongo,global.Package.meteor,global.Package.tracker)); +}(this, (function (exports,rxjs,mongo,meteor,tracker) { 'use strict'; -var subscribeEvents = ['onReady', 'onError', 'onStop']; -function isMeteorCallbacks(callbacks) { - return _.isFunction(callbacks) || isCallbacksObject(callbacks); -} -// Checks if callbacks of {@link CallbacksObject} type. -function isCallbacksObject(callbacks) { - return callbacks && subscribeEvents.some(function (event) { - return _.isFunction(callbacks[event]); - }); -} -var g = typeof global === 'object' ? global : - typeof window === 'object' ? window : - typeof self === 'object' ? self : undefined; -var METEOR_RXJS_ZONE = 'meteor-rxjs-zone'; -var fakeZone = { - name: METEOR_RXJS_ZONE, - run: function (func) { - return func(); - }, - fork: function (spec) { - return fakeZone; - } -}; -function forkZone() { - if (g.Zone) { - var zone = g.Zone.current; - if (zone.name === METEOR_RXJS_ZONE) { - zone = zone.parent || fakeZone; - } - return zone.fork({ name: METEOR_RXJS_ZONE }); + const subscribeEvents = ['onReady', 'onError', 'onStop']; + function isFunction(fn) { + return typeof fn === 'function'; } - return fakeZone; -} -function getZone() { - if (g.Zone) { - var zone = g.Zone.current; - if (zone.name === METEOR_RXJS_ZONE) { - return zone.parent; - } - return zone; + function isMeteorCallbacks(callbacks) { + return isFunction(callbacks) || isCallbacksObject(callbacks); } -} -function removeObserver(observers, observer, onEmpty) { - var index = observers.indexOf(observer); - observers.splice(index, 1); - if (observers.length === 0 && onEmpty) { - onEmpty(); + // Checks if callbacks of {@link CallbacksObject} type. + function isCallbacksObject(callbacks) { + return callbacks && subscribeEvents.some((event) => { + return isFunction(callbacks[event]); + }); } -} -var gZone = g.Zone ? g.Zone.current : fakeZone; - -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + const g = typeof global === 'object' ? global : + typeof window === 'object' ? window : + typeof self === 'object' ? self : undefined; + const METEOR_RXJS_ZONE = 'meteor-rxjs-zone'; + const fakeZone = { + name: METEOR_RXJS_ZONE, + run(func) { + return func(); + }, + fork(spec) { + return fakeZone; + } }; -})(); -var ObservableCursor = /** @class */ (function (_super) { - __extends(ObservableCursor, _super); - /** - * @constructor - * @extends Observable - * @param {Mongo.Cursor} cursor - The Mongo.Cursor to wrap. - */ - function ObservableCursor(cursor) { - var _this = _super.call(this, function (observer) { - _this._observers.push(observer); - if (!_this._hCursor) { - _this._hCursor = _this._observeCursor(cursor); + function forkZone() { + if (g.Zone) { + let zone = g.Zone.current; + if (zone.name === METEOR_RXJS_ZONE) { + zone = zone.parent || fakeZone; + } + return zone.fork({ name: METEOR_RXJS_ZONE }); + } + return fakeZone; + } + function getZone() { + if (g.Zone) { + let zone = g.Zone.current; + if (zone.name === METEOR_RXJS_ZONE) { + return zone.parent; } - Meteor.setTimeout(function () { - if (_this._isDataInitinialized) { - observer.next(_this._data); + return zone; + } + } + function removeObserver(observers, observer, onEmpty) { + let index = observers.indexOf(observer); + observers.splice(index, 1); + if (observers.length === 0 && onEmpty) { + onEmpty(); + } + } + const gZone = g.Zone ? g.Zone.current : fakeZone; + + class ObservableCursor extends rxjs.Observable { + /** + * @constructor + * @extends Observable + * @param {Mongo.Cursor} cursor - The Mongo.Cursor to wrap. + */ + constructor(cursor) { + super((observer) => { + this._observers.push(observer); + if (!this._hCursor) { + this._hCursor = this._observeCursor(cursor); } - else if (cursor.count() === 0) { - _this._isDataInitinialized = true; - observer.next(_this._data); + Meteor.setTimeout(() => { + if (this._isDataInitinialized) { + observer.next(this._data); + } + else if (cursor.count() === 0) { + this._isDataInitinialized = true; + observer.next(this._data); + } + }, 0); + return () => { + removeObserver(this._observers, observer, () => this.stop()); + }; + }); + this._data = []; + this._observers = []; + this._countObserver = new rxjs.Subject(); + this._isDataInitinialized = false; + for (const key in cursor) { + if (key !== 'count' && key !== 'map') { + this[key] = cursor[key]; } - }, 0); - return function () { - removeObserver(_this._observers, observer, function () { return _this.stop(); }); - }; - }) || this; - _this._data = []; - _this._observers = []; - _this._countObserver = new rxjs.Subject(); - _this._isDataInitinialized = false; - _.extend(_this, _.omit(cursor, 'count', 'map')); - _this._cursor = cursor; - _this._zone = forkZone(); - return _this; - } - /** - * Static method which creates an ObservableCursor from Mongo.Cursor. - * Use this to create an ObservableCursor object from an existing Mongo.Cursor. - * Prefer to create an Cursors from the ObservableCollection instance instead. - * - * @param {Mongo.Cursor} cursor - The Mongo.Cursor to wrap. - * @static - * @returns {ObservableCursor} Wrapped Cursor. - */ - ObservableCursor.create = function (cursor) { - return new ObservableCursor(cursor); - }; - Object.defineProperty(ObservableCursor.prototype, "cursor", { + } + this._cursor = cursor; + this._zone = forkZone(); + } + /** + * Static method which creates an ObservableCursor from Mongo.Cursor. + * Use this to create an ObservableCursor object from an existing Mongo.Cursor. + * Prefer to create an Cursors from the ObservableCollection instance instead. + * + * @param {Mongo.Cursor} cursor - The Mongo.Cursor to wrap. + * @static + * @returns {ObservableCursor} Wrapped Cursor. + */ + static create(cursor) { + return new ObservableCursor(cursor); + } /** * Returns the actual Mongo.Cursor that wrapped by current ObservableCursor instance. * @return {Mongo.Cursor} The actual MongoDB Cursor. */ - get: function () { + get cursor() { return this._cursor; - }, - enumerable: true, - configurable: true - }); - /** - * A wrapper for Mongo.Cursor.count() method - returns an Observable of number, which - * triggers each time there is a change in the collection, and exposes the number of - * objects in the collection. - * @returns {Observable} Observable which trigger the callback when the - * count of the object changes. - */ - ObservableCursor.prototype.collectionCount = function () { - return this._countObserver.asObservable(); - }; - /** - * Stops the observation on the cursor. - */ - ObservableCursor.prototype.stop = function () { - var _this = this; - this._zone.run(function () { - _this._runComplete(); - }); - if (this._hCursor) { - this._hCursor.stop(); } - this._data = []; - this._hCursor = null; - }; - /** - * Clears the Observable definition. - * Use this method only when the Observable is still cold, and there are no active subscriptions yet. - */ - ObservableCursor.prototype.dispose = function () { - this._observers = null; - this._cursor = null; - }; - /** - * Return all matching documents as an Array. - * - * @return {Array} The array with the matching documents. - */ - ObservableCursor.prototype.fetch = function () { - return this._cursor.fetch(); - }; - /** - * Watch a query. Receive callbacks as the result set changes. - * @param {Mongo.ObserveCallbacks} callbacks - The callbacks object. - * @return {Meteor.LiveQueryHandle} The array with the matching documents. - */ - ObservableCursor.prototype.observe = function (callbacks) { - return this._cursor.observe(callbacks); - }; - /** - * Watch a query. Receive callbacks as the result set changes. - * Only the differences between the old and new documents are passed to the callbacks. - * @param {Mongo.ObserveChangesCallbacks} callbacks - The callbacks object. - * @return {Meteor.LiveQueryHandle} The array with the matching documents. - */ - ObservableCursor.prototype.observeChanges = function (callbacks) { - return this._cursor.observeChanges(callbacks); - }; - ObservableCursor.prototype._runComplete = function () { - this._countObserver.complete(); - this._observers.forEach(function (observer) { - observer.complete(); - }); - }; - ObservableCursor.prototype._runNext = function (data) { - this._countObserver.next(this._data.length); - this._observers.forEach(function (observer) { - observer.next(data); - }); - }; - ObservableCursor.prototype._addedAt = function (doc, at, before) { - this._data.splice(at, 0, doc); - this._handleChange(); - }; - ObservableCursor.prototype._changedAt = function (doc, old, at) { - this._data[at] = doc; - this._handleChange(); - }; - ObservableCursor.prototype._removedAt = function (doc, at) { - this._data.splice(at, 1); - this._handleChange(); - }; - ObservableCursor.prototype._movedTo = function (doc, fromIndex, toIndex) { - this._data.splice(fromIndex, 1); - this._data.splice(toIndex, 0, doc); - this._handleChange(); - }; - ObservableCursor.prototype._handleChange = function () { - var _this = this; - this._isDataInitinialized = true; - this._zone.run(function () { - _this._runNext(_this._data); - }); - }; - ObservableCursor.prototype._observeCursor = function (cursor) { - var _this = this; - return gZone.run(function () { return cursor.observe({ - addedAt: _this._addedAt.bind(_this), - changedAt: _this._changedAt.bind(_this), - movedTo: _this._movedTo.bind(_this), - removedAt: _this._removedAt.bind(_this) - }); }); - }; - return ObservableCursor; -}(rxjs.Observable)); - -(function (MongoObservable) { - 'use strict'; - /** - * Creates a new MongoObservable.Collection from an existing of predefined Mongo.Collection. - * Use this feature to wrap existing collections such as Meteor.users. - * @param {Mongo.Collection} collection - The collection. - * @returns {MongoObservable.Collection} - Wrapped collection. - * @static - */ - function fromExisting(collection) { - return new MongoObservable.Collection(collection); - } - MongoObservable.fromExisting = fromExisting; - /** - * A class represents a MongoDB collection in the client side, wrapped with RxJS - * Observables, so you can use it with your Angular 2 easier. - * The wrapper has the same API as Mongo.Collection, only the "find" method returns - * an ObservableCursor instead of regular Mongo.Cursor. - * - * T is a generic type - should be used with the type of the objects inside the collection. - */ - var Collection = /** @class */ (function () { /** - * Creates a new Mongo.Collection instance wrapped with Observable features. - * @param {String | Mongo.Collection} nameOrExisting - The name of the collection. If null, creates an - * unmanaged (unsynchronized) local collection. If provided an instance of existing collection, will - * create a wrapper for the existing Mongo.Collection. - * @param {ConstructorOptions} options - Creation options. - * @constructor + * A wrapper for Mongo.Cursor.count() method - returns an Observable of number, which + * triggers each time there is a change in the collection, and exposes the number of + * objects in the collection. + * @returns {Observable} Observable which trigger the callback when the + * count of the object changes. */ - function Collection(nameOrExisting, options) { - if (nameOrExisting instanceof Mongo.Collection) { - this._collection = nameOrExisting; - } - else { - this._collection = new Mongo.Collection(nameOrExisting, options); - } + collectionCount() { + return this._countObserver.asObservable(); } - Object.defineProperty(Collection.prototype, "collection", { - /** - * Returns the Mongo.Collection object that wrapped with the MongoObservable.Collection. - * @returns {Mongo.Collection} The Collection instance - */ - get: function () { - return this._collection; - }, - enumerable: true, - configurable: true - }); /** - * Allow users to write directly to this collection from client code, subject to limitations you define. - * - * @returns {Boolean} + * Stops the observation on the cursor. */ - Collection.prototype.allow = function (options) { - return this._collection.allow(options); - }; + stop() { + this._zone.run(() => { + this._runComplete(); + }); + if (this._hCursor) { + this._hCursor.stop(); + } + this._data = []; + this._hCursor = null; + } /** - * Override allow rules. - * - * @returns {Boolean} + * Clears the Observable definition. + * Use this method only when the Observable is still cold, and there are no active subscriptions yet. */ - Collection.prototype.deny = function (options) { - return this._collection.deny(options); - }; + dispose() { + this._observers = null; + this._cursor = null; + } /** - * Returns the Collection object corresponding to this collection from the npm - * mongodb driver module which is wrapped by Mongo.Collection. + * Return all matching documents as an Array. * - * @returns {Mongo.Collection} The Collection instance - * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-rawCollection|rawCollection on Meteor documentation} + * @return {Array} The array with the matching documents. */ - Collection.prototype.rawCollection = function () { - return this._collection.rawCollection(); - }; + fetch() { + return this._cursor.fetch(); + } /** - * Returns the Db object corresponding to this collection's database connection from the - * npm mongodb driver module which is wrapped by Mongo.Collection. - * - * @returns {Mongo.Db} The Db instance - * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-rawDatabase|rawDatabase on Meteor documentation} + * Watch a query. Receive callbacks as the result set changes. + * @param {Mongo.ObserveCallbacks} callbacks - The callbacks object. + * @return {Meteor.LiveQueryHandle} The array with the matching documents. */ - Collection.prototype.rawDatabase = function () { - return this._collection.rawDatabase(); - }; + observe(callbacks) { + return this._cursor.observe(callbacks); + } /** - * Insert a document in the collection. - * - * @param {T} doc - The document to insert. May not yet have an _id - * attribute, in which case Meteor will generate one for you. - * @returns {Observable} Observable which completes with the inserted ObjectId - * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-insert|insert on Meteor documentation} + * Watch a query. Receive callbacks as the result set changes. + * Only the differences between the old and new documents are passed to the callbacks. + * @param {Mongo.ObserveChangesCallbacks} callbacks - The callbacks object. + * @return {Meteor.LiveQueryHandle} The array with the matching documents. */ - Collection.prototype.insert = function (doc) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.insert(doc, function (error, docId) { - observers.forEach(function (observer) { - error ? observer.error(error) : - observer.next(docId); - observer.complete(); - }); + observeChanges(callbacks) { + return this._cursor.observeChanges(callbacks); + } + _runComplete() { + this._countObserver.complete(); + this._observers.forEach(observer => { + observer.complete(); + }); + } + _runNext(data) { + this._countObserver.next(this._data.length); + this._observers.forEach(observer => { + observer.next(data); + }); + } + _addedAt(doc, at, before) { + this._data.splice(at, 0, doc); + this._handleChange(); + } + _changedAt(doc, old, at) { + this._data[at] = doc; + this._handleChange(); + } + _removedAt(doc, at) { + this._data.splice(at, 1); + this._handleChange(); + } + _movedTo(doc, fromIndex, toIndex) { + this._data.splice(fromIndex, 1); + this._data.splice(toIndex, 0, doc); + this._handleChange(); + } + _handleChange() { + this._isDataInitinialized = true; + this._zone.run(() => { + this._runNext(this._data); }); - return obs; - }; + } + _observeCursor(cursor) { + return gZone.run(() => cursor.observe({ + addedAt: this._addedAt.bind(this), + changedAt: this._changedAt.bind(this), + movedTo: this._movedTo.bind(this), + removedAt: this._removedAt.bind(this) + })); + } + } + + (function (MongoObservable) { /** - * Remove documents from the collection. - * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify - * @returns {Observable} Observable which completes with the number of affected rows - * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-remove|remove on Meteor documentation} + * Creates a new MongoObservable.Collection from an existing of predefined Mongo.Collection. + * Use this feature to wrap existing collections such as Meteor.users. + * @param {Mongo.Collection} collection - The collection. + * @returns {MongoObservable.Collection} - Wrapped collection. + * @static */ - Collection.prototype.remove = function (selector) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.remove(selector, function (error, removed) { - observers.forEach(function (observer) { - error ? observer.error(error) : - observer.next(removed); - observer.complete(); - }); - }); - return obs; - }; + function fromExisting(collection) { + return new MongoObservable.Collection(collection); + } + MongoObservable.fromExisting = fromExisting; /** - * Modify one or more documents in the collection. - * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify - * @param {Modifier} modifier - Specifies how to modify the documents - * @param {MongoUpdateOptions} options - Update options - * first argument and, if no error, the number of affected documents as the second - * @returns {Observable} Observable which completes with the number of affected rows + * A class represents a MongoDB collection in the client side, wrapped with RxJS + * Observables, so you can use it with your Angular 2 easier. + * The wrapper has the same API as Mongo.Collection, only the "find" method returns + * an ObservableCursor instead of regular Mongo.Cursor. * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-update|update on Meteor documentation} + * T is a generic type - should be used with the type of the objects inside the collection. */ - Collection.prototype.update = function (selector, modifier, options) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.update(selector, modifier, options, function (error, updated) { - observers.forEach(function (observer) { - error ? observer.error(error) : - observer.next(updated); - observer.complete(); + class Collection { + /** + * Creates a new Mongo.Collection instance wrapped with Observable features. + * @param {String | Mongo.Collection} nameOrExisting - The name of the collection. If null, creates an + * unmanaged (unsynchronized) local collection. If provided an instance of existing collection, will + * create a wrapper for the existing Mongo.Collection. + * @param {ConstructorOptions} options - Creation options. + * @constructor + */ + constructor(nameOrExisting, options) { + if (nameOrExisting instanceof mongo.Mongo.Collection) { + this._collection = nameOrExisting; + } + else { + this._collection = new mongo.Mongo.Collection(nameOrExisting, options); + } + } + /** + * Returns the Mongo.Collection object that wrapped with the MongoObservable.Collection. + * @returns {Mongo.Collection} The Collection instance + */ + get collection() { + return this._collection; + } + /** + * Allow users to write directly to this collection from client code, subject to limitations you define. + * + * @returns {Boolean} + */ + allow(options) { + return this._collection.allow(options); + } + /** + * Override allow rules. + * + * @returns {Boolean} + */ + deny(options) { + return this._collection.deny(options); + } + /** + * Returns the Collection object corresponding to this collection from the npm + * mongodb driver module which is wrapped by Mongo.Collection. + * + * @returns {Mongo.Collection} The Collection instance + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-rawCollection|rawCollection on Meteor documentation} + */ + rawCollection() { + return this._collection.rawCollection(); + } + /** + * Returns the Db object corresponding to this collection's database connection from the + * npm mongodb driver module which is wrapped by Mongo.Collection. + * + * @returns {Mongo.Db} The Db instance + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-rawDatabase|rawDatabase on Meteor documentation} + */ + rawDatabase() { + return this._collection.rawDatabase(); + } + /** + * Insert a document in the collection. + * + * @param {T} doc - The document to insert. May not yet have an _id + * attribute, in which case Meteor will generate one for you. + * @returns {Observable} Observable which completes with the inserted ObjectId + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-insert|insert on Meteor documentation} + */ + insert(doc) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.insert(doc, (error, docId) => { + observers.forEach(observer => { + error ? observer.error(error) : + observer.next(docId); + observer.complete(); + }); }); - }); - return obs; - }; + return obs; + } + /** + * Remove documents from the collection. + * + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify + * @returns {Observable} Observable which completes with the number of affected rows + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-remove|remove on Meteor documentation} + */ + remove(selector) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.remove(selector, (error, removed) => { + observers.forEach(observer => { + error ? observer.error(error) : + observer.next(removed); + observer.complete(); + }); + }); + return obs; + } + /** + * Modify one or more documents in the collection. + * + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify + * @param {Modifier} modifier - Specifies how to modify the documents + * @param {MongoUpdateOptions} options - Update options + * first argument and, if no error, the number of affected documents as the second + * @returns {Observable} Observable which completes with the number of affected rows + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-update|update on Meteor documentation} + */ + update(selector, modifier, options) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.update(selector, modifier, options, (error, updated) => { + observers.forEach(observer => { + error ? observer.error(error) : + observer.next(updated); + observer.complete(); + }); + }); + return obs; + } + /** + * Finds the first document that matches the selector, as ordered by sort and skip options. + * + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify + * @param {Modifier} modifier - Specifies how to modify the documents + * @param {MongoUpsertOptions} options - Upsert options + * first argument and, if no error, the number of affected documents as the second. + * @returns {Observable<{numberAffected, insertedId}>} Observable which completes with an + * Object that contain the keys numberAffected and insertedId. + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-upsert|upsert on Meteor documentation} + */ + upsert(selector, modifier, options) { + let observers = []; + let obs = this._createObservable(observers); + this._collection.upsert(selector, modifier, options, (error, affected) => { + observers.forEach(observer => { + error ? observer.error(error) : + observer.next(affected); + observer.complete(); + }); + }); + return obs; + } + /** + * Method has the same notation as Mongo.Collection.find, only returns Observable. + * + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find + * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. + * @returns {ObservableCursor} RxJS Observable wrapped with Meteor features. + * @example Using Angular2 Component + * const MyCollection = MongoObservable.Collection("myCollection"); + * + * class MyComponent { + * private myData: ObservableCursor; + * + * constructor() { + * this.myData = MyCollection.find({}, {limit: 10}); + * } + * } + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-find|find on Meteor documentation} + */ + find(selector, options) { + const cursor = this._collection.find.apply(this._collection, arguments); + return ObservableCursor.create(cursor); + } + /** + * Finds the first document that matches the selector, as ordered by sort and skip options. + * + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find + * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. + * @returns {any} The first object, or `undefined` in case of non-existing object. + * + * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-findOne|findOne on Meteor documentation} + */ + findOne(selector, options) { + return this._collection.findOne.apply(this._collection, arguments); + } + _createObservable(observers) { + return rxjs.Observable.create((observer) => { + observers.push(observer); + return () => { + removeObserver(observers, observer); + }; + }); + } + } + MongoObservable.Collection = Collection; + })(exports.MongoObservable || (exports.MongoObservable = {})); + /** + * An options object for MongoDB queries. + * @typedef {Object} Collection~MongoQueryOptions + * @property {Object} sort - Sort order (default: natural order) + * @property {Number} skip - Number of results to skip at the beginning + * @property {Object} fields - Dictionary of fields to return or exclude. + * @property {Boolean} reactive - (Client only) Default true; pass false to disable reactivity + * @property {Function} transform - Overrides transform on the Collection for this cursor. Pass null to disable transformation. + */ + /** + * A MongoDB query selector representation. + * @typedef {(Mongo.Mongo.Selector|Mongo.Mongo.ObjectID|string)} Collection~MongoQueryMongo.Selector + */ + /** + * A MongoDB query options for upsert action + * @typedef {Object} Collection~MongoUpsertOptions + * @property {Boolean} multi - True to modify all matching documents; + * false to only modify one of the matching documents (the default). + */ + /** + * A MongoDB query options for update action + * @typedef {Object} Collection~MongoUpdateOptions + * @property {Boolean} multi - True to modify all matching documents; + * @property {Boolean} upsert - True to use upsert logic. + */ + + let liveSubscriptions = []; + function throwInvalidCallback(method) { + throw new Error(`Invalid ${method} arguments: + your last param can't be a callback function, + please remove it and use ".subscribe" of the Observable!`); + } + /** + * This is a class with static methods that wrap Meteor's API and return RxJS + * Observables. The methods' signatures are the same as Meteor's, with the ] + * exception that the callbacks are handled by Meteor-rxjs. Instead of + * providing callbacks, you need to subscribe to the observables that are + * returned. The methods that are wrapped in MeteorObservable are + * [Meteor.call](https://docs.meteor.com/api/methods.html#Meteor-call), + * [Meteor.autorun](https://docs.meteor.com/api/tracker.html#Tracker-autorun) + * and [Meteor.subscribe](https://docs.meteor.com/api/pubsub.html#Meteor-subscribe). + */ + class MeteorObservable { /** - * Finds the first document that matches the selector, as ordered by sort and skip options. + * Invokes a [Meteor Method](https://docs.meteor.com/api/methods.html) + * defined on the server, passing any number of arguments. This method has + * the same signature as + * [Meteor.call](https://docs.meteor.com/api/methods.html#Meteor-call), only + * without the callbacks: + * MeteorObservable.call(name, [...args]) + * + * + * @param {string} name - Name of the method in the Meteor server + * @param {any} args - Parameters that will be forwarded to the method. + * after the func call to initiate change detection. + * @returns {Observable} - RxJS Observable, which completes when the + * server returns a response. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify - * @param {Modifier} modifier - Specifies how to modify the documents - * @param {MongoUpsertOptions} options - Upsert options - * first argument and, if no error, the number of affected documents as the second. - * @returns {Observable<{numberAffected, insertedId}>} Observable which completes with an - * Object that contain the keys numberAffected and insertedId. + * @example Example using Angular2 Component + * class MyComponent { + * constructor() { * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-upsert|upsert on Meteor documentation} + * } + * + * doAction(payload) { + * MeteorObservable.call("myData", payload).subscribe((response) => { + * // Handle success and response from server! + * }, (err) => { + * // Handle error + * }); + * } + * } */ - Collection.prototype.upsert = function (selector, modifier, options) { - var observers = []; - var obs = this._createObservable(observers); - this._collection.upsert(selector, modifier, options, function (error, affected) { - observers.forEach(function (observer) { - error ? observer.error(error) : - observer.next(affected); - observer.complete(); - }); + static call(name, ...args) { + const lastParam = args[args.length - 1]; + if (isMeteorCallbacks(lastParam)) { + throwInvalidCallback('MeteorObservable.call'); + } + let zone = forkZone(); + return rxjs.Observable.create((observer) => { + meteor.Meteor.call(name, ...args.concat([ + (error, result) => { + zone.run(() => { + error ? observer.error(error) : + observer.next(result); + observer.complete(); + }); + } + ])); }); - return obs; - }; + } /** - * Method has the same notation as Mongo.Collection.find, only returns Observable. + * When you subscribe to a collection, it tells the server to send records to + * the client. This method has the same signature as + * [Meteor.subscribe](https://docs.meteor.com/api/pubsub.html#Meteor-subscribe), + * except without the callbacks again: + * subscribe(name, [...args]) * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find - * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. - * @returns {ObservableCursor} RxJS Observable wrapped with Meteor features. - * @example Using Angular2 Component - * const MyCollection = MongoObservable.Collection("myCollection"); + * You can use this method from any Angular2 element - such as Component, + * Pipe or Service. * - * class MyComponent { - * private myData: ObservableCursor; + * @param {string} name - Name of the publication in the Meteor server + * @param {any} args - Parameters that will be forwarded to the publication. + * after the func call to initiate change detection. + * @returns {Observable} - RxJS Observable, which completes when the + * subscription is ready. + * + * @example Example using Angular2 Service + * class MyService { + * private meteorSubscription: Observable; * * constructor() { - * this.myData = MyCollection.find({}, {limit: 10}); + * + * } + * + * subscribeToData() { + * this.meteorSubscription = MeteorObservable.subscribe("myData").subscribe(() => { + * // Subscription is ready! + * }); + * } + * + * unsubscribeToData() { + * this.meteorSubscription.unsubscribe(); * } * } * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-find|find on Meteor documentation} - */ - Collection.prototype.find = function (selector, options) { - var cursor = this._collection.find.apply(this._collection, arguments); - return ObservableCursor.create(cursor); - }; - /** - * Finds the first document that matches the selector, as ordered by sort and skip options. + * @example Example using Angular2 Component + * class MyComponent implements OnInit, OnDestroy { + * private meteorSubscription: Observable; + * + * constructor() { + * + * } + * + * ngOnInit() { + * this.meteorSubscription = MeteorObservable.subscribe("myData").subscribe(() => { + * // Subscription is ready! + * }); + * } * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find - * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. - * @returns {any} The first object, or `undefined` in case of non-existing object. + * ngOnDestroy() { + * this.meteorSubscription.unsubscribe(); + * } + * } * - * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-findOne|findOne on Meteor documentation} + * @see {@link http://docs.meteor.com/api/pubsub.html|Publications in Meteor documentation} */ - Collection.prototype.findOne = function (selector, options) { - return this._collection.findOne.apply(this._collection, arguments); - }; - Collection.prototype._createObservable = function (observers) { - return rxjs.Observable.create(function (observer) { + static subscribe(name, ...args) { + let lastParam = args[args.length - 1]; + if (isMeteorCallbacks(lastParam)) { + throwInvalidCallback('MeteorObservable.subscribe'); + } + let zone = forkZone(); + let observers = []; + let subscribe = () => { + return meteor.Meteor.subscribe(name, ...args.concat([{ + onError: (error) => { + zone.run(() => { + observers.forEach(observer => observer.error(error)); + }); + }, + onReady: () => { + zone.run(() => { + observers.forEach(observer => observer.next()); + }); + } + } + ])); + }; + let subHandler = null; + return rxjs.Observable.create((observer) => { observers.push(observer); - return function () { - removeObserver(observers, observer); + // Execute subscribe lazily. + if (subHandler === null) { + subHandler = subscribe(); + if (liveSubscriptions.find(sub => sub === subHandler.subscriptionId)) { + // subscription already exists, call observer.next() since Meteor won't. + observer.next(); + } + else { + liveSubscriptions.push(subHandler.subscriptionId); + } + } + return () => { + removeObserver(observers, observer, () => { + // remove subscription from liveSubscriptions list + let i = liveSubscriptions.findIndex(sub => sub === subHandler.subscriptionId); + if (i > -1) { + liveSubscriptions.splice(i, 1); + } + subHandler.stop(); + }); }; }); - }; - return Collection; - }()); - MongoObservable.Collection = Collection; -})(exports.MongoObservable || (exports.MongoObservable = {})); -/** - * An options object for MongoDB queries. - * @typedef {Object} Collection~MongoQueryOptions - * @property {Object} sort - Sort order (default: natural order) - * @property {Number} skip - Number of results to skip at the beginning - * @property {Object} fields - Dictionary of fields to return or exclude. - * @property {Boolean} reactive - (Client only) Default true; pass false to disable reactivity - * @property {Function} transform - Overrides transform on the Collection for this cursor. Pass null to disable transformation. - */ -/** - * A MongoDB query selector representation. - * @typedef {(Mongo.Selector|Mongo.ObjectID|string)} Collection~MongoQuerySelector - */ -/** - * A MongoDB query options for upsert action - * @typedef {Object} Collection~MongoUpsertOptions - * @property {Boolean} multi - True to modify all matching documents; - * false to only modify one of the matching documents (the default). - */ -/** - * A MongoDB query options for update action - * @typedef {Object} Collection~MongoUpdateOptions - * @property {Boolean} multi - True to modify all matching documents; - * @property {Boolean} upsert - True to use upsert logic. - */ - -var liveSubscriptions = []; -function throwInvalidCallback(method) { - throw new Error("Invalid " + method + " arguments:\n your last param can't be a callback function,\n please remove it and use \".subscribe\" of the Observable!"); -} -/** - * This is a class with static methods that wrap Meteor's API and return RxJS - * Observables. The methods' signatures are the same as Meteor's, with the ] - * exception that the callbacks are handled by Meteor-rxjs. Instead of - * providing callbacks, you need to subscribe to the observables that are - * returned. The methods that are wrapped in MeteorObservable are - * [Meteor.call](https://docs.meteor.com/api/methods.html#Meteor-call), - * [Meteor.autorun](https://docs.meteor.com/api/tracker.html#Tracker-autorun) - * and [Meteor.subscribe](https://docs.meteor.com/api/pubsub.html#Meteor-subscribe). - */ -var MeteorObservable = /** @class */ (function () { - function MeteorObservable() { - } - /** - * Invokes a [Meteor Method](https://docs.meteor.com/api/methods.html) - * defined on the server, passing any number of arguments. This method has - * the same signature as - * [Meteor.call](https://docs.meteor.com/api/methods.html#Meteor-call), only - * without the callbacks: - * MeteorObservable.call(name, [...args]) - * - * - * @param {string} name - Name of the method in the Meteor server - * @param {any} args - Parameters that will be forwarded to the method. - * after the func call to initiate change detection. - * @returns {Observable} - RxJS Observable, which completes when the - * server returns a response. - * - * @example Example using Angular2 Component - * class MyComponent { - * constructor() { - * - * } - * - * doAction(payload) { - * MeteorObservable.call("myData", payload).subscribe((response) => { - * // Handle success and response from server! - * }, (err) => { - * // Handle error - * }); - * } - * } - */ - MeteorObservable.call = function (name) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var lastParam = args[args.length - 1]; - if (isMeteorCallbacks(lastParam)) { - throwInvalidCallback('MeteorObservable.call'); - } - var zone = forkZone(); - return rxjs.Observable.create(function (observer) { - Meteor.call.apply(Meteor, [name].concat(args.concat([ - function (error, result) { - zone.run(function () { - error ? observer.error(error) : - observer.next(result); - observer.complete(); + } + /** + * Allows you to run a function every time there is a change is a reactive + * data sources. This method has the same signature as + * [Meteor.autorun](https://docs.meteor.com/api/tracker.html#Tracker-autorun), + * only without the callback: + * MeteorObservable.autorun() + * + * @returns {Observable} - RxJS Observable, which trigger the subscription callback + * each time that Meteor Tracker detects a change. + * @example Example using Angular2 Component + * class MyComponent { + * constructor() { + * + * } + * + * doAction(payload) { + * MeteorObservable.autorun().subscribe(() => { + * // Handle Tracker autorun change + * }); + * } + * } + */ + static autorun() { + let zone = forkZone(); + let observers = []; + let autorun = () => { + return tracker.Tracker.autorun((computation) => { + zone.run(() => { + observers.forEach(observer => observer.next(computation)); }); - } - ]))); - }); - }; - /** - * When you subscribe to a collection, it tells the server to send records to - * the client. This method has the same signature as - * [Meteor.subscribe](https://docs.meteor.com/api/pubsub.html#Meteor-subscribe), - * except without the callbacks again: - * subscribe(name, [...args]) - * - * You can use this method from any Angular2 element - such as Component, - * Pipe or Service. - * - * @param {string} name - Name of the publication in the Meteor server - * @param {any} args - Parameters that will be forwarded to the publication. - * after the func call to initiate change detection. - * @returns {Observable} - RxJS Observable, which completes when the - * subscription is ready. - * - * @example Example using Angular2 Service - * class MyService { - * private meteorSubscription: Observable; - * - * constructor() { - * - * } - * - * subscribeToData() { - * this.meteorSubscription = MeteorObservable.subscribe("myData").subscribe(() => { - * // Subscription is ready! - * }); - * } - * - * unsubscribeToData() { - * this.meteorSubscription.unsubscribe(); - * } - * } - * - * @example Example using Angular2 Component - * class MyComponent implements OnInit, OnDestroy { - * private meteorSubscription: Observable; - * - * constructor() { - * - * } - * - * ngOnInit() { - * this.meteorSubscription = MeteorObservable.subscribe("myData").subscribe(() => { - * // Subscription is ready! - * }); - * } - * - * ngOnDestroy() { - * this.meteorSubscription.unsubscribe(); - * } - * } - * - * @see {@link http://docs.meteor.com/api/pubsub.html|Publications in Meteor documentation} - */ - MeteorObservable.subscribe = function (name) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var lastParam = args[args.length - 1]; - if (isMeteorCallbacks(lastParam)) { - throwInvalidCallback('MeteorObservable.subscribe'); - } - var zone = forkZone(); - var observers = []; - var subscribe = function () { - return Meteor.subscribe.apply(Meteor, [name].concat(args.concat([{ - onError: function (error) { - zone.run(function () { - observers.forEach(function (observer) { return observer.error(error); }); - }); - }, - onReady: function () { - zone.run(function () { - observers.forEach(function (observer) { return observer.next(); }); - }); - } - } - ]))); - }; - var subHandler = null; - return rxjs.Observable.create(function (observer) { - observers.push(observer); - // Execute subscribe lazily. - if (subHandler === null) { - subHandler = subscribe(); - if (liveSubscriptions.find(function (sub) { return sub === subHandler.subscriptionId; })) { - // subscription already exists, call observer.next() since Meteor won't. - observer.next(); - } - else { - liveSubscriptions.push(subHandler.subscriptionId); - } - } - return function () { - removeObserver(observers, observer, function () { - // remove subscription from liveSubscriptions list - var i = liveSubscriptions.findIndex(function (sub) { return sub === subHandler.subscriptionId; }); - if (i > -1) { - liveSubscriptions.splice(i, 1); - } - subHandler.stop(); }); }; - }); - }; - /** - * Allows you to run a function every time there is a change is a reactive - * data sources. This method has the same signature as - * [Meteor.autorun](https://docs.meteor.com/api/tracker.html#Tracker-autorun), - * only without the callback: - * MeteorObservable.autorun() - * - * @returns {Observable} - RxJS Observable, which trigger the subscription callback - * each time that Meteor Tracker detects a change. - * @example Example using Angular2 Component - * class MyComponent { - * constructor() { - * - * } - * - * doAction(payload) { - * MeteorObservable.autorun().subscribe(() => { - * // Handle Tracker autorun change - * }); - * } - * } - */ - MeteorObservable.autorun = function () { - var zone = forkZone(); - var observers = []; - var autorun = function () { - return Tracker.autorun(function (computation) { - zone.run(function () { - observers.forEach(function (observer) { return observer.next(computation); }); - }); + let handler = null; + return rxjs.Observable.create((observer) => { + observers.push(observer); + // Execute autorun lazily. + if (handler === null) { + handler = autorun(); + } + return () => { + removeObserver(observers, observer, () => handler.stop()); + }; }); - }; - var handler = null; - return rxjs.Observable.create(function (observer) { - observers.push(observer); - // Execute autorun lazily. - if (handler === null) { - handler = autorun(); - } - return function () { - removeObserver(observers, observer, function () { return handler.stop(); }); - }; - }); - }; - return MeteorObservable; -}()); + } + } -var __extends$1 = (undefined && undefined.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var zoneOperator = function (zone) { return function (source) { return source.lift(new ZoneOperator(zone || getZone())); }; }; -var ZoneOperator = /** @class */ (function () { - function ZoneOperator(zone) { - this.zone = zone; + const zoneOperator = (zone) => (source) => source.lift(new ZoneOperator(zone || getZone())); + class ZoneOperator { + constructor(zone) { + this.zone = zone; + } + call(subscriber, source) { + return source._subscribe(new ZoneSubscriber(subscriber, this.zone)); + } } - ZoneOperator.prototype.call = function (subscriber, source) { - return source._subscribe(new ZoneSubscriber(subscriber, this.zone)); - }; - return ZoneOperator; -}()); -var ZoneSubscriber = /** @class */ (function (_super) { - __extends$1(ZoneSubscriber, _super); - function ZoneSubscriber(destination, zone) { - var _this = _super.call(this, destination) || this; - _this.zone = zone; - return _this; + class ZoneSubscriber extends rxjs.Subscriber { + constructor(destination, zone) { + super(destination); + this.zone = zone; + } + _next(value) { + this.zone.run(() => { + this.destination.next(value); + }); + } + _complete() { + this.zone.run(() => { + this.destination.complete(); + }); + } + _error(err) { + this.zone.run(() => { + this.destination.error(err); + }); + } } - ZoneSubscriber.prototype._next = function (value) { - var _this = this; - this.zone.run(function () { - _this.destination.next(value); - }); - }; - ZoneSubscriber.prototype._complete = function () { - var _this = this; - this.zone.run(function () { - _this.destination.complete(); - }); - }; - ZoneSubscriber.prototype._error = function (err) { - var _this = this; - this.zone.run(function () { - _this.destination.error(err); - }); - }; - return ZoneSubscriber; -}(rxjs.Subscriber)); -exports.MeteorObservable = MeteorObservable; -exports.ObservableCursor = ObservableCursor; -exports.zoneOperator = zoneOperator; + exports.MeteorObservable = MeteorObservable; + exports.ObservableCursor = ObservableCursor; + exports.zoneOperator = zoneOperator; -Object.defineProperty(exports, '__esModule', { value: true }); + Object.defineProperty(exports, '__esModule', { value: true }); }))); diff --git a/dist/utils.d.ts b/dist/utils.d.ts index 56922e09..1857c735 100644 --- a/dist/utils.d.ts +++ b/dist/utils.d.ts @@ -6,6 +6,7 @@ export declare type CallbacksObject = { }; export declare type MeteorCallbacks = ((...args) => any) | CallbacksObject; export declare const subscribeEvents: string[]; +export declare function isFunction(fn: any): boolean; export declare function isMeteorCallbacks(callbacks: any): boolean; export declare function isCallbacksObject(callbacks: any): boolean; export declare const g: any; diff --git a/dist/utils.js b/dist/utils.js index a22e494c..41a2eb9c 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,29 +1,32 @@ -export var subscribeEvents = ['onReady', 'onError', 'onStop']; +export const subscribeEvents = ['onReady', 'onError', 'onStop']; +export function isFunction(fn) { + return typeof fn === 'function'; +} export function isMeteorCallbacks(callbacks) { - return _.isFunction(callbacks) || isCallbacksObject(callbacks); + return isFunction(callbacks) || isCallbacksObject(callbacks); } // Checks if callbacks of {@link CallbacksObject} type. export function isCallbacksObject(callbacks) { - return callbacks && subscribeEvents.some(function (event) { - return _.isFunction(callbacks[event]); + return callbacks && subscribeEvents.some((event) => { + return isFunction(callbacks[event]); }); } -export var g = typeof global === 'object' ? global : +export const g = typeof global === 'object' ? global : typeof window === 'object' ? window : typeof self === 'object' ? self : undefined; -var METEOR_RXJS_ZONE = 'meteor-rxjs-zone'; -var fakeZone = { +const METEOR_RXJS_ZONE = 'meteor-rxjs-zone'; +const fakeZone = { name: METEOR_RXJS_ZONE, - run: function (func) { + run(func) { return func(); }, - fork: function (spec) { + fork(spec) { return fakeZone; } }; export function forkZone() { if (g.Zone) { - var zone = g.Zone.current; + let zone = g.Zone.current; if (zone.name === METEOR_RXJS_ZONE) { zone = zone.parent || fakeZone; } @@ -33,7 +36,7 @@ export function forkZone() { } export function getZone() { if (g.Zone) { - var zone = g.Zone.current; + let zone = g.Zone.current; if (zone.name === METEOR_RXJS_ZONE) { return zone.parent; } @@ -41,11 +44,11 @@ export function getZone() { } } export function removeObserver(observers, observer, onEmpty) { - var index = observers.indexOf(observer); + let index = observers.indexOf(observer); observers.splice(index, 1); if (observers.length === 0 && onEmpty) { onEmpty(); } } -export var gZone = g.Zone ? g.Zone.current : fakeZone; +export const gZone = g.Zone ? g.Zone.current : fakeZone; //# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/dist/utils.js.map b/dist/utils.js.map index e25a0954..2cfa88c9 100644 --- a/dist/utils.js.map +++ b/dist/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,IAAM,eAAe,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAEhE,MAAM,4BAA4B,SAAc;IAC9C,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CA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ACD,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,yBAAyB,SAA4B,EAC5B,QAAyB,EACzB,OAAkB;IAC/C,IAAI,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC3B,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC"} \ No newline at end of file diff --git a/dist/zone.js b/dist/zone.js index 691bd3cb..ae449978 100644 --- a/dist/zone.js +++ b/dist/zone.js @@ -1,50 +1,33 @@ -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); import { Subscriber } from 'rxjs'; import { getZone } from './utils'; -export var zoneOperator = function (zone) { return function (source) { return source.lift(new ZoneOperator(zone || getZone())); }; }; -var ZoneOperator = /** @class */ (function () { - function ZoneOperator(zone) { +export const zoneOperator = (zone) => (source) => source.lift(new ZoneOperator(zone || getZone())); +class ZoneOperator { + constructor(zone) { this.zone = zone; } - ZoneOperator.prototype.call = function (subscriber, source) { + call(subscriber, source) { return source._subscribe(new ZoneSubscriber(subscriber, this.zone)); - }; - return ZoneOperator; -}()); -var ZoneSubscriber = /** @class */ (function (_super) { - __extends(ZoneSubscriber, _super); - function ZoneSubscriber(destination, zone) { - var _this = _super.call(this, destination) || this; - _this.zone = zone; - return _this; } - ZoneSubscriber.prototype._next = function (value) { - var _this = this; - this.zone.run(function () { - _this.destination.next(value); +} +class ZoneSubscriber extends Subscriber { + constructor(destination, zone) { + super(destination); + this.zone = zone; + } + _next(value) { + this.zone.run(() => { + this.destination.next(value); }); - }; - ZoneSubscriber.prototype._complete = function () { - var _this = this; - this.zone.run(function () { - _this.destination.complete(); + } + _complete() { + this.zone.run(() => { + this.destination.complete(); }); - }; - ZoneSubscriber.prototype._error = function (err) { - var _this = this; - this.zone.run(function () { - _this.destination.error(err); + } + _error(err) { + this.zone.run(() => { + this.destination.error(err); }); - }; - return ZoneSubscriber; -}(Subscriber)); + } +} //# sourceMappingURL=zone.js.map \ No newline at end of file diff --git a/dist/zone.js.map b/dist/zone.js.map index 82494d1b..a596a444 100644 --- a/dist/zone.js.map +++ b/dist/zone.js.map @@ -1 +1 @@ -{"version":3,"file":"zone.js","sourceRoot":"","sources":["../src/zone.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAA4B,UAAU,EAAE,MAAM,MAAM,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,IAAM,YAAY,GAAG,UAAI,IAAW,IAAK,OAAA,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC,EAAhD,CAAgD,EAA3E,CAA2E,CAAC;AAG5H;IACE,sBAAoB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAC9B,CAAC;IAED,2BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtE,CAAC;IACH,mBAAC;AAAD,CAAC,AAPD,IAOC;AAED;IAAgC,kCAAa;IA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AAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtE,CAAC;CACF;AAED,oBAAwB,SAAQ,UAAa;IAC3C,YAAY,WAA0B,EAClB,IAAU;QAC5B,KAAK,CAAC,WAAW,CAAC,CAAC;QADD,SAAI,GAAJ,IAAI,CAAM;IAE9B,CAAC;IAES,KAAK,CAAC,KAAQ;QACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAES,SAAS;QACjB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAES,MAAM,CAAC,GAAS;QACxB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;CACF"} \ No newline at end of file diff --git a/docs/ObservableCollection.md b/docs/ObservableCollection.md index 80bfcda7..b1f19550 100644 --- a/docs/ObservableCollection.md +++ b/docs/ObservableCollection.md @@ -26,7 +26,6 @@ T is a generic type - should be used with the type of the objects inside the col * [.findOne(selector, options)](#Collection+findOne) ⇒ any * _inner_ * [~MongoQueryOptions](#Collection..MongoQueryOptions) : Object - * [~MongoQuerySelector](#Collection..MongoQuerySelector) : Mongo.Selector \| Mongo.ObjectID \| string * [~MongoUpsertOptions](#Collection..MongoUpsertOptions) : Object * [~MongoUpdateOptions](#Collection..MongoUpdateOptions) : Object @@ -102,7 +101,7 @@ Remove documents from the collection. | Param | Type | Description | | --- | --- | --- | -| selector | [MongoQuerySelector](#Collection..MongoQuerySelector) | Specifies which documents to modify | +| selector | [Selector](#Collection..MongoQueryMongo.Selector) | Specifies which documents to modify | @@ -115,7 +114,7 @@ Modify one or more documents in the collection. | Param | Type | Description | | --- | --- | --- | -| selector | [MongoQuerySelector](#Collection..MongoQuerySelector) | Specifies which documents to modify | +| selector | [Selector](#Collection..MongoQueryMongo.Selector) | Specifies which documents to modify | | modifier | Modifier | Specifies how to modify the documents | | options | MongoUpdateOptions | Update options first argument and, if no error, the number of affected documents as the second | @@ -131,7 +130,7 @@ Finds the first document that matches the selector, as ordered by sort and skip | Param | Type | Description | | --- | --- | --- | -| selector | [MongoQuerySelector](#Collection..MongoQuerySelector) | Specifies which documents to modify | +| selector | [Selector](#Collection..MongoQueryMongo.Selector) | Specifies which documents to modify | | modifier | Modifier | Specifies how to modify the documents | | options | MongoUpsertOptions | Upsert options first argument and, if no error, the number of affected documents as the second. | @@ -146,7 +145,7 @@ Method has the same notation as Mongo.Collection.find, only returns Observable. | Param | Type | Description | | --- | --- | --- | -| selector | [MongoQuerySelector](#Collection..MongoQuerySelector) | A query describing the documents to find | +| selector | [Selector](#Collection..MongoQueryMongo.Selector) | A query describing the documents to find | | options | [MongoQueryOptions](#Collection..MongoQueryOptions) | Query options, such as sort, limit, etc. | **Example** *(Using Angular2 Component)* @@ -172,7 +171,7 @@ Finds the first document that matches the selector, as ordered by sort and skip | Param | Type | Description | | --- | --- | --- | -| selector | [MongoQuerySelector](#Collection..MongoQuerySelector) | A query describing the documents to find | +| selector | [Selector](#Collection..MongoQueryMongo.Selector) | A query describing the documents to find | | options | [MongoQueryOptions](#Collection..MongoQueryOptions) | Query options, such as sort, limit, etc. | @@ -191,12 +190,6 @@ An options object for MongoDB queries. | reactive | Boolean | (Client only) Default true; pass false to disable reactivity | | transform | function | Overrides transform on the Collection for this cursor. Pass null to disable transformation. | - - -### Collection~MongoQuerySelector : Mongo.Selector \| Mongo.ObjectID \| string -A MongoDB query selector representation. - -**Kind**: inner typedef of [Collection](#Collection) ### Collection~MongoUpsertOptions : Object diff --git a/package.json b/package.json index 6a0ec4de..99ea5854 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meteor-rxjs", - "version": "0.4.11", + "version": "0.4.13", "description": "Use Meteor API in RxJS style", "keywords": [ "rxjs", @@ -16,21 +16,21 @@ "scripts": { "changelog": "$(npm bin)/conventional-changelog -p meteor-rxjs -i CHANGELOG.md -s -r 0", "docs": "./generate-docs.sh", - "prebuild": "npm run lint", - "build": "npm run build-only && npm run bundle && npm run docs", - "prepublish": "npm run build", + "prebuild": "meteor npm run lint", + "build": "meteor npm run build-only && meteor npm run bundle && meteor npm run docs", + "prepublish": "meteor npm run build", "build-only": "tsc || echo not ok", - "pretest": "cd tests && rm -rf node_modules && npm install", - "test-ci": "npm run pretest && cd tests && meteor test --once --driver-package dispatch:mocha-phantomjs", - "test": "cd tests && meteor test --driver-package practicalmeteor:mocha", + "pretest": "rm -rf node_modules && cd tests && npm install", + "test-ci": "meteor npm run pretest && cd tests && TEST_BROWSER_DRIVER=chrome meteor test --once --driver-package ardatan:mocha", + "test": "cd tests && TEST_BROWSER_DRIVER=chrome meteor test --driver-package ardatan:mocha", "lint": "tslint src/**/*.ts", "bundle": "rollup -i ./dist/index.js -o ./dist/bundles/index.umd.js -n meteor.rxjs -c rollup.config.js" }, "repository": { "type": "git", - "url": "git+https://github.com/Urigo/mongo-rxjs-observable.git" + "url": "git+https://github.com/Urigo/meteor-rxjs.git" }, - "author": "Angular2-Meteor (https://github.com/Urigo/angular2-meteor)", + "author": "Angular-Meteor (https://github.com/Urigo/angular-meteor)", "license": "MIT", "bugs": { "url": "https://github.com/Urigo/mongo-rxjs-observable/issues" @@ -38,19 +38,15 @@ "homepage": "http://www.angular-meteor.com", "peerDependencies": { "@types/meteor": "^1.4.6", - "rxjs": "^5.4.3 || ^6.0.0" + "rxjs": "^6.0.0" }, "devDependencies": { - "@types/chai": "4.0.4", "@types/meteor": "1.4.14", - "@types/mocha": "2.2.43", - "@types/underscore": "1.8.3", "conventional-changelog": "1.1.0", "conventional-changelog-cli": "1.2.0", "jsdoc-to-markdown": "3.0.0", - "rollup": "0.49.3", + "rollup": "0.59.4", "rxjs": "6.0.0", - "rxjs-compat": "6.0.0", "tslint": "5.7.0", "typescript": "2.7.2", "zone.js": "0.8.20" @@ -60,4 +56,4 @@ "rxjs" ] } -} +} \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index 9d288432..a7f675e2 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,7 +2,10 @@ export default { output: { format: 'umd' }, + external: ['rxjs'], globals: { - 'rxjs': 'rxjs' + 'meteor/meteor': 'Package.meteor', + 'meteor/mongo': 'Package.mongo', + 'meteor/tracker': 'Package.tracker' } }; diff --git a/src/MeteorObservable.ts b/src/MeteorObservable.ts index 2c480ccc..a9996660 100644 --- a/src/MeteorObservable.ts +++ b/src/MeteorObservable.ts @@ -2,6 +2,9 @@ import { Observable , Subscriber } from 'rxjs'; import { isMeteorCallbacks, forkZone, removeObserver } from './utils'; +import { Meteor } from 'meteor/meteor'; +import { Tracker } from 'meteor/tracker'; + let liveSubscriptions = []; function throwInvalidCallback(method: string) { diff --git a/src/ObservableCollection.ts b/src/ObservableCollection.ts index f209a645..f26579c5 100644 --- a/src/ObservableCollection.ts +++ b/src/ObservableCollection.ts @@ -3,14 +3,10 @@ import { Observable , Subscriber } from 'rxjs'; import { ObservableCursor } from './ObservableCursor'; import { removeObserver } from './utils'; -import Selector = Mongo.Selector; -import ObjectID = Mongo.ObjectID; -import SortSpecifier = Mongo.SortSpecifier; -import FieldSpecifier = Mongo.FieldSpecifier; -import Modifier = Mongo.Modifier; +import { Meteor } from 'meteor/meteor'; +import { Mongo } from 'meteor/mongo'; export module MongoObservable { - 'use strict'; export interface ConstructorOptions { connection?: Object; @@ -142,12 +138,12 @@ export module MongoObservable { /** * Remove documents from the collection. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @returns {Observable} Observable which completes with the number of affected rows * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-remove|remove on Meteor documentation} */ - remove(selector: Selector | ObjectID | string): Observable { + remove(selector: Mongo.Selector | Mongo.ObjectID | string): Observable { let observers: Subscriber[] = []; let obs = this._createObservable(observers); @@ -166,7 +162,7 @@ export module MongoObservable { /** * Modify one or more documents in the collection. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @param {Modifier} modifier - Specifies how to modify the documents * @param {MongoUpdateOptions} options - Update options * first argument and, if no error, the number of affected documents as the second @@ -174,8 +170,8 @@ export module MongoObservable { * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-update|update on Meteor documentation} */ - update(selector: Selector | ObjectID | string, - modifier: Modifier, + update(selector: Mongo.Selector | Mongo.ObjectID | string, + modifier: Mongo.Modifier, options?: { multi?: boolean; upsert?: boolean; }): Observable { let observers: Subscriber[] = []; let obs = this._createObservable(observers); @@ -195,7 +191,7 @@ export module MongoObservable { /** * Finds the first document that matches the selector, as ordered by sort and skip options. * - * @param {Collection~MongoQuerySelector} selector - Specifies which documents to modify + * @param {Collection~MongoQueryMongo.Selector} selector - Specifies which documents to modify * @param {Modifier} modifier - Specifies how to modify the documents * @param {MongoUpsertOptions} options - Upsert options * first argument and, if no error, the number of affected documents as the second. @@ -204,8 +200,8 @@ export module MongoObservable { * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-upsert|upsert on Meteor documentation} */ - upsert(selector: Selector | ObjectID | string, - modifier: Modifier, + upsert(selector: Mongo.Selector | Mongo.ObjectID | string, + modifier: Mongo.Modifier, options?: { multi?: boolean; }): Observable { let observers: Subscriber[] = []; let obs = this._createObservable(observers); @@ -225,7 +221,7 @@ export module MongoObservable { /** * Method has the same notation as Mongo.Collection.find, only returns Observable. * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. * @returns {ObservableCursor} RxJS Observable wrapped with Meteor features. * @example Using Angular2 Component @@ -241,11 +237,11 @@ export module MongoObservable { * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-find|find on Meteor documentation} */ - find(selector?: Selector | ObjectID | string, options?: { - sort?: SortSpecifier; + find(selector?: Mongo.Selector | Mongo.ObjectID | string, options?: { + sort?: Mongo.SortSpecifier; skip?: number; limit?: number; - fields?: FieldSpecifier; + fields?: Mongo.FieldSpecifier; reactive?: boolean; transform?: Function; }): ObservableCursor { @@ -257,16 +253,16 @@ export module MongoObservable { /** * Finds the first document that matches the selector, as ordered by sort and skip options. * - * @param {Collection~MongoQuerySelector} selector - A query describing the documents to find + * @param {Collection~MongoQueryMongo.Selector} selector - A query describing the documents to find * @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc. * @returns {any} The first object, or `undefined` in case of non-existing object. * * @see {@link https://docs.meteor.com/api/collections.html#Mongo-Collection-findOne|findOne on Meteor documentation} */ - findOne(selector?: Selector | ObjectID | string, options?: { - sort?: SortSpecifier; + findOne(selector?: Mongo.Selector | Mongo.ObjectID | string, options?: { + sort?: Mongo.SortSpecifier; skip?: number; - fields?: FieldSpecifier; + fields?: Mongo.FieldSpecifier; reactive?: boolean; transform?: Function; }): T { @@ -298,7 +294,7 @@ export module MongoObservable { /** * A MongoDB query selector representation. - * @typedef {(Mongo.Selector|Mongo.ObjectID|string)} Collection~MongoQuerySelector + * @typedef {(Mongo.Mongo.Selector|Mongo.Mongo.ObjectID|string)} Collection~MongoQueryMongo.Selector */ /** diff --git a/src/ObservableCursor.ts b/src/ObservableCursor.ts index e47518bd..1bb56d9e 100644 --- a/src/ObservableCursor.ts +++ b/src/ObservableCursor.ts @@ -1,8 +1,9 @@ -import { Observable , Subscriber , Subject } from 'rxjs'; +import { Observable, Subscriber, Subject } from 'rxjs'; import { gZone, forkZone, removeObserver } from './utils'; -declare let _; +import { Tracker } from 'meteor/tracker'; +import { Mongo } from 'meteor/mongo'; export class ObservableCursor extends Observable { private _zone: Zone; @@ -54,7 +55,11 @@ export class ObservableCursor extends Observable { }; }); - _.extend(this, _.omit(cursor, 'count', 'map')); + for (const key in cursor) { + if (key !== 'count' && key !== 'map') { + this[key] = cursor[key]; + } + } this._cursor = cursor; this._zone = forkZone(); diff --git a/src/utils.ts b/src/utils.ts index 0595284f..648887ce 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,5 @@ import { Subscriber } from 'rxjs'; -declare let _; - export declare type CallbacksObject = { onReady?: Function; onError?: Function; @@ -12,14 +10,18 @@ export declare type MeteorCallbacks = ((...args) => any) | CallbacksObject; export const subscribeEvents = ['onReady', 'onError', 'onStop']; +export function isFunction(fn) { + return typeof fn === 'function'; +} + export function isMeteorCallbacks(callbacks: any): boolean { - return _.isFunction(callbacks) || isCallbacksObject(callbacks); + return isFunction(callbacks) || isCallbacksObject(callbacks); } // Checks if callbacks of {@link CallbacksObject} type. export function isCallbacksObject(callbacks: any): boolean { return callbacks && subscribeEvents.some((event) => { - return _.isFunction(callbacks[event]); + return isFunction(callbacks[event]); }); } diff --git a/tests/.meteor/packages b/tests/.meteor/packages index 80a34879..92c0eed7 100644 --- a/tests/.meteor/packages +++ b/tests/.meteor/packages @@ -4,25 +4,17 @@ # 'meteor add' and 'meteor remove' will edit this file for you, # but you can also edit it by hand. -meteor-base@1.1.0 # Packages every Meteor app needs to have -mobile-experience@1.0.4 # Packages for a great mobile UX -mongo@1.2.0 # The database Meteor supports right now +meteor-base@1.3.0 # Packages every Meteor app needs to have +mobile-experience@1.0.5 # Packages for a great mobile UX +mongo@1.4.2 # The database Meteor supports right now reactive-var@1.0.11 # Reactive variable for tracker -jquery@1.11.10 # Helpful client-side library tracker@1.1.3 # Meteor's client-side reactive programming library -standard-minifier-css@1.3.4 # CSS minifier run for production mode -standard-minifier-js@2.1.1 # JS minifier run for production mode -es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers. -ecmascript@0.8.2 # Enable ECMAScript2015+ syntax in app code +standard-minifier-css@1.4.0 # CSS minifier run for production mode +standard-minifier-js@2.3.1 # JS minifier run for production mode +es5-shim@4.7.0 # ECMAScript 5 compatibility for older browsers. +ecmascript # Enable ECMAScript2015+ syntax in app code insecure@1.0.7 # Allow all DB writes from clients (for prototyping) -angular2-compilers -practicalmeteor:sinon -practicalmeteor:chai -dispatch:mocha-phantomjs -dburles:factory +barbatus:typescript xolvio:cleaner -shell-server@0.2.4 -practicalmeteor:mocha -dynamic-import diff --git a/tests/.meteor/release b/tests/.meteor/release index 47c31abc..011385b2 100644 --- a/tests/.meteor/release +++ b/tests/.meteor/release @@ -1 +1 @@ -METEOR@1.5.2 +METEOR@1.6.1.1 diff --git a/tests/.meteor/versions b/tests/.meteor/versions index 706fbaf4..d7d2b8f6 100644 --- a/tests/.meteor/versions +++ b/tests/.meteor/versions @@ -1,93 +1,64 @@ -allow-deny@1.0.6 -angular2-compilers@0.6.6 -autoupdate@1.3.12 -babel-compiler@6.20.0 -babel-runtime@1.0.1 -barbatus:caching-compiler@1.1.9 -barbatus:css-compiler@0.4.1 -barbatus:scss-compiler@3.8.3 +allow-deny@1.1.0 +ardatan:mocha@1.0.3 +autoupdate@1.4.0 +babel-compiler@7.0.9 +babel-runtime@1.2.0 barbatus:typescript@0.6.11 barbatus:typescript-compiler@0.9.11 barbatus:typescript-runtime@1.0.2 base64@1.0.10 binary-heap@1.0.10 -blaze@2.3.2 -blaze-tools@1.0.10 -boilerplate-generator@1.2.0 -caching-compiler@1.1.9 -caching-html-compiler@1.1.2 -callback-hook@1.0.10 -check@1.2.5 -coffeescript@1.12.7_1 -coffeescript-compiler@1.12.7_1 -dburles:factory@1.1.0 -ddp@1.3.0 -ddp-client@2.1.0 -ddp-common@1.2.9 -ddp-server@2.0.0 -deps@1.0.12 -diff-sequence@1.0.7 -dispatch:mocha-phantomjs@0.1.9 -dispatch:phantomjs-tests@0.0.7 -dynamic-import@0.1.1 -ecmascript@0.8.2 -ecmascript-runtime@0.4.1 -ecmascript-runtime-client@0.4.3 -ecmascript-runtime-server@0.4.1 -ejson@1.0.14 -es5-shim@4.6.15 -fastclick@1.0.13 +boilerplate-generator@1.4.0 +callback-hook@1.1.0 +check@1.3.0 +ddp@1.4.0 +ddp-client@2.3.1 +ddp-common@1.4.0 +ddp-server@2.1.2 +diff-sequence@1.1.0 +dynamic-import@0.3.0 +ecmascript@0.10.6 +ecmascript-runtime@0.5.0 +ecmascript-runtime-client@0.6.0 +ecmascript-runtime-server@0.5.0 +ejson@1.1.0 +es5-shim@4.7.0 geojson-utils@1.0.10 hot-code-push@1.0.4 -html-tools@1.0.11 -htmljs@1.0.11 -http@1.2.12 -id-map@1.0.9 +http@1.4.0 +id-map@1.1.0 insecure@1.0.7 -jquery@1.11.10 launch-screen@1.1.1 livedata@1.0.18 -logging@1.1.17 -meteor@1.7.1 -meteor-base@1.1.0 -minifier-css@1.2.16 -minifier-js@2.1.3 -minimongo@1.3.0 -mobile-experience@1.0.4 +logging@1.1.19 +meteor@1.8.2 +meteor-base@1.3.0 +minifier-css@1.3.0 +minifier-js@2.3.1 +minimongo@1.4.3 +mobile-experience@1.0.5 mobile-status-bar@1.0.14 -modules@0.10.0 -modules-runtime@0.8.0 -mongo@1.2.0 -mongo-dev-server@1.0.1 +modules@0.11.3 +modules-runtime@0.9.1 +mongo@1.4.2 +mongo-dev-server@1.1.0 mongo-id@1.0.6 -npm-mongo@2.2.30 -observe-sequence@1.0.16 -ordered-dict@1.0.9 -practicalmeteor:chai@2.1.0_1 -practicalmeteor:loglevel@1.2.0_2 -practicalmeteor:mocha@2.4.5_6 -practicalmeteor:mocha-core@1.0.1 -practicalmeteor:sinon@1.14.1_2 -promise@0.9.0 -random@1.0.10 +npm-mongo@2.2.33 +ordered-dict@1.1.0 +promise@0.10.1 +random@1.1.0 reactive-var@1.0.11 -reload@1.1.11 -retry@1.0.9 +reload@1.2.0 +retry@1.1.0 routepolicy@1.0.12 -shell-server@0.2.4 -spacebars@1.0.15 -spacebars-compiler@1.1.3 -standard-minifier-css@1.3.4 -standard-minifier-js@2.1.1 -templating@1.3.2 -templating-compiler@1.3.2 -templating-runtime@1.3.2 -templating-tools@1.1.2 -tmeasday:test-reporter-helpers@0.2.1 +server-render@0.3.1 +shim-common@0.1.0 +socket-stream-client@0.1.0 +standard-minifier-css@1.4.0 +standard-minifier-js@2.3.1 tracker@1.1.3 underscore@1.0.10 -urigo:static-html-compiler@0.1.8 -url@1.1.0 -webapp@1.3.18 +url@1.2.0 +webapp@1.5.0 webapp-hashing@1.0.9 xolvio:cleaner@0.3.1 diff --git a/tests/client/unit/meteor-observable.spec.ts b/tests/client/unit/meteor-observable.spec.ts index d1d2a3e2..22144e80 100644 --- a/tests/client/unit/meteor-observable.spec.ts +++ b/tests/client/unit/meteor-observable.spec.ts @@ -1,7 +1,8 @@ -import {chai} from 'meteor/practicalmeteor:chai'; -import {sinon} from 'meteor/practicalmeteor:sinon'; -import {MeteorObservable} from 'meteor-rxjs'; -import {Observable} from 'rxjs'; +import * as chai from 'chai'; +import * as sinon from 'sinon'; +import { Meteor } from 'meteor/meteor'; +import { MeteorObservable } from 'meteor-rxjs'; +import { Observable, isObservable } from 'rxjs'; const expect = chai.expect; @@ -9,7 +10,7 @@ describe('MeteorObservable', () => { describe('call', () => { it('Should return RxJS Observable when using "call"', () => { let returnValue = MeteorObservable.call('testMethod'); - expect(returnValue instanceof Observable).to.equal(true); + expect(isObservable(returnValue)).to.equal(true); }); it('Should NOT run the actual "call" method without subscribing to the result', () => { @@ -39,13 +40,13 @@ describe('MeteorObservable', () => { it('Should trigger the RxJS Observable "error" callback when got the server error', (done) => { let subscriptionHandler = MeteorObservable.call('NON_EXISTING_METHOD').subscribe(null, - (e) => { + (e) => { expect(e instanceof Meteor.Error).to.equal(true); subscriptionHandler.unsubscribe(); done(); }); }); - }); + }); describe('subscribe', () => { function getSubsCount() { @@ -54,7 +55,7 @@ describe('MeteorObservable', () => { it('Should return RxJS Observable when using "subscribe"', () => { let returnValue = MeteorObservable.subscribe('test'); - expect(returnValue instanceof Observable).to.equal(true); + expect(isObservable(returnValue)).to.equal(true); }); it('Should NOT run the actual "subscribe" method without subscribing to the result', () => { @@ -93,7 +94,7 @@ describe('MeteorObservable', () => { done => { let baseCount = getSubsCount(); let observable = MeteorObservable.subscribe('test'); - let subHandler1 = observable.subscribe(() => {}); + let subHandler1 = observable.subscribe(() => { }); let subHandler2 = observable.subscribe(() => { expect(getSubsCount()).to.equal(baseCount + 1); subHandler1.unsubscribe(); diff --git a/tests/client/unit/observable-collection.spec.ts b/tests/client/unit/observable-collection.spec.ts index 106aaf4e..6d4a2466 100644 --- a/tests/client/unit/observable-collection.spec.ts +++ b/tests/client/unit/observable-collection.spec.ts @@ -1,7 +1,7 @@ -import {chai} from 'meteor/practicalmeteor:chai'; -import {sinon} from 'meteor/practicalmeteor:sinon'; -import {MongoObservable, ObservableCursor} from 'meteor-rxjs'; -import {Observable} from 'rxjs'; +import * as chai from 'chai'; +import * as sinon from 'sinon'; +import { MongoObservable, ObservableCursor } from 'meteor-rxjs'; +import { Observable, isObservable } from 'rxjs'; const expect = chai.expect; @@ -11,7 +11,7 @@ describe('MongoObservable methods bridge', () => { it('Should return RxJS Observable object when using "find"', () => { let findResult = observable.find({}); - expect(findResult instanceof Observable).to.equal(true); + expect(isObservable(findResult)).to.equal(true); }); it('Should wrap existing collection', () => { diff --git a/tests/client/unit/observable-cursor.spec.ts b/tests/client/unit/observable-cursor.spec.ts index d9e21825..babbcb14 100644 --- a/tests/client/unit/observable-cursor.spec.ts +++ b/tests/client/unit/observable-cursor.spec.ts @@ -1,10 +1,7 @@ -import {chai} from 'meteor/practicalmeteor:chai'; -import {sinon} from 'meteor/practicalmeteor:sinon'; -import {Observable} from 'rxjs'; -import {ObservableCursor, MongoObservable} from 'meteor-rxjs'; - - - +import * as chai from 'chai'; +import * as sinon from 'sinon'; +import { Observable, isObservable } from 'rxjs'; +import { ObservableCursor, MongoObservable } from 'meteor-rxjs'; const expect = chai.expect; @@ -32,7 +29,7 @@ describe('ObservableCursor', function () { }); it('Should wrap the Mongo.Cursor and return RxJS Observable', () => { - expect(observable instanceof Observable).to.equal(true); + expect(isObservable(observable)).to.equal(true); }); it('Should not use the actual Cursor "observeChanges" method w/o Observable subscription', () => { @@ -69,7 +66,7 @@ describe('ObservableCursor', function () { }); it('Should trigger subscription callback when adding data to the collection', () => { - let newDoc = {name: 'newDoc'}; + let newDoc = { name: 'newDoc' }; let subHandler; let callback = docs => { let inserted = docs[0]; @@ -83,10 +80,10 @@ describe('ObservableCursor', function () { }); it('Should trigger subscription callback when moving items in the collection', (done) => { - cursor = collection.find({}, {sort: {name: 1}}); + cursor = collection.find({}, { sort: { name: 1 } }); observable = ObservableCursor.create(cursor); - let newDoc = {name: 'ZZZZ'}; + let newDoc = { name: 'ZZZZ' }; let subHandler; let count = 0; @@ -111,7 +108,7 @@ describe('ObservableCursor', function () { name: 'BBBB' }); - collection.update({_id: objectId}, { $set: {name: 'AAAA'} }); + collection.update({ _id: objectId }, { $set: { name: 'AAAA' } }); }); it('Should trigger callback twice when inserting a doc and then removing it', () => { @@ -119,14 +116,14 @@ describe('ObservableCursor', function () { let subHandler; let callback = docs => { count++; - if (count == 2) { + if (count === 2) { expect(docs.length).to.equal(0); subHandler.unsubscribe(); } }; let spy = sinon.spy(callback); - let subHandler = observable.subscribe(spy); - let idToRemove = collection.insert({test: true}); + subHandler = observable.subscribe(spy); + let idToRemove = collection.insert({ test: true }); collection.remove(idToRemove); expect(spy.calledTwice).to.be.true; }); @@ -135,11 +132,11 @@ describe('ObservableCursor', function () { let count = 0; let callback = docs => { count++; - if (count == 1) { + if (count === 1) { expect(docs[0].test).to.equal(true); } - if (count == 2) { + if (count === 2) { expect(docs[0].test).to.equal(false); subHandler.unsubscribe(); done(); @@ -148,14 +145,14 @@ describe('ObservableCursor', function () { let spy = sinon.spy(callback); let subHandler = observable.subscribe(spy); - let idToUpdate = collection.insert({test: true}); - collection.update({_id: idToUpdate}, {$set: {test: false}}); + let idToUpdate = collection.insert({ test: true }); + collection.update({ _id: idToUpdate }, { $set: { test: false } }); expect(spy.calledTwice).to.be.true; }); it('Should stop Mongo cursor when the last subscription unsubscribes', () => { let stopSpy = sinon.spy(); - let spy = sinon.stub(cursor, 'observeChanges', () => { + let spy = sinon.stub(cursor, 'observeChanges').callsFake(() => { return { stop: stopSpy } @@ -168,13 +165,8 @@ describe('ObservableCursor', function () { spy.restore(); }); - it('RxJS operators should persist', () => { - expect(observable.count).to.equal(Observable.prototype.count); - expect(observable.map).to.equal(Observable.prototype.map); - }); - it('Should trigger collectionCount when adding item', () => { - let newDoc = {name: 'newDoc'}; + let newDoc = { name: 'newDoc' }; let subHandler, subCountHandler; let callback = count => { expect(count).to.equal(1); @@ -188,15 +180,14 @@ describe('ObservableCursor', function () { }); it('Should trigger collectionCount when adding and removing items', (done) => { - let newDoc = {name: 'newDoc'}; + let newDoc = { name: 'newDoc' }; let subHandler, subCountHandler; let c = 0; let callback = count => { if (c === 0) { expect(count).to.equal(1); - } - else if (c === 1) { + } else if (c === 1) { expect(count).to.equal(0); subHandler.unsubscribe(); subCountHandler.unsubscribe(); @@ -209,7 +200,7 @@ describe('ObservableCursor', function () { subHandler = observable.subscribe(); subCountHandler = observable.collectionCount().subscribe(callback); let id = collection.insert(newDoc); - collection.remove({_id: id}); + collection.remove({ _id: id }); }); it('Multiple subscription for the same Observable should replay last value', () => { @@ -219,11 +210,11 @@ describe('ObservableCursor', function () { let spyCb1 = sinon.spy(); let spyCb2 = sinon.spy(); let firstSubscriptionHandler = observable.subscribe(spyCb1); - wrappedCollection.insert({test: 1}); - wrappedCollection.insert({test: 2}); - wrappedCollection.insert({test: 3}); + wrappedCollection.insert({ test: 1 }); + wrappedCollection.insert({ test: 2 }); + wrappedCollection.insert({ test: 3 }); let secondSubscriptionHandler = observable.subscribe(spyCb2); - wrappedCollection.insert({test: 4}); + wrappedCollection.insert({ test: 4 }); expect(spyCb1.callCount).to.equal(4); expect(spyCb2.callCount).to.equal(1); diff --git a/tests/client/unit/zone-operator.spec.ts b/tests/client/unit/zone-operator.spec.ts index 743823c5..e5d6ba03 100644 --- a/tests/client/unit/zone-operator.spec.ts +++ b/tests/client/unit/zone-operator.spec.ts @@ -1,7 +1,7 @@ -import {chai} from 'meteor/practicalmeteor:chai'; -import {sinon} from 'meteor/practicalmeteor:sinon'; -import {Observable} from 'rxjs'; -import {MeteorObservable, MongoObservable,zoneOperator} from 'meteor-rxjs'; +import * as chai from 'chai'; +import * as sinon from 'sinon'; +import { Observable } from 'rxjs'; +import { MeteorObservable, MongoObservable, zoneOperator } from 'meteor-rxjs'; import 'zone.js/dist/zone.js'; diff --git a/tests/package-lock.json b/tests/package-lock.json index 6bf50faa..3ae47364 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -3,12 +3,34 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "@babel/runtime": { + "version": "7.0.0-beta.49", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.49.tgz", + "integrity": "sha1-A7O/B+uYIHLI6FHdLd1RECguYb8=", + "requires": { + "core-js": "2.5.7", + "regenerator-runtime": "0.11.1" + } + }, + "@sinonjs/formatio": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", + "requires": { + "samsam": "1.3.0" + } + }, + "@types/chai": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.3.tgz", + "integrity": "sha512-f5dXGzOJycyzSMdaXVhiBhauL4dYydXwVpavfQ1mVCaGjR56a9QfklXObUxlIY9bGTmCPHEEZ04I16BZ/8w5ww==" + }, "@types/connect": { "version": "3.4.32", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz", "integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==", "requires": { - "@types/node": "10.0.4" + "@types/node": "10.1.3" } }, "@types/meteor": { @@ -20,83 +42,344 @@ "@types/underscore": "1.8.8" } }, + "@types/mocha": { + "version": "2.2.43", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.43.tgz", + "integrity": "sha512-xNlAmH+lRJdUMXClMTI9Y0pRqIojdxfm7DHsIxoB2iTzu3fnPmSMEN8SsSx0cdwV36d02PWCWaDUoZPDSln+xw==" + }, "@types/node": { - "version": "10.0.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.0.4.tgz", - "integrity": "sha512-RisaZmcmCLjRipAY7nVi3fmkIk4Z0JMn8YHdGF6qYMsIDpD0dfzz+3yy2dL5Q5aHWOnqPx51IRxkA44myknJvw==" + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.1.3.tgz", + "integrity": "sha512-GiCx7dRvta0hbxXoJFAUxz+CKX6bZSCKjM5slq2vPp/5zwK01T4ibYZkGr6EN4F2QmxDQR76/ZHg6q+7iFWCWw==" + }, + "@types/sinon": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-5.0.0.tgz", + "integrity": "sha512-RsisuFAkhtCB3DKwQrBZYdkqtOyck7y5GkMZ7KeYVjLNBoV9ZMI0Kxj304Myp+B5Jj4LeEdPMTPlXNylG9x94A==" }, "@types/underscore": { "version": "1.8.8", "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.8.8.tgz", "integrity": "sha512-EquzRwzAAs04anQ8/6MYXFKvHoD+MIlF+gu87EDda7dN9zrKvQYHsc9VFAPB1xY4tUHQVvBMtjsHrvof2EE1Mg==" }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "requires": { - "core-js": "2.5.5", - "regenerator-runtime": "0.11.1" + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "requires": { + "array-uniq": "1.0.3" } }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, + "buffer-from": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", + "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "requires": { + "assertion-error": "1.1.0", + "check-error": "1.0.2", + "deep-eql": "3.0.1", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.8" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" + }, + "chromedriver": { + "version": "2.38.3", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-2.38.3.tgz", + "integrity": "sha512-tczy6RHl0LOVA4p+xezcu3NRjr9A1iLyyfjP9yPIUynvV28YSKH/Ll1iw0jMCjN9jwtaB2HB4aPjv0Uuw2VARw==", + "requires": { + "del": "3.0.0", + "extract-zip": "1.6.7", + "kew": "0.7.0", + "mkdirp": "0.5.1", + "request": "2.87.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "1.0.0" + } + }, "commander": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "1.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "typedarray": "0.0.6" + } }, "core-js": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", - "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=" + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "1.0.0" + } }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, "requires": { "ms": "2.0.0" } }, - "es6-shim": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/es6-shim/-/es6-shim-0.35.3.tgz", - "integrity": "sha1-m/tzY/7//4emzbbNk+QF7DxLbyY=" + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "requires": { + "type-detect": "4.0.8" + } + }, + "del": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "requires": { + "globby": "6.1.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", + "p-map": "1.2.0", + "pify": "3.0.0", + "rimraf": "2.6.2" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "es6-promise": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", + "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "requires": { + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "requires": { + "pend": "1.2.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "1.0.0" + } }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", @@ -106,11 +389,73 @@ "path-is-absolute": "1.0.1" } }, + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "requires": { + "array-union": "1.0.2", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.14.1" + } + }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "1.3.3", "wrappy": "1.0.2" @@ -119,8 +464,135 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=" + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "requires": { + "is-path-inside": "1.0.1" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jszip": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz", + "integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==", + "requires": { + "core-js": "2.3.0", + "es6-promise": "3.0.2", + "lie": "3.1.1", + "pako": "1.0.6", + "readable-stream": "2.0.6" + }, + "dependencies": { + "core-js": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", + "integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, + "just-extend": { + "version": "1.1.27", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz", + "integrity": "sha512-mJVp13Ix6gFo3SBAy9U/kL+oeZqzlYYYLQBwXVBlVzIsZwBqGREnOro24oC/8s8aox+rJhtZ2DiQof++IrkA+g==" + }, + "kew": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", + "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=" + }, + "lie": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", + "integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=", + "requires": { + "immediate": "3.0.6" + } }, "linklocal": { "version": "2.8.2", @@ -135,6 +607,16 @@ "rimraf": "2.6.2" } }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "lolex": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.0.tgz", + "integrity": "sha512-uJkH2e0BVfU5KOJUevbTOtpDduooSarH5PopO+LfM/vZf8Z9sJzODqKev804JYM2i++ktJfUmC1le4LwFQ1VMg==" + }, "map-limit": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/map-limit/-/map-limit-0.0.1.tgz", @@ -152,18 +634,24 @@ "bundled": true }, "@types/connect": { - "version": "3.4.32", + "version": "3.4.31", "bundled": true, "requires": { - "@types/node": "10.0.4" + "@types/node": "8.0.28" } }, "@types/meteor": { - "version": "1.4.13", + "version": "1.4.14", "bundled": true, "requires": { - "@types/connect": "3.4.32", - "@types/underscore": "1.8.3" + "@types/connect": "3.4.31", + "@types/underscore": "1.8.8" + }, + "dependencies": { + "@types/underscore": { + "version": "1.8.8", + "bundled": true + } } }, "@types/mocha": { @@ -171,7 +659,7 @@ "bundled": true }, "@types/node": { - "version": "10.0.4", + "version": "8.0.28", "bundled": true }, "@types/underscore": { @@ -179,10 +667,10 @@ "bundled": true }, "JSONStream": { - "version": "1.3.2", + "version": "1.2.1", "bundled": true, "requires": { - "jsonparse": "1.3.1", + "jsonparse": "1.2.0", "through": "2.3.8" } }, @@ -205,7 +693,7 @@ "version": "0.1.4", "bundled": true, "requires": { - "kind-of": "3.2.2", + "kind-of": "3.0.4", "longest": "1.0.1", "repeat-string": "1.6.1" } @@ -218,11 +706,24 @@ "version": "3.0.0", "bundled": true, "requires": { - "array-back": "1.0.4" + "array-back": "1.0.3" + }, + "dependencies": { + "array-back": { + "version": "1.0.3", + "bundled": true, + "requires": { + "typical": "2.6.0" + } + }, + "typical": { + "version": "2.6.0", + "bundled": true + } } }, "ansi-regex": { - "version": "2.1.1", + "version": "2.0.0", "bundled": true }, "ansi-styles": { @@ -234,7 +735,7 @@ "bundled": true, "requires": { "array-back": "1.0.4", - "home-path": "1.0.5", + "home-path": "1.0.3", "test-value": "2.1.0", "usage-stats": "0.9.4" } @@ -243,7 +744,13 @@ "version": "1.0.4", "bundled": true, "requires": { - "typical": "2.6.1" + "typical": "2.6.0" + }, + "dependencies": { + "typical": { + "version": "2.6.0", + "bundled": true + } } }, "array-find-index": { @@ -254,13 +761,10 @@ "version": "1.0.0", "bundled": true }, - "arrify": { - "version": "1.0.1", - "bundled": true - }, "async": { - "version": "1.5.2", - "bundled": true + "version": "0.2.10", + "bundled": true, + "optional": true }, "babel-code-frame": { "version": "6.26.0", @@ -276,11 +780,11 @@ "bundled": true }, "bluebird": { - "version": "3.4.7", + "version": "3.4.6", "bundled": true }, "brace-expansion": { - "version": "1.1.11", + "version": "1.1.8", "bundled": true, "requires": { "balanced-match": "1.0.0", @@ -322,7 +826,7 @@ } }, "catharsis": { - "version": "0.8.9", + "version": "0.8.8", "bundled": true, "requires": { "underscore-contrib": "0.3.0" @@ -331,6 +835,7 @@ "center-align": { "version": "0.1.3", "bundled": true, + "optional": true, "requires": { "align-text": "0.1.4", "lazy-cache": "1.0.4" @@ -350,6 +855,7 @@ "cliui": { "version": "2.1.0", "bundled": true, + "optional": true, "requires": { "center-align": "0.1.3", "right-align": "0.1.3", @@ -358,20 +864,21 @@ "dependencies": { "wordwrap": { "version": "0.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, "collect-all": { - "version": "1.0.3", + "version": "1.0.2", "bundled": true, "requires": { "stream-connect": "1.0.2", - "stream-via": "1.0.4" + "stream-via": "1.0.3" } }, "colors": { - "version": "1.2.4", + "version": "1.1.2", "bundled": true }, "command-line-args": { @@ -399,17 +906,23 @@ "ansi-escape-sequences": "3.0.0", "array-back": "1.0.4", "command-line-args": "4.0.7", - "command-line-usage": "4.1.0", - "typical": "2.6.1" + "command-line-usage": "4.0.1", + "typical": "2.6.0" + }, + "dependencies": { + "typical": { + "version": "2.6.0", + "bundled": true + } } }, "command-line-usage": { - "version": "4.1.0", + "version": "4.0.1", "bundled": true, "requires": { "ansi-escape-sequences": "4.0.0", "array-back": "2.0.0", - "table-layout": "0.4.3", + "table-layout": "0.4.2", "typical": "2.6.1" }, "dependencies": { @@ -430,7 +943,7 @@ } }, "commander": { - "version": "2.15.1", + "version": "2.11.0", "bundled": true }, "common-sequence": { @@ -460,11 +973,11 @@ "version": "1.1.0", "bundled": true, "requires": { - "conventional-changelog-angular": "1.6.6", - "conventional-changelog-atom": "0.1.2", + "conventional-changelog-angular": "1.3.0", + "conventional-changelog-atom": "0.1.0", "conventional-changelog-codemirror": "0.1.0", - "conventional-changelog-core": "1.9.5", - "conventional-changelog-ember": "0.2.10", + "conventional-changelog-core": "1.5.0", + "conventional-changelog-ember": "0.2.2", "conventional-changelog-eslint": "0.1.0", "conventional-changelog-express": "0.1.0", "conventional-changelog-jquery": "0.1.0", @@ -473,18 +986,19 @@ } }, "conventional-changelog-angular": { - "version": "1.6.6", + "version": "1.3.0", "bundled": true, "requires": { "compare-func": "1.3.2", - "q": "1.5.1" + "github-url-from-git": "1.4.0", + "q": "1.4.1" } }, "conventional-changelog-atom": { - "version": "0.1.2", + "version": "0.1.0", "bundled": true, "requires": { - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-cli": { @@ -493,7 +1007,7 @@ "requires": { "add-stream": "1.0.0", "conventional-changelog": "1.1.0", - "lodash": "4.17.10", + "lodash": "4.17.0", "meow": "3.7.0", "tempfile": "1.1.1" } @@ -502,61 +1016,61 @@ "version": "0.1.0", "bundled": true, "requires": { - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-core": { - "version": "1.9.5", + "version": "1.5.0", "bundled": true, "requires": { - "conventional-changelog-writer": "2.0.3", - "conventional-commits-parser": "2.1.7", + "conventional-changelog-writer": "1.4.1", + "conventional-commits-parser": "1.3.0", "dateformat": "1.0.12", - "get-pkg-repo": "1.4.0", - "git-raw-commits": "1.3.6", + "get-pkg-repo": "1.3.0", + "git-raw-commits": "1.1.2", "git-remote-origin-url": "2.0.0", - "git-semver-tags": "1.3.6", - "lodash": "4.17.10", - "normalize-package-data": "2.4.0", - "q": "1.5.1", + "git-semver-tags": "1.1.2", + "lodash": "4.17.0", + "normalize-package-data": "2.3.5", + "q": "1.4.1", "read-pkg": "1.1.0", "read-pkg-up": "1.0.1", - "through2": "2.0.3" + "through2": "2.0.1" } }, "conventional-changelog-ember": { - "version": "0.2.10", + "version": "0.2.2", "bundled": true, "requires": { - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-eslint": { "version": "0.1.0", "bundled": true, "requires": { - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-express": { "version": "0.1.0", "bundled": true, "requires": { - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-jquery": { "version": "0.1.0", "bundled": true, "requires": { - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-jscs": { "version": "0.1.0", "bundled": true, "requires": { - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-jshint": { @@ -564,157 +1078,92 @@ "bundled": true, "requires": { "compare-func": "1.3.2", - "q": "1.5.1" + "q": "1.4.1" } }, "conventional-changelog-writer": { - "version": "2.0.3", + "version": "1.4.1", "bundled": true, "requires": { "compare-func": "1.3.2", - "conventional-commits-filter": "1.1.6", + "conventional-commits-filter": "1.0.0", "dateformat": "1.0.12", - "handlebars": "4.0.11", + "handlebars": "4.0.6", "json-stringify-safe": "5.0.1", - "lodash": "4.17.10", + "lodash": "4.17.0", "meow": "3.7.0", - "semver": "5.5.0", - "split": "1.0.1", - "through2": "2.0.3" - } - }, - "conventional-commits-filter": { - "version": "1.1.6", - "bundled": true, - "requires": { - "is-subset": "0.1.1", - "modify-values": "1.0.1" - } - }, - "conventional-commits-parser": { - "version": "2.1.7", - "bundled": true, - "requires": { - "JSONStream": "1.3.2", - "is-text-path": "1.0.1", - "lodash": "4.17.10", - "meow": "4.0.1", - "split2": "2.2.0", - "through2": "2.0.3", - "trim-off-newlines": "1.0.1" + "semver": "5.3.0", + "split": "1.0.0", + "through2": "2.0.1" }, "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true - }, - "camelcase-keys": { - "version": "4.2.0", - "bundled": true, - "requires": { - "camelcase": "4.1.0", - "map-obj": "2.0.0", - "quick-lru": "1.1.0" - } - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "indent-string": { - "version": "3.2.0", - "bundled": true - }, - "load-json-file": { - "version": "4.0.0", - "bundled": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "4.0.0", - "pify": "3.0.0", - "strip-bom": "3.0.0" - } - }, - "map-obj": { - "version": "2.0.0", + "async": { + "version": "1.5.2", "bundled": true }, - "meow": { - "version": "4.0.1", + "handlebars": { + "version": "4.0.6", "bundled": true, "requires": { - "camelcase-keys": "4.2.0", - "decamelize-keys": "1.1.0", - "loud-rejection": "1.6.0", - "minimist": "1.2.0", - "minimist-options": "3.0.2", - "normalize-package-data": "2.4.0", - "read-pkg-up": "3.0.0", - "redent": "2.0.0", - "trim-newlines": "2.0.0" + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.7.4" } }, - "parse-json": { - "version": "4.0.0", + "source-map": { + "version": "0.4.4", "bundled": true, "requires": { - "error-ex": "1.3.1", - "json-parse-better-errors": "1.0.2" + "amdefine": "1.0.1" } }, - "path-type": { - "version": "3.0.0", + "uglify-js": { + "version": "2.7.4", "bundled": true, + "optional": true, "requires": { - "pify": "3.0.0" + "async": "0.2.10", + "source-map": "0.5.6", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "bundled": true, + "optional": true + }, + "source-map": { + "version": "0.5.6", + "bundled": true, + "optional": true + } } - }, - "pify": { - "version": "3.0.0", - "bundled": true - }, - "read-pkg": { - "version": "3.0.0", - "bundled": true, - "requires": { - "load-json-file": "4.0.0", - "normalize-package-data": "2.4.0", - "path-type": "3.0.0" - } - }, - "read-pkg-up": { - "version": "3.0.0", - "bundled": true, - "requires": { - "find-up": "2.1.0", - "read-pkg": "3.0.0" - } - }, - "redent": { - "version": "2.0.0", - "bundled": true, - "requires": { - "indent-string": "3.2.0", - "strip-indent": "2.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "bundled": true - }, - "strip-indent": { - "version": "2.0.0", - "bundled": true - }, - "trim-newlines": { - "version": "2.0.0", - "bundled": true } } }, + "conventional-commits-filter": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-subset": "0.1.1", + "modify-values": "1.0.0" + } + }, + "conventional-commits-parser": { + "version": "1.3.0", + "bundled": true, + "requires": { + "JSONStream": "1.2.1", + "is-text-path": "1.0.1", + "lodash": "4.17.0", + "meow": "3.7.0", + "split2": "2.1.0", + "through2": "2.0.1", + "trim-off-newlines": "1.0.1" + } + }, "core-util-is": { "version": "1.0.2", "bundled": true @@ -745,16 +1194,8 @@ "version": "1.2.0", "bundled": true }, - "decamelize-keys": { - "version": "1.1.0", - "bundled": true, - "requires": { - "decamelize": "1.2.0", - "map-obj": "1.0.1" - } - }, "deep-extend": { - "version": "0.5.1", + "version": "0.5.0", "bundled": true }, "defer-promise": { @@ -762,42 +1203,27 @@ "bundled": true }, "diff": { - "version": "3.5.0", + "version": "3.3.1", "bundled": true }, "dmd": { - "version": "3.0.12", + "version": "3.0.6", "bundled": true, "requires": { - "array-back": "2.0.0", + "array-back": "1.0.4", "cache-point": "0.4.1", "common-sequence": "1.0.2", - "file-set": "2.0.0", - "handlebars": "4.0.11", - "marked": "0.3.19", + "file-set": "1.1.1", + "handlebars": "3.0.3", + "marked": "0.3.6", "object-get": "2.1.0", "reduce-flatten": "1.0.1", "reduce-unique": "1.0.0", "reduce-without": "1.0.1", - "test-value": "3.0.0", + "test-value": "2.1.0", "walk-back": "3.0.0" }, "dependencies": { - "array-back": { - "version": "2.0.0", - "bundled": true, - "requires": { - "typical": "2.6.1" - } - }, - "test-value": { - "version": "3.0.0", - "bundled": true, - "requires": { - "array-back": "2.0.0", - "typical": "2.6.1" - } - }, "walk-back": { "version": "3.0.0", "bundled": true @@ -812,7 +1238,7 @@ } }, "error-ex": { - "version": "1.3.1", + "version": "1.3.0", "bundled": true, "requires": { "is-arrayish": "0.2.1" @@ -835,19 +1261,23 @@ "bundled": true }, "file-set": { - "version": "2.0.0", + "version": "1.1.1", "bundled": true, "requires": { - "array-back": "2.0.0", - "glob": "7.1.2" + "array-back": "1.0.3", + "glob": "7.1.1" }, "dependencies": { "array-back": { - "version": "2.0.0", + "version": "1.0.3", "bundled": true, "requires": { - "typical": "2.6.1" + "typical": "2.6.0" } + }, + "typical": { + "version": "2.6.0", + "bundled": true } } }, @@ -876,14 +1306,14 @@ "bundled": true }, "get-pkg-repo": { - "version": "1.4.0", + "version": "1.3.0", "bundled": true, "requires": { - "hosted-git-info": "2.6.0", + "hosted-git-info": "2.1.5", "meow": "3.7.0", - "normalize-package-data": "2.4.0", - "parse-github-repo-url": "1.4.1", - "through2": "2.0.3" + "normalize-package-data": "2.3.5", + "parse-github-repo-url": "1.3.0", + "through2": "2.0.1" } }, "get-stdin": { @@ -891,125 +1321,14 @@ "bundled": true }, "git-raw-commits": { - "version": "1.3.6", + "version": "1.1.2", "bundled": true, "requires": { "dargs": "4.1.0", "lodash.template": "4.4.0", - "meow": "4.0.1", - "split2": "2.2.0", - "through2": "2.0.3" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true - }, - "camelcase-keys": { - "version": "4.2.0", - "bundled": true, - "requires": { - "camelcase": "4.1.0", - "map-obj": "2.0.0", - "quick-lru": "1.1.0" - } - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "indent-string": { - "version": "3.2.0", - "bundled": true - }, - "load-json-file": { - "version": "4.0.0", - "bundled": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "4.0.0", - "pify": "3.0.0", - "strip-bom": "3.0.0" - } - }, - "map-obj": { - "version": "2.0.0", - "bundled": true - }, - "meow": { - "version": "4.0.1", - "bundled": true, - "requires": { - "camelcase-keys": "4.2.0", - "decamelize-keys": "1.1.0", - "loud-rejection": "1.6.0", - "minimist": "1.2.0", - "minimist-options": "3.0.2", - "normalize-package-data": "2.4.0", - "read-pkg-up": "3.0.0", - "redent": "2.0.0", - "trim-newlines": "2.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "bundled": true, - "requires": { - "error-ex": "1.3.1", - "json-parse-better-errors": "1.0.2" - } - }, - "path-type": { - "version": "3.0.0", - "bundled": true, - "requires": { - "pify": "3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "bundled": true - }, - "read-pkg": { - "version": "3.0.0", - "bundled": true, - "requires": { - "load-json-file": "4.0.0", - "normalize-package-data": "2.4.0", - "path-type": "3.0.0" - } - }, - "read-pkg-up": { - "version": "3.0.0", - "bundled": true, - "requires": { - "find-up": "2.1.0", - "read-pkg": "3.0.0" - } - }, - "redent": { - "version": "2.0.0", - "bundled": true, - "requires": { - "indent-string": "3.2.0", - "strip-indent": "2.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "bundled": true - }, - "strip-indent": { - "version": "2.0.0", - "bundled": true - }, - "trim-newlines": { - "version": "2.0.0", - "bundled": true - } + "meow": "3.7.0", + "split2": "2.1.0", + "through2": "2.0.1" } }, "git-remote-origin-url": { @@ -1021,170 +1340,83 @@ } }, "git-semver-tags": { - "version": "1.3.6", + "version": "1.1.2", "bundled": true, "requires": { - "meow": "4.0.1", - "semver": "5.5.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true - }, - "camelcase-keys": { - "version": "4.2.0", - "bundled": true, - "requires": { - "camelcase": "4.1.0", - "map-obj": "2.0.0", - "quick-lru": "1.1.0" - } - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "indent-string": { - "version": "3.2.0", - "bundled": true - }, - "load-json-file": { - "version": "4.0.0", - "bundled": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "4.0.0", - "pify": "3.0.0", - "strip-bom": "3.0.0" - } - }, - "map-obj": { - "version": "2.0.0", - "bundled": true - }, - "meow": { - "version": "4.0.1", - "bundled": true, - "requires": { - "camelcase-keys": "4.2.0", - "decamelize-keys": "1.1.0", - "loud-rejection": "1.6.0", - "minimist": "1.2.0", - "minimist-options": "3.0.2", - "normalize-package-data": "2.4.0", - "read-pkg-up": "3.0.0", - "redent": "2.0.0", - "trim-newlines": "2.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "bundled": true, - "requires": { - "error-ex": "1.3.1", - "json-parse-better-errors": "1.0.2" - } - }, - "path-type": { - "version": "3.0.0", - "bundled": true, - "requires": { - "pify": "3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "bundled": true - }, - "read-pkg": { - "version": "3.0.0", - "bundled": true, - "requires": { - "load-json-file": "4.0.0", - "normalize-package-data": "2.4.0", - "path-type": "3.0.0" - } - }, - "read-pkg-up": { - "version": "3.0.0", - "bundled": true, - "requires": { - "find-up": "2.1.0", - "read-pkg": "3.0.0" - } - }, - "redent": { - "version": "2.0.0", - "bundled": true, - "requires": { - "indent-string": "3.2.0", - "strip-indent": "2.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "bundled": true - }, - "strip-indent": { - "version": "2.0.0", - "bundled": true - }, - "trim-newlines": { - "version": "2.0.0", - "bundled": true - } + "meow": "3.7.0", + "semver": "5.3.0" } }, "gitconfiglocal": { "version": "1.0.0", "bundled": true, "requires": { - "ini": "1.3.5" + "ini": "1.3.4" } }, + "github-url-from-git": { + "version": "1.4.0", + "bundled": true + }, "glob": { - "version": "7.1.2", + "version": "7.1.1", "bundled": true, "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", "inherits": "2.0.3", - "minimatch": "3.0.4", + "minimatch": "3.0.3", "once": "1.4.0", "path-is-absolute": "1.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "bundled": true + }, + "brace-expansion": { + "version": "1.1.6", + "bundled": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.0.3", + "bundled": true, + "requires": { + "brace-expansion": "1.1.6" + } + } } }, "graceful-fs": { - "version": "4.1.11", + "version": "4.1.10", "bundled": true }, "handlebars": { - "version": "4.0.11", + "version": "3.0.3", "bundled": true, "requires": { - "async": "1.5.2", "optimist": "0.6.1", - "source-map": "0.4.4", - "uglify-js": "2.8.29" + "source-map": "0.1.43", + "uglify-js": "2.3.6" } }, "has-ansi": { "version": "2.0.0", "bundled": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "2.0.0" } }, "home-path": { - "version": "1.0.5", + "version": "1.0.3", "bundled": true }, "hosted-git-info": { - "version": "2.6.0", + "version": "2.1.5", "bundled": true }, "indent-string": { @@ -1207,7 +1439,7 @@ "bundled": true }, "ini": { - "version": "1.3.5", + "version": "1.3.4", "bundled": true }, "is-arrayish": { @@ -1215,7 +1447,7 @@ "bundled": true }, "is-buffer": { - "version": "1.1.6", + "version": "1.1.4", "bundled": true }, "is-builtin-module": { @@ -1236,10 +1468,6 @@ "version": "1.0.1", "bundled": true }, - "is-plain-obj": { - "version": "1.1.0", - "bundled": true - }, "is-subset": { "version": "0.1.1", "bundled": true @@ -1248,7 +1476,7 @@ "version": "1.0.1", "bundled": true, "requires": { - "text-extensions": "1.7.0" + "text-extensions": "1.3.3" } }, "is-utf8": { @@ -1271,18 +1499,24 @@ "version": "3.6.0", "bundled": true, "requires": { - "bluebird": "3.4.7", - "catharsis": "0.8.9", + "bluebird": "3.4.6", + "catharsis": "0.8.8", "escape-string-regexp": "1.0.5", "espree": "3.1.7", "js2xmlparser": "1.0.0", "klaw": "1.3.1", - "marked": "0.3.19", + "marked": "0.3.6", "mkdirp": "0.5.1", "requizzle": "0.2.1", "strip-json-comments": "2.0.1", "taffydb": "2.6.2", "underscore": "1.8.3" + }, + "dependencies": { + "underscore": { + "version": "1.8.3", + "bundled": true + } } }, "jsdoc-api": { @@ -1291,52 +1525,25 @@ "requires": { "array-back": "1.0.4", "cache-point": "0.4.1", - "collect-all": "1.0.3", + "collect-all": "1.0.2", "file-set": "1.1.1", "fs-then-native": "2.0.0", "jsdoc-75lb": "3.6.0", - "object-to-spawn-args": "1.1.1", + "object-to-spawn-args": "1.1.0", "temp-path": "1.0.0", "walk-back": "2.0.1" - }, - "dependencies": { - "file-set": { - "version": "1.1.1", - "bundled": true, - "requires": { - "array-back": "1.0.4", - "glob": "7.1.2" - } - } } }, "jsdoc-parse": { - "version": "3.0.1", + "version": "3.0.0", "bundled": true, "requires": { - "array-back": "2.0.0", + "array-back": "1.0.4", "lodash.omit": "4.5.0", "lodash.pick": "4.4.0", "reduce-extract": "1.0.0", - "sort-array": "2.0.0", - "test-value": "3.0.0" - }, - "dependencies": { - "array-back": { - "version": "2.0.0", - "bundled": true, - "requires": { - "typical": "2.6.1" - } - }, - "test-value": { - "version": "3.0.0", - "bundled": true, - "requires": { - "array-back": "2.0.0", - "typical": "2.6.1" - } - } + "sort-array": "1.1.1", + "test-value": "2.1.0" } }, "jsdoc-to-markdown": { @@ -1346,9 +1553,9 @@ "array-back": "1.0.4", "command-line-tool": "0.7.0", "config-master": "3.1.0", - "dmd": "3.0.12", + "dmd": "3.0.6", "jsdoc-api": "3.0.0", - "jsdoc-parse": "3.0.1", + "jsdoc-parse": "3.0.0", "jsdoc2md-stats": "2.0.1", "walk-back": "2.0.1" } @@ -1360,63 +1567,46 @@ "app-usage-stats": "0.5.1" } }, - "json-parse-better-errors": { - "version": "1.0.2", - "bundled": true - }, "json-stringify-safe": { "version": "5.0.1", "bundled": true }, "jsonparse": { - "version": "1.3.1", + "version": "1.2.0", "bundled": true }, "kind-of": { - "version": "3.2.2", + "version": "3.0.4", "bundled": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "1.1.4" } }, "klaw": { "version": "1.3.1", "bundled": true, "requires": { - "graceful-fs": "4.1.11" + "graceful-fs": "4.1.10" } }, "lazy-cache": { "version": "1.0.4", - "bundled": true + "bundled": true, + "optional": true }, "load-json-file": { "version": "1.1.0", "bundled": true, "requires": { - "graceful-fs": "4.1.11", + "graceful-fs": "4.1.10", "parse-json": "2.2.0", "pify": "2.3.0", "pinkie-promise": "2.0.1", "strip-bom": "2.0.0" } }, - "locate-path": { - "version": "2.0.0", - "bundled": true, - "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "bundled": true - } - } - }, "lodash": { - "version": "4.17.10", + "version": "4.17.0", "bundled": true }, "lodash._reinterpolate": { @@ -1459,7 +1649,7 @@ "bundled": true, "requires": { "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" + "signal-exit": "3.0.1" } }, "map-obj": { @@ -1467,7 +1657,7 @@ "bundled": true }, "marked": { - "version": "0.3.19", + "version": "0.3.6", "bundled": true }, "meow": { @@ -1479,43 +1669,35 @@ "loud-rejection": "1.6.0", "map-obj": "1.0.1", "minimist": "1.2.0", - "normalize-package-data": "2.4.0", - "object-assign": "4.1.1", + "normalize-package-data": "2.3.5", + "object-assign": "4.1.0", "read-pkg-up": "1.0.1", "redent": "1.0.0", "trim-newlines": "1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true + } } }, "minimatch": { "version": "3.0.4", "bundled": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "1.1.8" } }, "minimist": { - "version": "1.2.0", + "version": "0.0.8", "bundled": true }, - "minimist-options": { - "version": "3.0.2", - "bundled": true, - "requires": { - "arrify": "1.0.1", - "is-plain-obj": "1.1.0" - } - }, "mkdirp": { "version": "0.5.1", "bundled": true, "requires": { "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "bundled": true - } } }, "mkdirp2": { @@ -1523,17 +1705,17 @@ "bundled": true }, "modify-values": { - "version": "1.0.1", + "version": "1.0.0", "bundled": true }, "normalize-package-data": { - "version": "2.4.0", + "version": "2.3.5", "bundled": true, "requires": { - "hosted-git-info": "2.6.0", + "hosted-git-info": "2.1.5", "is-builtin-module": "1.0.0", - "semver": "5.5.0", - "validate-npm-package-license": "3.0.3" + "semver": "5.3.0", + "validate-npm-package-license": "3.0.1" } }, "number-is-nan": { @@ -1541,7 +1723,7 @@ "bundled": true }, "object-assign": { - "version": "4.1.1", + "version": "4.1.0", "bundled": true }, "object-get": { @@ -1549,7 +1731,7 @@ "bundled": true }, "object-to-spawn-args": { - "version": "1.1.1", + "version": "1.1.0", "bundled": true }, "once": { @@ -1563,47 +1745,23 @@ "version": "0.6.1", "bundled": true, "requires": { - "minimist": "0.0.10", + "minimist": "0.0.8", "wordwrap": "0.0.3" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "bundled": true - } } }, "os-tmpdir": { "version": "1.0.2", "bundled": true }, - "p-limit": { - "version": "1.2.0", - "bundled": true, - "requires": { - "p-try": "1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "bundled": true, - "requires": { - "p-limit": "1.2.0" - } - }, - "p-try": { - "version": "1.0.0", - "bundled": true - }, "parse-github-repo-url": { - "version": "1.4.1", + "version": "1.3.0", "bundled": true }, "parse-json": { "version": "2.2.0", "bundled": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "1.3.0" } }, "path-exists": { @@ -1625,7 +1783,7 @@ "version": "1.1.0", "bundled": true, "requires": { - "graceful-fs": "4.1.11", + "graceful-fs": "4.1.10", "pify": "2.3.0", "pinkie-promise": "2.0.1" } @@ -1646,15 +1804,11 @@ } }, "process-nextick-args": { - "version": "2.0.0", + "version": "1.0.7", "bundled": true }, "q": { - "version": "1.5.1", - "bundled": true - }, - "quick-lru": { - "version": "1.1.0", + "version": "1.4.1", "bundled": true }, "read-pkg": { @@ -1662,7 +1816,7 @@ "bundled": true, "requires": { "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", + "normalize-package-data": "2.3.5", "path-type": "1.1.0" } }, @@ -1675,15 +1829,14 @@ } }, "readable-stream": { - "version": "2.3.6", + "version": "2.0.6", "bundled": true, "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", "util-deprecate": "1.0.2" } }, @@ -1702,13 +1855,24 @@ "test-value": "1.1.0" }, "dependencies": { + "array-back": { + "version": "1.0.3", + "bundled": true, + "requires": { + "typical": "2.6.0" + } + }, "test-value": { "version": "1.1.0", "bundled": true, "requires": { - "array-back": "1.0.4", - "typical": "2.6.1" + "array-back": "1.0.3", + "typical": "2.6.0" } + }, + "typical": { + "version": "2.6.0", + "bundled": true } } }, @@ -1763,16 +1927,10 @@ "bundled": true, "requires": { "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "bundled": true - } } }, "resolve": { - "version": "1.7.1", + "version": "1.4.0", "bundled": true, "requires": { "path-parse": "1.0.5" @@ -1781,6 +1939,7 @@ "right-align": { "version": "0.1.3", "bundled": true, + "optional": true, "requires": { "align-text": "0.1.4" } @@ -1790,83 +1949,102 @@ "bundled": true }, "rxjs": { - "version": "5.5.7", + "version": "6.0.0", "bundled": true, "requires": { - "symbol-observable": "1.0.1" + "tslib": "1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.9.0", + "bundled": true + } } }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true - }, "semver": { - "version": "5.5.0", + "version": "5.3.0", "bundled": true }, "signal-exit": { - "version": "3.0.2", + "version": "3.0.1", "bundled": true }, "sort-array": { - "version": "2.0.0", + "version": "1.1.1", "bundled": true, "requires": { - "array-back": "1.0.4", + "array-back": "1.0.3", "object-get": "2.1.0", - "typical": "2.6.1" + "typical": "2.6.0" + }, + "dependencies": { + "array-back": { + "version": "1.0.3", + "bundled": true, + "requires": { + "typical": "2.6.0" + } + }, + "typical": { + "version": "2.6.0", + "bundled": true + } } }, "source-map": { - "version": "0.4.4", + "version": "0.1.43", "bundled": true, "requires": { "amdefine": "1.0.1" } }, "spdx-correct": { - "version": "3.0.0", + "version": "1.0.2", "bundled": true, "requires": { - "spdx-expression-parse": "3.0.0", - "spdx-license-ids": "3.0.0" + "spdx-license-ids": "1.2.2" } }, - "spdx-exceptions": { - "version": "2.1.0", - "bundled": true - }, "spdx-expression-parse": { - "version": "3.0.0", - "bundled": true, - "requires": { - "spdx-exceptions": "2.1.0", - "spdx-license-ids": "3.0.0" - } + "version": "1.0.4", + "bundled": true }, "spdx-license-ids": { - "version": "3.0.0", + "version": "1.2.2", "bundled": true }, "split": { - "version": "1.0.1", + "version": "1.0.0", "bundled": true, "requires": { "through": "2.3.8" } }, "split2": { - "version": "2.2.0", + "version": "2.1.0", "bundled": true, "requires": { - "through2": "2.0.3" + "through2": "2.0.1" } }, "stream-connect": { "version": "1.0.2", "bundled": true, "requires": { - "array-back": "1.0.4" + "array-back": "1.0.3" + }, + "dependencies": { + "array-back": { + "version": "1.0.3", + "bundled": true, + "requires": { + "typical": "2.6.0" + } + }, + "typical": { + "version": "2.6.0", + "bundled": true + } } }, "stream-read-all": { @@ -1874,21 +2052,18 @@ "bundled": true }, "stream-via": { - "version": "1.0.4", + "version": "1.0.3", "bundled": true }, "string_decoder": { - "version": "1.1.1", - "bundled": true, - "requires": { - "safe-buffer": "5.1.2" - } + "version": "0.10.31", + "bundled": true }, "strip-ansi": { "version": "3.0.1", "bundled": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "2.0.0" } }, "strip-bom": { @@ -1913,16 +2088,12 @@ "version": "2.0.0", "bundled": true }, - "symbol-observable": { - "version": "1.0.1", - "bundled": true - }, "table-layout": { - "version": "0.4.3", + "version": "0.4.2", "bundled": true, "requires": { "array-back": "2.0.0", - "deep-extend": "0.5.1", + "deep-extend": "0.5.0", "lodash.padend": "4.6.1", "typical": "2.6.1", "wordwrapjs": "3.0.0" @@ -1957,12 +2128,25 @@ "version": "2.1.0", "bundled": true, "requires": { - "array-back": "1.0.4", - "typical": "2.6.1" + "array-back": "1.0.3", + "typical": "2.6.0" + }, + "dependencies": { + "array-back": { + "version": "1.0.3", + "bundled": true, + "requires": { + "typical": "2.6.0" + } + }, + "typical": { + "version": "2.6.0", + "bundled": true + } } }, "text-extensions": { - "version": "1.7.0", + "version": "1.3.3", "bundled": true }, "through": { @@ -1970,10 +2154,10 @@ "bundled": true }, "through2": { - "version": "2.0.3", + "version": "2.0.1", "bundled": true, "requires": { - "readable-stream": "2.3.6", + "readable-stream": "2.0.6", "xtend": "4.0.1" } }, @@ -1986,7 +2170,7 @@ "bundled": true }, "tslib": { - "version": "1.9.0", + "version": "1.7.1", "bundled": true }, "tslint": { @@ -1994,22 +2178,28 @@ "bundled": true, "requires": { "babel-code-frame": "6.26.0", - "colors": "1.2.4", - "commander": "2.15.1", - "diff": "3.5.0", - "glob": "7.1.2", + "colors": "1.1.2", + "commander": "2.11.0", + "diff": "3.3.1", + "glob": "7.1.1", "minimatch": "3.0.4", - "resolve": "1.7.1", - "semver": "5.5.0", - "tslib": "1.9.0", - "tsutils": "2.26.2" + "resolve": "1.4.0", + "semver": "5.4.1", + "tslib": "1.7.1", + "tsutils": "2.8.2" + }, + "dependencies": { + "semver": { + "version": "5.4.1", + "bundled": true + } } }, "tsutils": { - "version": "2.26.2", + "version": "2.8.2", "bundled": true, "requires": { - "tslib": "1.9.0" + "tslib": "1.7.1" } }, "typescript": { @@ -2021,28 +2211,32 @@ "bundled": true }, "uglify-js": { - "version": "2.8.29", + "version": "2.3.6", "bundled": true, "optional": true, "requires": { - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" + "async": "0.2.10", + "optimist": "0.3.7", + "source-map": "0.1.43" }, "dependencies": { - "source-map": { - "version": "0.5.7", + "optimist": { + "version": "0.3.7", "bundled": true, - "optional": true + "optional": true, + "requires": { + "wordwrap": "0.0.3" + } } } }, "uglify-to-browserify": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "underscore": { - "version": "1.8.3", + "version": "1.6.0", "bundled": true }, "underscore-contrib": { @@ -2050,12 +2244,6 @@ "bundled": true, "requires": { "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "bundled": true - } } }, "usage-stats": { @@ -2067,7 +2255,7 @@ "mkdirp2": "1.0.3", "req-then": "0.6.4", "typical": "2.6.1", - "uuid": "3.2.1" + "uuid": "3.1.0" }, "dependencies": { "array-back": { @@ -2077,8 +2265,12 @@ "typical": "2.6.1" } }, + "home-path": { + "version": "1.0.5", + "bundled": true + }, "uuid": { - "version": "3.2.1", + "version": "3.1.0", "bundled": true } } @@ -2092,11 +2284,11 @@ "bundled": true }, "validate-npm-package-license": { - "version": "3.0.3", + "version": "3.0.1", "bundled": true, "requires": { - "spdx-correct": "3.0.0", - "spdx-expression-parse": "3.0.0" + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" } }, "walk-back": { @@ -2105,7 +2297,8 @@ }, "window-size": { "version": "0.1.0", - "bundled": true + "bundled": true, + "optional": true }, "wordwrap": { "version": "0.0.3", @@ -2130,6 +2323,7 @@ "yargs": { "version": "3.10.0", "bundled": true, + "optional": true, "requires": { "camelcase": "1.2.1", "cliui": "2.1.0", @@ -2139,7 +2333,8 @@ "dependencies": { "camelcase": { "version": "1.2.1", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -2149,11 +2344,23 @@ } } }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "requires": { + "mime-db": "1.33.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "1.1.11" } @@ -2161,81 +2368,391 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, "requires": { "minimist": "0.0.8" } }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nise": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.3.3.tgz", + "integrity": "sha512-v1J/FLUB9PfGqZLGDBhQqODkbLotP0WtLo9R4EJY2PPu5f5Xg4o0rA8FDlmrjFSv9vBBKcfnOSpfYYuu5RTHqg==", + "requires": { + "@sinonjs/formatio": "2.0.0", + "just-extend": "1.1.27", + "lolex": "2.7.0", + "path-to-regexp": "1.7.0", + "text-encoding": "0.6.4" + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "once": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", - "dev": true, "requires": { "wrappy": "1.0.2" } }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==" + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==" + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=" + }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "requires": { + "isarray": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + } + } + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=" + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "2.0.4" + } + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } }, "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" }, + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.7.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.2", + "safe-buffer": "5.1.2", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, "requires": { "glob": "7.1.2" } }, "rxjs": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.1.0.tgz", - "integrity": "sha512-lMZdl6xbHJCSb5lmnb6nOhsoBVCyoDC5LDJQK9WWyq+tsI7KnlDIZ0r0AZAlBpRPLbwQA9kzSBAZwNIZEZ+hcw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.0.tgz", + "integrity": "sha512-qBzf5uu6eOKiCZuAE0SgZ0/Qp+l54oeVxFfC2t+mJ2SFI6IB8gmMdJHs5DUMu5kqifqcCtsKS2XHjhZu6RKvAw==", "requires": { - "tslib": "1.9.0" + "tslib": "1.9.1" } }, - "rxjs-compat": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.1.0.tgz", - "integrity": "sha512-x5L1KQy1RqDRpPadN5iDOx71TV9Wqmlmu6OOEn3tFFgaTCB0/N+Lmby/rZHgJ6JEPzzt0nD9Zv+kS53E5JIR5g==" + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "samsam": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", + "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==" + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "selenium-webdriver": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz", + "integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==", + "requires": { + "jszip": "3.1.5", + "rimraf": "2.6.2", + "tmp": "0.0.30", + "xml2js": "0.4.19" + } + }, + "sinon": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-5.0.10.tgz", + "integrity": "sha512-+YT7Mjr8BpNndQqUUydO/daggF4yuOAnsVjo+5Ayx3mLLUqojfkXhDkho4HB5VgfnZYSdhxVDPbfJ2EBXFMSvA==", + "requires": { + "@sinonjs/formatio": "2.0.0", + "diff": "3.5.0", + "lodash.get": "4.4.2", + "lolex": "2.7.0", + "nise": "1.3.3", + "supports-color": "5.4.0", + "type-detect": "4.0.8" + } + }, + "sshpk": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "5.1.2" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "requires": { + "has-flag": "3.0.0" + } + }, + "text-encoding": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=" + }, + "tmp": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz", + "integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=", + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "1.4.1" + } }, "tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.1.tgz", + "integrity": "sha512-avfPS28HmGLLc2o4elcc2EIq2FcH++Yo5YxpBZi9Yw93BCTGFthI4HPE4Rpep6vSYQaK8e69PelM44tPj+RaQg==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "5.1.2" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": "1.2.4", + "xmlbuilder": "9.0.7" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "requires": { + "fd-slicer": "1.0.1" + } }, "zone.js": { - "version": "0.8.17", - "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.17.tgz", - "integrity": "sha1-TF5RhahX2o2nk9rzkZNxxaNrKgs=" + "version": "0.8.26", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.26.tgz", + "integrity": "sha512-W9Nj+UmBJG251wkCacIkETgra4QgBo/vgoEkb4a2uoLzpQG7qF9nzwoLXWU5xj3Fg2mxGvEDh47mg24vXccYjA==" } } } diff --git a/tests/package.json b/tests/package.json index d9000b90..553a4a0b 100644 --- a/tests/package.json +++ b/tests/package.json @@ -5,13 +5,19 @@ "start": "meteor run" }, "dependencies": { - "babel-runtime": "^6.26.0", - "es6-shim": "^0.35.3", + "@babel/runtime": "^7.0.0-beta.49", + "@types/chai": "^4.1.3", + "@types/meteor": "^1.4.6", + "@types/mocha": "2.2.43", + "@types/sinon": "^5.0.0", + "chai": "^4.1.2", + "chromedriver": "^2.38.3", "meteor-rxjs": "file:..", + "mocha": "^5.2.0", "rxjs": "^6.0.0", - "rxjs-compat": "^6.0.0", - "zone.js": "0.8.17", - "@types/meteor": "^1.4.6" + "selenium-webdriver": "3.6.0", + "sinon": "^5.0.10", + "zone.js": "0.8.26" }, "devDependencies": { "linklocal": "^2.8.1" diff --git a/tests/yarn.lock b/tests/yarn.lock index cc07f24d..4003b008 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -2,7 +2,28 @@ # yarn lockfile v1 -babel-runtime@6.26.0: +"@types/connect@*": + version "3.4.32" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.32.tgz#aa0e9616b9435ccad02bc52b5b454ffc2c70ba28" + dependencies: + "@types/node" "*" + +"@types/meteor@^1.4.6": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@types/meteor/-/meteor-1.4.15.tgz#36e41c4811d0a3fbc89607bb5ac4853ea8cde0e2" + dependencies: + "@types/connect" "*" + "@types/underscore" "*" + +"@types/node@*": + version "10.1.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.3.tgz#5c16980936c4e3c83ce64e8ed71fb37bd7aea135" + +"@types/underscore@*": + version "1.8.8" + resolved "https://registry.yarnpkg.com/@types/underscore/-/underscore-1.8.8.tgz#510fe1ca5e7fa87fccd405b9a8b566d420bc3d1b" + +babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" dependencies: @@ -20,9 +41,9 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -commander@^2.11.0: - version "2.15.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.0.tgz#ad2a23a1c3b036e392469b8012cec6b33b4c1322" +commander@^2.15.0: + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" concat-map@0.0.1: version "0.0.1" @@ -32,13 +53,13 @@ core-js@^2.4.0: version "2.5.3" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.3.tgz#8acc38345824f16d8365b7c9b4259168e8ed603e" -debug@^2.6.8: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" +debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" -es6-shim@0.35.3: +es6-shim@^0.35.3: version "0.35.3" resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.3.tgz#9bfb7363feffff87a6cdb6cd93e405ec3c4b6f26" @@ -68,15 +89,15 @@ inherits@2: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -linklocal@2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/linklocal/-/linklocal-2.8.1.tgz#3db5a1767afaa127772bdc7a80cbae460dfa30a5" +linklocal@^2.8.1: + version "2.8.2" + resolved "https://registry.yarnpkg.com/linklocal/-/linklocal-2.8.2.tgz#c69e8864daac79369029892b17d5a8089275dca7" dependencies: - commander "^2.11.0" - debug "^2.6.8" + commander "^2.15.0" + debug "^3.1.0" map-limit "0.0.1" mkdirp "^0.5.1" - rimraf "^2.6.1" + rimraf "^2.6.2" map-limit@0.0.1: version "0.0.1" @@ -85,7 +106,7 @@ map-limit@0.0.1: once "~1.3.0" "meteor-rxjs@file:..": - version "0.4.8" + version "0.4.11" minimatch@^3.0.4: version "3.0.4" @@ -127,21 +148,25 @@ regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" -rimraf@^2.6.1: +rimraf@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" -rxjs@5.4.3: - version "5.4.3" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.3.tgz#0758cddee6033d68e0fd53676f0f3596ce3d483f" +rxjs-compat@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/rxjs-compat/-/rxjs-compat-6.2.0.tgz#2eb49cc6ac20d0d7057c6887d1895beaab0966f9" + +rxjs@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.0.tgz#e024d0e180b72756a83c2aaea8f25423751ba978" dependencies: - symbol-observable "^1.0.1" + tslib "^1.9.0" -symbol-observable@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" +tslib@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.1.tgz#a5d1f0532a49221c87755cfcc89ca37197242ba7" wrappy@1: version "1.0.2" diff --git a/tsconfig.json b/tsconfig.json index 3309fd02..4b456930 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,11 @@ "compilerOptions": { "experimentalDecorators": true, "module": "es2015", - "target": "es5", - "lib": ["es2015", "dom"], + "target": "es2015", + "lib": [ + "es2015", + "dom" + ], "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, "moduleResolution": "node", @@ -14,9 +17,7 @@ "rootDir": "./src", "types": [ "zone.js", - "@types/chai", - "@types/meteor", - "@types/underscore" + "@types/meteor" ] }, "files": [ @@ -25,4 +26,4 @@ "exclude": [ "node_modules" ] -} +} \ No newline at end of file diff --git a/tslint.json b/tslint.json index 8b737a5c..4653e113 100644 --- a/tslint.json +++ b/tslint.json @@ -33,7 +33,7 @@ "no-string-literal": true, "no-switch-case-fall-through": true, "no-trailing-whitespace": true, - "no-unused-expression": true, + "no-unused-expression": false, "no-use-before-declare": true, "no-var-keyword": false, "object-literal-sort-keys": true, diff --git a/yarn.lock b/yarn.lock index fcf8be56..cca747d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,16 +2,16 @@ # yarn lockfile v1 -"@types/chai@4.0.4": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.4.tgz#fe86315d9a66827feeb16f73bc954688ec950e18" - "@types/connect@*": version "3.4.31" resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.31.tgz#1f92d6b117ecc05076c49ecd024f7976e528bad9" dependencies: "@types/node" "*" +"@types/estree@0.0.39": + version "0.0.39" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" + "@types/meteor@1.4.14": version "1.4.14" resolved "https://registry.yarnpkg.com/@types/meteor/-/meteor-1.4.14.tgz#b4b14b2e2a98b20cf2bd03a28bffa52ba40b8be2" @@ -19,10 +19,6 @@ "@types/connect" "*" "@types/underscore" "*" -"@types/mocha@2.2.43": - version "2.2.43" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.43.tgz#03c54589c43ad048cbcbfd63999b55d0424eec27" - "@types/node@*": version "8.0.28" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.28.tgz#86206716f8d9251cf41692e384264cbd7058ad60" @@ -31,10 +27,6 @@ version "1.8.8" resolved "https://registry.yarnpkg.com/@types/underscore/-/underscore-1.8.8.tgz#510fe1ca5e7fa87fccd405b9a8b566d420bc3d1b" -"@types/underscore@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@types/underscore/-/underscore-1.8.3.tgz#d3cb512dd3dde32b2bbba4be0ca68bd3dad4a1f5" - JSONStream@^1.0.4: version "1.2.1" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.2.1.tgz#32aa5790e799481083b49b4b7fa94e23bae69bf9" @@ -1092,13 +1084,12 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rollup@0.49.3: - version "0.49.3" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.49.3.tgz#4cce32643dd8cf2154c69ff0e43470067db0adbf" - -rxjs-compat@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/rxjs-compat/-/rxjs-compat-6.0.0.tgz#2496403f74042d07899faeeac0bd703e4bce6710" +rollup@0.59.4: + version "0.59.4" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.59.4.tgz#6f80f7017c22667ff1bf3e62adf8624a44cc44aa" + dependencies: + "@types/estree" "0.0.39" + "@types/node" "*" rxjs@6.0.0: version "6.0.0"