adorn-api 1.0.13 → 1.0.14
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/dist/adapter/express/auth.d.ts +8 -0
- package/dist/adapter/express/auth.d.ts.map +1 -1
- package/dist/adapter/express/bootstrap.d.ts +12 -0
- package/dist/adapter/express/bootstrap.d.ts.map +1 -1
- package/dist/adapter/express/coercion.d.ts +81 -1
- package/dist/adapter/express/coercion.d.ts.map +1 -1
- package/dist/adapter/express/index.d.ts +1 -0
- package/dist/adapter/express/index.d.ts.map +1 -1
- package/dist/adapter/express/merge.d.ts +17 -0
- package/dist/adapter/express/merge.d.ts.map +1 -1
- package/dist/adapter/express/openapi.d.ts +55 -0
- package/dist/adapter/express/openapi.d.ts.map +1 -1
- package/dist/adapter/express/router.d.ts +6 -0
- package/dist/adapter/express/router.d.ts.map +1 -1
- package/dist/adapter/express/swagger.d.ts +6 -0
- package/dist/adapter/express/swagger.d.ts.map +1 -1
- package/dist/adapter/express/types.d.ts +26 -0
- package/dist/adapter/express/types.d.ts.map +1 -1
- package/dist/adapter/express/validation.d.ts +19 -2
- package/dist/adapter/express/validation.d.ts.map +1 -1
- package/dist/cli.cjs +192 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +192 -11
- package/dist/cli.js.map +1 -1
- package/dist/compiler/analyze/index.d.ts +5 -0
- package/dist/compiler/analyze/index.d.ts.map +1 -0
- package/dist/compiler/analyze/scanControllers.d.ts +52 -0
- package/dist/compiler/analyze/scanControllers.d.ts.map +1 -1
- package/dist/compiler/cache/isStale.d.ts +26 -0
- package/dist/compiler/cache/isStale.d.ts.map +1 -1
- package/dist/compiler/cache/loadArtifacts.d.ts +36 -0
- package/dist/compiler/cache/loadArtifacts.d.ts.map +1 -1
- package/dist/compiler/cache/schema.d.ts +14 -0
- package/dist/compiler/cache/schema.d.ts.map +1 -1
- package/dist/compiler/cache/writeCache.d.ts +6 -0
- package/dist/compiler/cache/writeCache.d.ts.map +1 -1
- package/dist/compiler/gems.d.ts +75 -0
- package/dist/compiler/gems.d.ts.map +1 -0
- package/dist/compiler/generator/index.d.ts +7 -0
- package/dist/compiler/generator/index.d.ts.map +1 -0
- package/dist/compiler/generator/manifest.d.ts +23 -0
- package/dist/compiler/generator/manifest.d.ts.map +1 -0
- package/dist/compiler/generator/openapi.d.ts +118 -0
- package/dist/compiler/generator/openapi.d.ts.map +1 -0
- package/dist/compiler/graph/builder.d.ts +24 -0
- package/dist/compiler/graph/builder.d.ts.map +1 -0
- package/dist/compiler/graph/index.d.ts +7 -0
- package/dist/compiler/graph/index.d.ts.map +1 -0
- package/dist/compiler/graph/schemaGraph.d.ts +67 -0
- package/dist/compiler/graph/schemaGraph.d.ts.map +1 -0
- package/dist/compiler/graph/types.d.ts +203 -0
- package/dist/compiler/graph/types.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +12 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/ir/index.d.ts +7 -0
- package/dist/compiler/ir/index.d.ts.map +1 -0
- package/dist/compiler/ir/pipeline.d.ts +82 -0
- package/dist/compiler/ir/pipeline.d.ts.map +1 -0
- package/dist/compiler/ir/stages.d.ts +40 -0
- package/dist/compiler/ir/stages.d.ts.map +1 -0
- package/dist/compiler/ir/visitor.d.ts +98 -0
- package/dist/compiler/ir/visitor.d.ts.map +1 -0
- package/dist/compiler/manifest/emit.d.ts +14 -0
- package/dist/compiler/manifest/emit.d.ts.map +1 -1
- package/dist/compiler/manifest/format.d.ts +42 -0
- package/dist/compiler/manifest/format.d.ts.map +1 -1
- package/dist/compiler/manifest/index.d.ts +6 -0
- package/dist/compiler/manifest/index.d.ts.map +1 -0
- package/dist/compiler/runner/createProgram.d.ts +16 -0
- package/dist/compiler/runner/createProgram.d.ts.map +1 -1
- package/dist/compiler/runner/index.d.ts +5 -0
- package/dist/compiler/runner/index.d.ts.map +1 -0
- package/dist/compiler/schema/extractAnnotations.d.ts +47 -0
- package/dist/compiler/schema/extractAnnotations.d.ts.map +1 -1
- package/dist/compiler/schema/index.d.ts +6 -0
- package/dist/compiler/schema/index.d.ts.map +1 -0
- package/dist/compiler/schema/intersectionHandler.d.ts +37 -0
- package/dist/compiler/schema/intersectionHandler.d.ts.map +1 -1
- package/dist/compiler/schema/objectHandler.d.ts +86 -0
- package/dist/compiler/schema/objectHandler.d.ts.map +1 -1
- package/dist/compiler/schema/openapi.d.ts +15 -0
- package/dist/compiler/schema/openapi.d.ts.map +1 -1
- package/dist/compiler/schema/parameters.d.ts +72 -0
- package/dist/compiler/schema/parameters.d.ts.map +1 -1
- package/dist/compiler/schema/primitives.d.ts +58 -0
- package/dist/compiler/schema/primitives.d.ts.map +1 -1
- package/dist/compiler/schema/typeToJsonSchema.d.ts +20 -0
- package/dist/compiler/schema/typeToJsonSchema.d.ts.map +1 -1
- package/dist/compiler/schema/types.d.ts +15 -0
- package/dist/compiler/schema/types.d.ts.map +1 -1
- package/dist/compiler/schema/unionHandler.d.ts +60 -0
- package/dist/compiler/schema/unionHandler.d.ts.map +1 -1
- package/dist/compiler/transform/dedup.d.ts +35 -0
- package/dist/compiler/transform/dedup.d.ts.map +1 -0
- package/dist/compiler/transform/flatten.d.ts +50 -0
- package/dist/compiler/transform/flatten.d.ts.map +1 -0
- package/dist/compiler/transform/index.d.ts +7 -0
- package/dist/compiler/transform/index.d.ts.map +1 -0
- package/dist/compiler/transform/inline.d.ts +46 -0
- package/dist/compiler/transform/inline.d.ts.map +1 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts +16 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts.map +1 -1
- package/dist/compiler/validation/index.d.ts +5 -0
- package/dist/compiler/validation/index.d.ts.map +1 -0
- package/dist/decorators/Auth.d.ts +17 -0
- package/dist/decorators/Auth.d.ts.map +1 -1
- package/dist/decorators/Controller.d.ts +15 -0
- package/dist/decorators/Controller.d.ts.map +1 -1
- package/dist/decorators/Public.d.ts +13 -0
- package/dist/decorators/Public.d.ts.map +1 -1
- package/dist/decorators/Use.d.ts +18 -0
- package/dist/decorators/Use.d.ts.map +1 -1
- package/dist/decorators/methods.d.ts +20 -0
- package/dist/decorators/methods.d.ts.map +1 -1
- package/dist/express.cjs +32 -10
- package/dist/express.cjs.map +1 -1
- package/dist/express.js +32 -10
- package/dist/express.js.map +1 -1
- package/dist/index.cjs +160 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -2
- package/dist/index.js.map +1 -1
- package/dist/metal/applyListQuery.d.ts +73 -0
- package/dist/metal/applyListQuery.d.ts.map +1 -1
- package/dist/metal/index.cjs.map +1 -1
- package/dist/metal/index.d.ts +4 -0
- package/dist/metal/index.d.ts.map +1 -1
- package/dist/metal/index.js.map +1 -1
- package/dist/metal/listQuery.d.ts +19 -0
- package/dist/metal/listQuery.d.ts.map +1 -1
- package/dist/metal/queryOptions.d.ts +8 -0
- package/dist/metal/queryOptions.d.ts.map +1 -1
- package/dist/metal/readMetalBag.d.ts +36 -0
- package/dist/metal/readMetalBag.d.ts.map +1 -1
- package/dist/metal/registerMetalEntities.d.ts +20 -0
- package/dist/metal/registerMetalEntities.d.ts.map +1 -1
- package/dist/metal/schemaFromEntity.d.ts +30 -0
- package/dist/metal/schemaFromEntity.d.ts.map +1 -1
- package/dist/metal/searchWhere.d.ts +39 -0
- package/dist/metal/searchWhere.d.ts.map +1 -1
- package/dist/metal/symbolMetadata.d.ts +6 -0
- package/dist/metal/symbolMetadata.d.ts.map +1 -1
- package/dist/runtime/auth/runtime.d.ts +155 -6
- package/dist/runtime/auth/runtime.d.ts.map +1 -1
- package/dist/runtime/metadata/bucket.d.ts +1 -2
- package/dist/runtime/metadata/bucket.d.ts.map +1 -1
- package/dist/runtime/metadata/key.d.ts +1 -1
- package/dist/runtime/metadata/key.d.ts.map +1 -1
- package/dist/runtime/metadata/read.d.ts +1 -2
- package/dist/runtime/metadata/read.d.ts.map +1 -1
- package/dist/runtime/metadata/types.d.ts +74 -0
- package/dist/runtime/metadata/types.d.ts.map +1 -1
- package/dist/runtime/polyfill.d.ts +1 -1
- package/dist/runtime/polyfill.d.ts.map +1 -1
- package/dist/runtime/upload.d.ts +37 -0
- package/dist/runtime/upload.d.ts.map +1 -1
- package/dist/runtime/validation/ajv.d.ts +100 -0
- package/dist/runtime/validation/ajv.d.ts.map +1 -1
- package/dist/runtime/validation/index.d.ts +9 -0
- package/dist/runtime/validation/index.d.ts.map +1 -1
- package/dist/scripts/adorn-example.cjs +238 -6
- package/dist/scripts/adorn-example.cjs.map +1 -1
- package/dist/utils/port.d.ts +9 -0
- package/dist/utils/port.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deduplication transformation for removing duplicate type definitions.
|
|
3
|
+
* Merges identical types and updates references.
|
|
4
|
+
*/
|
|
5
|
+
import type { Graph, NodeId } from "../graph/types.js";
|
|
6
|
+
import type { NodeTransformer } from "../ir/visitor.js";
|
|
7
|
+
/**
|
|
8
|
+
* Type similarity comparison result
|
|
9
|
+
*/
|
|
10
|
+
interface TypeSimilarity {
|
|
11
|
+
score: number;
|
|
12
|
+
identical: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Deduplication transformation result
|
|
16
|
+
*/
|
|
17
|
+
export interface DeduplicationResult {
|
|
18
|
+
mergedNodes: Map<NodeId, NodeId>;
|
|
19
|
+
removedCount: number;
|
|
20
|
+
duplicatesFound: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Type deduplication transformer
|
|
24
|
+
*/
|
|
25
|
+
export declare function createDeduplicationTransformer(): NodeTransformer;
|
|
26
|
+
/**
|
|
27
|
+
* Apply deduplication to graph
|
|
28
|
+
*/
|
|
29
|
+
export declare function applyDeduplication(graph: Graph): DeduplicationResult;
|
|
30
|
+
/**
|
|
31
|
+
* Find structurally similar types
|
|
32
|
+
*/
|
|
33
|
+
export declare function findSimilarTypes(graph: Graph, threshold?: number): Array<[NodeId, NodeId, TypeSimilarity]>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=dedup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../../src/compiler/transform/dedup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAGV,KAAK,EACL,MAAM,EACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxE;;GAEG;AACH,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,eAAe,CAkBhE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,mBAAmB,CA+CpE;AA0CD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,SAAS,GAAE,MAAY,GACtB,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAwBzC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flattening transformation for simplifying nested type structures.
|
|
3
|
+
* Flattens deeply nested object types into shallower structures.
|
|
4
|
+
*/
|
|
5
|
+
import type { Graph, NodeId } from "../graph/types.js";
|
|
6
|
+
import type { NodeTransformer } from "../ir/visitor.js";
|
|
7
|
+
/**
|
|
8
|
+
* Flattening configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface FlattenConfig {
|
|
11
|
+
maxNestingLevel: number;
|
|
12
|
+
preserveNaming: boolean;
|
|
13
|
+
prefix: string;
|
|
14
|
+
mergeOverlapping: boolean;
|
|
15
|
+
maxProperties: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Default flattening configuration
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_FLATTEN_CONFIG: FlattenConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Flattening transformation result
|
|
23
|
+
*/
|
|
24
|
+
export interface FlattenResult {
|
|
25
|
+
flattenedNodes: NodeId[];
|
|
26
|
+
propertiesFlattened: number;
|
|
27
|
+
conflictsResolved: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create flattening transformer
|
|
31
|
+
*/
|
|
32
|
+
export declare function createFlattenTransformer(config?: Partial<FlattenConfig>): NodeTransformer;
|
|
33
|
+
/**
|
|
34
|
+
* Apply flattening to graph
|
|
35
|
+
*/
|
|
36
|
+
export declare function applyFlattening(graph: Graph, config?: Partial<FlattenConfig>): FlattenResult;
|
|
37
|
+
/**
|
|
38
|
+
* Find deeply nested types that could benefit from flattening
|
|
39
|
+
*/
|
|
40
|
+
export declare function findNestedTypes(graph: Graph, config?: Partial<FlattenConfig>): NodeId[];
|
|
41
|
+
/**
|
|
42
|
+
* Analyze flattening impact on the graph
|
|
43
|
+
*/
|
|
44
|
+
export declare function analyzeFlatteningImpact(graph: Graph, config?: Partial<FlattenConfig>): {
|
|
45
|
+
nodesAffected: number;
|
|
46
|
+
propertiesFlattened: number;
|
|
47
|
+
avgNestingLevelBefore: number;
|
|
48
|
+
avgNestingLevelAfter: number;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=flatten.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../src/compiler/transform/flatten.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAGV,KAAK,EACL,MAAM,EACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAMpC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,eAAe,CAajB;AA4BD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,EACZ,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,aAAa,CAwBf;AAuHD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,EACZ,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,MAAM,EAAE,CAqBV;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,KAAK,EACZ,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CA0BA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compiler/transform/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference inlining transformation.
|
|
3
|
+
* Inlines small type definitions to reduce schema complexity.
|
|
4
|
+
*/
|
|
5
|
+
import type { AnyNode, Graph, NodeId } from "../graph/types.js";
|
|
6
|
+
import type { VisitorContext } from "../ir/visitor.js";
|
|
7
|
+
/**
|
|
8
|
+
* Inlining configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface InliningConfig {
|
|
11
|
+
maxDepth: number;
|
|
12
|
+
maxNodes: number;
|
|
13
|
+
inlinePrimitives: boolean;
|
|
14
|
+
inlineSmallTypes: boolean;
|
|
15
|
+
smallTypeThreshold: number;
|
|
16
|
+
excludePatterns: RegExp[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Default inlining configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_INLINING_CONFIG: InliningConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Inlining transformation result
|
|
24
|
+
*/
|
|
25
|
+
export interface InliningResult {
|
|
26
|
+
inlinedNodes: NodeId[];
|
|
27
|
+
inlinedEdges: number;
|
|
28
|
+
nodesRemoved: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create inlining transformer with custom config
|
|
32
|
+
*/
|
|
33
|
+
export declare function createInliningTransformer(config?: Partial<InliningConfig>): (node: AnyNode, context: VisitorContext) => AnyNode | null;
|
|
34
|
+
/**
|
|
35
|
+
* Apply inlining to graph
|
|
36
|
+
*/
|
|
37
|
+
export declare function applyInlining(graph: Graph, config?: Partial<InliningConfig>): InliningResult;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate inlining depth for a node
|
|
40
|
+
*/
|
|
41
|
+
export declare function calculateInliningDepth(graph: Graph, nodeId: NodeId, visited?: Set<NodeId>): number;
|
|
42
|
+
/**
|
|
43
|
+
* Find potential inline candidates
|
|
44
|
+
*/
|
|
45
|
+
export declare function findInlineCandidates(graph: Graph, config?: Partial<InliningConfig>): NodeId[];
|
|
46
|
+
//# sourceMappingURL=inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../../src/compiler/transform/inline.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,MAAM,EAEP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAOrC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,GAAE,OAAO,CAAC,cAAc,CAAM,IAGpE,MAAM,OAAO,EAAE,SAAS,cAAc,KAAG,OAAO,GAAG,IAAI,CAYhE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,KAAK,EACZ,MAAM,GAAE,OAAO,CAAC,cAAc,CAAM,GACnC,cAAc,CAsBhB;AA0KD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,GAAG,CAAC,MAAM,CAAa,GAC/B,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,MAAM,GAAE,OAAO,CAAC,cAAc,CAAM,GACnC,MAAM,EAAE,CAkBV"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI specification interface for validator generation.
|
|
3
|
+
*/
|
|
1
4
|
interface OpenApi {
|
|
2
5
|
openapi: string;
|
|
3
6
|
components?: {
|
|
4
7
|
schemas?: Record<string, unknown>;
|
|
5
8
|
};
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Manifest interface for validator generation.
|
|
12
|
+
*/
|
|
7
13
|
interface Manifest {
|
|
8
14
|
manifestVersion: number;
|
|
9
15
|
controllers: Array<{
|
|
@@ -30,6 +36,9 @@ interface Manifest {
|
|
|
30
36
|
}>;
|
|
31
37
|
}>;
|
|
32
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Options for emitting precompiled validators.
|
|
41
|
+
*/
|
|
33
42
|
export interface EmitPrecompiledValidatorsOptions {
|
|
34
43
|
outDir: string;
|
|
35
44
|
openapi: OpenApi;
|
|
@@ -37,6 +46,13 @@ export interface EmitPrecompiledValidatorsOptions {
|
|
|
37
46
|
strict?: "off" | "log" | "error";
|
|
38
47
|
formatsMode?: "fast" | "full";
|
|
39
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Emits precompiled validators for the API.
|
|
51
|
+
* Generates standalone validation code using AJV for optimal performance.
|
|
52
|
+
*
|
|
53
|
+
* @param opts - Options including output directory, OpenAPI spec, manifest, and validation settings
|
|
54
|
+
* @returns Promise resolving to paths of generated validator files and a content hash
|
|
55
|
+
*/
|
|
40
56
|
export declare function emitPrecompiledValidators(opts: EmitPrecompiledValidatorsOptions): Promise<{
|
|
41
57
|
validatorsCjsPath: string;
|
|
42
58
|
validatorsEsmPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitPrecompiledValidators.d.ts","sourceRoot":"","sources":["../../../src/compiler/validation/emitPrecompiledValidators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitPrecompiledValidators.d.ts","sourceRoot":"","sources":["../../../src/compiler/validation/emitPrecompiledValidators.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,UAAU,OAAO;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE;QACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;CACH;AAED;;GAEG;AACH,UAAU,QAAQ;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,KAAK,CAAC;YAChB,WAAW,EAAE,MAAM,CAAC;YACpB,IAAI,EAAE;gBACJ,IAAI,CAAC,EAAE;oBACL,SAAS,EAAE,MAAM,CAAC;oBAClB,WAAW,EAAE,MAAM,CAAC;iBACrB,GAAG,IAAI,CAAC;gBACT,QAAQ,CAAC,EAAE,KAAK,CAAC;oBACf,MAAM,EAAE,MAAM,CAAC;oBACf,WAAW,EAAE,MAAM,CAAC;oBACpB,SAAS,CAAC,EAAE,MAAM,CAAC;iBACpB,CAAC,CAAC;aACJ,CAAC;YACF,SAAS,EAAE,KAAK,CAAC;gBACf,MAAM,EAAE,MAAM,CAAC;gBACf,WAAW,EAAE,MAAM,CAAC;gBACpB,SAAS,EAAE,MAAM,CAAC;aACnB,CAAC,CAAC;SACJ,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ;AA4CD;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,gCAAgC,GAAG,OAAO,CAAC;IAC/F,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAyGD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compiler/validation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator to mark a method as requiring authentication.
|
|
3
|
+
*
|
|
4
|
+
* @param scheme - The authentication scheme to use (e.g., "Bearer", "Basic")
|
|
5
|
+
* @param options - Optional authentication configuration
|
|
6
|
+
* @param options.scopes - Required permission scopes for this endpoint
|
|
7
|
+
* @param options.optional - If true, authentication is optional (useful for mixed auth endpoints)
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* @Auth("Bearer", { scopes: ["admin"] })
|
|
12
|
+
* @Delete("/users/:id")
|
|
13
|
+
* deleteUser() {
|
|
14
|
+
* // Implementation
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
1
18
|
export declare function Auth(scheme: string, options?: {
|
|
2
19
|
scopes?: string[];
|
|
3
20
|
optional?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../src/decorators/Auth.ts"],"names":[],"mappings":"AAGA,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,IAEpF,QAAQ,GAAG,EACX,SAAS,2BAA2B,UAwBvC"}
|
|
1
|
+
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../src/decorators/Auth.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,IAEpF,QAAQ,GAAG,EACX,SAAS,2BAA2B,UAwBvC"}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator to mark a class as a controller with a base path.
|
|
3
|
+
* All methods in the controller will be relative to this base path.
|
|
4
|
+
*
|
|
5
|
+
* @param basePath - The base path for all routes in this controller
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* @Controller("/users")
|
|
10
|
+
* export class UsersController {
|
|
11
|
+
* @Get("/:id")
|
|
12
|
+
* getUser() { }
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
1
16
|
export declare function Controller(basePath: string): <T extends new (...args: any[]) => any>(target: T, context: ClassDecoratorContext<T>) => T | void;
|
|
2
17
|
//# sourceMappingURL=Controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../src/decorators/Controller.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,IACxB,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACpD,QAAQ,CAAC,EACT,SAAS,qBAAqB,CAAC,CAAC,CAAC,KAChC,CAAC,GAAG,IAAI,CAIZ"}
|
|
1
|
+
{"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../src/decorators/Controller.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,IACxB,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACpD,QAAQ,CAAC,EACT,SAAS,qBAAqB,CAAC,CAAC,CAAC,KAChC,CAAC,GAAG,IAAI,CAIZ"}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator to mark a method as public (no authentication required).
|
|
3
|
+
* Use this to explicitly allow unauthenticated access to specific endpoints.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* @Public()
|
|
8
|
+
* @Get("/health")
|
|
9
|
+
* healthCheck() {
|
|
10
|
+
* return { status: "ok" };
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
export declare function Public(): (target: any, context: ClassMethodDecoratorContext) => void;
|
|
2
15
|
//# sourceMappingURL=Public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Public.d.ts","sourceRoot":"","sources":["../../src/decorators/Public.ts"],"names":[],"mappings":"AAGA,wBAAgB,MAAM,KAElB,QAAQ,GAAG,EACX,SAAS,2BAA2B,UAoBvC"}
|
|
1
|
+
{"version":3,"file":"Public.d.ts","sourceRoot":"","sources":["../../src/decorators/Public.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,KAElB,QAAQ,GAAG,EACX,SAAS,2BAA2B,UAoBvC"}
|
package/dist/decorators/Use.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import type { ExpressMw } from "../runtime/metadata/types.js";
|
|
2
2
|
type UseTarget = string | ExpressMw;
|
|
3
|
+
/**
|
|
4
|
+
* Decorator to apply middleware to a controller class or individual methods.
|
|
5
|
+
*
|
|
6
|
+
* @param middleware - One or more middleware functions or paths (for path-specific middleware)
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // Apply to entire controller
|
|
11
|
+
* @Use(cors(), helmet())
|
|
12
|
+
* @Controller("/api")
|
|
13
|
+
* class ApiController { }
|
|
14
|
+
*
|
|
15
|
+
* // Apply to specific method
|
|
16
|
+
* @Use(express.json())
|
|
17
|
+
* @Post("/upload")
|
|
18
|
+
* uploadFile() { }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export declare function Use(...middleware: UseTarget[]): (target: any, context: ClassDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
4
22
|
export {};
|
|
5
23
|
//# sourceMappingURL=Use.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Use.d.ts","sourceRoot":"","sources":["../../src/decorators/Use.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,8BAA8B,CAAC;AAE1E,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpC,wBAAgB,GAAG,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,IAE1C,QAAQ,GAAG,EACX,SAAS,qBAAqB,GAAG,2BAA2B,UA4B/D"}
|
|
1
|
+
{"version":3,"file":"Use.d.ts","sourceRoot":"","sources":["../../src/decorators/Use.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,8BAA8B,CAAC;AAE1E,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,GAAG,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,IAE1C,QAAQ,GAAG,EACX,SAAS,qBAAqB,GAAG,2BAA2B,UA4B/D"}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a method decorator for HTTP GET requests.
|
|
3
|
+
* @param path - The route path for this endpoint
|
|
4
|
+
*/
|
|
1
5
|
export declare const Get: (path: string) => <T extends (...args: any[]) => any>(target: T, context: ClassMethodDecoratorContext<any, T>) => T | void;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a method decorator for HTTP POST requests.
|
|
8
|
+
* @param path - The route path for this endpoint
|
|
9
|
+
*/
|
|
2
10
|
export declare const Post: (path: string) => <T extends (...args: any[]) => any>(target: T, context: ClassMethodDecoratorContext<any, T>) => T | void;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a method decorator for HTTP PUT requests.
|
|
13
|
+
* @param path - The route path for this endpoint
|
|
14
|
+
*/
|
|
3
15
|
export declare const Put: (path: string) => <T extends (...args: any[]) => any>(target: T, context: ClassMethodDecoratorContext<any, T>) => T | void;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a method decorator for HTTP PATCH requests.
|
|
18
|
+
* @param path - The route path for this endpoint
|
|
19
|
+
*/
|
|
4
20
|
export declare const Patch: (path: string) => <T extends (...args: any[]) => any>(target: T, context: ClassMethodDecoratorContext<any, T>) => T | void;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a method decorator for HTTP DELETE requests.
|
|
23
|
+
* @param path - The route path for this endpoint
|
|
24
|
+
*/
|
|
5
25
|
export declare const Delete: (path: string) => <T extends (...args: any[]) => any>(target: T, context: ClassMethodDecoratorContext<any, T>) => T | void;
|
|
6
26
|
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/decorators/methods.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/decorators/methods.ts"],"names":[],"mappings":"AA8BA;;;GAGG;AACH,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,MA9Bb,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,UACxC,CAAC,WACA,2BAA2B,CAAC,GAAG,EAAE,CAAC,CAAC,KAC3C,CAAC,GAAG,IA2B8D,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,MApCd,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,UACxC,CAAC,WACA,2BAA2B,CAAC,GAAG,EAAE,CAAC,CAAC,KAC3C,CAAC,GAAG,IAiCgE,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,MA1Cb,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,UACxC,CAAC,WACA,2BAA2B,CAAC,GAAG,EAAE,CAAC,CAAC,KAC3C,CAAC,GAAG,IAuC8D,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,MAhDf,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,UACxC,CAAC,WACA,2BAA2B,CAAC,GAAG,EAAE,CAAC,CAAC,KAC3C,CAAC,GAAG,IA6CkE,CAAC;AAE5E;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,MAtDhB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,UACxC,CAAC,WACA,2BAA2B,CAAC,GAAG,EAAE,CAAC,CAAC,KAC3C,CAAC,GAAG,IAmDoE,CAAC"}
|
package/dist/express.cjs
CHANGED
|
@@ -167,11 +167,25 @@ function computeBoundRoutes(controllers, manifest) {
|
|
|
167
167
|
var import_ajv = __toESM(require("ajv"), 1);
|
|
168
168
|
var import_ajv_formats = __toESM(require("ajv-formats"), 1);
|
|
169
169
|
var ValidationErrorResponse = class extends Error {
|
|
170
|
+
/**
|
|
171
|
+
* HTTP status code for validation errors.
|
|
172
|
+
*/
|
|
173
|
+
statusCode;
|
|
174
|
+
/**
|
|
175
|
+
* Detailed validation errors.
|
|
176
|
+
*/
|
|
177
|
+
errors;
|
|
178
|
+
/**
|
|
179
|
+
* Creates a new ValidationErrorResponse.
|
|
180
|
+
*
|
|
181
|
+
* @param statusCode - HTTP status code (typically 400)
|
|
182
|
+
* @param errors - Array of validation errors
|
|
183
|
+
*/
|
|
170
184
|
constructor(statusCode, errors) {
|
|
171
185
|
super("Validation failed");
|
|
186
|
+
this.name = "ValidationErrorResponse";
|
|
172
187
|
this.statusCode = statusCode;
|
|
173
188
|
this.errors = errors;
|
|
174
|
-
this.name = "ValidationErrorResponse";
|
|
175
189
|
}
|
|
176
190
|
};
|
|
177
191
|
function createValidator() {
|
|
@@ -477,13 +491,16 @@ function getRawQueryString(req) {
|
|
|
477
491
|
if (index === -1) return "";
|
|
478
492
|
return url.slice(index + 1);
|
|
479
493
|
}
|
|
480
|
-
function parseDeepObjectParams(rawQuery, names) {
|
|
494
|
+
function parseDeepObjectParams(rawQuery, names, maxDepth = 5) {
|
|
481
495
|
const out = {};
|
|
482
496
|
if (!rawQuery || names.size === 0) return out;
|
|
483
497
|
const params = new URLSearchParams(rawQuery);
|
|
484
498
|
for (const [key, value] of params.entries()) {
|
|
485
499
|
const path3 = parseBracketPath(key);
|
|
486
500
|
if (path3.length === 0) continue;
|
|
501
|
+
if (path3.length > maxDepth) {
|
|
502
|
+
throw new Error(`Query parameter nesting depth (${path3.length}) exceeds maximum of ${maxDepth}`);
|
|
503
|
+
}
|
|
487
504
|
const root = path3[0];
|
|
488
505
|
if (!names.has(root)) continue;
|
|
489
506
|
assignDeepValue(out, path3, value);
|
|
@@ -596,10 +613,10 @@ function createAuthMiddleware(authConfig, routeAuth, globalSecurity) {
|
|
|
596
613
|
}
|
|
597
614
|
|
|
598
615
|
// src/adapter/express/validation.ts
|
|
599
|
-
function validateRequestWithPrecompiled(route, req, validators) {
|
|
616
|
+
function validateRequestWithPrecompiled(route, req, validators, maxDepth = 5) {
|
|
600
617
|
const errors = [];
|
|
601
618
|
const deepNames = new Set(route.args.query.filter((q) => q.serialization?.style === "deepObject").map((q) => q.name));
|
|
602
|
-
const deepValues = deepNames.size > 0 ? parseDeepObjectParams(getRawQueryString(req), deepNames) : {};
|
|
619
|
+
const deepValues = deepNames.size > 0 ? parseDeepObjectParams(getRawQueryString(req), deepNames, maxDepth) : {};
|
|
603
620
|
if (route.args.body) {
|
|
604
621
|
const validator = validators[route.operationId]?.body;
|
|
605
622
|
if (validator) {
|
|
@@ -635,11 +652,11 @@ function validateRequestWithPrecompiled(route, req, validators) {
|
|
|
635
652
|
}
|
|
636
653
|
return errors.length > 0 ? errors : null;
|
|
637
654
|
}
|
|
638
|
-
function validateRequest(route, req, openapi, validator) {
|
|
655
|
+
function validateRequest(route, req, openapi, validator, maxDepth = 5) {
|
|
639
656
|
const openapiOperation = getOpenApiOperation(openapi, route);
|
|
640
657
|
const paramSchemaIndex = getParamSchemaIndex(openapiOperation);
|
|
641
658
|
const deepNames = new Set(route.args.query.filter((q) => q.serialization?.style === "deepObject").map((q) => q.name));
|
|
642
|
-
const deepValues = deepNames.size > 0 ? parseDeepObjectParams(getRawQueryString(req), deepNames) : {};
|
|
659
|
+
const deepValues = deepNames.size > 0 ? parseDeepObjectParams(getRawQueryString(req), deepNames, maxDepth) : {};
|
|
643
660
|
const errors = [];
|
|
644
661
|
if (route.args.body) {
|
|
645
662
|
const bodySchema = getSchemaByRef(openapi, route.args.body.schemaRef);
|
|
@@ -744,7 +761,7 @@ function validateRequest(route, req, openapi, validator) {
|
|
|
744
761
|
|
|
745
762
|
// src/adapter/express/router.ts
|
|
746
763
|
async function createExpressRouter(options) {
|
|
747
|
-
const { controllers, artifactsDir = ".adorn", middleware = {}, defaultPageSize = 10 } = options;
|
|
764
|
+
const { controllers, artifactsDir = ".adorn", middleware = {}, defaultPageSize = 10, queryOptions } = options;
|
|
748
765
|
let manifest;
|
|
749
766
|
let openapi;
|
|
750
767
|
let precompiledValidators = null;
|
|
@@ -814,10 +831,15 @@ async function createExpressRouter(options) {
|
|
|
814
831
|
}
|
|
815
832
|
router[method](route.fullPath, ...middlewareChain, async (req, res, next) => {
|
|
816
833
|
try {
|
|
817
|
-
const
|
|
834
|
+
const maxDepth = queryOptions?.maxNestingDepth ?? 5;
|
|
835
|
+
const validationErrors = precompiledValidators ? validateRequestWithPrecompiled(route, req, precompiledValidators, maxDepth) : validateRequest(route, req, openapi, validator, maxDepth);
|
|
818
836
|
if (validationErrors) {
|
|
819
837
|
return res.status(400).json(formatValidationErrors(validationErrors));
|
|
820
838
|
}
|
|
839
|
+
const deepNames = new Set(
|
|
840
|
+
route.args.query.filter((q) => q.serialization?.style === "deepObject").map((q) => q.name)
|
|
841
|
+
);
|
|
842
|
+
const deepValues = deepNames.size > 0 ? parseDeepObjectParams(getRawQueryString(req), deepNames, maxDepth) : {};
|
|
821
843
|
const instance = getInstance(route.controllerCtor);
|
|
822
844
|
const handler = instance[route.methodName];
|
|
823
845
|
if (typeof handler !== "function") {
|
|
@@ -843,7 +865,7 @@ async function createExpressRouter(options) {
|
|
|
843
865
|
}
|
|
844
866
|
if (jsonArgs.length > 0) {
|
|
845
867
|
for (const q of jsonArgs) {
|
|
846
|
-
const rawValue = req.query[q.name];
|
|
868
|
+
const rawValue = q.serialization?.style === "deepObject" ? deepValues[q.name] : req.query[q.name];
|
|
847
869
|
if (rawValue === void 0 || rawValue === null) continue;
|
|
848
870
|
let parsed = rawValue;
|
|
849
871
|
if (typeof rawValue === "string" && rawValue.length > 0) {
|
|
@@ -863,7 +885,7 @@ async function createExpressRouter(options) {
|
|
|
863
885
|
}
|
|
864
886
|
if (standardArgs.length > 0) {
|
|
865
887
|
for (const q of standardArgs) {
|
|
866
|
-
const rawValue = req.query[q.name];
|
|
888
|
+
const rawValue = q.serialization?.style === "deepObject" ? deepValues[q.name] : req.query[q.name];
|
|
867
889
|
if (rawValue === void 0) continue;
|
|
868
890
|
const parsed = parseQueryValue(rawValue, q);
|
|
869
891
|
const paramSchema = getParamSchemaFromIndex(paramSchemaIndex, "query", q.name) ?? (q.schemaRef ? getSchemaByRef(openapi, q.schemaRef) : null) ?? schemaFromType(q.schemaType);
|