@statezero/core 0.1.59 → 0.1.60

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.
@@ -59,19 +59,4 @@ export class FileObject {
59
59
  */
60
60
  getBlob(): Blob;
61
61
  waitForUpload(): Promise<any>;
62
- toJSON(): {
63
- name: any;
64
- size: any;
65
- type: any;
66
- status: string;
67
- uploaded: boolean;
68
- filePath: any;
69
- fileUrl: any;
70
- uploadResult: any;
71
- uploadError: string | null;
72
- uploadType: string | null;
73
- uploadId: any;
74
- totalChunks: number;
75
- completedChunks: number;
76
- };
77
62
  }
@@ -350,23 +350,6 @@ export class FileObject {
350
350
  async waitForUpload() {
351
351
  return this.uploadPromise;
352
352
  }
353
- toJSON() {
354
- return {
355
- name: this.name,
356
- size: this.size,
357
- type: this.type,
358
- status: this.status,
359
- uploaded: this.uploaded,
360
- filePath: this.filePath,
361
- fileUrl: this.fileUrl,
362
- uploadResult: this.uploadResult,
363
- uploadError: this.uploadError ? String(this.uploadError) : null,
364
- uploadType: this.uploadType,
365
- uploadId: this.uploadId,
366
- totalChunks: this.totalChunks,
367
- completedChunks: this.completedChunks,
368
- };
369
- }
370
353
  }
371
354
  FileObject.configKey = "default";
372
355
  FileObject.MIN_CHUNK_SIZE = 5 * 1024 * 1024; // 5MB minimum for S3 multipart
@@ -44,10 +44,10 @@ export class Model {
44
44
  */
45
45
  static validate(data: Object, validateType?: string, partial?: boolean): Promise<boolean>;
46
46
  constructor(data?: {});
47
+ serializer: ModelSerializer;
47
48
  _data: {};
48
49
  _pk: any;
49
50
  __version: number;
50
- serializer: ModelSerializer;
51
51
  touch(): void;
52
52
  /**
53
53
  * Sets the primary key of the model instance.
@@ -29,11 +29,11 @@ import axios from "axios";
29
29
  */
30
30
  export class Model {
31
31
  constructor(data = {}) {
32
- // Initialize internal data store
33
- this._data = data;
34
- this._pk = data[this.constructor.primaryKeyField] || undefined;
35
- this.__version = 0;
36
32
  this.serializer = new ModelSerializer(this.constructor);
33
+ const serializedData = this.serializer.toInternal(data);
34
+ this._data = serializedData;
35
+ this._pk = serializedData[this.constructor.primaryKeyField] || undefined;
36
+ this.__version = 0;
37
37
  return wrapReactiveModel(this);
38
38
  }
39
39
  touch() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
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",