@podium/utils
Advanced tools
Comparing version 5.0.5 to 5.0.6
@@ -0,1 +1,8 @@ | ||
## [5.0.6](https://github.com/podium-lib/utils/compare/v5.0.5...v5.0.6) (2024-05-13) | ||
### Bug Fixes | ||
* add back generics to httpincoming ([#237](https://github.com/podium-lib/utils/issues/237)) ([4c70da7](https://github.com/podium-lib/utils/commit/4c70da7699e05321005575105ea3d99673b9a07d)) | ||
## [5.0.5](https://github.com/podium-lib/utils/compare/v5.0.4...v5.0.5) (2024-05-07) | ||
@@ -2,0 +9,0 @@ |
@@ -13,2 +13,3 @@ import { URL } from 'node:url'; | ||
/** | ||
* @template {Record<string, unknown>} [T=Record<string, unknown>] | ||
* @typedef {object} PodiumHttpIncoming | ||
@@ -21,3 +22,3 @@ * @property {string} name | ||
* @property {Array<import('./asset-js.js').JavaScriptAsset | string>} js | ||
* @property {object} [params] | ||
* @property {T} [params] | ||
* @property {boolean} [development] | ||
@@ -27,2 +28,3 @@ * @property {boolean} [proxy] | ||
/** @template {Record<string, unknown>} [T=Record<string, unknown>] */ | ||
export default class HttpIncoming { | ||
@@ -54,5 +56,6 @@ #development; | ||
/** | ||
* @constructor | ||
* @param {object} [request={}] The incoming HTTP request | ||
* @param {object} [response={}] The HTTP response | ||
* @param {object} [params={}] Parameters such as locale. Typically res.locals. | ||
* @param {T} [params={}] Parameters such as locale. Typically res.locals. | ||
* | ||
@@ -64,2 +67,3 @@ * @example | ||
*/ | ||
// @ts-expect-error Not happy about the generics, but this is safe | ||
constructor(request = {}, response = {}, params = {}) { | ||
@@ -151,2 +155,5 @@ this.#development = false; | ||
/** | ||
* @returns {T} | ||
*/ | ||
get params() { | ||
@@ -210,3 +217,3 @@ return this.#params; | ||
/** | ||
* @returns {PodiumHttpIncoming} | ||
* @returns {PodiumHttpIncoming<T>} | ||
*/ | ||
@@ -213,0 +220,0 @@ toJSON() { |
{ | ||
"name": "@podium/utils", | ||
"version": "5.0.5", | ||
"version": "5.0.6", | ||
"description": "Common generic utility methods shared by @podium modules.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
/// <reference types="node" resolution-mode="require"/> | ||
/** | ||
* @template {Record<string, unknown>} [T=Record<string, unknown>] | ||
* @typedef {object} PodiumHttpIncoming | ||
@@ -10,11 +11,13 @@ * @property {string} name | ||
* @property {Array<import('./asset-js.js').JavaScriptAsset | string>} js | ||
* @property {object} [params] | ||
* @property {T} [params] | ||
* @property {boolean} [development] | ||
* @property {boolean} [proxy] | ||
*/ | ||
export default class HttpIncoming { | ||
/** @template {Record<string, unknown>} [T=Record<string, unknown>] */ | ||
export default class HttpIncoming<T extends Record<string, unknown> = Record<string, unknown>> { | ||
/** | ||
* @constructor | ||
* @param {object} [request={}] The incoming HTTP request | ||
* @param {object} [response={}] The HTTP response | ||
* @param {object} [params={}] Parameters such as locale. Typically res.locals. | ||
* @param {T} [params={}] Parameters such as locale. Typically res.locals. | ||
* | ||
@@ -26,3 +29,3 @@ * @example | ||
*/ | ||
constructor(request?: object, response?: object, params?: object); | ||
constructor(request?: object, response?: object, params?: T); | ||
set development(value: boolean); | ||
@@ -48,4 +51,7 @@ get development(): boolean; | ||
get podlets(): unknown; | ||
set params(value: any); | ||
get params(): any; | ||
set params(value: T); | ||
/** | ||
* @returns {T} | ||
*/ | ||
get params(): T; | ||
set proxy(value: boolean); | ||
@@ -64,5 +70,5 @@ get proxy(): boolean; | ||
/** | ||
* @returns {PodiumHttpIncoming} | ||
* @returns {PodiumHttpIncoming<T>} | ||
*/ | ||
toJSON(): PodiumHttpIncoming; | ||
toJSON(): PodiumHttpIncoming<T>; | ||
[inspect](): { | ||
@@ -73,3 +79,3 @@ development: boolean; | ||
context: {}; | ||
params: any; | ||
params: T; | ||
proxy: boolean; | ||
@@ -85,3 +91,3 @@ name: string; | ||
} | ||
export type PodiumHttpIncoming = { | ||
export type PodiumHttpIncoming<T extends Record<string, unknown> = Record<string, unknown>> = { | ||
name: string; | ||
@@ -93,3 +99,3 @@ context: object; | ||
js: Array<import('./asset-js.js').JavaScriptAsset | string>; | ||
params?: object; | ||
params?: T; | ||
development?: boolean; | ||
@@ -96,0 +102,0 @@ proxy?: boolean; |
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
87429
1475