mobiletto-orm-typedef-gen 2.3.40 → 2.3.42

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,4 +1,4 @@
1
- import { isArrayType, MobilettoOrmError, MobilettoOrmTypeDef, MobilettoOrmValidationError, } from "mobiletto-orm-typedef";
1
+ import { isArrayType, MobilettoOrmError, MobilettoOrmTypeDef, } from "mobiletto-orm-typedef";
2
2
  import * as fs from "fs";
3
3
  import Handlebars from "handlebars";
4
4
  import { dirname } from "path";
@@ -36,23 +36,7 @@ const defaultPrepareContext = (typeDef, ctx) => {
36
36
  field.typeIsArray = isArrayType(field.type);
37
37
  field.typeIsObject = field.type === "object";
38
38
  if (field.typeIsArray) {
39
- field.valueType =
40
- field.values && Array.isArray(field.values) && field.values.length > 0
41
- ? typeof field.values[0]
42
- : field.items &&
43
- Array.isArray(field.items) &&
44
- field.items.length > 0 &&
45
- typeof field.items[0] === "object" &&
46
- field.items[0].value
47
- ? typeof field.items[0].value
48
- : field.ref
49
- ? "string"
50
- : null;
51
- if (field.valueType == null) {
52
- const errors = {};
53
- errors[field.name] = ["indeterminateArrayValueType"];
54
- throw new MobilettoOrmValidationError(errors);
55
- }
39
+ field.valueType = field.type.substring(0, field.type.indexOf("[]"));
56
40
  field.arrayIndent = " ";
57
41
  }
58
42
  if (field.default) {
@@ -1,4 +1,4 @@
1
- import { isArrayType, MobilettoOrmError, MobilettoOrmTypeDef, MobilettoOrmValidationError, } from "mobiletto-orm-typedef";
1
+ import { isArrayType, MobilettoOrmError, MobilettoOrmTypeDef, } from "mobiletto-orm-typedef";
2
2
  import * as fs from "fs";
3
3
  import Handlebars from "handlebars";
4
4
  import { dirname } from "path";
@@ -36,23 +36,7 @@ const defaultPrepareContext = (typeDef, ctx) => {
36
36
  field.typeIsArray = isArrayType(field.type);
37
37
  field.typeIsObject = field.type === "object";
38
38
  if (field.typeIsArray) {
39
- field.valueType =
40
- field.values && Array.isArray(field.values) && field.values.length > 0
41
- ? typeof field.values[0]
42
- : field.items &&
43
- Array.isArray(field.items) &&
44
- field.items.length > 0 &&
45
- typeof field.items[0] === "object" &&
46
- field.items[0].value
47
- ? typeof field.items[0].value
48
- : field.ref
49
- ? "string"
50
- : null;
51
- if (field.valueType == null) {
52
- const errors = {};
53
- errors[field.name] = ["indeterminateArrayValueType"];
54
- throw new MobilettoOrmValidationError(errors);
55
- }
39
+ field.valueType = field.type.substring(0, field.type.indexOf("[]"));
56
40
  field.arrayIndent = " ";
57
41
  }
58
42
  if (field.default) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobiletto-orm-typedef-gen",
3
- "version": "2.3.40",
3
+ "version": "2.3.42",
4
4
  "type": "module",
5
5
  "description": "generate various files based on mobiletto-orm-typedef definitions",
6
6
  "keywords": [
@@ -53,7 +53,7 @@
53
53
  "eslint-config-prettier": "^8.8.0",
54
54
  "handlebars": "^4.7.7",
55
55
  "hokey-runtime": "^1.0.4",
56
- "mobiletto-orm-typedef": "^2.4.4",
56
+ "mobiletto-orm-typedef": "^2.4.5",
57
57
  "mocha": "^10.2.0",
58
58
  "prettier": "^3.0.0",
59
59
  "tslint-config-prettier": "^1.18.0",