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

@@ -857,7 +857,7 @@ RestWrite.prototype.createSessionToken = async function () {
return;
}
const { sessionData, createSession } = Auth.createSession(this.config, {
const { sessionData, createSession } = RestWrite.createSession(this.config, {
userId: this.objectId(),
createdWith: {
action: this.storage['authProvider'] ? 'login' : 'signup',
@@ -873,6 +873,37 @@ RestWrite.prototype.createSessionToken = async function () {
return createSession();
};
RestWrite.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);
return {
sessionData,
createSession: () =>
new RestWrite(config, Auth.master(config), '_Session', null, sessionData).execute(),
};
};
// Delete email reset tokens if user is changing password or email.
RestWrite.prototype.deleteEmailResetTokenIfNeeded = function () {
if (this.className !== '_User' || this.query === null) {
@@ -978,7 +1009,7 @@ RestWrite.prototype.handleSession = function () {
additionalSessionData[key] = this.data[key];
}
const { sessionData, createSession } = Auth.createSession(this.config, {
const { sessionData, createSession } = RestWrite.createSession(this.config, {
userId: this.auth.user.id,
createdWith: {
action: 'create',
@@ -1258,7 +1289,7 @@ RestWrite.prototype.handleInstallation = function () {
return promise;
};
// If we short-circuted the object response - then we need to make sure we expand all the files,
// If we short-circuited the object response - then we need to make sure we expand all the files,
// since this might not have a query, meaning it won't return the full result back.
// TODO: (nlutsenko) This should die when we move to per-class based controllers on _Session/_User
RestWrite.prototype.expandFilesForExistingObjects = function () {