@tsed/schema 6.116.0 → 6.116.3

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DecoratorContext = void 0;
4
4
  const core_1 = require("@tsed/core");
5
- const pascal_case_1 = require("pascal-case");
5
+ const change_case_1 = require("change-case");
6
6
  const JsonEntityStore_1 = require("./JsonEntityStore");
7
7
  /**
8
8
  * @ignore
@@ -36,7 +36,7 @@ class DecoratorContext extends Map {
36
36
  });
37
37
  };
38
38
  this.methods.forEach((name) => {
39
- decorator[(0, pascal_case_1.pascalCase)(name)] = wrapKey(name);
39
+ decorator[(0, change_case_1.pascalCase)(name)] = wrapKey(name);
40
40
  });
41
41
  return decorator;
42
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DecoratorContext.js","sourceRoot":"","sources":["../../../src/domain/DecoratorContext.ts"],"names":[],"mappings":";;;AAAA,qCAA+D;AAC/D,6CAAuC;AACvC,uDAAkD;AASlD;;GAEG;AACH,MAAsB,gBAA0B,SAAQ,GAAgB;IAC7D,OAAO,CAAW;IACjB,aAAa,CAAiB;IAC9B,MAAM,CAAkB;IACxB,OAAO,GAA6B,EAAE,CAAC;IAEjD,YAAY,OAAY,EAAE;QACxB,KAAK,EAAE,CAAC;QAER,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,EAA0B;QAClC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,MAAM,SAAS,GAAQ,CAAC,GAAG,IAAyB,EAAE,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O;SACR;QAED,IAAI,IAAI,CAAC,aAAa,KAAK,qBAAc,CAAC,KAAK,EAAE;YAC/C,KAAK,GAAG;gBACN,GAAG,KAAK;gBACR,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;aACxB,CAAC;SACH;QAED,OAAO;YACL,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;YACvB,GAAG,KAAK;SACT,CAAC;IACJ,CAAC;IAES,IAAI,CAAC,IAAyB,EAAE,SAAc;QACtD,IAAI,CAAC,MAAM,GAAG,iCAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAES,MAAM,CAAC,IAAyB,EAAE,SAAc;QACxD,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAES,QAAQ,CAAC,GAAW,EAAE,KAAU;QACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAES,UAAU;QAClB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAES,UAAU,KAAI,CAAC;IAEf,SAAS,KAAI,CAAC;CACzB;AApGD,4CAoGC","sourcesContent":["import {DecoratorParameters, DecoratorTypes} from \"@tsed/core\";\nimport {pascalCase} from \"pascal-case\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\n\n/**\n * @ignore\n */\nexport interface DecoratorActionHandler {\n (ctx: Map<string, any>): void;\n}\n\n/**\n * @ignore\n */\nexport abstract class DecoratorContext<T = any> extends Map<string, any> {\n readonly methods: string[];\n protected decoratorType: DecoratorTypes;\n protected entity: JsonEntityStore;\n protected actions: DecoratorActionHandler[] = [];\n\n constructor(opts: any = {}) {\n super();\n\n Object.entries(opts).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n addAction(cb: DecoratorActionHandler) {\n this.actions.push(cb);\n return this;\n }\n\n build(): T {\n const decorator: any = (...args: DecoratorParameters) => this.bind(args, decorator);\n\n const wrap = (cb: any) => {\n return (...args: any[]) => {\n cb(...args);\n return decorator;\n };\n };\n\n const wrapKey = (key: string) => {\n return wrap((...values: any[]) => {\n key in this ? (this as any)[key](...values) : this.set(key, values[0]);\n });\n };\n\n this.methods.forEach((name) => {\n decorator[pascalCase(name)] = wrapKey(name);\n });\n\n return decorator as unknown as T;\n }\n\n toObject(): any {\n return [...this.entries()].reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: value\n };\n }, {});\n }\n\n getMergedKey(key: string, defaultValue: any) {\n let value = this.get(key) || defaultValue;\n\n if (!value) {\n return;\n }\n\n if (this.decoratorType === DecoratorTypes.CLASS) {\n value = {\n ...value,\n ...(defaultValue || {})\n };\n }\n\n return {\n ...(defaultValue || {}),\n ...value\n };\n }\n\n protected bind(args: DecoratorParameters, decorator: any) {\n this.entity = JsonEntityStore.from(...args);\n\n this.beforeInit();\n this.onInit(args, decorator);\n this.afterInit();\n }\n\n protected onInit(args: DecoratorParameters, decorator: any): void {\n this.forEach((value, key) => {\n this.onMapKey(key, value);\n });\n }\n\n protected onMapKey(key: string, value: any): void {\n this.entity.set(key, value);\n }\n\n protected runActions() {\n this.actions.forEach((action: any) => {\n action(this);\n });\n\n return this;\n }\n\n protected beforeInit() {}\n\n protected afterInit() {}\n}\n"]}
1
+ {"version":3,"file":"DecoratorContext.js","sourceRoot":"","sources":["../../../src/domain/DecoratorContext.ts"],"names":[],"mappings":";;;AAAA,qCAA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IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAES,QAAQ,CAAC,GAAW,EAAE,KAAU;QACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAES,UAAU;QAClB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAES,UAAU,KAAI,CAAC;IAEf,SAAS,KAAI,CAAC;CACzB;AApGD,4CAoGC","sourcesContent":["import {DecoratorParameters, DecoratorTypes} from \"@tsed/core\";\nimport {pascalCase} from \"change-case\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\n\n/**\n * @ignore\n */\nexport interface DecoratorActionHandler {\n (ctx: Map<string, any>): void;\n}\n\n/**\n * @ignore\n */\nexport abstract class DecoratorContext<T = any> extends Map<string, any> {\n readonly methods: string[];\n protected decoratorType: DecoratorTypes;\n protected entity: JsonEntityStore;\n protected actions: DecoratorActionHandler[] = [];\n\n constructor(opts: any = {}) {\n super();\n\n Object.entries(opts).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n addAction(cb: DecoratorActionHandler) {\n this.actions.push(cb);\n return this;\n }\n\n build(): T {\n const decorator: any = (...args: DecoratorParameters) => this.bind(args, decorator);\n\n const wrap = (cb: any) => {\n return (...args: any[]) => {\n cb(...args);\n return decorator;\n };\n };\n\n const wrapKey = (key: string) => {\n return wrap((...values: any[]) => {\n key in this ? (this as any)[key](...values) : this.set(key, values[0]);\n });\n };\n\n this.methods.forEach((name) => {\n decorator[pascalCase(name)] = wrapKey(name);\n });\n\n return decorator as unknown as T;\n }\n\n toObject(): any {\n return [...this.entries()].reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: value\n };\n }, {});\n }\n\n getMergedKey(key: string, defaultValue: any) {\n let value = this.get(key) || defaultValue;\n\n if (!value) {\n return;\n }\n\n if (this.decoratorType === DecoratorTypes.CLASS) {\n value = {\n ...value,\n ...(defaultValue || {})\n };\n }\n\n return {\n ...(defaultValue || {}),\n ...value\n };\n }\n\n protected bind(args: DecoratorParameters, decorator: any) {\n this.entity = JsonEntityStore.from(...args);\n\n this.beforeInit();\n this.onInit(args, decorator);\n this.afterInit();\n }\n\n protected onInit(args: DecoratorParameters, decorator: any): void {\n this.forEach((value, key) => {\n this.onMapKey(key, value);\n });\n }\n\n protected onMapKey(key: string, value: any): void {\n this.entity.set(key, value);\n }\n\n protected runActions() {\n this.actions.forEach((action: any) => {\n action(this);\n });\n\n return this;\n }\n\n protected beforeInit() {}\n\n protected afterInit() {}\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.operationIdFormatter = void 0;
4
- const camel_case_1 = require("camel-case");
4
+ const change_case_1 = require("change-case");
5
5
  const DEFAULT_PATTERN = "%c.%m";
6
6
  /**
7
7
  * @ignore
@@ -10,7 +10,7 @@ function operationIdFormatter(pattern = "") {
10
10
  const OPERATION_IDS = new Map();
11
11
  const transform = (name, propertyKey) => {
12
12
  const str = (pattern || DEFAULT_PATTERN).replace(/%c/, name).replace(/%m/, propertyKey);
13
- return pattern === "" ? (0, camel_case_1.camelCase)(str) : str;
13
+ return pattern === "" ? (0, change_case_1.camelCase)(str) : str;
14
14
  };
15
15
  return (name, propertyKey, path = "") => {
16
16
  const operationId = transform(name, propertyKey);
@@ -25,7 +25,7 @@ function operationIdFormatter(pattern = "") {
25
25
  const operationKey = name + propertyKey + result[0];
26
26
  if (!OPERATION_IDS.has(operationKey)) {
27
27
  OPERATION_IDS.set(operationKey, 0);
28
- return (0, camel_case_1.camelCase)(`${operationId} By ${result}`);
28
+ return (0, change_case_1.camelCase)(`${operationId} By ${result}`);
29
29
  }
30
30
  }
31
31
  const id = OPERATION_IDS.get(operationKey) + 1;
@@ -1 +1 @@
1
- {"version":3,"file":"operationIdFormatter.js","sourceRoot":"","sources":["../../../src/utils/operationIdFormatter.ts"],"names":[],"mappings":";;;AAAA,2CAAqC;AAErC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;GAEG;AACH,SAAgB,oBAAoB,CAAC,UAAkB,EAAE;IACvD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,EAAE;QACtD,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACxF,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAA,sBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/C,CAAC,CAAC;IAEF,OAAO,CAAC,IAAY,EAAE,WAAmB,EAAE,OAAe,EAAE,EAAE,EAAE;QAC9D,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,CAAC;QAExC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACpC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;YAEnC,OAAO,WAAW,CAAC;SACpB;QAED,iBAAiB;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,MAAM,EAAE;YACV,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAEpD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;gBACpC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;gBAEnC,OAAO,IAAA,sBAAS,EAAC,GAAG,WAAW,OAAO,MAAM,EAAE,CAAC,CAAC;aACjD;SACF;QAED,MAAM,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,CAAE,GAAG,CAAC,CAAC;QAChD,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,GAAG,WAAW,IAAI,EAAE,EAAE,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAnCD,oDAmCC","sourcesContent":["import {camelCase} from \"camel-case\";\n\nconst DEFAULT_PATTERN = \"%c.%m\";\n\n/**\n * @ignore\n */\nexport function operationIdFormatter(pattern: string = \"\") {\n const OPERATION_IDS = new Map<string, number>();\n\n const transform = (name: string, propertyKey: string) => {\n const str = (pattern || DEFAULT_PATTERN).replace(/%c/, name).replace(/%m/, propertyKey);\n return pattern === \"\" ? camelCase(str) : str;\n };\n\n return (name: string, propertyKey: string, path: string = \"\") => {\n const operationId = transform(name, propertyKey);\n const operationKey = name + propertyKey;\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return operationId;\n }\n\n // try with paths\n const result = path.match(/{(\\w+)}/gi);\n if (result) {\n const operationKey = name + propertyKey + result[0];\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return camelCase(`${operationId} By ${result}`);\n }\n }\n\n const id = OPERATION_IDS.get(operationKey)! + 1;\n OPERATION_IDS.set(operationKey, id);\n\n return `${operationId}_${id}`;\n };\n}\n"]}
1
+ {"version":3,"file":"operationIdFormatter.js","sourceRoot":"","sources":["../../../src/utils/operationIdFormatter.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AAEtC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;GAEG;AACH,SAAgB,oBAAoB,CAAC,UAAkB,EAAE;IACvD,MAAM,aAAa,GAAG,IAAI,G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G,WAAW,IAAI,EAAE,EAAE,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAnCD,oDAmCC","sourcesContent":["import {camelCase} from \"change-case\";\n\nconst DEFAULT_PATTERN = \"%c.%m\";\n\n/**\n * @ignore\n */\nexport function operationIdFormatter(pattern: string = \"\") {\n const OPERATION_IDS = new Map<string, number>();\n\n const transform = (name: string, propertyKey: string) => {\n const str = (pattern || DEFAULT_PATTERN).replace(/%c/, name).replace(/%m/, propertyKey);\n return pattern === \"\" ? camelCase(str) : str;\n };\n\n return (name: string, propertyKey: string, path: string = \"\") => {\n const operationId = transform(name, propertyKey);\n const operationKey = name + propertyKey;\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return operationId;\n }\n\n // try with paths\n const result = path.match(/{(\\w+)}/gi);\n if (result) {\n const operationKey = name + propertyKey + result[0];\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return camelCase(`${operationId} By ${result}`);\n }\n }\n\n const id = OPERATION_IDS.get(operationKey)! + 1;\n OPERATION_IDS.set(operationKey, id);\n\n return `${operationId}_${id}`;\n };\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toRef = exports.createRef = exports.createRefName = void 0;
4
- const pascal_case_1 = require("pascal-case");
4
+ const change_case_1 = require("change-case");
5
5
  const SpecTypes_1 = require("../domain/SpecTypes");
6
6
  const core_1 = require("@tsed/core");
7
7
  /**
@@ -17,7 +17,7 @@ function getHost(options) {
17
17
  */
18
18
  function createRefName(name, options) {
19
19
  if (options.groups && options.groups.length) {
20
- return (0, pascal_case_1.pascalCase)(`${name} ${options.groups.join(" ")}`);
20
+ return (0, change_case_1.pascalCase)(`${name} ${options.groups.join(" ")}`);
21
21
  }
22
22
  return name;
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/ut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,CAAC,CAAC,CAAC,SAAS;oBACrC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;oBACvC,KAAK,EAAE,CAAC,GAAG,CAAC;iBACb,CAAC,CAAC;YACL,KAAK,qBAAS,CAAC,IAAI;gBACjB,OAAO,IAAA,kBAAW,EAAC;oBACjB,QAAQ;oBACR,SAAS;oBACT,KAAK,EAAE,CAAC,GAAG,CAAC;iBACb,CAAC,CAAC;YACL,KAAK,qBAAS,CAAC,OAAO,EAAE,2BAA2B;gBACjD,IAAI,QAAQ,IAAI,SAAS,EAAE;oBACzB,OAAO,IAAA,kBAAW,EAAC;wBACjB,QAAQ;wBACR,SAAS;wBACT,KAAK,EAAE,CAAC,GAAG,CAAC;qBACb,CAAC,CAAC;iBACJ;SACJ;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AArCD,8BAqCC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,KAAiB,EAAE,MAAW,EAAE,OAA0B;IAC9E,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAErD,OAAO,CAAC,OAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC;IAE3C,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAND,sBAMC","sourcesContent":["import {pascalCase} from \"pascal-case\";\nimport type {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {cleanObject} from \"@tsed/core\";\n\n/**\n * ignore\n * @param options\n */\nfunction getHost(options: JsonSchemaOptions) {\n const {host = `#/${options.specType === \"openapi3\" ? \"components/schemas\" : \"definitions\"}`} = options;\n\n return host;\n}\n\n/**\n * @ignore\n */\nexport function createRefName(name: string, options: JsonSchemaOptions) {\n if (options.groups && options.groups.length) {\n return pascalCase(`${name} ${options.groups.join(\" \")}`);\n }\n\n return name;\n}\n\n/**\n * @ignore\n */\nexport function createRef(name: string, schema: JsonSchema, options: JsonSchemaOptions) {\n const host = getHost(options);\n const ref = {\n $ref: `${host}/${name}`\n };\n\n const nullable = schema.isNullable;\n const readOnly = schema.isReadOnly;\n const writeOnly = schema.isWriteOnly;\n\n if (nullable || readOnly || writeOnly) {\n switch (options.specType) {\n case SpecTypes.OPENAPI:\n return cleanObject({\n nullable: nullable ? true : undefined,\n readOnly: readOnly ? true : undefined,\n writeOnly: writeOnly ? true : undefined,\n oneOf: [ref]\n });\n case SpecTypes.JSON:\n return cleanObject({\n readOnly,\n writeOnly,\n oneOf: [ref]\n });\n case SpecTypes.SWAGGER: // TODO unsupported feature\n if (readOnly || writeOnly) {\n return cleanObject({\n readOnly,\n writeOnly,\n allOf: [ref]\n });\n }\n }\n }\n\n return ref;\n}\n\n/**\n * @ignore\n */\nexport function toRef(value: JsonSchema, schema: any, options: JsonSchemaOptions) {\n const name = createRefName(value.getName(), options);\n\n options.schemas![value.getName()] = schema;\n\n return createRef(name, value, options);\n}\n"]}
1
+ {"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/utils/ref.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AAEvC,mDAA8C;AAE9C,qCAAuC;AAEvC;;;GAGG;AACH,SAAS,OAAO,CAAC,OAA0B;IACzC,MAAM,EAAC,IAAI,GAAG,KAAK,OAAO,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,EAAE,EAAC,GAAG,OAAO,CAAC;IAEvG,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAY,EAAE,OAA0B;IACpE,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3C,OAAO,IAAA,wBAAU,EAAC,GAAG,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,CAAC;qBACb,CAAC,CAAC;iBACJ;SACJ;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AArCD,8BAqCC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,KAAiB,EAAE,MAAW,EAAE,OAA0B;IAC9E,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAErD,OAAO,CAAC,OAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC;IAE3C,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAND,sBAMC","sourcesContent":["import {pascalCase} from \"change-case\";\nimport type {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {cleanObject} from \"@tsed/core\";\n\n/**\n * ignore\n * @param options\n */\nfunction getHost(options: JsonSchemaOptions) {\n const {host = `#/${options.specType === \"openapi3\" ? \"components/schemas\" : \"definitions\"}`} = options;\n\n return host;\n}\n\n/**\n * @ignore\n */\nexport function createRefName(name: string, options: JsonSchemaOptions) {\n if (options.groups && options.groups.length) {\n return pascalCase(`${name} ${options.groups.join(\" \")}`);\n }\n\n return name;\n}\n\n/**\n * @ignore\n */\nexport function createRef(name: string, schema: JsonSchema, options: JsonSchemaOptions) {\n const host = getHost(options);\n const ref = {\n $ref: `${host}/${name}`\n };\n\n const nullable = schema.isNullable;\n const readOnly = schema.isReadOnly;\n const writeOnly = schema.isWriteOnly;\n\n if (nullable || readOnly || writeOnly) {\n switch (options.specType) {\n case SpecTypes.OPENAPI:\n return cleanObject({\n nullable: nullable ? true : undefined,\n readOnly: readOnly ? true : undefined,\n writeOnly: writeOnly ? true : undefined,\n oneOf: [ref]\n });\n case SpecTypes.JSON:\n return cleanObject({\n readOnly,\n writeOnly,\n oneOf: [ref]\n });\n case SpecTypes.SWAGGER: // TODO unsupported feature\n if (readOnly || writeOnly) {\n return cleanObject({\n readOnly,\n writeOnly,\n allOf: [ref]\n });\n }\n }\n }\n\n return ref;\n}\n\n/**\n * @ignore\n */\nexport function toRef(value: JsonSchema, schema: any, options: JsonSchemaOptions) {\n const name = createRefName(value.getName(), options);\n\n options.schemas![value.getName()] = schema;\n\n return createRef(name, value, options);\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { DecoratorTypes } from "@tsed/core";
2
- import { pascalCase } from "pascal-case";
2
+ import { pascalCase } from "change-case";
3
3
  import { JsonEntityStore } from "./JsonEntityStore.js";
4
4
  /**
5
5
  * @ignore
@@ -1 +1 @@
1
- {"version":3,"file":"DecoratorContext.js","sourceRoot":"","sources":["../../../src/domain/DecoratorContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAC,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AASlD;;GAEG;AACH,MAAM,OAAgB,gBAA0B,SAAQ,GAAgB;IAC7D,OAAO,CAAW;IACjB,aAAa,CAAiB;IAC9B,MAAM,CAAkB;IACxB,OAAO,GAA6B,EAAE,CAAC;IAEjD,YAAY,OAAY,EAAE;QACxB,KAAK,EAAE,CAAC;QAER,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,EAA0B;QAClC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,MAAM,SAAS,GAAQ,CAAC,GAAG,IAAyB,EAAE,EAAE,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AAI,IAAI,CAAC,aAAa,KAAK,cAAc,CAAC,KAAK,EAAE;YAC/C,KAAK,GAAG;gBACN,GAAG,KAAK;gBACR,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;aACxB,CAAC;SACH;QAED,OAAO;YACL,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;YACvB,GAAG,KAAK;SACT,CAAC;IACJ,CAAC;IAES,IAAI,CAAC,IAAyB,EAAE,SAAc;QACtD,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAES,MAAM,CAAC,IAAyB,EAAE,SAAc;QACxD,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAES,QAAQ,CAAC,GAAW,EAAE,KAAU;QACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAES,UAAU;QAClB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAES,UAAU,KAAI,CAAC;IAEf,SAAS,KAAI,CAAC;CACzB","sourcesContent":["import {DecoratorParameters, DecoratorTypes} from \"@tsed/core\";\nimport {pascalCase} from \"pascal-case\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\n\n/**\n * @ignore\n */\nexport interface DecoratorActionHandler {\n (ctx: Map<string, any>): void;\n}\n\n/**\n * @ignore\n */\nexport abstract class DecoratorContext<T = any> extends Map<string, any> {\n readonly methods: string[];\n protected decoratorType: DecoratorTypes;\n protected entity: JsonEntityStore;\n protected actions: DecoratorActionHandler[] = [];\n\n constructor(opts: any = {}) {\n super();\n\n Object.entries(opts).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n addAction(cb: DecoratorActionHandler) {\n this.actions.push(cb);\n return this;\n }\n\n build(): T {\n const decorator: any = (...args: DecoratorParameters) => this.bind(args, decorator);\n\n const wrap = (cb: any) => {\n return (...args: any[]) => {\n cb(...args);\n return decorator;\n };\n };\n\n const wrapKey = (key: string) => {\n return wrap((...values: any[]) => {\n key in this ? (this as any)[key](...values) : this.set(key, values[0]);\n });\n };\n\n this.methods.forEach((name) => {\n decorator[pascalCase(name)] = wrapKey(name);\n });\n\n return decorator as unknown as T;\n }\n\n toObject(): any {\n return [...this.entries()].reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: value\n };\n }, {});\n }\n\n getMergedKey(key: string, defaultValue: any) {\n let value = this.get(key) || defaultValue;\n\n if (!value) {\n return;\n }\n\n if (this.decoratorType === DecoratorTypes.CLASS) {\n value = {\n ...value,\n ...(defaultValue || {})\n };\n }\n\n return {\n ...(defaultValue || {}),\n ...value\n };\n }\n\n protected bind(args: DecoratorParameters, decorator: any) {\n this.entity = JsonEntityStore.from(...args);\n\n this.beforeInit();\n this.onInit(args, decorator);\n this.afterInit();\n }\n\n protected onInit(args: DecoratorParameters, decorator: any): void {\n this.forEach((value, key) => {\n this.onMapKey(key, value);\n });\n }\n\n protected onMapKey(key: string, value: any): void {\n this.entity.set(key, value);\n }\n\n protected runActions() {\n this.actions.forEach((action: any) => {\n action(this);\n });\n\n return this;\n }\n\n protected beforeInit() {}\n\n protected afterInit() {}\n}\n"]}
1
+ {"version":3,"file":"DecoratorContext.js","sourceRoot":"","sources":["../../../src/domain/DecoratorContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAC,MAAM,YAAY,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,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAES,QAAQ,CAAC,GAAW,EAAE,KAAU;QACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAES,UAAU;QAClB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAES,UAAU,KAAI,CAAC;IAEf,SAAS,KAAI,CAAC;CACzB","sourcesContent":["import {DecoratorParameters, DecoratorTypes} from \"@tsed/core\";\nimport {pascalCase} from \"change-case\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\n\n/**\n * @ignore\n */\nexport interface DecoratorActionHandler {\n (ctx: Map<string, any>): void;\n}\n\n/**\n * @ignore\n */\nexport abstract class DecoratorContext<T = any> extends Map<string, any> {\n readonly methods: string[];\n protected decoratorType: DecoratorTypes;\n protected entity: JsonEntityStore;\n protected actions: DecoratorActionHandler[] = [];\n\n constructor(opts: any = {}) {\n super();\n\n Object.entries(opts).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n addAction(cb: DecoratorActionHandler) {\n this.actions.push(cb);\n return this;\n }\n\n build(): T {\n const decorator: any = (...args: DecoratorParameters) => this.bind(args, decorator);\n\n const wrap = (cb: any) => {\n return (...args: any[]) => {\n cb(...args);\n return decorator;\n };\n };\n\n const wrapKey = (key: string) => {\n return wrap((...values: any[]) => {\n key in this ? (this as any)[key](...values) : this.set(key, values[0]);\n });\n };\n\n this.methods.forEach((name) => {\n decorator[pascalCase(name)] = wrapKey(name);\n });\n\n return decorator as unknown as T;\n }\n\n toObject(): any {\n return [...this.entries()].reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: value\n };\n }, {});\n }\n\n getMergedKey(key: string, defaultValue: any) {\n let value = this.get(key) || defaultValue;\n\n if (!value) {\n return;\n }\n\n if (this.decoratorType === DecoratorTypes.CLASS) {\n value = {\n ...value,\n ...(defaultValue || {})\n };\n }\n\n return {\n ...(defaultValue || {}),\n ...value\n };\n }\n\n protected bind(args: DecoratorParameters, decorator: any) {\n this.entity = JsonEntityStore.from(...args);\n\n this.beforeInit();\n this.onInit(args, decorator);\n this.afterInit();\n }\n\n protected onInit(args: DecoratorParameters, decorator: any): void {\n this.forEach((value, key) => {\n this.onMapKey(key, value);\n });\n }\n\n protected onMapKey(key: string, value: any): void {\n this.entity.set(key, value);\n }\n\n protected runActions() {\n this.actions.forEach((action: any) => {\n action(this);\n });\n\n return this;\n }\n\n protected beforeInit() {}\n\n protected afterInit() {}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { camelCase } from "camel-case";
1
+ import { camelCase } from "change-case";
2
2
  const DEFAULT_PATTERN = "%c.%m";
3
3
  /**
4
4
  * @ignore
@@ -1 +1 @@
1
- {"version":3,"file":"operationIdFormatter.js","sourceRoot":"","sources":["../../../src/utils/operationIdFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB,EAAE;IACvD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,EAAE;QACtD,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACxF,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/C,CAAC,CAAC;IAEF,OAAO,CAAC,IAAY,EAAE,WAAmB,EAAE,OAAe,EAAE,EAAE,EAAE;QAC9D,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,CAAC;QAExC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACpC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;YAEnC,OAAO,WAAW,CAAC;SACpB;QAED,iBAAiB;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,MAAM,EAAE;YACV,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAEpD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;gBACpC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;gBAEnC,OAAO,SAAS,CAAC,GAAG,WAAW,OAAO,MAAM,EAAE,CAAC,CAAC;aACjD;SACF;QAED,MAAM,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,CAAE,GAAG,CAAC,CAAC;QAChD,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,GAAG,WAAW,IAAI,EAAE,EAAE,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {camelCase} from \"camel-case\";\n\nconst DEFAULT_PATTERN = \"%c.%m\";\n\n/**\n * @ignore\n */\nexport function operationIdFormatter(pattern: string = \"\") {\n const OPERATION_IDS = new Map<string, number>();\n\n const transform = (name: string, propertyKey: string) => {\n const str = (pattern || DEFAULT_PATTERN).replace(/%c/, name).replace(/%m/, propertyKey);\n return pattern === \"\" ? camelCase(str) : str;\n };\n\n return (name: string, propertyKey: string, path: string = \"\") => {\n const operationId = transform(name, propertyKey);\n const operationKey = name + propertyKey;\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return operationId;\n }\n\n // try with paths\n const result = path.match(/{(\\w+)}/gi);\n if (result) {\n const operationKey = name + propertyKey + result[0];\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return camelCase(`${operationId} By ${result}`);\n }\n }\n\n const id = OPERATION_IDS.get(operationKey)! + 1;\n OPERATION_IDS.set(operationKey, id);\n\n return `${operationId}_${id}`;\n };\n}\n"]}
1
+ {"version":3,"file":"operationIdFormatter.js","sourceRoot":"","sources":["../../../src/utils/operationIdFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB,EAAE;IACvD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,EAAE;QACtD,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACxF,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/C,CAAC,CAAC;IAEF,OAAO,CAAC,IAAY,EAAE,WAAmB,EAAE,OAAe,EAAE,EAAE,EAAE;QAC9D,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,CAAC;QAExC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACpC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;YAEnC,OAAO,WAAW,CAAC;SACpB;QAED,iBAAiB;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,MAAM,EAAE;YACV,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAEpD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;gBACpC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;gBAEnC,OAAO,SAAS,CAAC,GAAG,WAAW,OAAO,MAAM,EAAE,CAAC,CAAC;aACjD;SACF;QAED,MAAM,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,YAAY,CAAE,GAAG,CAAC,CAAC;QAChD,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,GAAG,WAAW,IAAI,EAAE,EAAE,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {camelCase} from \"change-case\";\n\nconst DEFAULT_PATTERN = \"%c.%m\";\n\n/**\n * @ignore\n */\nexport function operationIdFormatter(pattern: string = \"\") {\n const OPERATION_IDS = new Map<string, number>();\n\n const transform = (name: string, propertyKey: string) => {\n const str = (pattern || DEFAULT_PATTERN).replace(/%c/, name).replace(/%m/, propertyKey);\n return pattern === \"\" ? camelCase(str) : str;\n };\n\n return (name: string, propertyKey: string, path: string = \"\") => {\n const operationId = transform(name, propertyKey);\n const operationKey = name + propertyKey;\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return operationId;\n }\n\n // try with paths\n const result = path.match(/{(\\w+)}/gi);\n if (result) {\n const operationKey = name + propertyKey + result[0];\n\n if (!OPERATION_IDS.has(operationKey)) {\n OPERATION_IDS.set(operationKey, 0);\n\n return camelCase(`${operationId} By ${result}`);\n }\n }\n\n const id = OPERATION_IDS.get(operationKey)! + 1;\n OPERATION_IDS.set(operationKey, id);\n\n return `${operationId}_${id}`;\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { pascalCase } from "pascal-case";
1
+ import { pascalCase } from "change-case";
2
2
  import { SpecTypes } from "../domain/SpecTypes.js";
3
3
  import { cleanObject } from "@tsed/core";
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/utils/ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAEvC;;;GAGG;AACH,SAAS,OAAO,CAAC,OAA0B;IACzC,MAAM,EAAC,IAAI,GAAG,KAAK,OAAO,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,EAAE,EAAC,GAAG,OAAO,CAAC;IAEvG,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,OAA0B;IACpE,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3C,OAAO,UAAU,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;KAC1D;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,MAAkB,EAAE,OAA0B;IACpF,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG;QACV,IAAI,EAAE,GAAG,IAAI,IAAI,IA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AAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import {pascalCase} from \"pascal-case\";\nimport type {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {cleanObject} from \"@tsed/core\";\n\n/**\n * ignore\n * @param options\n */\nfunction getHost(options: JsonSchemaOptions) {\n const {host = `#/${options.specType === \"openapi3\" ? \"components/schemas\" : \"definitions\"}`} = options;\n\n return host;\n}\n\n/**\n * @ignore\n */\nexport function createRefName(name: string, options: JsonSchemaOptions) {\n if (options.groups && options.groups.length) {\n return pascalCase(`${name} ${options.groups.join(\" \")}`);\n }\n\n return name;\n}\n\n/**\n * @ignore\n */\nexport function createRef(name: string, schema: JsonSchema, options: JsonSchemaOptions) {\n const host = getHost(options);\n const ref = {\n $ref: `${host}/${name}`\n };\n\n const nullable = schema.isNullable;\n const readOnly = schema.isReadOnly;\n const writeOnly = schema.isWriteOnly;\n\n if (nullable || readOnly || writeOnly) {\n switch (options.specType) {\n case SpecTypes.OPENAPI:\n return cleanObject({\n nullable: nullable ? true : undefined,\n readOnly: readOnly ? true : undefined,\n writeOnly: writeOnly ? true : undefined,\n oneOf: [ref]\n });\n case SpecTypes.JSON:\n return cleanObject({\n readOnly,\n writeOnly,\n oneOf: [ref]\n });\n case SpecTypes.SWAGGER: // TODO unsupported feature\n if (readOnly || writeOnly) {\n return cleanObject({\n readOnly,\n writeOnly,\n allOf: [ref]\n });\n }\n }\n }\n\n return ref;\n}\n\n/**\n * @ignore\n */\nexport function toRef(value: JsonSchema, schema: any, options: JsonSchemaOptions) {\n const name = createRefName(value.getName(), options);\n\n options.schemas![value.getName()] = schema;\n\n return createRef(name, value, options);\n}\n"]}
1
+ {"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/utils/ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,C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AAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;oBACrC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;oBACvC,KAAK,EAAE,CAAC,GAAG,CAAC;iBACb,CAAC,CAAC;YACL,KAAK,SAAS,CAAC,IAAI;gBACjB,OAAO,WAAW,CAAC;oBACjB,QAAQ;oBACR,SAAS;oBACT,KAAK,EAAE,CAAC,GAAG,CAAC;iBACb,CAAC,CAAC;YACL,KAAK,SAAS,CAAC,OAAO,EAAE,2BAA2B;gBACjD,IAAI,QAAQ,IAAI,SAAS,EAAE;oBACzB,OAAO,WAAW,CAAC;wBACjB,QAAQ;wBACR,SAAS;wBACT,KAAK,EAAE,CAAC,GAAG,CAAC;qBACb,CAAC,CAAC;iBACJ;SACJ;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,KAAiB,EAAE,MAAW,EAAE,OAA0B;IAC9E,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAErD,OAAO,CAAC,OAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC;IAE3C,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import {pascalCase} from \"change-case\";\nimport type {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {cleanObject} from \"@tsed/core\";\n\n/**\n * ignore\n * @param options\n */\nfunction getHost(options: JsonSchemaOptions) {\n const {host = `#/${options.specType === \"openapi3\" ? \"components/schemas\" : \"definitions\"}`} = options;\n\n return host;\n}\n\n/**\n * @ignore\n */\nexport function createRefName(name: string, options: JsonSchemaOptions) {\n if (options.groups && options.groups.length) {\n return pascalCase(`${name} ${options.groups.join(\" \")}`);\n }\n\n return name;\n}\n\n/**\n * @ignore\n */\nexport function createRef(name: string, schema: JsonSchema, options: JsonSchemaOptions) {\n const host = getHost(options);\n const ref = {\n $ref: `${host}/${name}`\n };\n\n const nullable = schema.isNullable;\n const readOnly = schema.isReadOnly;\n const writeOnly = schema.isWriteOnly;\n\n if (nullable || readOnly || writeOnly) {\n switch (options.specType) {\n case SpecTypes.OPENAPI:\n return cleanObject({\n nullable: nullable ? true : undefined,\n readOnly: readOnly ? true : undefined,\n writeOnly: writeOnly ? true : undefined,\n oneOf: [ref]\n });\n case SpecTypes.JSON:\n return cleanObject({\n readOnly,\n writeOnly,\n oneOf: [ref]\n });\n case SpecTypes.SWAGGER: // TODO unsupported feature\n if (readOnly || writeOnly) {\n return cleanObject({\n readOnly,\n writeOnly,\n allOf: [ref]\n });\n }\n }\n }\n\n return ref;\n}\n\n/**\n * @ignore\n */\nexport function toRef(value: JsonSchema, schema: any, options: JsonSchemaOptions) {\n const name = createRefName(value.getName(), options);\n\n options.schemas![value.getName()] = schema;\n\n return createRef(name, value, options);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/schema",
3
- "version": "6.116.0",
3
+ "version": "6.116.3",
4
4
  "description": "JsonSchema module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -32,19 +32,18 @@
32
32
  "tsed"
33
33
  ],
34
34
  "dependencies": {
35
- "@tsed/openspec": "6.116.0",
36
- "camel-case": "4.1.2",
35
+ "@tsed/openspec": "6.116.3",
36
+ "change-case": "^4.1.2",
37
37
  "fs-extra": "^10.0.1",
38
38
  "json-schema": "0.4.0",
39
39
  "micromatch": "4.0.5",
40
- "pascal-case": "3.1.2",
41
40
  "statuses": ">=2.0.1",
42
41
  "tslib": "2.4.0"
43
42
  },
44
43
  "devDependencies": {
45
44
  "@apidevtools/swagger-parser": "10.0.3",
46
- "@tsed/core": "6.116.0",
47
- "@tsed/openspec": "6.116.0",
45
+ "@tsed/core": "6.116.3",
46
+ "@tsed/openspec": "6.116.3",
48
47
  "@types/fs-extra": "9.0.13",
49
48
  "@types/json-schema": "7.0.11",
50
49
  "@types/micromatch": "4.0.2",
@@ -52,8 +51,8 @@
52
51
  "api-spec-converter": "2.12.0"
53
52
  },
54
53
  "peerDependencies": {
55
- "@tsed/core": "^6.116.0",
56
- "@tsed/openspec": "^6.116.0"
54
+ "@tsed/core": "^6.116.3",
55
+ "@tsed/openspec": "^6.116.3"
57
56
  },
58
57
  "peerDependenciesMeta": {
59
58
  "@tsed/openspec": {