diff --git a/.github/workflows/comment-issue.yml b/.github/workflows/comment-issue.yml new file mode 100644 index 00000000..f71d991e --- /dev/null +++ b/.github/workflows/comment-issue.yml @@ -0,0 +1,31 @@ +name: Add immediate comment on new issues + +on: + issues: + types: [opened] + +jobs: + createComment: + runs-on: ubuntu-latest + steps: + - name: Create Comment + uses: peter-evans/create-or-update-comment@v1.4.2 + with: + issue-number: ${{ github.event.issue.number }} + body: | + Thank you for submitting this issue! + + We, the Members of Meteor Community Packages take every issue seriously. + Our goal is to provide long-term lifecycles for packages and keep up + with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem. + + However, we contribute to these packages mostly in our free time. + Therefore, we can't guarantee you issues to be solved within certain time. + + If you think this issue is trivial to solve, don't hesitate to submit + a pull request, too! We will accompany you in the process with reviews and hints + on how to get development set up. + + Please also consider sponsoring the maintainers of the package. + If you don't know who is currently maintaining this package, just leave a comment + and we'll let you know diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 43988142..186e541c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,14 +7,14 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - meteor: [1.12.2, 2.6.1, 2.7.3] - redis-version: [4, 5, 6] + meteor: [1.12.2, 2.6.1, 2.7.3, 2.8.1, 2.12] + redis-version: [4, 5, 6, 7] steps: - uses: actions/checkout@v3 - name: Start Redis - uses: supercharge/redis-github-action@1.4.0 + uses: supercharge/redis-github-action@1.5.0 with: redis-version: ${{ matrix.redis-version }} diff --git a/.npm/package/npm-shrinkwrap.json b/.npm/package/npm-shrinkwrap.json index 9b02f5ba..c857ab9b 100644 --- a/.npm/package/npm-shrinkwrap.json +++ b/.npm/package/npm-shrinkwrap.json @@ -1,70 +1,40 @@ { "lockfileVersion": 1, "dependencies": { - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" - }, - "chai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", - "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==" - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" - }, - "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==" - }, "deep-extend": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.0.tgz", - "integrity": "sha1-bvSgmwX5iw41jW2T1Mo8rsZnKAM=" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" }, - "double-ended-queue": { - "version": "2.1.0-0", - "resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", - "integrity": "sha1-ED01J/0xUo9AGIEwyEHv3XgmTlw=" - }, - "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=" + "denque": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz", + "integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==" }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" - }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=" + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" }, "redis": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz", - "integrity": "sha512-M1OkonEQwtRmZv4tEWF2VgpG0JWJ8Fv1PhlgT5+B+uNq2cA3Rt1Yt/ryoR+vQNOQcIEgdCdfH0jr3bDpihAw1A==" + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz", + "integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==" }, "redis-commands": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.5.0.tgz", - "integrity": "sha512-6KxamqpZ468MeQC3bkWmCB1fp56XL64D4Kf0zJSwDZbVLLm7KFkoIcHrgRvQ+sk8dnhySs7+yBg94yIkAK7aJg==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", + "integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==" }, - "redis-parser": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-2.6.0.tgz", - "integrity": "sha1-Uu0J2srBCPGmMcB+m2mUHnoZUEs=" + "redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==" }, - "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==" + "redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==" } } } diff --git a/.versions b/.versions index 12ac1f34..4d450411 100644 --- a/.versions +++ b/.versions @@ -1,68 +1,67 @@ -accounts-base@2.2.4 -accounts-password@2.3.1 +accounts-base@2.2.8 +accounts-password@2.3.4 alanning:roles@3.4.0 aldeed:collection2@3.0.6 allow-deny@1.1.1 -babel-compiler@7.9.2 +babel-compiler@7.10.4 babel-runtime@1.5.1 base64@1.0.12 binary-heap@1.0.11 boilerplate-generator@1.7.1 -callback-hook@1.4.0 -check@1.3.1 -cultofcoders:redis-oplog@2.1.1 -ddp@1.4.0 -ddp-client@2.5.0 +callback-hook@1.5.1 +check@1.3.2 +cultofcoders:redis-oplog@2.2.0 +ddp@1.4.1 +ddp-client@2.6.1 ddp-common@1.4.0 -ddp-rate-limiter@1.1.0 -ddp-server@2.5.0 -diff-sequence@1.1.1 -dynamic-import@0.7.2 -ecmascript@0.16.2 -ecmascript-runtime@0.8.0 +ddp-rate-limiter@1.2.0 +ddp-server@2.6.1 +diff-sequence@1.1.2 +dynamic-import@0.7.3 +ecmascript@0.16.7 +ecmascript-runtime@0.8.1 ecmascript-runtime-client@0.12.1 ecmascript-runtime-server@0.11.0 -ejson@1.1.2 -email@2.2.1 -fetch@0.1.1 -geojson-utils@1.0.10 +ejson@1.1.3 +email@2.2.5 +fetch@0.1.3 +geojson-utils@1.0.11 id-map@1.1.1 inter-process-messaging@0.1.1 -local-test:cultofcoders:redis-oplog@2.1.1 +local-test:cultofcoders:redis-oplog@2.2.0 localstorage@1.2.0 -logging@1.3.1 +logging@1.3.2 matb33:collection-hooks@1.1.4 -meteor@1.10.0 +meteor@1.11.2 meteortesting:browser-tests@0.1.2 meteortesting:mocha@0.4.4 -minimongo@1.8.0 -modern-browsers@0.1.8 -modules@0.18.0 -modules-runtime@0.13.0 -mongo@1.15.0 +minimongo@1.9.3 +modern-browsers@0.1.9 +modules@0.19.0 +modules-runtime@0.13.1 +mongo@1.16.6 mongo-decimal@0.1.3 mongo-dev-server@1.1.0 mongo-id@1.0.8 natestrauser:publish-performant-counts@0.1.2 -npm-mongo@4.3.1 +npm-mongo@4.16.0 ordered-dict@1.1.0 practicalmeteor:mocha-core@1.0.1 -promise@0.12.0 +promise@0.12.2 raix:eventemitter@0.1.3 -random@1.2.0 -rate-limit@1.0.9 -react-fast-refresh@0.2.3 -reactive-var@1.0.11 +random@1.2.1 +rate-limit@1.1.1 +react-fast-refresh@0.2.7 +reactive-var@1.0.12 reload@1.3.1 retry@1.1.0 reywood:publish-composite@1.7.3 routepolicy@1.1.1 -service-configuration@1.3.0 sha@1.0.9 -socket-stream-client@0.5.0 +socket-stream-client@0.5.1 tmeasday:check-npm-versions@0.3.2 -tracker@1.2.0 -underscore@1.0.10 +tracker@1.3.2 +underscore@1.0.13 url@1.3.2 -webapp@1.13.1 -webapp-hashing@1.1.0 +webapp@1.13.5 +webapp-hashing@1.1.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d6e179..6aee7206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## CHANGELOG +### 2.2.0 +- Bumped minimum Meteor version to v1.12.2 +- Updated tests to cover from Meteor v1.12.2 to the latest v2.12 +- Added testing for Redis v7 +- Updated `node-redis` to v3.1.2 +- Updated `deep-extend` to v0.6.0 +- Fix update not returning number +- Fix SyntheticMutator not applying `globalRedisPrefix` + ### 2.1.1 - Fixes callback is not a function error when using SyntheticMutator.update diff --git a/README.md b/README.md index 3e8a670a..6589cb8b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ### LICENSE: MIT -[![Build Status](https://api.travis-ci.org/cult-of-coders/redis-oplog.svg?branch=master)](https://travis-ci.org/cult-of-coders/redis-oplog) [![Backers on Open Collective](https://opencollective.com/redis-oplog/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/redis-oplog/sponsors/badge.svg)](#sponsors) +[![Backers on Open Collective](https://opencollective.com/redis-oplog/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/redis-oplog/sponsors/badge.svg)](#sponsors) ## RedisOplog diff --git a/docs/failover.md b/docs/failover.md index 2d97dee0..ffa2a7b7 100644 --- a/docs/failover.md +++ b/docs/failover.md @@ -15,7 +15,7 @@ In order to configure these events, you can do it like this: // in a server-side file that is loaded on startup import { Config } from 'meteor/cultofcoders:redis-oplog'; -_.extend(Config.redisExtras.events, { +Object.assign(Config.redisExtras.events, { reconnect({delay, attempt, error}) { // put your logic here. }, @@ -30,4 +30,4 @@ _.extend(Config.redisExtras.events, { Since we have the logic of refreshing an observable collection, we can make it so it falls back to polling. But polling is very dangerous and very expensive, so we should avoid it at all costs, however this could be implemented and customized per collection, but honestly, your redis-server needs to have -high-availability, since it's a core component of your app. \ No newline at end of file +high-availability, since it's a core component of your app. diff --git a/docs/outside_mutations.md b/docs/outside_mutations.md index 9177b2c5..49203bc9 100644 --- a/docs/outside_mutations.md +++ b/docs/outside_mutations.md @@ -38,7 +38,7 @@ redis.publish('tasks', JSON.stringify({ You have to be careful, if in your app you subscribe by `_id`: ```js -return Task.find({_id: taskId}) +return Tasks.find({_id: taskId}) ``` In order for the processor to catch the event you have to send it to the `tasks::taskId` channel, where `taskId` represents the actual id inside MongoDB. @@ -47,7 +47,7 @@ So, if you have both types of publications, you have to publish it to both `task If you use namespaces, the channels also change: ```js -return Task.find({groupId}, { +return Tasks.find({groupId}, { namespace: `group::${groupId}` }) ``` @@ -57,7 +57,7 @@ you have to send it to both `group::groupId::tasks` and `tasks::taskId`, where ` Keep in mind, that namespaces don't affect direct query processing: ```js -return Task.find({_id: taskId}, { +return Tasks.find({_id: taskId}, { namespace: `group::${groupId}` }) ``` diff --git a/lib/cache/ObservableCollection.js b/lib/cache/ObservableCollection.js index 4118d3b1..127171df 100644 --- a/lib/cache/ObservableCollection.js +++ b/lib/cache/ObservableCollection.js @@ -99,7 +99,7 @@ export default class ObservableCollection { } if (fields) { - this.fieldsArray = _.keys(fields); + this.fieldsArray = Object.keys(fields); if (!_.isArray(this.fieldsArray)) { throw new Meteor.Error( @@ -156,7 +156,7 @@ export default class ObservableCollection { isEligibleByDB(_id) { if (this.matcher) { return !!this.collection.findOne( - _.extend({}, this.selector, { _id }), + Object.assign({}, this.selector, { _id }), { fields: { _id: 1 } } ); } @@ -326,7 +326,7 @@ export default class ObservableCollection { // if we have options, we surely have fields array let fieldsArray = this.fieldsArray.slice(); - if (_.keys(this.selector).length > 0) { + if (Object.keys(this.selector).length > 0) { fieldsArray = _.union( fieldsArray, extractFieldsFromFilters(this.selector) diff --git a/lib/cache/lib/extractFieldsFromFilters.js b/lib/cache/lib/extractFieldsFromFilters.js index ffe8bd2d..11b089f1 100644 --- a/lib/cache/lib/extractFieldsFromFilters.js +++ b/lib/cache/lib/extractFieldsFromFilters.js @@ -1,3 +1,5 @@ +import { _ } from 'meteor/underscore'; + const deepFilterFieldsArray = ['$and', '$or', '$nor']; const deepFilterFieldsObject = ['$not']; diff --git a/lib/cache/lib/getChannels.js b/lib/cache/lib/getChannels.js index d229fba1..659836c1 100644 --- a/lib/cache/lib/getChannels.js +++ b/lib/cache/lib/getChannels.js @@ -1,7 +1,6 @@ -import { _ } from 'meteor/underscore'; import getChannelName from '../../utils/getChannelName'; -export default (collectionName, {namespace, channel, namespaces, channels}) => { +export default (collectionName, {namespace, channel, namespaces, channels} = {}) => { let channelStrings = []; if (namespaces) { diff --git a/lib/cache/lib/getSnapbackFields.js b/lib/cache/lib/getSnapbackFields.js index 13182b55..8e113025 100644 --- a/lib/cache/lib/getSnapbackFields.js +++ b/lib/cache/lib/getSnapbackFields.js @@ -19,6 +19,6 @@ const isArray = (doc, parts) => { if (parts.length > 1) { return isArray(doc[parts[0]], parts.slice(1)); } else { - return _.isArray(doc[parts[0]]); + return Array.isArray(doc[parts[0]]); } -}; \ No newline at end of file +}; diff --git a/lib/init.js b/lib/init.js index 43122673..f56cd4e4 100644 --- a/lib/init.js +++ b/lib/init.js @@ -18,7 +18,7 @@ export default (config = {}) => { deepExtend(Config, config); - _.extend(Config, { + Object.assign(Config, { isInitialized: true, oldPublish: Meteor.publish, }); diff --git a/lib/mongo/Mutator.js b/lib/mongo/Mutator.js index 6bc8706c..dd96345a 100644 --- a/lib/mongo/Mutator.js +++ b/lib/mongo/Mutator.js @@ -1,3 +1,5 @@ +import { Meteor } from 'meteor/meteor'; +import { _ } from 'meteor/underscore'; import getMutationConfig from "./lib/getMutationConfig"; import getFields from "../utils/getFields"; import { @@ -152,7 +154,7 @@ export default class Mutator { Originals, selector, modifier, - _.extend({}, {_returnObject: false}, config), + Object.assign({}, {_returnObject: false}, config), callback, docIds, docs @@ -163,7 +165,7 @@ export default class Mutator { // we need the exact _ids // and we extend the selector, because if between finding the docIds and updating // another matching insert sneaked in, it's update will not be pushed - const updateSelector = _.extend({}, selector, { + const updateSelector = Object.assign({}, selector, { _id: { $in: docIds } }); @@ -238,7 +240,7 @@ export default class Mutator { this, selector, modifier, - _.extend({}, config, { _returnObject: true }) + Object.assign({}, config, { _returnObject: true }) ); if (callback) { @@ -250,7 +252,7 @@ export default class Mutator { if (config.pushToRedis) { if (data.insertedId) { - doc = { + let doc = { _id: data.insertedId }; @@ -333,7 +335,7 @@ export default class Mutator { ); } - const removeSelector = _.extend({}, selector); + const removeSelector = Object.assign({}, selector); const removeOptions = { fields: { _id: 1 }, transform: null diff --git a/lib/mongo/ObserveMultiplex.js b/lib/mongo/ObserveMultiplex.js index 7a086974..53e0c103 100644 --- a/lib/mongo/ObserveMultiplex.js +++ b/lib/mongo/ObserveMultiplex.js @@ -2,6 +2,7 @@ // This code is MIT and licensed to Meteor. import { Meteor } from 'meteor/meteor'; +import { _ } from 'meteor/underscore'; import { LocalCollection } from 'meteor/minimongo'; import OptimisticInvocation from './OptimisticInvocation'; @@ -40,7 +41,7 @@ export function ObserveMultiplexer(options) { }); } -_.extend(ObserveMultiplexer.prototype, { +Object.assign(ObserveMultiplexer.prototype, { addHandleAndSendInitialAdds: function(handle) { var self = this; @@ -212,7 +213,7 @@ _.extend(ObserveMultiplexer.prototype, { // can continue until these are done. (But we do have to be careful to not // use a handle that got removed, because removeHandle does not use the // queue; thus, we iterate over an array of keys that we control.) - _.each(_.keys(self._handles), function(handleId) { + Object.keys(self._handles).forEach(function(handleId) { var handle = self._handles && self._handles[handleId]; if (!handle) return; var callback = handle['_' + callbackName]; diff --git a/lib/mongo/PollingObserveDriver.js b/lib/mongo/PollingObserveDriver.js index 1271079f..f2a6f1d0 100644 --- a/lib/mongo/PollingObserveDriver.js +++ b/lib/mongo/PollingObserveDriver.js @@ -1,3 +1,4 @@ +import { _ } from 'meteor/underscore'; import { LocalCollection } from 'meteor/minimongo'; function listenAll(cursorDescription, listenCallback) { @@ -28,7 +29,7 @@ function forEachTrigger(cursorDescription, triggerCallback) { if (specificIds) { _.each(specificIds, function(id) { triggerCallback( - _.extend( + Object.assign( { id: id, }, @@ -38,7 +39,7 @@ function forEachTrigger(cursorDescription, triggerCallback) { }); triggerCallback( - _.extend( + Object.assign( { dropCollection: true, id: null, @@ -141,7 +142,7 @@ export default function PollingObserveDriver(options) { ); } -_.extend(PollingObserveDriver.prototype, { +Object.assign(PollingObserveDriver.prototype, { // This is always called through _.throttle (except once at startup). _unthrottledEnsurePollIsScheduled: function() { var self = this; diff --git a/lib/mongo/RedisOplogObserveDriver.js b/lib/mongo/RedisOplogObserveDriver.js index 97b45cbb..11f45d99 100644 --- a/lib/mongo/RedisOplogObserveDriver.js +++ b/lib/mongo/RedisOplogObserveDriver.js @@ -46,7 +46,7 @@ export default class RedisOplogObserveDriver { let oc = this.observableCollection; if (oc.selector._id) { oc.__containsOtherSelectorsThanId = - _.keys(oc.selector).length > 1; + Object.keys(oc.selector).length > 1; } } diff --git a/lib/mongo/SyntheticMutator.js b/lib/mongo/SyntheticMutator.js index cd32fc7e..5d2c9730 100644 --- a/lib/mongo/SyntheticMutator.js +++ b/lib/mongo/SyntheticMutator.js @@ -5,6 +5,8 @@ import { EJSON } from 'meteor/ejson'; import getFields from '../utils/getFields'; import { Events, RedisPipe } from '../constants'; import containsOperators from '../mongo/lib/containsOperators'; +import getChannels from '../cache/lib/getChannels'; +import getDedicatedChannel from '../utils/getDedicatedChannel'; /** * call(Mongo.Collection).insert(data) @@ -89,12 +91,12 @@ export default class SyntheticMutator { * @private */ static _extractChannels(channels, _id) { - if (!_.isArray(channels)) { + if (!Array.isArray(channels)) { if (channels instanceof Mongo.Collection) { const name = channels._name; - channels = [name]; + channels = getChannels(name); if (_id) { - channels.push(`${name}::${_id}`); + channels.push(getDedicatedChannel(name, _id)); } } else { channels = [channels]; diff --git a/lib/mongo/allow-deny/docToValidate.js b/lib/mongo/allow-deny/docToValidate.js index 517d95a3..2636685f 100644 --- a/lib/mongo/allow-deny/docToValidate.js +++ b/lib/mongo/allow-deny/docToValidate.js @@ -1,4 +1,4 @@ -import {EJSON} from 'meteor/ejson' +import { EJSON } from 'meteor/ejson' export default function docToValidate(validator, doc, generatedId) { let ret = doc diff --git a/lib/mongo/allow-deny/validatedInsert.js b/lib/mongo/allow-deny/validatedInsert.js index 5ec2da30..ed7a8df3 100644 --- a/lib/mongo/allow-deny/validatedInsert.js +++ b/lib/mongo/allow-deny/validatedInsert.js @@ -1,5 +1,5 @@ -import {Meteor} from 'meteor/meteor' -import {_} from 'meteor/underscore' +import { Meteor } from 'meteor/meteor' +import { _ } from 'meteor/underscore' import docToValidate from './docToValidate' export default function validatedInsert(userId, doc, generatedId) { diff --git a/lib/mongo/allow-deny/validatedRemove.js b/lib/mongo/allow-deny/validatedRemove.js index 6da505d6..f325b795 100644 --- a/lib/mongo/allow-deny/validatedRemove.js +++ b/lib/mongo/allow-deny/validatedRemove.js @@ -1,6 +1,6 @@ /* eslint no-param-reassign: 0 no-underscore-dangle: 0 */ -import {Meteor} from 'meteor/meteor' -import {_} from 'meteor/underscore' +import { Meteor } from 'meteor/meteor' +import { _ } from 'meteor/underscore' import transformDoc from './transformDoc' export default function validatedRemove(userId, selector) { diff --git a/lib/mongo/allow-deny/validatedUpdate.js b/lib/mongo/allow-deny/validatedUpdate.js index 2fbe9691..35f5f1e2 100644 --- a/lib/mongo/allow-deny/validatedUpdate.js +++ b/lib/mongo/allow-deny/validatedUpdate.js @@ -65,7 +65,7 @@ export default function validatedUpdate(userId, selector, mutator, options) { `Access denied. Operator ${op} not allowed in a restricted collection.` ); } else { - _.each(_.keys(params), field => { + Object.keys(params).forEach(field => { // treat dotted fields as if they are replacing their // top-level part if (field.indexOf('.') !== -1) { @@ -73,7 +73,7 @@ export default function validatedUpdate(userId, selector, mutator, options) { } // record the field we are trying to change - if (!_.contains(fields, field)) { + if (!fields.includes(field)) { fields.push(field); } }); @@ -126,7 +126,7 @@ export default function validatedUpdate(userId, selector, mutator, options) { this.update( selector, mutator, - _.extend(options, { + Object.assign(options, { optimistic: true, }) ); diff --git a/lib/mongo/extendMongoCollection.js b/lib/mongo/extendMongoCollection.js index b9bc6e20..15b84dc1 100644 --- a/lib/mongo/extendMongoCollection.js +++ b/lib/mongo/extendMongoCollection.js @@ -19,7 +19,7 @@ export default () => { extendObserveChanges(); - _.extend(Mongo.Collection.prototype, { + Object.assign(Mongo.Collection.prototype, { /** * @param data * @param config diff --git a/lib/mongo/extendObserveChanges.js b/lib/mongo/extendObserveChanges.js index c9f1d571..c3966ea2 100644 --- a/lib/mongo/extendObserveChanges.js +++ b/lib/mongo/extendObserveChanges.js @@ -1,10 +1,7 @@ -import { DDP } from 'meteor/ddp'; -import { Mongo, MongoInternals } from 'meteor/mongo'; -import { LocalCollection } from 'meteor/minimongo'; -import { Random } from 'meteor/random'; +import { MongoInternals } from 'meteor/mongo'; import observeChanges from './observeChanges'; -const MongoCursor = Object.getPrototypeOf( +export const MongoCursor = Object.getPrototypeOf( MongoInternals.defaultRemoteCollectionDriver().mongo.find() ).constructor; diff --git a/lib/mongo/lib/getMutationConfig.js b/lib/mongo/lib/getMutationConfig.js index 467b5ebe..0a3cb78a 100644 --- a/lib/mongo/lib/getMutationConfig.js +++ b/lib/mongo/lib/getMutationConfig.js @@ -24,7 +24,7 @@ export default function (collection, _config, mutationObject) { defaultOverrides.optimistic = false; } - let config = _.extend({}, Config.mutationDefaults, defaultOverrides, _config); + let config = Object.assign({}, Config.mutationDefaults, defaultOverrides, _config); if (collection._redisOplog) { const {mutation} = collection._redisOplog; diff --git a/lib/mongo/mongoCollectionNames.js b/lib/mongo/mongoCollectionNames.js index 99a4d823..1a6cea6b 100644 --- a/lib/mongo/mongoCollectionNames.js +++ b/lib/mongo/mongoCollectionNames.js @@ -4,7 +4,7 @@ const constructor = Mongo.Collection; const proto = Mongo.Collection.prototype; const hook = function() { - var ret = constructor.apply(this, arguments); + let ret = constructor.apply(this, arguments); map[arguments[0]] = this; return ret; }; @@ -16,7 +16,7 @@ hook.__getCollectionByName = function (name) { hook.prototype = proto; hook.prototype.constructor = hook; -for (var prop in constructor) { +for (let prop in constructor) { if (constructor.hasOwnProperty(prop)) { hook[prop] = constructor[prop]; } diff --git a/lib/mongo/observeChanges.js b/lib/mongo/observeChanges.js index 159b47de..84a15781 100644 --- a/lib/mongo/observeChanges.js +++ b/lib/mongo/observeChanges.js @@ -1,13 +1,12 @@ // This code was started based on meteor/meteor github repository // This code is MIT and licensed to Meteor. - +import { _ } from 'meteor/underscore'; import RedisOplogObserveDriver from './RedisOplogObserveDriver'; -import { MongoInternals } from 'meteor/mongo'; import { ObserveMultiplexer, ObserveHandle } from './ObserveMultiplex'; import PollingObserveDriver from './PollingObserveDriver'; export default function(cursorDescription, ordered, callbacks) { - var self = this; + const self = this; if (cursorDescription.options.tailable) { return self._observeChangesTailable( cursorDescription, @@ -19,7 +18,7 @@ export default function(cursorDescription, ordered, callbacks) { // You may not filter out _id when observing changes, because the id is a core // part of the observeChanges API. - var fields = cursorDescription.options.projection || cursorDescription.options.fields; + const fields = cursorDescription.options.projection || cursorDescription.options.fields; if ( fields && @@ -29,7 +28,7 @@ export default function(cursorDescription, ordered, callbacks) { } var observeKey = EJSON.stringify( - _.extend( + Object.assign( { ordered: ordered, }, diff --git a/lib/processors/actions/reload.js b/lib/processors/actions/reload.js index 2105404a..49f9a305 100644 --- a/lib/processors/actions/reload.js +++ b/lib/processors/actions/reload.js @@ -1,4 +1,4 @@ -import {_} from 'meteor/underscore'; +import { _ } from 'meteor/underscore'; import { MongoIDMap } from '../../cache/mongoIdMap'; /** @@ -17,7 +17,7 @@ export default function (observableCollection) { store.compareWith(newStore, { both(docId, oldDoc, newDoc) { - const modifiedFields = _.union(_.keys(oldDoc), _.keys(newDoc)); + const modifiedFields = _.union(Object.keys(oldDoc), Object.keys(newDoc)); observableCollection.change(newDoc, modifiedFields); }, leftOnly(docId) { diff --git a/lib/processors/actions/requery.js b/lib/processors/actions/requery.js index e23b311e..78b00f25 100644 --- a/lib/processors/actions/requery.js +++ b/lib/processors/actions/requery.js @@ -1,4 +1,3 @@ -import { _ } from 'meteor/underscore'; import { EJSON } from 'meteor/ejson'; import { Events } from '../../constants'; import { MongoIDMap } from '../../cache/mongoIdMap'; diff --git a/lib/processors/getStrategy.js b/lib/processors/getStrategy.js index f99724d3..6170e3b1 100644 --- a/lib/processors/getStrategy.js +++ b/lib/processors/getStrategy.js @@ -1,5 +1,4 @@ import { Strategy } from '../constants'; -import { _ } from 'meteor/underscore'; /** * @param selector @@ -21,4 +20,4 @@ export default function getStrategy(selector = {}, options = {}) { } return Strategy.DEFAULT; -} \ No newline at end of file +} diff --git a/lib/processors/lib/fieldsExist.js b/lib/processors/lib/fieldsExist.js index cbf313ad..f96ee43a 100644 --- a/lib/processors/lib/fieldsExist.js +++ b/lib/processors/lib/fieldsExist.js @@ -1,11 +1,9 @@ -import { _ } from 'meteor/underscore'; - /** * @param fieldsObject {Object} {"profile.firstName": 1, "roles": 1, "something": 1 } * @param fieldsArray {Array} ["profile", "roles.xx", "something" ] */ export function hasSortFields(fieldsObject, fieldsArray) { - const existingFields = _.keys(fieldsObject); + const existingFields = Object.keys(fieldsObject); for (let i = 0 ; i < fieldsArray.length ; i++) { const field = fieldsArray[i]; @@ -21,4 +19,4 @@ export function hasSortFields(fieldsObject, fieldsArray) { } return false; -} \ No newline at end of file +} diff --git a/lib/redis/RedisSubscriber.js b/lib/redis/RedisSubscriber.js index e2791ea7..8e10348f 100644 --- a/lib/redis/RedisSubscriber.js +++ b/lib/redis/RedisSubscriber.js @@ -1,6 +1,5 @@ import { Strategy } from '../constants'; import { getProcessor } from '../processors'; -import { _ } from 'meteor/underscore'; import { Meteor } from 'meteor/meteor'; import extractIdsFromSelector from '../utils/extractIdsFromSelector'; import RedisSubscriptionManager from './RedisSubscriptionManager'; diff --git a/lib/redis/RedisSubscriptionManager.js b/lib/redis/RedisSubscriptionManager.js index 5ced6f27..08aa1131 100644 --- a/lib/redis/RedisSubscriptionManager.js +++ b/lib/redis/RedisSubscriptionManager.js @@ -24,7 +24,7 @@ class RedisSubscriptionManager { */ getAllRedisSubscribers() { let redisSubscribers = []; - for (channel in this.store) { + for (let channel in this.store) { this.store[channel].forEach(_redisSubscriber => redisSubscribers.push(_redisSubscriber) ); diff --git a/lib/redis/getRedisClient.js b/lib/redis/getRedisClient.js index 4bf2ecad..cda5a07c 100644 --- a/lib/redis/getRedisClient.js +++ b/lib/redis/getRedisClient.js @@ -1,7 +1,6 @@ import redis from 'redis'; import Config from '../config'; -import { _ } from 'meteor/underscore'; -import {Meteor} from 'meteor/meteor'; +import { Meteor } from 'meteor/meteor'; // Redis requires two connections for pushing and listening to data let redisPusher; @@ -14,7 +13,7 @@ let redisListener; */ export function getRedisPusher() { if (!redisPusher) { - redisPusher = redis.createClient(_.extend({}, Config.redis, { + redisPusher = redis.createClient(Object.assign({}, Config.redis, { retry_strategy: getRetryStrategy() })); } @@ -30,7 +29,7 @@ export function getRedisPusher() { */ export function getRedisListener({onConnect} = {}) { if (!redisListener) { - redisListener = redis.createClient(_.extend({}, Config.redis, { + redisListener = redis.createClient(Object.assign({}, Config.redis, { retry_strategy: getRetryStrategy() })); @@ -71,4 +70,4 @@ function getRetryStrategy() { return Config.redisExtras.retry_strategy(...args); } } -} \ No newline at end of file +} diff --git a/lib/utils/getFields.js b/lib/utils/getFields.js index ffec25ae..2457c0c7 100644 --- a/lib/utils/getFields.js +++ b/lib/utils/getFields.js @@ -1,7 +1,5 @@ -import { _ } from 'meteor/underscore'; - /** - * Taken from: https://github.com/matb33/meteor-collection-hooks/blob/master/collection-hooks.js#L198 and modified. + * Taken from: https://github.com/Meteor-Community-Packages/meteor-collection-hooks/blob/master/collection-hooks.js#L194 and modified. * @param mutator */ export default function getFields(mutator) { @@ -9,11 +7,11 @@ export default function getFields(mutator) { var fields = []; var topLevelFields = []; - _.each(mutator, function (params, op) { + Object.entries(mutator).forEach(function ([op, params]) { if (op[0] == '$') { - _.each(_.keys(params), function (field) { + Object.keys(params).forEach(function (field) { // record the field we are trying to change - if (!_.contains(fields, field)) { + if (!fields.includes(field)) { // fields.push(field); // topLevelFields.push(field.split('.')[0]); diff --git a/lib/utils/shouldPublicationBeWithPolling.js b/lib/utils/shouldPublicationBeWithPolling.js index 5ffec9e1..b76e507a 100644 --- a/lib/utils/shouldPublicationBeWithPolling.js +++ b/lib/utils/shouldPublicationBeWithPolling.js @@ -1,4 +1,5 @@ import { Meteor } from 'meteor/meteor'; +import { _ } from 'meteor/underscore'; export default function(cursors) { let isDisabledOplog = undefined; diff --git a/lib/vent/Vent.js b/lib/vent/Vent.js index 5ed7aaa6..8e5d5c6e 100644 --- a/lib/vent/Vent.js +++ b/lib/vent/Vent.js @@ -1,7 +1,6 @@ -import {getRedisListener, getRedisPusher} from '../redis/getRedisClient'; -import {VentConstants} from '../constants'; -import {Meteor} from 'meteor/meteor'; -import {Random} from 'meteor/random'; +import { VentConstants } from '../constants'; +import { Meteor } from 'meteor/meteor'; +import { _ } from 'meteor/underscore'; import Config from '../config'; // TODO: diff --git a/lib/vent/VentClient.js b/lib/vent/VentClient.js index c2e57437..21304d84 100644 --- a/lib/vent/VentClient.js +++ b/lib/vent/VentClient.js @@ -1,6 +1,6 @@ -import {VentConstants} from '../constants'; -import {Random} from 'meteor/random'; -import {DDPCommon} from 'meteor/ddp-common'; +import { VentConstants } from '../constants'; +import { Random } from 'meteor/random'; +import { DDPCommon } from 'meteor/ddp-common'; /** * Handles vents inside Meteor @@ -104,4 +104,4 @@ class VentClientSubscription { } } -} \ No newline at end of file +} diff --git a/package.js b/package.js index 1272c84c..4e03a69e 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'cultofcoders:redis-oplog', - version: '2.1.1', + version: '2.2.0', // Brief, one-line summary of the package. summary: "Replacement for Meteor's MongoDB oplog implementation", // URL to the Git repository containing the source code for this package. @@ -11,13 +11,13 @@ Package.describe({ }); Npm.depends({ - redis: '2.8.0', - 'deep-extend': '0.5.0', + redis: '3.1.2', + 'deep-extend': '0.6.0', 'lodash.clonedeep': '4.5.0' }); Package.onUse(function(api) { - api.versionsFrom('1.5.1'); + api.versionsFrom(['1.12.2', '2.8.1', '2.12']); api.use([ 'underscore', 'ecmascript', diff --git a/testing/accounts/client.js b/testing/accounts/client.js index 762624f1..311a2aef 100644 --- a/testing/accounts/client.js +++ b/testing/accounts/client.js @@ -1,6 +1,5 @@ import { assert } from 'chai'; -import {Meteor} from 'meteor/meteor'; -import { DDP } from 'meteor/ddp-client'; +import { Meteor } from 'meteor/meteor'; describe('Testing accounts functionality', function () { it('Should properly subscribe and login', function (done) { diff --git a/testing/accounts/server.js b/testing/accounts/server.js index 91e90038..ea3922e1 100644 --- a/testing/accounts/server.js +++ b/testing/accounts/server.js @@ -1,4 +1,8 @@ import { Accounts } from 'meteor/accounts-base'; +import { Random } from 'meteor/random'; +import { Meteor } from 'meteor/meteor' +import { Roles } from 'meteor/alanning:roles' + // import { UserPresence } from 'meteor/socialize:user-presence'; // UserPresence.onCleanup(function(){ diff --git a/testing/boot.js b/testing/boot.js index d6b70de5..b68373c7 100644 --- a/testing/boot.js +++ b/testing/boot.js @@ -64,18 +64,18 @@ if (Meteor.isServer) { filters, options ) { - return Collection.find(filters, _.extend({}, options, opts[key])); + return Collection.find(filters, Object.assign({}, options, opts[key])); }); Meteor.methods({ [`create.${config[key].suffix}`](item, options = {}) { if (_.isArray(item)) { return _.map(item, i => - Collection.insert(i, _.extend(options, opts[key])) + Collection.insert(i, Object.assign(options, opts[key])) ); } - return Collection.insert(item, _.extend(options, opts[key])); + return Collection.insert(item, Object.assign(options, opts[key])); }, [`fetch.${config[key].suffix}`](selector = {}, options = {}) { return Collection.find(selector, options).fetch(); @@ -84,20 +84,20 @@ if (Meteor.isServer) { return Collection.update( selectors, modifier, - _.extend({}, opts[key], options) + Object.assign({}, opts[key], options) ); }, [`upsert.${config[key].suffix}`](selectors, modifier, options) { return Collection.upsert( selectors, modifier, - _.extend({}, opts[key], options) + Object.assign({}, opts[key], options) ); }, [`remove.${config[key].suffix}`](selectors, options = {}) { return Collection.remove( selectors, - _.extend(options, opts[key]) + Object.assign(options, opts[key]) ); }, [`synthetic.${config[key].suffix}`]( diff --git a/testing/collection-defaults/client.js b/testing/collection-defaults/client.js index 2c775500..b6895240 100644 --- a/testing/collection-defaults/client.js +++ b/testing/collection-defaults/client.js @@ -1,6 +1,5 @@ import { assert } from 'chai'; import { Items } from './collections'; -import { _ } from 'meteor/underscore'; import { waitForHandleToBeReady, callWithPromise } from '../lib/sync_utils'; import { Random } from 'meteor/random'; diff --git a/testing/collection-defaults/collections.js b/testing/collection-defaults/collections.js index 918c4d04..c68b6117 100644 --- a/testing/collection-defaults/collections.js +++ b/testing/collection-defaults/collections.js @@ -1,5 +1,7 @@ +import { Mongo } from 'meteor/mongo' + const Items = new Mongo.Collection('collection_defaults_items'); export { Items -} \ No newline at end of file +} diff --git a/testing/collection-defaults/server.js b/testing/collection-defaults/server.js index a7b4b897..39283747 100644 --- a/testing/collection-defaults/server.js +++ b/testing/collection-defaults/server.js @@ -1,3 +1,4 @@ +import { Meteor } from 'meteor/meteor' import { Items } from './collections'; if (Meteor.isServer) { diff --git a/testing/custom-publications/client.js b/testing/custom-publications/client.js index 7a24e8af..230624fc 100644 --- a/testing/custom-publications/client.js +++ b/testing/custom-publications/client.js @@ -1,7 +1,7 @@ import { assert } from 'chai'; -import {Items} from './collections'; -import {Meteor} from 'meteor/meteor'; -import {Counter} from 'meteor/natestrauser:publish-performant-counts' +import { Items } from './collections'; +import { Meteor } from 'meteor/meteor'; +// import {Counter} from 'meteor/natestrauser:publish-performant-counts' describe('Testing custom publications functionality', function () { it('Should be able to retrieve the correct number', function (done) { diff --git a/testing/custom-publications/collections.js b/testing/custom-publications/collections.js index 78979234..f985b16c 100644 --- a/testing/custom-publications/collections.js +++ b/testing/custom-publications/collections.js @@ -1,4 +1,4 @@ -import {Mongo} from 'meteor/mongo'; +import { Mongo } from 'meteor/mongo'; const Items = new Mongo.Collection('custom_publication_items'); diff --git a/testing/custom-publications/server.js b/testing/custom-publications/server.js index 29775f1e..584d474b 100644 --- a/testing/custom-publications/server.js +++ b/testing/custom-publications/server.js @@ -1,4 +1,5 @@ -import {Items} from './collections'; +import { Meteor } from 'meteor/meteor'; +import { Items } from './collections'; Meteor.publish('custom_publications', function () { const cursor = Items.find(); @@ -17,4 +18,4 @@ Meteor.methods({ Items.insert({name: 'Item 2'}); Items.insert({name: 'Item 3'}); } -}); \ No newline at end of file +}); diff --git a/testing/lib/helpers.js b/testing/lib/helpers.js index 847573fc..d52fc836 100644 --- a/testing/lib/helpers.js +++ b/testing/lib/helpers.js @@ -1,4 +1,5 @@ -import {waitForHandleToBeReady, callWithPromise} from './sync_utils'; +import { Meteor } from 'meteor/meteor'; +import { waitForHandleToBeReady, callWithPromise } from './sync_utils'; export default (suffix) => { const create = (...args) => { @@ -69,4 +70,4 @@ export default (suffix) => { syntheticSync, waitForHandleToBeReady } -} \ No newline at end of file +} diff --git a/testing/lib/sync_utils.js b/testing/lib/sync_utils.js index 9fe776d9..bcb98d7f 100644 --- a/testing/lib/sync_utils.js +++ b/testing/lib/sync_utils.js @@ -1,3 +1,6 @@ +import { Meteor } from 'meteor/meteor'; +import { Tracker } from 'meteor/tracker'; + const callWithPromise = (method, ...args) => { return new Promise((resolve, reject) => { Meteor.call(method, ...args, (err, res) => { @@ -22,4 +25,4 @@ const waitForHandleToBeReady = handle => { }); }; -export { callWithPromise, waitForHandleToBeReady }; \ No newline at end of file +export { callWithPromise, waitForHandleToBeReady }; diff --git a/testing/main.client.js b/testing/main.client.js index 61f5f662..7ce6b9d0 100644 --- a/testing/main.client.js +++ b/testing/main.client.js @@ -165,8 +165,8 @@ _.each(Collections, (Collection, key) => { assert.equal(doc.nested.c.b, 1); assert.equal(doc.nested.c.a, 1); assert.equal(doc.nested.d, 1); - assert.lengthOf(_.keys(doc), 1); - assert.lengthOf(_.keys(doc.nested), 4); + assert.lengthOf(Object.keys(doc), 1); + assert.lengthOf(Object.keys(doc.nested), 4); remove({ _id: docId }, () => { done(); @@ -355,7 +355,7 @@ _.each(Collections, (Collection, key) => { changed(docId, doc) { assert.equal(docId, _id); doc.bom.forEach(element => { - assert.isTrue(_.keys(element).length === 2); + assert.isTrue(Object.keys(element).length === 2); if (element.stockId === 1) { assert.equal(element.quantity, 30); } else { @@ -1100,7 +1100,7 @@ _.each(Collections, (Collection, key) => { const observer = cursor.observeChanges({ added(docId, doc) { assert.isUndefined(doc.something); - assert.isTrue(_.keys(doc).length == 1); + assert.isTrue(Object.keys(doc).length == 1); update( { _id: docId }, { @@ -1399,4 +1399,4 @@ _.each(Collections, (Collection, key) => { }); }); }); -}); \ No newline at end of file +}); diff --git a/testing/object-id/server.js b/testing/object-id/server.js index d5dd0ae3..afb62664 100644 --- a/testing/object-id/server.js +++ b/testing/object-id/server.js @@ -1,3 +1,4 @@ +import { Meteor } from 'meteor/meteor'; import { SmartIds } from './collections'; Meteor.publish('smart_ids', function(filters = {}) { diff --git a/testing/optimistic-ui/boot.js b/testing/optimistic-ui/boot.js index d3066847..cfb963da 100644 --- a/testing/optimistic-ui/boot.js +++ b/testing/optimistic-ui/boot.js @@ -1,3 +1,4 @@ +import { Meteor } from 'meteor/meteor'; import { Items } from './collections'; if (Meteor.isServer) { diff --git a/testing/optimistic-ui/client.test.js b/testing/optimistic-ui/client.test.js index 2480e25d..f4f5b15e 100644 --- a/testing/optimistic-ui/client.test.js +++ b/testing/optimistic-ui/client.test.js @@ -1,6 +1,6 @@ +import { Meteor } from 'meteor/meteor'; import { assert } from 'chai'; import { Items } from './collections'; -import { _ } from 'meteor/underscore'; import { waitForHandleToBeReady, callWithPromise } from '../lib/sync_utils'; import { Random } from 'meteor/random'; import './boot'; @@ -26,7 +26,7 @@ describe('Optimistic UI', () => { } assert.lengthOf(doc.liked, 2); - assert.isTrue(_.contains(doc.liked, 'XXX')); + assert.isTrue(doc.liked.includes('XXX')); setTimeout(() => { handle.stop(); @@ -36,7 +36,7 @@ describe('Optimistic UI', () => { }, }); - const item = _.first(cursor.fetch()); + const item = cursor.fetch()[0]; assert.isObject(item); Meteor.call('optimistic_ui.items.update', item._id, { @@ -69,7 +69,7 @@ describe('Optimistic UI', () => { } assert.lengthOf(doc.liked, 2); - assert.isTrue(_.contains(doc.liked, 'XXX')); + assert.isTrue(doc.liked.includes('XXX')); setTimeout(() => { handle.stop(); @@ -79,7 +79,7 @@ describe('Optimistic UI', () => { }, }); - const item = _.first(cursor.fetch()); + const item = cursor.fetch()[0]; assert.isObject(item); Items.update(item._id, { @@ -89,4 +89,4 @@ describe('Optimistic UI', () => { }); }); }); -}); \ No newline at end of file +}); diff --git a/testing/optimistic-ui/collections.js b/testing/optimistic-ui/collections.js index 8da4e384..7649fe26 100644 --- a/testing/optimistic-ui/collections.js +++ b/testing/optimistic-ui/collections.js @@ -1,5 +1,7 @@ +import { Mongo } from 'meteor/mongo'; + const Items = new Mongo.Collection('optimistic_ui_items'); export { Items -} \ No newline at end of file +} diff --git a/testing/polling/server.js b/testing/polling/server.js index bbc6f061..09a23a11 100644 --- a/testing/polling/server.js +++ b/testing/polling/server.js @@ -1,3 +1,4 @@ +import { Meteor } from 'meteor/meteor'; import { Campaigns } from './collections'; Meteor.publish('campaign_search', function(search, pollingIntervalMs = 100) { diff --git a/testing/publish-counts/client.js b/testing/publish-counts/client.js index dcb613a1..b2124100 100644 --- a/testing/publish-counts/client.js +++ b/testing/publish-counts/client.js @@ -1,5 +1,4 @@ import { assert } from 'chai'; -import {Items} from './collections'; import {Meteor} from 'meteor/meteor'; import {Counter} from 'meteor/natestrauser:publish-performant-counts' diff --git a/testing/publish-counts/collections.js b/testing/publish-counts/collections.js index a918f9a9..d6aaa6ce 100644 --- a/testing/publish-counts/collections.js +++ b/testing/publish-counts/collections.js @@ -1,5 +1,3 @@ -import {Mongo} from 'meteor/mongo'; +import { Mongo } from 'meteor/mongo'; -const Items = new Mongo.Collection('performant_counts_items'); - -export {Items} +export const Items = new Mongo.Collection('performant_counts_items'); diff --git a/testing/publish-counts/server.js b/testing/publish-counts/server.js index 1b217eda..2ac113b3 100644 --- a/testing/publish-counts/server.js +++ b/testing/publish-counts/server.js @@ -1,5 +1,6 @@ +import { Meteor } from 'meteor/meteor'; import { Counter } from 'meteor/natestrauser:publish-performant-counts' -import {Items} from './collections'; +import { Items } from './collections'; Meteor.publish('performant_counts', function () { return new Counter( @@ -20,4 +21,4 @@ Meteor.methods({ 'performant_counts_add'() { Items.insert({name: 'Item'}); } -}); \ No newline at end of file +}); diff --git a/testing/publishComposite/boot.js b/testing/publishComposite/boot.js index f43c64fb..3f57b224 100644 --- a/testing/publishComposite/boot.js +++ b/testing/publishComposite/boot.js @@ -1,3 +1,4 @@ +import { Meteor } from 'meteor/meteor'; import { Items, Children } from './collections'; import loadFixtures from './loadFixtures'; @@ -50,4 +51,4 @@ Meteor.methods({ 'publish_composite.children.remove'(...args) { return Children.remove(...args) } -}); \ No newline at end of file +}); diff --git a/testing/publishComposite/client.test.js b/testing/publishComposite/client.test.js index 4342bdbf..c50ff43b 100644 --- a/testing/publishComposite/client.test.js +++ b/testing/publishComposite/client.test.js @@ -1,6 +1,6 @@ +import { Meteor } from 'meteor/meteor'; import { assert } from 'chai'; import { Items, Children } from './collections'; -import { _ } from 'meteor/underscore'; import { waitForHandleToBeReady, callWithPromise } from '../lib/sync_utils'; describe('Publish Composite', () => { @@ -21,7 +21,7 @@ describe('Publish Composite', () => { } }); - const item = _.first(cursor.fetch()); + const item = cursor.fetch()[0]; assert.isObject(item); const childCursor = Children.find({ itemId: item._id }); @@ -41,4 +41,4 @@ describe('Publish Composite', () => { }); }); }) -}); \ No newline at end of file +}); diff --git a/testing/publishComposite/collections.js b/testing/publishComposite/collections.js index 8115835f..6c1619a3 100644 --- a/testing/publishComposite/collections.js +++ b/testing/publishComposite/collections.js @@ -1,7 +1,9 @@ +import { Mongo } from 'meteor/mongo'; + const Items = new Mongo.Collection('publish_composition'); const Children = new Mongo.Collection('publish_composition_children'); export { Items, Children -} \ No newline at end of file +} diff --git a/testing/publishComposite/loadFixtures.js b/testing/publishComposite/loadFixtures.js index ff8eba22..f7428877 100644 --- a/testing/publishComposite/loadFixtures.js +++ b/testing/publishComposite/loadFixtures.js @@ -1,4 +1,4 @@ -import {Items, Children} from './collections'; +import { Items, Children } from './collections'; const ITEMS = 5; const CHILDREN_PER_ITEM = 5; diff --git a/testing/server-autorun/client.js b/testing/server-autorun/client.js index 9c968655..4d5610fd 100644 --- a/testing/server-autorun/client.js +++ b/testing/server-autorun/client.js @@ -1,6 +1,6 @@ import { assert } from 'chai'; -import {Orders, Items} from './collections'; -import {Meteor} from 'meteor/meteor'; +import { Orders, Items } from './collections'; +import { Meteor } from 'meteor/meteor'; describe('Testing autorun functionality', function () { it('Should be able to subscribe', function (done) { diff --git a/testing/server-autorun/collections.js b/testing/server-autorun/collections.js index 9c10c885..91a27020 100644 --- a/testing/server-autorun/collections.js +++ b/testing/server-autorun/collections.js @@ -1,6 +1,4 @@ -import {Mongo} from 'meteor/mongo'; +import { Mongo } from 'meteor/mongo'; -const Items = new Mongo.Collection('autorun_test_items'); -const Orders = new Mongo.Collection('autorun_test_orders'); - -export {Orders, Items} +export const Items = new Mongo.Collection('autorun_test_items'); +export const Orders = new Mongo.Collection('autorun_test_orders'); diff --git a/testing/server-autorun/publication.js b/testing/server-autorun/publication.js index 62f00502..e005457d 100644 --- a/testing/server-autorun/publication.js +++ b/testing/server-autorun/publication.js @@ -1 +1 @@ -import {Orders, Items} from './collections'; +import { Orders, Items } from './collections'; diff --git a/testing/server-autorun/server.js b/testing/server-autorun/server.js index 186f0b6e..96d8d4d5 100644 --- a/testing/server-autorun/server.js +++ b/testing/server-autorun/server.js @@ -1,4 +1,5 @@ -import {Orders, Items} from './collections'; +import { Meteor } from 'meteor/meteor'; +import { Orders, Items } from './collections'; import './publication'; diff --git a/testing/transformations/collections.js b/testing/transformations/collections.js index c227edfb..8be541cf 100644 --- a/testing/transformations/collections.js +++ b/testing/transformations/collections.js @@ -1,4 +1,5 @@ -import {Mongo} from 'meteor/mongo'; +import { Meteor } from 'meteor/meteor'; +import { Mongo } from 'meteor/mongo'; let Items; @@ -18,4 +19,4 @@ if (Meteor.isServer) { }); } -export {Items} +export { Items } diff --git a/testing/transformations/server.js b/testing/transformations/server.js index bf20cbb6..28c1f194 100644 --- a/testing/transformations/server.js +++ b/testing/transformations/server.js @@ -1,3 +1,4 @@ +import { Meteor } from 'meteor/meteor'; import { assert } from 'chai'; import { Items } from './collections'; diff --git a/testing/vent/boot.js b/testing/vent/boot.js index 32910000..60b0c7c6 100644 --- a/testing/vent/boot.js +++ b/testing/vent/boot.js @@ -1,5 +1,5 @@ -import {Vent} from 'meteor/cultofcoders:redis-oplog'; -import {Meteor} from 'meteor/meteor'; +import { Vent } from 'meteor/cultofcoders:redis-oplog'; +import { Meteor } from 'meteor/meteor'; Vent.publish({ 'threadMessage'({channel, shouldReturn = true}) { @@ -21,4 +21,4 @@ Meteor.methods({ Vent.emit(channel, object) } } -}); \ No newline at end of file +}); diff --git a/testing/vent/client.js b/testing/vent/client.js index 1c46786d..9e2575f8 100644 --- a/testing/vent/client.js +++ b/testing/vent/client.js @@ -1,5 +1,4 @@ import { assert } from 'chai'; -import { waitForHandleToBeReady, callWithPromise } from '../lib/sync_utils'; import { Random } from 'meteor/random'; import { Vent } from 'meteor/cultofcoders:redis-oplog'; @@ -111,4 +110,4 @@ describe('Vent', function () { done(); }, 200); }); -}); \ No newline at end of file +});