From 6ee5f6a0a030c9f4eb34726d30d22cab1d4705ac Mon Sep 17 00:00:00 2001 From: Jimmy Domagala-Tang Date: Wed, 28 Jun 2023 10:19:56 -0400 Subject: [PATCH] Merge pull request #13497 from overleaf/jdt-extract-user-feature-set Extract user feature set to analytics GitOrigin-RevId: 41d25c9f32a01ffb27cf66217418d6014b20e841 --- package-lock.json | 84 ++++++++++++++++++- ...16153016_user_features_updated_at_index.js | 22 +++++ 2 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 services/web/migrations/20230616153016_user_features_updated_at_index.js diff --git a/package-lock.json b/package-lock.json index 0c502e2237..c6441b1a8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39360,7 +39360,7 @@ "minimist": "^1.2.7", "mixpanel": "^0.13.0", "moment": "^2.29.4", - "mongodb": "^3.6.6", + "mongodb": "^4.13.0", "p-limit": "^2.3.0", "pg": "^8.7.1", "pg-copy-streams": "^2.2.2", @@ -39386,6 +39386,57 @@ "sinon-chai": "^3.7.0" } }, + "services/analytics/node_modules/bson": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz", + "integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==", + "dependencies": { + "buffer": "^5.6.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "services/analytics/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "services/analytics/node_modules/mongodb": { + "version": "4.16.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.16.0.tgz", + "integrity": "sha512-0EB113Fsucaq1wsY0dOhi1fmZOwFtLOtteQkiqOXGklvWMnSH3g2QS53f0KTP+/6qOkuoXE2JksubSZNmxeI+g==", + "dependencies": { + "bson": "^4.7.2", + "mongodb-connection-string-url": "^2.5.4", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=12.9.0" + }, + "optionalDependencies": { + "@aws-sdk/credential-providers": "^3.186.0", + "saslprep": "^1.0.3" + } + }, "services/analytics/node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -48680,7 +48731,7 @@ "mixpanel": "^0.13.0", "mocha": "^10.2.0", "moment": "^2.29.4", - "mongodb": "^3.6.6", + "mongodb": "^4.13.0", "p-limit": "^2.3.0", "pg": "^8.7.1", "pg-copy-streams": "^2.2.2", @@ -48697,6 +48748,35 @@ "yargs": "^17.0.0" }, "dependencies": { + "bson": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz", + "integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==", + "requires": { + "buffer": "^5.6.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "mongodb": { + "version": "4.16.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.16.0.tgz", + "integrity": "sha512-0EB113Fsucaq1wsY0dOhi1fmZOwFtLOtteQkiqOXGklvWMnSH3g2QS53f0KTP+/6qOkuoXE2JksubSZNmxeI+g==", + "requires": { + "@aws-sdk/credential-providers": "^3.186.0", + "bson": "^4.7.2", + "mongodb-connection-string-url": "^2.5.4", + "saslprep": "^1.0.3", + "socks": "^2.7.1" + } + }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", diff --git a/services/web/migrations/20230616153016_user_features_updated_at_index.js b/services/web/migrations/20230616153016_user_features_updated_at_index.js new file mode 100644 index 0000000000..f4ab80ea9d --- /dev/null +++ b/services/web/migrations/20230616153016_user_features_updated_at_index.js @@ -0,0 +1,22 @@ +/* eslint-disable no-unused-vars */ + +const Helpers = require('./lib/helpers') + +exports.tags = ['saas'] + +const index = { + key: { + featuresUpdatedAt: 1, + }, + name: 'featuresUpdatedAt_1', +} + +exports.migrate = async client => { + const { db } = client + await Helpers.addIndexesToCollection(db.users, [index]) +} + +exports.rollback = async client => { + const { db } = client + await Helpers.dropIndexesFromCollection(db.users, [index]) +}