@singularsystems/neo-core 1.6.8 → 1.6.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Neo core changelog
2
2
 
3
+ ## Version 1.6.9 (27 October 2026)
4
+
5
+ - Offline DataCache
6
+ - Fixed deleted records not being removed from dbSet.
7
+ - Fixed refetch of data potentially returning previously stored records.
8
+
3
9
  ## Version 1.6.8 (15 October 2026)
4
10
 
5
11
  - Fixed sign out not clearing offline user data.
@@ -47,27 +47,30 @@ var ConvertingApiClientDataSource = /** @class */ (function (_super) {
47
47
  return __generator(this, function (_a) {
48
48
  switch (_a.label) {
49
49
  case 0:
50
- if (!(NetworkUtils.isOnline || !this.supportOffline)) return [3 /*break*/, 2];
50
+ if (!(NetworkUtils.isOnline || !this.supportOffline)) return [3 /*break*/, 5];
51
51
  return [4 /*yield*/, AxiosUtils.catchErrors(this.getMethod())];
52
52
  case 1:
53
53
  result = _a.sent();
54
- if (result.success) {
55
- rawData = result.data;
56
- if (this.supportOffline) {
57
- this.offlineStore(rawData);
58
- }
59
- }
60
- else if (!result.isNetworkError || !this.supportOffline) {
54
+ if (!result.success) return [3 /*break*/, 4];
55
+ rawData = result.data;
56
+ if (!this.supportOffline) return [3 /*break*/, 3];
57
+ return [4 /*yield*/, this.offlineStore(rawData)];
58
+ case 2:
59
+ _a.sent();
60
+ _a.label = 3;
61
+ case 3: return [3 /*break*/, 5];
62
+ case 4:
63
+ if (!result.isNetworkError || !this.supportOffline) {
61
64
  throw result.error;
62
65
  }
63
- _a.label = 2;
64
- case 2:
65
- if (!this.supportOffline) return [3 /*break*/, 4];
66
+ _a.label = 5;
67
+ case 5:
68
+ if (!this.supportOffline) return [3 /*break*/, 7];
66
69
  return [4 /*yield*/, this.offlineGet()];
67
- case 3:
70
+ case 6:
68
71
  rawData = _a.sent();
69
- _a.label = 4;
70
- case 4: return [2 /*return*/, this.convertData(rawData)];
72
+ _a.label = 7;
73
+ case 7: return [2 /*return*/, this.convertData(rawData)];
71
74
  }
72
75
  });
73
76
  });
@@ -91,7 +94,7 @@ var ApiClientLookupDataSource = /** @class */ (function (_super) {
91
94
  return this.dbSet.getAllAsync();
92
95
  };
93
96
  ApiClientLookupDataSource.prototype.offlineStore = function (rawData) {
94
- return this.dbSet.putAsync(rawData);
97
+ return this.dbSet.replaceAsync(rawData);
95
98
  };
96
99
  ApiClientLookupDataSource.prototype.convertData = function (rawData) {
97
100
  return List.fromJSArray(this.deserialiseType, rawData);
@@ -197,6 +197,15 @@ var Deserialiser = /** @class */ (function () {
197
197
  this.deserialiseArray(fromValue, to[key], propertyInfo.itemConstructorOptions);
198
198
  }
199
199
  else {
200
+ /*
201
+ TODO: this should throw an error.
202
+ If a developer forgets to add a child list attribute, this sets the raw data to the array.
203
+ This may cause other runtime errors because a full model is expected.
204
+ A serialise of the host object will also throw an error.
205
+ If raw data is needed, then @Attributes.Raw() should be used.
206
+
207
+ Change this during the next major version.
208
+ */
200
209
  // Plain array
201
210
  to[key] = fromValue;
202
211
  }
@@ -8,4 +8,6 @@ export interface IDbSet<T> {
8
8
  putAsync(value: T, keyValue?: IDBValidKey): Promise<void>;
9
9
  /** Adds or updates multiple items in a transaction. */
10
10
  putAsync(value: T[]): Promise<void>;
11
+ /** Replaces all items in the store with the specified values. */
12
+ replaceAsync(values: T[]): Promise<void>;
11
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",