@kiwiproject/kiwi-js 0.9.0 → 0.10.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.
@@ -10,6 +10,7 @@ export declare const KiwiStandardResponsesExpress: {
10
10
  standardAcceptedResponse: (res: Response, entity: unknown) => void;
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
+ standardForbiddenResponse: (res: Response, errorMessage: string) => void;
13
14
  standardNotFoundResponse: (res: Response, notFoundMessage: string, identifierField?: string, identifier?: unknown) => void;
14
15
  standardBadRequestResponse: (res: Response, errorMessage: string, errors?: Array<ErrorMessage>, identifierField?: string, identifier?: unknown) => void;
15
16
  };
@@ -108,6 +108,16 @@ const standardBadRequestResponse = (res, errorMessage, errors = [], identifierFi
108
108
  const standardUnauthorizedResponse = (res, errorMessage) => {
109
109
  res.status(401).json(new error_response_1.ErrorResponse(errorMessage).toMap());
110
110
  };
111
+ /**
112
+ * Returns a 403 Forbidden response containing an {@link ErrorResponse} entity which uses {@code errorMessage}
113
+ * as the detailed error message.
114
+ *
115
+ * @param res the Express Response
116
+ * @param errorMessage the error message to use
117
+ */
118
+ const standardForbiddenResponse = (res, errorMessage) => {
119
+ res.status(403).json(new error_response_1.ErrorResponse(errorMessage).toMap());
120
+ };
111
121
  /**
112
122
  * Returns a response having the given status and an {@link ErrorResponse} entity which uses {@code errorMessage}
113
123
  * as the detailed error message.
@@ -147,6 +157,7 @@ exports.KiwiStandardResponsesExpress = {
147
157
  standardAcceptedResponse,
148
158
  standardErrorResponse,
149
159
  standardUnauthorizedResponse,
160
+ standardForbiddenResponse,
150
161
  standardNotFoundResponse,
151
162
  standardBadRequestResponse,
152
163
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiwiproject/kiwi-js",
3
- "version": "0.9.0",
3
+ "version": "0.10.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",
@@ -25,18 +25,18 @@
25
25
  "express": "4.18.2"
26
26
  },
27
27
  "devDependencies": {
28
- "@babel/core": "7.23.7",
29
- "@babel/preset-env": "7.23.7",
28
+ "@babel/core": "7.23.9",
29
+ "@babel/preset-env": "7.23.9",
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.10.6",
34
- "@typescript-eslint/eslint-plugin": "6.16.0",
35
- "@typescript-eslint/parser": "6.16.0",
33
+ "@types/node": "20.11.20",
34
+ "@typescript-eslint/eslint-plugin": "7.0.2",
35
+ "@typescript-eslint/parser": "7.0.2",
36
36
  "babel-jest": "29.7.0",
37
- "eslint": "8.56.0",
37
+ "eslint": "8.57.0",
38
38
  "jest": "29.7.0",
39
- "prettier": "3.1.1",
39
+ "prettier": "3.2.5",
40
40
  "typescript": "5.3.3"
41
41
  }
42
42
  }