express-yaschema-api-handler
Advanced tools
Comparing version 1.2.2 to 1.3.0
export * from './config/exports'; | ||
export * from './middleware/exports'; | ||
export * from './register-api-handler/exports'; | ||
@@ -3,0 +4,0 @@ export * from './register-http-api-handler/exports'; |
{ | ||
"name": "express-yaschema-api-handler", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Express handler support for yaschema-api", | ||
@@ -11,3 +11,4 @@ "keywords": [ | ||
], | ||
"main": "lib/index.js", | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/mjs/index.js", | ||
"types": "lib/index.d.ts", | ||
@@ -19,6 +20,6 @@ "repository": "https://github.com/TypeScript-OSS/express-yaschema-api-handler.git", | ||
"scripts": { | ||
"build": "tsc -p tsconfig.build.json", | ||
"build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.mjs.json", | ||
"build:dev": "trash dev-build && yarn build && mkdir dev-build && cp -r lib dev-build && cp package.json dev-build && (cd dev-build && echo 'package' `pwd`)", | ||
"clean": "trash coverage dev-build docs lib", | ||
"generate:docs": "npx typedoc src/index.ts --out docs", | ||
"generate:docs": "npx typedoc src/index.ts --out docs --skipErrorChecking", | ||
"lint": "eslint 'src/**/*.ts?(x)' --max-warnings 0", | ||
@@ -29,3 +30,3 @@ "prepublishOnly": "yarn clean && yarn test && yarn lint && yarn test:audit && yarn clean && yarn build && yarn generate:docs", | ||
"test:check-circular-dependencies": "yarn build && npx madge --circular ./lib", | ||
"test:unit-tests:": "npx jest --runInBand --coverage", | ||
"test:unit-tests:": "NODE_OPTIONS=--experimental-vm-modules npx jest --runInBand --coverage", | ||
"test:unit-tests": "yarn test:unit-tests: src" | ||
@@ -35,4 +36,4 @@ }, | ||
"http-status-codes": "^2.2.0", | ||
"yaschema": "^2.0.2", | ||
"yaschema-api": "^2.0.3" | ||
"yaschema": "^2.1.0", | ||
"yaschema-api": "^2.1.0" | ||
}, | ||
@@ -42,11 +43,12 @@ "devDependencies": { | ||
"@types/express": "^4.17.17", | ||
"@types/jest": "^29.5.0", | ||
"@types/lodash": "4.14.191", | ||
"@types/node-fetch": "^2.6.2", | ||
"@typescript-eslint/eslint-plugin": "^5.50.0", | ||
"@typescript-eslint/parser": "^5.50.0", | ||
"@types/jest": "^29.5.1", | ||
"@types/lodash": "4.14.194", | ||
"@types/multer": "^1.4.7", | ||
"@types/node-fetch": "^2.6.3", | ||
"@typescript-eslint/eslint-plugin": "^5.59.2", | ||
"@typescript-eslint/parser": "^5.59.2", | ||
"body-parser": "^1.20.2", | ||
"eslint": "8.36.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-import-resolver-typescript": "^3.5.3", | ||
"eslint": "8.39.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-import-resolver-typescript": "^3.5.5", | ||
"eslint-plugin-import": "^2.27.5", | ||
@@ -58,2 +60,3 @@ "eslint-plugin-prefer-arrow": "^1.2.3", | ||
"express": "^4.18.2", | ||
"fast-text-encoding": "^1.0.6", | ||
"http-status-codes": "^2.2.0", | ||
@@ -63,10 +66,11 @@ "jest": "29.5.0", | ||
"madge": "6.0.0", | ||
"node-fetch": "^2.6.9", | ||
"prettier": "2.8.4", | ||
"multer": "^1.4.5-lts.1", | ||
"node-fetch": "^3.3.1", | ||
"prettier": "2.8.8", | ||
"trash-cli": "5.0.0", | ||
"ts-jest": "^29.0.5", | ||
"typedoc": "^0.23.24", | ||
"typescript": "5.0.2", | ||
"yaschema-api-fetcher": "^1.1.1" | ||
"ts-jest": "^29.1.0", | ||
"typedoc": "^0.24.6", | ||
"typescript": "5.0.4", | ||
"yaschema-api-fetcher": "^1.4.0" | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
import 'fast-text-encoding'; // node-fetch 3 needs this polyfill in Node | ||
import bodyParser from 'body-parser'; | ||
@@ -68,3 +70,3 @@ import express from 'express'; | ||
setDefaultUrlBase(`http://localhost:${port}`); | ||
setFetch(nodeFetch as any as Fetch); | ||
setFetch(nodeFetch as Fetch); | ||
}); | ||
@@ -71,0 +73,0 @@ |
@@ -59,3 +59,3 @@ import bodyParser from 'body-parser'; | ||
setDefaultUrlBase(`http://localhost:${port}`); | ||
setFetch(nodeFetch as any as Fetch); | ||
setFetch(nodeFetch as Fetch); | ||
}); | ||
@@ -62,0 +62,0 @@ |
@@ -0,1 +1,3 @@ | ||
import 'fast-text-encoding'; // node-fetch 3 needs this polyfill in Node | ||
import bodyParser from 'body-parser'; | ||
@@ -67,3 +69,3 @@ import express from 'express'; | ||
setDefaultUrlBase(`http://localhost:${port}`); | ||
setFetch(nodeFetch as any as Fetch); | ||
setFetch(nodeFetch as Fetch); | ||
}); | ||
@@ -70,0 +72,0 @@ |
@@ -0,1 +1,3 @@ | ||
import 'fast-text-encoding'; // node-fetch 3 needs this polyfill in Node | ||
import bodyParser from 'body-parser'; | ||
@@ -64,3 +66,3 @@ import express from 'express'; | ||
setDefaultUrlBase(`http://localhost:${port}`); | ||
setFetch(nodeFetch as any as Fetch); | ||
setFetch(nodeFetch as Fetch); | ||
}); | ||
@@ -67,0 +69,0 @@ |
export * from './config/exports'; | ||
export * from './middleware/exports'; | ||
export * from './register-api-handler/exports'; | ||
@@ -3,0 +4,0 @@ export * from './register-http-api-handler/exports'; |
@@ -23,2 +23,3 @@ import type { Express, NextFunction, Request, RequestHandler, Response } from 'express'; | ||
import { getUrlPathnameUsingRouteType } from '../internal-utils/get-url-pathname'; | ||
import { resolveYaschemaJsonPrefixedFormDataFields } from '../internal-utils/resolve-yaschema-json-prefixed-form-data-fields'; | ||
import { registerApiHandler } from '../register-api-handler/register-api-handler'; | ||
@@ -81,2 +82,8 @@ import type { HttpApiHandler } from '../types/HttpApiHandler'; | ||
// Form data supports JSON-encoded fields for objects and nested arrays where the JSON fields are prefixed with "yaschema/json:". | ||
if (api.requestType === 'form-data') { | ||
// In-place substitution of prefixed JSON strings with their resolved values | ||
resolveYaschemaJsonPrefixedFormDataFields(req.body); | ||
} | ||
const [reqHeaders, reqParams, reqQuery, reqBody] = await Promise.all([ | ||
@@ -112,3 +119,3 @@ (api.schemas.request.headers ?? anyReqHeadersSchema).deserializeAsync(req.headers, { validation: requestValidationMode }), | ||
if (!checkedRequestValidation.ok) { | ||
return res.status(StatusCodes.BAD_REQUEST).send('Request header validation error'); | ||
return res.status(StatusCodes.BAD_REQUEST).send(`Request ${checkedRequestValidation.invalidPart} validation error`); | ||
} | ||
@@ -115,0 +122,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
142779
145
1968
31
6
Updatedyaschema@^2.1.0
Updatedyaschema-api@^2.1.0