@dwtechs/antity 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/antity.d.ts +1 -0
- package/dist/antity.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -190,6 +190,14 @@ class Entity {
|
|
|
190
190
|
* @returns {Property | undefined} - The property object if found, otherwise `undefined`.
|
|
191
191
|
*/
|
|
192
192
|
getProp(key: string): Property | undefined;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Retrieves a list of properties associated with a specific method.
|
|
196
|
+
*
|
|
197
|
+
* @param {Method} method - The method to filter properties by.
|
|
198
|
+
* @returns {Property[]} An array of properties that are associated with the specified method.
|
|
199
|
+
*/
|
|
200
|
+
getPropsByMethod(method: Method): Property[];
|
|
193
201
|
|
|
194
202
|
/**
|
|
195
203
|
* Normalizes an array of records by applying sanitization and normalization
|
package/dist/antity.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ declare class Entity {
|
|
|
66
66
|
get properties(): Property[];
|
|
67
67
|
set name(name: string);
|
|
68
68
|
getProp(key: string): Property | undefined;
|
|
69
|
+
getPropsByMethod(method: Method): Property[];
|
|
69
70
|
normalize(req: Request, _res: Response, next: NextFunction): void;
|
|
70
71
|
validate(req: Request, _res: Response, next: NextFunction): void;
|
|
71
72
|
}
|
package/dist/antity.js
CHANGED
|
@@ -176,6 +176,14 @@ class Entity {
|
|
|
176
176
|
getProp(key) {
|
|
177
177
|
return this.properties.find(p => p.key === key);
|
|
178
178
|
}
|
|
179
|
+
getPropsByMethod(method) {
|
|
180
|
+
const props = [];
|
|
181
|
+
for (const p of this.properties) {
|
|
182
|
+
if (isIn(p.methods, method, 0))
|
|
183
|
+
props.push(p);
|
|
184
|
+
}
|
|
185
|
+
return props;
|
|
186
|
+
}
|
|
179
187
|
normalize(req, _res, next) {
|
|
180
188
|
var _a;
|
|
181
189
|
const rows = (_a = req.body) === null || _a === void 0 ? void 0 : _a.rows;
|