From ea500a26bce408347c9468d0882a507deb6c8270 Mon Sep 17 00:00:00 2001 From: matheusccastro Date: Fri, 6 Sep 2024 00:19:15 -0300 Subject: [PATCH 1/2] refactor: replace `synchronousCursor` with `asynchronousCursor`. Also use `async api` when possible --- .../.npm/package/npm-shrinkwrap.json | 18 +- packages/accounts-base/accounts_server.js | 7 +- .../email/.npm/package/npm-shrinkwrap.json | 12 +- packages/minimongo/constants.js | 4 +- packages/minimongo/cursor.js | 4 +- packages/mongo/collection.js | 5 - packages/mongo/collection_tests.js | 6 +- packages/mongo/mongo_driver.js | 283 ++---------------- packages/mongo/observe_changes_tests.js | 2 +- packages/mongo/polling_observe_driver.js | 8 +- packages/mongo/remote_collection_driver.js | 4 +- .../.npm/package/npm-shrinkwrap.json | 132 ++++---- .../webapp/.npm/package/npm-shrinkwrap.json | 12 +- 13 files changed, 136 insertions(+), 361 deletions(-) diff --git a/packages/accounts-2fa/.npm/package/npm-shrinkwrap.json b/packages/accounts-2fa/.npm/package/npm-shrinkwrap.json index 0376b5ea045..93c418735ae 100644 --- a/packages/accounts-2fa/.npm/package/npm-shrinkwrap.json +++ b/packages/accounts-2fa/.npm/package/npm-shrinkwrap.json @@ -2,9 +2,9 @@ "lockfileVersion": 4, "dependencies": { "@types/node": { - "version": "22.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz", - "integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==" + "version": "22.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==" }, "@types/notp": { "version": "2.0.5", @@ -32,14 +32,14 @@ "integrity": "sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA==" }, "tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" }, "undici-types": { - "version": "6.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz", - "integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" } } } diff --git a/packages/accounts-base/accounts_server.js b/packages/accounts-base/accounts_server.js index cf8f573b1d3..64d03b1ced4 100644 --- a/packages/accounts-base/accounts_server.js +++ b/packages/accounts-base/accounts_server.js @@ -1265,15 +1265,14 @@ export class AccountsServer extends AccountsCommon { // that would give a lot of power to an attacker with a stolen login // token and the ability to crash the server. Meteor.startup(async () => { - const users = await this.users.find({ + await this.users.find({ "services.resume.haveLoginTokensToDelete": true }, { fields: { "services.resume.loginTokensToDelete": 1 } - }) - users.forEach(user => { - this._deleteSavedTokensForUser( + }).forEachAsync(user => { + return this._deleteSavedTokensForUser( user._id, user.services.resume.loginTokensToDelete ) diff --git a/packages/email/.npm/package/npm-shrinkwrap.json b/packages/email/.npm/package/npm-shrinkwrap.json index 00cd9f35041..1101bf7754c 100644 --- a/packages/email/.npm/package/npm-shrinkwrap.json +++ b/packages/email/.npm/package/npm-shrinkwrap.json @@ -2,9 +2,9 @@ "lockfileVersion": 4, "dependencies": { "@types/node": { - "version": "22.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz", - "integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==" + "version": "22.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==" }, "@types/nodemailer": { "version": "6.4.14", @@ -57,9 +57,9 @@ "integrity": "sha512-DQi1h8VEBA/lURbSwFtEHnSTb9s2/pwLEaFuNhXwy1Dx3Sa0lOuYT2yNUr4/j2fs8oCAMANtrZ5OrPZtyVs3MQ==" }, "undici-types": { - "version": "6.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz", - "integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" } } } diff --git a/packages/minimongo/constants.js b/packages/minimongo/constants.js index ac72e9c9a83..72270311e82 100644 --- a/packages/minimongo/constants.js +++ b/packages/minimongo/constants.js @@ -5,7 +5,7 @@ export function getAsyncMethodName(method) { return `${method.replace('_', '')}Async`; } -export const ASYNC_COLLECTION_METHODS = [ +export const COLLECTION_METHODS = [ '_createCappedCollection', 'dropCollection', 'dropIndex', @@ -90,7 +90,7 @@ export const ASYNC_COLLECTION_METHODS = [ 'upsert', ]; -export const ASYNC_CURSOR_METHODS = [ +export const CURSOR_METHODS = [ /** * @deprecated in 2.9 * @summary Returns the number of documents that match a query. This method is diff --git a/packages/minimongo/cursor.js b/packages/minimongo/cursor.js index bfdecc49f8e..f7f5e7e483f 100644 --- a/packages/minimongo/cursor.js +++ b/packages/minimongo/cursor.js @@ -1,6 +1,6 @@ import LocalCollection from './local_collection.js'; import { hasOwn } from './common.js'; -import { ASYNC_CURSOR_METHODS, getAsyncMethodName } from './constants'; +import { CURSOR_METHODS, getAsyncMethodName } from './constants'; // Cursor: a specification for a particular subset of documents, w/ a defined // order, limit, and offset. creating a Cursor with LocalCollection.find(), @@ -558,7 +558,7 @@ export default class Cursor { } // Implements async version of cursor methods to keep collections isomorphic -ASYNC_CURSOR_METHODS.forEach(method => { +CURSOR_METHODS.forEach(method => { const asyncName = getAsyncMethodName(method); Cursor.prototype[asyncName] = function(...args) { try { diff --git a/packages/mongo/collection.js b/packages/mongo/collection.js index 06bc59ae356..2a99f0916c2 100644 --- a/packages/mongo/collection.js +++ b/packages/mongo/collection.js @@ -1,10 +1,5 @@ // options.connection, if given, is a LivedataClient or LivedataServer // XXX presently there is no way to destroy/clean up a Collection -import { - ASYNC_COLLECTION_METHODS, - getAsyncMethodName, -} from 'meteor/minimongo/constants'; - import { normalizeProjection } from "./mongo_utils"; /** diff --git a/packages/mongo/collection_tests.js b/packages/mongo/collection_tests.js index a0e9e7fecf0..1ebd8dbdb2d 100644 --- a/packages/mongo/collection_tests.js +++ b/packages/mongo/collection_tests.js @@ -191,12 +191,12 @@ Tinytest.add('collection - calling find with a valid readPreference', // as the cursor options are now private // You can check on abstract_cursor.ts the exposed public getters test.equal( - defaultCursor._synchronousCursor._dbCursor.readPreference + defaultCursor._asynchronousCursor._dbCursor.readPreference .mode, defaultReadPreference ); test.equal( - customCursor._synchronousCursor._dbCursor.readPreference.mode, + customCursor._asynchronousCursor._dbCursor.readPreference.mode, customReadPreference ); } @@ -214,7 +214,7 @@ Tinytest.addAsync('collection - calling find with an invalid readPreference', ); await test.throwsAsync(async function() { - // Trigger the creation of _synchronousCursor + // Trigger the creation of _asynchronousCursor await cursor.countAsync(); }, `Invalid read preference mode "${invalidReadPreference}"`); } diff --git a/packages/mongo/mongo_driver.js b/packages/mongo/mongo_driver.js index ae9f466e302..594b61d1650 100644 --- a/packages/mongo/mongo_driver.js +++ b/packages/mongo/mongo_driver.js @@ -16,7 +16,7 @@ const util = require("util"); var MongoDB = NpmModuleMongodb; import { DocFetcher } from "./doc_fetcher.js"; import { - ASYNC_CURSOR_METHODS, + CURSOR_METHODS, CLIENT_ONLY_METHODS, getAsyncMethodName } from "meteor/minimongo/constants"; @@ -198,7 +198,7 @@ MongoConnection = function (url, options) { name: 'Meteor', version: Meteor.release } - + self.client = new MongoDB.MongoClient(url, mongoOptions); self.db = self.client.db(); @@ -768,7 +768,7 @@ MongoConnection.prototype.findOneAsync = async function (collection_name, select options = options || {}; options.limit = 1; - const results = await self.find(collection_name, selector, options).fetch(); + const results = await self.find(collection_name, selector, options).fetchAsync(); return results[0]; }; @@ -834,13 +834,13 @@ CLIENT_ONLY_METHODS.forEach(function (m) { // not affect observeChanges output (eg, options.transform functions are not // stringifiable but do not affect observeChanges). // -// SynchronousCursor is a wrapper around a MongoDB cursor -// which includes fully-synchronous versions of forEach, etc. +// AsynchronousCursor is a wrapper around a MongoDB cursor +// which includes fully-asynchronous versions of forEach, etc. // // Cursor is the cursor object returned from find(), which implements the // documented Mongo.Collection cursor API. It wraps a CursorDescription and a -// SynchronousCursor (lazily: it doesn't contact Mongo until you call a method -// like fetch or forEach on it). +// AsynchronousCursor (lazily: it doesn't contact Mongo until you call a method +// like fetch/fetchAsync or forEach/forEachAsync on it). // // ObserveHandle is the "observe handle" returned from observeChanges. It has a // reference to an ObserveMultiplexer. @@ -869,30 +869,9 @@ Cursor = function (mongo, cursorDescription) { self._mongo = mongo; self._cursorDescription = cursorDescription; - self._synchronousCursor = null; + self._asynchronousCursor = null; }; -function setupSynchronousCursor(cursor, method) { - // You can only observe a tailable cursor. - if (cursor._cursorDescription.options.tailable) - throw new Error('Cannot call ' + method + ' on a tailable cursor'); - - if (!cursor._synchronousCursor) { - cursor._synchronousCursor = cursor._mongo._createSynchronousCursor( - cursor._cursorDescription, - { - // Make sure that the "cursor" argument to forEach/map callbacks is the - // Cursor, not the SynchronousCursor. - selfForIteration: cursor, - useTransform: true, - } - ); - } - - return cursor._synchronousCursor; -} - - Cursor.prototype.countAsync = async function () { const collection = this._mongo.rawCollection(this._cursorDescription.collectionName); return await collection.countDocuments( @@ -907,30 +886,29 @@ Cursor.prototype.count = function () { ); }; -[...ASYNC_CURSOR_METHODS, Symbol.iterator, Symbol.asyncIterator].forEach(methodName => { - // count is handled specially since we don't want to create a cursor. - // it is still included in ASYNC_CURSOR_METHODS because we still want an async version of it to exist. - if (methodName === 'count') { - return - } - Cursor.prototype[methodName] = function (...args) { - const cursor = setupSynchronousCursor(this, methodName); - return cursor[methodName](...args); - }; - - // These methods are handled separately. - if (methodName === Symbol.iterator || methodName === Symbol.asyncIterator) { - return; - } - - const methodNameAsync = getAsyncMethodName(methodName); - Cursor.prototype[methodNameAsync] = function (...args) { - try { - return Promise.resolve(this[methodName](...args)); - } catch (error) { - return Promise.reject(error); +// We don't handle the count method here. +[...CURSOR_METHODS, Symbol.asyncIterator].filter(method => method !== CURSOR_METHODS[0]).forEach(function(method) { + Cursor.prototype[method] = function asynchronousCursorMethod () { + // You can only observe a tailable cursor. + if (this._cursorDescription.options.tailable) + throw new Error("Cannot call " + method + " on a tailable cursor"); + + if (!this._asynchronousCursor) { + this._asynchronousCursor = this._mongo._createAsynchronousCursor( + this._cursorDescription, { + // Make sure that the "self" argument to forEach/map callbacks is the + // Cursor, not the AsynchronousCursor. + selfForIteration: this, + useTransform: true + }); } + + return this._asynchronousCursor[method].apply( + this._asynchronousCursor, arguments); }; + if (method !== Symbol.asyncIterator) { + Cursor.prototype[getAsyncMethodName(method)] = Cursor.prototype[method]; + } }); Cursor.prototype.getTransform = function () { @@ -992,7 +970,7 @@ Cursor.prototype.observeChangesAsync = async function (callbacks, options = {}) return this.observeChanges(callbacks, options); }; -MongoConnection.prototype._createSynchronousCursor = function( +MongoConnection.prototype._createAsynchronousCursor = function( cursorDescription, options) { var self = this; options = _.pick(options || {}, 'selfForIteration', 'useTransform'); @@ -1198,203 +1176,6 @@ class AsynchronousCursor { } } -var SynchronousCursor = function (dbCursor, cursorDescription, options, collection) { - var self = this; - options = _.pick(options || {}, 'selfForIteration', 'useTransform'); - - self._dbCursor = dbCursor; - self._cursorDescription = cursorDescription; - // The "self" argument passed to forEach/map callbacks. If we're wrapped - // inside a user-visible Cursor, we want to provide the outer cursor! - self._selfForIteration = options.selfForIteration || self; - if (options.useTransform && cursorDescription.options.transform) { - self._transform = LocalCollection.wrapTransform( - cursorDescription.options.transform); - } else { - self._transform = null; - } - - self._synchronousCount = Future.wrap( - collection.countDocuments.bind( - collection, - replaceTypes(cursorDescription.selector, replaceMeteorAtomWithMongo), - replaceTypes(cursorDescription.options, replaceMeteorAtomWithMongo), - ) - ); - self._visitedIds = new LocalCollection._IdMap; -}; - -_.extend(SynchronousCursor.prototype, { - // Returns a Promise for the next object from the underlying cursor (before - // the Mongo->Meteor type replacement). - _rawNextObjectPromise: function () { - const self = this; - return new Promise((resolve, reject) => { - self._dbCursor.next((err, doc) => { - if (err) { - reject(err); - } else { - resolve(doc); - } - }); - }); - }, - - // Returns a Promise for the next object from the cursor, skipping those whose - // IDs we've already seen and replacing Mongo atoms with Meteor atoms. - _nextObjectPromise: async function () { - var self = this; - - while (true) { - var doc = await self._rawNextObjectPromise(); - - if (!doc) return null; - doc = replaceTypes(doc, replaceMongoAtomWithMeteor); - - if (!self._cursorDescription.options.tailable && _.has(doc, '_id')) { - // Did Mongo give us duplicate documents in the same cursor? If so, - // ignore this one. (Do this before the transform, since transform might - // return some unrelated value.) We don't do this for tailable cursors, - // because we want to maintain O(1) memory usage. And if there isn't _id - // for some reason (maybe it's the oplog), then we don't do this either. - // (Be careful to do this for falsey but existing _id, though.) - if (self._visitedIds.has(doc._id)) continue; - self._visitedIds.set(doc._id, true); - } - - if (self._transform) - doc = self._transform(doc); - - return doc; - } - }, - - // Returns a promise which is resolved with the next object (like with - // _nextObjectPromise) or rejected if the cursor doesn't return within - // timeoutMS ms. - _nextObjectPromiseWithTimeout: function (timeoutMS) { - const self = this; - if (!timeoutMS) { - return self._nextObjectPromise(); - } - const nextObjectPromise = self._nextObjectPromise(); - const timeoutErr = new Error('Client-side timeout waiting for next object'); - const timeoutPromise = new Promise((resolve, reject) => { - const timer = setTimeout(() => { - reject(timeoutErr); - }, timeoutMS); - }); - return Promise.race([nextObjectPromise, timeoutPromise]) - .catch((err) => { - if (err === timeoutErr) { - self.close(); - } - throw err; - }); - }, - - _nextObject: function () { - var self = this; - return self._nextObjectPromise().await(); - }, - - forEach: function (callback, thisArg) { - var self = this; - const wrappedFn = Meteor.wrapFn(callback); - - // Get back to the beginning. - self._rewind(); - - // We implement the loop ourself instead of using self._dbCursor.each, - // because "each" will call its callback outside of a fiber which makes it - // much more complex to make this function synchronous. - var index = 0; - while (true) { - var doc = self._nextObject(); - if (!doc) return; - wrappedFn.call(thisArg, doc, index++, self._selfForIteration); - } - }, - - // XXX Allow overlapping callback executions if callback yields. - map: function (callback, thisArg) { - var self = this; - const wrappedFn = Meteor.wrapFn(callback); - var res = []; - self.forEach(function (doc, index) { - res.push(wrappedFn.call(thisArg, doc, index, self._selfForIteration)); - }); - return res; - }, - - _rewind: function () { - var self = this; - - // known to be synchronous - self._dbCursor.rewind(); - - self._visitedIds = new LocalCollection._IdMap; - }, - - // Mostly usable for tailable cursors. - close: function () { - var self = this; - - self._dbCursor.close(); - }, - - fetch: function () { - var self = this; - return self.map(_.identity); - }, - - count: function () { - var self = this; - return self._synchronousCount().wait(); - }, - - // This method is NOT wrapped in Cursor. - getRawObjects: function (ordered) { - var self = this; - if (ordered) { - return self.fetch(); - } else { - var results = new LocalCollection._IdMap; - self.forEach(function (doc) { - results.set(doc._id, doc); - }); - return results; - } - } -}); - -SynchronousCursor.prototype[Symbol.iterator] = function () { - var self = this; - - // Get back to the beginning. - self._rewind(); - - return { - next() { - const doc = self._nextObject(); - return doc ? { - value: doc - } : { - done: true - }; - } - }; -}; - -SynchronousCursor.prototype[Symbol.asyncIterator] = function () { - const syncResult = this[Symbol.iterator](); - return { - async next() { - return Promise.resolve(syncResult.next()); - } - }; -} - // Tails the cursor described by cursorDescription, most likely on the // oplog. Calls docCallback with each document found. Ignores errors and just // restarts the tail on error. @@ -1406,7 +1187,7 @@ MongoConnection.prototype.tail = function (cursorDescription, docCallback, timeo if (!cursorDescription.options.tailable) throw new Error("Can only tail a tailable cursor"); - var cursor = self._createSynchronousCursor(cursorDescription); + var cursor = self._createAsynchronousCursor(cursorDescription); var stopped = false; var lastTS; @@ -1441,7 +1222,7 @@ MongoConnection.prototype.tail = function (cursorDescription, docCallback, timeo if (lastTS) { newSelector.ts = {$gt: lastTS}; } - cursor = self._createSynchronousCursor(new CursorDescription( + cursor = self._createAsynchronousCursor(new CursorDescription( cursorDescription.collectionName, newSelector, cursorDescription.options)); diff --git a/packages/mongo/observe_changes_tests.js b/packages/mongo/observe_changes_tests.js index 30004d4b1df..9161be7d525 100644 --- a/packages/mongo/observe_changes_tests.js +++ b/packages/mongo/observe_changes_tests.js @@ -469,7 +469,7 @@ const getPromiseAndResolver = () => { if (Meteor.isServer) { testAsyncMulti("observeChanges - tailable", [ - async function (test, expect) { + async function (test) { var self = this; var collName = 'cap_' + Random.id(); var coll = new Mongo.Collection(collName); diff --git a/packages/mongo/polling_observe_driver.js b/packages/mongo/polling_observe_driver.js index 13da97b3c0f..31d97bc8b07 100644 --- a/packages/mongo/polling_observe_driver.js +++ b/packages/mongo/polling_observe_driver.js @@ -12,7 +12,7 @@ PollingObserveDriver = function (options) { self._stopCallbacks = []; self._stopped = false; - self._cursor = self._mongoHandle._createSynchronousCursor( + self._cursor = self._mongoHandle._createAsynchronousCursor( self._cursorDescription); // previous results snapshot. on each poll cycle, diffs against @@ -38,7 +38,7 @@ PollingObserveDriver = function (options) { // XXX figure out if we still need a queue self._taskQueue = new Meteor._AsynchronousQueue(); - + }; _.extend(PollingObserveDriver.prototype, { @@ -61,7 +61,7 @@ _.extend(PollingObserveDriver.prototype, { } ); self._stopCallbacks.push(async function () { await listenersHandle.stop(); }); - + // every once and a while, poll even if we don't think we're dirty, for // eventual consistency with database writes from outside the Meteor // universe. @@ -82,7 +82,7 @@ _.extend(PollingObserveDriver.prototype, { Meteor.clearInterval(intervalHandle); }); } - + // Make sure we actually poll soon! await this._unthrottledEnsurePollIsScheduled(); diff --git a/packages/mongo/remote_collection_driver.js b/packages/mongo/remote_collection_driver.js index 36a8a309105..7f5ffe870ab 100644 --- a/packages/mongo/remote_collection_driver.js +++ b/packages/mongo/remote_collection_driver.js @@ -1,5 +1,5 @@ import { - ASYNC_COLLECTION_METHODS, + COLLECTION_METHODS, getAsyncMethodName, CLIENT_ONLY_METHODS } from "meteor/minimongo/constants"; @@ -34,7 +34,7 @@ Object.assign(MongoInternals.RemoteCollectionDriver.prototype, { REMOTE_COLLECTION_METHODS.forEach(function (m) { ret[m] = _.bind(self.mongo[m], self.mongo, name); - if (!ASYNC_COLLECTION_METHODS.includes(m)) return; + if (!COLLECTION_METHODS.includes(m)) return; const asyncMethodName = getAsyncMethodName(m); ret[asyncMethodName] = function (...args) { try { diff --git a/packages/npm-mongo/.npm/package/npm-shrinkwrap.json b/packages/npm-mongo/.npm/package/npm-shrinkwrap.json index 3dc9f41668f..4c4a978ce1c 100644 --- a/packages/npm-mongo/.npm/package/npm-shrinkwrap.json +++ b/packages/npm-mongo/.npm/package/npm-shrinkwrap.json @@ -56,34 +56,34 @@ } }, "@aws-sdk/client-cognito-identity": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.631.0.tgz", - "integrity": "sha512-TXRkgwiLmNpwbiQShtUtSSE4DDHblhjHvtgxtzonzvdlDvYmCmaOwAQgi3HWuHztJtZ9ghf3jKB3N3jxAuKBbA==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.645.0.tgz", + "integrity": "sha512-nBfWDzWBQI1NCHYqBAmiifhdnLRxQYozaq6OjTuRcALjYJbOdFV7t0w9FWGISOq1OnM7r8UdCXlr2bzdyU0tJA==" }, "@aws-sdk/client-sso": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.631.0.tgz", - "integrity": "sha512-tpXRQMbbTsKED6GGF0rZbg9Nr0DRCWImopX2lVh4deIeHQfNxeOtq2brqDWiPD593I190xeL/HMChSOmvDXNAw==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.645.0.tgz", + "integrity": "sha512-2rc8TjnsNddOeKQ/pfNN7deNvGLXAeKeYtHtGDAiM2qfTKxd2sNcAsZ+JCDLyshuD4xLM5fpUyR0X8As9EAouQ==" }, "@aws-sdk/client-sso-oidc": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.631.0.tgz", - "integrity": "sha512-afJAssIvsHibVq65qO3Q31NCfSTsPEnyr+PT80uGVAkKev1PJI1AjsxBGUTLtPMV8lrzDzDx5CG9ax1AZ3LG6w==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.645.0.tgz", + "integrity": "sha512-X9ULtdk3cO+1ysurEkJ1MSnu6U00qodXx+IVual+1jXX4RYY1WmQmfo7uDKf6FFkz7wW1DAqU+GJIBNQr0YH8A==" }, "@aws-sdk/client-sts": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.631.0.tgz", - "integrity": "sha512-Zo/2XDrmNpnSRlQLL8XOCJxuN7UIrGKf4itdjHqtEmD2PqstnYe6IMeEVOELpZ8iktjvsIrVr+qxlIX1QlmgCQ==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.645.0.tgz", + "integrity": "sha512-6azXYtvtnAsPf2ShN9vKynIYVcJOpo6IoVmoMAVgNaBJyllP+s/RORzranYZzckqfmrudSxtct4rVapjLWuAMg==" }, "@aws-sdk/core": { - "version": "3.629.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.629.0.tgz", - "integrity": "sha512-+/ShPU/tyIBM3oY1cnjgNA/tFyHtlWq+wXF9xEKRv19NOpYbWQ+xzNwVjGq8vR07cCRqy/sDQLWPhxjtuV/FiQ==" + "version": "3.635.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.635.0.tgz", + "integrity": "sha512-i1x/E/sgA+liUE1XJ7rj1dhyXpAKO1UKFUcTTHXok2ARjWTvszHnSXMOsB77aPbmn0fUp1JTx2kHUAZ1LVt5Bg==" }, "@aws-sdk/credential-provider-cognito-identity": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.631.0.tgz", - "integrity": "sha512-HU6K7m9R95Hu/oQlLgP77h6NmoT6ABEGAUTDZydPV2G9G5LW3ytOjzLNJT9zO99UGb6L3mIn2IB5LtHOzjthGw==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.645.0.tgz", + "integrity": "sha512-Z4By/90TaYQZO1dPR1udYhegFiOlSWnZsJOYSAk4Gdny26Tqb78xVLw9R/33CzFblXC4WVSt4gizXTQ/sYyHNg==" }, "@aws-sdk/credential-provider-env": { "version": "3.620.1", @@ -91,19 +91,19 @@ "integrity": "sha512-ExuILJ2qLW5ZO+rgkNRj0xiAipKT16Rk77buvPP8csR7kkCflT/gXTyzRe/uzIiETTxM7tr8xuO9MP/DQXqkfg==" }, "@aws-sdk/credential-provider-http": { - "version": "3.622.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.622.0.tgz", - "integrity": "sha512-VUHbr24Oll1RK3WR8XLUugLpgK9ZuxEm/NVeVqyFts1Ck9gsKpRg1x4eH7L7tW3SJ4TDEQNMbD7/7J+eoL2svg==" + "version": "3.635.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.635.0.tgz", + "integrity": "sha512-iJyRgEjOCQlBMXqtwPLIKYc7Bsc6nqjrZybdMDenPDa+kmLg7xh8LxHsu9088e+2/wtLicE34FsJJIfzu3L82g==" }, "@aws-sdk/credential-provider-ini": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.631.0.tgz", - "integrity": "sha512-34NmRl6GYlyKTHwiA3C3MjCtmXfoaOXI8b2h7P9eAC8leuIb/51v482g0K6X5P5FqaGY8ZreUq5BMsGjBRr1uQ==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.645.0.tgz", + "integrity": "sha512-LlZW0qwUwNlTaAIDCNpLbPsyXvS42pRIwF92fgtCQedmdnpN3XRUC6hcwSYI7Xru3GGKp3RnceOvsdOaRJORsw==" }, "@aws-sdk/credential-provider-node": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.631.0.tgz", - "integrity": "sha512-MlYcFknrMQ8RUVe0DMPE09mX8+97s7MLwnVV8l+LFi7m+ZfBz+h6LrohhOXC5elJHf4G3T0r/9Rwct63+zHK/w==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.645.0.tgz", + "integrity": "sha512-eGFFuNvLeXjCJf5OCIuSEflxUowmK+bCS+lK4M8ofsYOEGAivdx7C0UPxNjHpvM8wKd8vpMl5phTeS9BWX5jMQ==" }, "@aws-sdk/credential-provider-process": { "version": "3.620.1", @@ -111,9 +111,9 @@ "integrity": "sha512-hWqFMidqLAkaV9G460+1at6qa9vySbjQKKc04p59OT7lZ5cO5VH5S4aI05e+m4j364MBROjjk2ugNvfNf/8ILg==" }, "@aws-sdk/credential-provider-sso": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.631.0.tgz", - "integrity": "sha512-k3Mj1Fc7faVOGR+qrwROir/8No35G7gbVL5FuY467x3y0ELa/6w0j/0HM+5eqzGABW7pSL/OHONhWKlYwg7Gkw==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.645.0.tgz", + "integrity": "sha512-d6XuChAl5NCsCrUexc6AFb4efPmb9+66iwPylKG+iMTMYgO1ackfy1Q2/f35jdn0jolkPkzKsVyfzsEVoID6ew==" }, "@aws-sdk/credential-provider-web-identity": { "version": "3.621.0", @@ -121,9 +121,9 @@ "integrity": "sha512-w7ASSyfNvcx7+bYGep3VBgC3K6vEdLmlpjT7nSIHxxQf+WSdvy+HynwJosrpZax0sK5q0D1Jpn/5q+r5lwwW6w==" }, "@aws-sdk/credential-providers": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.631.0.tgz", - "integrity": "sha512-1yWtgVeEfOogMNLKMADA0f1+zBsKtG5uojU3krQXaq4VDxHgVs0DsFot6BM2/nH8QH49eME7+C2ME9yXGxKBfA==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.645.0.tgz", + "integrity": "sha512-6g9qMngrMCvHNsxmh/1urnWKrvaa2fv55b3bYwPxwJCYAvg/xc7bV8YHL7GS2rJpACG707k9G86DTW+Hab8bJA==" }, "@aws-sdk/middleware-host-header": { "version": "3.620.0", @@ -141,9 +141,9 @@ "integrity": "sha512-nh91S7aGK3e/o1ck64sA/CyoFw+gAYj2BDOnoNa6ouyCrVJED96ZXWbhye/fz9SgmNUZR2g7GdVpiLpMKZoI5w==" }, "@aws-sdk/middleware-user-agent": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.631.0.tgz", - "integrity": "sha512-mpFRFaP9fjXhw8NiRTP+lBPKRKMSKzfCyTXQXrQCSo4fAUaz8LPCc8VdqyoNmx4CLBTRflbEHLx5PfInA0DsrA==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.645.0.tgz", + "integrity": "sha512-NpTAtqWK+49lRuxfz7st9for80r4NriCMK0RfdJSoPFVntjsSQiQ7+2nW2XL05uVY633e9DvCAw8YatX3zd1mw==" }, "@aws-sdk/region-config-resolver": { "version": "3.614.0", @@ -161,9 +161,9 @@ "integrity": "sha512-+Tqnh9w0h2LcrUsdXyT1F8mNhXz+tVYBtP19LpeEGntmvHwa2XzvLUCWpoIAIVsHp5+HdB2X9Sn0KAtmbFXc2Q==" }, "@aws-sdk/util-endpoints": { - "version": "3.631.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.631.0.tgz", - "integrity": "sha512-aavsyk17lK/r6rfVFYLh6/Y0eWvtbclWteJyW9PQLo5mpHPcTj6IbqMN4LHV27Y9IF7oOlbEAQ1CGTfpUlOvTg==" + "version": "3.645.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.645.0.tgz", + "integrity": "sha512-Oe+xaU4ic4PB1k3pb5VTC1/MWES13IlgpaQw01bVHGfwP6Yv6zZOxizRzca2Y3E+AyR+nKD7vXtHRY+w3bi4bg==" }, "@aws-sdk/util-locate-window": { "version": "3.568.0", @@ -181,9 +181,9 @@ "integrity": "sha512-15ElZT88peoHnq5TEoEtZwoXTXRxNrk60TZNdpl/TUBJ5oNJ9Dqb5Z4ryb8ofN6nm9aFf59GVAerFDz8iUoHBA==" }, "@mongodb-js/saslprep": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.8.tgz", - "integrity": "sha512-qKwC/M/nNNaKUBMQ0nuzm47b7ZYWQHN3pcXq4IIcoSBc2hOIrflAxJduIvvqmhoz3gR2TacTAs8vlsCVPkiEdQ==" + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz", + "integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==" }, "@smithy/abort-controller": { "version": "3.1.1", @@ -196,9 +196,9 @@ "integrity": "sha512-SkW5LxfkSI1bUC74OtfBbdz+grQXYiPYolyu8VfpLIjEoN/sHVBlLeGXMQ1vX4ejkgfv6sxVbQJ32yF2cl1veA==" }, "@smithy/core": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@smithy/core/-/core-2.3.2.tgz", - "integrity": "sha512-in5wwt6chDBcUv1Lw1+QzZxN9fBffi+qOixfb65yK4sDuKG7zAUO9HAFqmVzsZM3N+3tTyvZjtnDXePpvp007Q==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-2.4.0.tgz", + "integrity": "sha512-cHXq+FneIF/KJbt4q4pjN186+Jf4ZB0ZOqEaZMBhT79srEyGDDBV31NqBRBjazz8ppQ1bJbDJMY9ba5wKFV36w==" }, "@smithy/credential-provider-imds": { "version": "3.2.0", @@ -236,9 +236,9 @@ "integrity": "sha512-5y5aiKCEwg9TDPB4yFE7H6tYvGFf1OJHNczeY10/EFF8Ir8jZbNntQJxMWNfeQjC1mxPsaQ6mR9cvQbf+0YeMw==" }, "@smithy/middleware-retry": { - "version": "3.0.14", - "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-3.0.14.tgz", - "integrity": "sha512-7ZaWZJOjUxa5hgmuMspyt8v/zVsh0GXYuF7OvCmdcbVa/xbnKQoYC+uYKunAqRGTkxjOyuOCw9rmFUFOqqC0eQ==" + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-3.0.15.tgz", + "integrity": "sha512-iTMedvNt1ApdvkaoE8aSDuwaoc+BhvHqttbA/FO4Ty+y/S5hW6Ci/CTScG7vam4RYJWZxdTElc3MEfHRVH6cgQ==" }, "@smithy/middleware-serde": { "version": "3.0.3", @@ -296,9 +296,9 @@ "integrity": "sha512-aRryp2XNZeRcOtuJoxjydO6QTaVhxx/vjaR+gx7ZjaFgrgPRyZ3HCTbfwqYj6ZWEBHkCSUfcaymKPURaByukag==" }, "@smithy/smithy-client": { - "version": "3.1.12", - "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-3.1.12.tgz", - "integrity": "sha512-wtm8JtsycthkHy1YA4zjIh2thJgIQ9vGkoR639DBx5lLlLNU0v4GARpQZkr2WjXue74nZ7MiTSWfVrLkyD8RkA==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-3.2.0.tgz", + "integrity": "sha512-pDbtxs8WOhJLJSeaF/eAbPgXg4VVYFlRcL/zoNYA5WbG3wBL06CHtBSg53ppkttDpAJ/hdiede+xApip1CwSLw==" }, "@smithy/types": { "version": "3.3.0", @@ -336,14 +336,14 @@ "integrity": "sha512-pbjk4s0fwq3Di/ANL+rCvJMKM5bzAQdE5S/6RL5NXgMExFAi6UgQMPOm5yPaIWPpr+EOXKXRonJ3FoxKf4mCJQ==" }, "@smithy/util-defaults-mode-browser": { - "version": "3.0.14", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.14.tgz", - "integrity": "sha512-0iwTgKKmAIf+vFLV8fji21Jb2px11ktKVxbX6LIDPAUJyWQqGqBVfwba7xwa1f2FZUoolYQgLvxQEpJycXuQ5w==" + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.15.tgz", + "integrity": "sha512-FZ4Psa3vjp8kOXcd3HJOiDPBCWtiilLl57r0cnNtq/Ga9RSDrM5ERL6xt+tO43+2af6Pn5Yp92x2n5vPuduNfg==" }, "@smithy/util-defaults-mode-node": { - "version": "3.0.14", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.14.tgz", - "integrity": "sha512-e9uQarJKfXApkTMMruIdxHprhcXivH1flYCe8JRDTzkkLx8dA3V5J8GZlST9yfDiRWkJpZJlUXGN9Rc9Ade3OQ==" + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.15.tgz", + "integrity": "sha512-KSyAAx2q6d0t6f/S4XB2+3+6aQacm3aLMhs9aLMqn18uYGUepbdssfogW5JQZpc6lXNBnp0tEnR5e9CEKmEd7A==" }, "@smithy/util-endpoints": { "version": "2.0.5", @@ -381,9 +381,9 @@ "integrity": "sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA==" }, "@types/node": { - "version": "22.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz", - "integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==" + "version": "22.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==" }, "@types/webidl-conversions": { "version": "7.0.3", @@ -486,14 +486,14 @@ "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==" }, "tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" }, "undici-types": { - "version": "6.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz", - "integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" }, "uuid": { "version": "9.0.1", diff --git a/packages/webapp/.npm/package/npm-shrinkwrap.json b/packages/webapp/.npm/package/npm-shrinkwrap.json index 59e90defbdd..46503eb4215 100644 --- a/packages/webapp/.npm/package/npm-shrinkwrap.json +++ b/packages/webapp/.npm/package/npm-shrinkwrap.json @@ -32,9 +32,9 @@ "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" }, "@types/node": { - "version": "22.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz", - "integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==" + "version": "22.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==" }, "@types/qs": { "version": "6.9.15", @@ -469,9 +469,9 @@ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==" }, "undici-types": { - "version": "6.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz", - "integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" }, "unpipe": { "version": "1.0.0", From 4fabb2972cc839476c56be928e556f2a7ef19f4d Mon Sep 17 00:00:00 2001 From: matheusccastro Date: Sat, 7 Sep 2024 01:46:47 -0300 Subject: [PATCH 2/2] fix: add missing `await` calls --- packages/mongo/mongo_driver.js | 2 +- packages/service-configuration/package.js | 2 +- .../service_configuration_server.js | 64 +++++++++---------- tools/cli/commands-packages.js | 21 +++--- 4 files changed, 45 insertions(+), 44 deletions(-) diff --git a/packages/mongo/mongo_driver.js b/packages/mongo/mongo_driver.js index 594b61d1650..6f4092ad7c2 100644 --- a/packages/mongo/mongo_driver.js +++ b/packages/mongo/mongo_driver.js @@ -1059,7 +1059,7 @@ class AsynchronousCursor { // the Mongo->Meteor type replacement). async _rawNextObjectPromise() { try { - return this._dbCursor.next(); + return (await this._dbCursor.next()); } catch (e) { console.error(e); } diff --git a/packages/service-configuration/package.js b/packages/service-configuration/package.js index 43e82a48883..611087dccd5 100644 --- a/packages/service-configuration/package.js +++ b/packages/service-configuration/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'Manage the configuration for third-party services', - version: '1.3.5', + version: '1.3.6', }); Package.onUse(function(api) { diff --git a/packages/service-configuration/service_configuration_server.js b/packages/service-configuration/service_configuration_server.js index 087f8cd6abc..228c2d2b585 100644 --- a/packages/service-configuration/service_configuration_server.js +++ b/packages/service-configuration/service_configuration_server.js @@ -1,41 +1,41 @@ import { Meteor } from 'meteor/meteor'; -// Only one configuration should ever exist for each service. -// A unique index helps avoid various race conditions which could -// otherwise lead to an inconsistent database state (when there are multiple -// configurations for a single service, which configuration is correct?) -try { - ServiceConfiguration.configurations.createIndexAsync( - { service: 1 }, - { unique: true } - ); -} catch (err) { - console.error( - 'The service-configuration package persists configuration in the ' + - 'meteor_accounts_loginServiceConfiguration collection in MongoDB. As ' + - 'each service should have exactly one configuration, Meteor ' + - 'automatically creates a MongoDB index with a unique constraint on the ' + - ' meteor_accounts_loginServiceConfiguration collection. The ' + - 'createIndex command which creates that index is failing.\n\n' + - 'Meteor versions before 1.0.4 did not create this index. If you recently ' + - 'upgraded and are seeing this error message for the first time, please ' + - 'check your meteor_accounts_loginServiceConfiguration collection for ' + - 'multiple configuration entries for the same service and delete ' + - 'configuration entries until there is no more than one configuration ' + - 'entry per service.\n\n' + - 'If the meteor_accounts_loginServiceConfiguration collection looks ' + - 'fine, the createIndex command is failing for some other reason.\n\n' + - 'For more information on this history of this issue, please see ' + - 'https://github.com/meteor/meteor/pull/3514.\n' - ); - throw err; -} +Meteor.startup(async () => { + // Only one configuration should ever exist for each service. + // A unique index helps avoid various race conditions which could + // otherwise lead to an inconsistent database state (when there are multiple + // configurations for a single service, which configuration is correct?) + try { + await ServiceConfiguration.configurations.createIndexAsync( + { service: 1 }, + { unique: true } + ); + } catch (err) { + console.error( + 'The service-configuration package persists configuration in the ' + + 'meteor_accounts_loginServiceConfiguration collection in MongoDB. As ' + + 'each service should have exactly one configuration, Meteor ' + + 'automatically creates a MongoDB index with a unique constraint on the ' + + ' meteor_accounts_loginServiceConfiguration collection. The ' + + 'createIndex command which creates that index is failing.\n\n' + + 'Meteor versions before 1.0.4 did not create this index. If you recently ' + + 'upgraded and are seeing this error message for the first time, please ' + + 'check your meteor_accounts_loginServiceConfiguration collection for ' + + 'multiple configuration entries for the same service and delete ' + + 'configuration entries until there is no more than one configuration ' + + 'entry per service.\n\n' + + 'If the meteor_accounts_loginServiceConfiguration collection looks ' + + 'fine, the createIndex command is failing for some other reason.\n\n' + + 'For more information on this history of this issue, please see ' + + 'https://github.com/meteor/meteor/pull/3514.\n' + ); + throw err; + } -Meteor.startup(() => { const settings = Meteor.settings?.packages?.['service-configuration']; if (!settings) return; for (const key of Object.keys(settings)) { - ServiceConfiguration.configurations.upsertAsync( + await ServiceConfiguration.configurations.upsertAsync( { service: key }, { $set: settings[key], diff --git a/tools/cli/commands-packages.js b/tools/cli/commands-packages.js index e580246c480..77ab11b4309 100644 --- a/tools/cli/commands-packages.js +++ b/tools/cli/commands-packages.js @@ -2851,7 +2851,7 @@ main.registerCommand({ } try { - var conn = packageClient.loggedInPackagesConnection(); + var conn = await packageClient.loggedInPackagesConnection(); } catch (err) { packageClient.handlePackageServerConnectionError(err); return 1; @@ -2951,8 +2951,9 @@ main.registerCommand({ versions = await catalog.official.getSortedVersions(name); } + var conn; try { - var conn = await packageClient.loggedInPackagesConnection(); + conn = await packageClient.loggedInPackagesConnection(); } catch (err) { packageClient.handlePackageServerConnectionError(err); return 1; @@ -2961,16 +2962,16 @@ main.registerCommand({ try { var status = options.success ? "successfully" : "unsuccessfully"; // XXX: This should probably use progress bars instead. - _.each(versions, function (version) { + for (const version of versions) { Console.rawInfo( - "Setting " + name + "@" + version + " as " + - status + " migrated ...\n"); - packageClient.callPackageServer( - conn, - '_changeVersionMigrationStatus', - name, version, !options.success); + "Setting " + name + "@" + version + " as " + + status + " migrated ...\n"); + await packageClient.callPackageServer( + conn, + '_changeVersionMigrationStatus', + name, version, !options.success); Console.info("done."); - }); + } } catch (err) { packageClient.handlePackageServerConnectionError(err); return 1;