@singularsystems/neo-core 1.3.7 → 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 +12 -0
- package/dist/Components/FileManager/FileManager.js +3 -0
- package/dist/Components/FileManager/IFileManagerOptions.d.ts +2 -0
- package/dist/Data/DataCacheEntry.d.ts +2 -2
- package/dist/Data/DataCacheEntry.js +42 -16
- package/dist/Dates/DateUtils.d.ts +4 -4
- package/dist/Dates/DateUtils.js +1 -1
- package/dist/Dates/TimeSpan.d.ts +4 -6
- package/dist/Dates/TimeSpan.js +8 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
8
|
+
## Version 1.3.8 (28 Jan 2026)
|
|
9
|
+
|
|
10
|
+
- DateUtils
|
|
11
|
+
- Renamed `ITimeSpan` to `ITimeValues`. `DateUtils.difference` now returns `TimeSpan`. See breaking changes.
|
|
12
|
+
- FileOptions
|
|
13
|
+
- Added `capture` property to file options.
|
|
14
|
+
|
|
3
15
|
## Version 1.3.7 (24 Nov 2025)
|
|
4
16
|
|
|
5
17
|
- Deserialiser
|
|
@@ -214,6 +214,9 @@ var FileManagerBase = /** @class */ (function () {
|
|
|
214
214
|
else {
|
|
215
215
|
props.accept = "";
|
|
216
216
|
}
|
|
217
|
+
if (this.options.capture) {
|
|
218
|
+
props.capture = this.options.capture;
|
|
219
|
+
}
|
|
217
220
|
return props;
|
|
218
221
|
};
|
|
219
222
|
FileManagerBase.prototype.afterUpload = function (response) {
|
|
@@ -9,6 +9,8 @@ export interface IBaseFileManagerOptions {
|
|
|
9
9
|
allowedExtensions?: string[];
|
|
10
10
|
/** Accept type. E.g. image/* */
|
|
11
11
|
accept?: string;
|
|
12
|
+
/** Specify the preferred camera to use for capturing media. */
|
|
13
|
+
capture?: "user" | "environment";
|
|
12
14
|
/** True if you want to allow new files to be selected once a file is already uploading. */
|
|
13
15
|
allowConcurrent?: boolean;
|
|
14
16
|
/**
|
|
@@ -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 (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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 (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
}());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IPropertyInstance } from "../Model/PropertyInstance";
|
|
2
2
|
import { TimeZoneFormat } from "../Misc";
|
|
3
|
-
import {
|
|
3
|
+
import { ITimeValues, TimeSpan } from "./TimeSpan";
|
|
4
4
|
export default class DateUtils {
|
|
5
5
|
static defaultFormatString: string;
|
|
6
6
|
static defaultFormatStringWithTime: string;
|
|
@@ -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
|
*/
|
|
@@ -44,7 +44,7 @@ export default class DateUtils {
|
|
|
44
44
|
* Returns a new date, with the timespan components added to it.
|
|
45
45
|
* Use negative numbers to subtract.
|
|
46
46
|
*/
|
|
47
|
-
static add(date: Date, timeSpan: Partial<
|
|
47
|
+
static add(date: Date, timeSpan: Partial<ITimeValues>): Date;
|
|
48
48
|
/**
|
|
49
49
|
* Gets the difference between 2 dates.
|
|
50
50
|
*/
|
package/dist/Dates/DateUtils.js
CHANGED
|
@@ -223,7 +223,7 @@ var DateUtils = /** @class */ (function () {
|
|
|
223
223
|
var compareDate = new Date();
|
|
224
224
|
compareDate.setFullYear(endDate.getFullYear() - startDate.getFullYear(), endDate.getMonth() - startDate.getMonth(), endDate.getDate() - startDate.getDate());
|
|
225
225
|
compareDate.setHours(endDate.getHours() - startDate.getHours(), endDate.getMinutes() - startDate.getMinutes(), endDate.getSeconds() - startDate.getSeconds(), endDate.getMilliseconds() - startDate.getMilliseconds());
|
|
226
|
-
return new TimeSpan(compareDate.
|
|
226
|
+
return new TimeSpan(compareDate.getHours(), compareDate.getMinutes(), compareDate.getSeconds(), compareDate.getMilliseconds(), endDate.getTime() - startDate.getTime());
|
|
227
227
|
};
|
|
228
228
|
DateUtils.defaultFormatString = "dd MMM yyyy";
|
|
229
229
|
DateUtils.defaultFormatStringWithTime = "dd MMM yyyy HH:mm";
|
package/dist/Dates/TimeSpan.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ITimeValues {
|
|
2
2
|
years: number;
|
|
3
3
|
months: number;
|
|
4
4
|
days: number;
|
|
@@ -7,18 +7,16 @@ export interface ITimeSpan {
|
|
|
7
7
|
seconds: number;
|
|
8
8
|
milliseconds: number;
|
|
9
9
|
}
|
|
10
|
-
export declare class TimeSpan
|
|
11
|
-
readonly years: number;
|
|
12
|
-
readonly months: number;
|
|
13
|
-
readonly days: number;
|
|
10
|
+
export declare class TimeSpan {
|
|
14
11
|
readonly hours: number;
|
|
15
12
|
readonly minutes: number;
|
|
16
13
|
readonly seconds: number;
|
|
17
14
|
readonly milliseconds: number;
|
|
18
15
|
readonly totalMilliseconds: number;
|
|
19
|
-
constructor(
|
|
16
|
+
constructor(hours: number, minutes: number, seconds: number, milliseconds: number, totalMilliseconds: number);
|
|
20
17
|
get totalSeconds(): number;
|
|
21
18
|
get totalMinutes(): number;
|
|
22
19
|
get totalHours(): number;
|
|
20
|
+
get days(): number;
|
|
23
21
|
get totalDays(): number;
|
|
24
22
|
}
|
package/dist/Dates/TimeSpan.js
CHANGED
|
@@ -3,10 +3,7 @@ var msPerMinute = msPerSecond * 60;
|
|
|
3
3
|
var msPerHour = msPerMinute * 60;
|
|
4
4
|
var msPerDay = msPerHour * 24;
|
|
5
5
|
var TimeSpan = /** @class */ (function () {
|
|
6
|
-
function TimeSpan(
|
|
7
|
-
this.years = years;
|
|
8
|
-
this.months = months;
|
|
9
|
-
this.days = days;
|
|
6
|
+
function TimeSpan(hours, minutes, seconds, milliseconds, totalMilliseconds) {
|
|
10
7
|
this.hours = hours;
|
|
11
8
|
this.minutes = minutes;
|
|
12
9
|
this.seconds = seconds;
|
|
@@ -34,6 +31,13 @@ var TimeSpan = /** @class */ (function () {
|
|
|
34
31
|
enumerable: false,
|
|
35
32
|
configurable: true
|
|
36
33
|
});
|
|
34
|
+
Object.defineProperty(TimeSpan.prototype, "days", {
|
|
35
|
+
get: function () {
|
|
36
|
+
return this.totalDays;
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
37
41
|
Object.defineProperty(TimeSpan.prototype, "totalDays", {
|
|
38
42
|
get: function () {
|
|
39
43
|
return Math.floor(this.totalMilliseconds / msPerDay);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-core",
|
|
3
|
-
"version": "1.3.
|
|
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": "
|
|
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.
|
|
24
|
-
"typescript": "5.
|
|
23
|
+
"ts-jest": "29.4.6",
|
|
24
|
+
"typescript": "5.9.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@microsoft/signalr": "
|
|
28
|
-
"axios": "1.
|
|
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"
|