adorn-api 1.0.12 → 1.0.13
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/bootstrap.d.ts.map +1 -1
- package/dist/adapter/express/merge.d.ts.map +1 -1
- package/dist/adapter/express/router.d.ts.map +1 -1
- package/dist/cli.cjs +799 -409
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +799 -409
- package/dist/cli.js.map +1 -1
- package/dist/compiler/cache/isStale.d.ts.map +1 -1
- package/dist/compiler/cache/writeCache.d.ts.map +1 -1
- package/dist/compiler/schema/intersectionHandler.d.ts +7 -0
- package/dist/compiler/schema/intersectionHandler.d.ts.map +1 -0
- package/dist/compiler/schema/objectHandler.d.ts +20 -0
- package/dist/compiler/schema/objectHandler.d.ts.map +1 -0
- package/dist/compiler/schema/openapi.d.ts +1 -1
- package/dist/compiler/schema/openapi.d.ts.map +1 -1
- package/dist/compiler/schema/parameters.d.ts +18 -0
- package/dist/compiler/schema/parameters.d.ts.map +1 -0
- package/dist/compiler/schema/primitives.d.ts +10 -0
- package/dist/compiler/schema/primitives.d.ts.map +1 -0
- package/dist/compiler/schema/typeToJsonSchema.d.ts +2 -51
- package/dist/compiler/schema/typeToJsonSchema.d.ts.map +1 -1
- package/dist/compiler/schema/types.d.ts +54 -0
- package/dist/compiler/schema/types.d.ts.map +1 -0
- package/dist/compiler/schema/unionHandler.d.ts +10 -0
- package/dist/compiler/schema/unionHandler.d.ts.map +1 -0
- package/dist/express.cjs +41 -44
- package/dist/express.cjs.map +1 -1
- package/dist/express.js +41 -44
- package/dist/express.js.map +1 -1
- package/dist/http.d.ts +1 -2
- package/dist/http.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metal/index.cjs +2 -2
- package/dist/metal/index.cjs.map +1 -1
- package/dist/metal/index.js +2 -2
- package/dist/metal/index.js.map +1 -1
- package/dist/metal/listQuery.d.ts.map +1 -1
- package/dist/metal/queryOptions.d.ts.map +1 -1
- package/dist/metal/registerMetalEntities.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isStale.d.ts","sourceRoot":"","sources":["../../../src/compiler/cache/isStale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isStale.d.ts","sourceRoot":"","sources":["../../../src/compiler/cache/isStale.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GACnB;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACtC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAsBrD,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAqCtE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAevF;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,WAAW,CAAC,CA+CvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeCache.d.ts","sourceRoot":"","sources":["../../../src/compiler/cache/writeCache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAkB5B,wBAAgB,UAAU,CAAC,MAAM,EAAE;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"writeCache.d.ts","sourceRoot":"","sources":["../../../src/compiler/cache/writeCache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAkB5B,wBAAgB,UAAU,CAAC,MAAM,EAAE;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAqCP"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { JsonSchema, SchemaContext } from "./types.js";
|
|
3
|
+
export declare function handleIntersection(type: ts.IntersectionType, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema;
|
|
4
|
+
export declare function tryCollapseBrandedIntersection(types: readonly ts.Type[], ctx: SchemaContext, _typeNode?: ts.TypeNode): JsonSchema | null;
|
|
5
|
+
export declare function isPrimitiveLike(t: ts.Type): boolean;
|
|
6
|
+
export declare function isBrandObject(checker: ts.TypeChecker, t: ts.Type, _ctx: SchemaContext): boolean;
|
|
7
|
+
//# sourceMappingURL=intersectionHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersectionHandler.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/intersectionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG5D,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,EAAE,CAAC,gBAAgB,EACzB,GAAG,EAAE,aAAa,EAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,UAAU,CA6BZ;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,EACzB,GAAG,EAAE,aAAa,EAClB,SAAS,CAAC,EAAE,EAAE,CAAC,QAAQ,GACtB,UAAU,GAAG,IAAI,CAanB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAInD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAkB/F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { JsonSchema, SchemaContext } from "./types.js";
|
|
3
|
+
export declare function handleObjectType(type: ts.ObjectType, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema;
|
|
4
|
+
export declare function buildObjectSchema(type: ts.ObjectType, ctx: SchemaContext, _typeNode?: ts.TypeNode): JsonSchema;
|
|
5
|
+
export declare function isRecordType(type: ts.ObjectType, _checker: ts.TypeChecker): boolean;
|
|
6
|
+
export declare function getRecordValueType(type: ts.ObjectType, _checker: ts.TypeChecker): ts.Type | null;
|
|
7
|
+
export declare function isMetalOrmWrapperType(type: ts.Type, checker: ts.TypeChecker): boolean;
|
|
8
|
+
export declare function isMethodLike(type: ts.Type): boolean;
|
|
9
|
+
export declare function isIteratorOrSymbolProperty(propName: string): boolean;
|
|
10
|
+
export declare function getTypeNameFromNode(typeNode: ts.TypeNode | undefined, _ctx: SchemaContext): string;
|
|
11
|
+
interface MetalOrmWrapperInfo {
|
|
12
|
+
wrapperName: string;
|
|
13
|
+
targetTypeArgs: ReadonlyArray<ts.Type>;
|
|
14
|
+
isReadonlyArray: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function findMetalOrmWrapper(type: ts.Type, checker: ts.TypeChecker): MetalOrmWrapperInfo | null;
|
|
17
|
+
export declare function getWrapperTypeName(type: ts.Type, _checker: ts.TypeChecker): string | null;
|
|
18
|
+
export declare function handleMetalOrmWrapper(type: ts.ObjectType, ctx: SchemaContext): JsonSchema;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=objectHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectHandler.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/objectHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG5D,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,GAAG,EAAE,aAAa,EAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,UAAU,CA2CZ;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,GAAG,EAAE,aAAa,EAClB,SAAS,CAAC,EAAE,EAAE,CAAC,QAAQ,GACtB,UAAU,CAmDZ;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAQnF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,IAAI,GAAG,IAAI,CAchG;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAErF;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAGnD;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,CAKlG;AAsBD,UAAU,mBAAmB;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACvC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,mBAAmB,GAAG,IAAI,CAwB5B;AAwBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,WAAW,GAAG,MAAM,GAAG,IAAI,CAKzF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,aAAa,GAAG,UAAU,CAoCzF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import type { ScannedController } from "../analyze/scanControllers.js";
|
|
3
|
-
import type { JsonSchema } from "./
|
|
3
|
+
import type { JsonSchema } from "./types.js";
|
|
4
4
|
export interface OpenAPI31 {
|
|
5
5
|
openapi: "3.1.0";
|
|
6
6
|
info: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAsC,MAAM,+BAA+B,CAAC;AAG3G,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAsC,MAAM,+BAA+B,CAAC;AAG3G,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,YAAY,CAAC;AAU5D,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;KACrC,CAAC;IACF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CAC5C;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,iBAAiB,EAAE,EAChC,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,SAAS,CAuCX"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ScannedOperation } from "../analyze/scanControllers.js";
|
|
2
|
+
import type { SchemaContext, JsonSchema } from "./types.js";
|
|
3
|
+
export declare function buildPathParameters(operation: ScannedOperation, ctx: SchemaContext, parameters: any[]): void;
|
|
4
|
+
export declare function buildQueryParameters(operation: ScannedOperation, ctx: SchemaContext, parameters: any[]): void;
|
|
5
|
+
export declare function buildHeaderParameters(operation: ScannedOperation, ctx: SchemaContext, parameters: any[]): void;
|
|
6
|
+
export declare function buildCookieParameters(operation: ScannedOperation, ctx: SchemaContext, parameters: any[]): void;
|
|
7
|
+
export declare function determineQuerySerialization(schemaType: string | string[] | undefined): {
|
|
8
|
+
style?: string;
|
|
9
|
+
explode?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function generateExampleValue(schema: JsonSchema, propName: string): string;
|
|
12
|
+
export declare function parseExampleValue(description: string): string;
|
|
13
|
+
export declare function resolveSchemaRef(schema: JsonSchema, components: Map<string, JsonSchema>): JsonSchema;
|
|
14
|
+
export declare function resolveAndCollectObjectProps(schema: JsonSchema, components: Map<string, JsonSchema>): {
|
|
15
|
+
properties: Record<string, JsonSchema>;
|
|
16
|
+
required: string[];
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI5D,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,IAAI,CAkC5G;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,IAAI,CAwG7G;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,IAAI,CAmB9G;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,IAAI,CAqB9G;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAS5H;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAyBjF;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAM7D;AAyBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,CAWpG;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAClC;IAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAiChE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { JsonSchema, SchemaContext } from "./types.js";
|
|
3
|
+
export declare function handlePrimitiveType(type: ts.Type, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema | null;
|
|
4
|
+
export declare function isDateType(type: ts.Type, checker: ts.TypeChecker): boolean;
|
|
5
|
+
export declare function isSetType(type: ts.Type, _checker: ts.TypeChecker): boolean;
|
|
6
|
+
export declare function normalizeNumericType(type: ts.Type, checker: ts.TypeChecker, typeNode?: ts.TypeNode, propertyName?: string): JsonSchema;
|
|
7
|
+
export declare function shouldBeIntegerType(typeName: string | null): boolean;
|
|
8
|
+
export declare function getExplicitTypeNameFromNode(typeNode?: ts.TypeNode): string | null;
|
|
9
|
+
export declare function getEffectiveSymbol(type: ts.Type, checker: ts.TypeChecker): ts.Symbol | null;
|
|
10
|
+
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE5D,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,GAAG,EAAE,aAAa,EAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,UAAU,GAAG,IAAI,CA4CnB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAc1E;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAM1E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU,CAUtI;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAYpE;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,CAgBjF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,MAAM,GAAG,IAAI,CAM3F"}
|
|
@@ -1,55 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
properties?: Record<string, JsonSchema>;
|
|
5
|
-
required?: string[];
|
|
6
|
-
items?: JsonSchema;
|
|
7
|
-
enum?: (string | number | boolean)[];
|
|
8
|
-
$ref?: string;
|
|
9
|
-
nullable?: boolean;
|
|
10
|
-
description?: string;
|
|
11
|
-
default?: unknown;
|
|
12
|
-
examples?: unknown[];
|
|
13
|
-
example?: unknown;
|
|
14
|
-
anyOf?: JsonSchema[];
|
|
15
|
-
oneOf?: JsonSchema[];
|
|
16
|
-
allOf?: JsonSchema[];
|
|
17
|
-
discriminator?: DiscriminatorObject;
|
|
18
|
-
additionalProperties?: boolean | JsonSchema;
|
|
19
|
-
unevaluatedProperties?: boolean | JsonSchema;
|
|
20
|
-
format?: string;
|
|
21
|
-
pattern?: string;
|
|
22
|
-
minimum?: number;
|
|
23
|
-
maximum?: number;
|
|
24
|
-
exclusiveMinimum?: number;
|
|
25
|
-
exclusiveMaximum?: number;
|
|
26
|
-
minLength?: number;
|
|
27
|
-
maxLength?: number;
|
|
28
|
-
minItems?: number;
|
|
29
|
-
maxItems?: number;
|
|
30
|
-
minProperties?: number;
|
|
31
|
-
maxProperties?: number;
|
|
32
|
-
multipleOf?: number;
|
|
33
|
-
const?: unknown;
|
|
34
|
-
uniqueItems?: boolean;
|
|
35
|
-
title?: string;
|
|
36
|
-
readOnly?: boolean;
|
|
37
|
-
"x-metal-orm-entity"?: string;
|
|
38
|
-
"x-metal-orm-mode"?: string;
|
|
39
|
-
"x-metal-orm-rel"?: Record<string, unknown>;
|
|
40
|
-
"x-ts-type"?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface DiscriminatorObject {
|
|
43
|
-
propertyName: string;
|
|
44
|
-
mapping?: Record<string, string>;
|
|
45
|
-
}
|
|
46
|
-
export interface SchemaContext {
|
|
47
|
-
checker: ts.TypeChecker;
|
|
48
|
-
components: Map<string, JsonSchema>;
|
|
49
|
-
typeStack: Set<ts.Type>;
|
|
50
|
-
typeNameStack: string[];
|
|
51
|
-
mode?: "request" | "response";
|
|
52
|
-
}
|
|
2
|
+
import type { JsonSchema, SchemaContext } from "./types.js";
|
|
3
|
+
export type { JsonSchema, DiscriminatorObject, SchemaContext } from "./types.js";
|
|
53
4
|
export declare function typeToJsonSchema(type: ts.Type, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema;
|
|
54
5
|
export declare function createSchemaContext(checker: ts.TypeChecker, mode?: "request" | "response"): SchemaContext;
|
|
55
6
|
//# sourceMappingURL=typeToJsonSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeToJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/typeToJsonSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"typeToJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/typeToJsonSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAM5D,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEjF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,GAAG,EAAE,aAAa,EAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,UAAU,CAkCZ;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,GAAE,SAAS,GAAG,UAAuB,GAAG,aAAa,CAQrH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export interface JsonSchema {
|
|
3
|
+
type?: string | string[];
|
|
4
|
+
properties?: Record<string, JsonSchema>;
|
|
5
|
+
required?: string[];
|
|
6
|
+
items?: JsonSchema;
|
|
7
|
+
enum?: (string | number | boolean)[];
|
|
8
|
+
$ref?: string;
|
|
9
|
+
nullable?: boolean;
|
|
10
|
+
description?: string;
|
|
11
|
+
default?: unknown;
|
|
12
|
+
examples?: unknown[];
|
|
13
|
+
example?: unknown;
|
|
14
|
+
anyOf?: JsonSchema[];
|
|
15
|
+
oneOf?: JsonSchema[];
|
|
16
|
+
allOf?: JsonSchema[];
|
|
17
|
+
discriminator?: DiscriminatorObject;
|
|
18
|
+
additionalProperties?: boolean | JsonSchema;
|
|
19
|
+
unevaluatedProperties?: boolean | JsonSchema;
|
|
20
|
+
format?: string;
|
|
21
|
+
pattern?: string;
|
|
22
|
+
minimum?: number;
|
|
23
|
+
maximum?: number;
|
|
24
|
+
exclusiveMinimum?: number;
|
|
25
|
+
exclusiveMaximum?: number;
|
|
26
|
+
minLength?: number;
|
|
27
|
+
maxLength?: number;
|
|
28
|
+
minItems?: number;
|
|
29
|
+
maxItems?: number;
|
|
30
|
+
minProperties?: number;
|
|
31
|
+
maxProperties?: number;
|
|
32
|
+
multipleOf?: number;
|
|
33
|
+
const?: unknown;
|
|
34
|
+
uniqueItems?: boolean;
|
|
35
|
+
title?: string;
|
|
36
|
+
readOnly?: boolean;
|
|
37
|
+
"x-metal-orm-entity"?: string;
|
|
38
|
+
"x-metal-orm-mode"?: string;
|
|
39
|
+
"x-metal-orm-rel"?: Record<string, unknown>;
|
|
40
|
+
"x-ts-type"?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DiscriminatorObject {
|
|
43
|
+
propertyName: string;
|
|
44
|
+
mapping?: Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
export interface SchemaContext {
|
|
47
|
+
checker: ts.TypeChecker;
|
|
48
|
+
components: Map<string, JsonSchema>;
|
|
49
|
+
typeStack: Set<ts.Type>;
|
|
50
|
+
typeNameStack: string[];
|
|
51
|
+
mode?: "request" | "response";
|
|
52
|
+
propertyName?: string;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,qBAAqB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;IACxB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { JsonSchema, DiscriminatorObject, SchemaContext } from "./types.js";
|
|
3
|
+
export declare function handleUnion(type: ts.UnionType, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema;
|
|
4
|
+
export declare function detectDiscriminatedUnion(types: readonly ts.Type[], ctx: SchemaContext, _branches: JsonSchema[]): DiscriminatorObject | null;
|
|
5
|
+
export declare function findCommonPropertyNames(checker: ts.TypeChecker, types: readonly ts.Type[]): string[];
|
|
6
|
+
export declare function isRequiredProperty(checker: ts.TypeChecker, type: ts.Type, propName: string): boolean;
|
|
7
|
+
export declare function getPropertyLiteralValues(checker: ts.TypeChecker, type: ts.Type, propName: string): Set<string> | null;
|
|
8
|
+
export declare function areSetsDisjoint(sets: Array<Set<string>>): boolean;
|
|
9
|
+
export declare function getBranchSchemaName(type: ts.Type, ctx: SchemaContext): string;
|
|
10
|
+
//# sourceMappingURL=unionHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unionHandler.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/unionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGjF,wBAAgB,WAAW,CACzB,IAAI,EAAE,EAAE,CAAC,SAAS,EAClB,GAAG,EAAE,aAAa,EAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,UAAU,CA6DZ;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,EACzB,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,UAAU,EAAE,GACtB,mBAAmB,GAAG,IAAI,CA0B5B;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,MAAM,EAAE,CAOpG;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAapG;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAoBrH;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CASjE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAY7E"}
|
package/dist/express.cjs
CHANGED
|
@@ -216,7 +216,7 @@ async function getMtime(filePath) {
|
|
|
216
216
|
async function loadArtifacts(options) {
|
|
217
217
|
const { outDir } = options;
|
|
218
218
|
const cacheKey = import_node_path.default.resolve(outDir);
|
|
219
|
-
|
|
219
|
+
const entry = artifactCache.get(cacheKey);
|
|
220
220
|
const openapiPath = import_node_path.default.join(outDir, "openapi.json");
|
|
221
221
|
const manifestPath = import_node_path.default.join(outDir, "manifest.json");
|
|
222
222
|
const validatorsPath = import_node_path.default.join(outDir, "validators.mjs");
|
|
@@ -622,10 +622,10 @@ function validateRequestWithPrecompiled(route, req, validators) {
|
|
|
622
622
|
if (q.content === "application/json" && typeof value === "string") {
|
|
623
623
|
try {
|
|
624
624
|
value = JSON.parse(value);
|
|
625
|
-
} catch
|
|
625
|
+
} catch {
|
|
626
626
|
errors.push({
|
|
627
627
|
path: `#/query/${q.name}`,
|
|
628
|
-
message:
|
|
628
|
+
message: "Invalid JSON string",
|
|
629
629
|
keyword: "json",
|
|
630
630
|
params: {}
|
|
631
631
|
});
|
|
@@ -663,10 +663,10 @@ function validateRequest(route, req, openapi, validator) {
|
|
|
663
663
|
if (q.content === "application/json" && typeof value === "string") {
|
|
664
664
|
try {
|
|
665
665
|
value = JSON.parse(value);
|
|
666
|
-
} catch
|
|
666
|
+
} catch {
|
|
667
667
|
errors.push({
|
|
668
668
|
path: `#/query/${q.name}`,
|
|
669
|
-
message:
|
|
669
|
+
message: "Invalid JSON string",
|
|
670
670
|
keyword: "json",
|
|
671
671
|
params: {}
|
|
672
672
|
});
|
|
@@ -849,7 +849,7 @@ async function createExpressRouter(options) {
|
|
|
849
849
|
if (typeof rawValue === "string" && rawValue.length > 0) {
|
|
850
850
|
try {
|
|
851
851
|
parsed = JSON.parse(rawValue);
|
|
852
|
-
} catch
|
|
852
|
+
} catch {
|
|
853
853
|
parsed = rawValue;
|
|
854
854
|
}
|
|
855
855
|
}
|
|
@@ -975,41 +975,40 @@ function setupSwagger(options = {}) {
|
|
|
975
975
|
var import_express3 = __toESM(require("express"), 1);
|
|
976
976
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
977
977
|
function bootstrap(options) {
|
|
978
|
-
return new Promise(
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
});
|
|
978
|
+
return new Promise((resolve2, reject) => {
|
|
979
|
+
const {
|
|
980
|
+
controllers,
|
|
981
|
+
port: userPort,
|
|
982
|
+
host: userHost,
|
|
983
|
+
artifactsDir: userArtifactsDir = ".adorn",
|
|
984
|
+
enableSwagger = true,
|
|
985
|
+
swaggerPath = "/docs",
|
|
986
|
+
swaggerJsonPath = "/docs/openapi.json",
|
|
987
|
+
middleware,
|
|
988
|
+
auth,
|
|
989
|
+
coerce
|
|
990
|
+
} = options;
|
|
991
|
+
if (controllers.length === 0) {
|
|
992
|
+
reject(new Error("At least one controller must be provided to bootstrap()."));
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
const envPort = process.env.PORT;
|
|
996
|
+
const port = userPort ?? (envPort !== void 0 ? Number(envPort) : 3e3);
|
|
997
|
+
const host = userHost ?? process.env.HOST ?? "0.0.0.0";
|
|
998
|
+
if (isNaN(port) || port < 0 || port > 65535) {
|
|
999
|
+
reject(new Error(`Invalid port: ${port}. Port must be between 0 and 65535.`));
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
const absoluteArtifactsDir = import_node_path4.default.isAbsolute(userArtifactsDir) ? userArtifactsDir : import_node_path4.default.resolve(process.cwd(), userArtifactsDir);
|
|
1003
|
+
const app = (0, import_express3.default)();
|
|
1004
|
+
app.use(import_express3.default.json());
|
|
1005
|
+
createExpressRouter({
|
|
1006
|
+
controllers,
|
|
1007
|
+
artifactsDir: absoluteArtifactsDir,
|
|
1008
|
+
middleware,
|
|
1009
|
+
auth,
|
|
1010
|
+
coerce
|
|
1011
|
+
}).then((router) => {
|
|
1013
1012
|
app.use(router);
|
|
1014
1013
|
if (enableSwagger) {
|
|
1015
1014
|
const displayHost = host === "0.0.0.0" ? "localhost" : host;
|
|
@@ -1056,9 +1055,7 @@ function bootstrap(options) {
|
|
|
1056
1055
|
reject(new Error(`Failed to start server: ${error.message}`));
|
|
1057
1056
|
}
|
|
1058
1057
|
});
|
|
1059
|
-
}
|
|
1060
|
-
reject(error);
|
|
1061
|
-
}
|
|
1058
|
+
}).catch(reject);
|
|
1062
1059
|
});
|
|
1063
1060
|
}
|
|
1064
1061
|
// Annotate the CommonJS export names for ESM import in node:
|