@epistemology-factory/crocks-web
Advanced tools
Comparing version 0.2.9 to 0.2.10
{ | ||
"name": "@epistemology-factory/crocks-web", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"description": "Functions to help write web applications with crocks", | ||
@@ -29,4 +29,4 @@ "scripts": { | ||
"dependencies": { | ||
"@epistemology-factory/crocks-ext": "0.0.14" | ||
"@epistemology-factory/crocks-ext": "0.0.17" | ||
} | ||
} |
@@ -25,5 +25,13 @@ "use strict"; | ||
// aForbiddenResponse :: Object -> Matcher | ||
const aForbiddenResponse = (headers) => | ||
aResponse(403, headers, { message: "Forbidden" }) | ||
// anInternalServerError :: (Object, String, a) -> Matcher | ||
const anInternalServerError = partial(anErrorResponse, 500) | ||
// anUnauthorisedResponse :: Obejct -> Matcher | ||
const anUnauthorisedResponse = (headers) => | ||
aResponse(401, headers, { message: "Unauthorised" }) | ||
// anUnsupportedMediaType :: (Object, String) -> Matcher | ||
@@ -39,5 +47,7 @@ const anUnsupportedMediaType = (headers, contentType) => anErrorResponse( | ||
aBadRequest, | ||
aForbiddenResponse, | ||
anInternalServerError, | ||
anUnauthorisedResponse, | ||
anUnsupportedMediaType, | ||
aResponse | ||
} |
@@ -71,3 +71,3 @@ "use strict"; | ||
// getHeader :: a -> String -> b -> c | ||
// getHeaderOr :: a -> String -> b -> c | ||
const getHeaderOr = curry((value, header) => | ||
@@ -74,0 +74,0 @@ compose(option(value), getHeader(header)) |
@@ -53,6 +53,14 @@ "use strict"; | ||
// validateBody :: Schema -> Object -> Result Object | ||
const validateBody = (schema) => | ||
pipe( | ||
isSchemaValid(schema, [ "body" ]), | ||
bimap(validationError, identity) | ||
) | ||
module.exports = { | ||
parseBody, | ||
parseJSON, | ||
validateBody, | ||
validateRequest | ||
} |
@@ -61,5 +61,11 @@ "use strict"; | ||
// forbidden :: Object -> Object | ||
const forbidden = (headers) => response(403, headers, { message: "Forbidden" }) | ||
// internalServerError :: Object -> String -> a -> Object | ||
const internalServerError = errorResponse(500); | ||
// unauthorised :: Object -> Object | ||
const unauthorised = (headers) => response(401, headers, { message: "Unauthorised" }) | ||
// unsupportedMediaType :: Object -> String -> Object | ||
@@ -72,6 +78,8 @@ const unsupportedMediaType = curry((headers, contentType) => | ||
badRequest, | ||
forbidden, | ||
internalServerError, | ||
respondWith, | ||
response, | ||
unauthorised, | ||
unsupportedMediaType | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30705
846
+ Added@epistemology-factory/crocks-ext@0.0.17(transitive)
- Removed@epistemology-factory/crocks-ext@0.0.14(transitive)