Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for release 1.0.3 #918

Merged
merged 4 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
638 changes: 315 additions & 323 deletions backend/package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prompt-injection-api",
"version": "1.0.0",
"version": "1.0.3",
"type": "module",
"scripts": {
"build": "tsc --noEmit",
Expand Down Expand Up @@ -28,20 +28,20 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/express-session": "^1.18.0",
"@types/node": "^20.12.7",
"@types/node": "^20.14.10",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.2.0",
"prettier": "^3.2.5",
"eslint-plugin-jest": "^28.6.0",
"prettier": "^3.3.3",
"supertest": "^7.0.0",
"ts-jest": "^29.1.2",
"tsx": "^4.7.2",
"typescript": "^5.4.5"
"ts-jest": "^29.2.2",
"tsx": "^4.16.2",
"typescript": "^5.5.3"
}
}
12 changes: 7 additions & 5 deletions backend/src/controller/defenceController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,16 @@ function handleResetDefenceConfigItem(
currentDefences
);

const updatedDefences = req.session.levelState[level].defences;
if (updatedDefences === undefined) {
const updatedDefence = req.session.levelState[level].defences.find(
(defence) => defence.id === defenceId
);
if (!updatedDefence) {
Copy link
Member Author

@chriswilty chriswilty Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change here is a result of eslint pointing out that updatedDefences in original code could not actually be undefined.

sendErrorResponse(res, 500, 'Something went whacky');
return;
}
const updatedDefenceConfig = updatedDefences
.find((defence) => defence.id === defenceId)
?.config.find((config) => config.id === configItemId);
const updatedDefenceConfig = updatedDefence.config.find(
(config) => config.id === configItemId
);

res.send(updatedDefenceConfig);
}
Expand Down
Loading
Loading