Fix CI (#8862)
This commit is contained in:
@ -70,7 +70,7 @@
|
|||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"better-sqlite3": "^9.2.2",
|
"better-sqlite3": "^9.2.2",
|
||||||
"body-parser": "^1.20.2",
|
"body-parser": "^1.20.2",
|
||||||
"bullmq": "^4.14.0",
|
"bullmq": "^4.15.0",
|
||||||
"bytes": "^3.1.2",
|
"bytes": "^3.1.2",
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
|
import { useLocation, useSearchParams } from 'react-router-dom';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { useLocation } from 'react-router-dom';
|
|
||||||
|
|
||||||
import { PASSWORD_REGEX } from '@/auth/utils/passwordRegex';
|
|
||||||
import { isDeveloperDefaultSignInPrefilledState } from '@/client-config/states/isDeveloperDefaultSignInPrefilledState';
|
|
||||||
import { useSearchParams } from 'react-router-dom';
|
|
||||||
import { isDefined } from '~/utils/isDefined';
|
|
||||||
import {
|
import {
|
||||||
SignInUpStep,
|
SignInUpStep,
|
||||||
signInUpStepState,
|
signInUpStepState,
|
||||||
} from '@/auth/states/signInUpStepState';
|
} from '@/auth/states/signInUpStepState';
|
||||||
|
import { PASSWORD_REGEX } from '@/auth/utils/passwordRegex';
|
||||||
|
import { isDeveloperDefaultSignInPrefilledState } from '@/client-config/states/isDeveloperDefaultSignInPrefilledState';
|
||||||
|
import { isDefined } from '~/utils/isDefined';
|
||||||
|
|
||||||
const makeValidationSchema = (signInUpStep: SignInUpStep) =>
|
const makeValidationSchema = (signInUpStep: SignInUpStep) =>
|
||||||
z
|
z
|
||||||
@ -63,6 +62,11 @@ export const useSignInUpForm = () => {
|
|||||||
form.setValue('email', 'tim@apple.dev');
|
form.setValue('email', 'tim@apple.dev');
|
||||||
form.setValue('password', 'Applecar2025');
|
form.setValue('password', 'Applecar2025');
|
||||||
}
|
}
|
||||||
}, [form, isDeveloperDefaultSignInPrefilled, prefilledEmail, location.search]);
|
}, [
|
||||||
return { form: form };
|
form,
|
||||||
|
isDeveloperDefaultSignInPrefilled,
|
||||||
|
prefilledEmail,
|
||||||
|
location.search,
|
||||||
|
]);
|
||||||
|
return { form, validationSchema };
|
||||||
};
|
};
|
||||||
|
|||||||
@ -143,6 +143,10 @@ export const queries = {
|
|||||||
allowImpersonation
|
allowImpersonation
|
||||||
activationStatus
|
activationStatus
|
||||||
isPublicInviteLinkEnabled
|
isPublicInviteLinkEnabled
|
||||||
|
isGoogleAuthEnabled
|
||||||
|
isMicrosoftAuthEnabled
|
||||||
|
isPasswordAuthEnabled
|
||||||
|
subdomain
|
||||||
hasValidEntrepriseKey
|
hasValidEntrepriseKey
|
||||||
featureFlags {
|
featureFlags {
|
||||||
id
|
id
|
||||||
@ -164,6 +168,7 @@ export const queries = {
|
|||||||
logo
|
logo
|
||||||
displayName
|
displayName
|
||||||
domainName
|
domainName
|
||||||
|
subdomain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userVars
|
userVars
|
||||||
@ -286,6 +291,10 @@ export const responseData = {
|
|||||||
activationStatus: 'active',
|
activationStatus: 'active',
|
||||||
isPublicInviteLinkEnabled: false,
|
isPublicInviteLinkEnabled: false,
|
||||||
hasValidEntrepriseKey: false,
|
hasValidEntrepriseKey: false,
|
||||||
|
isGoogleAuthEnabled: true,
|
||||||
|
isMicrosoftAuthEnabled: false,
|
||||||
|
isPasswordAuthEnabled: true,
|
||||||
|
subdomain: 'test',
|
||||||
featureFlags: [],
|
featureFlags: [],
|
||||||
metadataVersion: 1,
|
metadataVersion: 1,
|
||||||
currentBillingSubscription: null,
|
currentBillingSubscription: null,
|
||||||
|
|||||||
@ -2,22 +2,23 @@ import { HttpService } from '@nestjs/axios';
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||||
|
|
||||||
import bcrypt from 'bcrypt';
|
|
||||||
import { expect, jest } from '@jest/globals';
|
import { expect, jest } from '@jest/globals';
|
||||||
|
import bcrypt from 'bcrypt';
|
||||||
|
|
||||||
|
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
||||||
import { SignInUpService } from 'src/engine/core-modules/auth/services/sign-in-up.service';
|
import { SignInUpService } from 'src/engine/core-modules/auth/services/sign-in-up.service';
|
||||||
|
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';
|
||||||
|
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||||
import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service';
|
import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service';
|
||||||
import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding.service';
|
import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding.service';
|
||||||
import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service';
|
import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service';
|
||||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||||
|
import { WorkspaceInvitationService } from 'src/engine/core-modules/workspace-invitation/services/workspace-invitation.service';
|
||||||
|
import { WorkspaceService } from 'src/engine/core-modules/workspace/services/workspace.service';
|
||||||
import {
|
import {
|
||||||
Workspace,
|
Workspace,
|
||||||
WorkspaceActivationStatus,
|
WorkspaceActivationStatus,
|
||||||
} from 'src/engine/core-modules/workspace/workspace.entity';
|
} from 'src/engine/core-modules/workspace/workspace.entity';
|
||||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
|
||||||
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
|
||||||
import { WorkspaceInvitationService } from 'src/engine/core-modules/workspace-invitation/services/workspace-invitation.service';
|
|
||||||
import { WorkspaceService } from 'src/engine/core-modules/workspace/services/workspace.service';
|
|
||||||
|
|
||||||
jest.mock('bcrypt');
|
jest.mock('bcrypt');
|
||||||
|
|
||||||
@ -75,9 +76,7 @@ describe('SignInUpService', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: WorkspaceService,
|
provide: WorkspaceService,
|
||||||
useValue: {
|
useValue: {},
|
||||||
generateSubdomain: jest.fn().mockReturnValue('tartanpion'),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: UserWorkspaceService,
|
provide: UserWorkspaceService,
|
||||||
@ -114,6 +113,12 @@ describe('SignInUpService', () => {
|
|||||||
workspaceInvitationFindInvitationByWorkspaceSubdomainAndUserEmailMock,
|
workspaceInvitationFindInvitationByWorkspaceSubdomainAndUserEmailMock,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: DomainManagerService,
|
||||||
|
useValue: {
|
||||||
|
generateSubdomain: jest.fn().mockReturnValue('testSubDomain'),
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
@ -139,7 +144,7 @@ describe('SignInUpService', () => {
|
|||||||
await service.signInUp({
|
await service.signInUp({
|
||||||
email: 'test@test.com',
|
email: 'test@test.com',
|
||||||
fromSSO: true,
|
fromSSO: true,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalledWith(
|
expect(spy).toHaveBeenCalledWith(
|
||||||
@ -169,7 +174,7 @@ describe('SignInUpService', () => {
|
|||||||
const result = await service.signInUp({
|
const result = await service.signInUp({
|
||||||
email,
|
email,
|
||||||
fromSSO: true,
|
fromSSO: true,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(result).toEqual(existingUser);
|
expect(result).toEqual(existingUser);
|
||||||
@ -204,7 +209,7 @@ describe('SignInUpService', () => {
|
|||||||
await service.signInUp({
|
await service.signInUp({
|
||||||
email,
|
email,
|
||||||
fromSSO: true,
|
fromSSO: true,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(spySignInUpOnExistingWorkspace).toHaveBeenCalledWith(
|
expect(spySignInUpOnExistingWorkspace).toHaveBeenCalledWith(
|
||||||
@ -257,7 +262,7 @@ describe('SignInUpService', () => {
|
|||||||
const result = await service.signInUp({
|
const result = await service.signInUp({
|
||||||
email,
|
email,
|
||||||
fromSSO: true,
|
fromSSO: true,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(result).toEqual(existingUser);
|
expect(result).toEqual(existingUser);
|
||||||
@ -297,7 +302,7 @@ describe('SignInUpService', () => {
|
|||||||
email,
|
email,
|
||||||
fromSSO: true,
|
fromSSO: true,
|
||||||
workspacePersonalInviteToken,
|
workspacePersonalInviteToken,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(spySignInUpOnExistingWorkspace).toHaveBeenCalledWith(
|
expect(spySignInUpOnExistingWorkspace).toHaveBeenCalledWith(
|
||||||
@ -348,7 +353,7 @@ describe('SignInUpService', () => {
|
|||||||
email,
|
email,
|
||||||
fromSSO: true,
|
fromSSO: true,
|
||||||
workspacePersonalInviteToken,
|
workspacePersonalInviteToken,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
@ -375,7 +380,7 @@ describe('SignInUpService', () => {
|
|||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
fromSSO: false,
|
fromSSO: false,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
@ -400,7 +405,7 @@ describe('SignInUpService', () => {
|
|||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
fromSSO: false,
|
fromSSO: false,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(UserCreateMock).toHaveBeenCalledTimes(1);
|
expect(UserCreateMock).toHaveBeenCalledTimes(1);
|
||||||
@ -436,7 +441,7 @@ describe('SignInUpService', () => {
|
|||||||
password,
|
password,
|
||||||
fromSSO: false,
|
fromSSO: false,
|
||||||
workspacePersonalInviteToken,
|
workspacePersonalInviteToken,
|
||||||
targetWorkspaceSubdomain: 'tartanpion',
|
targetWorkspaceSubdomain: 'testSubDomain',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(UserCreateMock).toHaveBeenCalledTimes(1);
|
expect(UserCreateMock).toHaveBeenCalledTimes(1);
|
||||||
|
|||||||
@ -4,17 +4,16 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
|
|
||||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||||
import { isDefined } from 'src/utils/is-defined';
|
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||||
import {
|
import {
|
||||||
WorkspaceException,
|
WorkspaceException,
|
||||||
WorkspaceExceptionCode,
|
WorkspaceExceptionCode,
|
||||||
} from 'src/engine/core-modules/workspace/workspace.exception';
|
} from 'src/engine/core-modules/workspace/workspace.exception';
|
||||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
|
||||||
import { isWorkEmail } from 'src/utils/is-work-email';
|
|
||||||
import { getDomainNameByEmail } from 'src/utils/get-domain-name-by-email';
|
import { getDomainNameByEmail } from 'src/utils/get-domain-name-by-email';
|
||||||
|
import { isDefined } from 'src/utils/is-defined';
|
||||||
|
import { isWorkEmail } from 'src/utils/is-work-email';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
// eslint-disable-next-line @nx/workspace-inject-workspace-repository
|
|
||||||
export class DomainManagerService {
|
export class DomainManagerService {
|
||||||
constructor(
|
constructor(
|
||||||
@InjectRepository(Workspace, 'core')
|
@InjectRepository(Workspace, 'core')
|
||||||
@ -126,6 +125,7 @@ export class DomainManagerService {
|
|||||||
order: {
|
order: {
|
||||||
createdAt: 'DESC',
|
createdAt: 'DESC',
|
||||||
},
|
},
|
||||||
|
relations: ['workspaceSSOIdentityProviders'],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (workspaces.length > 1) {
|
if (workspaces.length > 1) {
|
||||||
@ -153,7 +153,12 @@ export class DomainManagerService {
|
|||||||
|
|
||||||
if (!isDefined(subdomain)) return;
|
if (!isDefined(subdomain)) return;
|
||||||
|
|
||||||
return this.workspaceRepository.findOneBy({ subdomain });
|
const workspace = await this.workspaceRepository.findOne({
|
||||||
|
where: { subdomain },
|
||||||
|
relations: ['workspaceSSOIdentityProviders'],
|
||||||
|
});
|
||||||
|
|
||||||
|
return workspace;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new WorkspaceException(
|
throw new WorkspaceException(
|
||||||
'Workspace not found',
|
'Workspace not found',
|
||||||
|
|||||||
@ -17,19 +17,19 @@ import {
|
|||||||
AuthException,
|
AuthException,
|
||||||
AuthExceptionCode,
|
AuthExceptionCode,
|
||||||
} from 'src/engine/core-modules/auth/auth.exception';
|
} from 'src/engine/core-modules/auth/auth.exception';
|
||||||
|
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';
|
||||||
import { EmailService } from 'src/engine/core-modules/email/email.service';
|
import { EmailService } from 'src/engine/core-modules/email/email.service';
|
||||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||||
import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding.service';
|
import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding.service';
|
||||||
import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
|
import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
|
||||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||||
import { SendInvitationsOutput } from 'src/engine/core-modules/workspace-invitation/dtos/send-invitations.output';
|
import { SendInvitationsOutput } from 'src/engine/core-modules/workspace-invitation/dtos/send-invitations.output';
|
||||||
|
import { castAppTokenToWorkspaceInvitationUtil } from 'src/engine/core-modules/workspace-invitation/utils/cast-app-token-to-workspace-invitation.util';
|
||||||
import {
|
import {
|
||||||
WorkspaceInvitationException,
|
WorkspaceInvitationException,
|
||||||
WorkspaceInvitationExceptionCode,
|
WorkspaceInvitationExceptionCode,
|
||||||
} from 'src/engine/core-modules/workspace-invitation/workspace-invitation.exception';
|
} from 'src/engine/core-modules/workspace-invitation/workspace-invitation.exception';
|
||||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||||
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';
|
|
||||||
import { castAppTokenToWorkspaceInvitationUtil } from 'src/engine/core-modules/workspace-invitation/utils/cast-app-token-to-workspace-invitation.util';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
// eslint-disable-next-line @nx/workspace-inject-workspace-repository
|
// eslint-disable-next-line @nx/workspace-inject-workspace-repository
|
||||||
@ -338,7 +338,7 @@ export class WorkspaceInvitationService {
|
|||||||
? {
|
? {
|
||||||
inviteToken: invitation.value.appToken.value,
|
inviteToken: invitation.value.appToken.value,
|
||||||
email: invitation.value.email,
|
email: invitation.value.email,
|
||||||
}
|
}
|
||||||
: {},
|
: {},
|
||||||
});
|
});
|
||||||
const emailData = {
|
const emailData = {
|
||||||
|
|||||||
10
yarn.lock
10
yarn.lock
@ -21176,9 +21176,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"bullmq@npm:^4.14.0":
|
"bullmq@npm:^4.15.0":
|
||||||
version: 4.17.0
|
version: 4.18.2
|
||||||
resolution: "bullmq@npm:4.17.0"
|
resolution: "bullmq@npm:4.18.2"
|
||||||
dependencies:
|
dependencies:
|
||||||
cron-parser: "npm:^4.6.0"
|
cron-parser: "npm:^4.6.0"
|
||||||
glob: "npm:^8.0.3"
|
glob: "npm:^8.0.3"
|
||||||
@ -21189,7 +21189,7 @@ __metadata:
|
|||||||
semver: "npm:^7.5.4"
|
semver: "npm:^7.5.4"
|
||||||
tslib: "npm:^2.0.0"
|
tslib: "npm:^2.0.0"
|
||||||
uuid: "npm:^9.0.0"
|
uuid: "npm:^9.0.0"
|
||||||
checksum: 10c0/7dde2fcc2a6432aa52fb255ac470fbc6c01530d2825bad1b48549706de2d3af90b1895954db16a753f60a3e6f2755d9e9987b422597dbf74762932e98bc8fbd2
|
checksum: 10c0/09371a6d53377e556a37e3e046576bb20056a14ac26d29528bd0a4054c33f458f1764ae696ae6a39fda688e8215ef34f1ba94fe56ba89db5b9ad2c9aa0082f2f
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -44483,7 +44483,7 @@ __metadata:
|
|||||||
bcrypt: "npm:^5.1.1"
|
bcrypt: "npm:^5.1.1"
|
||||||
better-sqlite3: "npm:^9.2.2"
|
better-sqlite3: "npm:^9.2.2"
|
||||||
body-parser: "npm:^1.20.2"
|
body-parser: "npm:^1.20.2"
|
||||||
bullmq: "npm:^4.14.0"
|
bullmq: "npm:^4.15.0"
|
||||||
bytes: "npm:^3.1.2"
|
bytes: "npm:^3.1.2"
|
||||||
chromatic: "npm:^6.18.0"
|
chromatic: "npm:^6.18.0"
|
||||||
class-transformer: "npm:^0.5.1"
|
class-transformer: "npm:^0.5.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user