@tsed/schema 7.0.0-beta.3 → 7.0.0-beta.4
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/jest.config.js +4 -4
- package/lib/cjs/components/schemaMapper.js +1 -1
- package/lib/cjs/components/schemaMapper.js.map +1 -1
- package/lib/cjs/constants/httpStatusMessages.js +12 -96
- package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
- package/lib/cjs/decorators/common/anyOf.js +4 -0
- package/lib/cjs/decorators/common/anyOf.js.map +1 -1
- package/lib/cjs/decorators/common/description.js.map +1 -1
- package/lib/cjs/decorators/common/enum.js +1 -20
- package/lib/cjs/decorators/common/enum.js.map +1 -1
- package/lib/cjs/decorators/common/ignore.js.map +1 -1
- package/lib/cjs/decorators/common/jsonEntityFn.js.map +1 -1
- package/lib/cjs/decorators/common/oneOf.js +4 -0
- package/lib/cjs/decorators/common/oneOf.js.map +1 -1
- package/lib/cjs/decorators/common/recordOf.js +63 -0
- package/lib/cjs/decorators/common/recordOf.js.map +1 -0
- package/lib/cjs/decorators/operations/acceptMime.js +28 -0
- package/lib/cjs/decorators/operations/acceptMime.js.map +1 -0
- package/lib/cjs/decorators/operations/in.js +6 -4
- package/lib/cjs/decorators/operations/in.js.map +1 -1
- package/lib/cjs/decorators/operations/view.js +31 -0
- package/lib/cjs/decorators/operations/view.js.map +1 -0
- package/lib/cjs/domain/DecoratorContext.js.map +1 -1
- package/lib/cjs/domain/JsonClassStore.js +1 -1
- package/lib/cjs/domain/JsonMap.js.map +1 -1
- package/lib/cjs/domain/JsonMethodStore.js +66 -24
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
- package/lib/cjs/domain/JsonOperation.js +11 -26
- package/lib/cjs/domain/JsonOperation.js.map +1 -1
- package/lib/cjs/domain/JsonOperationRoute.js +4 -0
- package/lib/cjs/domain/JsonOperationRoute.js.map +1 -1
- package/lib/cjs/domain/JsonParameter.js +38 -44
- package/lib/cjs/domain/JsonParameter.js.map +1 -1
- package/lib/cjs/domain/JsonParameterStore.js +14 -5
- package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
- package/lib/cjs/domain/JsonPropertyStore.js +6 -2
- package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
- package/lib/cjs/domain/JsonResponse.js +1 -11
- package/lib/cjs/domain/JsonResponse.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js +47 -54
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/domain/SpecTypes.js +1 -0
- package/lib/cjs/domain/SpecTypes.js.map +1 -1
- package/lib/cjs/index.js +149 -20
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/JsonSchemaOptions.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/utils/from.js +9 -8
- package/lib/cjs/utils/from.js.map +1 -1
- package/lib/cjs/utils/generateSpec.js +55 -0
- package/lib/cjs/utils/generateSpec.js.map +1 -0
- package/lib/cjs/utils/generics.js.map +1 -1
- package/lib/cjs/utils/getJsonSchema.js +11 -1
- package/lib/cjs/utils/getJsonSchema.js.map +1 -1
- package/lib/cjs/utils/getJsonType.js +1 -1
- package/lib/cjs/utils/getJsonType.js.map +1 -1
- package/lib/cjs/utils/getOperationsRoutes.js +2 -1
- package/lib/cjs/utils/getOperationsRoutes.js.map +1 -1
- package/lib/cjs/utils/getSpec.js +58 -43
- package/lib/cjs/utils/getSpec.js.map +1 -1
- package/lib/cjs/utils/getSpecType.js +21 -0
- package/lib/cjs/utils/getSpecType.js.map +1 -0
- package/lib/cjs/utils/mapNullableType.js +1 -1
- package/lib/cjs/utils/mapNullableType.js.map +1 -1
- package/lib/cjs/utils/mapOpenSpec.js +41 -0
- package/lib/cjs/utils/mapOpenSpec.js.map +1 -0
- package/lib/cjs/utils/mapOpenSpec2.js +34 -0
- package/lib/cjs/utils/mapOpenSpec2.js.map +1 -0
- package/lib/cjs/utils/mapOpenSpec3.js +26 -0
- package/lib/cjs/utils/mapOpenSpec3.js.map +1 -0
- package/lib/cjs/utils/mapOpenSpecInfo.js +21 -0
- package/lib/cjs/utils/mapOpenSpecInfo.js.map +1 -0
- package/lib/cjs/utils/matchGroups.js +1 -1
- package/lib/cjs/utils/matchGroups.js.map +1 -1
- package/lib/cjs/utils/mergeOperation.js +1 -0
- package/lib/cjs/utils/mergeOperation.js.map +1 -1
- package/lib/cjs/utils/mergeSpec.js.map +1 -1
- package/lib/cjs/utils/serializeEnumValues.js +26 -0
- package/lib/cjs/utils/serializeEnumValues.js.map +1 -0
- package/lib/esm/components/anyMapper.js +4 -4
- package/lib/esm/components/classMapper.js +4 -4
- package/lib/esm/components/genericsMapper.js +4 -4
- package/lib/esm/components/inheritedClassMapper.js +2 -2
- package/lib/esm/components/itemMapper.js +1 -1
- package/lib/esm/components/lazyRefMapper.js +3 -3
- package/lib/esm/components/mapMapper.js +2 -2
- package/lib/esm/components/objectMapper.js +3 -3
- package/lib/esm/components/ofMapper.js +1 -1
- package/lib/esm/components/propertiesMapper.js +1 -1
- package/lib/esm/components/schemaMapper.js +7 -7
- package/lib/esm/components/schemaMapper.js.map +1 -1
- package/lib/esm/constants/httpStatusMessages.js +11 -96
- package/lib/esm/constants/httpStatusMessages.js.map +1 -1
- package/lib/esm/decorators/class/children.js +1 -1
- package/lib/esm/decorators/collections/collectionContains.js +1 -1
- package/lib/esm/decorators/collections/collectionOf.js +1 -1
- package/lib/esm/decorators/collections/maxItems.js +1 -1
- package/lib/esm/decorators/collections/maxProperties.js +1 -1
- package/lib/esm/decorators/collections/minItems.js +1 -1
- package/lib/esm/decorators/collections/minProperties.js +1 -1
- package/lib/esm/decorators/collections/uniqueItems.js +1 -1
- package/lib/esm/decorators/common/additionalProperties.js +1 -1
- package/lib/esm/decorators/common/allOf.js +1 -1
- package/lib/esm/decorators/common/allow.js +2 -2
- package/lib/esm/decorators/common/any.js +1 -1
- package/lib/esm/decorators/common/anyOf.js +5 -1
- package/lib/esm/decorators/common/anyOf.js.map +1 -1
- package/lib/esm/decorators/common/const.js +1 -1
- package/lib/esm/decorators/common/customKey.js +1 -1
- package/lib/esm/decorators/common/default.js +1 -1
- package/lib/esm/decorators/common/description.js +1 -1
- package/lib/esm/decorators/common/description.js.map +1 -1
- package/lib/esm/decorators/common/enum.js +2 -21
- package/lib/esm/decorators/common/enum.js.map +1 -1
- package/lib/esm/decorators/common/example.js +1 -1
- package/lib/esm/decorators/common/examples.js +1 -1
- package/lib/esm/decorators/common/exclusiveMaximum.js +1 -1
- package/lib/esm/decorators/common/exclusiveMinimum.js +1 -1
- package/lib/esm/decorators/common/format.js +2 -2
- package/lib/esm/decorators/common/forwardGroups.js +1 -1
- package/lib/esm/decorators/common/groups.js +2 -2
- package/lib/esm/decorators/common/ignore.js +1 -1
- package/lib/esm/decorators/common/ignore.js.map +1 -1
- package/lib/esm/decorators/common/integer.js +1 -1
- package/lib/esm/decorators/common/jsonEntityFn.js +1 -1
- package/lib/esm/decorators/common/jsonEntityFn.js.map +1 -1
- package/lib/esm/decorators/common/maxLength.js +1 -1
- package/lib/esm/decorators/common/maximum.js +1 -1
- package/lib/esm/decorators/common/minLength.js +1 -1
- package/lib/esm/decorators/common/minimum.js +1 -1
- package/lib/esm/decorators/common/multipleOf.js +1 -1
- package/lib/esm/decorators/common/name.js +1 -1
- package/lib/esm/decorators/common/nullable.js +2 -2
- package/lib/esm/decorators/common/oneOf.js +5 -1
- package/lib/esm/decorators/common/oneOf.js.map +1 -1
- package/lib/esm/decorators/common/optional.js +1 -1
- package/lib/esm/decorators/common/pattern.js +1 -1
- package/lib/esm/decorators/common/property.js +1 -1
- package/lib/esm/decorators/common/readOnly.js +1 -1
- package/lib/esm/decorators/common/recordOf.js +59 -0
- package/lib/esm/decorators/common/recordOf.js.map +1 -0
- package/lib/esm/decorators/common/required.js +2 -2
- package/lib/esm/decorators/common/requiredGroups.js +2 -2
- package/lib/esm/decorators/common/schema.js +1 -1
- package/lib/esm/decorators/common/title.js +1 -1
- package/lib/esm/decorators/common/writeOnly.js +1 -1
- package/lib/esm/decorators/config/jsonEntityComponent.js +1 -1
- package/lib/esm/decorators/generics/genericOf.js +2 -2
- package/lib/esm/decorators/generics/generics.js +1 -1
- package/lib/esm/decorators/operations/acceptMime.js +24 -0
- package/lib/esm/decorators/operations/acceptMime.js.map +1 -0
- package/lib/esm/decorators/operations/consumes.js +1 -1
- package/lib/esm/decorators/operations/contentType.js +1 -1
- package/lib/esm/decorators/operations/deprecated.js +1 -1
- package/lib/esm/decorators/operations/header.js +1 -1
- package/lib/esm/decorators/operations/in.js +3 -1
- package/lib/esm/decorators/operations/in.js.map +1 -1
- package/lib/esm/decorators/operations/inFile.js +5 -5
- package/lib/esm/decorators/operations/location.js +1 -1
- package/lib/esm/decorators/operations/operationId.js +1 -1
- package/lib/esm/decorators/operations/operationPath.js +1 -1
- package/lib/esm/decorators/operations/partial.js +1 -1
- package/lib/esm/decorators/operations/path.js +1 -1
- package/lib/esm/decorators/operations/produces.js +1 -1
- package/lib/esm/decorators/operations/redirect.js +2 -2
- package/lib/esm/decorators/operations/returns.js +8 -8
- package/lib/esm/decorators/operations/route.js +3 -3
- package/lib/esm/decorators/operations/security.js +1 -1
- package/lib/esm/decorators/operations/status.js +1 -1
- package/lib/esm/decorators/operations/summary.js +1 -1
- package/lib/esm/decorators/operations/tags.js +1 -1
- package/lib/esm/decorators/operations/view.js +27 -0
- package/lib/esm/decorators/operations/view.js.map +1 -0
- package/lib/esm/domain/DecoratorContext.js +1 -1
- package/lib/esm/domain/DecoratorContext.js.map +1 -1
- package/lib/esm/domain/JsonClassStore.js +3 -3
- package/lib/esm/domain/JsonLazyRef.js +2 -2
- package/lib/esm/domain/JsonMap.js +1 -1
- package/lib/esm/domain/JsonMap.js.map +1 -1
- package/lib/esm/domain/JsonMethodStore.js +68 -26
- package/lib/esm/domain/JsonMethodStore.js.map +1 -1
- package/lib/esm/domain/JsonOperation.js +10 -25
- package/lib/esm/domain/JsonOperation.js.map +1 -1
- package/lib/esm/domain/JsonOperationPathsMap.js +1 -1
- package/lib/esm/domain/JsonOperationRoute.js +5 -1
- package/lib/esm/domain/JsonOperationRoute.js.map +1 -1
- package/lib/esm/domain/JsonParameter.js +42 -48
- package/lib/esm/domain/JsonParameter.js.map +1 -1
- package/lib/esm/domain/JsonParameterStore.js +17 -8
- package/lib/esm/domain/JsonParameterStore.js.map +1 -1
- package/lib/esm/domain/JsonPropertyStore.js +7 -3
- package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
- package/lib/esm/domain/JsonRequestBody.js +2 -2
- package/lib/esm/domain/JsonResponse.js +4 -14
- package/lib/esm/domain/JsonResponse.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +9 -16
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/lib/esm/domain/SpecTypes.js +1 -0
- package/lib/esm/domain/SpecTypes.js.map +1 -1
- package/lib/esm/index.js +149 -20
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/JsonSchemaOptions.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/utils/from.js +5 -4
- package/lib/esm/utils/from.js.map +1 -1
- package/lib/esm/utils/generateSpec.js +50 -0
- package/lib/esm/utils/generateSpec.js.map +1 -0
- package/lib/esm/utils/generics.js.map +1 -1
- package/lib/esm/utils/getInheritedStores.js +1 -1
- package/lib/esm/utils/getJsonEntityStore.js +5 -5
- package/lib/esm/utils/getJsonSchema.js +14 -4
- package/lib/esm/utils/getJsonSchema.js.map +1 -1
- package/lib/esm/utils/getJsonType.js +2 -2
- package/lib/esm/utils/getJsonType.js.map +1 -1
- package/lib/esm/utils/getOperationsRoutes.js +5 -4
- package/lib/esm/utils/getOperationsRoutes.js.map +1 -1
- package/lib/esm/utils/getOperationsStores.js +4 -4
- package/lib/esm/utils/getPropertiesStores.js +3 -3
- package/lib/esm/utils/getRequiredProperties.js +1 -1
- package/lib/esm/utils/getSpec.js +65 -50
- package/lib/esm/utils/getSpec.js.map +1 -1
- package/lib/esm/utils/getSpecType.js +16 -0
- package/lib/esm/utils/getSpecType.js.map +1 -0
- package/lib/esm/utils/mapNullableType.js +2 -2
- package/lib/esm/utils/mapNullableType.js.map +1 -1
- package/lib/esm/utils/mapOpenSpec.js +37 -0
- package/lib/esm/utils/mapOpenSpec.js.map +1 -0
- package/lib/esm/utils/mapOpenSpec2.js +30 -0
- package/lib/esm/utils/mapOpenSpec2.js.map +1 -0
- package/lib/esm/utils/mapOpenSpec3.js +22 -0
- package/lib/esm/utils/mapOpenSpec3.js.map +1 -0
- package/lib/esm/utils/mapOpenSpecInfo.js +17 -0
- package/lib/esm/utils/mapOpenSpecInfo.js.map +1 -0
- package/lib/esm/utils/mapRouteOptions.js +1 -1
- package/lib/esm/utils/mergeOperation.js +4 -3
- package/lib/esm/utils/mergeOperation.js.map +1 -1
- package/lib/esm/utils/mergeSpec.js.map +1 -1
- package/lib/esm/utils/ref.js +1 -1
- package/lib/esm/utils/serializeEnumValues.js +21 -0
- package/lib/esm/utils/serializeEnumValues.js.map +1 -0
- package/lib/esm/utils/toJsonMapCollection.js +1 -1
- package/lib/types/constants/httpStatusMessages.d.ts +2 -263
- package/lib/types/decorators/common/anyOf.d.ts +4 -0
- package/lib/types/decorators/common/ignore.d.ts +1 -1
- package/lib/types/decorators/common/jsonEntityFn.d.ts +1 -1
- package/lib/types/decorators/common/oneOf.d.ts +4 -0
- package/lib/types/decorators/common/recordOf.d.ts +46 -0
- package/lib/types/decorators/operations/acceptMime.d.ts +19 -0
- package/lib/types/decorators/operations/in.d.ts +1 -1
- package/lib/types/decorators/operations/view.d.ts +23 -0
- package/lib/types/domain/JsonMap.d.ts +1 -1
- package/lib/types/domain/JsonMethodStore.d.ts +51 -2
- package/lib/types/domain/JsonOperation.d.ts +2 -1
- package/lib/types/domain/JsonOperationRoute.d.ts +5 -3
- package/lib/types/domain/JsonParameter.d.ts +2 -1
- package/lib/types/domain/JsonParameterStore.d.ts +23 -1
- package/lib/types/domain/JsonPropertyStore.d.ts +7 -0
- package/lib/types/domain/JsonResponse.d.ts +2 -1
- package/lib/types/domain/JsonSchema.d.ts +2 -2
- package/lib/types/domain/SpecTypes.d.ts +1 -0
- package/lib/types/index.d.ts +142 -13
- package/lib/types/interfaces/JsonSchemaOptions.d.ts +2 -2
- package/lib/types/utils/generateSpec.d.ts +16 -0
- package/lib/types/utils/generics.d.ts +1 -1
- package/lib/types/utils/getJsonSchema.d.ts +12 -2
- package/lib/types/utils/getOperationsRoutes.d.ts +2 -2
- package/lib/types/utils/getSpec.d.ts +5 -4
- package/lib/types/utils/getSpecType.d.ts +12 -0
- package/lib/types/utils/mapNullableType.d.ts +1 -1
- package/lib/types/utils/mapOpenSpec.d.ts +10 -0
- package/lib/types/utils/mapOpenSpec2.d.ts +9 -0
- package/lib/types/utils/mapOpenSpec3.d.ts +8 -0
- package/lib/types/utils/mapOpenSpecInfo.d.ts +6 -0
- package/lib/types/utils/mergeSpec.d.ts +2 -2
- package/lib/types/utils/serializeEnumValues.d.ts +5 -0
- package/package.json +30 -15
- package/readme.md +1 -0
- package/tsconfig.compile.esm.json +2 -12
- package/benchmark/cold-start.js +0 -17
- package/lib/cjs/components/index.js +0 -15
- package/lib/cjs/components/index.js.map +0 -1
- package/lib/cjs/decorators/index.js +0 -77
- package/lib/cjs/decorators/index.js.map +0 -1
- package/lib/cjs/domain/index.js +0 -20
- package/lib/cjs/domain/index.js.map +0 -1
- package/lib/cjs/interfaces/index.js +0 -8
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/esm/components/index.js +0 -12
- package/lib/esm/components/index.js.map +0 -1
- package/lib/esm/decorators/index.js +0 -74
- package/lib/esm/decorators/index.js.map +0 -1
- package/lib/esm/domain/index.js +0 -17
- package/lib/esm/domain/index.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -5
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/types/components/index.d.ts +0 -11
- package/lib/types/decorators/index.d.ts +0 -68
- package/lib/types/domain/index.d.ts +0 -16
- package/lib/types/interfaces/index.d.ts +0 -4
package/lib/cjs/index.js
CHANGED
|
@@ -1,24 +1,153 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
tslib_1.__exportStar(require("./components/anyMapper"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./components/classMapper"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./components/genericsMapper"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./components/inheritedClassMapper"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./components/itemMapper"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./components/lazyRefMapper"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./components/mapMapper"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./components/objectMapper"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./components/ofMapper"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./components/propertiesMapper"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./components/schemaMapper"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./constants/httpMethods"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./constants/httpStatusMessages"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./decorators/class/children"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./decorators/collections/collectionContains"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./decorators/collections/collectionOf"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./decorators/collections/maxItems"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./decorators/collections/maxProperties"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./decorators/collections/minItems"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./decorators/collections/minProperties"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./decorators/collections/uniqueItems"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./decorators/common/additionalProperties"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./decorators/common/allOf"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./decorators/common/allow"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./decorators/common/any"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./decorators/common/anyOf"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./decorators/common/const"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./decorators/common/customKey"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./decorators/common/default"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./decorators/common/description"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./decorators/common/enum"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./decorators/common/example"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./decorators/common/examples"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./decorators/common/exclusiveMaximum"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./decorators/common/exclusiveMinimum"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./decorators/common/format"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./decorators/common/forwardGroups"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./decorators/common/groups"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./decorators/common/hidden"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./decorators/common/ignore"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./decorators/common/integer"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./decorators/common/jsonEntityFn"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./decorators/common/maxLength"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./decorators/common/maximum"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./decorators/common/minLength"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./decorators/common/minimum"), exports);
|
|
53
|
+
tslib_1.__exportStar(require("./decorators/common/multipleOf"), exports);
|
|
54
|
+
tslib_1.__exportStar(require("./decorators/common/name"), exports);
|
|
55
|
+
tslib_1.__exportStar(require("./decorators/common/nullable"), exports);
|
|
56
|
+
tslib_1.__exportStar(require("./decorators/common/oneOf"), exports);
|
|
57
|
+
tslib_1.__exportStar(require("./decorators/common/optional"), exports);
|
|
58
|
+
tslib_1.__exportStar(require("./decorators/common/pattern"), exports);
|
|
59
|
+
tslib_1.__exportStar(require("./decorators/common/property"), exports);
|
|
60
|
+
tslib_1.__exportStar(require("./decorators/common/readOnly"), exports);
|
|
61
|
+
tslib_1.__exportStar(require("./decorators/common/recordOf"), exports);
|
|
62
|
+
tslib_1.__exportStar(require("./decorators/common/required"), exports);
|
|
63
|
+
tslib_1.__exportStar(require("./decorators/common/requiredGroups"), exports);
|
|
64
|
+
tslib_1.__exportStar(require("./decorators/common/schema"), exports);
|
|
65
|
+
tslib_1.__exportStar(require("./decorators/common/title"), exports);
|
|
66
|
+
tslib_1.__exportStar(require("./decorators/common/writeOnly"), exports);
|
|
67
|
+
tslib_1.__exportStar(require("./decorators/config/jsonEntityComponent"), exports);
|
|
68
|
+
tslib_1.__exportStar(require("./decorators/generics/genericOf"), exports);
|
|
69
|
+
tslib_1.__exportStar(require("./decorators/generics/generics"), exports);
|
|
70
|
+
tslib_1.__exportStar(require("./decorators/operations/acceptMime"), exports);
|
|
71
|
+
tslib_1.__exportStar(require("./decorators/operations/consumes"), exports);
|
|
72
|
+
tslib_1.__exportStar(require("./decorators/operations/contentType"), exports);
|
|
73
|
+
tslib_1.__exportStar(require("./decorators/operations/deprecated"), exports);
|
|
74
|
+
tslib_1.__exportStar(require("./decorators/operations/header"), exports);
|
|
75
|
+
tslib_1.__exportStar(require("./decorators/operations/in"), exports);
|
|
76
|
+
tslib_1.__exportStar(require("./decorators/operations/inFile"), exports);
|
|
77
|
+
tslib_1.__exportStar(require("./decorators/operations/location"), exports);
|
|
78
|
+
tslib_1.__exportStar(require("./decorators/operations/operationId"), exports);
|
|
79
|
+
tslib_1.__exportStar(require("./decorators/operations/operationPath"), exports);
|
|
80
|
+
tslib_1.__exportStar(require("./decorators/operations/partial"), exports);
|
|
81
|
+
tslib_1.__exportStar(require("./decorators/operations/path"), exports);
|
|
82
|
+
tslib_1.__exportStar(require("./decorators/operations/produces"), exports);
|
|
83
|
+
tslib_1.__exportStar(require("./decorators/operations/redirect"), exports);
|
|
84
|
+
tslib_1.__exportStar(require("./decorators/operations/returns"), exports);
|
|
85
|
+
tslib_1.__exportStar(require("./decorators/operations/route"), exports);
|
|
86
|
+
tslib_1.__exportStar(require("./decorators/operations/security"), exports);
|
|
87
|
+
tslib_1.__exportStar(require("./decorators/operations/status"), exports);
|
|
88
|
+
tslib_1.__exportStar(require("./decorators/operations/summary"), exports);
|
|
89
|
+
tslib_1.__exportStar(require("./decorators/operations/tags"), exports);
|
|
90
|
+
tslib_1.__exportStar(require("./decorators/operations/view"), exports);
|
|
91
|
+
tslib_1.__exportStar(require("./domain/DecoratorContext"), exports);
|
|
92
|
+
tslib_1.__exportStar(require("./domain/JsonAliasMap"), exports);
|
|
93
|
+
tslib_1.__exportStar(require("./domain/JsonClassStore"), exports);
|
|
94
|
+
tslib_1.__exportStar(require("./domain/JsonEntityStore"), exports);
|
|
95
|
+
tslib_1.__exportStar(require("./domain/JsonFormatTypes"), exports);
|
|
96
|
+
tslib_1.__exportStar(require("./domain/JsonLazyRef"), exports);
|
|
97
|
+
tslib_1.__exportStar(require("./domain/JsonMap"), exports);
|
|
98
|
+
tslib_1.__exportStar(require("./domain/JsonMethodStore"), exports);
|
|
99
|
+
tslib_1.__exportStar(require("./domain/JsonOperation"), exports);
|
|
100
|
+
tslib_1.__exportStar(require("./domain/JsonOperationPathsMap"), exports);
|
|
101
|
+
tslib_1.__exportStar(require("./domain/JsonOperationRoute"), exports);
|
|
102
|
+
tslib_1.__exportStar(require("./domain/JsonParameter"), exports);
|
|
103
|
+
tslib_1.__exportStar(require("./domain/JsonParameterStore"), exports);
|
|
104
|
+
tslib_1.__exportStar(require("./domain/JsonParameterTypes"), exports);
|
|
105
|
+
tslib_1.__exportStar(require("./domain/JsonPropertyStore"), exports);
|
|
106
|
+
tslib_1.__exportStar(require("./domain/JsonRequestBody"), exports);
|
|
107
|
+
tslib_1.__exportStar(require("./domain/JsonResponse"), exports);
|
|
108
|
+
tslib_1.__exportStar(require("./domain/JsonSchema"), exports);
|
|
109
|
+
tslib_1.__exportStar(require("./domain/SpecTypes"), exports);
|
|
110
|
+
tslib_1.__exportStar(require("./hooks/alterIgnore"), exports);
|
|
111
|
+
tslib_1.__exportStar(require("./hooks/alterOneOf"), exports);
|
|
112
|
+
tslib_1.__exportStar(require("./hooks/alterRequiredGroups"), exports);
|
|
113
|
+
tslib_1.__exportStar(require("./interfaces/IgnoreCallback"), exports);
|
|
114
|
+
tslib_1.__exportStar(require("./interfaces/JsonHookContext"), exports);
|
|
115
|
+
tslib_1.__exportStar(require("./interfaces/JsonOpenSpec"), exports);
|
|
116
|
+
tslib_1.__exportStar(require("./interfaces/JsonSchemaOptions"), exports);
|
|
117
|
+
tslib_1.__exportStar(require("./registries/JsonSchemaMapperContainer"), exports);
|
|
118
|
+
tslib_1.__exportStar(require("./utils/buildPath"), exports);
|
|
119
|
+
tslib_1.__exportStar(require("./utils/concatParameters"), exports);
|
|
120
|
+
tslib_1.__exportStar(require("./utils/concatPath"), exports);
|
|
121
|
+
tslib_1.__exportStar(require("./utils/defineStatusModel"), exports);
|
|
122
|
+
tslib_1.__exportStar(require("./utils/from"), exports);
|
|
123
|
+
tslib_1.__exportStar(require("./utils/generateSpec"), exports);
|
|
124
|
+
tslib_1.__exportStar(require("./utils/generics"), exports);
|
|
125
|
+
tslib_1.__exportStar(require("./utils/getComputedType"), exports);
|
|
126
|
+
tslib_1.__exportStar(require("./utils/getInheritedStores"), exports);
|
|
127
|
+
tslib_1.__exportStar(require("./utils/getJsonEntityStore"), exports);
|
|
128
|
+
tslib_1.__exportStar(require("./utils/getJsonPathParameters"), exports);
|
|
129
|
+
tslib_1.__exportStar(require("./utils/getJsonSchema"), exports);
|
|
130
|
+
tslib_1.__exportStar(require("./utils/getJsonType"), exports);
|
|
131
|
+
tslib_1.__exportStar(require("./utils/getOperationsRoutes"), exports);
|
|
132
|
+
tslib_1.__exportStar(require("./utils/getOperationsStores"), exports);
|
|
133
|
+
tslib_1.__exportStar(require("./utils/getPropertiesStores"), exports);
|
|
134
|
+
tslib_1.__exportStar(require("./utils/getRequiredProperties"), exports);
|
|
135
|
+
tslib_1.__exportStar(require("./utils/getSpec"), exports);
|
|
136
|
+
tslib_1.__exportStar(require("./utils/getSpecType"), exports);
|
|
137
|
+
tslib_1.__exportStar(require("./utils/isSuccessStatus"), exports);
|
|
138
|
+
tslib_1.__exportStar(require("./utils/mapHeaders"), exports);
|
|
139
|
+
tslib_1.__exportStar(require("./utils/mapNullableType"), exports);
|
|
140
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpec"), exports);
|
|
141
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpec2"), exports);
|
|
142
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpec3"), exports);
|
|
143
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpecInfo"), exports);
|
|
144
|
+
tslib_1.__exportStar(require("./utils/mapRouteOptions"), exports);
|
|
145
|
+
tslib_1.__exportStar(require("./utils/matchGroups"), exports);
|
|
146
|
+
tslib_1.__exportStar(require("./utils/mergeOperation"), exports);
|
|
147
|
+
tslib_1.__exportStar(require("./utils/mergeSpec"), exports);
|
|
148
|
+
tslib_1.__exportStar(require("./utils/operationIdFormatter"), exports);
|
|
149
|
+
tslib_1.__exportStar(require("./utils/ref"), exports);
|
|
150
|
+
tslib_1.__exportStar(require("./utils/serializeEnumValues"), exports);
|
|
151
|
+
tslib_1.__exportStar(require("./utils/toJsonMapCollection"), exports);
|
|
152
|
+
tslib_1.__exportStar(require("./utils/toJsonRegex"), exports);
|
|
24
153
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iEAAuC;AACvC,mEAAyC;AACzC,sEAA4C;AAC5C,4EAAkD;AAClD,kEAAwC;AACxC,qEAA2C;AAC3C,iEAAuC;AACvC,oEAA0C;AAC1C,gEAAsC;AACtC,wEAA8C;AAC9C,oEAA0C;AAC1C,kEAAwC;AACxC,yEAA+C;AAC/C,sEAA4C;AAC5C,sFAA4D;AAC5D,gFAAsD;AACtD,4EAAkD;AAClD,iFAAuD;AACvD,4EAAkD;AAClD,iFAAuD;AACvD,+EAAqD;AACrD,mFAAyD;AACzD,oEAA0C;AAC1C,oEAA0C;AAC1C,kEAAwC;AACxC,oEAA0C;AAC1C,oEAA0C;AAC1C,wEAA8C;AAC9C,sEAA4C;AAC5C,0EAAgD;AAChD,mEAAyC;AACzC,sEAA4C;AAC5C,uEAA6C;AAC7C,+EAAqD;AACrD,+EAAqD;AACrD,qEAA2C;AAC3C,4EAAkD;AAClD,qEAA2C;AAC3C,qEAA2C;AAC3C,qEAA2C;AAC3C,sEAA4C;AAC5C,2EAAiD;AACjD,wEAA8C;AAC9C,sEAA4C;AAC5C,wEAA8C;AAC9C,sEAA4C;AAC5C,yEAA+C;AAC/C,mEAAyC;AACzC,uEAA6C;AAC7C,oEAA0C;AAC1C,uEAA6C;AAC7C,sEAA4C;AAC5C,uEAA6C;AAC7C,uEAA6C;AAC7C,uEAA6C;AAC7C,uEAA6C;AAC7C,6EAAmD;AACnD,qEAA2C;AAC3C,oEAA0C;AAC1C,wEAA8C;AAC9C,kFAAwD;AACxD,0EAAgD;AAChD,yEAA+C;AAC/C,6EAAmD;AACnD,2EAAiD;AACjD,8EAAoD;AACpD,6EAAmD;AACnD,yEAA+C;AAC/C,qEAA2C;AAC3C,yEAA+C;AAC/C,2EAAiD;AACjD,8EAAoD;AACpD,gFAAsD;AACtD,0EAAgD;AAChD,uEAA6C;AAC7C,2EAAiD;AACjD,2EAAiD;AACjD,0EAAgD;AAChD,wEAA8C;AAC9C,2EAAiD;AACjD,yEAA+C;AAC/C,0EAAgD;AAChD,uEAA6C;AAC7C,uEAA6C;AAC7C,oEAA0C;AAC1C,gEAAsC;AACtC,kEAAwC;AACxC,mEAAyC;AACzC,mEAAyC;AACzC,+DAAqC;AACrC,2DAAiC;AACjC,mEAAyC;AACzC,iEAAuC;AACvC,yEAA+C;AAC/C,sEAA4C;AAC5C,iEAAuC;AACvC,sEAA4C;AAC5C,sEAA4C;AAC5C,qEAA2C;AAC3C,mEAAyC;AACzC,gEAAsC;AACtC,8DAAoC;AACpC,6DAAmC;AACnC,8DAAoC;AACpC,6DAAmC;AACnC,sEAA4C;AAC5C,sEAA4C;AAC5C,uEAA6C;AAC7C,oEAA0C;AAC1C,yEAA+C;AAC/C,iFAAuD;AACvD,4DAAkC;AAClC,mEAAyC;AACzC,6DAAmC;AACnC,oEAA0C;AAC1C,uDAA6B;AAC7B,+DAAqC;AACrC,2DAAiC;AACjC,kEAAwC;AACxC,qEAA2C;AAC3C,qEAA2C;AAC3C,wEAA8C;AAC9C,gEAAsC;AACtC,8DAAoC;AACpC,sEAA4C;AAC5C,sEAA4C;AAC5C,sEAA4C;AAC5C,wEAA8C;AAC9C,0DAAgC;AAChC,8DAAoC;AACpC,kEAAwC;AACxC,6DAAmC;AACnC,kEAAwC;AACxC,8DAAoC;AACpC,+DAAqC;AACrC,+DAAqC;AACrC,kEAAwC;AACxC,kEAAwC;AACxC,8DAAoC;AACpC,iEAAuC;AACvC,4DAAkC;AAClC,uEAA6C;AAC7C,sDAA4B;AAC5B,sEAA4C;AAC5C,sEAA4C;AAC5C,8DAAoC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/anyMapper\";\nexport * from \"./components/classMapper\";\nexport * from \"./components/genericsMapper\";\nexport * from \"./components/inheritedClassMapper\";\nexport * from \"./components/itemMapper\";\nexport * from \"./components/lazyRefMapper\";\nexport * from \"./components/mapMapper\";\nexport * from \"./components/objectMapper\";\nexport * from \"./components/ofMapper\";\nexport * from \"./components/propertiesMapper\";\nexport * from \"./components/schemaMapper\";\nexport * from \"./constants/httpMethods\";\nexport * from \"./constants/httpStatusMessages\";\nexport * from \"./decorators/class/children\";\nexport * from \"./decorators/collections/collectionContains\";\nexport * from \"./decorators/collections/collectionOf\";\nexport * from \"./decorators/collections/maxItems\";\nexport * from \"./decorators/collections/maxProperties\";\nexport * from \"./decorators/collections/minItems\";\nexport * from \"./decorators/collections/minProperties\";\nexport * from \"./decorators/collections/uniqueItems\";\nexport * from \"./decorators/common/additionalProperties\";\nexport * from \"./decorators/common/allOf\";\nexport * from \"./decorators/common/allow\";\nexport * from \"./decorators/common/any\";\nexport * from \"./decorators/common/anyOf\";\nexport * from \"./decorators/common/const\";\nexport * from \"./decorators/common/customKey\";\nexport * from \"./decorators/common/default\";\nexport * from \"./decorators/common/description\";\nexport * from \"./decorators/common/enum\";\nexport * from \"./decorators/common/example\";\nexport * from \"./decorators/common/examples\";\nexport * from \"./decorators/common/exclusiveMaximum\";\nexport * from \"./decorators/common/exclusiveMinimum\";\nexport * from \"./decorators/common/format\";\nexport * from \"./decorators/common/forwardGroups\";\nexport * from \"./decorators/common/groups\";\nexport * from \"./decorators/common/hidden\";\nexport * from \"./decorators/common/ignore\";\nexport * from \"./decorators/common/integer\";\nexport * from \"./decorators/common/jsonEntityFn\";\nexport * from \"./decorators/common/maxLength\";\nexport * from \"./decorators/common/maximum\";\nexport * from \"./decorators/common/minLength\";\nexport * from \"./decorators/common/minimum\";\nexport * from \"./decorators/common/multipleOf\";\nexport * from \"./decorators/common/name\";\nexport * from \"./decorators/common/nullable\";\nexport * from \"./decorators/common/oneOf\";\nexport * from \"./decorators/common/optional\";\nexport * from \"./decorators/common/pattern\";\nexport * from \"./decorators/common/property\";\nexport * from \"./decorators/common/readOnly\";\nexport * from \"./decorators/common/recordOf\";\nexport * from \"./decorators/common/required\";\nexport * from \"./decorators/common/requiredGroups\";\nexport * from \"./decorators/common/schema\";\nexport * from \"./decorators/common/title\";\nexport * from \"./decorators/common/writeOnly\";\nexport * from \"./decorators/config/jsonEntityComponent\";\nexport * from \"./decorators/generics/genericOf\";\nexport * from \"./decorators/generics/generics\";\nexport * from \"./decorators/operations/acceptMime\";\nexport * from \"./decorators/operations/consumes\";\nexport * from \"./decorators/operations/contentType\";\nexport * from \"./decorators/operations/deprecated\";\nexport * from \"./decorators/operations/header\";\nexport * from \"./decorators/operations/in\";\nexport * from \"./decorators/operations/inFile\";\nexport * from \"./decorators/operations/location\";\nexport * from \"./decorators/operations/operationId\";\nexport * from \"./decorators/operations/operationPath\";\nexport * from \"./decorators/operations/partial\";\nexport * from \"./decorators/operations/path\";\nexport * from \"./decorators/operations/produces\";\nexport * from \"./decorators/operations/redirect\";\nexport * from \"./decorators/operations/returns\";\nexport * from \"./decorators/operations/route\";\nexport * from \"./decorators/operations/security\";\nexport * from \"./decorators/operations/status\";\nexport * from \"./decorators/operations/summary\";\nexport * from \"./decorators/operations/tags\";\nexport * from \"./decorators/operations/view\";\nexport * from \"./domain/DecoratorContext\";\nexport * from \"./domain/JsonAliasMap\";\nexport * from \"./domain/JsonClassStore\";\nexport * from \"./domain/JsonEntityStore\";\nexport * from \"./domain/JsonFormatTypes\";\nexport * from \"./domain/JsonLazyRef\";\nexport * from \"./domain/JsonMap\";\nexport * from \"./domain/JsonMethodStore\";\nexport * from \"./domain/JsonOperation\";\nexport * from \"./domain/JsonOperationPathsMap\";\nexport * from \"./domain/JsonOperationRoute\";\nexport * from \"./domain/JsonParameter\";\nexport * from \"./domain/JsonParameterStore\";\nexport * from \"./domain/JsonParameterTypes\";\nexport * from \"./domain/JsonPropertyStore\";\nexport * from \"./domain/JsonRequestBody\";\nexport * from \"./domain/JsonResponse\";\nexport * from \"./domain/JsonSchema\";\nexport * from \"./domain/SpecTypes\";\nexport * from \"./hooks/alterIgnore\";\nexport * from \"./hooks/alterOneOf\";\nexport * from \"./hooks/alterRequiredGroups\";\nexport * from \"./interfaces/IgnoreCallback\";\nexport * from \"./interfaces/JsonHookContext\";\nexport * from \"./interfaces/JsonOpenSpec\";\nexport * from \"./interfaces/JsonSchemaOptions\";\nexport * from \"./registries/JsonSchemaMapperContainer\";\nexport * from \"./utils/buildPath\";\nexport * from \"./utils/concatParameters\";\nexport * from \"./utils/concatPath\";\nexport * from \"./utils/defineStatusModel\";\nexport * from \"./utils/from\";\nexport * from \"./utils/generateSpec\";\nexport * from \"./utils/generics\";\nexport * from \"./utils/getComputedType\";\nexport * from \"./utils/getInheritedStores\";\nexport * from \"./utils/getJsonEntityStore\";\nexport * from \"./utils/getJsonPathParameters\";\nexport * from \"./utils/getJsonSchema\";\nexport * from \"./utils/getJsonType\";\nexport * from \"./utils/getOperationsRoutes\";\nexport * from \"./utils/getOperationsStores\";\nexport * from \"./utils/getPropertiesStores\";\nexport * from \"./utils/getRequiredProperties\";\nexport * from \"./utils/getSpec\";\nexport * from \"./utils/getSpecType\";\nexport * from \"./utils/isSuccessStatus\";\nexport * from \"./utils/mapHeaders\";\nexport * from \"./utils/mapNullableType\";\nexport * from \"./utils/mapOpenSpec\";\nexport * from \"./utils/mapOpenSpec2\";\nexport * from \"./utils/mapOpenSpec3\";\nexport * from \"./utils/mapOpenSpecInfo\";\nexport * from \"./utils/mapRouteOptions\";\nexport * from \"./utils/matchGroups\";\nexport * from \"./utils/mergeOperation\";\nexport * from \"./utils/mergeSpec\";\nexport * from \"./utils/operationIdFormatter\";\nexport * from \"./utils/ref\";\nexport * from \"./utils/serializeEnumValues\";\nexport * from \"./utils/toJsonMapCollection\";\nexport * from \"./utils/toJsonRegex\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSchemaOptions.js","sourceRoot":"","sources":["../../../src/interfaces/JsonSchemaOptions.ts"],"names":[],"mappings":"","sourcesContent":["import {OpenSpecHash, OS3Schema} from \"@tsed/openspec\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\n\nexport interface JsonSchemaOptions {\n /**\n * Map properties with the alias name. By default: false\n */\n useAlias?: boolean;\n /**\n * Reference to Schema Object.\n */\n schemas?: OpenSpecHash<OS3Schema>;\n /**\n * Define Spec types level\n */\n specType?: SpecTypes;\n /**\n * Define a groups restriction to generate the JsonSchema.\n * Set false to disable groups.\n */\n groups?: string[] | false;\n /**\n * Generate custom keys when SpecType is JSON.\n */\n customKeys?: boolean;\n\n [key: string]: any;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"JsonSchemaOptions.js","sourceRoot":"","sources":["../../../src/interfaces/JsonSchemaOptions.ts"],"names":[],"mappings":"","sourcesContent":["import {OpenSpecHash, OS2Schema, OS3Schema} from \"@tsed/openspec\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\n\nexport interface JsonSchemaOptions {\n /**\n * Map properties with the alias name. By default: false\n */\n useAlias?: boolean;\n /**\n * Reference to Schema Object.\n */\n schemas?: OpenSpecHash<OS3Schema | OS2Schema>;\n /**\n * Define Spec types level\n */\n specType?: SpecTypes;\n /**\n * Define a groups restriction to generate the JsonSchema.\n * Set false to disable groups.\n */\n groups?: string[] | false;\n /**\n * Generate custom keys when SpecType is JSON.\n */\n customKeys?: boolean;\n\n [key: string]: any;\n}\n"]}
|
package/lib/cjs/utils/from.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lazyRef = exports.allOf = exports.oneOf = exports.anyOf = exports.any = exports.object = exports.set = exports.map = exports.array = exports.url = exports.uri = exports.email = exports.time = exports.datetime = exports.date = exports.boolean = exports.string = exports.integer = exports.number = exports.from = void 0;
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
|
-
const
|
|
5
|
+
const JsonEntityStore_1 = require("../domain/JsonEntityStore");
|
|
6
|
+
const JsonFormatTypes_1 = require("../domain/JsonFormatTypes");
|
|
6
7
|
const JsonLazyRef_1 = require("../domain/JsonLazyRef");
|
|
7
8
|
const JsonSchema_1 = require("../domain/JsonSchema");
|
|
8
9
|
const getJsonEntityStore_1 = require("./getJsonEntityStore");
|
|
@@ -83,7 +84,7 @@ exports.boolean = boolean;
|
|
|
83
84
|
* @schemaFunctional
|
|
84
85
|
*/
|
|
85
86
|
function date() {
|
|
86
|
-
return from(Date).format(
|
|
87
|
+
return from(Date).format(JsonFormatTypes_1.JsonFormatTypes.DATE);
|
|
87
88
|
}
|
|
88
89
|
exports.date = date;
|
|
89
90
|
/**
|
|
@@ -94,7 +95,7 @@ exports.date = date;
|
|
|
94
95
|
* @schemaFunctional
|
|
95
96
|
*/
|
|
96
97
|
function datetime() {
|
|
97
|
-
return from(Date).format(
|
|
98
|
+
return from(Date).format(JsonFormatTypes_1.JsonFormatTypes.DATE_TIME);
|
|
98
99
|
}
|
|
99
100
|
exports.datetime = datetime;
|
|
100
101
|
/**
|
|
@@ -105,7 +106,7 @@ exports.datetime = datetime;
|
|
|
105
106
|
* @schemaFunctional
|
|
106
107
|
*/
|
|
107
108
|
function time() {
|
|
108
|
-
return from(Date).format(
|
|
109
|
+
return from(Date).format(JsonFormatTypes_1.JsonFormatTypes.TIME);
|
|
109
110
|
}
|
|
110
111
|
exports.time = time;
|
|
111
112
|
/**
|
|
@@ -116,7 +117,7 @@ exports.time = time;
|
|
|
116
117
|
* @schemaFunctional
|
|
117
118
|
*/
|
|
118
119
|
function email() {
|
|
119
|
-
return from(String).format(
|
|
120
|
+
return from(String).format(JsonFormatTypes_1.JsonFormatTypes.EMAIL);
|
|
120
121
|
}
|
|
121
122
|
exports.email = email;
|
|
122
123
|
/**
|
|
@@ -127,7 +128,7 @@ exports.email = email;
|
|
|
127
128
|
* @schemaFunctional
|
|
128
129
|
*/
|
|
129
130
|
function uri() {
|
|
130
|
-
return from(String).format(
|
|
131
|
+
return from(String).format(JsonFormatTypes_1.JsonFormatTypes.URI);
|
|
131
132
|
}
|
|
132
133
|
exports.uri = uri;
|
|
133
134
|
/**
|
|
@@ -138,7 +139,7 @@ exports.uri = uri;
|
|
|
138
139
|
* @schemaFunctional
|
|
139
140
|
*/
|
|
140
141
|
function url() {
|
|
141
|
-
return from(String).format(
|
|
142
|
+
return from(String).format(JsonFormatTypes_1.JsonFormatTypes.URL);
|
|
142
143
|
}
|
|
143
144
|
exports.url = url;
|
|
144
145
|
/**
|
|
@@ -262,7 +263,7 @@ function lazyRef(cb) {
|
|
|
262
263
|
// solve issue with a self referenced model
|
|
263
264
|
if (cb()) {
|
|
264
265
|
// type is already accessible
|
|
265
|
-
return
|
|
266
|
+
return JsonEntityStore_1.JsonEntityStore.from(cb()).schema;
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
269
|
catch (er) { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/utils/from.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AACzC
|
|
1
|
+
{"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/utils/from.ts"],"names":[],"mappings":"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","sourcesContent":["import {isClass, Type} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {JsonFormatTypes} from \"../domain/JsonFormatTypes\";\nimport {JsonLazyRef} from \"../domain/JsonLazyRef\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\n\n/**\n * Create a new model from the given type.\n *\n * ```typescript\n * from(String)\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function from(type: Type<any> = Object) {\n if (isClass(type)) {\n const {schema} = getJsonEntityStore(type);\n\n schema.properties = function properties(obj: {[key: string]: JsonSchema}) {\n Object.entries(obj).forEach(([propertyKey, propSchema]) => {\n getJsonEntityStore(type.prototype, propertyKey).schema.assign(propSchema);\n });\n\n return this;\n };\n\n return schema;\n }\n\n return JsonSchema.from({type});\n}\n\n/**\n * Declare a new number model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function number() {\n return from(Number);\n}\n\n/**\n * Declare a new integer model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function integer() {\n return from(Number).integer();\n}\n\n/**\n * Declare a new string model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function string() {\n return from(String);\n}\n\n/**\n * Declare a new boolean model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function boolean() {\n return from(Boolean);\n}\n\n/**\n * Declare a new string model with `format: date`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function date() {\n return from(Date).format(JsonFormatTypes.DATE);\n}\n\n/**\n * Declare a new string model with `format: datetime`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function datetime() {\n return from(Date).format(JsonFormatTypes.DATE_TIME);\n}\n\n/**\n * Declare a new string model with `format: time`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function time() {\n return from(Date).format(JsonFormatTypes.TIME);\n}\n\n/**\n * Declare a new string model with `format: email`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function email() {\n return from(String).format(JsonFormatTypes.EMAIL);\n}\n\n/**\n * Declare a new string model with `format: uri`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function uri() {\n return from(String).format(JsonFormatTypes.URI);\n}\n\n/**\n * Declare a new string model with `format: url`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function url() {\n return from(String).format(JsonFormatTypes.URL);\n}\n\n/**\n * Declare a new object model with `additionalProperties: true`.\n *\n * ```json\n * {\n * \"type\": \"array\"\n * }\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function array() {\n return from(Array);\n}\n\n/**\n * Declare a new object model with `additionalProperties: true`.\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"additionalProperties\": true\n * }\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function map() {\n return from(Map).unknown(true);\n}\n\n/**\n * Declare a new array model with `uniqueItems: true`.\n *\n * ```json\n * {\n * \"type\": \"array\",\n * \"uniqueItems\": true\n * }\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function set() {\n return from(Array).uniqueItems(true);\n}\n\n/**\n * Declare a new object model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function object(properties: {[key: string]: JsonSchema} = {}) {\n return from(Object).properties(properties);\n}\n\n/**\n * Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function any(...types: any[]) {\n return from().any(...types);\n}\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n * @schemaFunctional\n */\nexport function anyOf(...anyOf: any[]) {\n return from().anyOf(anyOf);\n}\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n */\nexport function oneOf(...oneOf: any[]) {\n return from().oneOf(oneOf);\n}\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n * @schemaFunctional\n */\nexport function allOf(...allOf: any[]) {\n return from().allOf(allOf);\n}\n\n/**\n * Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.\n *\n * @schemaFunctional\n */\nexport function lazyRef(cb: () => Type<any>) {\n try {\n // solve issue with a self referenced model\n if (cb()) {\n // type is already accessible\n return JsonEntityStore.from(cb()).schema as any;\n }\n } catch (er) {}\n\n return new JsonLazyRef(cb);\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSpec = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
+
const core_1 = require("@tsed/core");
|
|
7
|
+
const mapOpenSpec_1 = require("./mapOpenSpec");
|
|
8
|
+
const getSpec_1 = require("./getSpec");
|
|
9
|
+
const getSpecType_1 = require("./getSpecType");
|
|
10
|
+
const mergeSpec_1 = require("./mergeSpec");
|
|
11
|
+
const SpecTypes_1 = require("../domain/SpecTypes");
|
|
12
|
+
async function readSpec(path) {
|
|
13
|
+
if (fs_extra_1.default.existsSync(path)) {
|
|
14
|
+
try {
|
|
15
|
+
return await fs_extra_1.default.readJSON(path, { encoding: "utf8" });
|
|
16
|
+
}
|
|
17
|
+
catch (e) { }
|
|
18
|
+
}
|
|
19
|
+
/* istanbul ignore next */
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generate OpenAPI spec from multiple sources (models, files, conf)
|
|
24
|
+
* @param tokens
|
|
25
|
+
* @param options
|
|
26
|
+
*/
|
|
27
|
+
async function generateSpec({ tokens, ...options }) {
|
|
28
|
+
const { version = "1.0.0", acceptMimes, specPath, specVersion } = options;
|
|
29
|
+
const fileSpec = specPath ? await readSpec(specPath) : {};
|
|
30
|
+
const defaultSpec = (0, mapOpenSpec_1.mapOpenSpec)((0, core_1.getValue)(options, "spec", {}), {
|
|
31
|
+
fileSpec,
|
|
32
|
+
version,
|
|
33
|
+
specVersion,
|
|
34
|
+
acceptMimes
|
|
35
|
+
});
|
|
36
|
+
const specType = (0, getSpecType_1.getSpecTypeFromSpec)(defaultSpec);
|
|
37
|
+
let controllersSpec = (0, getSpec_1.getSpec)(tokens, options);
|
|
38
|
+
if (specType === SpecTypes_1.SpecTypes.SWAGGER) {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
const { convert } = await Promise.resolve().then(() => tslib_1.__importStar(require("api-spec-converter")));
|
|
41
|
+
const { spec } = await convert({
|
|
42
|
+
from: "openapi_3",
|
|
43
|
+
to: "swagger_2",
|
|
44
|
+
source: {
|
|
45
|
+
...controllersSpec,
|
|
46
|
+
openapi: "3.0.1"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
controllersSpec = spec;
|
|
50
|
+
delete controllersSpec["x-components"];
|
|
51
|
+
}
|
|
52
|
+
return (0, mergeSpec_1.mergeSpec)(defaultSpec, controllersSpec);
|
|
53
|
+
}
|
|
54
|
+
exports.generateSpec = generateSpec;
|
|
55
|
+
//# sourceMappingURL=generateSpec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateSpec.js","sourceRoot":"","sources":["../../../src/utils/generateSpec.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,qCAAoC;AAEpC,+CAA0C;AAC1C,uCAA2E;AAC3E,+CAAkD;AAClD,2CAAsC;AACtC,mDAA8C;AAW9C,KAAK,UAAU,QAAQ,CAAC,IAAY;IAClC,IAAI,kBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACvB,IAAI;YACF,OAAO,MAAM,kBAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;SACpD;QAAC,OAAO,CAAC,EAAE,GAAE;KACf;IAED,0BAA0B;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAAC,EAAC,MAAM,EAAE,GAAG,OAAO,EAAsB;IAC1E,MAAM,EAAC,OAAO,GAAG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAC,GAAG,OAAO,CAAC;IACxE,MAAM,QAAQ,GAAmC,QAAQ,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1F,MAAM,WAAW,GAAG,IAAA,yBAAW,EAAC,IAAA,eAAQ,EAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE;QAC7D,QAAQ;QACR,OAAO;QACP,WAAW;QACX,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAA,iCAAmB,EAAC,WAAW,CAAC,CAAC;IAElD,IAAI,eAAe,GAAG,IAAA,iBAAO,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/C,IAAI,QAAQ,KAAK,qBAAS,CAAC,OAAO,EAAE;QAClC,aAAa;QACb,MAAM,EAAC,OAAO,EAAC,GAAG,gEAAa,oBAAoB,GAAC,CAAC;QACrD,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,OAAO,CAAC;YAC3B,IAAI,EAAE,WAAW;YACjB,EAAE,EAAE,WAAW;YACf,MAAM,EAAE;gBACN,GAAG,eAAe;gBAClB,OAAO,EAAE,OAAO;aACjB;SACF,CAAC,CAAC;QACH,eAAe,GAAG,IAAI,CAAC;QACvB,OAAQ,eAAuB,CAAC,cAAc,CAAC,CAAC;KACjD;IAED,OAAO,IAAA,qBAAS,EAAC,WAAW,EAAE,eAAe,CAAQ,CAAC;AACxD,CAAC;AA/BD,oCA+BC","sourcesContent":["import fs from \"fs-extra\";\nimport {getValue} from \"@tsed/core\";\nimport {OpenSpec2, OpenSpec3} from \"@tsed/openspec\";\nimport {mapOpenSpec} from \"./mapOpenSpec\";\nimport {getSpec, JsonTokenOptions, SpecSerializerOptions} from \"./getSpec\";\nimport {getSpecTypeFromSpec} from \"./getSpecType\";\nimport {mergeSpec} from \"./mergeSpec\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\n\nexport interface GenerateSpecOptions extends Omit<SpecSerializerOptions, \"specType\"> {\n tokens: JsonTokenOptions;\n version?: string;\n acceptMimes?: string;\n specPath?: string;\n specVersion?: string;\n spec?: any;\n}\n\nasync function readSpec(path: string) {\n if (fs.existsSync(path)) {\n try {\n return await fs.readJSON(path, {encoding: \"utf8\"});\n } catch (e) {}\n }\n\n /* istanbul ignore next */\n return {};\n}\n\n/**\n * Generate OpenAPI spec from multiple sources (models, files, conf)\n * @param tokens\n * @param options\n */\nexport async function generateSpec({tokens, ...options}: GenerateSpecOptions): Promise<OpenSpec2 | OpenSpec3> {\n const {version = \"1.0.0\", acceptMimes, specPath, specVersion} = options;\n const fileSpec: Partial<OpenSpec2 | OpenSpec3> = specPath ? await readSpec(specPath) : {};\n\n const defaultSpec = mapOpenSpec(getValue(options, \"spec\", {}), {\n fileSpec,\n version,\n specVersion,\n acceptMimes\n });\n\n const specType = getSpecTypeFromSpec(defaultSpec);\n\n let controllersSpec = getSpec(tokens, options);\n\n if (specType === SpecTypes.SWAGGER) {\n // @ts-ignore\n const {convert} = await import(\"api-spec-converter\");\n const {spec} = await convert({\n from: \"openapi_3\",\n to: \"swagger_2\",\n source: {\n ...controllersSpec,\n openapi: \"3.0.1\"\n }\n });\n controllersSpec = spec;\n delete (controllersSpec as any)[\"x-components\"];\n }\n\n return mergeSpec(defaultSpec, controllersSpec) as any;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generics.js","sourceRoot":"","sources":["../../../src/utils/generics.ts"],"names":[],"mappings":";;;AA4CA;;;;GAIG;AACH,SAAgB,cAAc,CAAC,aAAuB,EAAE,YAA4B;IAClF,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,GAAqB,EAAE,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AACrI,CAAC;AAFD,wCAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAA8C;IAC/E,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,YAAY,EAAE;QACjD,MAAM,EAAC,aAAa,EAAE,YAAY,EAAE,GAAG,GAAG,EAAC,GAAG,OAAO,CAAC;QAEtD,OAAO;YACL,GAAG,GAAG;YACN,QAAQ,EAAE,cAAc,CAAC,aAAa,EAAE,YAAY,CAAC;SACtD,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAXD,gDAWC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,KAAqB;IAC/C,MAAM,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC;IAEpD,OAAO;QACL,YAAY;QACZ,cAAc,EAAE,GAAG;KACpB,CAAC;AACJ,CAAC;AAPD,kCAOC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {JsonSchema} from \"../domain\";\n\nexport type GenericValue = Type<any> | JsonSchema | any;\n\n/**\n * @ignore\n */\nexport type GenericsMap = Map<string, GenericValue>;\n\n/**\n * @ignore\n */\nexport interface GenericTypes {\n genericTypes: Type<any>[];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface GenericLabels {\n genericLabels: string[];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface NestedGenerics {\n nestedGenerics: GenericValue[][];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface GenericsContext extends GenericTypes, GenericLabels, NestedGenerics {\n generics: GenericsMap;\n}\n\n/**\n * @ignore\n * @param genericLabels\n * @param genericTypes\n */\nexport function getGenericsMap(genericLabels: string[], genericTypes: GenericValue[]): GenericsMap {\n return genericLabels.reduce((map: Map<string, any>, item: string, index: number) => map.set(item, genericTypes[index]), new Map());\n}\n\n/**\n * @ignore\n * @param options\n */\nexport function mapGenericsOptions(options: Partial<GenericTypes & GenericLabels>) {\n if (options.genericLabels && options.genericTypes) {\n const {genericLabels, genericTypes, ...ops} = options;\n\n return {\n ...ops,\n generics: getGenericsMap(genericLabels, genericTypes)\n };\n }\n\n return options;\n}\n\n/**\n * @ignore\n * @param value\n */\nexport function popGenerics(value: NestedGenerics): NestedGenerics & GenericTypes {\n const [genericTypes, ...out] = value.nestedGenerics;\n\n return {\n genericTypes,\n nestedGenerics: out\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"generics.js","sourceRoot":"","sources":["../../../src/utils/generics.ts"],"names":[],"mappings":";;;AA4CA;;;;GAIG;AACH,SAAgB,cAAc,CAAC,aAAuB,EAAE,YAA4B;IAClF,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,GAAqB,EAAE,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AACrI,CAAC;AAFD,wCAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAA8C;IAC/E,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,YAAY,EAAE;QACjD,MAAM,EAAC,aAAa,EAAE,YAAY,EAAE,GAAG,GAAG,EAAC,GAAG,OAAO,CAAC;QAEtD,OAAO;YACL,GAAG,GAAG;YACN,QAAQ,EAAE,cAAc,CAAC,aAAa,EAAE,YAAY,CAAC;SACtD,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAXD,gDAWC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,KAAqB;IAC/C,MAAM,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC;IAEpD,OAAO;QACL,YAAY;QACZ,cAAc,EAAE,GAAG;KACpB,CAAC;AACJ,CAAC;AAPD,kCAOC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\n\nexport type GenericValue = Type<any> | JsonSchema | any;\n\n/**\n * @ignore\n */\nexport type GenericsMap = Map<string, GenericValue>;\n\n/**\n * @ignore\n */\nexport interface GenericTypes {\n genericTypes: Type<any>[];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface GenericLabels {\n genericLabels: string[];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface NestedGenerics {\n nestedGenerics: GenericValue[][];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface GenericsContext extends GenericTypes, GenericLabels, NestedGenerics {\n generics: GenericsMap;\n}\n\n/**\n * @ignore\n * @param genericLabels\n * @param genericTypes\n */\nexport function getGenericsMap(genericLabels: string[], genericTypes: GenericValue[]): GenericsMap {\n return genericLabels.reduce((map: Map<string, any>, item: string, index: number) => map.set(item, genericTypes[index]), new Map());\n}\n\n/**\n * @ignore\n * @param options\n */\nexport function mapGenericsOptions(options: Partial<GenericTypes & GenericLabels>) {\n if (options.genericLabels && options.genericTypes) {\n const {genericLabels, genericTypes, ...ops} = options;\n\n return {\n ...ops,\n generics: getGenericsMap(genericLabels, genericTypes)\n };\n }\n\n return options;\n}\n\n/**\n * @ignore\n * @param value\n */\nexport function popGenerics(value: NestedGenerics): NestedGenerics & GenericTypes {\n const [genericTypes, ...out] = value.nestedGenerics;\n\n return {\n genericTypes,\n nestedGenerics: out\n };\n}\n"]}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getJsonSchema = void 0;
|
|
4
|
-
require("../components");
|
|
5
4
|
const SpecTypes_1 = require("../domain/SpecTypes");
|
|
6
5
|
const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
|
|
7
6
|
const getJsonEntityStore_1 = require("./getJsonEntityStore");
|
|
7
|
+
require("../components/anyMapper");
|
|
8
|
+
require("../components/classMapper");
|
|
9
|
+
require("../components/genericsMapper");
|
|
10
|
+
require("../components/inheritedClassMapper");
|
|
11
|
+
require("../components/itemMapper");
|
|
12
|
+
require("../components/lazyRefMapper");
|
|
13
|
+
require("../components/mapMapper");
|
|
14
|
+
require("../components/objectMapper");
|
|
15
|
+
require("../components/ofMapper");
|
|
16
|
+
require("../components/propertiesMapper");
|
|
17
|
+
require("../components/schemaMapper");
|
|
8
18
|
/**
|
|
9
19
|
* @ignore
|
|
10
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":";;;AAEA,mDAA8C;AAE9C,uFAAmE;AACnE,6DAAwD;AACxD,mCAAiC;AACjC,qCAAmC;AACnC,wCAAsC;AACtC,8CAA4C;AAC5C,oCAAkC;AAClC,uCAAqC;AACrC,mCAAiC;AACjC,sCAAoC;AACpC,kCAAgC;AAChC,0CAAwC;AACxC,sCAAoC;AAEpC;;GAEG;AACH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;GAEG;AACH,SAAS,MAAM,CAAC,OAAY;IAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,GAAG,CAAC,MAAuB,EAAE,OAAY;IAChD,MAAM,KAAK,GAAqB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;IACzE,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,MAAM,GAAG,IAAA,sCAAU,EAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5D,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YACvC,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;SACtC;QAED,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KACxB;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,SAAgB,aAAa,CAAC,KAAsB,EAAE,UAA6B,EAAE;;IACnF,MAAM,MAAM,GAAG,IAAA,uCAAkB,EAAC,KAAK,CAAC,CAAC;IAEzC,OAAO,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE;QACV,GAAG,OAAO;QACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,qBAAS,CAAC,IAAI;QAC5C,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,IAAI,MAAM,CAAC,aAAa,KAAK,WAAW,EAAE;QACxC,OAAO,GAAG;YACR,GAAG,OAAO;YACV,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;YACtC,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAA,MAAM,CAAC,SAAS,0CAAE,MAAM;SACjC,CAAC;KACH;IAED,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC;AArBD,sCAqBC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport type {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\nimport \"../components/anyMapper\";\nimport \"../components/classMapper\";\nimport \"../components/genericsMapper\";\nimport \"../components/inheritedClassMapper\";\nimport \"../components/itemMapper\";\nimport \"../components/lazyRefMapper\";\nimport \"../components/mapMapper\";\nimport \"../components/objectMapper\";\nimport \"../components/ofMapper\";\nimport \"../components/propertiesMapper\";\nimport \"../components/schemaMapper\";\n\n/**\n * @ignore\n */\nconst CACHE_KEY = \"$cache:schemes\";\n\n/**\n * @ignore\n */\nfunction getKey(options: any) {\n return JSON.stringify(options);\n}\n\n/**\n * @ignore\n */\nfunction get(entity: JsonEntityStore, options: any) {\n const cache: Map<string, any> = entity.store.get(CACHE_KEY) || new Map();\n const key = getKey(options);\n\n if (!cache.has(key)) {\n const schema = execMapper(\"schema\", entity.schema, options);\n\n if (Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n cache.set(key, schema);\n }\n\n entity.store.set(CACHE_KEY, cache);\n\n return cache.get(key);\n}\n\nexport function getJsonSchema(model: Type<any> | any, options: JsonSchemaOptions = {}) {\n const entity = getJsonEntityStore(model);\n\n options = {\n endpoint: true,\n groups: [],\n ...options,\n specType: options.specType || SpecTypes.JSON,\n schemas: {}\n };\n\n if (entity.decoratorType === \"parameter\") {\n options = {\n ...options,\n genericTypes: entity.nestedGenerics[0],\n nestedGenerics: entity.nestedGenerics,\n groups: entity.parameter?.groups\n };\n }\n\n return get(entity, options);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getJsonType.js","sourceRoot":"","sources":["../../../src/utils/getJsonType.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"getJsonType.js","sourceRoot":"","sources":["../../../src/utils/getJsonType.ts"],"names":[],"mappings":";;;AAAA,qCAA+F;AAE/F;;GAEG;AACU,QAAA,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAEvG,SAAgB,WAAW,CAAC,KAAU;IACpC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,IAAA,kCAA2B,EAAC,KAAK,CAAC,EAAE;QACtC,IAAI,kBAAU,CAAC,OAAO,CAAC,KAAe,CAAC,GAAG,CAAC,CAAC,EAAE;YAC5C,OAAO,KAAK,CAAC;SACd;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,IAAI,KAAK,KAAK,MAAM,EAAE;gBACpB,OAAO,MAAM,CAAC;aACf;YAED,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,IAAA,kBAAW,EAAC,KAAK,CAAC,CAAC;KAC3B;IAED,IAAI,KAAK,KAAK,KAAK,EAAE;QACnB,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,IAAA,cAAO,EAAC,KAAK,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,CAAQ,CAAC;KACtC;IAED,IAAI,KAAK,KAAK,GAAG,EAAE;QACjB,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,IAAA,aAAM,EAAC,KAAK,CAAC,IAAI,IAAA,eAAQ,EAAC,KAAK,CAAC,EAAE;QACpC,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAtCD,kCAsCC","sourcesContent":["import {isArray, isBuffer, isDate, isPrimitiveOrPrimitiveClass, primitiveOf} from \"@tsed/core\";\n\n/**\n * @ignore\n */\nexport const JSON_TYPES = [\"string\", \"number\", \"integer\", \"boolean\", \"object\", \"array\", \"null\", \"any\"];\n\nexport function getJsonType(value: any): string {\n if (value === null) {\n return \"null\";\n }\n\n if (isPrimitiveOrPrimitiveClass(value)) {\n if (JSON_TYPES.indexOf(value as string) > -1) {\n return value;\n }\n\n if (typeof value === \"string\") {\n if (value === \"file\") {\n return \"file\";\n }\n\n return \"generic\";\n }\n\n return primitiveOf(value);\n }\n\n if (value === Array) {\n return \"array\";\n }\n\n if (isArray(value)) {\n return value.map(getJsonType) as any;\n }\n\n if (value === Set) {\n return \"array\";\n }\n\n if (isDate(value) || isBuffer(value)) {\n return \"string\";\n }\n\n return \"object\";\n}\n"]}
|
|
@@ -4,9 +4,10 @@ exports.getOperationsRoutes = void 0;
|
|
|
4
4
|
const getOperationsStores_1 = require("./getOperationsStores");
|
|
5
5
|
const JsonOperationRoute_1 = require("../domain/JsonOperationRoute");
|
|
6
6
|
const getJsonEntityStore_1 = require("./getJsonEntityStore");
|
|
7
|
+
const concatPath_1 = require("./concatPath");
|
|
7
8
|
function getOperationsRoutes(token, options = {}) {
|
|
8
9
|
const store = token.isStore ? token : (0, getJsonEntityStore_1.getJsonEntityStore)(token);
|
|
9
|
-
const basePath = ((options.basePath
|
|
10
|
+
const basePath = (0, concatPath_1.concatPath)(options.basePath, store.path);
|
|
10
11
|
let operationsRoutes = [];
|
|
11
12
|
if (options.withChildren) {
|
|
12
13
|
const children = store.get("childrenControllers", []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationsRoutes.js","sourceRoot":"","sources":["../../../src/utils/getOperationsRoutes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getOperationsRoutes.js","sourceRoot":"","sources":["../../../src/utils/getOperationsRoutes.ts"],"names":[],"mappings":";;;AAEA,+DAA0D;AAC1D,qEAAgE;AAEhE,6DAAwD;AACxD,6CAAwC;AAOxC,SAAgB,mBAAmB,CACjC,KAAsB,EACtB,UAAsC,EAAE;IAExC,MAAM,KAAK,GAAoB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,uCAAkB,EAAC,KAAK,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,IAAA,uBAAU,EAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,gBAAgB,GAAiC,EAAE,CAAC;IAExD,IAAI,OAAO,CAAC,YAAY,EAAE;QACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAS,qBAAqB,EAAE,EAAE,CAAC,CAAC;QAE9D,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,gBAAgB,EAAE,KAAK,EAAE,EAAE;YAC7D,OAAO,gBAAgB,CAAC,MAAM,CAC5B,mBAAmB,CAAC,KAAK,EAAE;gBACzB,GAAG,OAAO;gBACV,QAAQ;aACT,CAAC,CACH,CAAC;QACJ,CAAC,EAAE,gBAAgB,CAAC,CAAC;KACtB;IAED,OAAO,CAAC,GAAG,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;QAC1E,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;QAE7B,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACjD,MAAM,CAAC,IAAI,CACT,IAAI,uCAAkB,CAAS;oBAC7B,QAAQ;oBACR,KAAK;oBACL,QAAQ;oBACR,aAAa;iBACd,CAAC,CACH,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,gBAAgB,CAAC,CAAC;AACvB,CAAC;AAvCD,kDAuCC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {JsonMethodStore} from \"../domain/JsonMethodStore\";\nimport {getOperationsStores} from \"./getOperationsStores\";\nimport {JsonOperationRoute} from \"../domain/JsonOperationRoute\";\nimport {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\nimport {concatPath} from \"./concatPath\";\n\nexport interface GetOperationsRoutesOptions {\n withChildren?: boolean;\n basePath?: string;\n}\n\nexport function getOperationsRoutes<Entity extends JsonMethodStore = JsonMethodStore>(\n token: Type<any> | any,\n options: GetOperationsRoutesOptions = {}\n): JsonOperationRoute<Entity>[] {\n const store: JsonEntityStore = token.isStore ? token : getJsonEntityStore(token);\n const basePath = concatPath(options.basePath, store.path);\n let operationsRoutes: JsonOperationRoute<Entity>[] = [];\n\n if (options.withChildren) {\n const children = store.get<Type[]>(\"childrenControllers\", []);\n\n operationsRoutes = children.reduce((operationsRoutes, token) => {\n return operationsRoutes.concat(\n getOperationsRoutes(token, {\n ...options,\n basePath\n })\n );\n }, operationsRoutes);\n }\n\n return [...getOperationsStores(token).values()].reduce((routes, endpoint) => {\n const {operation} = endpoint;\n\n if (operation) {\n operation.operationPaths.forEach((operationPath) => {\n routes.push(\n new JsonOperationRoute<Entity>({\n basePath,\n token,\n endpoint,\n operationPath\n })\n );\n });\n }\n\n return routes;\n }, operationsRoutes);\n}\n"]}
|