rjweb-server
Advanced tools
Comparing version 9.2.6 to 9.2.7
# Changelog | ||
## 9.2.7 | ||
- Fix OpenAPI Merging issues | ||
## 9.2.6 | ||
@@ -4,0 +8,0 @@ |
@@ -12,2 +12,3 @@ "use strict"; | ||
const Path_1 = __importDefault(require("./Path")); | ||
const deepClone_1 = __importDefault(require("../../functions/deepClone")); | ||
class File { | ||
@@ -22,4 +23,5 @@ computePath(path) { | ||
* @since 9.0.0 | ||
*/ constructor(prefix, global, validators = [], ratelimits, promises, openApi) { | ||
*/ constructor(prefix, global, validators = [], ratelimits, promises) { | ||
this.validators = validators; | ||
this.openApi = {}; | ||
this.prefix = prefix; | ||
@@ -36,3 +38,2 @@ this._global = global; | ||
this.promises = promises ?? []; | ||
this.openApi = openApi ?? {}; | ||
} | ||
@@ -152,3 +153,3 @@ /** | ||
route.urlData.prefix = this.computePath(path.concat(route.urlData.prefix)); | ||
route.openApi = utils_1.object.deepMerge(this.openApi, route.openApi); | ||
route.openApi = (0, deepClone_1.default)(utils_1.object.deepMerge((0, deepClone_1.default)(this.openApi), route.openApi)); | ||
modifiedRoutesHttp.push(route); | ||
@@ -160,3 +161,3 @@ } | ||
newRoute.ratelimit = Object.assign(this._httpRatelimit, route.ratelimit); | ||
newRoute.openApi = utils_1.object.deepMerge(this.openApi, route.openApi); | ||
newRoute.openApi = (0, deepClone_1.default)(utils_1.object.deepMerge((0, deepClone_1.default)(this.openApi), route.openApi)); | ||
modifiedRoutesHttp.push(newRoute); | ||
@@ -174,3 +175,3 @@ } | ||
route.urlData.prefix = this.computePath(path.concat(route.urlData.prefix)); | ||
route.openApi = utils_1.object.deepMerge(this.openApi, route.openApi); | ||
route.openApi = (0, deepClone_1.default)(utils_1.object.deepMerge((0, deepClone_1.default)(this.openApi), route.openApi)); | ||
modifiedRoutesWS.push(route); | ||
@@ -182,3 +183,3 @@ } | ||
newRoute.ratelimit = Object.assign(this._wsRatelimit, route.ratelimit); | ||
newRoute.openApi = utils_1.object.deepMerge(this.openApi, route.openApi); | ||
newRoute.openApi = (0, deepClone_1.default)(utils_1.object.deepMerge((0, deepClone_1.default)(this.openApi), route.openApi)); | ||
modifiedRoutesWS.push(newRoute); | ||
@@ -196,3 +197,2 @@ } | ||
route.urlData.prefix = this.computePath(path.concat(route.urlData.prefix)); | ||
route.openApi = utils_1.object.deepMerge(this.openApi, route.openApi); | ||
modifiedRoutesStatic.push(route); | ||
@@ -204,3 +204,2 @@ } | ||
newRoute.ratelimit = route.ratelimit; | ||
newRoute.openApi = utils_1.object.deepMerge(this.openApi, route.openApi); | ||
modifiedRoutesStatic.push(newRoute); | ||
@@ -207,0 +206,0 @@ } |
@@ -13,2 +13,3 @@ "use strict"; | ||
const Ws_1 = __importDefault(require("./Ws")); | ||
const deepClone_1 = __importDefault(require("../../functions/deepClone")); | ||
class Path { | ||
@@ -145,3 +146,3 @@ computePath(path) { | ||
*/ path(prefix, callback) { | ||
const path = new Path(this.prefix.concat('/', prefix), this._global, [...this.validators], [this._httpRatelimit, this._wsRatelimit], this.promises, this.openApi); | ||
const path = new Path(this.prefix.concat('/', prefix), this._global, [...this.validators], [this._httpRatelimit, this._wsRatelimit], this.promises, (0, deepClone_1.default)(this.openApi)); | ||
callback(path); | ||
@@ -233,3 +234,3 @@ this.routesHttp.push(...path.routesHttp); | ||
const http = new Http_1.default(method, this.computePath(p), this._httpRatelimit); | ||
http['route'].openApi = Object.assign({}, this.openApi); | ||
http['route'].openApi = (0, deepClone_1.default)(this.openApi); | ||
callback(http); | ||
@@ -262,3 +263,3 @@ const url = http['route'].urlData; | ||
const ws = new Ws_1.default(this.computePath(p), this._wsRatelimit); | ||
ws['route'].openApi = Object.assign({}, this.openApi); | ||
ws['route'].openApi = (0, deepClone_1.default)(this.openApi); | ||
callback(ws); | ||
@@ -265,0 +266,0 @@ const url = ws['route'].urlData; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const utils_1 = require("@rjweb/utils"); | ||
const deepClone_1 = __importDefault(require("../functions/deepClone")); | ||
class Validator { | ||
@@ -94,3 +98,3 @@ /** | ||
this.listeners.wsClose = new Set([...validator.listeners.wsClose.values(), ...this.listeners.wsClose.values()]); | ||
this.openApi = utils_1.object.deepMerge(this.openApi, validator.openApi); | ||
this.openApi = (0, deepClone_1.default)(utils_1.object.deepMerge(this.openApi, validator.openApi)); | ||
const openApiFn = this.openApiFn; | ||
@@ -97,0 +101,0 @@ if (validator.openApiFn) |
{ | ||
"name": "rjweb-server", | ||
"version": "9.2.6", | ||
"version": "9.2.7", | ||
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js", |
@@ -7,2 +7,3 @@ import Route from "../Route"; | ||
import Path from "./Path"; | ||
import deepClone from "../../functions/deepClone"; | ||
export default class File { | ||
@@ -17,4 +18,5 @@ computePath(path) { | ||
* @since 9.0.0 | ||
*/ constructor(prefix, global, validators = [], ratelimits, promises, openApi) { | ||
*/ constructor(prefix, global, validators = [], ratelimits, promises) { | ||
this.validators = validators; | ||
this.openApi = {}; | ||
this.prefix = prefix; | ||
@@ -31,3 +33,2 @@ this._global = global; | ||
this.promises = promises ?? []; | ||
this.openApi = openApi ?? {}; | ||
} | ||
@@ -147,3 +148,3 @@ /** | ||
route.urlData.prefix = this.computePath(path.concat(route.urlData.prefix)); | ||
route.openApi = object.deepMerge(this.openApi, route.openApi); | ||
route.openApi = deepClone(object.deepMerge(deepClone(this.openApi), route.openApi)); | ||
modifiedRoutesHttp.push(route); | ||
@@ -155,3 +156,3 @@ } | ||
newRoute.ratelimit = Object.assign(this._httpRatelimit, route.ratelimit); | ||
newRoute.openApi = object.deepMerge(this.openApi, route.openApi); | ||
newRoute.openApi = deepClone(object.deepMerge(deepClone(this.openApi), route.openApi)); | ||
modifiedRoutesHttp.push(newRoute); | ||
@@ -169,3 +170,3 @@ } | ||
route.urlData.prefix = this.computePath(path.concat(route.urlData.prefix)); | ||
route.openApi = object.deepMerge(this.openApi, route.openApi); | ||
route.openApi = deepClone(object.deepMerge(deepClone(this.openApi), route.openApi)); | ||
modifiedRoutesWS.push(route); | ||
@@ -177,3 +178,3 @@ } | ||
newRoute.ratelimit = Object.assign(this._wsRatelimit, route.ratelimit); | ||
newRoute.openApi = object.deepMerge(this.openApi, route.openApi); | ||
newRoute.openApi = deepClone(object.deepMerge(deepClone(this.openApi), route.openApi)); | ||
modifiedRoutesWS.push(newRoute); | ||
@@ -191,3 +192,2 @@ } | ||
route.urlData.prefix = this.computePath(path.concat(route.urlData.prefix)); | ||
route.openApi = object.deepMerge(this.openApi, route.openApi); | ||
modifiedRoutesStatic.push(route); | ||
@@ -199,3 +199,2 @@ } | ||
newRoute.ratelimit = route.ratelimit; | ||
newRoute.openApi = object.deepMerge(this.openApi, route.openApi); | ||
modifiedRoutesStatic.push(newRoute); | ||
@@ -202,0 +201,0 @@ } |
@@ -8,2 +8,3 @@ import Route from "../Route"; | ||
import Ws from "./Ws"; | ||
import deepClone from "../../functions/deepClone"; | ||
export default class Path { | ||
@@ -140,3 +141,3 @@ computePath(path) { | ||
*/ path(prefix, callback) { | ||
const path = new Path(this.prefix.concat('/', prefix), this._global, [...this.validators], [this._httpRatelimit, this._wsRatelimit], this.promises, this.openApi); | ||
const path = new Path(this.prefix.concat('/', prefix), this._global, [...this.validators], [this._httpRatelimit, this._wsRatelimit], this.promises, deepClone(this.openApi)); | ||
callback(path); | ||
@@ -228,3 +229,3 @@ this.routesHttp.push(...path.routesHttp); | ||
const http = new Http(method, this.computePath(p), this._httpRatelimit); | ||
http['route'].openApi = Object.assign({}, this.openApi); | ||
http['route'].openApi = deepClone(this.openApi); | ||
callback(http); | ||
@@ -257,3 +258,3 @@ const url = http['route'].urlData; | ||
const ws = new Ws(this.computePath(p), this._wsRatelimit); | ||
ws['route'].openApi = Object.assign({}, this.openApi); | ||
ws['route'].openApi = deepClone(this.openApi); | ||
callback(ws); | ||
@@ -260,0 +261,0 @@ const url = ws['route'].urlData; |
import { object } from "@rjweb/utils"; | ||
import deepClone from "../functions/deepClone"; | ||
export default class Validator { | ||
@@ -92,3 +93,3 @@ /** | ||
this.listeners.wsClose = new Set([...validator.listeners.wsClose.values(), ...this.listeners.wsClose.values()]); | ||
this.openApi = object.deepMerge(this.openApi, validator.openApi); | ||
this.openApi = deepClone(object.deepMerge(this.openApi, validator.openApi)); | ||
const openApiFn = this.openApiFn; | ||
@@ -95,0 +96,0 @@ if (validator.openApiFn) |
{ | ||
"name": "rjweb-server", | ||
"version": "9.2.6", | ||
"version": "9.2.7", | ||
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js", |
@@ -20,3 +20,3 @@ import { UsableMiddleware } from "../Middleware"; | ||
* @since 9.0.0 | ||
*/ constructor(prefix: string, global: GlobalContext, validators?: Validators, ratelimits?: [RateLimitConfig, RateLimitConfig], promises?: Promise<any>[], openApi?: OperationObject); | ||
*/ constructor(prefix: string, global: GlobalContext, validators?: Validators, ratelimits?: [RateLimitConfig, RateLimitConfig], promises?: Promise<any>[]); | ||
/** | ||
@@ -23,0 +23,0 @@ * Add OpenAPI Documentation to all HTTP Endpoints in this Path (and all children) |
{ | ||
"name": "rjweb-server", | ||
"version": "9.2.6", | ||
"version": "9.2.7", | ||
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js", |
556345
174
13507