@kiwiproject/kiwi-js 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,11 +12,12 @@ const error_response_1 = require("../model/error-response");
12
12
  * @param entity the entity or undefined
13
13
  */
14
14
  const standardGetResponseWithIdentifier = (res, identifierField, identifier, entity) => {
15
- if (entity !== undefined) {
16
- res.status(200).json(entity);
15
+ if (entity === undefined || entity === null) {
16
+ standardNotFoundResponse(res, `Object with ${identifierField} ${identifier} not found`, identifierField, identifier);
17
17
  return;
18
18
  }
19
- standardNotFoundResponse(res, `Object with ${identifierField} ${identifier} not found`, identifierField, identifier);
19
+ res.status(200).json(entity);
20
+ return;
20
21
  };
21
22
  /**
22
23
  * Returns a 200 OK response if the entity is non-null. Otherwise, returns a 404 Not Found response with
@@ -27,11 +28,12 @@ const standardGetResponseWithIdentifier = (res, identifierField, identifier, ent
27
28
  * @param notFoundMessage the specific message to use in the 404 response (if entity is undefined)
28
29
  */
29
30
  const standardGetResponseWithMessage = (res, entity, notFoundMessage) => {
30
- if (entity !== undefined) {
31
- res.status(200).json(entity);
31
+ if (entity === undefined || entity === null) {
32
+ standardNotFoundResponse(res, notFoundMessage);
32
33
  return;
33
34
  }
34
- standardNotFoundResponse(res, notFoundMessage);
35
+ res.status(200).json(entity);
36
+ return;
35
37
  };
36
38
  /**
37
39
  * Returns a 404 Not Found response containing an {@link ErrorResponse} entity which uses {@code notFoundMessage}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiwiproject/kiwi-js",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "KiwiJS is a utility library. It contains a variety of utilities that we have built over time and find useful. Most of these utilities are ports from the Java Kiwi library.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,21 +22,21 @@
22
22
  ]
23
23
  },
24
24
  "dependencies": {
25
- "express": "4.18.3"
25
+ "express": "4.21.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@babel/core": "7.24.0",
29
- "@babel/preset-env": "7.24.0",
30
- "@babel/preset-typescript": "7.23.3",
28
+ "@babel/core": "7.25.2",
29
+ "@babel/preset-env": "7.25.4",
30
+ "@babel/preset-typescript": "7.24.7",
31
31
  "@jest/globals": "29.7.0",
32
32
  "@types/express": "4.17.21",
33
- "@types/node": "20.11.28",
34
- "@typescript-eslint/eslint-plugin": "7.2.0",
35
- "@typescript-eslint/parser": "7.2.0",
33
+ "@types/node": "22.5.5",
34
+ "@typescript-eslint/eslint-plugin": "8.6.0",
35
+ "@typescript-eslint/parser": "8.7.0",
36
36
  "babel-jest": "29.7.0",
37
- "eslint": "8.57.0",
37
+ "eslint": "9.11.0",
38
38
  "jest": "29.7.0",
39
- "prettier": "3.2.5",
40
- "typescript": "5.4.2"
39
+ "prettier": "3.3.3",
40
+ "typescript": "5.6.2"
41
41
  }
42
42
  }