@famgia/omnify-core 0.0.44 → 0.0.46
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 +30 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -636,6 +636,7 @@ var VALID_PROPERTY_FIELDS = /* @__PURE__ */ new Set([
|
|
|
636
636
|
"nullable",
|
|
637
637
|
"default",
|
|
638
638
|
"unique",
|
|
639
|
+
"primary",
|
|
639
640
|
"description",
|
|
640
641
|
"renamedFrom",
|
|
641
642
|
// String properties
|
|
@@ -696,6 +697,9 @@ function buildPropertyDefinition(data) {
|
|
|
696
697
|
if (data.unique !== void 0 && typeof data.unique === "boolean") {
|
|
697
698
|
prop.unique = data.unique;
|
|
698
699
|
}
|
|
700
|
+
if (data.primary !== void 0 && typeof data.primary === "boolean") {
|
|
701
|
+
prop.primary = data.primary;
|
|
702
|
+
}
|
|
699
703
|
if (data.description !== void 0 && isLocalizedString(data.description)) {
|
|
700
704
|
prop.description = data.description;
|
|
701
705
|
}
|
|
@@ -995,6 +999,8 @@ var BASE_PROPERTY_FIELDS = [
|
|
|
995
999
|
"nullable",
|
|
996
1000
|
"default",
|
|
997
1001
|
"unique",
|
|
1002
|
+
"primary",
|
|
1003
|
+
// Custom primary key (use with options.id: false)
|
|
998
1004
|
"description",
|
|
999
1005
|
"renamedFrom",
|
|
1000
1006
|
"rules",
|
|
@@ -1215,6 +1221,16 @@ var TextType = {
|
|
|
1215
1221
|
},
|
|
1216
1222
|
validateDefaultValue: validateTextDefault
|
|
1217
1223
|
};
|
|
1224
|
+
var MediumTextType = {
|
|
1225
|
+
name: "MediumText",
|
|
1226
|
+
category: "text",
|
|
1227
|
+
validFields: createValidFields([]),
|
|
1228
|
+
dbCompatibility: fullDbCompatibility(),
|
|
1229
|
+
validate() {
|
|
1230
|
+
return [];
|
|
1231
|
+
},
|
|
1232
|
+
validateDefaultValue: validateTextDefault
|
|
1233
|
+
};
|
|
1218
1234
|
var LongTextType = {
|
|
1219
1235
|
name: "LongText",
|
|
1220
1236
|
category: "text",
|
|
@@ -1254,6 +1270,7 @@ var PasswordType = {
|
|
|
1254
1270
|
var textTypes = [
|
|
1255
1271
|
StringType,
|
|
1256
1272
|
TextType,
|
|
1273
|
+
MediumTextType,
|
|
1257
1274
|
LongTextType,
|
|
1258
1275
|
EmailType,
|
|
1259
1276
|
PasswordType
|
|
@@ -1283,6 +1300,16 @@ function validateNumberDefault(value) {
|
|
|
1283
1300
|
function buildLocation3(file) {
|
|
1284
1301
|
return { file };
|
|
1285
1302
|
}
|
|
1303
|
+
var TinyIntType = {
|
|
1304
|
+
name: "TinyInt",
|
|
1305
|
+
category: "numeric",
|
|
1306
|
+
validFields: createValidFields(["unsigned"]),
|
|
1307
|
+
dbCompatibility: fullDbCompatibility(),
|
|
1308
|
+
validate() {
|
|
1309
|
+
return [];
|
|
1310
|
+
},
|
|
1311
|
+
validateDefaultValue: validateIntegerDefault
|
|
1312
|
+
};
|
|
1286
1313
|
var IntType = {
|
|
1287
1314
|
name: "Int",
|
|
1288
1315
|
category: "numeric",
|
|
@@ -1367,6 +1394,7 @@ var DecimalType = {
|
|
|
1367
1394
|
validateDefaultValue: validateNumberDefault
|
|
1368
1395
|
};
|
|
1369
1396
|
var numericTypes = [
|
|
1397
|
+
TinyIntType,
|
|
1370
1398
|
IntType,
|
|
1371
1399
|
BigIntType,
|
|
1372
1400
|
FloatType,
|
|
@@ -1443,7 +1471,7 @@ var DateTimeType = {
|
|
|
1443
1471
|
var TimestampType = {
|
|
1444
1472
|
name: "Timestamp",
|
|
1445
1473
|
category: "temporal",
|
|
1446
|
-
validFields: createValidFields([]),
|
|
1474
|
+
validFields: createValidFields(["useCurrent", "useCurrentOnUpdate"]),
|
|
1447
1475
|
dbCompatibility: {
|
|
1448
1476
|
mysql: "full",
|
|
1449
1477
|
postgres: "full",
|
|
@@ -2321,7 +2349,7 @@ Example:
|
|
|
2321
2349
|
target: User
|
|
2322
2350
|
# Creates author_id column automatically`;
|
|
2323
2351
|
}
|
|
2324
|
-
return `Unknown field '${field}'. Valid property fields: type, displayName, nullable, default, unique, description, length, unsigned, precision, scale, enum, relation, target, onDelete, onUpdate, joinTable, rules`;
|
|
2352
|
+
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`;
|
|
2325
2353
|
}
|
|
2326
2354
|
var STRING_TYPES_WITH_LENGTH_RULES = ["String", "Email", "Password"];
|
|
2327
2355
|
function validateRules(propertyName, property, filePath) {
|