@rvoh/psychic 3.8.2 → 3.8.5
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.
- package/dist/cjs/src/openapi-renderer/defaults.js +0 -11
- package/dist/cjs/src/router/index.js +7 -9
- package/dist/cjs/src/server/params.js +2 -0
- package/dist/esm/src/openapi-renderer/defaults.js +0 -11
- package/dist/esm/src/router/index.js +7 -9
- package/dist/esm/src/server/params.js +2 -0
- package/dist/types/src/router/index.d.ts +7 -9
- package/package.json +2 -2
|
@@ -94,17 +94,6 @@ export const DEFAULT_OPENAPI_COMPONENT_RESPONSES = {
|
|
|
94
94
|
Conflict: {
|
|
95
95
|
description: 'The request failed because a conflict was detected with the given request params',
|
|
96
96
|
},
|
|
97
|
-
// 422
|
|
98
|
-
ValidationErrors: {
|
|
99
|
-
description: 'The request failed to process due to validation errors with the provided values',
|
|
100
|
-
content: {
|
|
101
|
-
'application/json': {
|
|
102
|
-
schema: {
|
|
103
|
-
$ref: '#/components/schemas/ValidationErrors',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
97
|
// 500
|
|
109
98
|
InternalServerError: {
|
|
110
99
|
description: 'the server encountered an unexpected condition that prevented it from fulfilling the request',
|
|
@@ -224,16 +224,14 @@ suggested fix: "${convertRouteParams(path)}"
|
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* Automatically rescue certain errors and convert them into status codes.
|
|
227
|
-
* Validation errors (OpenAPI or otherwise) are
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* accepted.
|
|
227
|
+
* Validation errors (OpenAPI or otherwise) are converted to 400. When a
|
|
228
|
+
* controller deliberately returns field-level validation details for display
|
|
229
|
+
* to an end user, prefer a 400 response carrying an errors payload in the
|
|
230
|
+
* same shape as Dream#errors: { errors: { field: ['message'] } }.
|
|
232
231
|
*
|
|
233
|
-
* Philosophy: do not return information
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* validation (e.g. an email must be formatted correctly).
|
|
232
|
+
* Philosophy: do not return information unless it is explicitly intended for
|
|
233
|
+
* that information to be used by a front-end interface supporting
|
|
234
|
+
* user-visible validation (e.g. an email must be formatted correctly).
|
|
237
235
|
*
|
|
238
236
|
* By default, do not provide an attacker with any visibility into which layer
|
|
239
237
|
* of the application rejected their request.
|
|
@@ -162,6 +162,8 @@ export default class Params {
|
|
|
162
162
|
return this;
|
|
163
163
|
}
|
|
164
164
|
cast(paramName, paramValue, expectedType, opts) {
|
|
165
|
+
if (typeof paramValue === 'string')
|
|
166
|
+
paramValue = paramValue.trim();
|
|
165
167
|
if (expectedType instanceof RegExp) {
|
|
166
168
|
return this.matchRegexOrThrow(paramName, paramValue, expectedType);
|
|
167
169
|
}
|
|
@@ -94,17 +94,6 @@ export const DEFAULT_OPENAPI_COMPONENT_RESPONSES = {
|
|
|
94
94
|
Conflict: {
|
|
95
95
|
description: 'The request failed because a conflict was detected with the given request params',
|
|
96
96
|
},
|
|
97
|
-
// 422
|
|
98
|
-
ValidationErrors: {
|
|
99
|
-
description: 'The request failed to process due to validation errors with the provided values',
|
|
100
|
-
content: {
|
|
101
|
-
'application/json': {
|
|
102
|
-
schema: {
|
|
103
|
-
$ref: '#/components/schemas/ValidationErrors',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
97
|
// 500
|
|
109
98
|
InternalServerError: {
|
|
110
99
|
description: 'the server encountered an unexpected condition that prevented it from fulfilling the request',
|
|
@@ -224,16 +224,14 @@ suggested fix: "${convertRouteParams(path)}"
|
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* Automatically rescue certain errors and convert them into status codes.
|
|
227
|
-
* Validation errors (OpenAPI or otherwise) are
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* accepted.
|
|
227
|
+
* Validation errors (OpenAPI or otherwise) are converted to 400. When a
|
|
228
|
+
* controller deliberately returns field-level validation details for display
|
|
229
|
+
* to an end user, prefer a 400 response carrying an errors payload in the
|
|
230
|
+
* same shape as Dream#errors: { errors: { field: ['message'] } }.
|
|
232
231
|
*
|
|
233
|
-
* Philosophy: do not return information
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* validation (e.g. an email must be formatted correctly).
|
|
232
|
+
* Philosophy: do not return information unless it is explicitly intended for
|
|
233
|
+
* that information to be used by a front-end interface supporting
|
|
234
|
+
* user-visible validation (e.g. an email must be formatted correctly).
|
|
237
235
|
*
|
|
238
236
|
* By default, do not provide an attacker with any visibility into which layer
|
|
239
237
|
* of the application rejected their request.
|
|
@@ -162,6 +162,8 @@ export default class Params {
|
|
|
162
162
|
return this;
|
|
163
163
|
}
|
|
164
164
|
cast(paramName, paramValue, expectedType, opts) {
|
|
165
|
+
if (typeof paramValue === 'string')
|
|
166
|
+
paramValue = paramValue.trim();
|
|
165
167
|
if (expectedType instanceof RegExp) {
|
|
166
168
|
return this.matchRegexOrThrow(paramName, paramValue, expectedType);
|
|
167
169
|
}
|
|
@@ -49,16 +49,14 @@ export default class PsychicRouter {
|
|
|
49
49
|
private get validationErrorLoggingEnabled();
|
|
50
50
|
/**
|
|
51
51
|
* Automatically rescue certain errors and convert them into status codes.
|
|
52
|
-
* Validation errors (OpenAPI or otherwise) are
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* accepted.
|
|
52
|
+
* Validation errors (OpenAPI or otherwise) are converted to 400. When a
|
|
53
|
+
* controller deliberately returns field-level validation details for display
|
|
54
|
+
* to an end user, prefer a 400 response carrying an errors payload in the
|
|
55
|
+
* same shape as Dream#errors: { errors: { field: ['message'] } }.
|
|
57
56
|
*
|
|
58
|
-
* Philosophy: do not return information
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* validation (e.g. an email must be formatted correctly).
|
|
57
|
+
* Philosophy: do not return information unless it is explicitly intended for
|
|
58
|
+
* that information to be used by a front-end interface supporting
|
|
59
|
+
* user-visible validation (e.g. an email must be formatted correctly).
|
|
62
60
|
*
|
|
63
61
|
* By default, do not provide an attacker with any visibility into which layer
|
|
64
62
|
* of the application rejected their request.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@rvoh/psychic",
|
|
4
4
|
"description": "Typescript web framework",
|
|
5
|
-
"version": "3.8.
|
|
5
|
+
"version": "3.8.5",
|
|
6
6
|
"author": "RVOHealth",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"vitest": "^4.1.0",
|
|
138
138
|
"winston": "^3.14.2"
|
|
139
139
|
},
|
|
140
|
-
"packageManager": "pnpm@11.
|
|
140
|
+
"packageManager": "pnpm@11.9.0+sha512.bd682d5d03fe525ef7c9fd6780c6884d1e756ac4c9c9fe00c538782824310dcf90e3ddc4f53835f06dfaebd5085e41855e0bcbb3b60de2ac5bbab89e5036f03b"
|
|
141
141
|
}
|