diff --git a/app/config/strings.js b/app/config/strings.js index 8de280b..2131224 100644 --- a/app/config/strings.js +++ b/app/config/strings.js @@ -11,6 +11,12 @@ module.exports = { return `Thanks for signing up for ${semanticJoin(animalsList)} Facts! You will now receive fun facts about ${semanticJoin(animalsListCapital)} every day! =^.^=`; }, + animalTypes: [ + 'cat', + 'dog', + 'snail', + 'horse' + ], unauthenticated: "Sign in first", unauthorized: "You aren't allowed to do that!", noVerificationCode: "Please provide a verification code", @@ -23,5 +29,5 @@ module.exports = { exists: "That person is already being facted" }, invalidNumber: "That phone number is invalid!", - userPhotoUrl: "https://cat-fact.herokuapp.com/img/res/avatars/user-face.png" + userPhotoUrl: "https://cat-fact.herokuapp.com/img/res/avatars/user-face.png", }; \ No newline at end of file diff --git a/app/models/fact.js b/app/models/fact.js index 183d98c..c9e4ecb 100644 --- a/app/models/fact.js +++ b/app/models/fact.js @@ -2,6 +2,7 @@ const mongoose = require('mongoose'); const Schema = mongoose.Schema; const mongooseDelete = require('mongoose-delete'); const random = require('mongoose-simple-random'); +const { animalTypes } = require('../config/strings.js'); const FactSchema = new Schema({ user: {type: Schema.Types.ObjectId, ref: 'User'}, @@ -9,7 +10,7 @@ const FactSchema = new Schema({ sendDate: {type: Date}, used: {type: Boolean, default: false}, source: {type: String, enum: ['user', 'api'], default: 'user'}, - type: {type: String, enum: ['cat', 'dog', 'snail', 'horse'], default: 'cat'} + type: {type: String, enum: animalTypes, default: 'cat'} }, { timestamps: true }); diff --git a/app/models/recipient.js b/app/models/recipient.js index 61ded35..021a114 100644 --- a/app/models/recipient.js +++ b/app/models/recipient.js @@ -19,7 +19,7 @@ const RecipientSchema = new Schema({ addedBy: {type: Schema.Types.ObjectId, ref: 'User'}, subscriptions: [{ type: String, - enum: ['cat', 'dog', 'snail', 'horse'] + enum: strings.animalTypes // TODO: Move to constant definition }] }, { timestamps: true @@ -165,8 +165,8 @@ RecipientSchema.statics.addRecipients = async function ({authenticatedUser, requ RecipientSchema.path('number').validate(function(number, done) { this.model('Recipient').count({number: number}, function(err, count) { - if (err) return done(err); - done(!count); + if (err) return err; + return !count; }); }, strings.recipient.exists); diff --git a/app/routes/catbot.routes.js b/app/routes/catbot.routes.js index 35ff2ed..5accb43 100644 --- a/app/routes/catbot.routes.js +++ b/app/routes/catbot.routes.js @@ -86,13 +86,10 @@ router.get('/daily', async (req, res) => { }; }; - // TODO: Define global list for animal types, use that to build this object - const facts = { - cat: getFactAndRecipients('cat'), - dog: getFactAndRecipients('dog'), - snail: getFactAndRecipients('snail'), - horse: getFactAndRecipients('horse') - }; + const facts = {}; + strings.animalTypes.forEach(animal => { + facts[animal] = getFactAndRecipients(animal); + }); const result = await Promise.props(facts), dbMessages = []; diff --git a/app/routes/contact.routes.js b/app/routes/contact.routes.js index b0ae90f..e6f57a2 100644 --- a/app/routes/contact.routes.js +++ b/app/routes/contact.routes.js @@ -1,6 +1,6 @@ const express = require('express'); const router = express.Router(); -const google = require('googleapis'); +const { google } = require('googleapis'); const googleConfig = require.main.require('./app/config/google'); const googleContacts = google.people('v1'); diff --git a/app/routes/fact.routes.js b/app/routes/fact.routes.js index 218e5ff..c6b86e0 100644 --- a/app/routes/fact.routes.js +++ b/app/routes/fact.routes.js @@ -18,7 +18,7 @@ router.get('/', async (req, res) => { const matchAll = { $match: { used: false, - // source: 'user', + source: 'user', sendDate: { $exists: false }, @@ -62,9 +62,9 @@ router.get('/', async (req, res) => { countUpvotes = [ {$addFields: { upvotes: { $size: "$upvotes" }, - userUpvoted: { + userUpvoted: req.user ? { $in: [ req.user._id, "$upvotes.user" ] - } + } : undefined }}, {$sort: { upvotes: -1 @@ -81,12 +81,12 @@ router.get('/', async (req, res) => { projectUpvotes, ...countUpvotes ]), - me: Fact.aggregate([ + me: req.user ? Fact.aggregate([ matchMe, lookupUpvotes, projectUpvotes, ...countUpvotes - ]) + ]) : undefined }); return res.status(200).json(data); diff --git a/app/routes/recipient.routes.js b/app/routes/recipient.routes.js index 1d0f770..9a22c45 100644 --- a/app/routes/recipient.routes.js +++ b/app/routes/recipient.routes.js @@ -7,6 +7,7 @@ const IFTTTService = require.main.require('./app/services/ifttt.service.js'); const Recipient = require.main.require('./app/models/recipient'); const Message = require.main.require('./app/models/message'); +const VerificationCode = require.main.require('./app/models/verification-code'); // Get all recipients @@ -57,13 +58,33 @@ router.get('/me', isAuthenticated, async (req, res) => { // Add new recipient(s) router.post('/', isAuthenticated, async (req, res) => { + // TODO: Sanitize phone number input on server side + const requestedRecipients = req.body.recipients || [req.body.recipient]; const animalTypes = req.body.animalTypes; + /* + * requestedRecipients: [{ + * name: String, + * number: String + * }], + * animalTypes: [String] + */ + if (!requestedRecipients.length) { return res.status(400).json({message: `No recipients provided`}); } + // If recipient already exists but is 'deleted', restore recipient to + // the new user account + const existingRecipients = await Recipient.findDeleted({number: { + $in: requestedRecipients.map(r => r.number) + }}); + + if (existingRecipients.length) { + existingRecipients.forEach(r => r.remove()); + } + try { const results = await Recipient.addRecipients({ authenticatedUser: req.user, @@ -78,6 +99,33 @@ router.post('/', isAuthenticated, async (req, res) => { } }); +// Restore recipient with new subscriptions +router.patch('/:recipientId/restore', isAuthenticated, async (req, res) => { + + const recipientId = req.params.recipientId; + const resubscriptions = req.body.resubscriptions; + + console.log(recipientId, resubscriptions); + + try { + await Recipient.restore({_id: recipientId}); + + const recipient = await Recipient.findOneAndUpdate({_id: recipientId}, { + $set: { + subscriptions: resubscriptions + } + }, { + new: true + }); + console.log(recipient); + + return res.status(200).json(recipient); + } + catch (err) { + return res.status(err.status || 400).json(err); + } +}); + router.patch('/:recipientId', isAuthenticated, async (req, res) => { // TODO: only allow to edit recipient if user isAdmin or is addedBy them @@ -98,6 +146,36 @@ router.patch('/:recipientId', isAuthenticated, async (req, res) => { } }); +// Unsubscribe +router.delete('/me', isAuthenticated, async (req, res) => { + + if (!req.query.verificationCode) { + return res.status(403).json({ + message: strings.noVerificationCode + }); + } + + const submittedCode = req.query.verificationCode.trim(); + const verificationCode = await VerificationCode.findOne({code: submittedCode}); + const number = verificationCode ? verificationCode.data : undefined; + + if (!verificationCode || !verificationCode.user.equals(req.user._id)) { + return res.status(403).json({ + message: strings.invalidVerificationCode + }); + } + + await Recipient.delete({ number }); + await VerificationCode.findByIdAndRemove(verificationCode._id); + + const formattedPhone = `(${number.substr(0,3)}) ${number.substr(3,3)}-${number.substr(6,4)}`; + + return res.status(200).json({ + message: `Successfully unsubscribed ${formattedPhone}` + }); +}); + +// Remove one or more recipients router.delete('/', isAuthenticated, async (req, res) => { const query = {_id: {$in: req.query.recipients}}; diff --git a/app/routes/user.routes.js b/app/routes/user.routes.js index b9c202e..418296e 100644 --- a/app/routes/user.routes.js +++ b/app/routes/user.routes.js @@ -67,7 +67,11 @@ router.put('/me/profile/phone', isAuthenticated, async (req, res) => { const submittedCode = req.body.verificationCode.trim(); const verificationCode = await VerificationCode.findOne({code: submittedCode}); - if (!verificationCode) return res.status(403).json({message: strings.invalidVerificationCode}); + if (!verificationCode || verificationCode.user != req.user._id) { + return res.status(403).json({ + message: strings.invalidVerificationCode + }); + } const updatedUser = await User.findByIdAndUpdate(req.user._id, {$set: { phone: verificationCode.data diff --git a/package-lock.json b/package-lock.json index 08498af..1da5ee8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cat-facts", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -10,6 +10,14 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "abort-controller": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-2.0.2.tgz", + "integrity": "sha512-JXEYGxxMwiNl9EUdLysK0K0DwB7ENw6KeeaLHgofijTfJYPB/vOer3Mb+IcP913dCfWiQsd05MmVNl0H5PanrQ==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, "accepts": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", @@ -19,6 +27,19 @@ "negotiator": "0.6.1" } }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + }, + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "requires": { + "es6-promisify": "^5.0.0" + } + }, "ajv": { "version": "6.9.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz", @@ -130,6 +151,11 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -160,6 +186,11 @@ "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", "dev": true }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -181,6 +212,11 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -242,6 +278,21 @@ } } }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" + }, + "base64id": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", + "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=" + }, "basic-auth": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", @@ -265,12 +316,30 @@ "tweetnacl": "^0.14.3" } }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "requires": { + "callsite": "1.0.0" + } + }, + "bignumber.js": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz", + "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==" + }, "binary-extensions": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.0.tgz", "integrity": "sha512-EgmjVLMn22z7eGGv3kcnHwSnJXmFHjISTY9E/S5lIcTD3Oxw05QTcBLNkJFzcb3cNueUdF/IN4U+d78V0zO8Hw==", "dev": true }, + "blob": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", + "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" + }, "bluebird": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", @@ -358,6 +427,11 @@ "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.4.tgz", "integrity": "sha1-k8ENOeqltYQVy8QFLz5T5WKwtyw=" }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, "buffer-shims": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", @@ -385,6 +459,11 @@ "unset-value": "^1.0.0" } }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -501,11 +580,20 @@ "delayed-stream": "~1.0.0" } }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + }, "component-emitter": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" }, "concat-map": { "version": "0.0.1", @@ -734,6 +822,14 @@ "safer-buffer": "^2.1.0" } }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -749,11 +845,89 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, + "engine.io": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.3.2.tgz", + "integrity": "sha512-AsaA9KG7cWPXWHp5FvHdDWY3AMWeZ8x+2pUVLcn71qE5AtAzgGbxuclOytygskw8XGmiQafTmnI9Bix3uihu2w==", + "requires": { + "accepts": "~1.3.4", + "base64id": "1.0.0", + "cookie": "0.3.1", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.0", + "ws": "~6.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "engine.io-client": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.3.2.tgz", + "integrity": "sha512-y0CPINnhMvPuwtqXfsGuWE8BB66+B6wTtCofQDRecMQPYX3MYUZXFNKDhdrSe3EVjgOu4V3rxdeqN/Tr91IgbQ==", + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.1", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~6.1.0", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "engine.io-parser": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.3.tgz", + "integrity": "sha512-6HXPre2O4Houl7c4g7Ic/XzPnHBvaEmN90vtRO9uLmwtRqQmTOw0QMevL1TOfL2Cpu1VzsaTmMotQgMdkzGkVA==", + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.5", + "has-binary2": "~1.0.2" + } + }, "es6-promise": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz", "integrity": "sha1-7FYjOGgDKQkgcXDDlEjiREndH8Q=" }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "requires": { + "es6-promise": "^4.0.3" + }, + "dependencies": { + "es6-promise": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", + "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==" + } + } + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -770,6 +944,11 @@ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, "execa": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", @@ -991,6 +1170,11 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, + "fast-text-encoding": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.0.tgz", + "integrity": "sha512-R9bHCvweUxxwkDwhjav5vxpFvdPGlVngtqmx4pIZfSUhM/Q4NiIUHB456BAf+Q1Nwu3HEZYONtu+Rya+af4jiQ==" + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -1623,6 +1807,26 @@ } } }, + "gaxios": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-1.8.1.tgz", + "integrity": "sha512-RPm2L7qDjo6FgSle5+v2LvDO/eN+/H9jqmX8PJUAQZVmSXBqDDgP/TFSNhC6RMgRDPav7JclkbQjVjos4P6V8A==", + "requires": { + "abort-controller": "^2.0.2", + "extend": "^3.0.2", + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.3.0" + } + }, + "gcp-metadata": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.9.3.tgz", + "integrity": "sha512-caV4S84xAjENtpezLCT/GILEAF5h/bC4cNqZFmt/tjTn8t+JBtTkQrgBrJu3857YdsnlM8rxX/PMcKGtE8hUlw==", + "requires": { + "gaxios": "^1.0.2", + "json-bigint": "^0.3.0" + } + }, "get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", @@ -1673,531 +1877,84 @@ "ini": "^1.3.4" } }, - "googleapis": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-19.0.0.tgz", - "integrity": "sha1-hwDrFClHd+DBlhUgUf1jZwYd3oU=", - "requires": { - "async": "~2.3.0", - "google-auth-library": "~0.10.0", - "string-template": "~1.0.0" + "google-auth-library": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-3.1.0.tgz", + "integrity": "sha512-EntjrOgSffw5EhZGoV8+ROPwEK/aQpoMZaULw3bKailEGdjaUI25PmmFc4AN6vG/Q24YEUiuLxtTXa1Usar5Eg==", + "requires": { + "base64-js": "^1.3.0", + "fast-text-encoding": "^1.0.0", + "gaxios": "^1.2.1", + "gcp-metadata": "^0.9.3", + "gtoken": "^2.3.2", + "https-proxy-agent": "^2.2.1", + "jws": "^3.1.5", + "lru-cache": "^5.0.0", + "semver": "^5.5.0" }, "dependencies": { - "async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.3.0.tgz", - "integrity": "sha1-EBPRBRBH3TIP4k5JTVxm7K9hR9k=", + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "requires": { - "lodash": "^4.14.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" - } + "yallist": "^3.0.2" } }, - "google-auth-library": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.10.0.tgz", - "integrity": "sha1-bhW6vuhf0d0U2NEoopW2g41SE24=", - "requires": { - "gtoken": "^1.2.1", - "jws": "^3.1.4", - "lodash.noop": "^3.0.1", - "request": "^2.74.0" - }, - "dependencies": { - "gtoken": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.2.tgz", - "integrity": "sha1-Fyd2oanZasCfwioA9b6DzubeiCA=", - "requires": { - "google-p12-pem": "^0.1.0", - "jws": "^3.0.0", - "mime": "^1.2.11", - "request": "^2.72.0" - }, - "dependencies": { - "google-p12-pem": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-0.1.2.tgz", - "integrity": "sha1-M8RqsCGqc0+gMys5YKmj/8svMXc=", - "requires": { - "node-forge": "^0.7.1" - }, - "dependencies": { - "node-forge": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz", - "integrity": "sha1-naYR6giYL0uUIGs760zJZl8gwwA=" - } - } - }, - "mime": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", - "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" - } - } - }, - "jws": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.4.tgz", - "integrity": "sha1-+ei5M46KhHJ31kRLFGT2GIDgUKI=", - "requires": { - "base64url": "^2.0.0", - "jwa": "^1.1.4", - "safe-buffer": "^5.0.1" - }, - "dependencies": { - "base64url": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz", - "integrity": "sha1-6sFuA+oUOO/5Qj1puqNiYu0fcLs=" - }, - "jwa": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.5.tgz", - "integrity": "sha1-oFUs4CIHQs1S4VN3SjKQXDDnVuU=", - "requires": { - "base64url": "2.0.0", - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.9", - "safe-buffer": "^5.0.1" - }, - "dependencies": { - "buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" - }, - "ecdsa-sig-formatter": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz", - "integrity": "sha1-S8kmJ07Dtau1AW5+HWCSGsJisqE=", - "requires": { - "base64url": "^2.0.0", - "safe-buffer": "^5.0.1" - } - } - } - }, - "safe-buffer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", - "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=" - } - } - }, - "lodash.noop": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash.noop/-/lodash.noop-3.0.1.tgz", - "integrity": "sha1-OBiPTWUKOkdCWEObluxFsyYXEzw=" - }, - "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - }, - "dependencies": { - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" - }, - "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "requires": { - "delayed-stream": "~1.0.0" - }, - "dependencies": { - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - } - } - }, - "extend": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", - "integrity": "sha1-WkdDU7nzNT3dgXbf03uRyDpG8dQ=" - }, - "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.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" - }, - "dependencies": { - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - } - } - }, - "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - }, - "dependencies": { - "ajv": { - "version": "4.11.7", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.7.tgz", - "integrity": "sha1-hlWl2G0IJJhcxHGh2RP7Zymg7Eg=", - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - }, - "dependencies": { - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "~0.0.0" - }, - "dependencies": { - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - } - } - } - } - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" - } - } - }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" - }, - "dependencies": { - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "requires": { - "hoek": "2.x.x" - } - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "requires": { - "boom": "2.x.x" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" - }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "requires": { - "hoek": "2.x.x" - } - } - } - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "dependencies": { - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" - }, - "jsprim": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", - "integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "extsprintf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", - "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=" - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "verror": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", - "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", - "requires": { - "extsprintf": "1.0.2" - } - } - } - }, - "sshpk": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.0.tgz", - "integrity": "sha1-/yo+T9BEl1Vf7Zezmg/YL6+zozw=", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jodid25519": "^1.0.0", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - }, - "dependencies": { - "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=" - }, - "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.3" - } - }, - "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" - } - }, - "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.0" - } - }, - "getpass": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz", - "integrity": "sha1-KD/9n8ElaECHUxHBtg6MQBhxEOY=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "jodid25519": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", - "integrity": "sha1-BtSRIlUJNBlHfUJWM2BuDpB4KWc=", - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - } - } - } - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "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=" - }, - "mime-types": { - "version": "2.1.15", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", - "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", - "requires": { - "mime-db": "~1.27.0" - }, - "dependencies": { - "mime-db": { - "version": "1.27.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", - "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=" - } - } - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=" - }, - "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" - }, - "safe-buffer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", - "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=" - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, - "tough-cookie": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", - "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", - "requires": { - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - } - } - }, - "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.0.1" - } - }, - "uuid": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz", - "integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE=" - } - } - } - } + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" + } + } + }, + "google-p12-pem": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.3.tgz", + "integrity": "sha512-KGnAiMMWaJp4j4tYVvAjfP3wCKZRLv9M1Nir2wRRNWUYO7j1aX8O9Qgz+a8/EQ5rAvuo4SIu79n6SIdkNl7Msg==", + "requires": { + "node-forge": "^0.7.5", + "pify": "^4.0.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, + "googleapis": { + "version": "37.2.0", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-37.2.0.tgz", + "integrity": "sha512-UenlZ0c4eaVAylIPvvsIlL/q5/3Xg8DuKug5aqdmRMk+tTVfJUmEKgp3s4ZSUOI5oKqO/+arIW5UnY2S62B13w==", + "requires": { + "google-auth-library": "^3.0.0", + "googleapis-common": "^0.7.0" + } + }, + "googleapis-common": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/googleapis-common/-/googleapis-common-0.7.2.tgz", + "integrity": "sha512-9DEJIiO4nS7nw0VE1YVkEfXEj8x8MxsuB+yZIpOBULFSN9OIKcUU8UuKgSZFU4lJmRioMfngktrbkMwWJcUhQg==", + "requires": { + "gaxios": "^1.2.2", + "google-auth-library": "^3.0.0", + "pify": "^4.0.0", + "qs": "^6.5.2", + "url-template": "^2.0.8", + "uuid": "^3.2.1" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" }, - "string-template": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz", - "integrity": "sha1-np8iM9wA8hhxjsN5oopWc+zKi5Y=" + "qs": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.6.0.tgz", + "integrity": "sha512-KIJqT9jQJDQx5h5uAVPimw6yVg2SekOKu959OCtktD3FjzbpvaPr8i4zzg07DOMz+igA4W/aNM7OV8H37pFYfA==" } } }, @@ -2226,6 +1983,30 @@ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "dev": true }, + "gtoken": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-2.3.2.tgz", + "integrity": "sha512-F8EObUGyC8Qd3WXTloNULZBwfUsOABoHElihB1F6zGhT/cy38iPL09wGLRY712I+hQnOyA+sYlgPFX2cOKz0qg==", + "requires": { + "gaxios": "^1.0.4", + "google-p12-pem": "^1.0.0", + "jws": "^3.1.5", + "mime": "^2.2.0", + "pify": "^4.0.0" + }, + "dependencies": { + "mime": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.0.tgz", + "integrity": "sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w==" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -2240,6 +2021,26 @@ "har-schema": "^2.0.0" } }, + "has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "requires": { + "isarray": "2.0.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -2278,11 +2079,6 @@ } } }, - "hooks-fixed": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hooks-fixed/-/hooks-fixed-2.0.2.tgz", - "integrity": "sha512-YurCM4gQSetcrhwEtpQHhQ4M7Zo7poNGqY4kQGeBS6eZtOcT3tnNs01ThFa0jYBByAiYt1MjMjP/YApG0EnAvQ==" - }, "http-errors": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", @@ -2311,6 +2107,30 @@ "sshpk": "^1.7.0" } }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "requires": { + "agent-base": "^4.1.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, "iconv-lite": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", @@ -2334,6 +2154,11 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -2581,6 +2406,14 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "json-bigint": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-0.3.0.tgz", + "integrity": "sha1-DM2RLEuCcNBfBW+9E4FLU9OCWx4=", + "requires": { + "bignumber.js": "^7.0.0" + } + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -2607,10 +2440,29 @@ "verror": "1.10.0" } }, + "jwa": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.0.tgz", + "integrity": "sha512-mt6IHaq0ZZWDBspg0Pheu3r9sVNMEZn+GJe1zcdYyhFcDSclp3J8xEdO4PjZolZ2i8xlaVU1LetHM0nJejYsEw==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.1.tgz", + "integrity": "sha512-bGA2omSrFUkd72dhh05bIAN832znP4wOU3lfuXtRBuGTbsmNmDXMQg28f0Vsxaxgk4myF5YkKQpz6qeRpMgX9g==", + "requires": { + "jwa": "^1.2.0", + "safe-buffer": "^5.0.1" + } + }, "kareem": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-1.5.0.tgz", - "integrity": "sha1-4+QQHZ3P3imXadr0tNtk2JXRdEg=" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.0.tgz", + "integrity": "sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg==" }, "kind-of": { "version": "6.0.2", @@ -2632,11 +2484,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" - }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -2682,6 +2529,12 @@ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, + "memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "optional": true + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -2811,32 +2664,66 @@ } }, "mongoose": { - "version": "4.13.11", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-4.13.11.tgz", - "integrity": "sha512-OgXmFc3vzXwq4zWp41XfSBDnKZLqnBc4Kh7mwwGjBE5iWH5tfkixaPK0uFtpEuzDzUvAIg33bgniyTsmc00olA==", - "requires": { - "async": "2.1.4", - "bson": "~1.0.4", - "hooks-fixed": "2.0.2", - "kareem": "1.5.0", - "lodash.get": "4.4.2", - "mongodb": "2.2.34", - "mpath": "0.3.0", - "mpromise": "0.5.5", - "mquery": "2.3.3", - "ms": "2.0.0", - "muri": "1.3.0", + "version": "5.4.17", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.4.17.tgz", + "integrity": "sha512-9aAg8M0YUmGHQRDYvsKJ02wx/Qaof1Jn2iDH21ZtWGAZpQt9uVLNEOdcBuzi+lPJwGbLYh2dphdKX0sZ+dXAJQ==", + "requires": { + "async": "2.6.1", + "bson": "~1.1.0", + "kareem": "2.3.0", + "mongodb": "3.1.13", + "mongodb-core": "3.1.11", + "mongoose-legacy-pluralize": "1.0.2", + "mpath": "0.5.1", + "mquery": "3.2.0", + "ms": "2.1.1", "regexp-clone": "0.0.1", + "safe-buffer": "5.1.2", "sliced": "1.0.1" }, "dependencies": { "async": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.1.4.tgz", - "integrity": "sha1-LSFgx3iAMuTdbL4lAvH5osj2zeQ=", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "requires": { + "lodash": "^4.17.10" + } + }, + "bson": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", + "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" + }, + "mongodb": { + "version": "3.1.13", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.13.tgz", + "integrity": "sha512-sz2dhvBZQWf3LRNDhbd30KHVzdjZx9IKC0L+kSZ/gzYquCF5zPOgGqRz6sSCqYZtKP2ekB4nfLxhGtzGHnIKxA==", + "requires": { + "mongodb-core": "3.1.11", + "safe-buffer": "^5.1.2" + } + }, + "mongodb-core": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.11.tgz", + "integrity": "sha512-rD2US2s5qk/ckbiiGFHeu+yKYDXdJ1G87F6CG3YdaZpzdOm5zpoAZd/EKbPmFO6cQZ+XVXBXBJ660sSI0gc6qg==", "requires": { - "lodash": "^4.14.0" + "bson": "^1.1.0", + "require_optional": "^1.0.1", + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + }, + "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==" } } }, @@ -2845,6 +2732,11 @@ "resolved": "https://registry.npmjs.org/mongoose-delete/-/mongoose-delete-0.4.0.tgz", "integrity": "sha1-bu7tVti0eM8JrgK1iU0ROABWvko=" }, + "mongoose-legacy-pluralize": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", + "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" + }, "mongoose-simple-random": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/mongoose-simple-random/-/mongoose-simple-random-0.4.1.tgz", @@ -2863,35 +2755,34 @@ } }, "mpath": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.3.0.tgz", - "integrity": "sha1-elj3iem1/TyUUgY0FXlg8mvV70Q=" - }, - "mpromise": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mpromise/-/mpromise-0.5.5.tgz", - "integrity": "sha1-9bJCWddjrMIlewoMjG2Gb9UXMuY=" + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.5.1.tgz", + "integrity": "sha512-H8OVQ+QEz82sch4wbODFOz+3YQ61FYz/z3eJ5pIdbMEaUzDqA268Wd+Vt4Paw9TJfvDgVKaayC0gBzMIw2jhsg==" }, "mquery": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-2.3.3.tgz", - "integrity": "sha512-NC8L14kn+qxJbbJ1gbcEMDxF0sC3sv+1cbRReXXwVvowcwY1y9KoVZFq0ebwARibsadu8lx8nWGvm3V0Pf0ZWQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.0.tgz", + "integrity": "sha512-qPJcdK/yqcbQiKoemAt62Y0BAc0fTEKo1IThodBD+O5meQRJT/2HSe5QpBNwaa4CjskoGrYWsEyjkqgiE0qjhg==", "requires": { - "bluebird": "3.5.0", - "debug": "2.6.9", + "bluebird": "3.5.1", + "debug": "3.1.0", "regexp-clone": "0.0.1", - "sliced": "0.0.5" + "safe-buffer": "5.1.2", + "sliced": "1.0.1" }, "dependencies": { - "bluebird": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", - "integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=" + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } }, - "sliced": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", - "integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=" + "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==" } } }, @@ -2900,11 +2791,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, - "muri": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/muri/-/muri-1.3.0.tgz", - "integrity": "sha512-FiaFwKl864onHFFUV/a2szAl7X0fxVlSKNdhTf+BM8i8goEgYut8u5P9MqQqIYwvaMxjzVESsoEm/2kfkFH1rg==" - }, "nan": { "version": "2.12.1", "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", @@ -2936,6 +2822,16 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, + "node-fetch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz", + "integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==" + }, + "node-forge": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.6.tgz", + "integrity": "sha512-sol30LUpz1jQFBjOKwbjxijiE3b6pjd74YwfD0fJOKPjF+fONKb2Yg8rYgS6+bK6VDl+/wfr4IYpC7jDzLUIfw==" + }, "node-ifttt-maker": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/node-ifttt-maker/-/node-ifttt-maker-0.1.2.tgz", @@ -3069,6 +2965,11 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -3149,6 +3050,22 @@ "semver": "^5.1.0" } }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "requires": { + "better-assert": "~1.0.0" + } + }, "parseurl": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", @@ -3639,6 +3556,15 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "saslprep": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.2.tgz", + "integrity": "sha512-4cDsYuAjXssUSjxHKRe4DTZC0agDwsCqcMqtJAQPzC74nJ7LfAJflAtC1Zed5hMzEQKj82d3tuzqdGNRsLJ4Gw==", + "optional": true, + "requires": { + "sparse-bitfield": "^3.0.3" + } + }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", @@ -3858,449 +3784,91 @@ } }, "socket.io": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.7.4.tgz", - "integrity": "sha1-L37O3DORvy1cc+KR/iM+bjTU3QA=", - "requires": { - "debug": "2.3.3", - "engine.io": "~1.8.4", - "has-binary": "0.1.7", - "object-assign": "4.1.0", - "socket.io-adapter": "0.5.0", - "socket.io-client": "1.7.4", - "socket.io-parser": "2.3.1" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.2.0.tgz", + "integrity": "sha512-wxXrIuZ8AILcn+f1B4ez4hJTPG24iNgxBBDaJfT6MsyOhVYiTXWexGoPkd87ktJG8kQEcL/NBvRi64+9k4Kc0w==", + "requires": { + "debug": "~4.1.0", + "engine.io": "~3.3.1", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.2.0", + "socket.io-parser": "~3.3.0" }, "dependencies": { "debug": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", - "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", - "requires": { - "ms": "0.7.2" - }, - "dependencies": { - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=" - } - } - }, - "engine.io": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.8.4.tgz", - "integrity": "sha1-d7zhK4Dl1gQpM3/sOw2vaR68kAM=", - "requires": { - "accepts": "1.3.3", - "base64id": "1.0.0", - "cookie": "0.3.1", - "debug": "2.3.3", - "engine.io-parser": "1.3.2", - "ws": "1.1.4" - }, - "dependencies": { - "accepts": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", - "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", - "requires": { - "mime-types": "~2.1.11", - "negotiator": "0.6.1" - }, - "dependencies": { - "mime-types": { - "version": "2.1.16", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz", - "integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=", - "requires": { - "mime-db": "~1.29.0" - }, - "dependencies": { - "mime-db": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", - "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=" - } - } - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - } - } - }, - "base64id": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", - "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "engine.io-parser": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz", - "integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=", - "requires": { - "after": "0.8.2", - "arraybuffer.slice": "0.0.6", - "base64-arraybuffer": "0.1.5", - "blob": "0.0.4", - "has-binary": "0.1.7", - "wtf-8": "1.0.0" - }, - "dependencies": { - "after": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", - "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" - }, - "arraybuffer.slice": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", - "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=" - }, - "base64-arraybuffer": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" - }, - "blob": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", - "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=" - }, - "wtf-8": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz", - "integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=" - } - } - }, - "ws": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.4.tgz", - "integrity": "sha1-V/QNA2gy5fUFVmKjl8Tedu1mv2E=", - "requires": { - "options": ">=0.0.5", - "ultron": "1.0.x" - }, - "dependencies": { - "options": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", - "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=" - }, - "ultron": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", - "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=" - } - } - } - } - }, - "has-binary": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", - "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "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=" - } + "ms": "^2.1.1" } }, - "object-assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", - "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=" - }, - "socket.io-adapter": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.5.0.tgz", - "integrity": "sha1-y21LuL7IHhB4uZZ3+c7QBGBmu4s=", + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, + "socket.io-adapter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz", + "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=" + }, + "socket.io-client": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.2.0.tgz", + "integrity": "sha512-56ZrkTDbdTLmBIyfFYesgOxsjcLnwAKoN4CiPyTVkMQj3zTUh0QAx3GbvIvLpFEOvQWu92yyWICxB0u7wkVbYA==", + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "engine.io-client": "~3.3.1", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.3.0", + "to-array": "0.1.4" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "requires": { - "debug": "2.3.3", - "socket.io-parser": "2.3.1" + "ms": "2.0.0" } - }, - "socket.io-client": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.7.4.tgz", - "integrity": "sha1-7J+CA1btme9tNX8HVtZIcXvdQoE=", + } + } + }, + "socket.io-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz", + "integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==", + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "requires": { - "backo2": "1.0.2", - "component-bind": "1.0.0", - "component-emitter": "1.2.1", - "debug": "2.3.3", - "engine.io-client": "~1.8.4", - "has-binary": "0.1.7", - "indexof": "0.0.1", - "object-component": "0.0.3", - "parseuri": "0.0.5", - "socket.io-parser": "2.3.1", - "to-array": "0.1.4" - }, - "dependencies": { - "backo2": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" - }, - "component-bind": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", - "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" - }, - "engine.io-client": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.4.tgz", - "integrity": "sha1-n+hd7iWFPKa6viW9KtaHEIY+kcI=", - "requires": { - "component-emitter": "1.2.1", - "component-inherit": "0.0.3", - "debug": "2.3.3", - "engine.io-parser": "1.3.2", - "has-cors": "1.1.0", - "indexof": "0.0.1", - "parsejson": "0.0.3", - "parseqs": "0.0.5", - "parseuri": "0.0.5", - "ws": "1.1.2", - "xmlhttprequest-ssl": "1.5.3", - "yeast": "0.1.2" - }, - "dependencies": { - "component-inherit": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", - "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" - }, - "engine.io-parser": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz", - "integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=", - "requires": { - "after": "0.8.2", - "arraybuffer.slice": "0.0.6", - "base64-arraybuffer": "0.1.5", - "blob": "0.0.4", - "has-binary": "0.1.7", - "wtf-8": "1.0.0" - }, - "dependencies": { - "after": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", - "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" - }, - "arraybuffer.slice": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", - "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=" - }, - "base64-arraybuffer": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" - }, - "blob": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", - "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=" - }, - "wtf-8": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz", - "integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=" - } - } - }, - "has-cors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", - "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" - }, - "parsejson": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz", - "integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=", - "requires": { - "better-assert": "~1.0.0" - }, - "dependencies": { - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", - "requires": { - "callsite": "1.0.0" - }, - "dependencies": { - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" - } - } - } - } - }, - "parseqs": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", - "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", - "requires": { - "better-assert": "~1.0.0" - }, - "dependencies": { - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", - "requires": { - "callsite": "1.0.0" - }, - "dependencies": { - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" - } - } - } - } - }, - "ws": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.2.tgz", - "integrity": "sha1-iiRPoFJAHgjJiGz0SoUYnh/UBn8=", - "requires": { - "options": ">=0.0.5", - "ultron": "1.0.x" - }, - "dependencies": { - "options": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", - "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=" - }, - "ultron": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", - "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=" - } - } - }, - "xmlhttprequest-ssl": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz", - "integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0=" - }, - "yeast": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", - "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" - } - } - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" - }, - "object-component": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", - "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" - }, - "parseuri": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", - "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", - "requires": { - "better-assert": "~1.0.0" - }, - "dependencies": { - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", - "requires": { - "callsite": "1.0.0" - }, - "dependencies": { - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" - } - } - } - } - }, - "to-array": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", - "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" - } + "ms": "2.0.0" } }, - "socket.io-parser": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.3.1.tgz", - "integrity": "sha1-3VMgJRA85Clpcya+/WQAX8/ltKA=", - "requires": { - "component-emitter": "1.1.2", - "debug": "2.2.0", - "isarray": "0.0.1", - "json3": "3.3.2" - }, - "dependencies": { - "component-emitter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", - "integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM=" - }, - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "requires": { - "ms": "0.7.1" - }, - "dependencies": { - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=" - } - } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=" - } - } + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" } } }, @@ -4329,6 +3897,15 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, + "sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", + "optional": true, + "requires": { + "memory-pager": "^1.0.2" + } + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -4448,6 +4025,11 @@ "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", "dev": true }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + }, "to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", @@ -4711,6 +4293,11 @@ "prepend-http": "^1.0.1" } }, + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=" + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -4776,17 +4363,35 @@ "signal-exit": "^3.0.2" } }, + "ws": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", + "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "requires": { + "async-limiter": "~1.0.0" + } + }, "xdg-basedir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", "dev": true }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" } } } diff --git a/package.json b/package.json index 4a2d179..95a235d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cat-facts", - "version": "1.1.0", + "version": "1.1.2", "description": "Daily cat facts!", "main": "server.js", "repository": "", @@ -21,9 +21,9 @@ "ejs": "^2.5.6", "express": "^4.16.2", "express-session": "^1.15.6", - "googleapis": "^19.0.0", + "googleapis": "^37.2.0", "method-override": "^2.3.10", - "mongoose": "^4.13.11", + "mongoose": "^5.4.17", "mongoose-delete": "^0.4.0", "mongoose-simple-random": "^0.4.1", "morgan": "^1.9.1", @@ -35,7 +35,7 @@ "request-ip": "^2.0.2", "request-promise": "^4.2.2", "shortid": "^2.2.8", - "socket.io": "^1.4.8", + "socket.io": "^2.2.0", "twitter": "^1.7.1" }, "devDependencies": { diff --git a/public/css/style.css b/public/css/style.css index 94f3155..2294dac 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -48,11 +48,16 @@ message .message-bubble { max-width: 70%; } message .row-reverse .message-bubble { - background-color: #2196f3 !important; color: #fff; } +message .message-timestamp { + width: 100%; + text-align: center; + margin-top: 5px; + margin-bottom: 8px; +} -recipients tr.deleted { +recipients .deleted { opacity: .5; } @@ -62,6 +67,9 @@ recipients tr.deleted { .subscription-icon img { width: 30px; } +.subscription-icon.hidden { + visibility: hidden; +} .quick-fact .fact { max-height: 55vh !important; @@ -85,6 +93,7 @@ recipients tr.deleted { .margin-sides-0 { margin-left: 0px; margin-right: 0px; } .margin-sides-10 { margin-left: 10px; margin-right: 10px; } .min-width-350 { min-width: 350px !important; } +.max-width-850 { max-width: 850px !important; } .width-40 { width: 40px; } .avatar { diff --git a/public/index.html b/public/index.html index d7fe011..d6d3d84 100644 --- a/public/index.html +++ b/public/index.html @@ -44,7 +44,7 @@ arrow_back - + + + + @@ -164,7 +167,7 @@ - + diff --git a/public/js/app.js b/public/js/app.js index 16e29ce..90f9ba3 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,4 +1,4 @@ -/* global angular */ +/* global angular, navigator */ var app = angular.module('catfacts', [ 'ngMaterial', 'ui.router', @@ -8,7 +8,8 @@ var app = angular.module('catfacts', [ 'btford.socket-io', 'luegg.directives', 'ngclipboard', - 'cfp.hotkeys' + 'cfp.hotkeys', + 'angularMoment' ]); app.provider('animal', function() { @@ -102,8 +103,8 @@ app.config(['$mdThemingProvider', function($mdThemingProvider) { $mdThemingProvider.enableBrowserColor(); }]); -app.run(['$rootScope', '$state', '$window', '$location', '$mdToast', 'ApiService', 'AuthService', '$mdMedia', - function($rootScope, $state, $window, $location, $mdToast, ApiService, AuthService, $mdMedia) { +app.run(['$rootScope', '$state', '$window', '$location', '$mdToast', 'ApiService', 'AuthService', '$mdMedia', 'amMoment', + function($rootScope, $state, $window, $location, $mdToast, ApiService, AuthService, $mdMedia, amMoment) { $rootScope.authenticatedUser = null; $rootScope.$mdMedia = $mdMedia; @@ -111,6 +112,8 @@ app.run(['$rootScope', '$state', '$window', '$location', '$mdToast', 'ApiService $window.name = 'cat-facts-base-window'; $window.ga('create', 'UA-88600627-2', 'auto'); // Start Google Analytics + amMoment.changeLocale(navigator.languages ? navigator.languages[0] : navigator.language); + $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { // Keep animal url params during state change, default cat @@ -152,11 +155,26 @@ app.run(['$rootScope', '$state', '$window', '$location', '$mdToast', 'ApiService }; $rootScope.toast = function(options) { - $mdToast.show( - $mdToast.simple() - .textContent(options.message) - .position('bottom right') - .hideDelay(5000) - ); + if (options.action && options.actionText) { + $mdToast.show( + $mdToast.simple() + .textContent(options.message) + .action(options.actionText) + .highlightAction(true) + .position('bottom right') + .hideDelay(10000) + ).then(response => { + if (response === 'ok') { + options.action(); + } + }); + } else { + $mdToast.show( + $mdToast.simple() + .textContent(options.message) + .position('bottom right') + .hideDelay(5000) + ); + } }; }]); \ No newline at end of file diff --git a/public/js/controllers/conversation.js b/public/js/controllers/conversation.js index c188787..16747f7 100644 --- a/public/js/controllers/conversation.js +++ b/public/js/controllers/conversation.js @@ -5,6 +5,7 @@ app.controller('ConversationCtrl', ['$scope', 'ApiService', 'data', 'socket', '$ function($scope, ApiService, ConversationData, socket, $mdDialog) { $scope.data = ConversationData; + $scope.loading = true; socket.on('message', function(data) { console.log(data, ConversationData); @@ -15,9 +16,38 @@ app.controller('ConversationCtrl', ['$scope', 'ApiService', 'data', 'socket', '$ ApiService.getConversation(ConversationData.recipient.number).then(function(response) { $scope.messages = response.data; + $scope.loading = false; }); $scope.closeConversation = function() { $mdDialog.hide(); }; + + // Determine if the message was sent within a relatively short period before the previous one + $scope.isStale = function(currentMessage, prevMessage) { + + if (!prevMessage) return true; + + const currentDate = new Date(currentMessage.createdAt); + const prevDate = new Date(prevMessage.createdAt); + + const deltaMillis = new Date() - currentDate; + let scale, + scaleMinutes = (1000 * 60), + scaleHours = scaleMinutes * 60, + scaleDays = scaleHours * 24, + scaleYears = scaleDays * 365; + + if (deltaMillis < scaleHours) + // less than an hour ago + scale = scaleMinutes; + else if (deltaMillis < scaleDays) + // less than a day ago + scale = scaleHours; + else if (deltaMillis < scaleYears) + // less than a year ago + scale = scaleDays; + + return ((currentDate - prevDate) / scale) >= 1; + }; }]); \ No newline at end of file diff --git a/public/js/controllers/home.js b/public/js/controllers/home.js index a8177e4..aaa751d 100644 --- a/public/js/controllers/home.js +++ b/public/js/controllers/home.js @@ -1,8 +1,8 @@ /* global angular */ var app = angular.module('catfacts'); -app.controller('HomeCtrl', ['$scope', '$rootScope', '$http', '$state', '$window', - function($scope, $rootScope, $http, $state, $window) { +app.controller('HomeCtrl', ['$scope', '$rootScope', '$http', '$state', '$window', '$mdDialog', '$mdMedia', 'ApiService', + function($scope, $rootScope, $http, $state, $window, $mdDialog, $mdMedia, ApiService) { $scope.carousel = { catImages: [] @@ -12,27 +12,71 @@ app.controller('HomeCtrl', ['$scope', '$rootScope', '$http', '$state', '$window' $http.defaults.useXDomain = true; $scope.openApp = function() { + $state.go('facts'); + }; + + $scope.signIn = function() { if ($rootScope.authenticatedUser) { - $state.go('facts'); + $scope.openApp(); } else { $window.location.href = '/auth/google'; } }; + $scope.openUnsubscribe = function() { + $mdDialog.show({ + controller: ['$scope', '$mdDialog', function($scope, $mdDialog) { + + $scope.cancel = $mdDialog.hide; + $scope.$state = $state; + $scope.showCodeEntry = false; + + $scope.verifyPhone = function() { + + ApiService.verifyPhone($scope.number).then(() => { + $scope.showCodeEntry = true; + }, err => { + $rootScope.toast({ + message: err.data.message || + "Error sending verification code" + }); + }); + }; + + $scope.unsubscribe = function() { + + ApiService.unsubscribe($scope.code).then(res => { + $rootScope.toast({message: res.data.message}); + $mdDialog.hide(); + }, err => { + $rootScope.toast({ + message: err.data.message || "Error unsubscribing" + }); + }); + }; + }], + templateUrl: 'views/partials/unsubscribe.html', + parent: angular.element(document.body), + targetEvent: event, + clickOutsideToClose: true, + fullscreen: $mdMedia('xs') + }); + }; + // Get some cat facts for tagline $http({ method: 'GET', url: 'https://cat-fact-alexwohlbruck.c9users.io/fact' }).then(function(response) { $scope.fact = response.data.text; - }) + }); // Get background images from Imgur $http({ method: 'GET', url: 'https://api.imgur.com/3/gallery/r/cats', headers: { - 'Authorization': 'Client-ID 9350ca7bffa3250' + 'Authorization': 'Client-ID 160806899cb2d43' } }).then(function(response) { var images = response.data.data; diff --git a/public/js/controllers/main.js b/public/js/controllers/main.js index 51f4fd1..737f3ee 100644 --- a/public/js/controllers/main.js +++ b/public/js/controllers/main.js @@ -2,7 +2,7 @@ var app = angular.module('catfacts'); app.controller('MainCtrl', ['$scope', '$rootScope', '$state', '$window', '$mdSidenav', '$mdToast', '$mdDialog', '$mdMedia', '$mdBottomSheet', 'ApiService', 'animal', 'hotkeys', - function($scope, $rootScope, $state, $window, $mdSidenav, $mdToast, $mdDialog, $mdMedia, $mdBottomSheet, ApiService, animal, hotkeys) { + function($scope, $rootScope, $state, $window, $mdSidenav, $mdToast, $mdDialog, $mdMedia, $mdBottomSheet, ApiService, animalProvider, hotkeys) { $scope.sideNav = { left: { @@ -13,7 +13,7 @@ app.controller('MainCtrl', ['$scope', '$rootScope', '$state', '$window', '$mdSid }; $scope.ApiService = ApiService; - $scope.animals = animal; + $scope.animals = animalProvider; $rootScope.goBack = function() { $window.history.back(); diff --git a/public/js/controllers/recipients.js b/public/js/controllers/recipients.js index 64c79c5..014fccb 100644 --- a/public/js/controllers/recipients.js +++ b/public/js/controllers/recipients.js @@ -27,36 +27,37 @@ app.controller('RecipientsCtrl', ['$scope', '$rootScope', '$state', 'ApiService' const name = $scope.form.name, number = $scope.form.number; - if (name && number && $scope.validatePhone(number)) { + if (!name || !number || !$scope.validatePhone(number)) { + return $rootScope.toast({message: "Invalid name or number"}); + } + + ApiService.addRecipient({ + recipient: { + name, + number: $scope.validatePhone(number, true) + }, + animalTypes: [$state.params.animal] + }) + + .then(response => { - ApiService.addRecipient({ - recipient: { - name, - number: $scope.validatePhone(number, true) - }, - animalTypes: [$state.params.animal] - }) + // Remove this number from the list (if archived) + $scope.recipients = $scope.recipients.filter(r => r.number != number); - .then(response => { - - $scope.recipients = [ - ...$scope.recipients, - ...response.data.newRecipients, - ...response.data.updatedRecipients - ].sort((a, b) => { - return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; - }); - - $rootScope.toast({message: response.data.message}); - $scope.form = null; - }, err => { - console.error(err); - $rootScope.toast({message: err.data.errors[Object.keys(err.data.errors)[0]].message || err.data.message}); + $scope.recipients = [ + ...$scope.recipients, + ...response.data.newRecipients, + ...response.data.updatedRecipients + ].sort((a, b) => { + // Alphabetic sort + return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; }); - } else { - $rootScope.toast({message: "Invalid name or number"}); - } + $rootScope.toast({message: response.data.message}); + $scope.form = null; + }, err => { + $rootScope.toast({message: err.data.errors[Object.keys(err.data.errors)[0]].message || err.data.message}); + }); }; $scope.openImportContacts = contacts => { @@ -99,8 +100,6 @@ app.controller('RecipientsCtrl', ['$scope', '$rootScope', '$state', 'ApiService' ApiService.addRecipients({recipients, animalTypes: [$state.params.animal]}).then(response => { - console.log(response.data); - $scope.recipients = [ ...$scope.recipients, ...response.data.newRecipients, @@ -109,8 +108,6 @@ app.controller('RecipientsCtrl', ['$scope', '$rootScope', '$state', 'ApiService' return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; }); - console.log($scope.recipients); - $rootScope.toast({message: response.data.message}); }, err => { $rootScope.toast({message: err.data.message || "Error adding recipients"}); @@ -119,7 +116,19 @@ app.controller('RecipientsCtrl', ['$scope', '$rootScope', '$state', 'ApiService' }; function getMyRecipients() { - $scope.promise = ApiService.getMyRecipients({animalType: $state.params.animal}).then(response => { + if (!$rootScope.authenticatedUser) { + $rootScope.toast({ + message: "Sign in to access this page", + actionText: "Sign in", + action: function() { + window.location.replace('/auth'); + } + }); + } + + $scope.promise = ApiService.getMyRecipients({ + animalType: $state.params.animal + }).then(response => { $scope.recipients = response.data; }, err => { $rootScope.toast({message: err.data.message}); diff --git a/public/js/directives/message.js b/public/js/directives/message.js index c8ee635..3f57ab5 100644 --- a/public/js/directives/message.js +++ b/public/js/directives/message.js @@ -1,12 +1,20 @@ /* global angular */ var app = angular.module('catfacts'); -app.directive('message', function() { +app.directive('message', messageDirective); + +messageDirective.$inject(['$state']); + +function messageDirective($state) { return { restrict: 'E', scope: { - message: "=" + message: "=", + stale: "=" }, - templateUrl: '/views/directives/message.html' + templateUrl: '/views/directives/message.html', + controller: function($scope, $state) { + $scope.currentAnimal = $state.params.animal; + } }; -}); \ No newline at end of file +} \ No newline at end of file diff --git a/public/js/directives/recipients-list.js b/public/js/directives/recipients-list.js index ba8196e..9ed51b1 100644 --- a/public/js/directives/recipients-list.js +++ b/public/js/directives/recipients-list.js @@ -13,12 +13,14 @@ app.directive('recipients', function() { selected: '=' }, templateUrl: '/views/directives/recipients-list.html', - controller: ['$scope', '$rootScope', '$mdDialog', '$mdMedia', 'ApiService', - function($scope, $rootScope, $mdDialog, $mdMedia, ApiService) { + controller: ['$scope', '$rootScope', '$mdDialog', '$mdMedia', 'ApiService', 'animal', + function($scope, $rootScope, $mdDialog, $mdMedia, ApiService, animalProvider) { $scope.$mdMedia = $mdMedia; $scope.selected = []; + $scope.animals = animalProvider; + $scope.openConversation = function(event, recipient) { $mdDialog.show({ controller: 'ConversationCtrl', @@ -31,9 +33,10 @@ app.directive('recipients', function() { }); }; - $scope.editRecipient = function({recipient}, ev) { + $scope.editRecipient = function(event, recipient) { $mdDialog.show({ controller: ['$scope', '$mdDialog', function($scope, $mdDialog) { + $scope.recipient = recipient; $scope.cancel = $mdDialog.hide; @@ -47,20 +50,58 @@ app.directive('recipients', function() { }], templateUrl: 'views/partials/edit-recipient.html', parent: angular.element(document.body), - targetEvent: ev, + targetEvent: event, clickOutsideToClose: true, fullscreen: $mdMedia('xs') - }).then(function(editedRecipient) { + + }).then(editedRecipient => { + if (editedRecipient) { $rootScope.toast({message: 'Recipient updated'}); $scope.selected = []; } - }, function(err) { + }, err => { + $rootScope.toast(err); + }); + }; + + $scope.restoreRecipient = function(event, recipient) { + $mdDialog.show({ + controller: ['$scope', '$mdDialog', 'animal', + function($scope, $mdDialog, animalProvider) { + + $scope.animals = animalProvider; + $scope.recipient = recipient; + $scope.resubscriptions = []; + $scope.cancel = $mdDialog.hide; + + $scope.restore = function() { + ApiService.restoreRecipient($scope.recipient, $scope.resubscriptions).then(function({data}) { + $mdDialog.hide(data); + }, function(err) { + $mdDialog.cancel(err); + }); + }; + }], + templateUrl: 'views/partials/restore-recipient.html', + parent: angular.element(document.body), + targetEvent: event, + clickOutsideToClose: true, + fullscreen: $mdMedia('xs') + + }).then(recipient => { + + const index = $scope.recipients.findIndex(r => r._id == recipient._id); + + $scope.recipients.splice(index, 1); + $scope.recipients.push(recipient); + + }, err => { $rootScope.toast(err); }); }; - $scope.deleteRecipients = function({recipients, showPermanentDeleteOption}, ev) { + $scope.deleteRecipients = function(event, recipients) { $mdDialog.show({ controller: ['$scope', '$mdDialog', function($scope, $mdDialog) { $scope.recipients = recipients; @@ -69,6 +110,7 @@ app.directive('recipients', function() { $scope.delete = function() { $mdDialog.hide({ + permanent: $scope.permanent, recipients: recipients.map(o => o._id), soft: !$scope.permanent }); @@ -80,25 +122,29 @@ app.directive('recipients', function() { }], templateUrl: 'views/partials/delete-recipients.html', parent: angular.element(document.body), - targetEvent: ev, + targetEvent: event, clickOutsideToClose: true, fullscreen: $mdMedia('xs') }) + .then(data => { ApiService.deleteRecipients(data).then(response => { - // FIXME: When trying to re-add a deleted recipient, DB throws dup index error - - // TODO: If permanent delete is selected, remove recipient from list - - $scope.recipients = $scope.recipients.map(recipient => { + if (data.permanent) { + $scope.recipients = $scope.recipients.filter(r => !r.deleted); + } + else { + $scope.recipients = $scope.recipients.map(recipient => { + if (data.recipients.includes(recipient._id)) { recipient.deleted = true; } + return recipient; }); - + } + $scope.selected = []; $rootScope.toast({message: "Recipients deleted"}); diff --git a/public/js/services/api.service.js b/public/js/services/api.service.js index cece4c9..632687f 100644 --- a/public/js/services/api.service.js +++ b/public/js/services/api.service.js @@ -14,7 +14,11 @@ app.service('ApiService', ['$rootScope', '$http', '$location', function($rootSco }; this.verifyPhone = function(phone) { - return $http.post('/users/me/profile/phone/verification-code', {phone}); + return $http.post('/users/me/profile/phone/verification-code', { phone }); + }; + + this.unsubscribe = function(verificationCode) { + return $http.delete('/recipients/me', {params: { verificationCode }}); }; this.updatePhone = function(verificationCode) { @@ -88,12 +92,19 @@ app.service('ApiService', ['$rootScope', '$http', '$location', function($rootSco }; this.editRecipient = function(recipient) { - console.log(recipient); return $http.patch('/recipients/' + recipient._id, recipient); }; + this.restoreRecipient = function(recipient, resubscriptions) { + console.log(resubscriptions); + return $http.patch('/recipients/' + recipient._id + '/restore', { + resubscriptions + }); + }; + this.deleteRecipients = function(options) { // options: { recipients[], permanent (bool) } + return $http({ url: '/recipients', method: 'DELETE', @@ -101,10 +112,6 @@ app.service('ApiService', ['$rootScope', '$http', '$location', function($rootSco }); }; - this.restoreRecipient = function(recipient) { - return $http.patch('/recipients/' + recipient._id); - }; - this.getGoogleContacts = function({ animalType }) { return $http.get('/contacts', { params: { animal_type: animalType diff --git a/public/views/directives/message.html b/public/views/directives/message.html index 2580f40..55cf6f4 100644 --- a/public/views/directives/message.html +++ b/public/views/directives/message.html @@ -1,7 +1,28 @@ -
-
+
+ + + — + + — + + +
+ -
+ +
+ {{message.text}}
diff --git a/public/views/directives/recipients-list.html b/public/views/directives/recipients-list.html index dd5ef14..c2dc868 100644 --- a/public/views/directives/recipients-list.html +++ b/public/views/directives/recipients-list.html @@ -6,7 +6,7 @@ edit @@ -14,7 +14,7 @@ + ng-click="deleteRecipients($event, selected)"> delete @@ -49,11 +49,12 @@ + ng-repeat="animal in animals" + ng-class="{'hidden': !recipient.subscriptions.includes(animal.name)}"> - + - Subscribed to {{animal}} facts + Subscribed to {{animal.name}} facts {{recipient.number | tel}} diff --git a/public/views/home.html b/public/views/home.html index 998d0f5..d26cee2 100644 --- a/public/views/home.html +++ b/public/views/home.html @@ -3,10 +3,24 @@ {{fact}}
- Get Started + Sign in + + + + + Open App + + + + + Unsubscribe
diff --git a/public/views/partials/conversation.html b/public/views/partials/conversation.html index 3234e49..a98a008 100644 --- a/public/views/partials/conversation.html +++ b/public/views/partials/conversation.html @@ -1,21 +1,56 @@ -
- +
+ + + arrow_back
-

Catversation - {{data.recipient.name}}

-
{{data.recipient.number | tel}}
+

+ Catversation - {{data.recipient.name}} +

+ +
+ {{data.recipient.number | tel}} +
- -
- -

There aren't any messages yet :(

+ + +
+ + + + + + + +

+ + There aren't any messages yet :( +

\ No newline at end of file diff --git a/public/views/partials/delete-recipients.html b/public/views/partials/delete-recipients.html index 4563ea8..c955162 100644 --- a/public/views/partials/delete-recipients.html +++ b/public/views/partials/delete-recipients.html @@ -1,7 +1,7 @@

- Remove {{recipients.length}} {{recipients.length == 1 ? 'recipient' : 'recipients'}}? + Archive {{recipients.length == 1 ? recipients[0].name : recipients.length + ' recipients'}}?

{{recipients.length == 1 ? 'This person' : 'These people'}} will no longer recieve facts

diff --git a/public/views/partials/restore-recipient.html b/public/views/partials/restore-recipient.html new file mode 100644 index 0000000..956847c --- /dev/null +++ b/public/views/partials/restore-recipient.html @@ -0,0 +1,23 @@ + + +

+ Restore {{recipient.name}}? +

+ +

Select animals that this person will be resubscribed to:

+ + + + + + {{animal.name | capitalize}} facts + + + +
+ + + Cancel + Restore + +
\ No newline at end of file diff --git a/public/views/partials/unsubscribe.html b/public/views/partials/unsubscribe.html new file mode 100644 index 0000000..d94cdbb --- /dev/null +++ b/public/views/partials/unsubscribe.html @@ -0,0 +1,30 @@ + + +

+ Unsubscribe from {{$state.params.animal}} facts +

+ +

+ {{ + showCodeEntry ? + "Okay, we've send a verification code to your phone" : + "Enter the phone number you'd like to remove." + }} +

+ + + + + + + + + + +
+ + + Cancel + Unsubscribe + +
\ No newline at end of file diff --git a/server.js b/server.js index 26e91e2..e57ab12 100644 --- a/server.js +++ b/server.js @@ -17,7 +17,10 @@ const env = process.env.NODE_ENV || 'development'; global.Promise = require('bluebird'); mongoose.Promise = global.Promise; -mongoose.connect('mongodb://'+keys.database.username+':' + keys.database.password + '@ds157298.mlab.com:57298/cat-facts', {useMongoClient: true}); +mongoose.set('useCreateIndex', true); +mongoose.connect('mongodb://'+keys.database.username+':' + keys.database.password + '@ds157298.mlab.com:57298/cat-facts', { + useNewUrlParser: true +}); app.set('socketio', io); app.set('view engine', 'ejs');