@tsed/platform-params 7.75.2 → 7.75.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UseType = void 0;
4
4
  const schema_1 = require("@tsed/schema");
5
5
  const paramFn_js_1 = require("./paramFn.js");
6
+ function shouldFallBackToAny(entity) {
7
+ if (entity.itemSchema.has("allOf") || entity.itemSchema.has("anyOf") || entity.itemSchema.has("oneOf")) {
8
+ return false;
9
+ }
10
+ return entity.isCollection && entity.type === Object && [undefined, "object"].includes(entity.itemSchema.get("type"));
11
+ }
6
12
  /**
7
13
  * Set the type of the item collection.
8
14
  *
@@ -19,7 +25,7 @@ function UseType(useType) {
19
25
  if (useType) {
20
26
  return (0, schema_1.CollectionOf)(useType);
21
27
  }
22
- if (entity.isCollection && entity.type === Object && [undefined, "object"].includes(entity.itemSchema.get("type"))) {
28
+ if (shouldFallBackToAny(entity)) {
23
29
  (0, schema_1.Any)()(...parameters);
24
30
  }
25
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useType.js","sourceRoot":"","sources":["../../../src/decorators/useType.ts"],"names":[],"mappings":";;;AACA,yCAA+C;AAC/C,6CAAqC;AAErC;;;;;;;;;;GAUG;AACH,SAAgB,OAAO,CAAC,OAAoC;IAC1D,OAAO,IAAA,oBAAO,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,OAAO,EAAE;YACX,OAAO,IAAA,qBAAY,EAAC,OAAO,CAAC,CAAC;SAC9B;QAED,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE;YAClH,IAAA,YAAG,GAAE,CAAC,GAAG,UAAU,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,0BAUC"}
1
+ {"version":3,"file":"useType.js","sourceRoot":"","sources":["../../../src/decorators/useType.ts"],"names":[],"mappings":";;;AACA,yCAAwE;AACxE,6CAAqC;AAErC,SAAS,mBAAmB,CAAC,MAA0B;IACrD,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACtG,OAAO,KAAK,CAAC;KACd;IAED,OAAO,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACxH,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,OAAO,CAAC,OAAoC;IAC1D,OAAO,IAAA,oBAAO,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,OAAO,EAAE;YACX,OAAO,IAAA,qBAAY,EAAC,OAAO,CAAC,CAAC;SAC9B;QAED,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;YAC/B,IAAA,YAAG,GAAE,CAAC,GAAG,UAAU,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,0BAUC"}
@@ -1,5 +1,11 @@
1
1
  import { Any, CollectionOf } from "@tsed/schema";
2
2
  import { ParamFn } from "./paramFn.js";
3
+ function shouldFallBackToAny(entity) {
4
+ if (entity.itemSchema.has("allOf") || entity.itemSchema.has("anyOf") || entity.itemSchema.has("oneOf")) {
5
+ return false;
6
+ }
7
+ return entity.isCollection && entity.type === Object && [undefined, "object"].includes(entity.itemSchema.get("type"));
8
+ }
3
9
  /**
4
10
  * Set the type of the item collection.
5
11
  *
@@ -16,7 +22,7 @@ export function UseType(useType) {
16
22
  if (useType) {
17
23
  return CollectionOf(useType);
18
24
  }
19
- if (entity.isCollection && entity.type === Object && [undefined, "object"].includes(entity.itemSchema.get("type"))) {
25
+ if (shouldFallBackToAny(entity)) {
20
26
  Any()(...parameters);
21
27
  }
22
28
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useType.js","sourceRoot":"","sources":["../../../src/decorators/useType.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CAAC,OAAoC;IAC1D,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,OAAO,EAAE;YACX,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;SAC9B;QAED,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE;YAClH,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"useType.js","sourceRoot":"","sources":["../../../src/decorators/useType.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,YAAY,EAA0B,MAAM,cAAc,CAAC;AACxE,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,SAAS,mBAAmB,CAAC,MAA0B;IACrD,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACtG,OAAO,KAAK,CAAC;KACd;IAED,OAAO,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACxH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CAAC,OAAoC;IAC1D,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,OAAO,EAAE;YACX,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;SAC9B;QAED,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;YAC/B,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-params",
3
- "version": "7.75.2",
3
+ "version": "7.75.4",
4
4
  "description": "Params module for Ts.ED Framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/cjs/index.js",
@@ -22,22 +22,22 @@
22
22
  "tslib": "2.6.1"
23
23
  },
24
24
  "devDependencies": {
25
- "@tsed/barrels": "7.75.2",
26
- "@tsed/core": "7.75.2",
27
- "@tsed/di": "7.75.2",
28
- "@tsed/exceptions": "7.75.2",
29
- "@tsed/json-mapper": "7.75.2",
30
- "@tsed/schema": "7.75.2",
31
- "@tsed/typescript": "7.75.2",
25
+ "@tsed/barrels": "7.75.4",
26
+ "@tsed/core": "7.75.4",
27
+ "@tsed/di": "7.75.4",
28
+ "@tsed/exceptions": "7.75.4",
29
+ "@tsed/json-mapper": "7.75.4",
30
+ "@tsed/schema": "7.75.4",
31
+ "@tsed/typescript": "7.75.4",
32
32
  "eslint": "^8.57.0",
33
33
  "jest": "^29.7.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@tsed/core": "7.75.2",
37
- "@tsed/di": "7.75.2",
38
- "@tsed/exceptions": "7.75.2",
39
- "@tsed/json-mapper": "7.75.2",
40
- "@tsed/schema": "7.75.2"
36
+ "@tsed/core": "7.75.4",
37
+ "@tsed/di": "7.75.4",
38
+ "@tsed/exceptions": "7.75.4",
39
+ "@tsed/json-mapper": "7.75.4",
40
+ "@tsed/schema": "7.75.4"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
43
  "@tsed/core": {