Compare commits

..

5 Commits

Author SHA1 Message Date
NicklasWallgren
39842559b5 fix: reduce the memory consumption during build to prevent OOM (#3148)
Co-authored-by: Nicklas Wallgren <nicklas.wallgren@folksam.se>
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2023-07-18 00:08:06 +05:30
Anwarul Islam
51efb35aa6 fix: keybinding modifier issue (#3163) 2023-07-17 23:56:08 +05:30
NicklasWallgren
9402bb9285 fix: add healthcheck for db and remove unwanted volumes (#3150) 2023-07-17 21:22:56 +05:30
Balu Babu
82b6e08d68 fix: fixed issue in team-environment test cases (#3189) 2023-07-17 12:33:11 +05:30
Anwarul Islam
25177bd635 fix: update vite-plugin-dts version which fixes build issue on docker/alpine (#3179) 2023-07-17 12:32:25 +05:30
18 changed files with 291 additions and 1631 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
*/**/node_modules

View File

@@ -19,10 +19,12 @@ services:
- DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch?connect_timeout=300
- PORT=3000
volumes:
- ./packages/hoppscotch-backend/:/usr/src/app
# Uncomment the line below when modifying code. Only applicable when using the "dev" target.
# - ./packages/hoppscotch-backend/:/usr/src/app
- /usr/src/app/node_modules/
depends_on:
- hoppscotch-db
hoppscotch-db:
condition: service_healthy
ports:
- "3170:3000"
@@ -60,12 +62,20 @@ services:
# you are using an external postgres instance
# This will be exposed at port 5432
hoppscotch-db:
image: postgres
image: postgres:15
ports:
- "5432:5432"
user: postgres
environment:
# The default user defined by the docker image
POSTGRES_USER: postgres
# NOTE: Please UPDATE THIS PASSWORD!
POSTGRES_PASSWORD: testpass
POSTGRES_DB: hoppscotch
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'"]
interval: 5s
timeout: 5s
retries: 10

View File

@@ -10,23 +10,11 @@ import { TeamInvitationService } from '../team-invitation/team-invitation.servic
import { TeamCollectionService } from '../team-collection/team-collection.service';
import { MailerService } from '../mailer/mailer.service';
import { PrismaService } from 'src/prisma/prisma.service';
import { User as DbUser } from '@prisma/client';
import {
DUPLICATE_EMAIL,
INVALID_EMAIL,
ONLY_ONE_ADMIN_ACCOUNT,
TEAM_INVITE_ALREADY_MEMBER,
TEAM_MEMBER_NOT_FOUND,
USER_ALREADY_INVITED,
USER_IS_ADMIN,
USER_NOT_FOUND,
} from '../errors';
import { Team, TeamMember, TeamMemberRole } from 'src/team/team.model';
import { TeamInvitation } from 'src/team-invitation/team-invitation.model';
import * as E from 'fp-ts/Either';
import * as O from 'fp-ts/Option';
import * as TE from 'fp-ts/TaskEither';
import * as utils from 'src/utils';
const mockPrisma = mockDeep<PrismaService>();
const mockPubSub = mockDeep<PubSubService>();
@@ -64,582 +52,7 @@ const invitedUsers: InvitedUsers[] = [
invitedOn: new Date(),
},
];
const allUsers: DbUser[] = [
{
uid: 'uid1',
displayName: 'user1',
email: 'user1@hoppscotch.io',
photoURL: 'https://hoppscotch.io',
isAdmin: true,
refreshToken: 'refreshToken',
currentRESTSession: null,
currentGQLSession: null,
createdOn: new Date(),
},
{
uid: 'uid2',
displayName: 'user2',
email: 'user2@hoppscotch.io',
photoURL: 'https://hoppscotch.io',
isAdmin: false,
refreshToken: 'refreshToken',
currentRESTSession: null,
currentGQLSession: null,
createdOn: new Date(),
},
];
const teamMembers: TeamMember[] = [
{
membershipID: 'teamMember1',
userUid: allUsers[0].uid,
role: TeamMemberRole.OWNER,
},
];
const teams: Team[] = [
{
id: 'team1',
name: 'team1',
},
{
id: 'team2',
name: 'team2',
},
];
const teamInvitations: TeamInvitation[] = [
{
id: 'teamInvitation1',
teamID: 'team1',
creatorUid: 'uid1',
inviteeEmail: '',
inviteeRole: TeamMemberRole.OWNER,
},
];
describe('AdminService', () => {
describe('fetchUsers', () => {
test('should resolve right and return an array of users if cursorID is null', async () => {
mockUserService.fetchAllUsers.mockResolvedValueOnce(allUsers);
const result = await adminService.fetchUsers(null, 10);
expect(result).toEqual(allUsers);
expect(mockUserService.fetchAllUsers).toHaveBeenCalledWith(null, 10);
});
test('should resolve right and return an array of users if cursorID is not null', async () => {
mockUserService.fetchAllUsers.mockResolvedValueOnce([allUsers[1]]);
const cursorID = allUsers[0].uid;
const result = await adminService.fetchUsers(cursorID, 10);
expect(result).toEqual([allUsers[1]]);
expect(mockUserService.fetchAllUsers).toHaveBeenCalledWith(cursorID, 10);
});
});
describe('fetchAllTeams', () => {
test('should resolve right and return an array of teams if cursorID is null', async () => {
mockTeamService.fetchAllTeams.mockResolvedValueOnce(teams);
const result = await adminService.fetchAllTeams(null, 10);
expect(result).toEqual(teams);
expect(mockTeamService.fetchAllTeams).toHaveBeenCalledWith(null, 10);
});
test('should resolve right and return an array of teams if cursorID is not null', async () => {
mockTeamService.fetchAllTeams.mockResolvedValueOnce([teams[1]]);
const cursorID = teams[0].id;
const result = await adminService.fetchAllTeams(cursorID, 10);
expect(result).toEqual([teams[1]]);
expect(mockTeamService.fetchAllTeams).toHaveBeenCalledWith(cursorID, 10);
});
});
describe('membersCountInTeam', () => {
test('should resolve right and return the count of members in a team', async () => {
mockTeamService.getCountOfMembersInTeam.mockResolvedValueOnce(10);
const result = await adminService.membersCountInTeam('team1');
expect(result).toEqual(10);
expect(mockTeamService.getCountOfMembersInTeam).toHaveBeenCalledWith(
'team1',
);
});
});
describe('collectionCountInTeam', () => {
test('should resolve right and return the count of collections in a team', async () => {
mockTeamCollectionService.totalCollectionsInTeam.mockResolvedValueOnce(
10,
);
const result = await adminService.collectionCountInTeam('team1');
expect(result).toEqual(10);
expect(
mockTeamCollectionService.totalCollectionsInTeam,
).toHaveBeenCalledWith('team1');
});
});
describe('requestCountInTeam', () => {
test('should resolve right and return the count of requests in a team', async () => {
mockTeamRequestService.totalRequestsInATeam.mockResolvedValueOnce(10);
const result = await adminService.requestCountInTeam('team1');
expect(result).toEqual(10);
expect(mockTeamRequestService.totalRequestsInATeam).toHaveBeenCalledWith(
'team1',
);
});
});
describe('environmentCountInTeam', () => {
test('should resolve right and return the count of environments in a team', async () => {
mockTeamEnvironmentsService.totalEnvsInTeam.mockResolvedValueOnce(10);
const result = await adminService.environmentCountInTeam('team1');
expect(result).toEqual(10);
expect(mockTeamEnvironmentsService.totalEnvsInTeam).toHaveBeenCalledWith(
'team1',
);
});
});
describe('pendingInvitationCountInTeam', () => {
test('should resolve right and return the count of pending invitations in a team', async () => {
mockTeamInvitationService.getTeamInvitations.mockResolvedValueOnce(
teamInvitations,
);
const result = await adminService.pendingInvitationCountInTeam('team1');
expect(result).toEqual(teamInvitations);
expect(
mockTeamInvitationService.getTeamInvitations,
).toHaveBeenCalledWith('team1');
});
});
describe('changeRoleOfUserTeam', () => {
test('should resolve right and return the count of pending invitations in a team', async () => {
const teamMember = teamMembers[0];
mockTeamService.updateTeamMemberRole.mockResolvedValueOnce(
E.right(teamMember),
);
const result = await adminService.changeRoleOfUserTeam(
teamMember.userUid,
'team1',
teamMember.role,
);
expect(result).toEqualRight(teamMember);
expect(mockTeamService.updateTeamMemberRole).toHaveBeenCalledWith(
'team1',
teamMember.userUid,
teamMember.role,
);
});
test('should resolve left and return the error if any error occurred', async () => {
const teamMember = teamMembers[0];
const errorMessage = 'Team member not found';
mockTeamService.updateTeamMemberRole.mockResolvedValueOnce(
E.left(errorMessage),
);
const result = await adminService.changeRoleOfUserTeam(
teamMember.userUid,
'team1',
teamMember.role,
);
expect(result).toEqualLeft(errorMessage);
expect(mockTeamService.updateTeamMemberRole).toHaveBeenCalledWith(
'team1',
teamMember.userUid,
teamMember.role,
);
});
});
describe('removeUserFromTeam', () => {
test('should resolve right and remove user from a team', async () => {
const teamMember = teamMembers[0];
mockTeamService.leaveTeam.mockResolvedValueOnce(E.right(true));
const result = await adminService.removeUserFromTeam(
teamMember.userUid,
'team1',
);
expect(result).toEqualRight(true);
expect(mockTeamService.leaveTeam).toHaveBeenCalledWith(
'team1',
teamMember.userUid,
);
});
test('should resolve left and return the error if any error occurred', async () => {
const teamMember = teamMembers[0];
const errorMessage = 'Team member not found';
mockTeamService.leaveTeam.mockResolvedValueOnce(E.left(errorMessage));
const result = await adminService.removeUserFromTeam(
teamMember.userUid,
'team1',
);
expect(result).toEqualLeft(errorMessage);
expect(mockTeamService.leaveTeam).toHaveBeenCalledWith(
'team1',
teamMember.userUid,
);
});
});
describe('addUserToTeam', () => {
test('should return INVALID_EMAIL when email is invalid', async () => {
const teamID = 'team1';
const userEmail = 'invalidEmail';
const role = TeamMemberRole.EDITOR;
const mockValidateEmail = jest.spyOn(utils, 'validateEmail');
mockValidateEmail.mockReturnValueOnce(false);
const result = await adminService.addUserToTeam(teamID, userEmail, role);
expect(result).toEqual(E.left(INVALID_EMAIL));
expect(mockValidateEmail).toHaveBeenCalledWith(userEmail);
expect(mockUserService.findUserByEmail).not.toHaveBeenCalled();
expect(mockTeamService.getTeamMemberTE).not.toHaveBeenCalled();
});
test('should return USER_NOT_FOUND when user is not found', async () => {
const teamID = 'team1';
const userEmail = 'u@example.com';
const role = TeamMemberRole.EDITOR;
const mockValidateEmail = jest.spyOn(utils, 'validateEmail');
mockValidateEmail.mockReturnValueOnce(true);
mockUserService.findUserByEmail.mockResolvedValue(O.none);
const result = await adminService.addUserToTeam(teamID, userEmail, role);
expect(result).toEqual(E.left(USER_NOT_FOUND));
expect(mockValidateEmail).toHaveBeenCalledWith(userEmail);
});
test('should return TEAM_INVITE_ALREADY_MEMBER when user is already a member of the team', async () => {
const teamID = 'team1';
const userEmail = allUsers[0].email;
const role = TeamMemberRole.EDITOR;
const mockValidateEmail = jest.spyOn(utils, 'validateEmail');
mockValidateEmail.mockReturnValueOnce(true);
mockUserService.findUserByEmail.mockResolvedValueOnce(
O.some(allUsers[0]),
);
mockTeamService.getTeamMemberTE.mockReturnValueOnce(
TE.right(teamMembers[0]),
);
const result = await adminService.addUserToTeam(teamID, userEmail, role);
expect(result).toEqual(E.left(TEAM_INVITE_ALREADY_MEMBER));
expect(mockValidateEmail).toHaveBeenCalledWith(userEmail);
expect(mockUserService.findUserByEmail).toHaveBeenCalledWith(userEmail);
expect(mockTeamService.getTeamMemberTE).toHaveBeenCalledWith(
teamID,
allUsers[0].uid,
);
});
test('should add user to the team and return the result when user is not a member of the team', async () => {
const teamID = 'team1';
const userEmail = allUsers[0].email;
const role = TeamMemberRole.EDITOR;
const mockValidateEmail = jest.spyOn(utils, 'validateEmail');
mockValidateEmail.mockReturnValueOnce(true);
mockUserService.findUserByEmail.mockResolvedValueOnce(
O.some(allUsers[0]),
);
mockTeamService.getTeamMemberTE.mockReturnValueOnce(
TE.left(TEAM_MEMBER_NOT_FOUND),
);
mockTeamService.addMemberToTeamWithEmail.mockResolvedValueOnce(
E.right(teamMembers[0]),
);
mockTeamInvitationService.getTeamInviteByEmailAndTeamID.mockResolvedValueOnce(
E.right(teamInvitations[0])
);
const result = await adminService.addUserToTeam(teamID, userEmail, role);
expect(result).toEqual(E.right(teamMembers[0]));
expect(mockValidateEmail).toHaveBeenCalledWith(userEmail);
expect(mockUserService.findUserByEmail).toHaveBeenCalledWith(userEmail);
expect(mockTeamService.getTeamMemberTE).toHaveBeenCalledWith(
teamID,
allUsers[0].uid,
);
expect(mockTeamService.addMemberToTeamWithEmail).toHaveBeenCalledWith(
teamID,
allUsers[0].email,
role,
);
});
});
describe('createATeam', () => {
test('should return USER_NOT_FOUND when user is not found', async () => {
const userUid = allUsers[0].uid;
const teamName = 'team1';
mockUserService.findUserById.mockResolvedValue(O.none);
const result = await adminService.createATeam(userUid, teamName);
expect(result).toEqual(E.left(USER_NOT_FOUND));
expect(mockUserService.findUserById).toHaveBeenCalledWith(userUid);
expect(mockTeamService.createTeam).not.toHaveBeenCalled();
});
test('should create a team and return the result when the team is created successfully', async () => {
const user = allUsers[0];
const team = teams[0];
mockUserService.findUserById.mockResolvedValueOnce(O.some(user));
mockTeamService.createTeam.mockResolvedValueOnce(E.right(team));
const result = await adminService.createATeam(user.uid, team.name);
expect(result).toEqual(E.right(team));
expect(mockUserService.findUserById).toHaveBeenCalledWith(user.uid);
expect(mockTeamService.createTeam).toHaveBeenCalledWith(
team.name,
user.uid,
);
});
test('should return the error when the team creation fails', async () => {
const user = allUsers[0];
const team = teams[0];
const errorMessage = 'error';
mockUserService.findUserById.mockResolvedValueOnce(O.some(user));
mockTeamService.createTeam.mockResolvedValueOnce(E.left(errorMessage));
const result = await adminService.createATeam(user.uid, team.name);
expect(result).toEqual(E.left(errorMessage));
expect(mockUserService.findUserById).toHaveBeenCalledWith(user.uid);
expect(mockTeamService.createTeam).toHaveBeenCalledWith(
team.name,
user.uid,
);
});
});
describe('renameATeam', () => {
test('should rename a team and return the result when the team is renamed successfully', async () => {
const team = teams[0];
const newName = 'new name';
mockTeamService.renameTeam.mockResolvedValueOnce(E.right(team));
const result = await adminService.renameATeam(team.id, newName);
expect(result).toEqual(E.right(team));
expect(mockTeamService.renameTeam).toHaveBeenCalledWith(team.id, newName);
});
test('should return the error when the team renaming fails', async () => {
const team = teams[0];
const newName = 'new name';
const errorMessage = 'error';
mockTeamService.renameTeam.mockResolvedValueOnce(E.left(errorMessage));
const result = await adminService.renameATeam(team.id, newName);
expect(result).toEqual(E.left(errorMessage));
expect(mockTeamService.renameTeam).toHaveBeenCalledWith(team.id, newName);
});
});
describe('deleteATeam', () => {
test('should delete a team and return the result when the team is deleted successfully', async () => {
const team = teams[0];
mockTeamService.deleteTeam.mockResolvedValueOnce(E.right(true));
const result = await adminService.deleteATeam(team.id);
expect(result).toEqual(E.right(true));
expect(mockTeamService.deleteTeam).toHaveBeenCalledWith(team.id);
});
test('should return the error when the team deletion fails', async () => {
const team = teams[0];
const errorMessage = 'error';
mockTeamService.deleteTeam.mockResolvedValueOnce(E.left(errorMessage));
const result = await adminService.deleteATeam(team.id);
expect(result).toEqual(E.left(errorMessage));
expect(mockTeamService.deleteTeam).toHaveBeenCalledWith(team.id);
});
});
describe('fetchAdmins', () => {
test('should return the list of admin users', async () => {
const adminUsers = [];
mockUserService.fetchAdminUsers.mockResolvedValueOnce(adminUsers);
const result = await adminService.fetchAdmins();
expect(result).toEqual(adminUsers);
});
});
describe('fetchUserInfo', () => {
test('should return the user info when the user is found', async () => {
const user = allUsers[0];
mockUserService.findUserById.mockResolvedValueOnce(O.some(user));
const result = await adminService.fetchUserInfo(user.uid);
expect(result).toEqual(E.right(user));
});
test('should return USER_NOT_FOUND when the user is not found', async () => {
const user = allUsers[0];
mockUserService.findUserById.mockResolvedValueOnce(O.none);
const result = await adminService.fetchUserInfo(user.uid);
expect(result).toEqual(E.left(USER_NOT_FOUND));
});
});
describe('removeUserAccount', () => {
test('should return USER_NOT_FOUND when the user is not found', async () => {
const user = allUsers[0];
mockUserService.findUserById.mockResolvedValueOnce(O.none);
const result = await adminService.removeUserAccount(user.uid);
expect(result).toEqual(E.left(USER_NOT_FOUND));
});
test('should return USER_IS_ADMIN when the user is an admin', async () => {
const user = allUsers[0];
mockUserService.findUserById.mockResolvedValueOnce(O.some(user));
const result = await adminService.removeUserAccount(user.uid);
expect(result).toEqual(E.left(USER_IS_ADMIN));
});
test('should remove the user account and return the result when the user is not an admin', async () => {
const user = allUsers[1];
mockUserService.findUserById.mockResolvedValueOnce(O.some(user));
mockUserService.deleteUserByUID.mockReturnValueOnce(TE.right(true));
const result = await adminService.removeUserAccount(user.uid);
expect(result).toEqual(E.right(true));
});
test('should return the error when the user account deletion fails', async () => {
const user = allUsers[1];
const errorMessage = 'error';
mockUserService.findUserById.mockResolvedValueOnce(O.some(user));
mockUserService.deleteUserByUID.mockReturnValueOnce(
TE.left(errorMessage),
);
const result = await adminService.removeUserAccount(user.uid);
expect(result).toEqual(E.left(errorMessage));
});
});
describe('makeUserAdmin', () => {
test('should make the user an admin and return true when the operation is successful', async () => {
const user = allUsers[0];
mockUserService.makeAdmin.mockResolvedValueOnce(E.right(user));
const result = await adminService.makeUserAdmin(user.uid);
expect(result).toEqual(E.right(true));
});
test('should return the error when making the user an admin fails', async () => {
const user = allUsers[0];
mockUserService.makeAdmin.mockResolvedValueOnce(E.left(USER_NOT_FOUND));
const result = await adminService.makeUserAdmin(user.uid);
expect(result).toEqual(E.left(USER_NOT_FOUND));
});
});
describe('removeUserAsAdmin', () => {
test('should return ONLY_ONE_ADMIN_ACCOUNT when there is only one admin account', async () => {
const user = allUsers[0];
mockUserService.fetchAdminUsers.mockResolvedValueOnce([user]);
const result = await adminService.removeUserAsAdmin(user.uid);
expect(result).toEqual(E.left(ONLY_ONE_ADMIN_ACCOUNT));
});
test('should remove the user as an admin and return true when the operation is successful', async () => {
const user = allUsers[0];
mockUserService.fetchAdminUsers.mockResolvedValueOnce(allUsers);
mockUserService.removeUserAsAdmin.mockResolvedValueOnce(E.right(user));
const result = await adminService.removeUserAsAdmin(user.uid);
expect(result).toEqual(E.right(true));
});
test('should return the error when removing the user as an admin fails', async () => {
const user = allUsers[0];
mockUserService.fetchAdminUsers.mockResolvedValueOnce(allUsers);
mockUserService.removeUserAsAdmin.mockResolvedValueOnce(
E.left(USER_NOT_FOUND),
);
const result = await adminService.removeUserAsAdmin(user.uid);
expect(result).toEqual(E.left(USER_NOT_FOUND));
});
});
describe('getTeamInfo', () => {
test('should return the team info when the team is found', async () => {
const team = teams[0];
mockTeamService.getTeamWithIDTE.mockReturnValue(TE.right(team));
const result = await adminService.getTeamInfo(team.id);
expect(result).toEqual(E.right(team));
});
});
describe('fetchInvitedUsers', () => {
test('should resolve right and return an array of invited users', async () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

View File

@@ -240,7 +240,6 @@ export class AdminService {
teamID,
user.value.uid,
)();
if (E.isLeft(teamMember)) {
const addedUser = await this.teamService.addMemberToTeamWithEmail(
teamID,

View File

@@ -1,9 +1,5 @@
import {
Team,
TeamCollection as DBTeamCollection,
TeamRequest as DBTeamRequest,
} from '@prisma/client';
import { mockDeep, mockReset } from 'jest-mock-extended';
import { Team, TeamCollection as DBTeamCollection } from '@prisma/client';
import { mock, mockDeep, mockReset } from 'jest-mock-extended';
import {
TEAM_COLL_DEST_SAME,
TEAM_COLL_INVALID_JSON,
@@ -21,8 +17,9 @@ import { PrismaService } from 'src/prisma/prisma.service';
import { PubSubService } from 'src/pubsub/pubsub.service';
import { AuthUser } from 'src/types/AuthUser';
import { TeamCollectionService } from './team-collection.service';
import { TeamCollection } from './team-collection.model';
import { TeamCollectionModule } from './team-collection.module';
import * as E from 'fp-ts/Either';
import { CollectionFolder } from 'src/types/CollectionFolder';
const mockPrisma = mockDeep<PrismaService>();
const mockPubSub = mockDeep<PubSubService>();
@@ -279,188 +276,11 @@ const childTeamCollectionList: DBTeamCollection[] = [
},
];
const teamRequestList: DBTeamRequest[] = [
{
id: 'req1',
collectionID: childTeamCollection.id,
teamID: team.id,
title: 'request 1',
request: {},
orderIndex: 1,
createdOn: new Date(),
updatedOn: new Date(),
},
];
beforeEach(() => {
mockReset(mockPrisma);
mockPubSub.publish.mockClear();
});
describe('exportCollectionsToJSON', () => {
test('should export collections to JSON string successfully for structure-1', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection
|-> childTeamCollection
| |-> <no request of child coll>
|-> <no request of root coll>
*/
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([
rootTeamCollection,
]);
// RCV CALL 1: Inside exportCollectionsToJSON.exportCollectionToJSONObject for Root Collection
jest
.spyOn(teamCollectionService, 'getCollection')
.mockResolvedValueOnce(E.right(rootTeamCollection));
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([
childTeamCollection,
]);
// RCV CALL 2: Inside exportCollectionsToJSON.exportCollectionToJSONObject for Child Collection
jest
.spyOn(teamCollectionService, 'getCollection')
.mockResolvedValueOnce(E.right(childTeamCollection));
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.teamRequest.findMany.mockResolvedValueOnce([]);
// return { name: childTeamCollection.title, folders: [], requests: [], };
// Back to RCV CALL 1
mockPrisma.teamRequest.findMany.mockResolvedValueOnce([]);
const returnedValue: CollectionFolder = {
name: rootTeamCollection.title,
folders: [
{
name: childTeamCollection.title,
folders: [],
requests: [],
},
],
requests: [],
};
const result = await teamCollectionService.exportCollectionsToJSON(team.id);
expect(result).toEqualRight(JSON.stringify([returnedValue]));
});
test('should export collections to JSON string successfully for structure-2', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection
|-> childTeamCollection
| |-> request1
|-> <no request of root coll>
*/
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([
rootTeamCollection,
]);
// RCV CALL 1: Inside exportCollectionsToJSON.exportCollectionToJSONObject for Root Collection
jest
.spyOn(teamCollectionService, 'getCollection')
.mockResolvedValueOnce(E.right(rootTeamCollection));
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([
childTeamCollection,
]);
// RCV CALL 2: Inside exportCollectionsToJSON.exportCollectionToJSONObject for Child Collection
jest
.spyOn(teamCollectionService, 'getCollection')
.mockResolvedValueOnce(E.right(childTeamCollection));
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.teamRequest.findMany.mockResolvedValueOnce(teamRequestList);
// return { name: childTeamCollection.title, folders: [], requests: teamRequestList, };
// Back to RCV CALL 1
mockPrisma.teamRequest.findMany.mockResolvedValueOnce([]);
const returnedValue: CollectionFolder = {
name: rootTeamCollection.title,
folders: [
{
name: childTeamCollection.title,
folders: [],
requests: teamRequestList.map((req) => req.request),
},
],
requests: [],
};
const result = await teamCollectionService.exportCollectionsToJSON(team.id);
expect(result).toEqualRight(JSON.stringify([returnedValue]));
});
test('should export collections to JSON string successfully for structure-3', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection
|-> childTeamCollection
| |-> child-request1
|-> root-request1
*/
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([
rootTeamCollection,
]);
// RCV CALL 1: Inside exportCollectionsToJSON.exportCollectionToJSONObject for Root Collection
jest
.spyOn(teamCollectionService, 'getCollection')
.mockResolvedValueOnce(E.right(rootTeamCollection));
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([
childTeamCollection,
]);
// RCV CALL 2: Inside exportCollectionsToJSON.exportCollectionToJSONObject for Child Collection
jest
.spyOn(teamCollectionService, 'getCollection')
.mockResolvedValueOnce(E.right(childTeamCollection));
mockPrisma.teamCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.teamRequest.findMany.mockResolvedValueOnce(teamRequestList);
// return { name: childTeamCollection.title, folders: [], requests: teamRequestList, };
// Back to RCV CALL 1
mockPrisma.teamRequest.findMany.mockResolvedValueOnce(teamRequestList);
const returnedValue: CollectionFolder = {
name: rootTeamCollection.title,
folders: [
{
name: childTeamCollection.title,
folders: [],
requests: teamRequestList.map((req) => req.request),
},
],
requests: teamRequestList.map((req) => req.request),
};
const result = await teamCollectionService.exportCollectionsToJSON(team.id);
expect(result).toEqualRight(JSON.stringify([returnedValue]));
});
});
describe('getCollectionCount', () => {
test('should return the count of collections successfully', async () => {
const count = 10;
mockPrisma.teamCollection.count.mockResolvedValueOnce(count);
const result = await teamCollectionService.getCollectionCount(
rootTeamCollection.id,
);
expect(result).toEqual(count);
});
});
describe('getTeamOfCollection', () => {
test('should return the team of a collection successfully with valid collectionID', async () => {
mockPrisma.teamCollection.findUnique.mockResolvedValueOnce({
@@ -1640,3 +1460,5 @@ describe('totalCollectionsInTeam', () => {
});
});
});
//ToDo: write test cases for exportCollectionsToJSON

View File

@@ -9,7 +9,6 @@ import {
TEAM_REQ_NOT_FOUND,
TEAM_REQ_REORDERING_FAILED,
TEAM_COLL_NOT_FOUND,
JSON_INVALID,
} from 'src/errors';
import * as E from 'fp-ts/Either';
import { mockDeep, mockReset } from 'jest-mock-extended';
@@ -240,7 +239,7 @@ describe('deleteTeamRequest', () => {
});
describe('createTeamRequest', () => {
test('should rejects for invalid collection id', async () => {
test('rejects for invalid collection id', async () => {
mockTeamCollectionService.getTeamOfCollection.mockResolvedValue(
E.left(TEAM_INVALID_COLL_ID),
);
@@ -256,42 +255,7 @@ describe('createTeamRequest', () => {
expect(mockPrisma.teamRequest.create).not.toHaveBeenCalled();
});
test('should rejects for invalid team ID', async () => {
mockTeamCollectionService.getTeamOfCollection.mockResolvedValue(
E.right(team),
);
const response = await teamRequestService.createTeamRequest(
'testcoll',
'invalidteamid',
'Test Request',
'{}',
);
expect(response).toEqualLeft(TEAM_INVALID_ID);
expect(mockPrisma.teamRequest.create).not.toHaveBeenCalled();
});
test('should reject for invalid request body', async () => {
mockTeamCollectionService.getTeamOfCollection.mockResolvedValue(
E.right(team),
);
teamRequestService.getRequestsCountInCollection = jest
.fn()
.mockResolvedValueOnce(0);
const response = await teamRequestService.createTeamRequest(
'testcoll',
team.id,
'Test Request',
'invalidjson',
);
expect(response).toEqualLeft(JSON_INVALID);
expect(mockPrisma.teamRequest.create).not.toHaveBeenCalled();
});
test('should resolves and create team request', async () => {
test('resolves for valid collection id', async () => {
const dbRequest = dbTeamRequests[0];
const teamRequest = teamRequests[0];
@@ -572,52 +536,6 @@ describe('findRequestAndNextRequest', () => {
expect(result).resolves.toEqualLeft(TEAM_REQ_NOT_FOUND);
});
test('should resolve left if the next request and given destCollId are different', () => {
const args: MoveTeamRequestArgs = {
srcCollID: teamRequests[0].collectionID,
destCollID: 'different_coll_id',
requestID: teamRequests[0].id,
nextRequestID: teamRequests[4].id,
};
mockPrisma.teamRequest.findFirst
.mockResolvedValueOnce(dbTeamRequests[0])
.mockResolvedValueOnce(dbTeamRequests[4]);
const result = teamRequestService.findRequestAndNextRequest(
args.srcCollID,
args.requestID,
args.destCollID,
args.nextRequestID,
);
expect(result).resolves.toEqualLeft(TEAM_REQ_INVALID_TARGET_COLL_ID);
});
test('should resolve left if the request and the next request are from different teams', async () => {
const args: MoveTeamRequestArgs = {
srcCollID: teamRequests[0].collectionID,
destCollID: teamRequests[4].collectionID,
requestID: teamRequests[0].id,
nextRequestID: teamRequests[4].id,
};
const request = {
...dbTeamRequests[0],
teamID: 'different_team_id',
};
mockPrisma.teamRequest.findFirst
.mockResolvedValueOnce(request)
.mockResolvedValueOnce(dbTeamRequests[4]);
const result = await teamRequestService.findRequestAndNextRequest(
args.srcCollID,
args.requestID,
args.destCollID,
args.nextRequestID,
);
expect(result).toEqualLeft(TEAM_REQ_INVALID_TARGET_COLL_ID);
});
});
describe('moveRequest', () => {
@@ -807,12 +725,13 @@ describe('totalRequestsInATeam', () => {
});
expect(result).toEqual(0);
});
});
describe('getTeamRequestsCount', () => {
test('should return count of all Team Collections in the organization', async () => {
mockPrisma.teamRequest.count.mockResolvedValueOnce(10);
const result = await teamRequestService.getTeamRequestsCount();
expect(result).toEqual(10);
describe('getTeamRequestsCount', () => {
test('should return count of all Team Collections in the organization', async () => {
mockPrisma.teamRequest.count.mockResolvedValueOnce(10);
const result = await teamRequestService.getTeamRequestsCount();
expect(result).toEqual(10);
});
});
});

View File

@@ -1,4 +1,4 @@
import { UserCollection, UserRequest as DbUserRequest } from '@prisma/client';
import { UserCollection } from '@prisma/client';
import { mockDeep, mockReset } from 'jest-mock-extended';
import {
USER_COLL_DEST_SAME,
@@ -11,17 +11,12 @@ import {
USER_COLL_SHORT_TITLE,
USER_COLL_ALREADY_ROOT,
USER_NOT_OWNER,
USER_NOT_FOUND,
USER_COLL_INVALID_JSON,
} from 'src/errors';
import { PrismaService } from 'src/prisma/prisma.service';
import { PubSubService } from 'src/pubsub/pubsub.service';
import { AuthUser } from 'src/types/AuthUser';
import { ReqType } from 'src/types/RequestTypes';
import { UserCollectionService } from './user-collection.service';
import * as E from 'fp-ts/Either';
import { CollectionFolder } from 'src/types/CollectionFolder';
import { UserCollectionExportJSONData } from './user-collections.model';
const mockPrisma = mockDeep<PrismaService>();
const mockPubSub = mockDeep<PubSubService>();
@@ -346,485 +341,11 @@ const rootGQLGQLUserCollectionList: UserCollection[] = [
},
];
const userRESTRequestList: DbUserRequest[] = [
{
id: '123',
collectionID: rootRESTUserCollection.id,
userUid: user.uid,
title: 'Request 1',
request: {},
type: ReqType.REST,
orderIndex: 1,
createdOn: new Date(),
updatedOn: new Date(),
},
];
beforeEach(() => {
mockReset(mockPrisma);
mockPubSub.publish.mockClear();
});
describe('importCollectionsFromJSON', () => {
test('should resolve left for invalid JSON string', async () => {
const result = await userCollectionService.importCollectionsFromJSON(
'invalidJSONString',
user.uid,
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqual(E.left(USER_COLL_INVALID_JSON));
});
test('should resolve left if JSON string is not an array', async () => {
const result = await userCollectionService.importCollectionsFromJSON(
JSON.stringify({}),
user.uid,
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqual(E.left(USER_COLL_INVALID_JSON));
});
test('should resolve left if destCollectionID is invalid', async () => {
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.left(USER_COLL_NOT_FOUND));
const result = await userCollectionService.importCollectionsFromJSON(
JSON.stringify([]),
user.uid,
'invalidID',
ReqType.REST,
);
expect(result).toEqual(E.left(USER_COLL_NOT_FOUND));
});
test('should resolve left if destCollectionID is not owned by this user', async () => {
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(rootRESTUserCollection));
const result = await userCollectionService.importCollectionsFromJSON(
JSON.stringify([]),
'anotherUserUid',
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqual(E.left(USER_NOT_OWNER));
});
test('should resolve left if destCollection type miss match', async () => {
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(rootRESTUserCollection));
const result = await userCollectionService.importCollectionsFromJSON(
JSON.stringify([]),
user.uid,
rootRESTUserCollection.id,
ReqType.GQL,
);
expect(result).toEqual(E.left(USER_COLL_NOT_SAME_TYPE));
});
test('should resolve right for valid JSON and destCollectionID provided', async () => {
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(rootRESTUserCollection));
// private getChildCollectionsCount function call
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.$transaction.mockResolvedValueOnce([]);
const result = await userCollectionService.importCollectionsFromJSON(
JSON.stringify([]),
user.uid,
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqual(E.right(true));
});
test('should resolve right for importing in root directory (destCollectionID == null)', async () => {
// private getChildCollectionsCount function call
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.$transaction.mockResolvedValueOnce([]);
const result = await userCollectionService.importCollectionsFromJSON(
JSON.stringify([
{
name: 'collection-name',
folders: [],
requests: [{ name: 'request-name' }],
},
]),
user.uid,
null,
ReqType.REST,
);
expect(result).toEqual(E.right(true));
});
test('should resolve right and publish event', async () => {
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(rootRESTUserCollection));
// private getChildCollectionsCount function call
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.$transaction.mockResolvedValueOnce([{}]);
const result = await userCollectionService.importCollectionsFromJSON(
JSON.stringify([
{
name: 'collection-name',
folders: [],
requests: [{ name: 'request-name' }],
},
]),
user.uid,
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqual(E.right(true));
expect(mockPubSub.publish).toHaveBeenCalledTimes(1);
});
});
describe('exportUserCollectionsToJSON', () => {
test('should return a list of user collections successfully for valid collectionID input and structure - 1', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection (id: 1 [exporting this collection])
|-> childTeamCollection
| |-> <no request of root coll>
|-> <no request of root coll>
*/
mockPrisma.userCollection.findMany.mockResolvedValueOnce([
childRESTUserCollection,
]);
// RCV CALL 1: exportUserCollectionToJSONObject
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(childRESTUserCollection));
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.userRequest.findMany.mockResolvedValueOnce([]);
const returnFromCallee: CollectionFolder = {
id: childRESTUserCollection.id,
name: childRESTUserCollection.title,
folders: [],
requests: [],
};
// Back to exportUserCollectionsToJSON
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(rootRESTUserCollection));
mockPrisma.userRequest.findMany.mockResolvedValueOnce([]);
const returnedValue: UserCollectionExportJSONData = {
exportedCollection: JSON.stringify({
id: rootRESTUserCollection.id,
name: rootRESTUserCollection.title,
folders: [returnFromCallee],
requests: [],
}),
collectionType: ReqType.REST,
};
const result = await userCollectionService.exportUserCollectionsToJSON(
user.uid,
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqualRight(returnedValue);
});
test('should return a list of user collections successfully for valid collectionID input and structure - 2', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection (id: 1 [exporting this collection])
|-> childTeamCollection
| |-> request1
|-> <no request of root coll>
*/
mockPrisma.userCollection.findMany.mockResolvedValueOnce([
childRESTUserCollection,
]);
// RCV CALL 1: exportUserCollectionToJSONObject
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(childRESTUserCollection));
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.userRequest.findMany.mockResolvedValueOnce(userRESTRequestList);
const returnFromCallee: CollectionFolder = {
id: childRESTUserCollection.id,
name: childRESTUserCollection.title,
folders: [],
requests: userRESTRequestList.map((r) => {
return {
id: r.id,
name: r.title,
...(r.request as Record<string, unknown>),
};
}),
};
// Back to exportUserCollectionsToJSON
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(rootRESTUserCollection));
mockPrisma.userRequest.findMany.mockResolvedValueOnce([]);
const returnedValue: UserCollectionExportJSONData = {
exportedCollection: JSON.stringify({
id: rootRESTUserCollection.id,
name: rootRESTUserCollection.title,
folders: [returnFromCallee],
requests: [],
}),
collectionType: ReqType.REST,
};
const result = await userCollectionService.exportUserCollectionsToJSON(
user.uid,
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqualRight(returnedValue);
});
test('should return a list of user collections successfully for valid collectionID input and structure - 3', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection (id: 1 [exporting this collection])
|-> childTeamCollection
| |-> request1
|-> request2
*/
mockPrisma.userCollection.findMany.mockResolvedValueOnce([
childRESTUserCollection,
]);
// RCV CALL 1: exportUserCollectionToJSONObject
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(childRESTUserCollection));
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.userRequest.findMany.mockResolvedValueOnce(userRESTRequestList);
const returnFromCallee: CollectionFolder = {
id: childRESTUserCollection.id,
name: childRESTUserCollection.title,
folders: [],
requests: userRESTRequestList.map((r) => {
return {
id: r.id,
name: r.title,
...(r.request as Record<string, unknown>),
};
}),
};
// Back to exportUserCollectionsToJSON
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(rootRESTUserCollection));
mockPrisma.userRequest.findMany.mockResolvedValueOnce(userRESTRequestList);
const returnedValue: UserCollectionExportJSONData = {
exportedCollection: JSON.stringify({
id: rootRESTUserCollection.id,
name: rootRESTUserCollection.title,
folders: [returnFromCallee],
requests: userRESTRequestList.map((x) => {
return {
id: x.id,
name: x.title,
...(x.request as Record<string, unknown>), // type casting x.request of type Prisma.JSONValue to an object to enable spread
};
}),
}),
collectionType: ReqType.REST,
};
const result = await userCollectionService.exportUserCollectionsToJSON(
user.uid,
rootRESTUserCollection.id,
ReqType.REST,
);
expect(result).toEqualRight(returnedValue);
});
test('should return a list of user collections successfully for collectionID == null', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection (id: 1 [exporting this collection])
|-> childTeamCollection
| |-> request1
|-> request2
*/
mockPrisma.userCollection.findMany.mockResolvedValueOnce([
childRESTUserCollection,
]);
// RCV CALL 1: exportUserCollectionToJSONObject
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.right(childRESTUserCollection));
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
mockPrisma.userRequest.findMany.mockResolvedValueOnce(userRESTRequestList);
const returnFromCallee: CollectionFolder = {
id: childRESTUserCollection.id,
name: childRESTUserCollection.title,
folders: [],
requests: userRESTRequestList.map((r) => {
return {
id: r.id,
name: r.title,
...(r.request as Record<string, unknown>),
};
}),
};
// Back to exportUserCollectionsToJSON
const returnedValue: UserCollectionExportJSONData = {
exportedCollection: JSON.stringify([returnFromCallee]),
collectionType: ReqType.REST,
};
const result = await userCollectionService.exportUserCollectionsToJSON(
user.uid,
null,
ReqType.REST,
);
expect(result).toEqualRight(returnedValue);
});
test('should return USER_COLL_NOT_FOUND if collectionID or its child not found in DB', async () => {
/*
Assuming collection and request structure is as follows:
rootTeamCollection (id: 1 [exporting this collection])
|-> childTeamCollection
| |-> request1 <NOT FOUND IN DATABASE>
|-> request2
*/
mockPrisma.userCollection.findMany.mockResolvedValueOnce([
childRESTUserCollection,
]);
// RCV CALL 1: exportUserCollectionToJSONObject
jest
.spyOn(userCollectionService, 'getUserCollection')
.mockResolvedValueOnce(E.left(USER_COLL_NOT_FOUND));
// Back to exportUserCollectionsToJSON
const result = await userCollectionService.exportUserCollectionsToJSON(
user.uid,
null,
ReqType.REST,
);
expect(result).toEqualLeft(USER_COLL_NOT_FOUND);
});
});
describe('getUserOfCollection', () => {
test('should return a user successfully with valid collectionID', async () => {
mockPrisma.userCollection.findUniqueOrThrow.mockResolvedValueOnce({
...rootRESTUserCollection,
user: user,
} as any);
const result = await userCollectionService.getUserOfCollection(
rootRESTUserCollection.id,
);
expect(result).toEqualRight(user);
});
test('should return null with invalid collectionID', async () => {
mockPrisma.userCollection.findUniqueOrThrow.mockRejectedValue('error');
const result = await userCollectionService.getUserOfCollection('invalidId');
expect(result).toEqualLeft(USER_NOT_FOUND);
});
});
describe('getUserChildCollections', () => {
test('should return a list of child collections successfully with valid collectionID and userID', async () => {
mockPrisma.userCollection.findMany.mockResolvedValueOnce(
childRESTUserCollectionList,
);
const result = await userCollectionService.getUserChildCollections(
user,
rootRESTUserCollection.id,
null,
10,
ReqType.REST,
);
expect(result).toEqual(childRESTUserCollectionList);
expect(mockPrisma.userCollection.findMany).toHaveBeenCalledWith({
where: {
userUid: user.uid,
parentID: rootRESTUserCollection.id,
type: ReqType.REST,
},
take: 10,
skip: 0,
cursor: undefined,
});
});
test('should return an empty list if no child collections found', async () => {
mockPrisma.userCollection.findMany.mockResolvedValueOnce([]);
const result = await userCollectionService.getUserChildCollections(
user,
rootRESTUserCollection.id,
null,
10,
ReqType.REST,
);
expect(result).toEqual([]);
expect(mockPrisma.userCollection.findMany).toHaveBeenCalledWith({
where: {
userUid: user.uid,
parentID: rootRESTUserCollection.id,
type: ReqType.REST,
},
take: 10,
skip: 0,
cursor: undefined,
});
});
});
describe('getCollectionCount', () => {
test('should return the count of collections', async () => {
const collectionID = 'collection123';
const count = 5;
mockPrisma.userCollection.count.mockResolvedValueOnce(count);
const result = await userCollectionService.getCollectionCount(collectionID);
expect(result).toEqual(count);
expect(mockPrisma.userCollection.count).toHaveBeenCalledTimes(1);
expect(mockPrisma.userCollection.count).toHaveBeenCalledWith({
where: { parentID: collectionID },
});
});
});
describe('getParentOfUserCollection', () => {
test('should return a user-collection successfully with valid collectionID', async () => {
mockPrisma.userCollection.findUnique.mockResolvedValueOnce({

View File

@@ -140,15 +140,13 @@ describe('UserHistoryService', () => {
});
describe('createUserHistory', () => {
test('Should resolve right and create a REST request to users history and return a `UserHistory` object', async () => {
const executedOn = new Date();
mockPrisma.userHistory.create.mockResolvedValueOnce({
userUid: 'abc',
id: '1',
request: [{}],
responseMetadata: [{}],
reqType: ReqType.REST,
executedOn,
executedOn: new Date(),
isStarred: false,
});
@@ -158,7 +156,7 @@ describe('UserHistoryService', () => {
request: JSON.stringify([{}]),
responseMetadata: JSON.stringify([{}]),
reqType: ReqType.REST,
executedOn,
executedOn: new Date(),
isStarred: false,
};
@@ -172,15 +170,13 @@ describe('UserHistoryService', () => {
).toEqualRight(userHistory);
});
test('Should resolve right and create a GQL request to users history and return a `UserHistory` object', async () => {
const executedOn = new Date();
mockPrisma.userHistory.create.mockResolvedValueOnce({
userUid: 'abc',
id: '1',
request: [{}],
responseMetadata: [{}],
reqType: ReqType.GQL,
executedOn,
executedOn: new Date(),
isStarred: false,
});
@@ -190,7 +186,7 @@ describe('UserHistoryService', () => {
request: JSON.stringify([{}]),
responseMetadata: JSON.stringify([{}]),
reqType: ReqType.GQL,
executedOn,
executedOn: new Date(),
isStarred: false,
};
@@ -214,15 +210,13 @@ describe('UserHistoryService', () => {
).toEqualLeft(USER_HISTORY_INVALID_REQ_TYPE);
});
test('Should create a GQL request to users history and publish a created subscription', async () => {
const executedOn = new Date();
mockPrisma.userHistory.create.mockResolvedValueOnce({
userUid: 'abc',
id: '1',
request: [{}],
responseMetadata: [{}],
reqType: ReqType.GQL,
executedOn,
executedOn: new Date(),
isStarred: false,
});
@@ -232,7 +226,7 @@ describe('UserHistoryService', () => {
request: JSON.stringify([{}]),
responseMetadata: JSON.stringify([{}]),
reqType: ReqType.GQL,
executedOn,
executedOn: new Date(),
isStarred: false,
};
@@ -249,15 +243,13 @@ describe('UserHistoryService', () => {
);
});
test('Should create a REST request to users history and publish a created subscription', async () => {
const executedOn = new Date();
mockPrisma.userHistory.create.mockResolvedValueOnce({
userUid: 'abc',
id: '1',
request: [{}],
responseMetadata: [{}],
reqType: ReqType.REST,
executedOn,
executedOn: new Date(),
isStarred: false,
});
@@ -267,7 +259,7 @@ describe('UserHistoryService', () => {
request: JSON.stringify([{}]),
responseMetadata: JSON.stringify([{}]),
reqType: ReqType.REST,
executedOn,
executedOn: new Date(),
isStarred: false,
};

View File

@@ -5,9 +5,6 @@ import {
import { mockDeep, mockReset } from 'jest-mock-extended';
import {
JSON_INVALID,
USER_COLLECTION_NOT_FOUND,
USER_COLL_NOT_FOUND,
USER_REQUEST_INVALID_TYPE,
USER_REQUEST_NOT_FOUND,
USER_REQUEST_REORDERING_FAILED,
} from 'src/errors';
@@ -376,101 +373,6 @@ describe('UserRequestService', () => {
expect(result).resolves.toEqualLeft(JSON_INVALID);
});
test('Should resolve left for invalid collection ID', () => {
const args: CreateUserRequestArgs = {
collectionID: 'invalid-collection-id',
title: userRequests[0].title,
request: userRequests[0].request,
type: userRequests[0].type,
};
mockPrisma.userRequest.count.mockResolvedValue(
dbUserRequests[0].orderIndex - 1,
);
mockUserCollectionService.getUserCollection.mockResolvedValue(
E.left(USER_COLL_NOT_FOUND),
);
const result = userRequestService.createRequest(
args.collectionID,
args.title,
args.request,
args.type,
user,
);
expect(result).resolves.toEqualLeft(USER_COLL_NOT_FOUND);
});
test('Should resolve left for wrong collection ID (using other users collection ID)', () => {
const args: CreateUserRequestArgs = {
collectionID: userRequests[0].collectionID,
title: userRequests[0].title,
request: userRequests[0].request,
type: userRequests[0].type,
};
mockPrisma.userRequest.count.mockResolvedValue(
dbUserRequests[0].orderIndex - 1,
);
mockUserCollectionService.getUserCollection.mockResolvedValue(
E.right({ type: userRequests[0].type, userUid: 'another-user' } as any),
);
const result = userRequestService.createRequest(
args.collectionID,
args.title,
args.request,
args.type,
user,
);
expect(result).resolves.toEqualLeft(USER_COLLECTION_NOT_FOUND);
});
test('Should resolve left for collection type and request type miss match', () => {
const args: CreateUserRequestArgs = {
collectionID: userRequests[0].collectionID,
title: userRequests[0].title,
request: userRequests[0].request,
type: userRequests[0].type,
};
mockUserCollectionService.getUserCollection.mockResolvedValue(
E.right({ type: 'invalid-type', userUid: user.uid } as any),
);
const result = userRequestService.createRequest(
args.collectionID,
args.title,
args.request,
args.type,
user,
);
expect(result).resolves.toEqualLeft(USER_REQUEST_INVALID_TYPE);
});
test('Should resolve left if DB request type and parameter type is different', () => {
const args: CreateUserRequestArgs = {
collectionID: userRequests[0].collectionID,
title: userRequests[0].title,
request: userRequests[0].request,
type: userRequests[0].type,
};
mockPrisma.userRequest.count.mockResolvedValue(
dbUserRequests[0].orderIndex - 1,
);
mockPrisma.userRequest.create.mockResolvedValue(dbUserRequests[0]);
const result = userRequestService.createRequest(
args.collectionID,
args.title,
args.request,
ReqType.GQL,
user,
);
expect(result).resolves.toEqualLeft(USER_REQUEST_INVALID_TYPE);
});
});
describe('updateRequest', () => {

View File

@@ -82,17 +82,18 @@ declare module '@vue/runtime-core' {
HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal']
HoppSmartExpand: typeof import('@hoppscotch/ui')['HoppSmartExpand']
HoppSmartFileChip: typeof import('@hoppscotch/ui')['HoppSmartFileChip']
HoppSmartIntersection: typeof import('@hoppscotch/ui')['HoppSmartIntersection']
HoppSmartItem: typeof import('@hoppscotch/ui')['HoppSmartItem']
HoppSmartLink: typeof import('@hoppscotch/ui')['HoppSmartLink']
HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal']
HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture']
HoppSmartPlaceholder: typeof import('@hoppscotch/ui')['HoppSmartPlaceholder']
HoppSmartProgressRing: typeof import('@hoppscotch/ui')['HoppSmartProgressRing']
HoppSmartRadioGroup: typeof import('@hoppscotch/ui')['HoppSmartRadioGroup']
HoppSmartSlideOver: typeof import('@hoppscotch/ui')['HoppSmartSlideOver']
HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner']
HoppSmartTab: typeof import('@hoppscotch/ui')['HoppSmartTab']
HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs']
HoppSmartToggle: typeof import('@hoppscotch/ui')['HoppSmartToggle']
HoppSmartWindow: typeof import('@hoppscotch/ui')['HoppSmartWindow']
HoppSmartWindows: typeof import('@hoppscotch/ui')['HoppSmartWindows']
HttpAuthorization: typeof import('./components/http/Authorization.vue')['default']
@@ -122,6 +123,7 @@ declare module '@vue/runtime-core' {
HttpURLEncodedParams: typeof import('./components/http/URLEncodedParams.vue')['default']
IconLucideAlertTriangle: typeof import('~icons/lucide/alert-triangle')['default']
IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']
IconLucideBrush: typeof import('~icons/lucide/brush')['default']
IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default']
IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default']
IconLucideGlobe: typeof import('~icons/lucide/globe')['default']
@@ -131,8 +133,10 @@ declare module '@vue/runtime-core' {
IconLucideLayers: typeof import('~icons/lucide/layers')['default']
IconLucideListEnd: typeof import('~icons/lucide/list-end')['default']
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
IconLucideRss: typeof import('~icons/lucide/rss')['default']
IconLucideSearch: typeof import('~icons/lucide/search')['default']
IconLucideUsers: typeof import('~icons/lucide/users')['default']
IconLucideVerified: typeof import('~icons/lucide/verified')['default']
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']
LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']
LensesRenderersAudioLensRenderer: typeof import('./components/lenses/renderers/AudioLensRenderer.vue')['default']

View File

@@ -14,7 +14,13 @@ let keybindingsEnabled = true
* Alt is also regarded as macOS OPTION (⌥) key
* Ctrl is also regarded as macOS COMMAND (⌘) key (NOTE: this differs from HTML Keyboard spec where COMMAND is Meta key!)
*/
type ModifierKeys = "ctrl" | "alt" | "ctrl-shift" | "alt-shift"
type ModifierKeys =
| "ctrl"
| "alt"
| "ctrl-shift"
| "alt-shift"
| "ctrl-alt"
| "ctrl-alt-shift"
/* eslint-disable prettier/prettier */
// prettier-ignore
@@ -143,18 +149,19 @@ function getPressedKey(ev: KeyboardEvent): Key | null {
}
function getActiveModifier(ev: KeyboardEvent): ModifierKeys | null {
const isShiftKey = ev.shiftKey
const modifierKeys = {
ctrl: isAppleDevice() ? ev.metaKey : ev.ctrlKey,
alt: ev.altKey,
shift: ev.shiftKey,
}
// We only allow one modifier key to be pressed (for now)
// Control key (+ Command) gets priority and if Alt is also pressed, it is ignored
if (isAppleDevice() && ev.metaKey) return isShiftKey ? "ctrl-shift" : "ctrl"
else if (!isAppleDevice() && ev.ctrlKey)
return isShiftKey ? "ctrl-shift" : "ctrl"
// active modifier: ctrl | alt | ctrl-alt | ctrl-shift | ctrl-alt-shift | alt-shift
// modiferKeys object's keys are sorted to match the above order
const activeModifier = Object.keys(modifierKeys)
.filter((key) => modifierKeys[key as keyof typeof modifierKeys])
.join("-")
// Test for Alt key
if (ev.altKey) return isShiftKey ? "alt-shift" : "alt"
return null
return activeModifier === "" ? null : (activeModifier as ModifierKeys)
}
/**

View File

@@ -6,7 +6,7 @@ WORKDIR /usr/src/app
RUN npm i -g pnpm
COPY . .
RUN pnpm install
RUN pnpm install --force --frozen-lockfile
WORKDIR /usr/src/app/packages/hoppscotch-selfhost-web/
RUN pnpm run build

View File

@@ -7,7 +7,7 @@
"dev:vite": "vite",
"dev:gql-codegen": "graphql-codegen --require dotenv/config --config gql-codegen.yml dotenv_config_path=\"../../.env\" --watch",
"dev": "pnpm exec npm-run-all -p -l dev:*",
"build": "node --max_old_space_size=16384 ./node_modules/vite/bin/vite.js build",
"build": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build",
"preview": "vite preview",
"lint": "eslint src --ext .ts,.js,.vue --ignore-path .gitignore .",
"lint:ts": "vue-tsc --noEmit",

View File

@@ -6,7 +6,7 @@ WORKDIR /usr/src/app
RUN npm i -g pnpm
COPY . .
RUN pnpm install
RUN pnpm install --force --frozen-lockfile
WORKDIR /usr/src/app/packages/hoppscotch-sh-admin/
RUN pnpm run build

View File

@@ -71,7 +71,7 @@
"unplugin-vue-components": "^0.21.0",
"vite": "^3.2.3",
"vite-plugin-checker": "^0.5.1",
"vite-plugin-dts": "2.0.0-beta.3",
"vite-plugin-dts": "3.2.0",
"vite-plugin-fonts": "^0.6.0",
"vite-plugin-html-config": "^1.0.10",
"vite-plugin-inspect": "^0.7.4",

View File

@@ -1,62 +1,55 @@
<template>
<HoppSmartLink :to="to" :exact="exact" :blank="blank" class="inline-flex items-center justify-center focus:outline-none"
<HoppSmartLink
:to="to"
:exact="exact"
:blank="blank"
class="inline-flex items-center justify-center focus:outline-none"
:class="[
color
? `text-${color}-500 hover:text-${color}-600 focus-visible:text-${color}-600`
: 'hover:text-secondaryDark focus-visible:text-secondaryDark',
{ 'opacity-75 cursor-not-allowed': disabled },
{ 'flex-row-reverse': reverse },
]" :disabled="disabled" tabindex="0">
<component :is="icon" v-if="icon" class="svg-icons" :class="label ? (reverse ? 'ml-2' : 'mr-2') : ''" />
]"
:disabled="disabled"
tabindex="0"
>
<component
:is="icon"
v-if="icon"
class="svg-icons"
:class="label ? (reverse ? 'ml-2' : 'mr-2') : ''"
/>
{{ label }}
</HoppSmartLink>
</template>
<script lang="ts">
import HoppSmartLink from "./Link.vue";
import { Component, defineComponent, PropType } from "vue"
<script setup lang="ts">
import HoppSmartLink from "./Link.vue"
import { Component } from "vue"
export default defineComponent({
components: {
HoppSmartLink
},
props: {
to: {
type: String,
default: "",
},
exact: {
type: Boolean,
default: true,
},
blank: {
type: Boolean,
default: false,
},
label: {
type: String,
default: "",
},
icon: {
type: Object as PropType<Component | null>,
default: null,
},
svg: {
type: Object as PropType<Component | null>,
default: null,
},
color: {
type: String,
default: "",
},
disabled: {
type: Boolean,
default: false,
},
reverse: {
type: Boolean,
default: false,
},
},
})
withDefaults(
defineProps<{
to: string
exact: boolean
blank: boolean
label: string
icon: Component | null
svg: Component | null
color: string
disabled: boolean
reverse: boolean
}>(),
{
to: "",
exact: true,
blank: false,
label: "",
icon: null,
svg: null,
color: "",
disabled: false,
reverse: false,
}
)
</script>

View File

@@ -11,14 +11,13 @@ export default defineConfig({
vue(),
dts({
insertTypesEntry: true,
skipDiagnostics: true,
outputDir: ['dist']
outDir: ["dist"],
}),
WindiCSS({
root: path.resolve(__dirname),
}),
Icons({
compiler: "vue3"
compiler: "vue3",
}),
VitePluginFonts({
google: {
@@ -45,6 +44,6 @@ export default defineConfig({
exports: "named",
},
},
emptyOutDir: true
emptyOutDir: true,
},
})

284
pnpm-lock.yaml generated
View File

@@ -1274,8 +1274,8 @@ importers:
specifier: ^0.5.1
version: 0.5.1(eslint@8.29.0)(typescript@4.9.3)(vite@3.2.4)
vite-plugin-dts:
specifier: 2.0.0-beta.3
version: 2.0.0-beta.3(@types/node@17.0.45)(rollup@2.79.1)(vite@3.2.4)
specifier: 3.2.0
version: 3.2.0(@types/node@17.0.45)(sass@1.53.0)(terser@5.14.1)(typescript@4.9.3)
vite-plugin-fonts:
specifier: ^0.6.0
version: 0.6.0(vite@3.2.4)
@@ -1977,14 +1977,6 @@ packages:
dependencies:
'@babel/types': 7.18.7
/@babel/parser@7.20.15:
resolution: {integrity: sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.21.2
dev: true
/@babel/parser@7.21.2:
resolution: {integrity: sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==}
engines: {node: '>=6.0.0'}
@@ -1992,6 +1984,14 @@ packages:
dependencies:
'@babel/types': 7.18.7
/@babel/parser@7.22.7:
resolution: {integrity: sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.21.2
dev: true
/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.18.6(@babel/core@7.18.6):
resolution: {integrity: sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ==}
engines: {node: '>=6.9.0'}
@@ -5601,16 +5601,16 @@ packages:
vue-i18n:
optional: true
dependencies:
'@intlify/message-compiler': 9.3.0-beta.19
'@intlify/shared': 9.3.0-beta.19
'@intlify/message-compiler': 9.3.0-beta.24
'@intlify/shared': 9.3.0-beta.24
jsonc-eslint-parser: 1.4.1
source-map: 0.6.1
vue-i18n: 9.2.2(vue@3.2.37)
yaml-eslint-parser: 0.3.2
dev: true
/@intlify/bundle-utils@6.0.0:
resolution: {integrity: sha512-c8nTDgsTrBqVk3LPoF/YEarqeqcW0XAY5Y0UmFl5VKWKRNQh47jzvHRDmeRWhos5bUw1zIdiTixrs99FMJ9j5g==}
/@intlify/bundle-utils@7.0.0:
resolution: {integrity: sha512-+/RBsYWbiZcs97RyVb4mrsSrLmIMaI6evj30jI9f1psjXx+syRbf0ab63I5SIz290EOm6TE80fTst/Xjel+D9w==}
engines: {node: '>= 14.16'}
peerDependencies:
petite-vue-i18n: '*'
@@ -5621,8 +5621,8 @@ packages:
vue-i18n:
optional: true
dependencies:
'@intlify/message-compiler': 9.3.0-beta.17
'@intlify/shared': 9.3.0-beta.17
'@intlify/message-compiler': 9.3.0-beta.20
'@intlify/shared': 9.3.0-beta.20
acorn: 8.8.2
escodegen: 2.0.0
estree-walker: 2.0.2
@@ -5655,33 +5655,33 @@ packages:
'@intlify/shared': 9.2.2
source-map: 0.6.1
/@intlify/message-compiler@9.3.0-beta.17:
resolution: {integrity: sha512-i7hvVIRk1Ax2uKa9xLRJCT57to08OhFMhFXXjWN07rmx5pWQYQ23MfX1xgggv9drnWTNhqEiD+u4EJeHoS5+Ww==}
engines: {node: '>= 14'}
dependencies:
'@intlify/shared': 9.3.0-beta.17
source-map: 0.6.1
dev: true
/@intlify/message-compiler@9.3.0-beta.19:
resolution: {integrity: sha512-5RBn5tMOsWh5FqM65IfEJvfpRS8R0lHEUVNDa2rNc9Y7oGEI7swezlbFqU9Kc5FyHy5Kx2jHtdgFIipDwnIYFQ==}
/@intlify/message-compiler@9.3.0-beta.20:
resolution: {integrity: sha512-hwqQXyTnDzAVZ300SU31jO0+3OJbpOdfVU6iBkrmNpS7t2HRnVACo0EwcEXzJa++4EVDreqz5OeqJbt+PeSGGA==}
engines: {node: '>= 16'}
dependencies:
'@intlify/shared': 9.3.0-beta.19
source-map: 0.6.1
'@intlify/shared': 9.3.0-beta.20
source-map-js: 1.0.2
dev: true
/@intlify/message-compiler@9.3.0-beta.24:
resolution: {integrity: sha512-prhHATkgp0mpPqoVgiAtLmUc1JMvs8fMH6w53AVEBn+VF87dLhzanfmWY5FoZWORG51ag54gBDBOoM/VFv3m3A==}
engines: {node: '>= 16'}
dependencies:
'@intlify/shared': 9.3.0-beta.24
source-map-js: 1.0.2
dev: true
/@intlify/shared@9.2.2:
resolution: {integrity: sha512-wRwTpsslgZS5HNyM7uDQYZtxnbI12aGiBZURX3BTR9RFIKKRWpllTsgzHWvj3HKm3Y2Sh5LPC1r0PDCKEhVn9Q==}
engines: {node: '>= 14'}
/@intlify/shared@9.3.0-beta.17:
resolution: {integrity: sha512-mscf7RQsUTOil35jTij4KGW1RC9SWQjYScwLxP53Ns6g24iEd5HN7ksbt9O6FvTmlQuX77u+MXpBdfJsGqizLQ==}
engines: {node: '>= 14'}
/@intlify/shared@9.3.0-beta.20:
resolution: {integrity: sha512-RucSPqh8O9FFxlYUysQTerSw0b9HIRpyoN1Zjogpm0qLiHK+lBNSa5sh1nCJ4wSsNcjphzgpLQCyR60GZlRV8g==}
engines: {node: '>= 16'}
dev: true
/@intlify/shared@9.3.0-beta.19:
resolution: {integrity: sha512-+lhQggrLvlQ/O5OmIYAc9gadcYXMoaDi0Doef+X/f6TLZFr9PTMjOpBWmpwNNHi026e54jckntUn6GzqDtIN4w==}
/@intlify/shared@9.3.0-beta.24:
resolution: {integrity: sha512-AKxJ8s7eKIQWkNaf4wyyoLRwf4puCuQgjSChlDJm5JBEt6T8HGgnYTJLRXu6LD/JACn3Qwu6hM/XRX1c9yvjmQ==}
engines: {node: '>= 16'}
dev: true
@@ -5700,8 +5700,8 @@ packages:
vue-i18n:
optional: true
dependencies:
'@intlify/bundle-utils': 6.0.0
'@intlify/shared': 9.3.0-beta.19
'@intlify/bundle-utils': 7.0.0
'@intlify/shared': 9.3.0-beta.24
'@rollup/pluginutils': 4.2.1
debug: 4.3.4(supports-color@9.2.2)
fast-glob: 3.2.11
@@ -5728,7 +5728,7 @@ packages:
optional: true
dependencies:
'@intlify/bundle-utils': 3.4.0(vue-i18n@9.2.2)
'@intlify/shared': 9.3.0-beta.19
'@intlify/shared': 9.3.0-beta.24
'@rollup/pluginutils': 4.2.1
debug: 4.3.4(supports-color@9.2.2)
fast-glob: 3.2.12
@@ -6341,32 +6341,32 @@ packages:
resolution: {integrity: sha512-EWUguj2kd7ldmrF9F+vI5hUOralPd+sdsUnYbRy33vZTuZkduC1shE9TtEMEjAQwyfyMb4ole5KtjF8MsnQOlA==}
dev: true
/@microsoft/api-extractor-model@7.26.4(@types/node@17.0.45):
resolution: {integrity: sha512-PDCgCzXDo+SLY5bsfl4bS7hxaeEtnXj7XtuzEE+BtALp7B5mK/NrS2kHWU69pohgsRmEALycQdaQPXoyT2i5MQ==}
/@microsoft/api-extractor-model@7.27.4(@types/node@17.0.45):
resolution: {integrity: sha512-HjqQFmuGPOS20rtnu+9Jj0QrqZyR59E+piUWXPMZTTn4jaZI+4UmsHSf3Id8vyueAhOBH2cgwBuRTE5R+MfSMw==}
dependencies:
'@microsoft/tsdoc': 0.14.2
'@microsoft/tsdoc-config': 0.16.2
'@rushstack/node-core-library': 3.55.2(@types/node@17.0.45)
'@rushstack/node-core-library': 3.59.5(@types/node@17.0.45)
transitivePeerDependencies:
- '@types/node'
dev: true
/@microsoft/api-extractor@7.34.4(@types/node@17.0.45):
resolution: {integrity: sha512-HOdcci2nT40ejhwPC3Xja9G+WSJmWhCUKKryRfQYsmE9cD+pxmBaKBKCbuS9jUcl6bLLb4Gz+h7xEN5r0QiXnQ==}
/@microsoft/api-extractor@7.36.1(@types/node@17.0.45):
resolution: {integrity: sha512-2SPp1jq6wDY5IOsRLUv/4FxngslctBZJlztAJ3uWpCAwqKQG7ESdL3DhEza+StbYLtBQmu1Pk6q1Vkhl7qD/bg==}
hasBin: true
dependencies:
'@microsoft/api-extractor-model': 7.26.4(@types/node@17.0.45)
'@microsoft/api-extractor-model': 7.27.4(@types/node@17.0.45)
'@microsoft/tsdoc': 0.14.2
'@microsoft/tsdoc-config': 0.16.2
'@rushstack/node-core-library': 3.55.2(@types/node@17.0.45)
'@rushstack/rig-package': 0.3.18
'@rushstack/ts-command-line': 4.13.2
'@rushstack/node-core-library': 3.59.5(@types/node@17.0.45)
'@rushstack/rig-package': 0.4.0
'@rushstack/ts-command-line': 4.15.1
colors: 1.2.5
lodash: 4.17.21
resolve: 1.22.1
semver: 7.3.8
source-map: 0.6.1
typescript: 4.8.4
typescript: 5.0.4
transitivePeerDependencies:
- '@types/node'
dev: true
@@ -6932,8 +6932,8 @@ packages:
resolution: {integrity: sha512-LwzQKA4vzIct1zNZzBmRKI9QuNpLgTQMEjsQLf3BXuGYb3QPTP4Yjf6mkdX+X1mYttZ808QpOwAzZjv28kq7DA==}
dev: true
/@rushstack/node-core-library@3.55.2(@types/node@17.0.45):
resolution: {integrity: sha512-SaLe/x/Q/uBVdNFK5V1xXvsVps0y7h1sN7aSJllQyFbugyOaxhNRF25bwEDnicARNEjJw0pk0lYnJQ9Kr6ev0A==}
/@rushstack/node-core-library@3.59.5(@types/node@17.0.45):
resolution: {integrity: sha512-1IpV7LufrI1EoVO8hYsb3t6L8L+yp40Sa0OaOV2CIu1zx4e6ZeVNaVIEXFgMXBKdGXkAh21MnCaIzlDNpG6ZQw==}
peerDependencies:
'@types/node': '*'
peerDependenciesMeta:
@@ -6950,15 +6950,15 @@ packages:
z-schema: 5.0.5
dev: true
/@rushstack/rig-package@0.3.18:
resolution: {integrity: sha512-SGEwNTwNq9bI3pkdd01yCaH+gAsHqs0uxfGvtw9b0LJXH52qooWXnrFTRRLG1aL9pf+M2CARdrA9HLHJys3jiQ==}
/@rushstack/rig-package@0.4.0:
resolution: {integrity: sha512-FnM1TQLJYwSiurP6aYSnansprK5l8WUK8VG38CmAaZs29ZeL1msjK0AP1VS4ejD33G0kE/2cpsPsS9jDenBMxw==}
dependencies:
resolve: 1.22.1
strip-json-comments: 3.1.1
dev: true
/@rushstack/ts-command-line@4.13.2:
resolution: {integrity: sha512-bCU8qoL9HyWiciltfzg7GqdfODUeda/JpI0602kbN5YH22rzTxyqYvv7aRLENCM7XCQ1VRs7nMkEqgJUOU8Sag==}
/@rushstack/ts-command-line@4.15.1:
resolution: {integrity: sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ==}
dependencies:
'@types/argparse': 1.0.38
argparse: 1.0.10
@@ -7220,15 +7220,6 @@ packages:
engines: {node: '>= 10'}
dev: true
/@ts-morph/common@0.18.1:
resolution: {integrity: sha512-RVE+zSRICWRsfrkAw5qCAK+4ZH9kwEFv5h0+/YeHTLieWP7F4wWq4JsKFuNWG+fYh/KF+8rAtgdj5zb2mm+DVA==}
dependencies:
fast-glob: 3.2.12
minimatch: 5.1.0
mkdirp: 1.0.4
path-browserify: 1.0.1
dev: true
/@tsconfig/node10@1.0.9:
resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==}
@@ -8394,6 +8385,12 @@ packages:
muggle-string: 0.1.0
dev: true
/@volar/language-core@1.8.0:
resolution: {integrity: sha512-ZHTvZPM3pEbOOuaq+ybNz5TQlHUqPQPK0G1+SonvApGq0e3qgGijjhtL5T7hsCtUEmxfix8FrAuCH14tMBOhTg==}
dependencies:
'@volar/source-map': 1.8.0
dev: true
/@volar/shared@0.27.24:
resolution: {integrity: sha512-Mi8a4GQaiorfb+o4EqOXDZm9E/uBJXgScFgF+NhtcMBOUKHNMKQyLI7YRGumtyJTTdaX7nSDJjGGTkv23tcOtQ==}
dependencies:
@@ -8418,6 +8415,12 @@ packages:
muggle-string: 0.1.0
dev: true
/@volar/source-map@1.8.0:
resolution: {integrity: sha512-d35aV0yFkIrkynRSKgrN5hgbMv6ekkFvcJsJGmOZ8UEjqLStto9zq7RSvpp6/PZ7/pa4Gn1f6K1qDt0bq0oUew==}
dependencies:
muggle-string: 0.3.1
dev: true
/@volar/transforms@0.27.24:
resolution: {integrity: sha512-sOHi1ZSapFlxn7yPl4MO5TXd9aWC0BVq2CgXAJ2EESb+ddh2uJbGQgLLNocX+MDh419cUuuFT2QAJpuWHhJcng==}
dependencies:
@@ -8431,6 +8434,12 @@ packages:
'@volar/language-core': 1.0.9
dev: true
/@volar/typescript@1.8.0:
resolution: {integrity: sha512-T/U1XLLhXv6tNr40Awznfc6QZWizSL99t6M0DeXtIMbnvSCqjjCVRnwlsq+DK9C1RlO3k8+i0Z8iJn7O1GGtoA==}
dependencies:
'@volar/language-core': 1.8.0
dev: true
/@volar/vue-code-gen@0.38.2:
resolution: {integrity: sha512-whLunD6phSGWBUHZKdTxeglrpzQu26ii8CRVapFdjfyMaVhQ7ESNeIAhkTVyg2ovOPc0PiDYPQEPzfWAADIWog==}
dependencies:
@@ -8505,6 +8514,15 @@ packages:
estree-walker: 2.0.2
source-map: 0.6.1
/@vue/compiler-core@3.3.4:
resolution: {integrity: sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==}
dependencies:
'@babel/parser': 7.22.7
'@vue/shared': 3.3.4
estree-walker: 2.0.2
source-map-js: 1.0.2
dev: true
/@vue/compiler-dom@3.2.37:
resolution: {integrity: sha512-yxJLH167fucHKxaqXpYk7x8z7mMEnXOw3G2q62FTkmsvNxu4FQSu5+3UMb+L7fjKa26DEzhrmCxAgFLLIzVfqQ==}
dependencies:
@@ -8523,6 +8541,13 @@ packages:
'@vue/compiler-core': 3.2.45
'@vue/shared': 3.2.45
/@vue/compiler-dom@3.3.4:
resolution: {integrity: sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==}
dependencies:
'@vue/compiler-core': 3.3.4
'@vue/shared': 3.3.4
dev: true
/@vue/compiler-sfc@2.7.1:
resolution: {integrity: sha512-YQRE2uYhlvyFgHmKAqySCdLm7O37XZc+yG9dujwD3h8em+rD1qGOthxc0H3XcijOy50gj/pYHgBO6C3MjV+oug==}
dependencies:
@@ -8636,6 +8661,25 @@ packages:
- supports-color
dev: true
/@vue/language-core@1.8.4(typescript@4.9.3):
resolution: {integrity: sha512-pnNtNcJVfkGYluW0vsVO+Y1gyX+eA0voaS7+1JOhCp5zKeCaL/PAmGYOgfvwML62neL+2H8pnhY7sffmrGpEhw==}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@volar/language-core': 1.8.0
'@volar/source-map': 1.8.0
'@vue/compiler-dom': 3.3.4
'@vue/reactivity': 3.3.4
'@vue/shared': 3.3.4
minimatch: 9.0.3
muggle-string: 0.3.1
typescript: 4.9.3
vue-template-compiler: 2.7.14
dev: true
/@vue/reactivity-transform@3.2.37:
resolution: {integrity: sha512-IWopkKEb+8qpu/1eMKVeXrK0NLw9HicGviJzhJDEyfxTR9e1WtpnnbYkJWurX6WwoFP0sz10xQg8yL8lgskAZg==}
dependencies:
@@ -8679,6 +8723,12 @@ packages:
dependencies:
'@vue/shared': 3.2.45
/@vue/reactivity@3.3.4:
resolution: {integrity: sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==}
dependencies:
'@vue/shared': 3.3.4
dev: true
/@vue/runtime-core@3.2.37:
resolution: {integrity: sha512-JPcd9kFyEdXLl/i0ClS7lwgcs0QpUAWj+SKX2ZC3ANKi1U4DOtiEr6cRqFXsPwY5u1L9fAjkinIdB8Rz3FoYNQ==}
dependencies:
@@ -8739,6 +8789,19 @@ packages:
/@vue/shared@3.2.45:
resolution: {integrity: sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg==}
/@vue/shared@3.3.4:
resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==}
dev: true
/@vue/typescript@1.8.4(typescript@4.9.3):
resolution: {integrity: sha512-sioQfIY5xcmEAz+cPLvv6CtzGPtGhIdR0Za87zB8M4mPe4OSsE3MBGkXcslf+EzQgF+fm6Gr1SRMSX8r5ZmzDA==}
dependencies:
'@volar/typescript': 1.8.0
'@vue/language-core': 1.8.4(typescript@4.9.3)
transitivePeerDependencies:
- typescript
dev: true
/@vueuse/core@8.7.5(vue@3.2.37):
resolution: {integrity: sha512-tqgzeZGoZcXzoit4kOGLWJibDMLp0vdm6ZO41SSUQhkhtrPhAg6dbIEPiahhUu6sZAmSYvVrZgEr5aKD51nrLA==}
peerDependencies:
@@ -9143,7 +9206,7 @@ packages:
hasBin: true
/after@0.8.2:
resolution: {integrity: sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=}
resolution: {integrity: sha512-QbJ0NTQ/I9DI3uSJA4cbexiwQeRAfjPScqIbSjUDd9TOrcg6pTkdgziesOqxBMBzit8vFCTwrP27t13vFOORRA==}
dev: false
/agent-base@6.0.2:
@@ -9755,7 +9818,7 @@ packages:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
/base64-arraybuffer@0.1.4:
resolution: {integrity: sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=}
resolution: {integrity: sha512-a1eIFi4R9ySrbiMuyTGx5e92uRH5tQY6kArNcFaKBUleIoLjdjBg7Zxm3Mqm3Kmkf27HLR/1fnxX9q8GQ7Iavg==}
engines: {node: '>= 0.6.0'}
dev: false
@@ -10302,10 +10365,6 @@ packages:
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
dev: true
/code-block-writer@11.0.3:
resolution: {integrity: sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw==}
dev: true
/collect-v8-coverage@1.0.1:
resolution: {integrity: sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==}
dev: true
@@ -10402,14 +10461,14 @@ packages:
dev: true
/component-bind@1.0.0:
resolution: {integrity: sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=}
resolution: {integrity: sha512-WZveuKPeKAG9qY+FkYDeADzdHyTYdIboXS59ixDeRJL5ZhxpqUnxSOwop4FQjMsiYm3/Or8cegVbpAHNA7pHxw==}
dev: false
/component-emitter@1.3.0:
resolution: {integrity: sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==}
/component-inherit@0.0.3:
resolution: {integrity: sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=}
resolution: {integrity: sha512-w+LhYREhatpVqTESyGFg3NlP6Iu0kEKUHETY9GoZP/pQyW4mHFZuFWRUCIqVPZ36ueVLtoOEZaAqbCF2RDndaA==}
dev: false
/concat-map@0.0.1:
@@ -13609,7 +13668,7 @@ packages:
dev: false
/has-cors@1.1.0:
resolution: {integrity: sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=}
resolution: {integrity: sha512-g5VNKdkFuUuVCP9gYfDJHjK2nqdQJ7aDLTnycnc2+RvsOQbuLdF5pm7vuE5J76SEBIQjs4kQY/BWq74JUmjbXA==}
dev: false
/has-flag@3.0.0:
@@ -14002,7 +14061,7 @@ packages:
engines: {node: '>=8'}
/indexof@0.0.1:
resolution: {integrity: sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=}
resolution: {integrity: sha512-i0G7hLJ1z0DE8dsqJa2rycj9dBmNKgXBvotXtZYXakU9oivfB9Uj2ZBC27qqef2U58/ZLwalxa1X/RDCdkHtVg==}
dev: false
/inflight@1.0.6:
@@ -15863,6 +15922,10 @@ packages:
resolution: {integrity: sha512-ymToLHqL02udwVdbkowNpzjFd6UzozMtshPQKVi5k1EjKRqKqBrOnE9QbLEb0/pV76SAiIT13hdL8R6suc+f3g==}
dev: true
/kolorist@1.8.0:
resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}
dev: true
/leac@0.6.0:
resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}
dev: false
@@ -16231,13 +16294,6 @@ packages:
dependencies:
sourcemap-codec: 1.4.8
/magic-string@0.29.0:
resolution: {integrity: sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==}
engines: {node: '>=12'}
dependencies:
'@jridgewell/sourcemap-codec': 1.4.14
dev: true
/magic-string@0.30.0:
resolution: {integrity: sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==}
engines: {node: '>=12'}
@@ -16493,6 +16549,13 @@ packages:
dependencies:
brace-expansion: 2.0.1
/minimatch@9.0.3:
resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==}
engines: {node: '>=16 || 14 >=14.17'}
dependencies:
brace-expansion: 2.0.1
dev: true
/minimist-options@4.1.0:
resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==}
engines: {node: '>= 6'}
@@ -16971,6 +17034,10 @@ packages:
resolution: {integrity: sha512-Tr1knR3d2mKvvWthlk7202rywKbiOm4rVFLsfAaSIhJ6dt9o47W4S+JMtWhd/PW9Wrdew2/S2fSvhz3E2gkfEg==}
dev: true
/muggle-string@0.3.1:
resolution: {integrity: sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==}
dev: true
/multer@1.4.4-lts.1:
resolution: {integrity: sha512-WeSGziVj6+Z2/MwQo3GvqzgR+9Uc+qt8SwHKh3gvNPiISKfsMfG4SvCOFYlxxgkXt7yIV2i1yczehm0EOKIxIg==}
engines: {node: '>= 6.0.0'}
@@ -17569,10 +17636,6 @@ packages:
utils-merge: 1.0.1
dev: false
/path-browserify@1.0.1:
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
dev: true
/path-case@3.0.4:
resolution: {integrity: sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==}
dependencies:
@@ -19709,7 +19772,7 @@ packages:
dev: true
/to-array@0.1.4:
resolution: {integrity: sha1-F+bBH3PdTz10zaek/zI46a2b+JA=}
resolution: {integrity: sha512-LhVdShQD/4Mk4zXNroIQZJC+Ap3zgLcDuwEdcmLv9CCO73NWockQDwyUnW/m8VX/EElfL6FcYx7EeutN4HJA6A==}
dev: false
/to-fast-properties@2.0.0:
@@ -19899,13 +19962,6 @@ packages:
resolution: {integrity: sha512-DEQrfv6l7IvN2jlzc/VTdZJYsWUnQNCsueYjMkC/iXoEoi5fNan6MjeDqkvhfzbmHgdz9UxDUluX3V5HdjTydQ==}
dev: true
/ts-morph@17.0.1:
resolution: {integrity: sha512-10PkHyXmrtsTvZSL+cqtJLTgFXkU43Gd0JCc0Rw6GchWbqKe0Rwgt1v3ouobTZwQzF1mGhDeAlWYBMGRV7y+3g==}
dependencies:
'@ts-morph/common': 0.18.1
code-block-writer: 11.0.3
dev: true
/ts-node-dev@2.0.0(@types/node@18.11.10)(typescript@4.9.3):
resolution: {integrity: sha512-ywMrhCfH6M75yftYvrvNarLEY+SUXtUvU8/0Z6llrHQVBx12GiFk5sStF8UdfE/yfzk9IAq7O5EEbTQsxlBI8w==}
engines: {node: '>=0.8.0'}
@@ -20213,6 +20269,12 @@ packages:
hasBin: true
dev: true
/typescript@5.0.4:
resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==}
engines: {node: '>=12.20'}
hasBin: true
dev: true
/ua-parser-js@0.7.31:
resolution: {integrity: sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==}
dev: true
@@ -20746,27 +20808,31 @@ packages:
vscode-uri: 3.0.3
dev: true
/vite-plugin-dts@2.0.0-beta.3(@types/node@17.0.45)(rollup@2.79.1)(vite@3.2.4):
resolution: {integrity: sha512-QrsbTxyt0choSYXPxPfmN9XcSvxcVZk0zticxLrI5DkECs9KhDrSVGok1YP/UPkoKpfF9ThtOJcM5Rjuesxv/w==}
/vite-plugin-dts@3.2.0(@types/node@17.0.45)(sass@1.53.0)(terser@5.14.1)(typescript@4.9.3):
resolution: {integrity: sha512-s+dwJvDcb/AWgb49oVbq9JiUSIMwaVpFfV4SVIaBZmv9OZyeyDGxujaq+z4HJ4LB4hUG5c4oRAJyLfV66c763Q==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
vite: '>=2.9.0'
typescript: '*'
dependencies:
'@babel/parser': 7.20.15
'@microsoft/api-extractor': 7.34.4(@types/node@17.0.45)
'@microsoft/api-extractor': 7.36.1(@types/node@17.0.45)
'@rollup/pluginutils': 5.0.2(rollup@2.79.1)
'@rushstack/node-core-library': 3.55.2(@types/node@17.0.45)
'@rushstack/node-core-library': 3.59.5(@types/node@17.0.45)
'@vue/language-core': 1.8.4(typescript@4.9.3)
debug: 4.3.4(supports-color@9.2.2)
fast-glob: 3.2.12
fs-extra: 10.1.0
kolorist: 1.7.0
magic-string: 0.29.0
ts-morph: 17.0.1
kolorist: 1.8.0
typescript: 4.9.3
vue-tsc: 1.8.4(typescript@4.9.3)
optionalDependencies:
rollup: 2.79.1
vite: 3.2.4(@types/node@17.0.45)(sass@1.53.0)(terser@5.14.1)
transitivePeerDependencies:
- '@types/node'
- rollup
- less
- sass
- stylus
- sugarss
- supports-color
- terser
dev: true
/vite-plugin-eslint@1.8.1(eslint@8.29.0)(vite@3.2.4):
@@ -21500,6 +21566,18 @@ packages:
typescript: 4.9.3
dev: true
/vue-tsc@1.8.4(typescript@4.9.3):
resolution: {integrity: sha512-+hgpOhIx11vbi8/AxEdaPj3fiRwN9wy78LpsNNw2V995/IWa6TMyQxHbaw2ZKUpdwjySSHgrT6ohDEhUgFxGYw==}
hasBin: true
peerDependencies:
typescript: '*'
dependencies:
'@vue/language-core': 1.8.4(typescript@4.9.3)
'@vue/typescript': 1.8.4(typescript@4.9.3)
semver: 7.3.8
typescript: 4.9.3
dev: true
/vue@2.7.1:
resolution: {integrity: sha512-X1YkFddhbTAU2FPK0gBZ/vDOcOMA8ZT4uHoFVor1bUb7BpVGdEswS286YGtODsf/Ghfr1LM1sBMFAY8XT+dVhA==}
dependencies:
@@ -22290,7 +22368,7 @@ packages:
dev: false
/yeast@0.1.2:
resolution: {integrity: sha1-AI4G2AlDIMNy28L47XagymyKxBk=}
resolution: {integrity: sha512-8HFIh676uyGYP6wP13R/j6OJ/1HwJ46snpvzE7aHAN3Ryqh2yX6Xox2B4CUmTwwOIzlG3Bs7ocsP5dZH/R1Qbg==}
dev: false
/yn@3.1.1: