@famgia/omnify-core 0.0.44 → 0.0.45

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/dist/index.cjs CHANGED
@@ -747,6 +747,7 @@ var VALID_PROPERTY_FIELDS = /* @__PURE__ */ new Set([
747
747
  "nullable",
748
748
  "default",
749
749
  "unique",
750
+ "primary",
750
751
  "description",
751
752
  "renamedFrom",
752
753
  // String properties
@@ -807,6 +808,9 @@ function buildPropertyDefinition(data) {
807
808
  if (data.unique !== void 0 && typeof data.unique === "boolean") {
808
809
  prop.unique = data.unique;
809
810
  }
811
+ if (data.primary !== void 0 && typeof data.primary === "boolean") {
812
+ prop.primary = data.primary;
813
+ }
810
814
  if (data.description !== void 0 && (0, import_omnify_types.isLocalizedString)(data.description)) {
811
815
  prop.description = data.description;
812
816
  }
@@ -1106,6 +1110,8 @@ var BASE_PROPERTY_FIELDS = [
1106
1110
  "nullable",
1107
1111
  "default",
1108
1112
  "unique",
1113
+ "primary",
1114
+ // Custom primary key (use with options.id: false)
1109
1115
  "description",
1110
1116
  "renamedFrom",
1111
1117
  "rules",
@@ -1326,6 +1332,16 @@ var TextType = {
1326
1332
  },
1327
1333
  validateDefaultValue: validateTextDefault
1328
1334
  };
1335
+ var MediumTextType = {
1336
+ name: "MediumText",
1337
+ category: "text",
1338
+ validFields: createValidFields([]),
1339
+ dbCompatibility: fullDbCompatibility(),
1340
+ validate() {
1341
+ return [];
1342
+ },
1343
+ validateDefaultValue: validateTextDefault
1344
+ };
1329
1345
  var LongTextType = {
1330
1346
  name: "LongText",
1331
1347
  category: "text",
@@ -1365,6 +1381,7 @@ var PasswordType = {
1365
1381
  var textTypes = [
1366
1382
  StringType,
1367
1383
  TextType,
1384
+ MediumTextType,
1368
1385
  LongTextType,
1369
1386
  EmailType,
1370
1387
  PasswordType
@@ -1394,6 +1411,16 @@ function validateNumberDefault(value) {
1394
1411
  function buildLocation3(file) {
1395
1412
  return { file };
1396
1413
  }
1414
+ var TinyIntType = {
1415
+ name: "TinyInt",
1416
+ category: "numeric",
1417
+ validFields: createValidFields(["unsigned"]),
1418
+ dbCompatibility: fullDbCompatibility(),
1419
+ validate() {
1420
+ return [];
1421
+ },
1422
+ validateDefaultValue: validateIntegerDefault
1423
+ };
1397
1424
  var IntType = {
1398
1425
  name: "Int",
1399
1426
  category: "numeric",
@@ -1478,6 +1505,7 @@ var DecimalType = {
1478
1505
  validateDefaultValue: validateNumberDefault
1479
1506
  };
1480
1507
  var numericTypes = [
1508
+ TinyIntType,
1481
1509
  IntType,
1482
1510
  BigIntType,
1483
1511
  FloatType,
@@ -2432,7 +2460,7 @@ Example:
2432
2460
  target: User
2433
2461
  # Creates author_id column automatically`;
2434
2462
  }
2435
- return `Unknown field '${field}'. Valid property fields: type, displayName, nullable, default, unique, description, length, unsigned, precision, scale, enum, relation, target, onDelete, onUpdate, joinTable, rules`;
2463
+ return `Unknown field '${field}'. Valid property fields: type, displayName, nullable, default, unique, primary, description, length, unsigned, precision, scale, enum, relation, target, onDelete, onUpdate, joinTable, rules`;
2436
2464
  }
2437
2465
  var STRING_TYPES_WITH_LENGTH_RULES = ["String", "Email", "Password"];
2438
2466
  function validateRules(propertyName, property, filePath) {