@statezero/core 0.1.54 → 0.1.56

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.
@@ -73,5 +73,6 @@ export class FileObject {
73
73
  uploadId: any;
74
74
  totalChunks: number;
75
75
  completedChunks: number;
76
+ file_path: any;
76
77
  };
77
78
  }
@@ -365,6 +365,8 @@ export class FileObject {
365
365
  uploadId: this.uploadId,
366
366
  totalChunks: this.totalChunks,
367
367
  completedChunks: this.completedChunks,
368
+ // for the backend
369
+ file_path: this.filePath,
368
370
  };
369
371
  }
370
372
  }
@@ -92,8 +92,13 @@ export class Model {
92
92
  return DateParsingHelpers.serializeDate(value, field, ModelClass.schema);
93
93
  }
94
94
  // Handle FileObject -> simple file path/data
95
- if (value instanceof FileObject) {
96
- return value.filePath || value.file_path || value;
95
+ const fileFormats = ["file-path", "image-path"];
96
+ if (ModelClass.schema?.properties[field]?.format &&
97
+ fileFormats.includes(ModelClass.schema.properties[field].format) &&
98
+ value &&
99
+ typeof value.toJSON === "function") {
100
+ // Return a serializable JSON representation of the FileObject.
101
+ return value.toJSON();
97
102
  }
98
103
  // Handle Model instances -> primary keys
99
104
  if (value &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
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",