# VkrunJS Releases

## 3.5.0

### 🚀 New Features

- **feat(parse-data): add route-level override and advanced body parsing options**  
  `parseData()` can now be used globally (`app.use(parseData())`) or per route (`router.post("/x", parseData(...))`), allowing fine-grained control over request parsing.

- Added `body.inflate` option for automatic decompression of gzip, deflate, and br-encoded request bodies.
- Added `body.type` filter to restrict parsing to specific MIME types (string or RegExp).
- Added `body.raw` option to store the unparsed request body (`Buffer`) in `req.rawBody`, useful for signature verification (e.g., HMAC webhooks).
- Added `body.limit` to enforce a maximum request body size (default **10 MB**).
- Added `security.verify` callback to perform custom request verification before parsing (ideal for webhook authentication).
- Added unified MIME-type matching via the new `matchMimeType` helper function.

### 🛡 Security Enhancements

- Improved `security.escapeSQL` to consistently sanitize data across:

  - Query strings
  - Route parameters
  - JSON body
  - URL-encoded and multipart form data

- Protection against common SQL injection patterns:
  - Tautology (`' OR '1'='1`)
  - `UNION SELECT`
  - Comment-based and stacked queries
  - Time-based injections (`SLEEP`, `WAITFOR DELAY`)

### ⚙️ Improvements

- `parseData` is now fully compatible with Express body-parser behavior, supporting:

  - JSON (`application/json`)
  - URL-encoded (`application/x-www-form-urlencoded`)
  - Multipart form-data (`multipart/form-data`)
  - Raw (`application/octet-stream`) and text (`text/*`)

- Standardized error responses:

  - `400 Invalid Request Data`
  - `400 Invalid Compressed Data`
  - `415 Unsupported Content-Encoding`
  - `413 Payload Too Large`

- Internal refactor for async-safe stream reading and memory usage.
- Partial parsing support when type does not match (only params and query are processed).
- Enhanced error handling for invalid compression and oversized payloads.

### 🧪 Tests

- Expanded end-to-end test coverage for:

  - Global and route-level parsing
  - Compression (gzip, deflate, br)
  - Raw body capture (`rawBody`)
  - Payload limit enforcement
  - MIME type filtering
  - SQL injection sanitization and malformed payloads

- Achieved **100% test coverage** for all parsing modes and error scenarios in the `parse-data` module.

## 3.4.1

- fix(schema): prevent duplicate validation errors for UUID fields with `notRequired` and `nullable`.
- feat(swagger): add support for `nullable`, `readOnly`, `writeOnly`, `deprecated`, `xml`, and `discriminator` in base schema for improved OpenAPI compatibility.

## 3.4.0

- Ensure that applying methods like nullable(), notRequired(), or parseTo() on a schema
  creates a new derived schema without modifying the original base schema.
- Added comprehensive tests for string, number, bigInt, buffer, date, array, and object schemas.
- Improves reliability when reusing schemas for multiple conversions or transformations.

## 3.3.3

- Ensure `ExecutionContext` is instantiated fresh for each validation run
- Keep schema methods immutable as the shared build contract
- Prevent session data from leaking across concurrent validations
- Prepare `default` value handling to be managed entirely within schema methods

## 3.3.2

- feat rate-limit add custom onError handler for exceeded requests  
  Allows developers to define a custom function to handle requests that exceed
  the rate limit, instead of using the default 429 response.
- Remove duplicate route checks during route creation in RouterSetup.
- Centralize validation in AppSetup when handling requests (\_reqWithoutServer or server).
- Ensures all routes, whether added via routers or directly on app, are validated consistently.
- Simplifies tests and avoids false positives on route duplication.

## 3.3.1

- fix logger handle Error and subclasses in safeSerialize  
  Ensure that Error objects (including custom subclasses) are serialized
  with message, name, stack, and custom properties preserved. This
  prevents loss of error details in logger output.

## 3.3.0

- fix improve SQL escaping to prevent injection attacks

## 3.2.0

- fix header value converted to lowercase
- fix load-env correctly parse quoted values containing equals sign in .env files
- changed domain vkrunjs.com to vkrunjs.org in all documentation

## 3.1.1

- fix log in dd-mm-yyyy date format

## 3.1.0

- add dynamic typing to request headers and session
- remove unused loggerSanitizeInterval variable
- fix bug in logger module that is creating logs folder even when it will not generate the log in the physical file
- replaced the manual serialization logic in the logger module with safeSerialize to better support complex structures like Error, Buffer, functions, symbols, and circular references. This improves log safety and reduces custom parsing code
- add decodeURIComponent to the url before injecting into routerHandler.handleRequest and superReuqest should do encodeURIComponent to simulate behavior of requests that apply encodeURIComponent to the url
- add missing head method in swagger.route

## 3.0.7

- refactor logger remove MAX_OUTPUT_LENGTH
- refactor rate limit isolate instance data using instanceId and cleanup global timers
- fix swagger ui types

## 3.0.5

- fix enable and disable printing in the console log of the logger module

## 3.0.4

- fix router response in status method not chaining other methods

## 3.0.3

- fix missing lib folder

## 3.0.2

- fix response type

## 3.0.1

- fix custom method not executed with any method in schema module
- fix error when building projects using InferIn and InferOut typing

## 3.0.0

- add jsDoc to all methods of the schema module
- add oneOf method to validate multiple schemas
- add parseTo method to schema module
- add custom method to schema module
- add infer type to schema module
- add validate route data module
- refactor with new eslint configuration
- refactor util isEqual to check more data types
- separate node dependencies into an isolated module
- fix logger not generating physical log when daysToStoreLogs is equal to 0
- create options routes for cors when starting the server
- return error with error handler using asynchronous handlers

## 2.1.1

- export only utils that are not from the exclusive usage context of vkrun

## 2.1.0

- add html response and redirect to route module
- add html utility to render html template string with html color palette

## 2.0.0

- add constomizable messages to schema methods
- migrate setLocation to Location module so that other modules can share the context of custom informational messages
- loadEnv must return the parsed env itself
- add sysLog to Logger module and remove Logger middleware
- change swagger builder to work only serving swagger ui files
- streaming with response pipe in superRequest module

## 1.9.5

- add custom error message to string method of schema module
- add loadEnv module
- fix saveFileToDisk returning fieldName instead of originalName
- add custom error message to UUID method of schema module

## 1.9.1

- remove config removeComments

## 1.9.0

- change rateLimit sanitation method for superRequest and production with createServer
- add jsDoc to App module
- add jsDoc to CORS module
- add jsDoc to Router module
- add jsDoc to JWT module
- add jsDoc to Logger module
- add jsDoc to Mime module
- add jsDoc to ParseData module
- add jsDoc to RateLimit module
- add jsDoc to serveStaticFile module
- add jsDoc to superRequest module
- add jsDoc to upload module
- add jsDoc to swaggerBuilder module
- add jsDoc to schema module

## 1.8.0

- separate min array and max array validations from validate-array file
- add isEmail util
- add isBuffer util
- add isFunction util
- add regex validation method to schema module
- add buffer validation method to schema module
- add function validation method to schema module

## 1.7.1

- migrating documents to the official website and removing export default vkrun

## 1.7.0

- change build from commonjs to ESNext

## 1.6.0

- oneOf and notOneOf methods of schema module must accept schemas as comparison
- add compileRegex util
- add to schema module validation of min, max, oneOf and notOneOf for arrays
- migrate schema documentation to official website
- change the default export of vkrun to the App module

## 1.5.0

- remove the use of customResponse from the app server, leaving it only for use by superRequest
- route matching refactoring

## 1.4.0

- add to the upload module greater flexibility in managing files in memory, validations and custom returns by error type
- remove all tests with axios
- parse form data return file size

## 1.3.0

- replace wildcard imports with explicit imports for modularization and change type names to avoid duplication between modules
- add singleFile and multipleFiles methods to the upload module with configuration options
- add to parseData return fieldName when content type is form data
- fix translation of sentences from Portuguese to English in the readme of the sample projects
- add benchmark example

## 1.2.0

- fix superRequest does not work with async handlers
- adjust setHeader to return vkrun custom response and all additional vkrun methods should return this

## 1.1.0

- swagger builder should accept default path change api-docs
- change the way to inject error handling into the app
- change variable name and export httpStatus
- ensure that all methods in the schema module replace valueName and value in the error message

## 1.0.0

- official release

## 0.45.2

- updating incomplete package

## 0.45.0

- add mime function to return mime type from file extension
- add Mime documentation
- add sample projects to Mime with javascript and typescript
- super request return buffer string
- add serve static file middleware to serve files from a path
- add serve static file documentation
- add sample projects to serve static file with javascript and typescript

## 0.44.0

- add support for wildcard routes
- add SwaggerBuilder to dynamically work with Swagger OpenAPI documentation with flexible route visibility and multi-server support
- add SwaggerBuilder documentation
- add sample projects to SwaggerBuilder with javascript and typescript

## 0.43.0

- fix ensure isNumber returns false for NaN values
- add support BigInt parsing for large integers
- add util isBigInt
- add bigInt method to schema with sub methods min, max, positive and negative

## 0.42.4

- add sample projects to cors with javascript and typescript
- add sample projects to jwt with javascript and typescript
- add sample projects to logger with javascript and typescript
- add sample projects to validate route data with javascript and typescript
- add sample projects to rate limit with javascript and typescript
- add sample projects to schema with javascript and typescript
- add sample projects to super request with javascript and typescript

## 0.42.3

- link example projects to readme

## 0.42.2

- add sample projects to parse data with javascript and typescript
- fix when not post, put and patch protocol return empty body object
- fix parameter followed by query is not parsed

## 0.42.1

- update to generate release 0.42.0

## 0.42.0

- parse data convert files in memory when content-type is multipart/form-data
- add the parseData module as a method in app
- add upload middleware to save files
- add upload documentation
- add super request documentation
- super request accepts FormData without declaring the content-type
- add cors documentation
- add parse data documentation
- add rate limit documentation
- add validate route data documentation

## 0.41.1

- previous package did not include all new features

## 0.41.0

- add documentation for the methods min, max, positive, negative, notEqual, oneOf, and notOneOf of the schema module
- add test for submethods min, max, positive and positive from the number method to the array method
- add notEqual, ofOne and notOneOf methods to the schema module
- add utils regexMatch, isNotEqual, ofOne and notOneOf

## 0.40.0

- add validate negative number
- add validate positive number
- add validate min number
- add validate max number
- add validate nullable
- fix user session crashing when there is an attempt to use access credentials on another machine
- fix log file name format in Logger module is invalid on Windows

## 0.39.2

- fix user session crashing when there is an attempt to use access credentials on another machine

## 0.39.1

- remove console log

## 0.39.0

- add default attributes to session instance

## 0.38.4

- session remove cookies only in correct scenarios

## 0.38.3

- remove console log

## 0.38.2

- remove console logs

## 0.38.1

- remove default parameters from setCookie method

## 0.38.0

- session instance receiving cookie attributes

## 0.37.0

- add signOut method to session module
- add clearCookie method to response

## 0.36.0

- adjust the router to work with multiple router instances and create a route directly in the app

## 0.35.0

- change create session from middleware to function
- fix export types jwt module
- create mapping from http status code

## 0.34.3

### Minor Changes

- change Vkrun link in module documentation.

## 0.34.2

### Minor Changes

- fix build package from latest version v0.34.0 and v0.34.1.

## 0.34.1

### Minor Changes

- add Logger module documentation link to Vkrun Readme.

## 0.34.0

### Minor Changes

- add documentation for Logger module.
- change createLogger function name to Logger.
- add support for creating error log directly with the error in the Logger module.
- fix summary links.

## 0.29.0

### Minor Changes

- change export of modules.

## 0.28.0

### Minor Changes

- c5efc38: add documentation for router module

## 0.27.0

### Minor Changes

- 5b22289: update readme for framework
  add LICENSE
  add contributing document
  add installation guide document
  add security document
  add code of conduct document
  add hello world code example for javascript and typescript

## 0.26.0

### Minor Changes

- a2f48eb: change function name

## 0.25.0

### Minor Changes

- 70ab3f3: fix export app

## 0.24.0

### Minor Changes

- 1a011a8: export default app

## 0.23.0

### Minor Changes

- 563888a: router when running the middleware is not skipping the error handler

## 0.22.1

### Patch Changes

- f60b366: transform lib into framework

## 0.22.0

### Minor Changes

- 33e5e70: refactor logger

## 0.21.0

### Minor Changes

- c0a85ab: change path in config logger

## 0.20.0

### Minor Changes

- a8688a7: create logger module to create log files

## 0.19.0

### Minor Changes

- d2e949f: create module for schema

## 0.18.0

### Minor Changes

- ab67446: change filename

## 0.17.0

### Minor Changes

- bf7728c: refactor setLocation

## 0.16.1

### Patch Changes

- dc3564d: docs: update README

## 0.16.0

### Minor Changes

- 5cded14: validate return a test

## 0.15.0

### Minor Changes

- 5e548fc: refactor location modules"
- ae8123a: refactor setTranslationMessage function and create tests to achieve 100% test coverage
- e2ffee8: refactor setTranslationMessage and leave it with 100% test coverage

## 0.14.0

### Minor Changes

- f3f2954: automating deployment
