@statezero/core 0.1.74 → 0.1.75

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.
@@ -243,8 +243,10 @@ const dtsActionTemplate = Handlebars.compile(TS_ACTION_DECLARATION_TEMPLATE);
243
243
  // ================================================================================================
244
244
  function generateZodSchemaForProperty(prop) {
245
245
  let zodString;
246
- if (prop.choices && prop.choices.length > 0) {
247
- zodString = `z.enum(${JSON.stringify(prop.choices)})`;
246
+ if (prop.choices && Object.keys(prop.choices).length > 0) {
247
+ // Extract just the keys (values) from the choices dict
248
+ const choiceValues = Object.keys(prop.choices);
249
+ zodString = `z.enum(${JSON.stringify(choiceValues)})`;
248
250
  }
249
251
  else {
250
252
  switch (prop.type) {
@@ -327,8 +329,8 @@ function generateZodSchemaForProperty(prop) {
327
329
  return zodString;
328
330
  }
329
331
  function generateTsTypeForProperty(prop) {
330
- if (prop.choices && prop.choices.length > 0) {
331
- return prop.choices
332
+ if (prop.choices && Object.keys(prop.choices).length > 0) {
333
+ return Object.keys(prop.choices)
332
334
  .map((c) => `'${String(c).replace(/'/g, "\\'")}'`)
333
335
  .join(" | ");
334
336
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.1.74",
3
+ "version": "0.1.75",
4
4
  "type": "module",
5
5
  "module": "ESNext",
6
6
  "description": "The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate",