@tsed/schema 6.114.16 → 6.114.17

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.
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getJsonSchema = void 0;
4
- const SpecTypes_1 = require("../domain/SpecTypes");
5
- const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
6
- const getJsonEntityStore_1 = require("./getJsonEntityStore");
7
4
  require("../components/anyMapper");
8
5
  require("../components/classMapper");
9
6
  require("../components/genericsMapper");
@@ -15,6 +12,9 @@ require("../components/objectMapper");
15
12
  require("../components/ofMapper");
16
13
  require("../components/propertiesMapper");
17
14
  require("../components/schemaMapper");
15
+ const SpecTypes_1 = require("../domain/SpecTypes");
16
+ const JsonSchemaMapperContainer_1 = require("../registries/JsonSchemaMapperContainer");
17
+ const getJsonEntityStore_1 = require("./getJsonEntityStore");
18
18
  /**
19
19
  * @ignore
20
20
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":";;;AAEA,mDAA8C;AAE9C,uFAAmE;AACnE,6DAAwD;AACxD,mCAAiC;AACjC,qCAAmC;AACnC,wCAAsC;AACtC,8CAA4C;AAC5C,oCAAkC;AAClC,uCAAqC;AACrC,mCAAiC;AACjC,sCAAoC;AACpC,kCAAgC;AAChC,0CAAwC;AACxC,sCAAoC;AAEpC;;GAEG;AACH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;GAEG;AACH,SAAS,MAAM,CAAC,OAAY;IAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,GAAG,CAAC,MAAuB,EAAE,OAAY;IAChD,MAAM,KAAK,GAAqB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,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ed/core\";\nimport type {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\nimport \"../components/anyMapper\";\nimport \"../components/classMapper\";\nimport \"../components/genericsMapper\";\nimport \"../components/inheritedClassMapper\";\nimport \"../components/itemMapper\";\nimport \"../components/lazyRefMapper\";\nimport \"../components/mapMapper\";\nimport \"../components/objectMapper\";\nimport \"../components/ofMapper\";\nimport \"../components/propertiesMapper\";\nimport \"../components/schemaMapper\";\n\n/**\n * @ignore\n */\nconst CACHE_KEY = \"$cache:schemes\";\n\n/**\n * @ignore\n */\nfunction getKey(options: any) {\n return JSON.stringify(options);\n}\n\n/**\n * @ignore\n */\nfunction get(entity: JsonEntityStore, options: any) {\n const cache: Map<string, any> = entity.store.get(CACHE_KEY) || new Map();\n const key = getKey(options);\n\n if (!cache.has(key)) {\n const schema = execMapper(\"schema\", entity.schema, options);\n\n if (Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n cache.set(key, schema);\n }\n\n entity.store.set(CACHE_KEY, cache);\n\n return cache.get(key);\n}\n\nexport function getJsonSchema(model: Type<any> | any, options: JsonSchemaOptions = {}) {\n const entity = getJsonEntityStore(model);\n\n options = {\n endpoint: true,\n groups: [],\n ...options,\n specType: options.specType || SpecTypes.JSON,\n schemas: {}\n };\n\n if (entity.decoratorType === \"parameter\") {\n options = {\n ...options,\n genericTypes: entity.nestedGenerics[0],\n nestedGenerics: entity.nestedGenerics,\n groups: entity.parameter?.groups\n };\n }\n\n return get(entity, options);\n}\n"]}
1
+ {"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":";;;AACA,mCAAiC;AACjC,qCAAmC;AACnC,wCAAsC;AACtC,8CAA4C;AAC5C,oCAAkC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AAC,QAAQ,IAAI,qBAAS,CAAC,IAAI;QAC5C,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,IAAI,MAAM,CAAC,aAAa,KAAK,WAAW,EAAE;QACxC,OAAO,GAAG;YACR,GAAG,OAAO;YACV,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;YACtC,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAA,MAAM,CAAC,SAAS,0CAAE,MAAM;SACjC,CAAC;KACH;IAED,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC;AArBD,sCAqBC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport \"../components/anyMapper\";\nimport \"../components/classMapper\";\nimport \"../components/genericsMapper\";\nimport \"../components/inheritedClassMapper\";\nimport \"../components/itemMapper\";\nimport \"../components/lazyRefMapper\";\nimport \"../components/mapMapper\";\nimport \"../components/objectMapper\";\nimport \"../components/ofMapper\";\nimport \"../components/propertiesMapper\";\nimport \"../components/schemaMapper\";\nimport type {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\n\n/**\n * @ignore\n */\nconst CACHE_KEY = \"$cache:schemes\";\n\n/**\n * @ignore\n */\nfunction getKey(options: any) {\n return JSON.stringify(options);\n}\n\n/**\n * @ignore\n */\nfunction get(entity: JsonEntityStore, options: any) {\n const cache: Map<string, any> = entity.store.get(CACHE_KEY) || new Map();\n const key = getKey(options);\n\n if (!cache.has(key)) {\n const schema = execMapper(\"schema\", entity.schema, options);\n\n if (Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n cache.set(key, schema);\n }\n\n entity.store.set(CACHE_KEY, cache);\n\n return cache.get(key);\n}\n\nexport function getJsonSchema(model: Type<any> | any, options: JsonSchemaOptions = {}) {\n const entity = getJsonEntityStore(model);\n\n options = {\n endpoint: true,\n groups: [],\n ...options,\n specType: options.specType || SpecTypes.JSON,\n schemas: {}\n };\n\n if (entity.decoratorType === \"parameter\") {\n options = {\n ...options,\n genericTypes: entity.nestedGenerics[0],\n nestedGenerics: entity.nestedGenerics,\n groups: entity.parameter?.groups\n };\n }\n\n return get(entity, options);\n}\n"]}
@@ -1,6 +1,3 @@
1
- import { SpecTypes } from "../domain/SpecTypes.js";
2
- import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
3
- import { getJsonEntityStore } from "./getJsonEntityStore.js";
4
1
  import "../components/anyMapper.js";
5
2
  import "../components/classMapper.js";
6
3
  import "../components/genericsMapper.js";
@@ -12,6 +9,9 @@ import "../components/objectMapper.js";
12
9
  import "../components/ofMapper.js";
13
10
  import "../components/propertiesMapper.js";
14
11
  import "../components/schemaMapper.js";
12
+ import { SpecTypes } from "../domain/SpecTypes.js";
13
+ import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
14
+ import { getJsonEntityStore } from "./getJsonEntityStore.js";
15
15
  /**
16
16
  * @ignore
17
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,yBAAyB,CAAC;AACjC,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AACtC,OAAO,oCAAoC,CAAC;AAC5C,OAAO,0BAA0B,CAAC;AAClC,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,gCAAgC,CA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AAW,EAAE;QACxC,OAAO,GAAG;YACR,GAAG,OAAO;YACV,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;YACtC,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAA,MAAM,CAAC,SAAS,0CAAE,MAAM;SACjC,CAAC;KACH;IAED,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport type {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\nimport \"../components/anyMapper\";\nimport \"../components/classMapper\";\nimport \"../components/genericsMapper\";\nimport \"../components/inheritedClassMapper\";\nimport \"../components/itemMapper\";\nimport \"../components/lazyRefMapper\";\nimport \"../components/mapMapper\";\nimport \"../components/objectMapper\";\nimport \"../components/ofMapper\";\nimport \"../components/propertiesMapper\";\nimport \"../components/schemaMapper\";\n\n/**\n * @ignore\n */\nconst CACHE_KEY = \"$cache:schemes\";\n\n/**\n * @ignore\n */\nfunction getKey(options: any) {\n return JSON.stringify(options);\n}\n\n/**\n * @ignore\n */\nfunction get(entity: JsonEntityStore, options: any) {\n const cache: Map<string, any> = entity.store.get(CACHE_KEY) || new Map();\n const key = getKey(options);\n\n if (!cache.has(key)) {\n const schema = execMapper(\"schema\", entity.schema, options);\n\n if (Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n cache.set(key, schema);\n }\n\n entity.store.set(CACHE_KEY, cache);\n\n return cache.get(key);\n}\n\nexport function getJsonSchema(model: Type<any> | any, options: JsonSchemaOptions = {}) {\n const entity = getJsonEntityStore(model);\n\n options = {\n endpoint: true,\n groups: [],\n ...options,\n specType: options.specType || SpecTypes.JSON,\n schemas: {}\n };\n\n if (entity.decoratorType === \"parameter\") {\n options = {\n ...options,\n genericTypes: entity.nestedGenerics[0],\n nestedGenerics: entity.nestedGenerics,\n groups: entity.parameter?.groups\n };\n }\n\n return get(entity, options);\n}\n"]}
1
+ {"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":"AACA,OAAO,yBAAyB,CAAC;AACjC,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AACtC,OAAO,oCAAoC,CAAC;AAC5C,OAAO,0BAA0B,CAAC;AAClC,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,gCAAgC,CAAC;AACxC,OAAO,4BAA4B,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD;;GAEG;AACH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;GAEG;AACH,SAAS,MAAM,CAAC,OAAY;IAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,GAAG,CAAC,MAAuB,EAAE,OAAY;IAChD,MAAM,KAAK,GAAqB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;IACzE,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5D,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YACvC,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;SACtC;QAED,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KACxB;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAsB,EAAE,UAA6B,EAAE;;IACnF,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAEzC,OAAO,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE;QACV,GAAG,OAAO;QACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI;QAC5C,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,IAAI,MAAM,CAAC,aAAa,KAAK,WAAW,EAAE;QACxC,OAAO,GAAG;YACR,GAAG,OAAO;YACV,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;YACtC,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAA,MAAM,CAAC,SAAS,0CAAE,MAAM;SACjC,CAAC;KACH;IAED,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport \"../components/anyMapper\";\nimport \"../components/classMapper\";\nimport \"../components/genericsMapper\";\nimport \"../components/inheritedClassMapper\";\nimport \"../components/itemMapper\";\nimport \"../components/lazyRefMapper\";\nimport \"../components/mapMapper\";\nimport \"../components/objectMapper\";\nimport \"../components/ofMapper\";\nimport \"../components/propertiesMapper\";\nimport \"../components/schemaMapper\";\nimport type {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\n\n/**\n * @ignore\n */\nconst CACHE_KEY = \"$cache:schemes\";\n\n/**\n * @ignore\n */\nfunction getKey(options: any) {\n return JSON.stringify(options);\n}\n\n/**\n * @ignore\n */\nfunction get(entity: JsonEntityStore, options: any) {\n const cache: Map<string, any> = entity.store.get(CACHE_KEY) || new Map();\n const key = getKey(options);\n\n if (!cache.has(key)) {\n const schema = execMapper(\"schema\", entity.schema, options);\n\n if (Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n cache.set(key, schema);\n }\n\n entity.store.set(CACHE_KEY, cache);\n\n return cache.get(key);\n}\n\nexport function getJsonSchema(model: Type<any> | any, options: JsonSchemaOptions = {}) {\n const entity = getJsonEntityStore(model);\n\n options = {\n endpoint: true,\n groups: [],\n ...options,\n specType: options.specType || SpecTypes.JSON,\n schemas: {}\n };\n\n if (entity.decoratorType === \"parameter\") {\n options = {\n ...options,\n genericTypes: entity.nestedGenerics[0],\n nestedGenerics: entity.nestedGenerics,\n groups: entity.parameter?.groups\n };\n }\n\n return get(entity, options);\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import { Type } from "@tsed/core";
2
- import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
3
2
  import "../components/anyMapper";
4
3
  import "../components/classMapper";
5
4
  import "../components/genericsMapper";
@@ -11,4 +10,5 @@ import "../components/objectMapper";
11
10
  import "../components/ofMapper";
12
11
  import "../components/propertiesMapper";
13
12
  import "../components/schemaMapper";
13
+ import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions";
14
14
  export declare function getJsonSchema(model: Type<any> | any, options?: JsonSchemaOptions): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/schema",
3
- "version": "6.114.16",
3
+ "version": "6.114.17",
4
4
  "description": "JsonSchema module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -32,7 +32,7 @@
32
32
  "tsed"
33
33
  ],
34
34
  "dependencies": {
35
- "@tsed/openspec": "6.114.16",
35
+ "@tsed/openspec": "6.114.17",
36
36
  "camel-case": "4.1.2",
37
37
  "fs-extra": "^10.0.1",
38
38
  "json-schema": "0.4.0",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@apidevtools/swagger-parser": "10.0.3",
46
- "@tsed/core": "6.114.16",
47
- "@tsed/openspec": "6.114.16",
46
+ "@tsed/core": "6.114.17",
47
+ "@tsed/openspec": "6.114.17",
48
48
  "@types/fs-extra": "9.0.13",
49
49
  "@types/json-schema": "7.0.11",
50
50
  "@types/micromatch": "4.0.2",
@@ -52,8 +52,8 @@
52
52
  "api-spec-converter": "2.12.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@tsed/core": "^6.114.16",
56
- "@tsed/openspec": "^6.114.16"
55
+ "@tsed/core": "^6.114.17",
56
+ "@tsed/openspec": "^6.114.17"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@tsed/openspec": {