@singularsystems/neo-core 1.3.8 → 1.3.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,10 @@
1
1
  # Neo core changelog
2
2
 
3
+ ## Version 1.3.9 (4 March 2026)
4
+
5
+ - Made `IDataCacheEntry.expire` method awaitable.
6
+ - Made `DateUtils.format` allow null dates
7
+
3
8
  ## Version 1.3.8 (28 Jan 2026)
4
9
 
5
10
  - DateUtils
@@ -1,6 +1,6 @@
1
1
  import { IAsyncDataSource } from "./AsyncDataSource";
2
2
  export interface IDataCacheEntry {
3
- expire(refetch?: boolean): void;
3
+ expire(refetch?: boolean): Promise<void>;
4
4
  get(clearPreviousError?: boolean): IAsyncDataSource<any>;
5
5
  /**
6
6
  * Will return true if the data has expired, or the data source is loading.
@@ -32,7 +32,7 @@ export declare class DataCacheEntry<T> implements IDataCacheEntry {
32
32
  * Expires the datasource.
33
33
  * @param refetch True if the datasource must be refetched. This will cause any consumers of this datasource to rebind to the updated data.
34
34
  */
35
- expire(refetch?: boolean): void;
35
+ expire(refetch?: boolean): Promise<void>;
36
36
  private expireNow;
37
37
  private fetchIfExpired;
38
38
  }
@@ -1,3 +1,4 @@
1
+ import { __awaiter, __generator } from "tslib";
1
2
  var DataCacheEntry = /** @class */ (function () {
2
3
  function DataCacheEntry(dataSource, lifeTimeMinutes) {
3
4
  this.dataSource = dataSource;
@@ -47,27 +48,52 @@ var DataCacheEntry = /** @class */ (function () {
47
48
  * Expires the datasource.
48
49
  * @param refetch True if the datasource must be refetched. This will cause any consumers of this datasource to rebind to the updated data.
49
50
  */
50
- DataCacheEntry.prototype.expire = function (refetch) {
51
- if (refetch === void 0) { refetch = false; }
52
- this.expireNow();
53
- if (refetch) {
54
- this.fetchIfExpired();
55
- }
51
+ DataCacheEntry.prototype.expire = function () {
52
+ return __awaiter(this, arguments, void 0, function (refetch) {
53
+ if (refetch === void 0) { refetch = false; }
54
+ return __generator(this, function (_a) {
55
+ switch (_a.label) {
56
+ case 0:
57
+ this.expireNow();
58
+ if (!refetch) return [3 /*break*/, 2];
59
+ return [4 /*yield*/, this.fetchIfExpired()];
60
+ case 1:
61
+ _a.sent();
62
+ _a.label = 2;
63
+ case 2: return [2 /*return*/];
64
+ }
65
+ });
66
+ });
56
67
  };
57
68
  DataCacheEntry.prototype.expireNow = function () {
58
69
  this.expiryDate = new Date();
59
70
  };
60
- DataCacheEntry.prototype.fetchIfExpired = function (clearPreviousError) {
61
- var _this = this;
62
- if (clearPreviousError === void 0) { clearPreviousError = false; }
63
- if (this.isExpired) {
64
- this.expiryDate = new Date();
65
- this.expiryDate.setMinutes(this.expiryDate.getMinutes() + this.lifeTimeMinutes);
66
- this.dataSource.fetchDataAsync(clearPreviousError).catch(function (e) {
67
- _this.expireNow();
68
- // TODO: Error handling, or is console logging enough?
71
+ DataCacheEntry.prototype.fetchIfExpired = function () {
72
+ return __awaiter(this, arguments, void 0, function (clearPreviousError) {
73
+ var e_1;
74
+ if (clearPreviousError === void 0) { clearPreviousError = false; }
75
+ return __generator(this, function (_a) {
76
+ switch (_a.label) {
77
+ case 0:
78
+ if (!this.isExpired) return [3 /*break*/, 4];
79
+ this.expiryDate = new Date();
80
+ this.expiryDate.setMinutes(this.expiryDate.getMinutes() + this.lifeTimeMinutes);
81
+ _a.label = 1;
82
+ case 1:
83
+ _a.trys.push([1, 3, , 4]);
84
+ return [4 /*yield*/, this.dataSource.fetchDataAsync(clearPreviousError)];
85
+ case 2:
86
+ _a.sent();
87
+ return [3 /*break*/, 4];
88
+ case 3:
89
+ e_1 = _a.sent();
90
+ // TODO: Error handling, or is console logging enough?
91
+ this.expireNow();
92
+ return [3 /*break*/, 4];
93
+ case 4: return [2 /*return*/];
94
+ }
69
95
  });
70
- }
96
+ });
71
97
  };
72
98
  return DataCacheEntry;
73
99
  }());
@@ -11,8 +11,8 @@ export default class DateUtils {
11
11
  dayNames: string[];
12
12
  monthNames: string[];
13
13
  };
14
- static format(date: Date, formatString?: string, utc?: boolean): string;
15
- static format(dateProperty: IPropertyInstance<Date>): string;
14
+ static format(date: Date | null, formatString?: string, utc?: boolean): string;
15
+ static format(dateProperty: IPropertyInstance<Date | null>): string;
16
16
  /**
17
17
  * Formats a date using api standards.
18
18
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,16 +16,16 @@
16
16
  "license": "ISC",
17
17
  "devDependencies": {
18
18
  "@types/jest": "30.0.0",
19
- "@types/node": "24.7.2",
19
+ "@types/node": "25.3.0",
20
20
  "decimal.js-light": "2.5.1",
21
21
  "jest": "30.2.0",
22
22
  "jest-util": "30.2.0",
23
- "ts-jest": "29.4.5",
24
- "typescript": "5.7.3"
23
+ "ts-jest": "29.4.6",
24
+ "typescript": "5.9.3"
25
25
  },
26
26
  "dependencies": {
27
- "@microsoft/signalr": "9.0.6",
28
- "axios": "1.12.2",
27
+ "@microsoft/signalr": "10.0.0",
28
+ "axios": "1.13.5",
29
29
  "inversify": "6.0.2",
30
30
  "reflect-metadata": "0.2.2",
31
31
  "tslib": "2.8.1"