@famgia/omnify-core 0.0.79 → 0.0.80
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 +28 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -754,6 +754,8 @@ var VALID_PROPERTY_FIELDS = /* @__PURE__ */ new Set([
|
|
|
754
754
|
"primary",
|
|
755
755
|
"description",
|
|
756
756
|
"renamedFrom",
|
|
757
|
+
// Placeholder for form inputs (multi-language)
|
|
758
|
+
"placeholder",
|
|
757
759
|
// String properties
|
|
758
760
|
"length",
|
|
759
761
|
// Numeric properties
|
|
@@ -821,6 +823,9 @@ function buildPropertyDefinition(data) {
|
|
|
821
823
|
if (data.description !== void 0 && (0, import_omnify_types.isLocalizedString)(data.description)) {
|
|
822
824
|
prop.description = data.description;
|
|
823
825
|
}
|
|
826
|
+
if (data.placeholder !== void 0 && (0, import_omnify_types.isLocalizedString)(data.placeholder)) {
|
|
827
|
+
prop.placeholder = data.placeholder;
|
|
828
|
+
}
|
|
824
829
|
if (data.renamedFrom !== void 0 && typeof data.renamedFrom === "string") {
|
|
825
830
|
prop.renamedFrom = data.renamedFrom;
|
|
826
831
|
}
|
|
@@ -1120,6 +1125,8 @@ var import_omnify_types2 = require("@famgia/omnify-types");
|
|
|
1120
1125
|
var BASE_PROPERTY_FIELDS = [
|
|
1121
1126
|
"type",
|
|
1122
1127
|
"displayName",
|
|
1128
|
+
"placeholder",
|
|
1129
|
+
// Placeholder for form inputs (supports multi-language)
|
|
1123
1130
|
"nullable",
|
|
1124
1131
|
"default",
|
|
1125
1132
|
"unique",
|
|
@@ -2473,7 +2480,7 @@ Example:
|
|
|
2473
2480
|
target: User
|
|
2474
2481
|
# Creates author_id column automatically`;
|
|
2475
2482
|
}
|
|
2476
|
-
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`;
|
|
2483
|
+
return `Unknown field '${field}'. Valid property fields: type, displayName, placeholder, nullable, default, unique, primary, description, length, unsigned, precision, scale, enum, relation, target, onDelete, onUpdate, joinTable, rules, hidden, fillable, fields`;
|
|
2477
2484
|
}
|
|
2478
2485
|
var STRING_TYPES_WITH_LENGTH_RULES = ["String", "Email", "Password"];
|
|
2479
2486
|
function validateRules(propertyName, property, filePath) {
|
|
@@ -3066,6 +3073,7 @@ var GeneratorRunner = class {
|
|
|
3066
3073
|
logger: this.options.logger,
|
|
3067
3074
|
previousOutputs,
|
|
3068
3075
|
customTypes: this.options.customTypes ?? /* @__PURE__ */ new Map(),
|
|
3076
|
+
pluginEnums: this.options.pluginEnums ?? /* @__PURE__ */ new Map(),
|
|
3069
3077
|
localeConfig: this.options.localeConfig
|
|
3070
3078
|
};
|
|
3071
3079
|
const result = await definition.generate(ctx);
|
|
@@ -3166,6 +3174,7 @@ var consoleLogger = {
|
|
|
3166
3174
|
var PluginManager = class {
|
|
3167
3175
|
_plugins = /* @__PURE__ */ new Map();
|
|
3168
3176
|
_types = /* @__PURE__ */ new Map();
|
|
3177
|
+
_enums = /* @__PURE__ */ new Map();
|
|
3169
3178
|
_generators = /* @__PURE__ */ new Map();
|
|
3170
3179
|
_pluginConfigs = /* @__PURE__ */ new Map();
|
|
3171
3180
|
_cwd;
|
|
@@ -3242,6 +3251,19 @@ var PluginManager = class {
|
|
|
3242
3251
|
this._logger.debug(` Registered type: ${typeDef.name}`);
|
|
3243
3252
|
}
|
|
3244
3253
|
}
|
|
3254
|
+
if (plugin.enums) {
|
|
3255
|
+
for (const enumDef of plugin.enums) {
|
|
3256
|
+
const existing = this._enums.get(enumDef.name);
|
|
3257
|
+
if (existing) {
|
|
3258
|
+
warnings.push(
|
|
3259
|
+
`Enum '${enumDef.name}' already registered by another plugin`
|
|
3260
|
+
);
|
|
3261
|
+
continue;
|
|
3262
|
+
}
|
|
3263
|
+
this._enums.set(enumDef.name, enumDef);
|
|
3264
|
+
this._logger.debug(` Registered enum: ${enumDef.name}`);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3245
3267
|
if (plugin.generators) {
|
|
3246
3268
|
for (const genDef of plugin.generators) {
|
|
3247
3269
|
const existing = this._generators.get(genDef.name);
|
|
@@ -3263,8 +3285,9 @@ var PluginManager = class {
|
|
|
3263
3285
|
}
|
|
3264
3286
|
this._plugins.set(plugin.name, plugin);
|
|
3265
3287
|
const genCount = plugin.generators?.length ?? 0;
|
|
3288
|
+
const enumCount = plugin.enums?.length ?? 0;
|
|
3266
3289
|
this._logger.info(
|
|
3267
|
-
`Plugin registered: ${plugin.name} (${registeredTypes.length} types, ${genCount} generators)`
|
|
3290
|
+
`Plugin registered: ${plugin.name} (${registeredTypes.length} types, ${enumCount} enums, ${genCount} generators)`
|
|
3268
3291
|
);
|
|
3269
3292
|
return {
|
|
3270
3293
|
success: true,
|
|
@@ -3432,7 +3455,8 @@ var PluginManager = class {
|
|
|
3432
3455
|
const runner = new GeneratorRunner({
|
|
3433
3456
|
cwd: this._cwd,
|
|
3434
3457
|
logger: this._logger,
|
|
3435
|
-
customTypes
|
|
3458
|
+
customTypes,
|
|
3459
|
+
pluginEnums: this._enums
|
|
3436
3460
|
});
|
|
3437
3461
|
for (const gen of this._generators.values()) {
|
|
3438
3462
|
runner.register(gen);
|
|
@@ -3453,6 +3477,7 @@ var PluginManager = class {
|
|
|
3453
3477
|
}
|
|
3454
3478
|
this._plugins.clear();
|
|
3455
3479
|
this._types.clear();
|
|
3480
|
+
this._enums.clear();
|
|
3456
3481
|
this._generators.clear();
|
|
3457
3482
|
this._pluginConfigs.clear();
|
|
3458
3483
|
this._logger.debug("Plugin registry cleared");
|