@tsed/schema 7.48.0 → 7.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.js +2 -2
- package/lib/browser/schema.umd.min.js +1 -1
- package/lib/browser/schema.umd.min.js.map +1 -1
- package/lib/cjs/components/async-api/channelsMapper.js +62 -0
- package/lib/cjs/components/async-api/channelsMapper.js.map +1 -0
- package/lib/cjs/components/async-api/generate.js +20 -0
- package/lib/cjs/components/async-api/generate.js.map +1 -0
- package/lib/cjs/components/async-api/messageMapper.js +44 -0
- package/lib/cjs/components/async-api/messageMapper.js.map +1 -0
- package/lib/cjs/components/async-api/payloadMapper.js +52 -0
- package/lib/cjs/components/async-api/payloadMapper.js.map +1 -0
- package/lib/cjs/components/async-api/responseMapper.js +58 -0
- package/lib/cjs/components/async-api/responseMapper.js.map +1 -0
- package/lib/cjs/components/{anyMapper.js → default/anyMapper.js} +9 -9
- package/lib/cjs/components/default/anyMapper.js.map +1 -0
- package/lib/cjs/components/{classMapper.js → default/classMapper.js} +11 -9
- package/lib/cjs/components/default/classMapper.js.map +1 -0
- package/lib/cjs/components/{genericsMapper.js → default/genericsMapper.js} +6 -6
- package/lib/cjs/components/default/genericsMapper.js.map +1 -0
- package/lib/cjs/components/{inheritedClassMapper.js → default/inheritedClassMapper.js} +3 -3
- package/lib/cjs/components/default/inheritedClassMapper.js.map +1 -0
- package/lib/cjs/components/{itemMapper.js → default/itemMapper.js} +2 -2
- package/lib/cjs/components/default/itemMapper.js.map +1 -0
- package/lib/cjs/components/{lazyRefMapper.js → default/lazyRefMapper.js} +4 -4
- package/lib/cjs/components/default/lazyRefMapper.js.map +1 -0
- package/lib/cjs/components/{mapMapper.js → default/mapMapper.js} +3 -3
- package/lib/cjs/components/default/mapMapper.js.map +1 -0
- package/lib/cjs/components/{objectMapper.js → default/objectMapper.js} +5 -5
- package/lib/cjs/components/default/objectMapper.js.map +1 -0
- package/lib/cjs/components/{ofMapper.js → default/ofMapper.js} +2 -2
- package/lib/cjs/components/default/ofMapper.js.map +1 -0
- package/lib/cjs/components/{propertiesMapper.js → default/propertiesMapper.js} +3 -3
- package/lib/cjs/components/default/propertiesMapper.js.map +1 -0
- package/lib/cjs/components/{schemaMapper.js → default/schemaMapper.js} +16 -16
- package/lib/cjs/components/default/schemaMapper.js.map +1 -0
- package/lib/cjs/components/index.js +26 -20
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/open-spec/generate.js +24 -0
- package/lib/cjs/components/open-spec/generate.js.map +1 -0
- package/lib/cjs/components/{operationInFilesMapper.js → open-spec/operationInFilesMapper.js} +1 -1
- package/lib/cjs/components/open-spec/operationInFilesMapper.js.map +1 -0
- package/lib/cjs/components/{operationInParameterMapper.js → open-spec/operationInParameterMapper.js} +7 -7
- package/lib/cjs/components/open-spec/operationInParameterMapper.js.map +1 -0
- package/lib/cjs/components/{operationInParametersMapper.js → open-spec/operationInParametersMapper.js} +2 -2
- package/lib/cjs/components/open-spec/operationInParametersMapper.js.map +1 -0
- package/lib/cjs/components/{operationInQueryMapper.js → open-spec/operationInQueryMapper.js} +4 -4
- package/lib/cjs/components/open-spec/operationInQueryMapper.js.map +1 -0
- package/lib/cjs/components/{operationMapper.js → open-spec/operationMapper.js} +6 -6
- package/lib/cjs/components/open-spec/operationMapper.js.map +1 -0
- package/lib/cjs/components/{operationMediaMapper.js → open-spec/operationMediaMapper.js} +2 -2
- package/lib/cjs/components/open-spec/operationMediaMapper.js.map +1 -0
- package/lib/cjs/components/{operationRequestBodyMapper.js → open-spec/operationRequestBodyMapper.js} +5 -5
- package/lib/cjs/components/open-spec/operationRequestBodyMapper.js.map +1 -0
- package/lib/cjs/components/{operationResponseMapper.js → open-spec/operationResponseMapper.js} +2 -2
- package/lib/cjs/components/open-spec/operationResponseMapper.js.map +1 -0
- package/lib/cjs/components/{pathsMapper.js → open-spec/pathsMapper.js} +38 -33
- package/lib/cjs/components/open-spec/pathsMapper.js.map +1 -0
- package/lib/cjs/constants/OperationVerbs.js +36 -0
- package/lib/cjs/constants/OperationVerbs.js.map +1 -0
- package/lib/cjs/decorators/operations/operation.js +45 -0
- package/lib/cjs/decorators/operations/operation.js.map +1 -0
- package/lib/cjs/decorators/operations/operationPath.js.map +1 -1
- package/lib/cjs/decorators/operations/publish.js +10 -0
- package/lib/cjs/decorators/operations/publish.js.map +1 -0
- package/lib/cjs/decorators/operations/route.js +14 -49
- package/lib/cjs/decorators/operations/route.js.map +1 -1
- package/lib/cjs/decorators/operations/subscribe.js +10 -0
- package/lib/cjs/decorators/operations/subscribe.js.map +1 -0
- package/lib/cjs/domain/JsonEntityStore.js +0 -4
- package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
- package/lib/cjs/domain/JsonMap.js +1 -1
- package/lib/cjs/domain/JsonMap.js.map +1 -1
- package/lib/cjs/domain/JsonOperation.js +6 -0
- package/lib/cjs/domain/JsonOperation.js.map +1 -1
- package/lib/cjs/domain/JsonOperationPathsMap.js +4 -5
- package/lib/cjs/domain/JsonOperationPathsMap.js.map +1 -1
- package/lib/cjs/domain/JsonParameter.js +1 -1
- package/lib/cjs/domain/JsonParameter.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js +1 -1
- 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 +33 -22
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/registries/JsonSchemaMapperContainer.js +13 -11
- package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/cjs/utils/getJsonSchema.js +7 -4
- package/lib/cjs/utils/getJsonSchema.js.map +1 -1
- package/lib/cjs/utils/getOperationsRoutes.js +3 -3
- package/lib/cjs/utils/getOperationsRoutes.js.map +1 -1
- package/lib/cjs/utils/getSpec.js +4 -14
- package/lib/cjs/utils/getSpec.js.map +1 -1
- package/lib/cjs/utils/mapOperationOptions.js +31 -0
- package/lib/cjs/utils/mapOperationOptions.js.map +1 -0
- package/lib/cjs/utils/operationIdFormatter.js +5 -1
- package/lib/cjs/utils/operationIdFormatter.js.map +1 -1
- package/lib/cjs/utils/ref.js +2 -2
- package/lib/cjs/utils/ref.js.map +1 -1
- package/lib/cjs/utils/removeHiddenOperation.js +8 -0
- package/lib/cjs/utils/removeHiddenOperation.js.map +1 -0
- package/lib/cjs/utils/somethingOf.js +16 -0
- package/lib/cjs/utils/somethingOf.js.map +1 -0
- package/lib/esm/components/async-api/channelsMapper.js +58 -0
- package/lib/esm/components/async-api/channelsMapper.js.map +1 -0
- package/lib/esm/components/async-api/generate.js +18 -0
- package/lib/esm/components/async-api/generate.js.map +1 -0
- package/lib/esm/components/async-api/messageMapper.js +40 -0
- package/lib/esm/components/async-api/messageMapper.js.map +1 -0
- package/lib/esm/components/async-api/payloadMapper.js +48 -0
- package/lib/esm/components/async-api/payloadMapper.js.map +1 -0
- package/lib/esm/components/async-api/responseMapper.js +54 -0
- package/lib/esm/components/async-api/responseMapper.js.map +1 -0
- package/lib/esm/components/{anyMapper.js → default/anyMapper.js} +9 -9
- package/lib/esm/components/default/anyMapper.js.map +1 -0
- package/lib/esm/components/{classMapper.js → default/classMapper.js} +11 -9
- package/lib/esm/components/default/classMapper.js.map +1 -0
- package/lib/esm/components/{genericsMapper.js → default/genericsMapper.js} +6 -6
- package/lib/esm/components/default/genericsMapper.js.map +1 -0
- package/lib/esm/components/{inheritedClassMapper.js → default/inheritedClassMapper.js} +3 -3
- package/lib/esm/components/default/inheritedClassMapper.js.map +1 -0
- package/lib/esm/components/default/itemMapper.js +6 -0
- package/lib/esm/components/default/itemMapper.js.map +1 -0
- package/lib/esm/components/{lazyRefMapper.js → default/lazyRefMapper.js} +4 -4
- package/lib/esm/components/default/lazyRefMapper.js.map +1 -0
- package/lib/esm/components/{mapMapper.js → default/mapMapper.js} +3 -3
- package/lib/esm/components/default/mapMapper.js.map +1 -0
- package/lib/esm/components/{objectMapper.js → default/objectMapper.js} +5 -5
- package/lib/esm/components/default/objectMapper.js.map +1 -0
- package/lib/esm/components/{ofMapper.js → default/ofMapper.js} +2 -2
- package/lib/esm/components/default/ofMapper.js.map +1 -0
- package/lib/esm/components/{propertiesMapper.js → default/propertiesMapper.js} +3 -3
- package/lib/esm/components/default/propertiesMapper.js.map +1 -0
- package/lib/esm/components/{schemaMapper.js → default/schemaMapper.js} +17 -17
- package/lib/esm/components/default/schemaMapper.js.map +1 -0
- package/lib/esm/components/index.js +26 -20
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/open-spec/generate.js +22 -0
- package/lib/esm/components/open-spec/generate.js.map +1 -0
- package/lib/esm/components/{operationInFilesMapper.js → open-spec/operationInFilesMapper.js} +1 -1
- package/lib/esm/components/open-spec/operationInFilesMapper.js.map +1 -0
- package/lib/esm/components/{operationInParameterMapper.js → open-spec/operationInParameterMapper.js} +7 -7
- package/lib/esm/components/open-spec/operationInParameterMapper.js.map +1 -0
- package/lib/esm/components/{operationInParametersMapper.js → open-spec/operationInParametersMapper.js} +2 -2
- package/lib/esm/components/open-spec/operationInParametersMapper.js.map +1 -0
- package/lib/esm/components/{operationInQueryMapper.js → open-spec/operationInQueryMapper.js} +4 -4
- package/lib/esm/components/open-spec/operationInQueryMapper.js.map +1 -0
- package/lib/esm/components/{operationMapper.js → open-spec/operationMapper.js} +6 -6
- package/lib/esm/components/open-spec/operationMapper.js.map +1 -0
- package/lib/esm/components/open-spec/operationMediaMapper.js +7 -0
- package/lib/esm/components/open-spec/operationMediaMapper.js.map +1 -0
- package/lib/esm/components/{operationRequestBodyMapper.js → open-spec/operationRequestBodyMapper.js} +5 -5
- package/lib/esm/components/open-spec/operationRequestBodyMapper.js.map +1 -0
- package/lib/esm/components/{operationResponseMapper.js → open-spec/operationResponseMapper.js} +2 -2
- package/lib/esm/components/open-spec/operationResponseMapper.js.map +1 -0
- package/lib/esm/components/open-spec/pathsMapper.js +91 -0
- package/lib/esm/components/open-spec/pathsMapper.js.map +1 -0
- package/lib/esm/constants/OperationVerbs.js +33 -0
- package/lib/esm/constants/OperationVerbs.js.map +1 -0
- package/lib/esm/decorators/operations/operation.js +41 -0
- package/lib/esm/decorators/operations/operation.js.map +1 -0
- package/lib/esm/decorators/operations/operationPath.js.map +1 -1
- package/lib/esm/decorators/operations/publish.js +6 -0
- package/lib/esm/decorators/operations/publish.js.map +1 -0
- package/lib/esm/decorators/operations/route.js +14 -48
- package/lib/esm/decorators/operations/route.js.map +1 -1
- package/lib/esm/decorators/operations/subscribe.js +6 -0
- package/lib/esm/decorators/operations/subscribe.js.map +1 -0
- package/lib/esm/domain/JsonEntityStore.js +0 -4
- package/lib/esm/domain/JsonEntityStore.js.map +1 -1
- package/lib/esm/domain/JsonMap.js +1 -1
- package/lib/esm/domain/JsonMap.js.map +1 -1
- package/lib/esm/domain/JsonOperation.js +6 -0
- package/lib/esm/domain/JsonOperation.js.map +1 -1
- package/lib/esm/domain/JsonOperationPathsMap.js +4 -5
- package/lib/esm/domain/JsonOperationPathsMap.js.map +1 -1
- package/lib/esm/domain/JsonParameter.js +1 -1
- package/lib/esm/domain/JsonParameter.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +1 -1
- 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 +33 -22
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/registries/JsonSchemaMapperContainer.js +13 -11
- package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -1
- package/lib/esm/utils/getJsonSchema.js +7 -4
- package/lib/esm/utils/getJsonSchema.js.map +1 -1
- package/lib/esm/utils/getOperationsRoutes.js +3 -3
- package/lib/esm/utils/getOperationsRoutes.js.map +1 -1
- package/lib/esm/utils/getSpec.js +5 -15
- package/lib/esm/utils/getSpec.js.map +1 -1
- package/lib/{cjs/utils/mapRouteOptions.js → esm/utils/mapOperationOptions.js} +9 -8
- package/lib/esm/utils/mapOperationOptions.js.map +1 -0
- package/lib/esm/utils/operationIdFormatter.js +3 -0
- package/lib/esm/utils/operationIdFormatter.js.map +1 -1
- package/lib/esm/utils/ref.js +3 -3
- package/lib/esm/utils/ref.js.map +1 -1
- package/lib/esm/utils/removeHiddenOperation.js +4 -0
- package/lib/esm/utils/removeHiddenOperation.js.map +1 -0
- package/lib/esm/utils/somethingOf.js +12 -0
- package/lib/esm/utils/somethingOf.js.map +1 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/components/async-api/channelsMapper.d.ts +2 -0
- package/lib/types/components/async-api/generate.d.ts +1 -0
- package/lib/types/components/async-api/messageMapper.d.ts +6 -0
- package/lib/types/components/async-api/payloadMapper.d.ts +4 -0
- package/lib/types/components/async-api/responseMapper.d.ts +6 -0
- package/lib/types/components/{anyMapper.d.ts → default/anyMapper.d.ts} +1 -1
- package/lib/types/components/default/classMapper.d.ts +3 -0
- package/lib/types/components/{genericsMapper.d.ts → default/genericsMapper.d.ts} +1 -1
- package/lib/types/components/{inheritedClassMapper.d.ts → default/inheritedClassMapper.d.ts} +1 -1
- package/lib/types/components/{itemMapper.d.ts → default/itemMapper.d.ts} +1 -1
- package/lib/types/components/default/lazyRefMapper.d.ts +3 -0
- package/lib/types/components/{mapMapper.d.ts → default/mapMapper.d.ts} +1 -1
- package/lib/types/components/{objectMapper.d.ts → default/objectMapper.d.ts} +1 -1
- package/lib/types/components/default/ofMapper.d.ts +3 -0
- package/lib/types/components/default/propertiesMapper.d.ts +3 -0
- package/lib/types/components/default/schemaMapper.d.ts +3 -0
- package/lib/types/components/index.d.ts +26 -20
- package/lib/types/components/open-spec/generate.d.ts +1 -0
- package/lib/types/components/{operationInParameterMapper.d.ts → open-spec/operationInParameterMapper.d.ts} +2 -2
- package/lib/types/components/open-spec/operationInParametersMapper.d.ts +3 -0
- package/lib/types/components/open-spec/operationMapper.d.ts +3 -0
- package/lib/types/components/open-spec/operationMediaMapper.d.ts +3 -0
- package/lib/types/components/{operationRequestBodyMapper.d.ts → open-spec/operationRequestBodyMapper.d.ts} +2 -2
- package/lib/types/components/open-spec/operationResponseMapper.d.ts +3 -0
- package/lib/types/components/{pathsMapper.d.ts → open-spec/pathsMapper.d.ts} +1 -1
- package/lib/types/constants/OperationVerbs.d.ts +20 -0
- package/lib/types/decorators/operations/operation.d.ts +60 -0
- package/lib/types/decorators/operations/operationPath.d.ts +2 -2
- package/lib/types/decorators/operations/publish.d.ts +1 -0
- package/lib/types/decorators/operations/route.d.ts +11 -66
- package/lib/types/decorators/operations/subscribe.d.ts +1 -0
- package/lib/types/domain/JsonOperation.d.ts +1 -0
- package/lib/types/domain/SpecTypes.d.ts +2 -1
- package/lib/types/index.d.ts +33 -22
- package/lib/types/interfaces/JsonSchemaOptions.d.ts +3 -4
- package/lib/types/registries/JsonSchemaMapperContainer.d.ts +6 -5
- package/lib/types/utils/getOperationsRoutes.d.ts +2 -0
- package/lib/types/utils/getSpec.d.ts +5 -1
- package/lib/types/utils/{mapRouteOptions.d.ts → mapOperationOptions.d.ts} +1 -1
- package/lib/types/utils/operationIdFormatter.d.ts +2 -0
- package/lib/types/utils/removeHiddenOperation.d.ts +2 -0
- package/lib/types/utils/somethingOf.d.ts +1 -0
- package/package.json +6 -6
- package/lib/cjs/components/anyMapper.js.map +0 -1
- package/lib/cjs/components/classMapper.js.map +0 -1
- package/lib/cjs/components/genericsMapper.js.map +0 -1
- package/lib/cjs/components/inheritedClassMapper.js.map +0 -1
- package/lib/cjs/components/itemMapper.js.map +0 -1
- package/lib/cjs/components/lazyRefMapper.js.map +0 -1
- package/lib/cjs/components/mapMapper.js.map +0 -1
- package/lib/cjs/components/objectMapper.js.map +0 -1
- package/lib/cjs/components/ofMapper.js.map +0 -1
- package/lib/cjs/components/operationInFilesMapper.js.map +0 -1
- package/lib/cjs/components/operationInParameterMapper.js.map +0 -1
- package/lib/cjs/components/operationInParametersMapper.js.map +0 -1
- package/lib/cjs/components/operationInQueryMapper.js.map +0 -1
- package/lib/cjs/components/operationMapper.js.map +0 -1
- package/lib/cjs/components/operationMediaMapper.js.map +0 -1
- package/lib/cjs/components/operationRequestBodyMapper.js.map +0 -1
- package/lib/cjs/components/operationResponseMapper.js.map +0 -1
- package/lib/cjs/components/pathsMapper.js.map +0 -1
- package/lib/cjs/components/propertiesMapper.js.map +0 -1
- package/lib/cjs/components/schemaMapper.js.map +0 -1
- package/lib/cjs/constants/httpMethods.js +0 -46
- package/lib/cjs/constants/httpMethods.js.map +0 -1
- package/lib/cjs/utils/mapRouteOptions.js.map +0 -1
- package/lib/esm/components/anyMapper.js.map +0 -1
- package/lib/esm/components/classMapper.js.map +0 -1
- package/lib/esm/components/genericsMapper.js.map +0 -1
- package/lib/esm/components/inheritedClassMapper.js.map +0 -1
- package/lib/esm/components/itemMapper.js +0 -6
- package/lib/esm/components/itemMapper.js.map +0 -1
- package/lib/esm/components/lazyRefMapper.js.map +0 -1
- package/lib/esm/components/mapMapper.js.map +0 -1
- package/lib/esm/components/objectMapper.js.map +0 -1
- package/lib/esm/components/ofMapper.js.map +0 -1
- package/lib/esm/components/operationInFilesMapper.js.map +0 -1
- package/lib/esm/components/operationInParameterMapper.js.map +0 -1
- package/lib/esm/components/operationInParametersMapper.js.map +0 -1
- package/lib/esm/components/operationInQueryMapper.js.map +0 -1
- package/lib/esm/components/operationMapper.js.map +0 -1
- package/lib/esm/components/operationMediaMapper.js +0 -7
- package/lib/esm/components/operationMediaMapper.js.map +0 -1
- package/lib/esm/components/operationRequestBodyMapper.js.map +0 -1
- package/lib/esm/components/operationResponseMapper.js.map +0 -1
- package/lib/esm/components/pathsMapper.js +0 -86
- package/lib/esm/components/pathsMapper.js.map +0 -1
- package/lib/esm/components/propertiesMapper.js.map +0 -1
- package/lib/esm/components/schemaMapper.js.map +0 -1
- package/lib/esm/constants/httpMethods.js +0 -43
- package/lib/esm/constants/httpMethods.js.map +0 -1
- package/lib/esm/utils/mapRouteOptions.js +0 -22
- package/lib/esm/utils/mapRouteOptions.js.map +0 -1
- package/lib/types/components/classMapper.d.ts +0 -3
- package/lib/types/components/lazyRefMapper.d.ts +0 -3
- package/lib/types/components/ofMapper.d.ts +0 -3
- package/lib/types/components/operationInParametersMapper.d.ts +0 -3
- package/lib/types/components/operationMapper.d.ts +0 -3
- package/lib/types/components/operationMediaMapper.d.ts +0 -3
- package/lib/types/components/operationResponseMapper.d.ts +0 -3
- package/lib/types/components/propertiesMapper.d.ts +0 -3
- package/lib/types/components/schemaMapper.d.ts +0 -3
- package/lib/types/constants/httpMethods.d.ts +0 -12
- /package/lib/types/components/{operationInFilesMapper.d.ts → open-spec/operationInFilesMapper.d.ts} +0 -0
- /package/lib/types/components/{operationInQueryMapper.d.ts → open-spec/operationInQueryMapper.d.ts} +0 -0
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.schemaMapper = void 0;
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
|
-
const JsonAliasMap_1 = require("
|
|
6
|
-
const SpecTypes_1 = require("
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const inlineEnums_1 = require("
|
|
11
|
-
const mapNullableType_1 = require("
|
|
5
|
+
const JsonAliasMap_1 = require("../../domain/JsonAliasMap");
|
|
6
|
+
const SpecTypes_1 = require("../../domain/SpecTypes");
|
|
7
|
+
const alterOneOf_1 = require("../../hooks/alterOneOf");
|
|
8
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
9
|
+
const getRequiredProperties_1 = require("../../utils/getRequiredProperties");
|
|
10
|
+
const inlineEnums_1 = require("../../utils/inlineEnums");
|
|
11
|
+
const mapNullableType_1 = require("../../utils/mapNullableType");
|
|
12
12
|
/**
|
|
13
13
|
* @ignore
|
|
14
14
|
*/
|
|
@@ -38,19 +38,19 @@ function shouldSkipKey(key, { specType = SpecTypes_1.SpecTypes.JSON, customKeys
|
|
|
38
38
|
(specType !== SpecTypes_1.SpecTypes.JSON && IGNORES_OPENSPEC.includes(key)));
|
|
39
39
|
}
|
|
40
40
|
function isExample(key, value, options) {
|
|
41
|
-
return key === "examples" && (0, core_1.isObject)(value) && SpecTypes_1.SpecTypes.OPENAPI
|
|
41
|
+
return key === "examples" && (0, core_1.isObject)(value) && [SpecTypes_1.SpecTypes.OPENAPI, SpecTypes_1.SpecTypes.ASYNCAPI].includes(options.specType);
|
|
42
42
|
}
|
|
43
43
|
function mapOptions(options) {
|
|
44
44
|
let addDef = false;
|
|
45
45
|
if (!options) {
|
|
46
46
|
addDef = true;
|
|
47
|
-
options = { schemas: {}, inlineEnums: true };
|
|
47
|
+
options = { components: { schemas: {} }, inlineEnums: true };
|
|
48
48
|
}
|
|
49
|
-
const { useAlias = true,
|
|
49
|
+
const { useAlias = true, components = { schemas: {} } } = options;
|
|
50
50
|
options = {
|
|
51
51
|
...options,
|
|
52
52
|
useAlias,
|
|
53
|
-
|
|
53
|
+
components
|
|
54
54
|
};
|
|
55
55
|
return {
|
|
56
56
|
addDef,
|
|
@@ -75,7 +75,7 @@ function mapKeys(schema, options) {
|
|
|
75
75
|
value = Object.values(value)[0];
|
|
76
76
|
}
|
|
77
77
|
if (value && typeof value === "object" && (0, JsonSchemaMapperContainer_1.hasMapper)(key)) {
|
|
78
|
-
value = (0, JsonSchemaMapperContainer_1.execMapper)(key, value, options, schema);
|
|
78
|
+
value = (0, JsonSchemaMapperContainer_1.execMapper)(key, [value], options, schema);
|
|
79
79
|
if (isEmptyProperties(key, value)) {
|
|
80
80
|
return item;
|
|
81
81
|
}
|
|
@@ -92,13 +92,13 @@ function mapKeys(schema, options) {
|
|
|
92
92
|
function serializeSchema(schema, options) {
|
|
93
93
|
let obj = mapKeys(schema, options);
|
|
94
94
|
if (schema.isClass) {
|
|
95
|
-
obj = (0, JsonSchemaMapperContainer_1.execMapper)("inheritedClass", obj, {
|
|
95
|
+
obj = (0, JsonSchemaMapperContainer_1.execMapper)("inheritedClass", [obj], {
|
|
96
96
|
...options,
|
|
97
97
|
root: false,
|
|
98
98
|
target: schema.getComputedType()
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
obj = (0, JsonSchemaMapperContainer_1.execMapper)("generics", obj, {
|
|
101
|
+
obj = (0, JsonSchemaMapperContainer_1.execMapper)("generics", [obj], {
|
|
102
102
|
...options,
|
|
103
103
|
root: false
|
|
104
104
|
});
|
|
@@ -117,8 +117,8 @@ function serializeSchema(schema, options) {
|
|
|
117
117
|
function schemaMapper(schema, opts) {
|
|
118
118
|
const { options, addDef } = mapOptions(opts);
|
|
119
119
|
const obj = serializeSchema(schema, options);
|
|
120
|
-
if (addDef &&
|
|
121
|
-
obj.definitions = options.schemas;
|
|
120
|
+
if (addDef && Object.keys((0, core_1.getValue)(options, "components.schemas", {})).length) {
|
|
121
|
+
obj.definitions = options.components.schemas;
|
|
122
122
|
}
|
|
123
123
|
return obj;
|
|
124
124
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaMapper.js","sourceRoot":"","sources":["../../../../src/components/default/schemaMapper.ts"],"names":[],"mappings":";;;AAAA,qCAA8C;AAC9C,4DAA+D;AAE/D,sDAAiD;AACjD,uDAAkD;AAElD,0FAA2G;AAC3G,6EAAwE;AACxE,yDAAoD;AACpD,iEAA4D;AAE5D;;GAEG;AACH,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAE,qBAAS,CAAC,OAAO,EAAE,qBAAS,CAAC,OAAO,EAAE,qBAAS,CAAC,IAAI,CAAC,CAAC;AACzH;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,CAAC;AAEnC;;GAEG;AACH,SAAS,iBAAiB,CAAC,GAAW,EAAE,KAAU;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,EAAE,YAAY,E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CAAC,CAAC;IACvC,GAAG,GAAG,IAAA,yBAAW,EAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAExC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,YAAY,CAAC,MAAkB,EAAE,IAAuB;IACtE,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE7C,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,IAAA,eAAQ,EAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;QAC7E,GAAG,CAAC,WAAW,GAAG,OAAO,CAAC,UAAW,CAAC,OAAO,CAAC;KAC/C;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,oCAUC;AAED,IAAA,oDAAwB,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -4,24 +4,30 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
tslib_1.__exportStar(require("./
|
|
8
|
-
tslib_1.__exportStar(require("./
|
|
9
|
-
tslib_1.__exportStar(require("./
|
|
10
|
-
tslib_1.__exportStar(require("./
|
|
11
|
-
tslib_1.__exportStar(require("./
|
|
12
|
-
tslib_1.__exportStar(require("./
|
|
13
|
-
tslib_1.__exportStar(require("./
|
|
14
|
-
tslib_1.__exportStar(require("./
|
|
15
|
-
tslib_1.__exportStar(require("./
|
|
16
|
-
tslib_1.__exportStar(require("./
|
|
17
|
-
tslib_1.__exportStar(require("./
|
|
18
|
-
tslib_1.__exportStar(require("./
|
|
19
|
-
tslib_1.__exportStar(require("./
|
|
20
|
-
tslib_1.__exportStar(require("./
|
|
21
|
-
tslib_1.__exportStar(require("./
|
|
22
|
-
tslib_1.__exportStar(require("./
|
|
23
|
-
tslib_1.__exportStar(require("./
|
|
24
|
-
tslib_1.__exportStar(require("./
|
|
25
|
-
tslib_1.__exportStar(require("./
|
|
26
|
-
tslib_1.__exportStar(require("./
|
|
7
|
+
tslib_1.__exportStar(require("./async-api/channelsMapper"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./async-api/generate"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./async-api/messageMapper"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./async-api/payloadMapper"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./async-api/responseMapper"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./default/anyMapper"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./default/classMapper"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./default/genericsMapper"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./default/inheritedClassMapper"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./default/itemMapper"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./default/lazyRefMapper"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./default/mapMapper"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./default/objectMapper"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./default/ofMapper"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./default/propertiesMapper"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./default/schemaMapper"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./open-spec/generate"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./open-spec/operationInFilesMapper"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./open-spec/operationInParameterMapper"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./open-spec/operationInParametersMapper"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./open-spec/operationInQueryMapper"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./open-spec/operationMapper"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./open-spec/operationMediaMapper"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./open-spec/operationRequestBodyMapper"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./open-spec/operationResponseMapper"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./open-spec/pathsMapper"), exports);
|
|
27
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,qEAA2C;AAC3C,+DAAqC;AACrC,oEAA0C;AAC1C,oEAA0C;AAC1C,qEAA2C;AAC3C,8DAAoC;AACpC,gEAAsC;AACtC,mEAAyC;AACzC,yEAA+C;AAC/C,+DAAqC;AACrC,kEAAwC;AACxC,8DAAoC;AACpC,iEAAuC;AACvC,6DAAmC;AACnC,qEAA2C;AAC3C,iEAAuC;AACvC,+DAAqC;AACrC,6EAAmD;AACnD,iFAAuD;AACvD,kFAAwD;AACxD,6EAAmD;AACnD,sEAA4C;AAC5C,2EAAiD;AACjD,iFAAuD;AACvD,8EAAoD;AACpD,kEAAwC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@tsed/core");
|
|
4
|
+
const SpecTypes_1 = require("../../domain/SpecTypes");
|
|
5
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
6
|
+
function generate(model, options) {
|
|
7
|
+
options = {
|
|
8
|
+
...options,
|
|
9
|
+
specType: SpecTypes_1.SpecTypes.OPENAPI
|
|
10
|
+
};
|
|
11
|
+
const specJson = {
|
|
12
|
+
paths: (0, JsonSchemaMapperContainer_1.execMapper)("paths", [model], options)
|
|
13
|
+
};
|
|
14
|
+
specJson.tags = (0, core_1.uniqBy)(options.tags, "name");
|
|
15
|
+
if (Object.keys((0, core_1.getValue)(options, "components.schemas", {})).length) {
|
|
16
|
+
specJson.components = {
|
|
17
|
+
schemas: options.components.schemas
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return specJson;
|
|
21
|
+
}
|
|
22
|
+
(0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("generate", generate, SpecTypes_1.SpecTypes.OPENAPI);
|
|
23
|
+
(0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("generate", generate, SpecTypes_1.SpecTypes.SWAGGER);
|
|
24
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/components/open-spec/generate.ts"],"names":[],"mappings":";;AAAA,qCAAkD;AAClD,sDAAiD;AACjD,0FAAgG;AAGhG,SAAS,QAAQ,CAAC,KAAgB,EAAE,OAA8B;IAChE,OAAO,GAAG;QACR,GAAG,OAAO;QACV,QAAQ,EAAE,qBAAS,CAAC,OAAO;KAC5B,CAAC;IAEF,MAAM,QAAQ,GAAQ;QACpB,KAAK,EAAE,IAAA,sCAAU,EAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;KAC7C,CAAC;IAEF,QAAQ,CAAC,IAAI,GAAG,IAAA,aAAM,EAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE7C,IAAI,MAAM,CAAC,IAAI,CAAC,IAAA,eAAQ,EAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;QACnE,QAAQ,CAAC,UAAU,GAAG;YACpB,OAAO,EAAE,OAAO,CAAC,UAAW,CAAC,OAAO;SACrC,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,IAAA,oDAAwB,EAAC,UAAU,EAAE,QAAQ,EAAE,qBAAS,CAAC,OAAO,CAAC,CAAC;AAClE,IAAA,oDAAwB,EAAC,UAAU,EAAE,QAAQ,EAAE,qBAAS,CAAC,OAAO,CAAC,CAAC"}
|
package/lib/cjs/components/{operationInFilesMapper.js → open-spec/operationInFilesMapper.js}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationInFilesMapper = void 0;
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
5
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
6
6
|
function operationInFilesMapper(parameter, { jsonSchema }) {
|
|
7
7
|
const schema = {
|
|
8
8
|
type: "string",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationInFilesMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationInFilesMapper.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,0FAAoF;AAGpF,SAAgB,sBAAsB,CAAC,SAAc,EAAE,EAAC,UAAU,EAAuB;IACvF,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,SAAS;KACjB,CAAC;IAEF,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAA,kBAAW,EAAC;YAC7B,GAAI,UAAU,CAAC,KAAgB;YAC/B,GAAG,MAAM;SACV,CAAC,CAAC;QAEH,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC;QAE9B,OAAO,SAAS,CAAC;KAClB;IAED,SAAS,CAAC,MAAM,GAAG,IAAA,kBAAW,EAAC;QAC7B,GAAG,UAAU;QACb,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC;AAxBD,wDAwBC;AAED,IAAA,oDAAwB,EAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC"}
|
package/lib/cjs/components/{operationInParameterMapper.js → open-spec/operationInParameterMapper.js}
RENAMED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationInParameterMapper = void 0;
|
|
4
4
|
const change_case_1 = require("change-case");
|
|
5
|
-
const JsonParameterTypes_1 = require("
|
|
6
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
7
|
-
const generics_1 = require("
|
|
5
|
+
const JsonParameterTypes_1 = require("../../domain/JsonParameterTypes");
|
|
6
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
7
|
+
const generics_1 = require("../../utils/generics");
|
|
8
8
|
function mapOptions(parameter, options = {}) {
|
|
9
9
|
return {
|
|
10
10
|
...options,
|
|
@@ -14,9 +14,9 @@ function mapOptions(parameter, options = {}) {
|
|
|
14
14
|
}
|
|
15
15
|
function operationInParameterMapper(jsonParameter, opts) {
|
|
16
16
|
const options = mapOptions(jsonParameter, opts);
|
|
17
|
-
const schemas = { ...(options.schemas || {}) };
|
|
18
|
-
const { type, schema, ...parameter } = (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonParameter, options);
|
|
19
|
-
const jsonSchema = (0, JsonSchemaMapperContainer_1.execMapper)("item", jsonParameter.$schema, {
|
|
17
|
+
const schemas = { ...(options.components?.schemas || {}) };
|
|
18
|
+
const { type, schema, ...parameter } = (0, JsonSchemaMapperContainer_1.execMapper)("map", [jsonParameter], options);
|
|
19
|
+
const jsonSchema = (0, JsonSchemaMapperContainer_1.execMapper)("item", [jsonParameter.$schema], {
|
|
20
20
|
...options,
|
|
21
21
|
...(0, generics_1.popGenerics)(jsonParameter)
|
|
22
22
|
});
|
|
@@ -29,7 +29,7 @@ function operationInParameterMapper(jsonParameter, opts) {
|
|
|
29
29
|
};
|
|
30
30
|
const mapperName = (0, change_case_1.camelCase)(`operationIn ${jsonParameter.get("in")}`);
|
|
31
31
|
if ((0, JsonSchemaMapperContainer_1.hasMapper)(mapperName)) {
|
|
32
|
-
return (0, JsonSchemaMapperContainer_1.execMapper)(mapperName, parameter, paramOpts);
|
|
32
|
+
return (0, JsonSchemaMapperContainer_1.execMapper)(mapperName, [parameter], paramOpts);
|
|
33
33
|
}
|
|
34
34
|
parameter.schema = jsonSchema;
|
|
35
35
|
return parameter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationInParameterMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationInParameterMapper.ts"],"names":[],"mappings":";;;AACA,6CAAsC;AAGtC,wEAAmE;AAEnE,0FAA2G;AAC3G,mDAAiD;AAQjD,SAAS,UAAU,CAAC,SAAwB,EAAE,UAA6B,EAAE;IAC3E,OAAO;QACL,GAAG,OAAO;QACV,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,UAAU,EAAE,SAAS,CAAC,UAAU;KACjC,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAAC,aAA4B,EAAE,IAAwB;IAC/F,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,EAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,IAAI,EAAE,CAAC,EAAC,CAAC;IAEzD,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,EAAC,GAAG,IAAA,sCAAU,EAAC,KAAK,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;IAEjF,MAAM,UAAU,GAAG,IAAA,sCAAU,EAAC,MAAM,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QAC7D,GAAG,OAAO;QACV,GAAG,IAAA,sBAAW,EAAC,aAAa,CAAC;KAC9B,CAAC,CAAC;IAEH,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,uCAAkB,CAAC,IAAI,CAAC;IAE/F,MAAM,SAAS,GAAG;QAChB,GAAG,OAAO;QACV,UAAU;QACV,aAAa;QACb,UAAU,EAAE,OAAO;KACpB,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,uBAAS,EAAC,eAAe,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEvE,IAAI,IAAA,qCAAS,EAAC,UAAU,CAAC,EAAE;QACzB,OAAO,IAAA,sCAAU,EAAC,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;KACvD;IAED,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC;IAE9B,OAAO,SAAS,CAAC;AACnB,CAAC;AA7BD,gEA6BC;AAED,IAAA,oDAAwB,EAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationInParametersMapper = void 0;
|
|
4
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
4
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
5
5
|
function operationInParametersMapper(parameters, options) {
|
|
6
|
-
return parameters.flatMap((parameter) => (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameter", parameter, options)).filter(Boolean);
|
|
6
|
+
return parameters.flatMap((parameter) => (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameter", [parameter], options)).filter(Boolean);
|
|
7
7
|
}
|
|
8
8
|
exports.operationInParametersMapper = operationInParametersMapper;
|
|
9
9
|
(0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationInParameters", operationInParametersMapper);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationInParametersMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationInParametersMapper.ts"],"names":[],"mappings":";;;AAEA,0FAAgG;AAEhG,SAAgB,2BAA2B,CAAC,UAA2B,EAAE,OAA0B;IACjG,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAA,sCAAU,EAAC,sBAAsB,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrH,CAAC;AAFD,kEAEC;AAED,IAAA,oDAAwB,EAAC,uBAAuB,EAAE,2BAA2B,CAAC,CAAC"}
|
package/lib/cjs/components/{operationInQueryMapper.js → open-spec/operationInQueryMapper.js}
RENAMED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationInQueryMapper = void 0;
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
6
|
-
const ref_1 = require("
|
|
5
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
6
|
+
const ref_1 = require("../../utils/ref");
|
|
7
7
|
function inlineReference(parameter, { jsonParameter, ...options }) {
|
|
8
8
|
const name = (0, ref_1.createRefName)(jsonParameter.$schema.getName(), options);
|
|
9
|
-
const schema = options.schemas?.[name];
|
|
9
|
+
const schema = options.components?.schemas?.[name];
|
|
10
10
|
if (schema && !options.oldSchemas?.[name]) {
|
|
11
|
-
delete options.schemas[jsonParameter.$schema.getName()];
|
|
11
|
+
delete options.components.schemas[jsonParameter.$schema.getName()];
|
|
12
12
|
}
|
|
13
13
|
return Object.entries(schema?.properties || {}).reduce((params, [key, { description, ...prop }]) => {
|
|
14
14
|
return [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationInQueryMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationInQueryMapper.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,0FAAoF;AACpF,yCAA8C;AAG9C,SAAS,eAAe,CAAC,SA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,GAAG,YAAY,CAAC;KAChC;IAED,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC;IAE9B,OAAO,SAAS,CAAC;AACnB,CAAC;AAZD,wDAYC;AAED,IAAA,oDAAwB,EAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationMapper = void 0;
|
|
4
|
-
const httpStatusMessages_1 = require("
|
|
5
|
-
const JsonParameterTypes_1 = require("
|
|
6
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
4
|
+
const httpStatusMessages_1 = require("../../constants/httpStatusMessages");
|
|
5
|
+
const JsonParameterTypes_1 = require("../../domain/JsonParameterTypes");
|
|
6
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
7
7
|
function extractParameters(jsonOperation, options) {
|
|
8
8
|
return jsonOperation
|
|
9
9
|
.get("parameters")
|
|
@@ -17,7 +17,7 @@ function extractParameters(jsonOperation, options) {
|
|
|
17
17
|
}, [[], []]);
|
|
18
18
|
}
|
|
19
19
|
function operationMapper(jsonOperation, { tags = [], defaultTags = [], ...options } = {}) {
|
|
20
|
-
const { consumes, produces, ...operation } = (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonOperation, { ...options, ignore: ["parameters"] });
|
|
20
|
+
const { consumes, produces, ...operation } = (0, JsonSchemaMapperContainer_1.execMapper)("map", [jsonOperation], { ...options, ignore: ["parameters"] });
|
|
21
21
|
if (operation.security) {
|
|
22
22
|
operation.security = [].concat(operation.security);
|
|
23
23
|
}
|
|
@@ -33,9 +33,9 @@ function operationMapper(jsonOperation, { tags = [], defaultTags = [], ...option
|
|
|
33
33
|
consumes: jsonOperation.get("consumes")?.length ? jsonOperation.get("consumes") : ["application/json"]
|
|
34
34
|
};
|
|
35
35
|
const [parameters, bodyParameters] = extractParameters(jsonOperation, parametersOptions);
|
|
36
|
-
operation.parameters = (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameters", parameters, options);
|
|
36
|
+
operation.parameters = (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameters", [parameters], options);
|
|
37
37
|
if (bodyParameters.length) {
|
|
38
|
-
operation.requestBody = (0, JsonSchemaMapperContainer_1.execMapper)("operationRequestBody", bodyParameters, parametersOptions);
|
|
38
|
+
operation.requestBody = (0, JsonSchemaMapperContainer_1.execMapper)("operationRequestBody", [bodyParameters], parametersOptions);
|
|
39
39
|
}
|
|
40
40
|
const operationTags = operation.tags?.length ? operation.tags : defaultTags;
|
|
41
41
|
if (operationTags.length) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationMapper.ts"],"names":[],"mappings":";;;AAAA,2EAAoE;AAGpE,wEAAoF;AAEpF,0FAAgG;AAEhG,SAAS,iBAAiB,CAAC,aAA4B,EAAE,OAA0B;IACjF,OAAO,aAAa;SACjB,GAAG,CAAC,YAAY,CAAC;SACjB,MAAM,CAAC,CAAC,SAAwB,EAAE,EAAE,CAAC,IAAA,oCAAe,EAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;SAC1E,MAAM,CACL,CAAC,MAAgC,EAAE,SAAwB,EAAE,EAAE;QAC7D,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,MAAM,CAAC;QAE5C,IAAI,CAAC,uCAAkB,CAAC,IAAI,EAAE,uCAAkB,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE;YACrF,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;SACrD;QAED,OAAO,CAAC,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,EAAE,cAAc,CAAC,CAAC;IACtD,CAAC,EACD,CAAC,EAAE,EA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AC,CAAC;KACjG;IAED,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAE5E,IAAI,aAAa,CAAC,MAAM,EAAE;QACxB,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAM,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;KAC3D;IAED,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;IAE5B,OAAO,SAAS,CAAC;AACnB,CAAC;AArCD,0CAqCC;AAED,IAAA,oDAAwB,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationMediaMapper = void 0;
|
|
4
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
4
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
5
5
|
function operationMediaMapper(jsonMedia, options) {
|
|
6
6
|
let groups = [...(jsonMedia.groups || [])];
|
|
7
|
-
return (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonMedia, { ...options, groups, groupsName: jsonMedia.groupsName });
|
|
7
|
+
return (0, JsonSchemaMapperContainer_1.execMapper)("map", [jsonMedia], { ...options, groups, groupsName: jsonMedia.groupsName });
|
|
8
8
|
}
|
|
9
9
|
exports.operationMediaMapper = operationMediaMapper;
|
|
10
10
|
(0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationMedia", operationMediaMapper);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationMediaMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationMediaMapper.ts"],"names":[],"mappings":";;;AAEA,0FAAgG;AAEhG,SAAgB,oBAAoB,CAAC,SAAoB,EAAE,OAA0B;IACnF,IAAI,MAAM,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,IAAA,sCAAU,EAAC,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,UAAU,EAAC,CAAC,CAAC;AAChG,CAAC;AAJD,oDAIC;AAED,IAAA,oDAAwB,EAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC"}
|
package/lib/cjs/components/{operationRequestBodyMapper.js → open-spec/operationRequestBodyMapper.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationRequestBodyMapper = void 0;
|
|
4
|
-
const JsonRequestBody_1 = require("
|
|
5
|
-
const JsonSchema_1 = require("
|
|
6
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
4
|
+
const JsonRequestBody_1 = require("../../domain/JsonRequestBody");
|
|
5
|
+
const JsonSchema_1 = require("../../domain/JsonSchema");
|
|
6
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
7
7
|
function buildSchemaFromBodyParameters(parameters, options) {
|
|
8
8
|
let schema = new JsonSchema_1.JsonSchema();
|
|
9
9
|
const props = {};
|
|
@@ -18,7 +18,7 @@ function buildSchemaFromBodyParameters(parameters, options) {
|
|
|
18
18
|
props[key] = value;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
const jsonParameter = (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameter", parameter, options);
|
|
21
|
+
const jsonParameter = (0, JsonSchemaMapperContainer_1.execMapper)("operationInParameter", [parameter], options);
|
|
22
22
|
if (name) {
|
|
23
23
|
schema.addProperty(name, jsonParameter.schema || {
|
|
24
24
|
type: jsonParameter.type
|
|
@@ -50,7 +50,7 @@ function operationRequestBodyMapper(bodyParameters, { consumes, ...options }) {
|
|
|
50
50
|
consumes.forEach((consume) => {
|
|
51
51
|
requestBody.addContent(consume, schema, examples);
|
|
52
52
|
});
|
|
53
|
-
return (0, JsonSchemaMapperContainer_1.execMapper)("map", requestBody, options);
|
|
53
|
+
return (0, JsonSchemaMapperContainer_1.execMapper)("map", [requestBody], options);
|
|
54
54
|
}
|
|
55
55
|
exports.operationRequestBodyMapper = operationRequestBodyMapper;
|
|
56
56
|
(0, JsonSchemaMapperContainer_1.registerJsonSchemaMapper)("operationRequestBody", operationRequestBodyMapper);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationRequestBodyMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationRequestBodyMapper.ts"],"names":[],"mappings":";;;AAGA,kEAA6D;AAC7D,wDAAmD;AAEnD,0FAAgG;AAEhG,SAAS,6BAA6B,CAAC,UAA2B,EAAE,OAA0B;IAC5F,IAAI,MAAM,GAAG,IAAI,uBAAU,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;QAEjC,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;aACrB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;aAChD,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACxB,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;gBAC5B,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;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U,EAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AAVD,gEAUC;AAED,IAAA,oDAAwB,EAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAAC"}
|
package/lib/cjs/components/{operationResponseMapper.js → open-spec/operationResponseMapper.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationResponseMapper = void 0;
|
|
4
|
-
const JsonSchemaMapperContainer_1 = require("
|
|
4
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
5
5
|
function operationResponseMapper(jsonResponse, options = {}) {
|
|
6
|
-
const response = (0, JsonSchemaMapperContainer_1.execMapper)("map", jsonResponse, options);
|
|
6
|
+
const response = (0, JsonSchemaMapperContainer_1.execMapper)("map", [jsonResponse], options);
|
|
7
7
|
if (jsonResponse.status === 204) {
|
|
8
8
|
delete response.content;
|
|
9
9
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationResponseMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/operationResponseMapper.ts"],"names":[],"mappings":";;;AAEA,0FAAgG;AAEhG,SAAgB,uBAAuB,CAAC,YAA0B,EAAE,UAA6B,EAAE;IACjG,MAAM,QAAQ,GAAG,IAAA,sCAAU,EAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;IAE5D,IAAI,YAAY,CAAC,MAAM,KAAK,GAAG,EAAE;QAC/B,OAAO,QAAQ,CAAC,OAAO,CAAC;KACzB;IAED,IAAI,QAAQ,CAAC,OAAO,EAAE;QACpB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,CAAgB,EAAE,EAAE;YAClF,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG;gBACtB,GAAG,KAAK;gBACR,MAAM,EAAE;oBACN,IAAI;iBACL;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAnBD,0DAmBC;AAED,IAAA,oDAAwB,EAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pathsMapper = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const OperationVerbs_1 = require("../../constants/OperationVerbs");
|
|
5
|
+
const JsonSchemaMapperContainer_1 = require("../../registries/JsonSchemaMapperContainer");
|
|
6
|
+
const buildPath_1 = require("../../utils/buildPath");
|
|
7
|
+
const concatParameters_1 = require("../../utils/concatParameters");
|
|
8
|
+
const getJsonEntityStore_1 = require("../../utils/getJsonEntityStore");
|
|
9
|
+
const getJsonPathParameters_1 = require("../../utils/getJsonPathParameters");
|
|
10
|
+
const getOperationsStores_1 = require("../../utils/getOperationsStores");
|
|
11
|
+
const operationIdFormatter_1 = require("../../utils/operationIdFormatter");
|
|
12
|
+
const removeHiddenOperation_1 = require("../../utils/removeHiddenOperation");
|
|
13
|
+
const ALLOWED_VERBS = [
|
|
14
|
+
OperationVerbs_1.OperationVerbs.ALL,
|
|
15
|
+
OperationVerbs_1.OperationVerbs.GET,
|
|
16
|
+
OperationVerbs_1.OperationVerbs.POST,
|
|
17
|
+
OperationVerbs_1.OperationVerbs.PUT,
|
|
18
|
+
OperationVerbs_1.OperationVerbs.PATCH,
|
|
19
|
+
OperationVerbs_1.OperationVerbs.HEAD,
|
|
20
|
+
OperationVerbs_1.OperationVerbs.OPTIONS,
|
|
21
|
+
OperationVerbs_1.OperationVerbs.DELETE,
|
|
22
|
+
OperationVerbs_1.OperationVerbs.TRACE
|
|
23
|
+
];
|
|
13
24
|
function pushToPath(paths, { path, method, operation }) {
|
|
14
25
|
return {
|
|
15
26
|
...paths,
|
|
@@ -19,22 +30,9 @@ function pushToPath(paths, { path, method, operation }) {
|
|
|
19
30
|
}
|
|
20
31
|
};
|
|
21
32
|
}
|
|
22
|
-
function removeHiddenOperation(operationStore) {
|
|
23
|
-
return !operationStore.store.get("hidden");
|
|
24
|
-
}
|
|
25
|
-
function mapOperationPaths({ operationStore, operation }) {
|
|
26
|
-
return [...operationStore.operation.operationPaths.values()]
|
|
27
|
-
.map((operationPath) => {
|
|
28
|
-
return {
|
|
29
|
-
...operationPath,
|
|
30
|
-
operationStore,
|
|
31
|
-
operation
|
|
32
|
-
};
|
|
33
|
-
})
|
|
34
|
-
.filter(({ method }) => method);
|
|
35
|
-
}
|
|
36
33
|
function mapOperationInPathParameters(options) {
|
|
37
|
-
return ({
|
|
34
|
+
return ({ operationPath, operation, operationStore }) => {
|
|
35
|
+
const { path, method } = operationPath;
|
|
38
36
|
return (0, getJsonPathParameters_1.getJsonPathParameters)(options.ctrlRootPath, path).map(({ path, parameters }) => {
|
|
39
37
|
path = path ? path : "/";
|
|
40
38
|
parameters = (0, concatParameters_1.concatParameters)(parameters.map(({ type, ...param }) => {
|
|
@@ -50,7 +48,7 @@ function mapOperationInPathParameters(options) {
|
|
|
50
48
|
...operation,
|
|
51
49
|
parameters,
|
|
52
50
|
operationId: operation.operationId ||
|
|
53
|
-
|
|
51
|
+
(0, operationIdFormatter_1.getOperationId)(path, {
|
|
54
52
|
...options,
|
|
55
53
|
store: operationStore
|
|
56
54
|
})
|
|
@@ -63,11 +61,18 @@ function mapOperationInPathParameters(options) {
|
|
|
63
61
|
}
|
|
64
62
|
function mapOperation(options) {
|
|
65
63
|
return (operationStore) => {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
const operationPaths = operationStore.operation.getAllowedOperationPath(ALLOWED_VERBS);
|
|
65
|
+
if (operationPaths.length === 0) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
const operation = (0, JsonSchemaMapperContainer_1.execMapper)("operation", [operationStore.operation], options);
|
|
69
|
+
return operationPaths.map((operationPath) => {
|
|
70
|
+
return {
|
|
71
|
+
operationPath,
|
|
72
|
+
operation,
|
|
73
|
+
operationStore
|
|
74
|
+
};
|
|
75
|
+
});
|
|
71
76
|
};
|
|
72
77
|
}
|
|
73
78
|
function pathsMapper(model, { paths, rootPath, ...options }) {
|
|
@@ -79,9 +84,9 @@ function pathsMapper(model, { paths, rootPath, ...options }) {
|
|
|
79
84
|
ctrlRootPath
|
|
80
85
|
};
|
|
81
86
|
return [...(0, getOperationsStores_1.getOperationsStores)(model).values()]
|
|
82
|
-
.filter(removeHiddenOperation)
|
|
83
|
-
.
|
|
84
|
-
.flatMap(
|
|
87
|
+
.filter(removeHiddenOperation_1.removeHiddenOperation)
|
|
88
|
+
.filter((operationStore) => operationStore.operation.getAllowedOperationPath(ALLOWED_VERBS).length > 0)
|
|
89
|
+
.flatMap(mapOperation(options))
|
|
85
90
|
.flatMap(mapOperationInPathParameters(options))
|
|
86
91
|
.reduce(pushToPath, paths);
|
|
87
92
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathsMapper.js","sourceRoot":"","sources":["../../../../src/components/open-spec/pathsMapper.ts"],"names":[],"mappings":";;;AACA,mEAA8D;AAI9D,0FAAgG;AAChG,qDAAgD;AAChD,mEAA8D;AAC9D,uEAAkE;AAClE,6EAAwE;AACxE,yEAAoE;AACpE,2EAAgE;AAChE,6EAAwE;AAExE,MAAM,aAAa,GAAG;IACpB,+BAAc,CAAC,GAAG;IAClB,+BAAc,CAAC,GAAG;IAClB,+BAAc,CAAC,IAAI;IACnB,+BAAc,CAAC,GAAG;IAClB,+BAAc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C9C,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC/B,CAAC;AAhBD,kCAgBC;AAED,IAAA,oDAAwB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OperationMethods = exports.OPERATION_WS_VERBS = exports.OPERATION_HTTP_VERBS = exports.OperationVerbs = void 0;
|
|
4
|
+
var OperationVerbs;
|
|
5
|
+
(function (OperationVerbs) {
|
|
6
|
+
OperationVerbs["ALL"] = "ALL";
|
|
7
|
+
OperationVerbs["GET"] = "GET";
|
|
8
|
+
OperationVerbs["POST"] = "POST";
|
|
9
|
+
OperationVerbs["PUT"] = "PUT";
|
|
10
|
+
OperationVerbs["PATCH"] = "PATCH";
|
|
11
|
+
OperationVerbs["HEAD"] = "HEAD";
|
|
12
|
+
OperationVerbs["DELETE"] = "DELETE";
|
|
13
|
+
OperationVerbs["OPTIONS"] = "OPTIONS";
|
|
14
|
+
OperationVerbs["TRACE"] = "TRACE";
|
|
15
|
+
OperationVerbs["PUBLISH"] = "PUBLISH";
|
|
16
|
+
OperationVerbs["SUBSCRIBE"] = "SUBSCRIBE";
|
|
17
|
+
OperationVerbs["CUSTOM"] = "CUSTOM";
|
|
18
|
+
})(OperationVerbs = exports.OperationVerbs || (exports.OperationVerbs = {}));
|
|
19
|
+
exports.OPERATION_HTTP_VERBS = [
|
|
20
|
+
OperationVerbs.ALL,
|
|
21
|
+
OperationVerbs.GET,
|
|
22
|
+
OperationVerbs.POST,
|
|
23
|
+
OperationVerbs.PUT,
|
|
24
|
+
OperationVerbs.PATCH,
|
|
25
|
+
OperationVerbs.HEAD,
|
|
26
|
+
OperationVerbs.DELETE,
|
|
27
|
+
OperationVerbs.OPTIONS,
|
|
28
|
+
OperationVerbs.TRACE,
|
|
29
|
+
OperationVerbs.CUSTOM
|
|
30
|
+
];
|
|
31
|
+
exports.OPERATION_WS_VERBS = [OperationVerbs.PUBLISH, OperationVerbs.SUBSCRIBE];
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use OperationVerbs instead of OperationMethods
|
|
34
|
+
*/
|
|
35
|
+
exports.OperationMethods = OperationVerbs;
|
|
36
|
+
//# sourceMappingURL=OperationVerbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationVerbs.js","sourceRoot":"","sources":["../../../src/constants/OperationVerbs.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAaX;AAbD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,6BAAW,CAAA;IACX,iCAAe,CAAA;IACf,+BAAa,CAAA;IACb,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,iCAAe,CAAA;IACf,qCAAmB,CAAA;IACnB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAbW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAazB;AAEY,QAAA,oBAAoB,GAAG;IAClC,cAAc,CAAC,GAAG;IAClB,cAAc,CAAC,GAAG;IAClB,cAAc,CAAC,IAAI;IACnB,cAAc,CAAC,GAAG;IAClB,cAAc,CAAC,KAAK;IACpB,cAAc,CAAC,IAAI;IACnB,cAAc,CAAC,MAAM;IACrB,cAAc,CAAC,OAAO;IACtB,cAAc,CAAC,KAAK;IACpB,cAAc,CAAC,MAAM;CACtB,CAAC;AAEW,QAAA,kBAAkB,GAAG,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;AAErF;;GAEG;AACU,QAAA,gBAAgB,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Operation = void 0;
|
|
4
|
+
const OperationVerbs_1 = require("../../constants/OperationVerbs");
|
|
5
|
+
const DecoratorContext_1 = require("../../domain/DecoratorContext");
|
|
6
|
+
const mapOperationOptions_1 = require("../../utils/mapOperationOptions");
|
|
7
|
+
class OperationDecoratorContext extends DecoratorContext_1.DecoratorContext {
|
|
8
|
+
methods = ["name", "description", "summary", "method", "id", "use", "useAfter", "useBefore"];
|
|
9
|
+
beforeInit() {
|
|
10
|
+
const path = this.get("path");
|
|
11
|
+
const method = OperationVerbs_1.OperationVerbs[this.get("method")] || OperationVerbs_1.OperationVerbs.CUSTOM;
|
|
12
|
+
path && this.entity.operation.addOperationPath(method, path);
|
|
13
|
+
}
|
|
14
|
+
onMapKey(key, value) {
|
|
15
|
+
switch (key) {
|
|
16
|
+
case "name":
|
|
17
|
+
case "id":
|
|
18
|
+
this.entity.operation.operationId(value);
|
|
19
|
+
return;
|
|
20
|
+
case "summary":
|
|
21
|
+
this.entity.operation.summary(value);
|
|
22
|
+
return;
|
|
23
|
+
case "description":
|
|
24
|
+
this.entity.operation.description(value);
|
|
25
|
+
return;
|
|
26
|
+
case "use":
|
|
27
|
+
this.entity.use(value);
|
|
28
|
+
return;
|
|
29
|
+
case "useAfter":
|
|
30
|
+
this.entity.after(value);
|
|
31
|
+
return;
|
|
32
|
+
case "useBefore":
|
|
33
|
+
this.entity.before(value);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
return super.onMapKey(key, value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function Operation(...args) {
|
|
40
|
+
const routeOptions = (0, mapOperationOptions_1.mapOperationOptions)(args);
|
|
41
|
+
const context = new OperationDecoratorContext(routeOptions);
|
|
42
|
+
return context.build();
|
|
43
|
+
}
|
|
44
|
+
exports.Operation = Operation;
|
|
45
|
+
//# sourceMappingURL=operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/decorators/operations/operation.ts"],"names":[],"mappings":";;;AAAA,mEAA8D;AAC9D,oEAA+D;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AC;CACF;AAwBD,SAAgB,SAAS,CAAC,GAAG,IAAW;IACtC,MAAM,YAAY,GAAG,IAAA,yCAAmB,EAAC,IAAI,CAAC,CAAC;IAE/C,MAAM,OAAO,GAAG,IAAI,yBAAyB,CAAC,YAAY,CAAC,CAAC;IAE5D,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC;AAND,8BAMC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operationPath.js","sourceRoot":"","sources":["../../../../src/decorators/operations/operationPath.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yDAAoD;AAGpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"operationPath.js","sourceRoot":"","sources":["../../../../src/decorators/operations/operationPath.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yDAAoD;AAGpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,aAAa,CAAC,MAA+B,EAAE,OAAwB,GAAG;IACxF,OAAO,IAAA,2BAAY,EAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAClC,IAAI,KAAK,CAAC,aAAa,KAAK,qBAAc,CAAC,MAAM,EAAE;YACjD,MAAM,IAAI,+BAAwB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;SACzD;QAED,KAAK,CAAC,SAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC;AARD,sCAQC"}
|