@statezero/core 0.2.54 → 0.2.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.
Files changed (72) hide show
  1. package/dist/adaptors/vue/components/StateZeroDebugPanel.js +42 -41
  2. package/dist/models/backend1/django_app/author.schema.json +16 -16
  3. package/dist/models/backend1/django_app/book.schema.json +11 -11
  4. package/dist/models/backend1/django_app/composeditem.schema.json +3 -3
  5. package/dist/models/backend1/django_app/comprehensivemodel.schema.json +3 -3
  6. package/dist/models/backend1/django_app/dailyrate.schema.json +7 -7
  7. package/dist/models/backend1/django_app/errortestcompoundunique.schema.json +4 -4
  8. package/dist/models/backend1/django_app/errortestonetoonemodel.schema.json +2 -2
  9. package/dist/models/backend1/django_app/errortestprotectedchild.schema.json +2 -2
  10. package/dist/models/backend1/django_app/errortestuniquemodel.schema.json +1 -1
  11. package/dist/models/backend1/django_app/excludeditem.schema.json +2 -2
  12. package/dist/models/backend1/django_app/hfchild.schema.json +2 -2
  13. package/dist/models/backend1/django_app/hfparent.schema.json +2 -2
  14. package/dist/models/backend1/django_app/index.js +2 -0
  15. package/dist/models/backend1/django_app/m2mdepthtestlevel1.schema.json +2 -2
  16. package/dist/models/backend1/django_app/m2mdepthtestlevel2.schema.json +2 -2
  17. package/dist/models/backend1/django_app/m2mdepthtestlevel3.schema.json +2 -2
  18. package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +2 -2
  19. package/dist/models/backend1/django_app/nodeleteitem.schema.json +2 -2
  20. package/dist/models/backend1/django_app/objectlevelitem.schema.json +2 -2
  21. package/dist/models/backend1/django_app/order.schema.json +6 -6
  22. package/dist/models/backend1/django_app/orderitem.schema.json +4 -4
  23. package/dist/models/backend1/django_app/product.schema.json +11 -11
  24. package/dist/models/backend1/django_app/readonlyitem.schema.json +2 -2
  25. package/dist/models/backend1/django_app/restrictedcreateitem.schema.json +2 -2
  26. package/dist/models/backend1/django_app/restrictededititem.schema.json +2 -2
  27. package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +2 -2
  28. package/dist/models/backend1/django_app/rowfiltereditem.schema.json +2 -2
  29. package/dist/models/backend1/django_app/tag.schema.json +10 -10
  30. package/dist/models/backend1/django_app/uuidmessage.d.ts +156 -0
  31. package/dist/models/backend1/django_app/uuidmessage.js +72 -0
  32. package/dist/models/backend1/django_app/uuidmessage.schema.json +136 -0
  33. package/dist/models/backend1/django_app/uuiduser.d.ts +92 -0
  34. package/dist/models/backend1/django_app/uuiduser.js +69 -0
  35. package/dist/models/backend1/django_app/uuiduser.schema.json +70 -0
  36. package/dist/models/default/django_app/author.schema.json +16 -16
  37. package/dist/models/default/django_app/book.schema.json +11 -11
  38. package/dist/models/default/django_app/composeditem.schema.json +3 -3
  39. package/dist/models/default/django_app/comprehensivemodel.schema.json +3 -3
  40. package/dist/models/default/django_app/dailyrate.schema.json +7 -7
  41. package/dist/models/default/django_app/errortestcompoundunique.schema.json +4 -4
  42. package/dist/models/default/django_app/errortestonetoonemodel.schema.json +2 -2
  43. package/dist/models/default/django_app/errortestprotectedchild.schema.json +2 -2
  44. package/dist/models/default/django_app/errortestuniquemodel.schema.json +1 -1
  45. package/dist/models/default/django_app/excludeditem.schema.json +2 -2
  46. package/dist/models/default/django_app/hfchild.schema.json +2 -2
  47. package/dist/models/default/django_app/hfparent.schema.json +2 -2
  48. package/dist/models/default/django_app/index.js +2 -0
  49. package/dist/models/default/django_app/m2mdepthtestlevel1.schema.json +2 -2
  50. package/dist/models/default/django_app/m2mdepthtestlevel2.schema.json +2 -2
  51. package/dist/models/default/django_app/m2mdepthtestlevel3.schema.json +2 -2
  52. package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +2 -2
  53. package/dist/models/default/django_app/nodeleteitem.schema.json +2 -2
  54. package/dist/models/default/django_app/objectlevelitem.schema.json +2 -2
  55. package/dist/models/default/django_app/order.schema.json +6 -6
  56. package/dist/models/default/django_app/orderitem.schema.json +4 -4
  57. package/dist/models/default/django_app/product.schema.json +11 -11
  58. package/dist/models/default/django_app/readonlyitem.schema.json +2 -2
  59. package/dist/models/default/django_app/restrictedcreateitem.schema.json +2 -2
  60. package/dist/models/default/django_app/restrictededititem.schema.json +2 -2
  61. package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +2 -2
  62. package/dist/models/default/django_app/rowfiltereditem.schema.json +2 -2
  63. package/dist/models/default/django_app/tag.schema.json +10 -10
  64. package/dist/models/default/django_app/uuidmessage.d.ts +156 -0
  65. package/dist/models/default/django_app/uuidmessage.js +72 -0
  66. package/dist/models/default/django_app/uuidmessage.schema.json +136 -0
  67. package/dist/models/default/django_app/uuiduser.d.ts +92 -0
  68. package/dist/models/default/django_app/uuiduser.js +69 -0
  69. package/dist/models/default/django_app/uuiduser.schema.json +70 -0
  70. package/dist/syncEngine/stores/querysetStore.d.ts +1 -0
  71. package/dist/syncEngine/stores/querysetStore.js +12 -8
  72. package/package.json +1 -1
@@ -5,25 +5,25 @@
5
5
  "plural_title": "Tags",
6
6
  "primary_key_field": "id",
7
7
  "filterable_fields": [
8
- "priority",
9
- "metadata",
10
- "cost_currency",
8
+ "slug",
9
+ "description",
11
10
  "name",
12
- "books",
13
11
  "created_at",
14
- "slug",
12
+ "cost_currency",
13
+ "id",
15
14
  "cost",
15
+ "books",
16
16
  "is_featured",
17
- "id",
18
- "description"
17
+ "metadata",
18
+ "priority"
19
19
  ],
20
20
  "searchable_fields": [
21
- "name",
22
- "description"
21
+ "description",
22
+ "name"
23
23
  ],
24
24
  "ordering_fields": [
25
- "priority",
26
25
  "created_at",
26
+ "priority",
27
27
  "name"
28
28
  ],
29
29
  "properties": {
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Model-specific QuerySet implementation
3
+ */
4
+ export class UUIDMessageQuerySet {
5
+ }
6
+ /**
7
+ * Model-specific Manager implementation
8
+ */
9
+ export class UUIDMessageManager {
10
+ constructor(ModelClass: any);
11
+ newQuerySet(): UUIDMessageQuerySet;
12
+ }
13
+ /**
14
+ * Implementation of the UUIDMessage model
15
+ */
16
+ export class UUIDMessage {
17
+ static configKey: string;
18
+ static modelName: string;
19
+ static primaryKeyField: string;
20
+ static objects: UUIDMessageManager;
21
+ static fields: string[];
22
+ static schema: {
23
+ model_name: string;
24
+ title: string;
25
+ class_name: string;
26
+ plural_title: string;
27
+ primary_key_field: string;
28
+ filterable_fields: string[];
29
+ searchable_fields: string[];
30
+ ordering_fields: string[];
31
+ properties: {
32
+ id: {
33
+ type: string;
34
+ title: string;
35
+ required: boolean;
36
+ description: null;
37
+ nullable: boolean;
38
+ format: string;
39
+ max_length: null;
40
+ choices: null;
41
+ default: null;
42
+ validators: never[];
43
+ max_digits: null;
44
+ decimal_places: null;
45
+ read_only: boolean;
46
+ ref: null;
47
+ };
48
+ sender: {
49
+ type: string;
50
+ title: string;
51
+ required: boolean;
52
+ description: null;
53
+ nullable: boolean;
54
+ format: string;
55
+ max_length: null;
56
+ choices: null;
57
+ default: null;
58
+ validators: never[];
59
+ max_digits: null;
60
+ decimal_places: null;
61
+ read_only: boolean;
62
+ ref: null;
63
+ };
64
+ recipient: {
65
+ type: string;
66
+ title: string;
67
+ required: boolean;
68
+ description: null;
69
+ nullable: boolean;
70
+ format: string;
71
+ max_length: null;
72
+ choices: null;
73
+ default: null;
74
+ validators: never[];
75
+ max_digits: null;
76
+ decimal_places: null;
77
+ read_only: boolean;
78
+ ref: null;
79
+ };
80
+ body: {
81
+ type: string;
82
+ title: string;
83
+ required: boolean;
84
+ description: null;
85
+ nullable: boolean;
86
+ format: string;
87
+ max_length: null;
88
+ choices: null;
89
+ default: string;
90
+ validators: never[];
91
+ max_digits: null;
92
+ decimal_places: null;
93
+ read_only: boolean;
94
+ ref: null;
95
+ };
96
+ created_at: {
97
+ type: string;
98
+ title: string;
99
+ required: boolean;
100
+ description: null;
101
+ nullable: boolean;
102
+ format: string;
103
+ max_length: null;
104
+ choices: null;
105
+ default: string;
106
+ validators: never[];
107
+ max_digits: null;
108
+ decimal_places: null;
109
+ read_only: boolean;
110
+ ref: null;
111
+ };
112
+ };
113
+ relationships: {
114
+ sender: {
115
+ type: string;
116
+ model: string;
117
+ class_name: string;
118
+ primary_key_field: string;
119
+ };
120
+ recipient: {
121
+ type: string;
122
+ model: string;
123
+ class_name: string;
124
+ primary_key_field: string;
125
+ };
126
+ };
127
+ default_ordering: string[];
128
+ definitions: {
129
+ MoneyField: {
130
+ type: string;
131
+ properties: {
132
+ amount: {
133
+ type: string;
134
+ };
135
+ currency: {
136
+ type: string;
137
+ };
138
+ };
139
+ };
140
+ };
141
+ datetime_format: string;
142
+ date_format: string;
143
+ time_format: string;
144
+ display: null;
145
+ };
146
+ static relationshipFields: Map<string, {
147
+ ModelClass: () => any;
148
+ relationshipType: string;
149
+ }>;
150
+ constructor(data: any);
151
+ /**
152
+ * Define property getters and setters for all model fields
153
+ * @private
154
+ */
155
+ private _defineProperties;
156
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * This file was auto-generated. Do not make direct changes to the file.
3
+ */
4
+ import { Model, Manager, QuerySet, getModelClass } from '../../../../src';
5
+ import { wrapReactiveModel } from '../../../../src';
6
+ import schemaData from './uuidmessage.schema.json';
7
+ /**
8
+ * Model-specific QuerySet implementation
9
+ */
10
+ export class UUIDMessageQuerySet extends QuerySet {
11
+ }
12
+ /**
13
+ * Model-specific Manager implementation
14
+ */
15
+ export class UUIDMessageManager extends Manager {
16
+ constructor(ModelClass) {
17
+ super(ModelClass, UUIDMessageQuerySet);
18
+ }
19
+ newQuerySet() {
20
+ return new UUIDMessageQuerySet(this.ModelClass);
21
+ }
22
+ }
23
+ /**
24
+ * Implementation of the UUIDMessage model
25
+ */
26
+ export class UUIDMessage extends Model {
27
+ constructor(data) {
28
+ UUIDMessage.validateFields(data);
29
+ super(data);
30
+ // Define getters and setters for all fields
31
+ this._defineProperties();
32
+ return wrapReactiveModel(this);
33
+ }
34
+ /**
35
+ * Define property getters and setters for all model fields
36
+ * @private
37
+ */
38
+ _defineProperties() {
39
+ // For each field, define a property that gets/sets from internal storage
40
+ UUIDMessage.fields.forEach(field => {
41
+ Object.defineProperty(this, field, {
42
+ get: function () {
43
+ return this.getField(field);
44
+ },
45
+ set: function (value) {
46
+ this.setField(field, value);
47
+ },
48
+ enumerable: true, // Make sure fields are enumerable for serialization
49
+ configurable: true
50
+ });
51
+ });
52
+ // Add a special read-only getter for the repr field
53
+ Object.defineProperty(this, 'repr', {
54
+ get: function () {
55
+ return this.getField('repr');
56
+ },
57
+ enumerable: true, // Make sure repr is enumerable
58
+ configurable: true
59
+ });
60
+ }
61
+ }
62
+ // Bind this model to its backend
63
+ UUIDMessage.configKey = 'default';
64
+ UUIDMessage.modelName = 'django_app.uuidmessage';
65
+ UUIDMessage.primaryKeyField = 'id';
66
+ UUIDMessage.objects = new UUIDMessageManager(UUIDMessage);
67
+ UUIDMessage.fields = ['id', 'sender', 'recipient', 'body', 'created_at'];
68
+ UUIDMessage.schema = schemaData;
69
+ UUIDMessage.relationshipFields = new Map([
70
+ ['sender', { 'ModelClass': () => getModelClass('django_app.uuiduser', 'default'), 'relationshipType': 'foreign-key' }],
71
+ ['recipient', { 'ModelClass': () => getModelClass('django_app.uuiduser', 'default'), 'relationshipType': 'foreign-key' }]
72
+ ]);
@@ -0,0 +1,136 @@
1
+ {
2
+ "model_name": "django_app.uuidmessage",
3
+ "title": "Uuid Message",
4
+ "class_name": "UUIDMessage",
5
+ "plural_title": "Uuid Messages",
6
+ "primary_key_field": "id",
7
+ "filterable_fields": [
8
+ "recipient",
9
+ "body",
10
+ "created_at",
11
+ "id",
12
+ "sender"
13
+ ],
14
+ "searchable_fields": [
15
+ "body"
16
+ ],
17
+ "ordering_fields": [
18
+ "created_at"
19
+ ],
20
+ "properties": {
21
+ "id": {
22
+ "type": "string",
23
+ "title": "Id",
24
+ "required": true,
25
+ "description": null,
26
+ "nullable": false,
27
+ "format": "uuid",
28
+ "max_length": null,
29
+ "choices": null,
30
+ "default": null,
31
+ "validators": [],
32
+ "max_digits": null,
33
+ "decimal_places": null,
34
+ "read_only": true,
35
+ "ref": null
36
+ },
37
+ "sender": {
38
+ "type": "string",
39
+ "title": "Sender",
40
+ "required": false,
41
+ "description": null,
42
+ "nullable": true,
43
+ "format": "foreign-key",
44
+ "max_length": null,
45
+ "choices": null,
46
+ "default": null,
47
+ "validators": [],
48
+ "max_digits": null,
49
+ "decimal_places": null,
50
+ "read_only": false,
51
+ "ref": null
52
+ },
53
+ "recipient": {
54
+ "type": "string",
55
+ "title": "Recipient",
56
+ "required": false,
57
+ "description": null,
58
+ "nullable": true,
59
+ "format": "foreign-key",
60
+ "max_length": null,
61
+ "choices": null,
62
+ "default": null,
63
+ "validators": [],
64
+ "max_digits": null,
65
+ "decimal_places": null,
66
+ "read_only": false,
67
+ "ref": null
68
+ },
69
+ "body": {
70
+ "type": "string",
71
+ "title": "Body",
72
+ "required": false,
73
+ "description": null,
74
+ "nullable": false,
75
+ "format": "text",
76
+ "max_length": null,
77
+ "choices": null,
78
+ "default": "",
79
+ "validators": [],
80
+ "max_digits": null,
81
+ "decimal_places": null,
82
+ "read_only": false,
83
+ "ref": null
84
+ },
85
+ "created_at": {
86
+ "type": "string",
87
+ "title": "Created at",
88
+ "required": false,
89
+ "description": null,
90
+ "nullable": false,
91
+ "format": "date-time",
92
+ "max_length": null,
93
+ "choices": null,
94
+ "default": "2026-02-28T23:13:32.575797+00:00",
95
+ "validators": [],
96
+ "max_digits": null,
97
+ "decimal_places": null,
98
+ "read_only": false,
99
+ "ref": null
100
+ }
101
+ },
102
+ "relationships": {
103
+ "sender": {
104
+ "type": "foreign-key",
105
+ "model": "django_app.uuiduser",
106
+ "class_name": "UUIDUser",
107
+ "primary_key_field": "id"
108
+ },
109
+ "recipient": {
110
+ "type": "foreign-key",
111
+ "model": "django_app.uuiduser",
112
+ "class_name": "UUIDUser",
113
+ "primary_key_field": "id"
114
+ }
115
+ },
116
+ "default_ordering": [
117
+ "-created_at"
118
+ ],
119
+ "definitions": {
120
+ "MoneyField": {
121
+ "type": "object",
122
+ "properties": {
123
+ "amount": {
124
+ "type": "number"
125
+ },
126
+ "currency": {
127
+ "type": "string"
128
+ }
129
+ }
130
+ }
131
+ },
132
+ "datetime_format": "iso-8601",
133
+ "date_format": "iso-8601",
134
+ "time_format": "iso-8601",
135
+ "display": null
136
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Model-specific QuerySet implementation
3
+ */
4
+ export class UUIDUserQuerySet {
5
+ }
6
+ /**
7
+ * Model-specific Manager implementation
8
+ */
9
+ export class UUIDUserManager {
10
+ constructor(ModelClass: any);
11
+ newQuerySet(): UUIDUserQuerySet;
12
+ }
13
+ /**
14
+ * Implementation of the UUIDUser model
15
+ */
16
+ export class UUIDUser {
17
+ static configKey: string;
18
+ static modelName: string;
19
+ static primaryKeyField: string;
20
+ static objects: UUIDUserManager;
21
+ static fields: string[];
22
+ static schema: {
23
+ model_name: string;
24
+ title: string;
25
+ class_name: string;
26
+ plural_title: string;
27
+ primary_key_field: string;
28
+ filterable_fields: string[];
29
+ searchable_fields: string[];
30
+ ordering_fields: string[];
31
+ properties: {
32
+ id: {
33
+ type: string;
34
+ title: string;
35
+ required: boolean;
36
+ description: null;
37
+ nullable: boolean;
38
+ format: string;
39
+ max_length: null;
40
+ choices: null;
41
+ default: null;
42
+ validators: never[];
43
+ max_digits: null;
44
+ decimal_places: null;
45
+ read_only: boolean;
46
+ ref: null;
47
+ };
48
+ name: {
49
+ type: string;
50
+ title: string;
51
+ required: boolean;
52
+ description: null;
53
+ nullable: boolean;
54
+ format: null;
55
+ max_length: number;
56
+ choices: null;
57
+ default: null;
58
+ validators: never[];
59
+ max_digits: null;
60
+ decimal_places: null;
61
+ read_only: boolean;
62
+ ref: null;
63
+ };
64
+ };
65
+ relationships: {};
66
+ default_ordering: null;
67
+ definitions: {
68
+ MoneyField: {
69
+ type: string;
70
+ properties: {
71
+ amount: {
72
+ type: string;
73
+ };
74
+ currency: {
75
+ type: string;
76
+ };
77
+ };
78
+ };
79
+ };
80
+ datetime_format: string;
81
+ date_format: string;
82
+ time_format: string;
83
+ display: null;
84
+ };
85
+ static relationshipFields: Map<any, any>;
86
+ constructor(data: any);
87
+ /**
88
+ * Define property getters and setters for all model fields
89
+ * @private
90
+ */
91
+ private _defineProperties;
92
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * This file was auto-generated. Do not make direct changes to the file.
3
+ */
4
+ import { Model, Manager, QuerySet, getModelClass } from '../../../../src';
5
+ import { wrapReactiveModel } from '../../../../src';
6
+ import schemaData from './uuiduser.schema.json';
7
+ /**
8
+ * Model-specific QuerySet implementation
9
+ */
10
+ export class UUIDUserQuerySet extends QuerySet {
11
+ }
12
+ /**
13
+ * Model-specific Manager implementation
14
+ */
15
+ export class UUIDUserManager extends Manager {
16
+ constructor(ModelClass) {
17
+ super(ModelClass, UUIDUserQuerySet);
18
+ }
19
+ newQuerySet() {
20
+ return new UUIDUserQuerySet(this.ModelClass);
21
+ }
22
+ }
23
+ /**
24
+ * Implementation of the UUIDUser model
25
+ */
26
+ export class UUIDUser extends Model {
27
+ constructor(data) {
28
+ UUIDUser.validateFields(data);
29
+ super(data);
30
+ // Define getters and setters for all fields
31
+ this._defineProperties();
32
+ return wrapReactiveModel(this);
33
+ }
34
+ /**
35
+ * Define property getters and setters for all model fields
36
+ * @private
37
+ */
38
+ _defineProperties() {
39
+ // For each field, define a property that gets/sets from internal storage
40
+ UUIDUser.fields.forEach(field => {
41
+ Object.defineProperty(this, field, {
42
+ get: function () {
43
+ return this.getField(field);
44
+ },
45
+ set: function (value) {
46
+ this.setField(field, value);
47
+ },
48
+ enumerable: true, // Make sure fields are enumerable for serialization
49
+ configurable: true
50
+ });
51
+ });
52
+ // Add a special read-only getter for the repr field
53
+ Object.defineProperty(this, 'repr', {
54
+ get: function () {
55
+ return this.getField('repr');
56
+ },
57
+ enumerable: true, // Make sure repr is enumerable
58
+ configurable: true
59
+ });
60
+ }
61
+ }
62
+ // Bind this model to its backend
63
+ UUIDUser.configKey = 'default';
64
+ UUIDUser.modelName = 'django_app.uuiduser';
65
+ UUIDUser.primaryKeyField = 'id';
66
+ UUIDUser.objects = new UUIDUserManager(UUIDUser);
67
+ UUIDUser.fields = ['id', 'name'];
68
+ UUIDUser.schema = schemaData;
69
+ UUIDUser.relationshipFields = new Map([]);
@@ -0,0 +1,70 @@
1
+ {
2
+ "model_name": "django_app.uuiduser",
3
+ "title": "Uuid User",
4
+ "class_name": "UUIDUser",
5
+ "plural_title": "Uuid Users",
6
+ "primary_key_field": "id",
7
+ "filterable_fields": [
8
+ "id",
9
+ "name"
10
+ ],
11
+ "searchable_fields": [
12
+ "name"
13
+ ],
14
+ "ordering_fields": [
15
+ "name"
16
+ ],
17
+ "properties": {
18
+ "id": {
19
+ "type": "string",
20
+ "title": "Id",
21
+ "required": true,
22
+ "description": null,
23
+ "nullable": false,
24
+ "format": "uuid",
25
+ "max_length": null,
26
+ "choices": null,
27
+ "default": null,
28
+ "validators": [],
29
+ "max_digits": null,
30
+ "decimal_places": null,
31
+ "read_only": true,
32
+ "ref": null
33
+ },
34
+ "name": {
35
+ "type": "string",
36
+ "title": "Name",
37
+ "required": true,
38
+ "description": null,
39
+ "nullable": false,
40
+ "format": null,
41
+ "max_length": 100,
42
+ "choices": null,
43
+ "default": null,
44
+ "validators": [],
45
+ "max_digits": null,
46
+ "decimal_places": null,
47
+ "read_only": false,
48
+ "ref": null
49
+ }
50
+ },
51
+ "relationships": {},
52
+ "default_ordering": null,
53
+ "definitions": {
54
+ "MoneyField": {
55
+ "type": "object",
56
+ "properties": {
57
+ "amount": {
58
+ "type": "number"
59
+ },
60
+ "currency": {
61
+ "type": "string"
62
+ }
63
+ }
64
+ }
65
+ },
66
+ "datetime_format": "iso-8601",
67
+ "date_format": "iso-8601",
68
+ "time_format": "iso-8601",
69
+ "display": null
70
+ }
@@ -7,6 +7,7 @@ export class QuerysetStore {
7
7
  groundTruthPks: never[];
8
8
  isSyncing: boolean;
9
9
  lastSync: number | null;
10
+ lastHydrated: number | null;
10
11
  _createdAt: number;
11
12
  isTemp: any;
12
13
  pruneThreshold: any;
@@ -15,6 +15,7 @@ export class QuerysetStore {
15
15
  this.queryset = queryset;
16
16
  this.isSyncing = false;
17
17
  this.lastSync = null;
18
+ this.lastHydrated = null;
18
19
  this._createdAt = Date.now();
19
20
  this.isTemp = options.isTemp || false;
20
21
  this.pruneThreshold = options.pruneThreshold || 10;
@@ -48,20 +49,22 @@ export class QuerysetStore {
48
49
  return this.queryset.semanticKey;
49
50
  }
50
51
  onHydrated(hydratedData) {
51
- // Only use cached data if we haven't synced yet and have no ground truth.
52
- // This prevents stale cache from overwriting real server data.
53
52
  if (this.lastSync !== null)
54
53
  return;
55
54
  if (this.groundTruthPks.length > 0 || this.operationsMap.size > 0)
56
55
  return;
57
56
  const cached = this.qsCache.get(this.cacheKey);
58
- if (!isNil(cached) && !isEmpty(cached)) {
59
- // Set ground truth WITHOUT updating lastSync — hydration is not a real sync
57
+ if (!isNil(cached)) {
60
58
  this.groundTruthPks = Array.isArray(cached) ? cached : [];
61
- this._emitRenderEvent();
59
+ this.lastHydrated = Date.now();
60
+ if (cached.length > 0) {
61
+ this._emitRenderEvent();
62
+ }
62
63
  }
63
64
  }
64
65
  setCache(result) {
66
+ if (this.lastSync === null)
67
+ return;
65
68
  let nonTempPks = [];
66
69
  result.forEach((pk) => {
67
70
  if (typeof pk === "string" && containsTempPk(pk)) {
@@ -302,8 +305,8 @@ export class QuerysetStore {
302
305
  const pkField = this.pkField;
303
306
  return modelStore.render().map(inst => inst[pkField]).filter(pk => pk != null);
304
307
  }
305
- // Permanent never-synced: seed from local data
306
- if (!this.isTemp && this.lastSync === null && modelStore) {
308
+ // Permanent never-synced and never-hydrated: seed from local data
309
+ if (!this.isTemp && this.lastSync === null && this.lastHydrated === null && modelStore) {
307
310
  const hasOffset = (this.queryset._serializerOptions?.offset ?? 0) > 0;
308
311
  if (!hasOffset) {
309
312
  // No offset: seed from all model store data, filter handles membership
@@ -345,7 +348,8 @@ export class QuerysetStore {
345
348
  if (ops[i].status !== Status.CONFIRMED)
346
349
  return true;
347
350
  // Confirmed ops: only relevant if newer than last sync
348
- return ops[i].timestamp >= cutoff;
351
+ if (ops[i].timestamp >= cutoff)
352
+ return true;
349
353
  }
350
354
  return false;
351
355
  }