@xuda.io/ai_module 1.1.5600 → 1.1.5601
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/index.mjs +10 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5071,7 +5071,16 @@ const get_dashboard_cpi_zod_item = function (key, val = {}, options = {}) {
|
|
|
5071
5071
|
let schema;
|
|
5072
5072
|
|
|
5073
5073
|
if (val.enum?.length) {
|
|
5074
|
-
|
|
5074
|
+
const enum_values = val.enum.filter((item) => typeof item !== 'undefined');
|
|
5075
|
+
if (!enum_values.length) {
|
|
5076
|
+
schema = z.any();
|
|
5077
|
+
} else if (enum_values.length === 1) {
|
|
5078
|
+
schema = z.literal(enum_values[0]);
|
|
5079
|
+
} else if (enum_values.every((item) => typeof item === 'string')) {
|
|
5080
|
+
schema = z.enum(enum_values);
|
|
5081
|
+
} else {
|
|
5082
|
+
schema = z.union(enum_values.map((item) => z.literal(item)));
|
|
5083
|
+
}
|
|
5075
5084
|
} else {
|
|
5076
5085
|
switch (val.type) {
|
|
5077
5086
|
case 'string':
|