Add circular dependency detection to CI (#7316)

* add circular dependency detection to CI

* fixed Auth-RestWrite circular dependency

* updated package lock

* fixed Logger circular dependency

* fix lint
This commit is contained in:
Manuel
2021-04-08 03:47:57 +02:00
committed by GitHub
parent 0becb0cc9f
commit c56d326b17
9 changed files with 1226 additions and 88 deletions

View File

@@ -1,4 +1,3 @@
const cryptoUtils = require('./cryptoUtils');
const RestQuery = require('./RestQuery');
const Parse = require('parse/node');
@@ -299,39 +298,6 @@ Auth.prototype._getAllRolesNamesForRoleIds = function (roleIDs, names = [], quer
});
};
const createSession = function (
config,
{ userId, createdWith, installationId, additionalSessionData }
) {
const token = 'r:' + cryptoUtils.newToken();
const expiresAt = config.generateSessionExpiresAt();
const sessionData = {
sessionToken: token,
user: {
__type: 'Pointer',
className: '_User',
objectId: userId,
},
createdWith,
restricted: false,
expiresAt: Parse._encode(expiresAt),
};
if (installationId) {
sessionData.installationId = installationId;
}
Object.assign(sessionData, additionalSessionData);
// We need to import RestWrite at this point for the cyclic dependency it has to it
const RestWrite = require('./RestWrite');
return {
sessionData,
createSession: () =>
new RestWrite(config, master(config), '_Session', null, sessionData).execute(),
};
};
module.exports = {
Auth,
master,
@@ -339,5 +305,4 @@ module.exports = {
readOnly,
getAuthForSessionToken,
getAuthForLegacySessionToken,
createSession,
};