@kiwiproject/kiwi-js 0.10.0 → 0.11.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.
@@ -11,6 +11,7 @@ export declare const KiwiStandardResponsesExpress: {
11
11
  standardErrorResponse: (res: Response, status: number, errorMessage: string, errors?: Array<ErrorMessage>, identifierField?: string, identifier?: unknown) => void;
12
12
  standardUnauthorizedResponse: (res: Response, errorMessage: string) => void;
13
13
  standardForbiddenResponse: (res: Response, errorMessage: string) => void;
14
+ standardForbiddenResponseWithEntity: (res: Response, entity: unknown) => void;
14
15
  standardNotFoundResponse: (res: Response, notFoundMessage: string, identifierField?: string, identifier?: unknown) => void;
15
16
  standardBadRequestResponse: (res: Response, errorMessage: string, errors?: Array<ErrorMessage>, identifierField?: string, identifier?: unknown) => void;
16
17
  };
@@ -118,6 +118,15 @@ const standardUnauthorizedResponse = (res, errorMessage) => {
118
118
  const standardForbiddenResponse = (res, errorMessage) => {
119
119
  res.status(403).json(new error_response_1.ErrorResponse(errorMessage).toMap());
120
120
  };
121
+ /**
122
+ * Returns a 403 Forbidden response containing a provided entity.
123
+ *
124
+ * @param res the Express Response
125
+ * @param entity the entity to use
126
+ */
127
+ const standardForbiddenResponseWithEntity = (res, entity) => {
128
+ res.status(403).json(entity);
129
+ };
121
130
  /**
122
131
  * Returns a response having the given status and an {@link ErrorResponse} entity which uses {@code errorMessage}
123
132
  * as the detailed error message.
@@ -158,6 +167,7 @@ exports.KiwiStandardResponsesExpress = {
158
167
  standardErrorResponse,
159
168
  standardUnauthorizedResponse,
160
169
  standardForbiddenResponse,
170
+ standardForbiddenResponseWithEntity,
161
171
  standardNotFoundResponse,
162
172
  standardBadRequestResponse,
163
173
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiwiproject/kiwi-js",
3
- "version": "0.10.0",
3
+ "version": "0.11.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.2"
25
+ "express": "4.18.3"
26
26
  },
27
27
  "devDependencies": {
28
- "@babel/core": "7.23.9",
29
- "@babel/preset-env": "7.23.9",
28
+ "@babel/core": "7.24.0",
29
+ "@babel/preset-env": "7.24.0",
30
30
  "@babel/preset-typescript": "7.23.3",
31
31
  "@jest/globals": "29.7.0",
32
32
  "@types/express": "4.17.21",
33
- "@types/node": "20.11.20",
34
- "@typescript-eslint/eslint-plugin": "7.0.2",
35
- "@typescript-eslint/parser": "7.0.2",
33
+ "@types/node": "20.11.28",
34
+ "@typescript-eslint/eslint-plugin": "7.2.0",
35
+ "@typescript-eslint/parser": "7.2.0",
36
36
  "babel-jest": "29.7.0",
37
37
  "eslint": "8.57.0",
38
38
  "jest": "29.7.0",
39
39
  "prettier": "3.2.5",
40
- "typescript": "5.3.3"
40
+ "typescript": "5.4.2"
41
41
  }
42
42
  }