@tsed/schema 6.102.5 → 6.102.8-rc.2
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/lib/cjs/constants/httpStatusMessages.js +12 -96
- package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
- package/lib/cjs/decorators/common/description.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/operations/in.js +6 -4
- package/lib/cjs/decorators/operations/in.js.map +1 -1
- package/lib/cjs/domain/JsonMap.js.map +1 -1
- package/lib/cjs/domain/JsonOperation.js.map +1 -1
- package/lib/cjs/domain/JsonParameter.js.map +1 -1
- package/lib/cjs/domain/JsonResponse.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/index.js +135 -13
- package/lib/cjs/index.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/generics.js.map +1 -1
- package/lib/cjs/utils/getJsonSchema.js +1 -1
- package/lib/cjs/utils/getJsonSchema.js.map +1 -1
- package/lib/cjs/utils/getSpec.js.map +1 -1
- 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 +6 -6
- 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 +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 +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 +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/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 +1 -1
- 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/domain/DecoratorContext.js +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 +4 -4
- package/lib/esm/domain/JsonOperation.js +8 -8
- package/lib/esm/domain/JsonOperation.js.map +1 -1
- package/lib/esm/domain/JsonOperationPathsMap.js +1 -1
- package/lib/esm/domain/JsonOperationRoute.js +1 -1
- package/lib/esm/domain/JsonParameter.js +6 -6
- package/lib/esm/domain/JsonParameter.js.map +1 -1
- package/lib/esm/domain/JsonParameterStore.js +4 -4
- package/lib/esm/domain/JsonPropertyStore.js +3 -3
- package/lib/esm/domain/JsonRequestBody.js +2 -2
- package/lib/esm/domain/JsonResponse.js +4 -4
- package/lib/esm/domain/JsonResponse.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +6 -6
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/lib/esm/index.js +142 -20
- package/lib/esm/index.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/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 +4 -4
- package/lib/esm/utils/getJsonSchema.js.map +1 -1
- package/lib/esm/utils/getOperationsRoutes.js +3 -3
- 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 +6 -6
- package/lib/esm/utils/getSpec.js.map +1 -1
- package/lib/esm/utils/mapNullableType.js +1 -1
- package/lib/esm/utils/mapRouteOptions.js +1 -1
- package/lib/esm/utils/mergeOperation.js +3 -3
- package/lib/esm/utils/ref.js +1 -1
- package/lib/esm/utils/toJsonMapCollection.js +1 -1
- package/lib/types/constants/httpStatusMessages.d.ts +2 -263
- package/lib/types/decorators/common/ignore.d.ts +1 -1
- package/lib/types/decorators/common/jsonEntityFn.d.ts +1 -1
- package/lib/types/decorators/operations/in.d.ts +1 -1
- package/lib/types/domain/JsonMap.d.ts +1 -1
- package/lib/types/domain/JsonOperation.d.ts +2 -1
- package/lib/types/domain/JsonParameter.d.ts +1 -1
- package/lib/types/domain/JsonResponse.d.ts +2 -1
- package/lib/types/domain/JsonSchema.d.ts +1 -1
- package/lib/types/index.d.ts +135 -13
- package/lib/types/utils/generics.d.ts +1 -1
- package/lib/types/utils/getJsonSchema.d.ts +2 -2
- package/lib/types/utils/getSpec.d.ts +1 -1
- package/package.json +21 -8
- package/tsconfig.compile.esm.json +1 -0
- package/lib/cjs/components/index.js +0 -15
- package/lib/cjs/components/index.js.map +0 -1
- package/lib/cjs/decorators/index.js +0 -79
- 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 -76
- 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 -70
- package/lib/types/domain/index.d.ts +0 -16
- package/lib/types/interfaces/index.d.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSpec.js","sourceRoot":"","sources":["../../../src/utils/getSpec.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AAErD,mDAA8C;AAE9C,2CAAsC;AACtC,6DAAwD;AACxD,+DAA0D;AAC1D,qDAAgD;AAChD,iEAA4D;AAoC5D;;GAEG;AACH,MAAM,MAAM,GAAqC,IAAI,GAAG,EAAE,CAAC;AAE3D;;GAEG;AACH,SAAS,GAAG,CAAC,KAAgB,EAAE,OAAY,EAAE,EAAO;IAClD,IAAI,CAAC,MAAM,CAAC,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CAAC,OAAO,EAAE;gBAClC,QAAQ,CAAC,UAAU,GAAG;oBACpB,OAAO;iBACR,CAAC;aACH;iBAAM;gBACL,QAAQ,CAAC,WAAW,GAAG,OAAO,CAAC;aAChC;SACF;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAhED,0BAgEC","sourcesContent":["import {cleanObject, Type, uniqBy} from \"@tsed/core\";\nimport {OpenSpec2, OpenSpec3} from \"@tsed/openspec\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces\";\nimport {buildPath} from \"./buildPath\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\nimport {getOperationsStores} from \"./getOperationsStores\";\nimport {mergeOperation} from \"./mergeOperation\";\nimport {operationIdFormatter} from \"./operationIdFormatter\";\n\nexport interface SpecSerializerOptions extends JsonSchemaOptions {\n specType?: SpecTypes.SWAGGER | SpecTypes.OPENAPI;\n /**\n * Paths\n */\n paths?: any;\n /**\n * Root path. This paths will be added to all generated paths Object.\n */\n rootPath?: string;\n /**\n * A function to generate the operationId.\n */\n operationIdFormatter?: (name: string, propertyKey: string, path: string) => string;\n /**\n * A pattern to generate the operationId.\n */\n operationIdPattern?: string;\n}\n\nexport interface OS3SpecSerializerOptions extends SpecSerializerOptions {\n /**\n * Define Spec types level\n */\n specType: SpecTypes.OPENAPI;\n}\n\nexport interface OS2SpecSerializerOptions extends SpecSerializerOptions {\n /**\n * Define Spec types level\n */\n specType: SpecTypes.SWAGGER;\n}\n\n/**\n * @ignore\n */\nconst caches: Map<Type<any>, Map<string, any>> = new Map();\n\n/**\n * @ignore\n */\nfunction get(model: Type<any>, options: any, cb: any) {\n if (!caches.has(model)) {\n caches.set(model, new Map());\n }\n\n const cache = caches.get(model)!;\n const key = JSON.stringify(options);\n\n if (!cache.has(key)) {\n cache.set(key, cb());\n }\n\n return cache.get(key);\n}\n\n/**\n * Return the swagger or open spec for the given class.\n * @param model\n * @param options\n */\nexport function getSpec(model: Type<any>, options: OS2SpecSerializerOptions): Partial<OpenSpec2>;\nexport function getSpec(model: Type<any>): Partial<OpenSpec2>;\nexport function getSpec(model: Type<any>, options: SpecSerializerOptions): Partial<OpenSpec2>;\n/**\n * Return the swagger or open spec for the given class.\n * @param model\n * @param options\n */\nexport function getSpec(model: Type<any>, options: OS3SpecSerializerOptions): Partial<OpenSpec3>;\n/**\n * Return the swagger or open spec for the given class.\n * @param model\n * @param options\n */\nexport function getSpec(model: Type<any>, options: SpecSerializerOptions = {}): Partial<OpenSpec2 | OpenSpec3> {\n if (!options.specType) {\n options.specType = SpecTypes.OPENAPI;\n }\n\n options = {\n ...options,\n operationIdFormatter: options.operationIdFormatter || operationIdFormatter(options.operationIdPattern),\n root: false,\n specType: options.specType\n };\n\n return get(model, options, () => {\n const store = getJsonEntityStore(model);\n const {specType = SpecTypes.OPENAPI, schemas = {}, paths = {}, rootPath = \"/\", tags = []} = options;\n const ctrlPath = store.path;\n const defaultTags = cleanObject({\n name: store.schema.getName(),\n description: store.schema.get(\"description\")\n });\n\n const specJson: any = {paths};\n\n getOperationsStores(model).forEach((operationStore) => {\n if (operationStore.store.get(\"hidden\")) {\n return;\n }\n\n const operation = operationStore.operation!.toJSON({...options, specType, schemas});\n\n operationStore.operation!.operationPaths.forEach(({path, method}: {path: string; method: string}) => {\n if (method) {\n mergeOperation(specJson, operation, {\n rootPath: buildPath(rootPath + ctrlPath),\n path,\n method,\n defaultTags,\n tags,\n specType,\n operationId: (path: string) =>\n options.operationIdFormatter!(\n operationStore.parent.schema.get(\"name\") || operationStore.parent.targetName,\n operationStore.propertyName,\n path\n )\n });\n }\n });\n });\n\n specJson.tags = uniqBy(tags, \"name\");\n\n if (Object.keys(schemas).length) {\n if (specType === SpecTypes.OPENAPI) {\n specJson.components = {\n schemas\n };\n } else {\n specJson.definitions = schemas;\n }\n }\n\n return specJson;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"getSpec.js","sourceRoot":"","sources":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C,UAAU,EAC5E,cAAc,CAAC,YAAY,EAC3B,IAAI,CACL;qBACJ,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,IAAI,GAAG,IAAA,aAAM,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAErC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YAC/B,IAAI,QAAQ,KAAK,qBAAS,CAAC,OAAO,EAAE;gBAClC,QAAQ,CAAC,UAAU,GAAG;oBACpB,OAAO;iBACR,CAAC;aACH;iBAAM;gBACL,QAAQ,CAAC,WAAW,GAAG,OAAO,CAAC;aAChC;SACF;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAhED,0BAgEC","sourcesContent":["import {cleanObject, Type, uniqBy} from \"@tsed/core\";\nimport {OpenSpec2, OpenSpec3} from \"@tsed/openspec\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {buildPath} from \"./buildPath\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\nimport {getOperationsStores} from \"./getOperationsStores\";\nimport {mergeOperation} from \"./mergeOperation\";\nimport {operationIdFormatter} from \"./operationIdFormatter\";\n\nexport interface SpecSerializerOptions extends JsonSchemaOptions {\n specType?: SpecTypes.SWAGGER | SpecTypes.OPENAPI;\n /**\n * Paths\n */\n paths?: any;\n /**\n * Root path. This paths will be added to all generated paths Object.\n */\n rootPath?: string;\n /**\n * A function to generate the operationId.\n */\n operationIdFormatter?: (name: string, propertyKey: string, path: string) => string;\n /**\n * A pattern to generate the operationId.\n */\n operationIdPattern?: string;\n}\n\nexport interface OS3SpecSerializerOptions extends SpecSerializerOptions {\n /**\n * Define Spec types level\n */\n specType: SpecTypes.OPENAPI;\n}\n\nexport interface OS2SpecSerializerOptions extends SpecSerializerOptions {\n /**\n * Define Spec types level\n */\n specType: SpecTypes.SWAGGER;\n}\n\n/**\n * @ignore\n */\nconst caches: Map<Type<any>, Map<string, any>> = new Map();\n\n/**\n * @ignore\n */\nfunction get(model: Type<any>, options: any, cb: any) {\n if (!caches.has(model)) {\n caches.set(model, new Map());\n }\n\n const cache = caches.get(model)!;\n const key = JSON.stringify(options);\n\n if (!cache.has(key)) {\n cache.set(key, cb());\n }\n\n return cache.get(key);\n}\n\n/**\n * Return the swagger or open spec for the given class.\n * @param model\n * @param options\n */\nexport function getSpec(model: Type<any>, options: OS2SpecSerializerOptions): Partial<OpenSpec2>;\nexport function getSpec(model: Type<any>): Partial<OpenSpec2>;\nexport function getSpec(model: Type<any>, options: SpecSerializerOptions): Partial<OpenSpec2>;\n/**\n * Return the swagger or open spec for the given class.\n * @param model\n * @param options\n */\nexport function getSpec(model: Type<any>, options: OS3SpecSerializerOptions): Partial<OpenSpec3>;\n/**\n * Return the swagger or open spec for the given class.\n * @param model\n * @param options\n */\nexport function getSpec(model: Type<any>, options: SpecSerializerOptions = {}): Partial<OpenSpec2 | OpenSpec3> {\n if (!options.specType) {\n options.specType = SpecTypes.OPENAPI;\n }\n\n options = {\n ...options,\n operationIdFormatter: options.operationIdFormatter || operationIdFormatter(options.operationIdPattern),\n root: false,\n specType: options.specType\n };\n\n return get(model, options, () => {\n const store = getJsonEntityStore(model);\n const {specType = SpecTypes.OPENAPI, schemas = {}, paths = {}, rootPath = \"/\", tags = []} = options;\n const ctrlPath = store.path;\n const defaultTags = cleanObject({\n name: store.schema.getName(),\n description: store.schema.get(\"description\")\n });\n\n const specJson: any = {paths};\n\n getOperationsStores(model).forEach((operationStore) => {\n if (operationStore.store.get(\"hidden\")) {\n return;\n }\n\n const operation = operationStore.operation!.toJSON({...options, specType, schemas});\n\n operationStore.operation!.operationPaths.forEach(({path, method}: {path: string; method: string}) => {\n if (method) {\n mergeOperation(specJson, operation, {\n rootPath: buildPath(rootPath + ctrlPath),\n path,\n method,\n defaultTags,\n tags,\n specType,\n operationId: (path: string) =>\n options.operationIdFormatter!(\n operationStore.parent.schema.get(\"name\") || operationStore.parent.targetName,\n operationStore.propertyName,\n path\n )\n });\n }\n });\n });\n\n specJson.tags = uniqBy(tags, \"name\");\n\n if (Object.keys(schemas).length) {\n if (specType === SpecTypes.OPENAPI) {\n specJson.components = {\n schemas\n };\n } else {\n specJson.definitions = schemas;\n }\n }\n\n return specJson;\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JsonLazyRef } from "../domain/JsonLazyRef";
|
|
2
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
-
import { mapGenericsOptions } from "../utils/generics";
|
|
4
|
-
import { toRef } from "../utils/ref";
|
|
1
|
+
import { JsonLazyRef } from "../domain/JsonLazyRef.js";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { mapGenericsOptions } from "../utils/generics.js";
|
|
4
|
+
import { toRef } from "../utils/ref.js";
|
|
5
5
|
export function anyMapper(input, options = {}) {
|
|
6
6
|
if (typeof input !== "object" || input === null) {
|
|
7
7
|
return input;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JsonEntityStore } from "../domain/JsonEntityStore";
|
|
2
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
-
import { mapGenericsOptions, popGenerics } from "../utils/generics";
|
|
4
|
-
import { createRef, createRefName } from "../utils/ref";
|
|
1
|
+
import { JsonEntityStore } from "../domain/JsonEntityStore.js";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { mapGenericsOptions, popGenerics } from "../utils/generics.js";
|
|
4
|
+
import { createRef, createRefName } from "../utils/ref.js";
|
|
5
5
|
export function classMapper(value, options) {
|
|
6
6
|
const store = JsonEntityStore.from(value.class);
|
|
7
7
|
const name = createRefName(store.schema.getName() || value.getName(), options);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isClass, isPrimitiveClass } from "@tsed/core";
|
|
2
|
-
import { JsonEntityStore } from "../domain/JsonEntityStore";
|
|
3
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
4
|
-
import { popGenerics } from "../utils/generics";
|
|
5
|
-
import { getJsonType } from "../utils/getJsonType";
|
|
2
|
+
import { JsonEntityStore } from "../domain/JsonEntityStore.js";
|
|
3
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
4
|
+
import { popGenerics } from "../utils/generics.js";
|
|
5
|
+
import { getJsonType } from "../utils/getJsonType.js";
|
|
6
6
|
/**
|
|
7
7
|
* @ignore
|
|
8
8
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { classOf, deepMerge } from "@tsed/core";
|
|
2
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
-
import { getInheritedStores } from "../utils/getInheritedStores";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { getInheritedStores } from "../utils/getInheritedStores.js";
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function itemMapper(value, options) {
|
|
3
3
|
return value && value.isClass ? execMapper("class", value, options) : execMapper("any", value, options);
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
2
|
-
import { mapGenericsOptions } from "../utils/generics";
|
|
3
|
-
import { createRef, toRef } from "../utils/ref";
|
|
1
|
+
import { registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { mapGenericsOptions } from "../utils/generics.js";
|
|
3
|
+
import { createRef, toRef } from "../utils/ref.js";
|
|
4
4
|
export function lazyRefMapper(input, options) {
|
|
5
5
|
var _a;
|
|
6
6
|
const name = input.name;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mapGenericsOptions } from "../utils/generics";
|
|
2
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { mapGenericsOptions } from "../utils/generics.js";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
3
|
/**
|
|
4
4
|
* Serialize class which inherit from Map like JsonMap, JsonOperation, JsonParameter.
|
|
5
5
|
* @param input
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from "@tsed/core";
|
|
2
|
-
import { alterIgnore } from "../hooks/alterIgnore";
|
|
3
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
4
|
-
import { mapNullableType } from "../utils/mapNullableType";
|
|
2
|
+
import { alterIgnore } from "../hooks/alterIgnore.js";
|
|
3
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
4
|
+
import { mapNullableType } from "../utils/mapNullableType.js";
|
|
5
5
|
/**
|
|
6
6
|
* Serialize Any object to a json schema
|
|
7
7
|
* @param input
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function ofMapper(input, options, parent) {
|
|
3
3
|
return input.map((value) => {
|
|
4
4
|
return execMapper("item", value, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function propertiesMapper(input, options, parent) {
|
|
3
3
|
if (input.isClass) {
|
|
4
4
|
return execMapper("class", input, options);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isObject } from "@tsed/core";
|
|
2
|
-
import { mapAliasedProperties } from "../domain/JsonAliasMap";
|
|
3
|
-
import { SpecTypes } from "../domain/SpecTypes";
|
|
4
|
-
import { execMapper, hasMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
5
|
-
import { getRequiredProperties } from "../utils/getRequiredProperties";
|
|
6
|
-
import { alterOneOf } from "../hooks/alterOneOf";
|
|
7
|
-
import { mapNullableType } from "../utils/mapNullableType";
|
|
2
|
+
import { mapAliasedProperties } from "../domain/JsonAliasMap.js";
|
|
3
|
+
import { SpecTypes } from "../domain/SpecTypes.js";
|
|
4
|
+
import { execMapper, hasMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
5
|
+
import { getRequiredProperties } from "../utils/getRequiredProperties.js";
|
|
6
|
+
import { alterOneOf } from "../hooks/alterOneOf.js";
|
|
7
|
+
import { mapNullableType } from "../utils/mapNullableType.js";
|
|
8
8
|
/**
|
|
9
9
|
* @ignore
|
|
10
10
|
*/
|
|
@@ -1,99 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
"204": { label: "No Content", code: "NO_CONTENT" },
|
|
14
|
-
"205": { label: "Reset Content", code: "RESET_CONTENT" },
|
|
15
|
-
"206": { label: "Partial Content", code: "PARTIAL_CONTENT" },
|
|
16
|
-
"207": { label: "Multi-Status", code: "MULTI_STATUS" },
|
|
17
|
-
"208": { label: "Already Reported", code: "ALREADY_REPORTED" },
|
|
18
|
-
"226": { label: "IM Used", code: "IM_USED" },
|
|
19
|
-
"300": { label: "Multiple Choices", code: "MULTIPLE_CHOICES" },
|
|
20
|
-
"301": { label: "Moved Permanently", code: "MOVED_PERMANENTLY" },
|
|
21
|
-
"302": { label: "Found", code: "FOUND" },
|
|
22
|
-
"303": { label: "See Other", code: "SEE_OTHER" },
|
|
23
|
-
"304": { label: "Not Modified", code: "NOT_MODIFIED" },
|
|
24
|
-
"305": { label: "Use Proxy", code: "USE_PROXY" },
|
|
25
|
-
"306": { label: "(Unused)", code: "UNUSED" },
|
|
26
|
-
"307": { label: "Temporary Redirect", code: "TEMPORARY_REDIRECT" },
|
|
27
|
-
"308": { label: "Permanent Redirect", code: "PERMANENT_REDIRECT" },
|
|
28
|
-
"310": { label: "Too Many Redirects", code: "TOO_MANY_REDIRECTS" },
|
|
29
|
-
"400": { label: "Bad Request", code: "BAD_REQUEST" },
|
|
30
|
-
"401": { label: "Unauthorized", code: "UNAUTHORIZED" },
|
|
31
|
-
"402": { label: "Payment Required", code: "PAYMENT_REQUIRED" },
|
|
32
|
-
"403": { label: "Forbidden", code: "FORBIDDEN" },
|
|
33
|
-
"404": { label: "Not Found", code: "NOT_FOUND" },
|
|
34
|
-
"405": { label: "Method Not Allowed", code: "METHOD_NOT_ALLOWED" },
|
|
35
|
-
"406": { label: "Not Acceptable", code: "NOT_ACCEPTABLE" },
|
|
36
|
-
"407": {
|
|
37
|
-
label: "Proxy Authentication Required",
|
|
38
|
-
code: "PROXY_AUTHENTICATION_REQUIRED"
|
|
39
|
-
},
|
|
40
|
-
"408": { label: "Request Timeout", code: "REQUEST_TIMEOUT" },
|
|
41
|
-
"409": { label: "Conflict", code: "CONFLICT" },
|
|
42
|
-
"410": { label: "Gone", code: "GONE" },
|
|
43
|
-
"411": { label: "Length Required", code: "LENGTH_REQUIRED" },
|
|
44
|
-
"412": { label: "Precondition Failed", code: "PRECONDITION_FAILED" },
|
|
45
|
-
"413": {
|
|
46
|
-
label: "Request Entity Too Large",
|
|
47
|
-
code: "REQUEST_ENTITY_TOO_LARGE"
|
|
48
|
-
},
|
|
49
|
-
"414": { label: "Request URI Too Long", code: "REQUEST_URI_TOO_LONG" },
|
|
50
|
-
"415": { label: "Unsupported Media Type", code: "UNSUPPORTED_MEDIA_TYPE" },
|
|
51
|
-
"416": {
|
|
52
|
-
label: "Request Range Unsatisfiable",
|
|
53
|
-
code: "REQUEST_RANGE_UNSATISFIABLE"
|
|
54
|
-
},
|
|
55
|
-
"417": { label: "Expectation Failed", code: "EXPECTATION_FAILED" },
|
|
56
|
-
"418": { label: "I'm a Teapot", code: "I_M_A_TEAPOT" },
|
|
57
|
-
"421": { label: "Misdirected Request", code: "MISDIRECTED_REQUEST" },
|
|
58
|
-
"422": { label: "Unprocessable Entity", code: "UNPROCESSABLE_ENTITY" },
|
|
59
|
-
"423": { label: "Locked", code: "LOCKED" },
|
|
60
|
-
"424": { label: "Failed Dependency", code: "FAILED_DEPENDENCY" },
|
|
61
|
-
"425": { label: "Too Early", code: "TOO_EARLY" },
|
|
62
|
-
"426": { label: "Upgrade Required", code: "UPGRADE_REQUIRED" },
|
|
63
|
-
"427": { label: "Unassigned", code: "UNASSIGNED" },
|
|
64
|
-
"428": { label: "Precondition Required", code: "PRECONDITION_REQUIRED" },
|
|
65
|
-
"429": { label: "Too Many Requests", code: "TOO_MANY_REQUESTS" },
|
|
66
|
-
"430": { label: "Unassigned", code: "UNASSIGNED" },
|
|
67
|
-
"431": {
|
|
68
|
-
label: "Request Header Fields Too Large",
|
|
69
|
-
code: "REQUEST_HEADER_FIELDS_TOO_LARGE"
|
|
70
|
-
},
|
|
71
|
-
"451": {
|
|
72
|
-
label: "Unavailable For Legal Reasons",
|
|
73
|
-
code: "UNAVAILABLE_FOR_LEGAL_REASONS"
|
|
74
|
-
},
|
|
75
|
-
"500": { label: "Internal Server Error", code: "INTERNAL_SERVER_ERROR" },
|
|
76
|
-
"501": { label: "Not Implemented", code: "NOT_IMPLEMENTED" },
|
|
77
|
-
"502": { label: "Bad Gateway", code: "BAD_GATEWAY" },
|
|
78
|
-
"503": { label: "Service Unavailable", code: "SERVICE_UNAVAILABLE" },
|
|
79
|
-
"504": { label: "Gateway Timeout", code: "GATEWAY_TIMEOUT" },
|
|
80
|
-
"505": {
|
|
81
|
-
label: "HTTP Version Not Supported",
|
|
82
|
-
code: "HTTP_VERSION_NOT_SUPPORTED"
|
|
83
|
-
},
|
|
84
|
-
"506": { label: "Variant Also Negotiates", code: "VARIANT_ALSO_NEGOTIATES" },
|
|
85
|
-
"507": { label: "Insufficient Storage", code: "INSUFFICIENT_STORAGE" },
|
|
86
|
-
"508": { label: "Loop Detected", code: "LOOP_DETECTED" },
|
|
87
|
-
"509": {
|
|
88
|
-
label: "Bandwidth Limit Exceeded",
|
|
89
|
-
code: "BANDWIDTH_LIMIT_EXCEEDED"
|
|
90
|
-
},
|
|
91
|
-
"510": { label: "Not Extended", code: "NOT_EXTENDED" },
|
|
92
|
-
"511": {
|
|
93
|
-
label: "Network Authentication Required",
|
|
94
|
-
code: "NETWORK_AUTHENTICATION_REQUIRED"
|
|
95
|
-
}
|
|
96
|
-
};
|
|
1
|
+
import statuses from "statuses";
|
|
2
|
+
import { constantCase } from "change-case";
|
|
3
|
+
export const HTTP_STATUS_MESSAGES = statuses.codes.reduce((map, code) => {
|
|
4
|
+
const message = String(statuses(code));
|
|
5
|
+
return {
|
|
6
|
+
...map,
|
|
7
|
+
[String(code)]: { label: message, code: constantCase(message) }
|
|
8
|
+
};
|
|
9
|
+
}, {});
|
|
10
|
+
HTTP_STATUS_MESSAGES["200"].label = "Success";
|
|
11
|
+
HTTP_STATUS_MESSAGES["200"].code = "SUCCESS";
|
|
97
12
|
export function getStatusConstant(status) {
|
|
98
13
|
var _a;
|
|
99
14
|
return (_a = HTTP_STATUS_MESSAGES[status]) === null || _a === void 0 ? void 0 : _a.code;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatusMessages.js","sourceRoot":"","sources":["../../../src/constants/httpStatusMessages.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"httpStatusMessages.js","sourceRoot":"","sources":["../../../src/constants/httpStatusMessages.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAkD,EAAE,IAAY,EAAE,EAAE;IAC7H,MAAM,OAAO,GAAW,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,OAAO;QACL,GAAG,GAAG;QACN,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,EAAC;KAC9D,CAAC;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AAEP,oBAAoB,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC;AAC9C,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;AAE7C,MAAM,UAAU,iBAAiB,CAAC,MAAuB;;IACvD,OAAO,MAAC,oBAA4B,CAAC,MAAM,CAAC,0CAAE,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAuB;;IACtD,OAAO,MAAC,oBAA4B,CAAC,MAAM,CAAC,0CAAE,KAAK,CAAC;AACtD,CAAC","sourcesContent":["import statuses from \"statuses\";\nimport {constantCase} from \"change-case\";\n\nexport const HTTP_STATUS_MESSAGES = statuses.codes.reduce((map: Record<string, {label: string; code: string}>, code: number) => {\n const message: string = String(statuses(code));\n return {\n ...map,\n [String(code)]: {label: message, code: constantCase(message)}\n };\n}, {});\n\nHTTP_STATUS_MESSAGES[\"200\"].label = \"Success\";\nHTTP_STATUS_MESSAGES[\"200\"].code = \"SUCCESS\";\n\nexport function getStatusConstant(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.code;\n}\n\nexport function getStatusMessage(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.label;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonEntityFn } from "../common/jsonEntityFn";
|
|
1
|
+
import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
2
2
|
/**
|
|
3
3
|
* If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
|
4
4
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DecoratorTypes, isClass, useDecorators } from "@tsed/core";
|
|
2
|
-
import { JsonEntityFn } from "./jsonEntityFn";
|
|
3
|
-
import { Property } from "./property";
|
|
2
|
+
import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
3
|
+
import { Property } from "./property.js";
|
|
4
4
|
/**
|
|
5
5
|
* Add allowed values when the property or parameters is required.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../src/decorators/common/description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../src/decorators/common/description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,WAAW,CAAC,WAAgB;IAC1C,OAAO,YAAY,CAAC,CAAC,KAAsB,EAAE,IAAyB,EAAE,EAAE;;QACxE,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,cAAc,CAAC,IAAI,CAAC;YACzB,KAAK,cAAc,CAAC,KAAK;gBACvB,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACtC,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACtB,KAA4B,CAAC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACjE,MAAM;YAER,KAAK,cAAc,CAAC,MAAM;gBACxB,MAAC,KAAyB,CAAC,SAAS,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAC;gBAC/D,MAAM;SACT;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {DecoratorParameters, decoratorTypeOf, DecoratorTypes} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\nimport type {JsonMethodStore} from \"../../domain/JsonMethodStore\";\nimport type {JsonParameterStore} from \"../../domain/JsonParameterStore\";\n\n/**\n * Add a description to the class, method or property\n *\n * ## Examples\n * ### On class\n *\n * ```typescript\n * @Description(\"description\")\n * class Model {\n *\n * }\n * ```\n *\n * ### On method\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * @Description(\"description\")\n * async method() {}\n * }\n * ```\n *\n * ### On parameter\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * async method(@Description(\"description\") @PathParam(\"id\") id: string) {}\n * }\n * ```\n *\n * ### On property\n *\n * ```typescript\n * class Model {\n * @Description(\"description\")\n * id: string;\n * }\n * ```\n *\n * @param {string} description\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @classDecorator\n * @methodDecorator\n * @propertyDecorator\n * @parameterDecorator\n */\nexport function Description(description: any) {\n return JsonEntityFn((store: JsonEntityStore, args: DecoratorParameters) => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.PROP:\n case DecoratorTypes.CLASS:\n store.schema.description(description);\n break;\n\n case DecoratorTypes.PARAM:\n (store as JsonParameterStore).parameter.description(description);\n break;\n\n case DecoratorTypes.METHOD:\n (store as JsonMethodStore).operation?.description(description);\n break;\n }\n });\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JsonFormatTypes } from "../../domain/JsonFormatTypes";
|
|
2
|
-
import { JsonEntityFn } from "./jsonEntityFn";
|
|
1
|
+
import { JsonFormatTypes } from "../../domain/JsonFormatTypes.js";
|
|
2
|
+
import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
3
3
|
/**
|
|
4
4
|
* The following formats are supported for string validation with `format` keyword:
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DecoratorTypes } from "@tsed/core";
|
|
2
|
-
import { matchGroups } from "../../utils/matchGroups";
|
|
3
|
-
import { JsonEntityFn } from "./jsonEntityFn";
|
|
2
|
+
import { matchGroups } from "../../utils/matchGroups.js";
|
|
3
|
+
import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../../../src/decorators/common/ignore.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,UAAU,MAAM,CAAC,KAA+B,SAAS;IAC7D,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {IgnoreCallback} from \"../../interfaces\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * @ignore\n */\nconst defaultCB = (value: any, ctx: any) => ctx.mongoose !== true;\n\n/**\n * Ignore the property when JsonMapper serialize the class to a Plain Object JavaScript.\n *\n * ::: warning\n * Swagger will not generate documentation for the ignored property.\n * :::\n *\n * ```typescript\n * class User {\n * @Ignore()\n * _id: string;\n *\n * @Property()\n * firstName: string;\n *\n * @Property()\n * lastName: string;\n *\n * @Ignore((value, ctx) => !ctx.mongoose) // don't ignore prop only if mongoose\n * password: string;\n * }\n * ```\n *\n * The controller:\n * ```typescript\n * import {Post, Controller, BodyParams} from \"@tsed/common\";\n * import {Person} from \"../models/Person\";\n *\n * @Controller(\"/\")\n * export class UsersCtrl {\n * @Get(\"/\")\n * get(): User {\n * const user = new User();\n * user._id = \"12345\";\n * user.firstName = \"John\";\n * user.lastName = \"Doe\";\n * user.password = \"secretpassword\";\n * return\n * }\n * }\n * ```\n *\n * The expected json object:\n *\n * ```json\n * {\n * \"firstName\": \"John\",\n * \"lastName\": \"Doe\"\n * }\n * ```\n * @param cb Callback to know if the property must be ignored\n * @decorator\n * @validation\n * @swagger\n * @schema\n */\nexport function Ignore(cb: boolean | IgnoreCallback = defaultCB) {\n return JsonEntityFn((store) => {\n store.schema.ignore(cb);\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../../../src/decorators/common/ignore.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,UAAU,MAAM,CAAC,KAA+B,SAAS;IAC7D,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {IgnoreCallback} from \"../../interfaces/IgnoreCallback\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * @ignore\n */\nconst defaultCB = (value: any, ctx: any) => ctx.mongoose !== true;\n\n/**\n * Ignore the property when JsonMapper serialize the class to a Plain Object JavaScript.\n *\n * ::: warning\n * Swagger will not generate documentation for the ignored property.\n * :::\n *\n * ```typescript\n * class User {\n * @Ignore()\n * _id: string;\n *\n * @Property()\n * firstName: string;\n *\n * @Property()\n * lastName: string;\n *\n * @Ignore((value, ctx) => !ctx.mongoose) // don't ignore prop only if mongoose\n * password: string;\n * }\n * ```\n *\n * The controller:\n * ```typescript\n * import {Post, Controller, BodyParams} from \"@tsed/common\";\n * import {Person} from \"../models/Person\";\n *\n * @Controller(\"/\")\n * export class UsersCtrl {\n * @Get(\"/\")\n * get(): User {\n * const user = new User();\n * user._id = \"12345\";\n * user.firstName = \"John\";\n * user.lastName = \"Doe\";\n * user.password = \"secretpassword\";\n * return\n * }\n * }\n * ```\n *\n * The expected json object:\n *\n * ```json\n * {\n * \"firstName\": \"John\",\n * \"lastName\": \"Doe\"\n * }\n * ```\n * @param cb Callback to know if the property must be ignored\n * @decorator\n * @validation\n * @swagger\n * @schema\n */\nexport function Ignore(cb: boolean | IgnoreCallback = defaultCB) {\n return JsonEntityFn((store) => {\n store.schema.ignore(cb);\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonEntityFn.js","sourceRoot":"","sources":["../../../../src/decorators/common/jsonEntityFn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAuD;IAEvD,OAAO,CAAC,GAAG,UAA+B,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAQ,EAAE,CAAC,kBAAkB,CAAI,GAAG,UAAU,CAAM,EAAE,UAAU,CAAC,CAAC;QAC9E,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;YAChC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC;SACvB;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {DecoratorParameters} from \"@tsed/core\";\nimport type {JsonEntityStore} from \"../../domain\";\nimport {getJsonEntityStore} from \"../../utils/getJsonEntityStore\";\n\n/**\n * Decorator util to compose another decorator. See @@Description@@ decorator implementation for more details.\n *\n * ## Usage\n *\n * ```typescript\n * export function Description(description: any) {\n * return JsonEntityFn((entity: JsonEntityStore, args: DecoratorParameters) => {\n * entity.itemSchema.description(description)\n * });\n * }\n * ```\n *\n * @param fn\n * @decorator\n * @utils\n * @model\n */\nexport function JsonEntityFn<T extends JsonEntityStore = JsonEntityStore>(\n fn: (entity: T, parameters: DecoratorParameters) => any\n): (...args: any[]) => any {\n return (...parameters: DecoratorParameters) => {\n const result: any = fn(getJsonEntityStore<T>(...parameters) as T, parameters);\n if (typeof result === \"function\") {\n result(...parameters);\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"jsonEntityFn.js","sourceRoot":"","sources":["../../../../src/decorators/common/jsonEntityFn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAuD;IAEvD,OAAO,CAAC,GAAG,UAA+B,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAQ,EAAE,CAAC,kBAAkB,CAAI,GAAG,UAAU,CAAM,EAAE,UAAU,CAAC,CAAC;QAC9E,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;YAChC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC;SACvB;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {DecoratorParameters} from \"@tsed/core\";\nimport type {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {getJsonEntityStore} from \"../../utils/getJsonEntityStore\";\n\n/**\n * Decorator util to compose another decorator. See @@Description@@ decorator implementation for more details.\n *\n * ## Usage\n *\n * ```typescript\n * export function Description(description: any) {\n * return JsonEntityFn((entity: JsonEntityStore, args: DecoratorParameters) => {\n * entity.itemSchema.description(description)\n * });\n * }\n * ```\n *\n * @param fn\n * @decorator\n * @utils\n * @model\n */\nexport function JsonEntityFn<T extends JsonEntityStore = JsonEntityStore>(\n fn: (entity: T, parameters: DecoratorParameters) => any\n): (...args: any[]) => any {\n return (...parameters: DecoratorParameters) => {\n const result: any = fn(getJsonEntityStore<T>(...parameters) as T, parameters);\n if (typeof result === \"function\") {\n result(...parameters);\n }\n };\n}\n"]}
|