@dudousxd/nestjs-filter 1.0.1
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/CHANGELOG.md +37 -0
- package/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/adapter/adapter.d.ts +158 -0
- package/dist/adapter/adapter.d.ts.map +1 -0
- package/dist/adapter/adapter.js +2 -0
- package/dist/adapter/adapter.js.map +1 -0
- package/dist/als-store.d.ts +15 -0
- package/dist/als-store.d.ts.map +1 -0
- package/dist/als-store.js +6 -0
- package/dist/als-store.js.map +1 -0
- package/dist/base-filter.d.ts +46 -0
- package/dist/base-filter.d.ts.map +1 -0
- package/dist/base-filter.js +95 -0
- package/dist/base-filter.js.map +1 -0
- package/dist/cli/generate.d.ts +3 -0
- package/dist/cli/generate.d.ts.map +1 -0
- package/dist/cli/generate.js +43 -0
- package/dist/cli/generate.js.map +1 -0
- package/dist/decorator/apply-filter.decorator.d.ts +11 -0
- package/dist/decorator/apply-filter.decorator.d.ts.map +1 -0
- package/dist/decorator/apply-filter.decorator.js +22 -0
- package/dist/decorator/apply-filter.decorator.js.map +1 -0
- package/dist/decorator/filter-for.decorator.d.ts +4 -0
- package/dist/decorator/filter-for.decorator.d.ts.map +1 -0
- package/dist/decorator/filter-for.decorator.js +29 -0
- package/dist/decorator/filter-for.decorator.js.map +1 -0
- package/dist/decorator/filterable.decorator.d.ts +5 -0
- package/dist/decorator/filterable.decorator.d.ts.map +1 -0
- package/dist/decorator/filterable.decorator.js +24 -0
- package/dist/decorator/filterable.decorator.js.map +1 -0
- package/dist/decorator/relations.decorator.d.ts +29 -0
- package/dist/decorator/relations.decorator.d.ts.map +1 -0
- package/dist/decorator/relations.decorator.js +40 -0
- package/dist/decorator/relations.decorator.js.map +1 -0
- package/dist/errors/exceptions.d.ts +32 -0
- package/dist/errors/exceptions.d.ts.map +1 -0
- package/dist/errors/exceptions.js +56 -0
- package/dist/errors/exceptions.js.map +1 -0
- package/dist/filter/filter-exception.filter.d.ts +6 -0
- package/dist/filter/filter-exception.filter.d.ts.map +1 -0
- package/dist/filter/filter-exception.filter.js +32 -0
- package/dist/filter/filter-exception.filter.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/input/dispatcher.d.ts +2 -0
- package/dist/input/dispatcher.d.ts.map +1 -0
- package/dist/input/dispatcher.js +25 -0
- package/dist/input/dispatcher.js.map +1 -0
- package/dist/input/normalizer.d.ts +9 -0
- package/dist/input/normalizer.d.ts.map +1 -0
- package/dist/input/normalizer.js +51 -0
- package/dist/input/normalizer.js.map +1 -0
- package/dist/input/source-resolver.d.ts +3 -0
- package/dist/input/source-resolver.d.ts.map +1 -0
- package/dist/input/source-resolver.js +49 -0
- package/dist/input/source-resolver.js.map +1 -0
- package/dist/input/validator.d.ts +3 -0
- package/dist/input/validator.d.ts.map +1 -0
- package/dist/input/validator.js +33 -0
- package/dist/input/validator.js.map +1 -0
- package/dist/interceptor/apply-filter.interceptor.d.ts +10 -0
- package/dist/interceptor/apply-filter.interceptor.d.ts.map +1 -0
- package/dist/interceptor/apply-filter.interceptor.js +81 -0
- package/dist/interceptor/apply-filter.interceptor.js.map +1 -0
- package/dist/module.d.ts +15 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +111 -0
- package/dist/module.js.map +1 -0
- package/dist/operators/column-filter.dto.d.ts +22 -0
- package/dist/operators/column-filter.dto.d.ts.map +1 -0
- package/dist/operators/column-filter.dto.js +61 -0
- package/dist/operators/column-filter.dto.js.map +1 -0
- package/dist/operators/index.d.ts +5 -0
- package/dist/operators/index.d.ts.map +1 -0
- package/dist/operators/index.js +4 -0
- package/dist/operators/index.js.map +1 -0
- package/dist/operators/types.d.ts +21 -0
- package/dist/operators/types.d.ts.map +1 -0
- package/dist/operators/types.js +28 -0
- package/dist/operators/types.js.map +1 -0
- package/dist/operators/validate-column-filter.d.ts +24 -0
- package/dist/operators/validate-column-filter.d.ts.map +1 -0
- package/dist/operators/validate-column-filter.js +118 -0
- package/dist/operators/validate-column-filter.js.map +1 -0
- package/dist/runner.d.ts +105 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +554 -0
- package/dist/runner.js.map +1 -0
- package/dist/testing/filter-testing.module.d.ts +7 -0
- package/dist/testing/filter-testing.module.d.ts.map +1 -0
- package/dist/testing/filter-testing.module.js +41 -0
- package/dist/testing/filter-testing.module.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-query-builder.d.ts +6 -0
- package/dist/testing/mock-query-builder.d.ts.map +1 -0
- package/dist/testing/mock-query-builder.js +22 -0
- package/dist/testing/mock-query-builder.js.map +1 -0
- package/dist/tokens.d.ts +8 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +8 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types.d.ts +110 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/escape-like.d.ts +10 -0
- package/dist/utils/escape-like.d.ts.map +1 -0
- package/dist/utils/escape-like.js +15 -0
- package/dist/utils/escape-like.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { FILTER_FOR_METADATA } from '../tokens.js';
|
|
3
|
+
export function FilterFor(inputKey) {
|
|
4
|
+
return (target, propertyKey) => {
|
|
5
|
+
const methodName = String(propertyKey);
|
|
6
|
+
const key = inputKey ?? methodName;
|
|
7
|
+
const ctor = target.constructor;
|
|
8
|
+
const existing = (Reflect.getOwnMetadata(FILTER_FOR_METADATA, ctor) ??
|
|
9
|
+
new Map());
|
|
10
|
+
existing.set(key, methodName);
|
|
11
|
+
Reflect.defineMetadata(FILTER_FOR_METADATA, existing, ctor);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function getFilterForMap(target) {
|
|
15
|
+
const result = new Map();
|
|
16
|
+
let current = target;
|
|
17
|
+
while (current && current !== Function.prototype && current !== Object) {
|
|
18
|
+
const own = Reflect.getOwnMetadata(FILTER_FOR_METADATA, current);
|
|
19
|
+
if (own) {
|
|
20
|
+
for (const [key, method] of own) {
|
|
21
|
+
if (!result.has(key))
|
|
22
|
+
result.set(key, method);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
current = Object.getPrototypeOf(current);
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=filter-for.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-for.decorator.js","sourceRoot":"","sources":["../../src/decorator/filter-for.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,SAAS,CAAC,QAAiB;IACzC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,GAAG,GAAG,QAAQ,IAAI,UAAU,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;QAChC,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,IAAI,CAAC;YACjE,IAAI,GAAG,EAAkB,CAAwB,CAAC;QACpD,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC9B,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,IAAI,OAAO,GAAkB,MAAM,CAAC;IACpC,OAAO,OAAO,IAAI,OAAO,KAAK,QAAQ,CAAC,SAAS,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvE,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAElD,CAAC;QACd,IAAI,GAAG,EAAE,CAAC;YACR,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;gBAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;oBAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;QACD,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { FilterMetadata, FilterableOptions } from '../types.js';
|
|
3
|
+
export declare function Filterable(options: FilterableOptions): ClassDecorator;
|
|
4
|
+
export declare function getFilterableMetadata(target: object): FilterMetadata | undefined;
|
|
5
|
+
//# sourceMappingURL=filterable.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterable.decorator.d.ts","sourceRoot":"","sources":["../../src/decorator/filterable.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErE,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAgBrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEhF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { FilterMissingEntityException } from '../errors/exceptions.js';
|
|
3
|
+
import { FILTERABLE_METADATA } from '../tokens.js';
|
|
4
|
+
export function Filterable(options) {
|
|
5
|
+
return (target) => {
|
|
6
|
+
if (!options || !options.entity) {
|
|
7
|
+
throw new FilterMissingEntityException(target.name || 'AnonymousFilter');
|
|
8
|
+
}
|
|
9
|
+
if (options.allowed && options.blocked) {
|
|
10
|
+
throw new Error(`@Filterable on ${target.name}: specify 'allowed' or 'blocked', not both.`);
|
|
11
|
+
}
|
|
12
|
+
const meta = {
|
|
13
|
+
entity: options.entity,
|
|
14
|
+
...(options.allowed !== undefined && { allowed: options.allowed }),
|
|
15
|
+
...(options.blocked !== undefined && { blocked: options.blocked }),
|
|
16
|
+
autoFields: options.autoFields ?? true,
|
|
17
|
+
};
|
|
18
|
+
Reflect.defineMetadata(FILTERABLE_METADATA, meta, target);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function getFilterableMetadata(target) {
|
|
22
|
+
return Reflect.getMetadata(FILTERABLE_METADATA, target);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=filterable.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterable.decorator.js","sourceRoot":"","sources":["../../src/decorator/filterable.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,MAAM,UAAU,UAAU,CAAC,OAA0B;IACnD,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,IAAI,4BAA4B,CAAC,MAAM,CAAC,IAAI,IAAI,iBAAiB,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,IAAI,6CAA6C,CAAC,CAAC;QAC9F,CAAC;QACD,MAAM,IAAI,GAAmB;YAC3B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;YAClE,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;YAClE,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;SACvC,CAAC;QACF,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,CAA+B,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { Type } from '@nestjs/common';
|
|
3
|
+
export interface RelationConfig {
|
|
4
|
+
filter: Type<unknown>;
|
|
5
|
+
keys: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export type RelationsMap = Record<string, RelationConfig>;
|
|
8
|
+
/**
|
|
9
|
+
* Maps input keys to relation filters.
|
|
10
|
+
* When an input key listed in a relation's `keys` array arrives,
|
|
11
|
+
* the runner delegates it to the relation's filter via
|
|
12
|
+
* adapter.applyRelationConstraint().
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* @Relations({
|
|
17
|
+
* posts: { filter: PostFilter, keys: ['postTitle', 'postStatus'] },
|
|
18
|
+
* })
|
|
19
|
+
* export class UserFilter extends MikroOrmFilter<User> {}
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function Relations(map: RelationsMap): ClassDecorator;
|
|
23
|
+
export declare function getRelationsMap(target: object): RelationsMap | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Resolves which relation (if any) owns a given input key.
|
|
26
|
+
* Returns [relationName, RelationConfig] or undefined.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveRelation(target: object, inputKey: string): [string, RelationConfig] | undefined;
|
|
29
|
+
//# sourceMappingURL=relations.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relations.decorator.d.ts","sourceRoot":"","sources":["../../src/decorator/relations.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,cAAc,CAI3D;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAExE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,SAAS,CAStC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { FILTER_RELATIONS_METADATA } from '../tokens.js';
|
|
3
|
+
/**
|
|
4
|
+
* Maps input keys to relation filters.
|
|
5
|
+
* When an input key listed in a relation's `keys` array arrives,
|
|
6
|
+
* the runner delegates it to the relation's filter via
|
|
7
|
+
* adapter.applyRelationConstraint().
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* @Relations({
|
|
12
|
+
* posts: { filter: PostFilter, keys: ['postTitle', 'postStatus'] },
|
|
13
|
+
* })
|
|
14
|
+
* export class UserFilter extends MikroOrmFilter<User> {}
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function Relations(map) {
|
|
18
|
+
return (target) => {
|
|
19
|
+
Reflect.defineMetadata(FILTER_RELATIONS_METADATA, map, target);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function getRelationsMap(target) {
|
|
23
|
+
return Reflect.getMetadata(FILTER_RELATIONS_METADATA, target);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolves which relation (if any) owns a given input key.
|
|
27
|
+
* Returns [relationName, RelationConfig] or undefined.
|
|
28
|
+
*/
|
|
29
|
+
export function resolveRelation(target, inputKey) {
|
|
30
|
+
const map = getRelationsMap(target);
|
|
31
|
+
if (!map)
|
|
32
|
+
return undefined;
|
|
33
|
+
for (const [relationName, config] of Object.entries(map)) {
|
|
34
|
+
if (config.keys.includes(inputKey)) {
|
|
35
|
+
return [relationName, config];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=relations.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relations.decorator.js","sourceRoot":"","sources":["../../src/decorator/relations.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AASzD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,GAAiB;IACzC,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,OAAO,CAAC,cAAc,CAAC,yBAAyB,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,yBAAyB,EAAE,MAAM,CAA6B,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAc,EACd,QAAgB;IAEhB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,KAAK,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACzD,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare abstract class FilterException extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class FilterNotRegisteredException extends FilterException {
|
|
5
|
+
readonly filterName: string;
|
|
6
|
+
constructor(filterName: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class FilterMissingEntityException extends FilterException {
|
|
9
|
+
readonly filterName: string;
|
|
10
|
+
constructor(filterName: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class FilterStateUnavailableException extends FilterException {
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
export declare class UnknownFilterKeyException extends FilterException {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
constructor(key: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class FilterValidationException extends FilterException {
|
|
20
|
+
readonly errors: unknown[];
|
|
21
|
+
constructor(errors: unknown[]);
|
|
22
|
+
}
|
|
23
|
+
export declare class FilterMissingAdapterException extends FilterException {
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
26
|
+
export declare class FilterMethodException extends FilterException {
|
|
27
|
+
readonly key: string;
|
|
28
|
+
readonly value: unknown;
|
|
29
|
+
readonly cause: unknown;
|
|
30
|
+
constructor(key: string, value: unknown, cause: unknown);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/errors/exceptions.ts"],"names":[],"mappings":"AAAA,8BAAsB,eAAgB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,4BAA6B,SAAQ,eAAe;aACnC,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAG/C;AAED,qBAAa,4BAA6B,SAAQ,eAAe;aACnC,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAG/C;AAED,qBAAa,+BAAgC,SAAQ,eAAe;;CAInE;AAED,qBAAa,yBAA0B,SAAQ,eAAe;aAChC,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM;CAGxC;AAED,qBAAa,yBAA0B,SAAQ,eAAe;aAChC,MAAM,EAAE,OAAO,EAAE;gBAAjB,MAAM,EAAE,OAAO,EAAE;CAG9C;AAED,qBAAa,6BAA8B,SAAQ,eAAe;;CAMjE;AAED,qBAAa,qBAAsB,SAAQ,eAAe;aAEtC,GAAG,EAAE,MAAM;aACX,KAAK,EAAE,OAAO;aACL,KAAK,EAAE,OAAO;gBAFvB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,EACL,KAAK,EAAE,OAAO;CAM1C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export class FilterException extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = new.target.name;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class FilterNotRegisteredException extends FilterException {
|
|
8
|
+
filterName;
|
|
9
|
+
constructor(filterName) {
|
|
10
|
+
super(`Filter ${filterName} not registered. Add it to FilterModule.forFeature([...]).`);
|
|
11
|
+
this.filterName = filterName;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class FilterMissingEntityException extends FilterException {
|
|
15
|
+
filterName;
|
|
16
|
+
constructor(filterName) {
|
|
17
|
+
super(`Filter ${filterName} is missing @Filterable({ entity }).`);
|
|
18
|
+
this.filterName = filterName;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class FilterStateUnavailableException extends FilterException {
|
|
22
|
+
constructor() {
|
|
23
|
+
super('Filter state ($query, $input, $context) is only available inside FilterRunner.apply().');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export class UnknownFilterKeyException extends FilterException {
|
|
27
|
+
key;
|
|
28
|
+
constructor(key) {
|
|
29
|
+
super(`Unknown filter key "${key}". No method or @FilterFor matches.`);
|
|
30
|
+
this.key = key;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export class FilterValidationException extends FilterException {
|
|
34
|
+
errors;
|
|
35
|
+
constructor(errors) {
|
|
36
|
+
super('Filter input validation failed.');
|
|
37
|
+
this.errors = errors;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export class FilterMissingAdapterException extends FilterException {
|
|
41
|
+
constructor() {
|
|
42
|
+
super('No FilterAdapter registered. Import an adapter module (e.g. MikroOrmFilterModule.forRoot()).');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class FilterMethodException extends FilterException {
|
|
46
|
+
key;
|
|
47
|
+
value;
|
|
48
|
+
cause;
|
|
49
|
+
constructor(key, value, cause) {
|
|
50
|
+
super(`Filter method for key "${key}" threw: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
51
|
+
this.key = key;
|
|
52
|
+
this.value = value;
|
|
53
|
+
this.cause = cause;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
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GAAG,YAAY,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAClG,CAAC;QANc,QAAG,GAAH,GAAG,CAAQ;QACX,UAAK,GAAL,KAAK,CAAS;QACL,UAAK,GAAL,KAAK,CAAS;IAKzC,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ArgumentsHost, type ExceptionFilter } from '@nestjs/common';
|
|
2
|
+
import { FilterValidationException } from '../errors/exceptions.js';
|
|
3
|
+
export declare class FilterExceptionFilter implements ExceptionFilter {
|
|
4
|
+
catch(exception: FilterValidationException, host: ArgumentsHost): void;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=filter-exception.filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-exception.filter.d.ts","sourceRoot":"","sources":["../../src/filter/filter-exception.filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAS,KAAK,eAAe,EAAc,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,qBACa,qBAAsB,YAAW,eAAe;IAC3D,KAAK,CAAC,SAAS,EAAE,yBAAyB,EAAE,IAAI,EAAE,aAAa;CAuBhE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Catch, HttpStatus } from '@nestjs/common';
|
|
8
|
+
import { FilterValidationException } from '../errors/exceptions.js';
|
|
9
|
+
let FilterExceptionFilter = class FilterExceptionFilter {
|
|
10
|
+
catch(exception, host) {
|
|
11
|
+
if (host.getType() !== 'http') {
|
|
12
|
+
throw exception; // re-throw for non-HTTP contexts (e.g. WebSocket, RPC)
|
|
13
|
+
}
|
|
14
|
+
const ctx = host.switchToHttp();
|
|
15
|
+
const response = ctx.getResponse();
|
|
16
|
+
const sanitizedErrors = exception.errors.map((err) => ({
|
|
17
|
+
property: err.property,
|
|
18
|
+
constraints: err.constraints,
|
|
19
|
+
...(err.children?.length ? { children: err.children } : {}),
|
|
20
|
+
}));
|
|
21
|
+
response.status(HttpStatus.BAD_REQUEST).json({
|
|
22
|
+
statusCode: HttpStatus.BAD_REQUEST,
|
|
23
|
+
message: 'Filter input validation failed.',
|
|
24
|
+
errors: sanitizedErrors,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
FilterExceptionFilter = __decorate([
|
|
29
|
+
Catch(FilterValidationException)
|
|
30
|
+
], FilterExceptionFilter);
|
|
31
|
+
export { FilterExceptionFilter };
|
|
32
|
+
//# sourceMappingURL=filter-exception.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-exception.filter.js","sourceRoot":"","sources":["../../src/filter/filter-exception.filter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAsB,KAAK,EAAwB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,KAAK,CAAC,SAAoC,EAAE,IAAmB;QAC7D,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;YAC9B,MAAM,SAAS,CAAC,CAAC,uDAAuD;QAC1E,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,eAAe,GACnB,SAAS,CAAC,MAKX,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5D,CAAC,CAAC,CAAC;QACJ,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;YAC3C,UAAU,EAAE,UAAU,CAAC,WAAW;YAClC,OAAO,EAAE,iCAAiC;YAC1C,MAAM,EAAE,eAAe;SACxB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAxBY,qBAAqB;IADjC,KAAK,CAAC,yBAAyB,CAAC;GACpB,qBAAqB,CAwBjC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const VERSION = "0.0.0";
|
|
2
|
+
export { BaseFilter } from './base-filter.js';
|
|
3
|
+
export type { FilterAdapter, EntityFieldInfo, EntityRelationInfo } from './adapter/adapter.js';
|
|
4
|
+
export { Filterable, getFilterableMetadata } from './decorator/filterable.decorator.js';
|
|
5
|
+
export { FilterFor, getFilterForMap } from './decorator/filter-for.decorator.js';
|
|
6
|
+
export { ApplyFilter, getApplyFilterMetadata } from './decorator/apply-filter.decorator.js';
|
|
7
|
+
export { Relations, getRelationsMap, resolveRelation } from './decorator/relations.decorator.js';
|
|
8
|
+
export type { RelationConfig, RelationsMap } from './decorator/relations.decorator.js';
|
|
9
|
+
export { ApplyFilterInterceptor } from './interceptor/apply-filter.interceptor.js';
|
|
10
|
+
export { FilterExceptionFilter } from './filter/filter-exception.filter.js';
|
|
11
|
+
export { FilterRunner } from './runner.js';
|
|
12
|
+
export { FilterModule } from './module.js';
|
|
13
|
+
export { FilterException, FilterNotRegisteredException, FilterMissingEntityException, FilterStateUnavailableException, UnknownFilterKeyException, FilterValidationException, FilterMissingAdapterException, FilterMethodException, } from './errors/exceptions.js';
|
|
14
|
+
export { FILTER_MODULE_OPTIONS, FILTER_ADAPTER, FILTERABLE_METADATA, FILTER_FOR_METADATA, FILTER_RELATIONS_METADATA, APPLY_FILTER_METADATA, APPLY_FILTER_REQ_KEY, } from './tokens.js';
|
|
15
|
+
export type { ApplyFilterOptions, FilterableOptions, FilterContext, FilterInput, FilterInputStrict, FilterInputLoose, FilterMetadata, FilterModuleOptions, FilterModuleOptionsFactory, FilterModuleAsyncOptions, InputNormalizer, InputSource, OnUnknownKey, StructuredInput, ValidationMode, } from './types.js';
|
|
16
|
+
export { resolveInputFromRequest } from './input/source-resolver.js';
|
|
17
|
+
export { normalizeInput } from './input/normalizer.js';
|
|
18
|
+
export { escapeLike } from './utils/escape-like.js';
|
|
19
|
+
export type { ColumnFilter, FilterOperator } from './operators/types.js';
|
|
20
|
+
export { FILTER_OPERATORS } from './operators/types.js';
|
|
21
|
+
export { ColumnFilterDto } from './operators/column-filter.dto.js';
|
|
22
|
+
export { validateColumnFilter, validateColumnFilters, InvalidColumnFilterError, MAX_FILTER_DEPTH, } from './operators/validate-column-filter.js';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OA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AE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,uCAAuC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const VERSION = '0.0.0';
|
|
2
|
+
export { BaseFilter } from './base-filter.js';
|
|
3
|
+
export { Filterable, getFilterableMetadata } from './decorator/filterable.decorator.js';
|
|
4
|
+
export { FilterFor, getFilterForMap } from './decorator/filter-for.decorator.js';
|
|
5
|
+
export { ApplyFilter, getApplyFilterMetadata } from './decorator/apply-filter.decorator.js';
|
|
6
|
+
export { Relations, getRelationsMap, resolveRelation } from './decorator/relations.decorator.js';
|
|
7
|
+
export { ApplyFilterInterceptor } from './interceptor/apply-filter.interceptor.js';
|
|
8
|
+
export { FilterExceptionFilter } from './filter/filter-exception.filter.js';
|
|
9
|
+
export { FilterRunner } from './runner.js';
|
|
10
|
+
export { FilterModule } from './module.js';
|
|
11
|
+
export { FilterException, FilterNotRegisteredException, FilterMissingEntityException, FilterStateUnavailableException, UnknownFilterKeyException, FilterValidationException, FilterMissingAdapterException, FilterMethodException, } from './errors/exceptions.js';
|
|
12
|
+
export { FILTER_MODULE_OPTIONS, FILTER_ADAPTER, FILTERABLE_METADATA, FILTER_FOR_METADATA, FILTER_RELATIONS_METADATA, APPLY_FILTER_METADATA, APPLY_FILTER_REQ_KEY, } from './tokens.js';
|
|
13
|
+
export { resolveInputFromRequest } from './input/source-resolver.js';
|
|
14
|
+
export { normalizeInput } from './input/normalizer.js';
|
|
15
|
+
export { escapeLike } from './utils/escape-like.js';
|
|
16
|
+
export { FILTER_OPERATORS } from './operators/types.js';
|
|
17
|
+
export { ColumnFilterDto } from './operators/column-filter.dto.js';
|
|
18
|
+
export { validateColumnFilter, validateColumnFilters, InvalidColumnFilterError, MAX_FILTER_DEPTH, } from './operators/validate-column-filter.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAEjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,4BAA4B,EAC5B,4BAA4B,EAC5B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAkBrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/input/dispatcher.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGrF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getFilterForMap } from '../decorator/filter-for.decorator.js';
|
|
2
|
+
import { getFilterableMetadata } from '../decorator/filterable.decorator.js';
|
|
3
|
+
const cache = new WeakMap();
|
|
4
|
+
export function resolveDispatchTarget(ctor, inputKey) {
|
|
5
|
+
const allowed = computeAllowed(ctor);
|
|
6
|
+
return allowed.get(inputKey) ?? null;
|
|
7
|
+
}
|
|
8
|
+
function computeAllowed(ctor) {
|
|
9
|
+
const cached = cache.get(ctor);
|
|
10
|
+
if (cached)
|
|
11
|
+
return cached;
|
|
12
|
+
const filterForMap = getFilterForMap(ctor);
|
|
13
|
+
const meta = getFilterableMetadata(ctor);
|
|
14
|
+
const allowed = new Map();
|
|
15
|
+
for (const [inputKey, methodName] of filterForMap) {
|
|
16
|
+
if (meta?.allowed && !meta.allowed.includes(inputKey))
|
|
17
|
+
continue;
|
|
18
|
+
if (meta?.blocked?.includes(inputKey))
|
|
19
|
+
continue;
|
|
20
|
+
allowed.set(inputKey, methodName);
|
|
21
|
+
}
|
|
22
|
+
cache.set(ctor, allowed);
|
|
23
|
+
return allowed;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=dispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src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boolean;
|
|
5
|
+
/** When true, null, undefined and empty string values are stripped. Defaults to true. */
|
|
6
|
+
stripEmpty?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function normalizeInput(input: unknown, options: NormalizeOptions): Record<string, unknown>;
|
|
9
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../src/input/normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,eAAe,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAID,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBjG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const BLOCKED_KEYS = new Set(['__proto__', 'constructor', 'prototype', 'toString', 'valueOf']);
|
|
2
|
+
export function normalizeInput(input, options) {
|
|
3
|
+
if (input == null || typeof input !== 'object')
|
|
4
|
+
return {};
|
|
5
|
+
const norm = pickNormalizer(options.normalizer);
|
|
6
|
+
const drop = options.dropId === true;
|
|
7
|
+
const strip = options.stripEmpty !== false;
|
|
8
|
+
const out = Object.create(null);
|
|
9
|
+
for (const [rawKey, value] of Object.entries(input)) {
|
|
10
|
+
if (BLOCKED_KEYS.has(rawKey))
|
|
11
|
+
continue;
|
|
12
|
+
if (strip && (value === null || value === undefined || value === ''))
|
|
13
|
+
continue;
|
|
14
|
+
let key = norm(rawKey);
|
|
15
|
+
if (BLOCKED_KEYS.has(key))
|
|
16
|
+
continue;
|
|
17
|
+
if (drop)
|
|
18
|
+
key = stripId(key);
|
|
19
|
+
if (key.length === 0)
|
|
20
|
+
continue;
|
|
21
|
+
out[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function pickNormalizer(spec) {
|
|
26
|
+
if (typeof spec === 'function')
|
|
27
|
+
return spec;
|
|
28
|
+
if (spec === 'camelCase')
|
|
29
|
+
return toCamelCase;
|
|
30
|
+
return toSnakeCase;
|
|
31
|
+
}
|
|
32
|
+
function toCamelCase(key) {
|
|
33
|
+
const result = key.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
|
|
34
|
+
return result.charAt(0).toLowerCase() + result.slice(1);
|
|
35
|
+
}
|
|
36
|
+
function toSnakeCase(key) {
|
|
37
|
+
return key
|
|
38
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
|
|
39
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
40
|
+
.toLowerCase();
|
|
41
|
+
}
|
|
42
|
+
function stripId(key) {
|
|
43
|
+
if (key.endsWith('Id'))
|
|
44
|
+
return key.slice(0, -2);
|
|
45
|
+
if (key.endsWith('_id'))
|
|
46
|
+
return key.slice(0, -3);
|
|
47
|
+
if (key === 'id')
|
|
48
|
+
return '';
|
|
49
|
+
return key;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=normalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizer.js","sourceRoot":"","sources":["../../src/input/normalizer.ts"],"names":[],"mappings":"AASA,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;AAE/F,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,OAAyB;IACtE,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC1D,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChD,M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KAAK,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG;SACP,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,WAAW,EAAE,CAAC;AACnB,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChD,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjD,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-resolver.d.ts","sourceRoot":"","sources":["../../src/input/source-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW/C,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,WAAW,GAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+BzB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const WRITE_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);
|
|
2
|
+
const READ_METHODS = new Set(['GET', 'HEAD']);
|
|
3
|
+
export function resolveInputFromRequest(req, source) {
|
|
4
|
+
if (typeof source === 'function') {
|
|
5
|
+
const r = source(req);
|
|
6
|
+
return { ...(r ?? {}) };
|
|
7
|
+
}
|
|
8
|
+
const r = (req ?? {});
|
|
9
|
+
const query = (r.query ?? {});
|
|
10
|
+
const body = (r.body ?? {});
|
|
11
|
+
switch (source) {
|
|
12
|
+
case 'query':
|
|
13
|
+
return { ...query };
|
|
14
|
+
case 'body':
|
|
15
|
+
return { ...body };
|
|
16
|
+
case 'auto': {
|
|
17
|
+
const method = (r.method ?? 'GET').toUpperCase();
|
|
18
|
+
if (READ_METHODS.has(method))
|
|
19
|
+
return { ...query };
|
|
20
|
+
if (WRITE_METHODS.has(method))
|
|
21
|
+
return { ...query, ...body };
|
|
22
|
+
return { ...query };
|
|
23
|
+
}
|
|
24
|
+
default: {
|
|
25
|
+
if (source.includes('.')) {
|
|
26
|
+
const resolved = resolveDotPath(r, source);
|
|
27
|
+
return { ...(resolved ?? {}) };
|
|
28
|
+
}
|
|
29
|
+
const method = (r.method ?? 'GET').toUpperCase();
|
|
30
|
+
if (READ_METHODS.has(method))
|
|
31
|
+
return { ...query };
|
|
32
|
+
if (WRITE_METHODS.has(method))
|
|
33
|
+
return { ...query, ...body };
|
|
34
|
+
return { ...query };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function resolveDotPath(obj, path) {
|
|
39
|
+
let current = obj;
|
|
40
|
+
for (const segment of path.split('.')) {
|
|
41
|
+
if (current == null || typeof current !== 'object')
|
|
42
|
+
return undefined;
|
|
43
|
+
current = current[segment];
|
|
44
|
+
}
|
|
45
|
+
if (current == null || typeof current !== 'object')
|
|
46
|
+
return undefined;
|
|
47
|
+
return current;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=source-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-resolver.js","sourceRoot":"","sources":["../../src/input/source-resolver.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAClE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAQ9C,MAAM,UAAU,uBAAu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M,IAAI,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YACjD,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;YAClD,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC;YAC5D,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,GAAY,EAAE,IAAY;IAChD,IAAI,OAAO,GAAY,GAAG,CAAC;IAC3B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACtC,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QACrE,OAAO,GAAI,OAAmC,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACrE,OAAO,OAAkC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/input/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAiB3C,wBAAsB,aAAa,CAAC,CAAC,EACnC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAclC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FilterValidationException } from '../errors/exceptions.js';
|
|
2
|
+
let cached;
|
|
3
|
+
async function loadValidator() {
|
|
4
|
+
if (cached !== undefined)
|
|
5
|
+
return cached;
|
|
6
|
+
try {
|
|
7
|
+
const cv = (await import('class-validator'));
|
|
8
|
+
const ct = (await import('class-transformer'));
|
|
9
|
+
cached = { validate: cv.validate, plainToInstance: ct.plainToInstance };
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
cached = null;
|
|
13
|
+
}
|
|
14
|
+
return cached;
|
|
15
|
+
}
|
|
16
|
+
export async function validateInput(FilterClass, input) {
|
|
17
|
+
const mod = await loadValidator();
|
|
18
|
+
if (!mod)
|
|
19
|
+
return input;
|
|
20
|
+
const instance = mod.plainToInstance(FilterClass, input);
|
|
21
|
+
const errors = (await mod.validate(instance, {
|
|
22
|
+
whitelist: false,
|
|
23
|
+
forbidNonWhitelisted: false,
|
|
24
|
+
}));
|
|
25
|
+
if (errors.length > 0)
|
|
26
|
+
throw new FilterValidationException(errors);
|
|
27
|
+
const transformed = {};
|
|
28
|
+
for (const key of Object.keys(input)) {
|
|
29
|
+
transformed[key] = instance[key];
|
|
30
|
+
}
|
|
31
|
+
return transformed;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/input/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,IAAI,MAA4E,CAAC;AAEjF,KAAK,UAAU,aAAa;IAC1B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAsC,CAAC;QAClF,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAA6C,CAAC;QAC3F,MAAM,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,CAAC,eAAe,EAAE,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAoB,EACpB,KAA8B;IAE9B,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE;QAC3C,SAAS,EAAE,KAAK;QAChB,oBAAoB,EAAE,KAAK;KAC5B,CAAC,CAAc,CAAC;IACjB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,WAAW,GAA4B,EAAE,CAAC;IAChD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,WAAW,CAAC,GAAG,CAAC,GAAI,QAAoC,CAAC,GAAG,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CallHandler, type ExecutionContext, type NestInterceptor } from '@nestjs/common';
|
|
2
|
+
import { ModuleRef } from '@nestjs/core';
|
|
3
|
+
import type { Observable } from 'rxjs';
|
|
4
|
+
export declare class ApplyFilterInterceptor implements NestInterceptor {
|
|
5
|
+
private readonly moduleRef;
|
|
6
|
+
constructor(moduleRef: ModuleRef);
|
|
7
|
+
intercept(ctx: ExecutionContext, next: CallHandler): Observable<unknown>;
|
|
8
|
+
private runAll;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=apply-filter.interceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-filter.interceptor.d.ts","sourceRoot":"","sources":["../../src/interceptor/apply-filter.interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAErB,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAiBvC,qBACa,sBAAuB,YAAW,eAAe;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,SAAS,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC;YAqC1D,MAAM;CAyBrB"}
|