diff --git a/package-lock.json b/package-lock.json index b6895f1f..4e6802b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7864,6 +7864,12 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true } } }, @@ -10920,6 +10926,11 @@ "combined-stream": "^1.0.6", "mime-types": "^2.1.12" } + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" } } }, @@ -12373,9 +12384,9 @@ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==" }, "v8-compile-cache": { "version": "2.1.0", diff --git a/package.json b/package.json index dba7ddbb..fa27d9ae 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "semver": "7.3.2", "subscriptions-transport-ws": "0.9.16", "tv4": "1.3.0", - "uuid": "3.4.0", + "uuid": "8.0.0", "winston": "3.2.1", "winston-daily-rotate-file": "4.4.2", "ws": "7.2.5" @@ -122,7 +122,9 @@ "url": "https://opencollective.com/parse-server", "logo": "https://opencollective.com/parse-server/logo.txt?reverse=true&variant=binary" }, - "publishConfig": { "registry": "https://npm.pkg.github.com/" }, + "publishConfig": { + "registry": "https://npm.pkg.github.com/" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/parse-server" diff --git a/spec/ParseGraphQLServer.spec.js b/spec/ParseGraphQLServer.spec.js index 46e50cde..dcfb693c 100644 --- a/spec/ParseGraphQLServer.spec.js +++ b/spec/ParseGraphQLServer.spec.js @@ -29,7 +29,7 @@ const { const { ParseServer } = require('../'); const { ParseGraphQLServer } = require('../lib/GraphQL/ParseGraphQLServer'); const ReadPreference = require('mongodb').ReadPreference; -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); function handleError(e) { if ( diff --git a/src/LiveQuery/ParseLiveQueryServer.js b/src/LiveQuery/ParseLiveQueryServer.js index fc3d7e39..0411745e 100644 --- a/src/LiveQuery/ParseLiveQueryServer.js +++ b/src/LiveQuery/ParseLiveQueryServer.js @@ -9,7 +9,7 @@ import { matchesQuery, queryHash } from './QueryTools'; import { ParsePubSub } from './ParsePubSub'; import SchemaController from '../Controllers/SchemaController'; import _ from 'lodash'; -import uuid from 'uuid'; +import { v4 as uuidv4 } from 'uuid'; import { runLiveQueryEventHandlers } from '../triggers'; import { getAuthForSessionToken, Auth } from '../Auth'; import { getCacheController } from '../Controllers'; @@ -60,7 +60,7 @@ class ParseLiveQueryServer { // Initialize websocket server this.parseWebSocketServer = new ParseWebSocketServer( server, - parseWebsocket => this._onConnect(parseWebsocket), + (parseWebsocket) => this._onConnect(parseWebsocket), config ); @@ -165,13 +165,13 @@ class ParseLiveQueryServer { // Check ACL return this._matchesACL(acl, client, requestId); }) - .then(isMatched => { + .then((isMatched) => { if (!isMatched) { return null; } client.pushDelete(requestId, deletedParseObject); }) - .catch(error => { + .catch((error) => { logger.error('Matching ACL error : ', error); }); } @@ -298,7 +298,7 @@ class ParseLiveQueryServer { originalParseObject ); }, - error => { + (error) => { logger.error('Matching ACL error : ', error); } ); @@ -308,7 +308,7 @@ class ParseLiveQueryServer { } _onConnect(parseWebsocket: any): void { - parseWebsocket.on('message', request => { + parseWebsocket.on('message', (request) => { if (typeof request === 'string') { try { request = JSON.parse(request); @@ -426,10 +426,10 @@ class ParseLiveQueryServer { cacheController: this.cacheController, sessionToken: sessionToken, }) - .then(auth => { + .then((auth) => { return { auth, userId: auth && auth.user && auth.user.id }; }) - .catch(error => { + .catch((error) => { // There was an error with the session token const result = {}; if (error && error.code === Parse.Error.INVALID_SESSION_TOKEN) { @@ -523,7 +523,7 @@ class ParseLiveQueryServer { return Promise.resolve() .then(async () => { // Resolve false right away if the acl doesn't have any roles - const acl_has_roles = Object.keys(acl.permissionsById).some(key => + const acl_has_roles = Object.keys(acl.permissionsById).some((key) => key.startsWith('role:') ); if (!acl_has_roles) { @@ -581,7 +581,7 @@ class ParseLiveQueryServer { return; } const hasMasterKey = this._hasMasterKey(request, this.keyPairs); - const clientId = uuid(); + const clientId = uuidv4(); const client = new Client( clientId, parseWebsocket,