@famgia/omnify-core 0.0.78 → 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.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -643,6 +643,8 @@ var VALID_PROPERTY_FIELDS = /* @__PURE__ */ new Set([
|
|
|
643
643
|
"primary",
|
|
644
644
|
"description",
|
|
645
645
|
"renamedFrom",
|
|
646
|
+
// Placeholder for form inputs (multi-language)
|
|
647
|
+
"placeholder",
|
|
646
648
|
// String properties
|
|
647
649
|
"length",
|
|
648
650
|
// Numeric properties
|
|
@@ -710,6 +712,9 @@ function buildPropertyDefinition(data) {
|
|
|
710
712
|
if (data.description !== void 0 && isLocalizedString(data.description)) {
|
|
711
713
|
prop.description = data.description;
|
|
712
714
|
}
|
|
715
|
+
if (data.placeholder !== void 0 && isLocalizedString(data.placeholder)) {
|
|
716
|
+
prop.placeholder = data.placeholder;
|
|
717
|
+
}
|
|
713
718
|
if (data.renamedFrom !== void 0 && typeof data.renamedFrom === "string") {
|
|
714
719
|
prop.renamedFrom = data.renamedFrom;
|
|
715
720
|
}
|
|
@@ -1009,6 +1014,8 @@ import { isLocaleMap } from "@famgia/omnify-types";
|
|
|
1009
1014
|
var BASE_PROPERTY_FIELDS = [
|
|
1010
1015
|
"type",
|
|
1011
1016
|
"displayName",
|
|
1017
|
+
"placeholder",
|
|
1018
|
+
// Placeholder for form inputs (supports multi-language)
|
|
1012
1019
|
"nullable",
|
|
1013
1020
|
"default",
|
|
1014
1021
|
"unique",
|
|
@@ -2362,7 +2369,7 @@ Example:
|
|
|
2362
2369
|
target: User
|
|
2363
2370
|
# Creates author_id column automatically`;
|
|
2364
2371
|
}
|
|
2365
|
-
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`;
|
|
2372
|
+
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`;
|
|
2366
2373
|
}
|
|
2367
2374
|
var STRING_TYPES_WITH_LENGTH_RULES = ["String", "Email", "Password"];
|
|
2368
2375
|
function validateRules(propertyName, property, filePath) {
|
|
@@ -2955,6 +2962,7 @@ var GeneratorRunner = class {
|
|
|
2955
2962
|
logger: this.options.logger,
|
|
2956
2963
|
previousOutputs,
|
|
2957
2964
|
customTypes: this.options.customTypes ?? /* @__PURE__ */ new Map(),
|
|
2965
|
+
pluginEnums: this.options.pluginEnums ?? /* @__PURE__ */ new Map(),
|
|
2958
2966
|
localeConfig: this.options.localeConfig
|
|
2959
2967
|
};
|
|
2960
2968
|
const result = await definition.generate(ctx);
|
|
@@ -3055,6 +3063,7 @@ var consoleLogger = {
|
|
|
3055
3063
|
var PluginManager = class {
|
|
3056
3064
|
_plugins = /* @__PURE__ */ new Map();
|
|
3057
3065
|
_types = /* @__PURE__ */ new Map();
|
|
3066
|
+
_enums = /* @__PURE__ */ new Map();
|
|
3058
3067
|
_generators = /* @__PURE__ */ new Map();
|
|
3059
3068
|
_pluginConfigs = /* @__PURE__ */ new Map();
|
|
3060
3069
|
_cwd;
|
|
@@ -3131,6 +3140,19 @@ var PluginManager = class {
|
|
|
3131
3140
|
this._logger.debug(` Registered type: ${typeDef.name}`);
|
|
3132
3141
|
}
|
|
3133
3142
|
}
|
|
3143
|
+
if (plugin.enums) {
|
|
3144
|
+
for (const enumDef of plugin.enums) {
|
|
3145
|
+
const existing = this._enums.get(enumDef.name);
|
|
3146
|
+
if (existing) {
|
|
3147
|
+
warnings.push(
|
|
3148
|
+
`Enum '${enumDef.name}' already registered by another plugin`
|
|
3149
|
+
);
|
|
3150
|
+
continue;
|
|
3151
|
+
}
|
|
3152
|
+
this._enums.set(enumDef.name, enumDef);
|
|
3153
|
+
this._logger.debug(` Registered enum: ${enumDef.name}`);
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3134
3156
|
if (plugin.generators) {
|
|
3135
3157
|
for (const genDef of plugin.generators) {
|
|
3136
3158
|
const existing = this._generators.get(genDef.name);
|
|
@@ -3152,8 +3174,9 @@ var PluginManager = class {
|
|
|
3152
3174
|
}
|
|
3153
3175
|
this._plugins.set(plugin.name, plugin);
|
|
3154
3176
|
const genCount = plugin.generators?.length ?? 0;
|
|
3177
|
+
const enumCount = plugin.enums?.length ?? 0;
|
|
3155
3178
|
this._logger.info(
|
|
3156
|
-
`Plugin registered: ${plugin.name} (${registeredTypes.length} types, ${genCount} generators)`
|
|
3179
|
+
`Plugin registered: ${plugin.name} (${registeredTypes.length} types, ${enumCount} enums, ${genCount} generators)`
|
|
3157
3180
|
);
|
|
3158
3181
|
return {
|
|
3159
3182
|
success: true,
|
|
@@ -3321,7 +3344,8 @@ var PluginManager = class {
|
|
|
3321
3344
|
const runner = new GeneratorRunner({
|
|
3322
3345
|
cwd: this._cwd,
|
|
3323
3346
|
logger: this._logger,
|
|
3324
|
-
customTypes
|
|
3347
|
+
customTypes,
|
|
3348
|
+
pluginEnums: this._enums
|
|
3325
3349
|
});
|
|
3326
3350
|
for (const gen of this._generators.values()) {
|
|
3327
3351
|
runner.register(gen);
|
|
@@ -3342,6 +3366,7 @@ var PluginManager = class {
|
|
|
3342
3366
|
}
|
|
3343
3367
|
this._plugins.clear();
|
|
3344
3368
|
this._types.clear();
|
|
3369
|
+
this._enums.clear();
|
|
3345
3370
|
this._generators.clear();
|
|
3346
3371
|
this._pluginConfigs.clear();
|
|
3347
3372
|
this._logger.debug("Plugin registry cleared");
|