@actdim/utico 1.2.5 → 1.2.7
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/README.md +73 -3
- package/dist/arrayExtensions.es.js +64 -38
- package/dist/arrayExtensions.es.js.map +1 -1
- package/dist/asyncLock.es.js +45 -30
- package/dist/asyncLock.es.js.map +1 -1
- package/dist/cache/cacheContracts.es.js +8 -4
- package/dist/cache/cacheContracts.es.js.map +1 -1
- package/dist/cache/memoryCache.es.js +28 -13
- package/dist/cache/memoryCache.es.js.map +1 -1
- package/dist/cache/persistentCache.es.js +174 -97
- package/dist/cache/persistentCache.es.js.map +1 -1
- package/dist/dataFormats.es.js +4 -4
- package/dist/dataFormats.es.js.map +1 -1
- package/dist/dateTimeDataFormat.es.js +211 -130
- package/dist/dateTimeDataFormat.es.js.map +1 -1
- package/dist/decorators.es.js +15 -11
- package/dist/decorators.es.js.map +1 -1
- package/dist/gfx/canvasUtils.es.js +197 -114
- package/dist/gfx/canvasUtils.es.js.map +1 -1
- package/dist/gfx/color.es.js +134 -68
- package/dist/gfx/color.es.js.map +1 -1
- package/dist/i18n/cultures.es.js +8 -8
- package/dist/i18n/cultures.es.js.map +1 -1
- package/dist/i18n/enUsCulture.es.js +2 -2
- package/dist/i18n/enUsCulture.es.js.map +1 -1
- package/dist/i18n/euCulture.es.js +2 -2
- package/dist/i18n/euCulture.es.js.map +1 -1
- package/dist/i18n/invariantCulture.es.js +2 -2
- package/dist/i18n/invariantCulture.es.js.map +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/math.es.js +14 -8
- package/dist/math.es.js.map +1 -1
- package/dist/metadata.es.js +53 -25
- package/dist/metadata.es.js.map +1 -1
- package/dist/patterns.es.js +5 -3
- package/dist/patterns.es.js.map +1 -1
- package/dist/store/dataStore.es.js +241 -157
- package/dist/store/dataStore.es.js.map +1 -1
- package/dist/store/persistentStore.es.js +23 -17
- package/dist/store/persistentStore.es.js.map +1 -1
- package/dist/store/storeContracts.es.js +7 -3
- package/dist/store/storeContracts.es.js.map +1 -1
- package/dist/store/storeDb.es.js +87 -50
- package/dist/store/storeDb.es.js.map +1 -1
- package/dist/stringCore.es.js +60 -22
- package/dist/stringCore.es.js.map +1 -1
- package/dist/structEvent.es.js +30 -17
- package/dist/structEvent.es.js.map +1 -1
- package/dist/typeCore.es.js +25 -11
- package/dist/typeCore.es.js.map +1 -1
- package/dist/typeUtils.es.js +292 -182
- package/dist/typeUtils.es.js.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.es.js +138 -81
- package/dist/utils.es.js.map +1 -1
- package/dist/watchable.es.js +50 -27
- package/dist/watchable.es.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,80 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { DateTime } from "luxon";
|
|
4
|
+
const DateTimeNumberFormat = {
|
|
3
5
|
UnixTimeMilliseconds: "unixTimeMilliseconds",
|
|
4
6
|
UnixTimeSeconds: "unixTimeSeconds",
|
|
5
7
|
/** OLE Automation Date */
|
|
6
8
|
OADate: "oaDate"
|
|
7
|
-
}
|
|
9
|
+
};
|
|
10
|
+
const DateTimePrecision = {
|
|
8
11
|
Auto: "auto",
|
|
9
12
|
Date: "date",
|
|
10
13
|
Minute: "minute",
|
|
11
14
|
Second: "second",
|
|
12
15
|
Millisecond: "millisecond"
|
|
13
|
-
}
|
|
16
|
+
};
|
|
17
|
+
const DateTimeKind = {
|
|
14
18
|
Local: "local",
|
|
15
19
|
Utc: "utc"
|
|
16
|
-
}
|
|
20
|
+
};
|
|
21
|
+
const DateTimeStringInterpretation = {
|
|
17
22
|
Auto: "auto",
|
|
18
23
|
Local: "local",
|
|
19
24
|
// wall-clock, naive
|
|
20
25
|
Utc: "utc"
|
|
21
26
|
// universal, instant, absolute
|
|
22
|
-
}
|
|
27
|
+
};
|
|
28
|
+
const DateTimeExportInterpretation = {
|
|
23
29
|
Original: "original",
|
|
24
30
|
Local: "local",
|
|
25
31
|
// wall-clock, naive
|
|
26
32
|
Utc: "utc",
|
|
27
33
|
// universal, instant, absolute
|
|
28
34
|
Match: "match"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
};
|
|
36
|
+
const $isDateTimeExtended = Symbol("isDateTimeExtended");
|
|
37
|
+
function isDateTimeExtended(obj) {
|
|
38
|
+
return obj[$isDateTimeExtended] == true;
|
|
32
39
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
case
|
|
40
|
+
__name(isDateTimeExtended, "isDateTimeExtended");
|
|
41
|
+
function truncateToPrecision(dt, precision) {
|
|
42
|
+
switch (precision) {
|
|
43
|
+
case DateTimePrecision.Date:
|
|
44
|
+
return dt.startOf("day");
|
|
45
|
+
case DateTimePrecision.Minute:
|
|
46
|
+
return dt.startOf("minute");
|
|
47
|
+
case DateTimePrecision.Second:
|
|
48
|
+
return dt.startOf("second");
|
|
49
|
+
case DateTimePrecision.Auto:
|
|
50
|
+
case DateTimePrecision.Millisecond:
|
|
43
51
|
default:
|
|
44
|
-
return
|
|
52
|
+
return dt;
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let l = u;
|
|
54
|
-
if (T === f.Local ? l = u.setZone("local", { keepLocalTime: !0 }) : T === f.Utc ? l = u.setZone("utc", { keepLocalTime: !0 }) : T === f.Match && (i === r.Local ? l = u.setZone("local", { keepLocalTime: !0 }) : i === r.Utc && (l = u.setZone("utc", { keepLocalTime: !0 }))), i === r.Local) {
|
|
55
|
-
const S = c.precision === n.Date ? D.localDate : D.localDateTime;
|
|
56
|
-
return l.setZone("local").toFormat(S, m);
|
|
55
|
+
__name(truncateToPrecision, "truncateToPrecision");
|
|
56
|
+
function extend(dt, precision = DateTimePrecision.Auto) {
|
|
57
|
+
const isExtended = isDateTimeExtended(dt);
|
|
58
|
+
if (isExtended) {
|
|
59
|
+
if (precision === DateTimePrecision.Auto) {
|
|
60
|
+
precision = dt.precision;
|
|
57
61
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
} else {
|
|
63
|
+
if (precision === DateTimePrecision.Auto) {
|
|
64
|
+
precision = DateTimePrecision.Millisecond;
|
|
61
65
|
}
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
}
|
|
67
|
+
const extended = truncateToPrecision(dt, precision);
|
|
68
|
+
if (!isExtended) {
|
|
69
|
+
extended[$isDateTimeExtended] = true;
|
|
70
|
+
extended.exportToString = (formatOrKind = DateTimeKind.Utc, interpretAs = DateTimeExportInterpretation.Original, options) => {
|
|
71
|
+
const sourceForInterpretation = extended.precision === DateTimePrecision.Date ? extended : extended.toUTC();
|
|
72
|
+
let interpreted = sourceForInterpretation;
|
|
73
|
+
if (interpretAs === DateTimeExportInterpretation.Local) {
|
|
74
|
+
interpreted = sourceForInterpretation.setZone("local", { keepLocalTime: true });
|
|
75
|
+
} else if (interpretAs === DateTimeExportInterpretation.Utc) {
|
|
76
|
+
interpreted = sourceForInterpretation.setZone("utc", { keepLocalTime: true });
|
|
77
|
+
} else if (interpretAs === DateTimeExportInterpretation.Match) {
|
|
78
|
+
if (formatOrKind === DateTimeKind.Local) {
|
|
79
|
+
interpreted = sourceForInterpretation.setZone("local", { keepLocalTime: true });
|
|
80
|
+
} else if (formatOrKind === DateTimeKind.Utc) {
|
|
81
|
+
interpreted = sourceForInterpretation.setZone("utc", { keepLocalTime: true });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (formatOrKind === DateTimeKind.Local) {
|
|
85
|
+
const format = extended.precision === DateTimePrecision.Date ? s11nFormat.localDate : s11nFormat.localDateTime;
|
|
86
|
+
return interpreted.setZone("local").toFormat(format, options);
|
|
87
|
+
}
|
|
88
|
+
if (formatOrKind === DateTimeKind.Utc) {
|
|
89
|
+
const format = extended.precision === DateTimePrecision.Date ? s11nFormat.utcDate : s11nFormat.utcDateTime;
|
|
90
|
+
return interpreted.setZone("utc").toFormat(format, options);
|
|
91
|
+
}
|
|
92
|
+
return interpreted.toFormat(formatOrKind, options);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
extended.precision = precision;
|
|
96
|
+
return extended;
|
|
64
97
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
98
|
+
__name(extend, "extend");
|
|
99
|
+
function inferPrecisionFromFormat(format) {
|
|
100
|
+
if (!format) return void 0;
|
|
101
|
+
if (format.includes("S")) return DateTimePrecision.Millisecond;
|
|
102
|
+
if (format.includes("s")) return DateTimePrecision.Second;
|
|
103
|
+
if (format.includes("m")) return DateTimePrecision.Minute;
|
|
104
|
+
return DateTimePrecision.Date;
|
|
68
105
|
}
|
|
69
|
-
|
|
106
|
+
__name(inferPrecisionFromFormat, "inferPrecisionFromFormat");
|
|
107
|
+
const defaultToDateTimeOptions = {
|
|
70
108
|
/** ISO 8601 (yyyy-MM-dd'T'HH:mm:ss.SSS[Z|±HH:mm] or yyyy-MM-dd'T'HH:mm:ss.SSS) */
|
|
71
109
|
stringFormat: void 0,
|
|
72
|
-
stringInterpretAs:
|
|
73
|
-
numberFormat:
|
|
74
|
-
numberInterpretAs:
|
|
75
|
-
dateInterpretAs:
|
|
76
|
-
precision:
|
|
77
|
-
}
|
|
110
|
+
stringInterpretAs: DateTimeStringInterpretation.Auto,
|
|
111
|
+
numberFormat: DateTimeNumberFormat.UnixTimeMilliseconds,
|
|
112
|
+
numberInterpretAs: DateTimeKind.Utc,
|
|
113
|
+
dateInterpretAs: DateTimeKind.Utc,
|
|
114
|
+
precision: DateTimePrecision.Auto
|
|
115
|
+
};
|
|
116
|
+
const s11nFormat = {
|
|
78
117
|
// ISO local date (without offset), example: 2026-02-24
|
|
79
118
|
localDate: "yyyy-MM-dd",
|
|
80
119
|
// ISO local datetime (without offset), example: 2026-02-24T13:45:30.123
|
|
@@ -84,115 +123,157 @@ const U = {
|
|
|
84
123
|
// ISO UTC datetime (explicit UTC suffix), example: 2026-02-24T13:45:30.123Z
|
|
85
124
|
utcDateTime: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
|
|
86
125
|
};
|
|
87
|
-
function
|
|
88
|
-
if (!
|
|
126
|
+
function getDateTimeFromString(value, format, precision = DateTimePrecision.Auto, interpretAs = DateTimeStringInterpretation.Auto) {
|
|
127
|
+
if (!value) {
|
|
89
128
|
return null;
|
|
90
|
-
|
|
91
|
-
|
|
129
|
+
}
|
|
130
|
+
let dt = format ? DateTime.fromFormat(value, format, { setZone: true }) : DateTime.fromISO(value, { setZone: true });
|
|
131
|
+
if (interpretAs === DateTimeStringInterpretation.Local) {
|
|
132
|
+
dt = dt.setZone("local", { keepLocalTime: true });
|
|
133
|
+
} else if (interpretAs === DateTimeStringInterpretation.Utc) {
|
|
134
|
+
dt = dt.setZone("utc", { keepLocalTime: true });
|
|
135
|
+
}
|
|
136
|
+
if (!dt.isValid) {
|
|
92
137
|
throw new Error(
|
|
93
|
-
`Assertion. Invalid datetime format: ${
|
|
138
|
+
`Assertion. Invalid datetime format: ${value}. Expected format: ${format ?? "ISO 8601 (yyyy-MM-dd'T'HH:mm:ss.SSS[Z|±HH:mm] or yyyy-MM-dd'T'HH:mm:ss.SSS)"}.`
|
|
94
139
|
);
|
|
95
|
-
|
|
140
|
+
}
|
|
141
|
+
if (precision === DateTimePrecision.Auto) {
|
|
142
|
+
precision = inferPrecisionFromFormat(format) ?? DateTimePrecision.Millisecond;
|
|
143
|
+
}
|
|
144
|
+
return extend(dt, precision);
|
|
96
145
|
}
|
|
97
|
-
|
|
98
|
-
|
|
146
|
+
__name(getDateTimeFromString, "getDateTimeFromString");
|
|
147
|
+
function getDateTimeFromNumber(value, dtNumberFormat = DateTimeNumberFormat.UnixTimeMilliseconds, interpretAs = DateTimeKind.Utc, precision = DateTimePrecision.Millisecond) {
|
|
148
|
+
if (value == null) {
|
|
99
149
|
return null;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
150
|
+
}
|
|
151
|
+
let dt;
|
|
152
|
+
switch (dtNumberFormat) {
|
|
153
|
+
case DateTimeNumberFormat.UnixTimeMilliseconds:
|
|
154
|
+
dt = interpretAs === "local" ? DateTime.fromMillis(value) : DateTime.fromMillis(value, { zone: "utc" });
|
|
104
155
|
break;
|
|
105
|
-
case
|
|
106
|
-
|
|
156
|
+
case DateTimeNumberFormat.UnixTimeSeconds:
|
|
157
|
+
dt = interpretAs === "local" ? DateTime.fromSeconds(value) : DateTime.fromSeconds(value, { zone: "utc" });
|
|
107
158
|
break;
|
|
108
|
-
case
|
|
109
|
-
if (
|
|
110
|
-
const
|
|
111
|
-
|
|
159
|
+
case DateTimeNumberFormat.OADate: {
|
|
160
|
+
if (interpretAs === "local") {
|
|
161
|
+
const days = Math.floor(value);
|
|
162
|
+
const ms = Math.abs((value - days) * 864e5);
|
|
163
|
+
const jsDate = new Date(1899, 11, 30 + days, 0, 0, 0, ms);
|
|
164
|
+
dt = DateTime.fromJSDate(jsDate);
|
|
112
165
|
break;
|
|
113
166
|
}
|
|
114
|
-
const
|
|
115
|
-
|
|
167
|
+
const oaEpochMs = Date.UTC(1899, 11, 30, 0, 0, 0, 0);
|
|
168
|
+
dt = DateTime.fromMillis(oaEpochMs + value * 864e5, { zone: "utc" });
|
|
116
169
|
break;
|
|
117
170
|
}
|
|
118
171
|
}
|
|
119
|
-
return
|
|
172
|
+
return extend(dt, precision);
|
|
120
173
|
}
|
|
121
|
-
|
|
122
|
-
|
|
174
|
+
__name(getDateTimeFromNumber, "getDateTimeFromNumber");
|
|
175
|
+
function getDateTimeNumber(dt, dtNumberFormat = DateTimeNumberFormat.UnixTimeSeconds) {
|
|
176
|
+
if (dt == null) {
|
|
123
177
|
return null;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
178
|
+
}
|
|
179
|
+
switch (dtNumberFormat) {
|
|
180
|
+
case DateTimeNumberFormat.UnixTimeMilliseconds:
|
|
181
|
+
return dt.toMillis();
|
|
182
|
+
case DateTimeNumberFormat.UnixTimeSeconds:
|
|
183
|
+
return dt.toSeconds();
|
|
184
|
+
case DateTimeNumberFormat.OADate: {
|
|
185
|
+
const oaEpochMs = Date.UTC(1899, 11, 30, 0, 0, 0, 0);
|
|
186
|
+
return (dt.toMillis() - oaEpochMs) / 864e5;
|
|
132
187
|
}
|
|
133
188
|
}
|
|
134
189
|
}
|
|
135
|
-
|
|
136
|
-
|
|
190
|
+
__name(getDateTimeNumber, "getDateTimeNumber");
|
|
191
|
+
function toDateTime(source, options = defaultToDateTimeOptions) {
|
|
192
|
+
if (source == null) {
|
|
137
193
|
return null;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
194
|
+
}
|
|
195
|
+
options = { ...defaultToDateTimeOptions, ...options };
|
|
196
|
+
if (!options.precision) {
|
|
197
|
+
options.precision = DateTimePrecision.Auto;
|
|
198
|
+
}
|
|
199
|
+
if (DateTime.isDateTime(source)) {
|
|
200
|
+
return extend(source, options.precision);
|
|
201
|
+
}
|
|
202
|
+
if (typeof source === "string") {
|
|
203
|
+
return getDateTimeFromString(
|
|
204
|
+
source,
|
|
205
|
+
options.stringFormat,
|
|
206
|
+
options.precision,
|
|
207
|
+
options.stringInterpretAs
|
|
146
208
|
);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
209
|
+
}
|
|
210
|
+
if (typeof source === "number") {
|
|
211
|
+
return getDateTimeFromNumber(
|
|
212
|
+
source,
|
|
213
|
+
options.numberFormat,
|
|
214
|
+
options.numberInterpretAs,
|
|
215
|
+
options.precision
|
|
153
216
|
);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
217
|
+
}
|
|
218
|
+
if (source instanceof Date) {
|
|
219
|
+
const dt = options.dateInterpretAs === DateTimeKind.Utc ? DateTime.fromJSDate(source).toUTC() : DateTime.fromJSDate(source);
|
|
220
|
+
return extend(dt, options.precision);
|
|
157
221
|
}
|
|
158
222
|
throw new Error("Unsupported DateTime source");
|
|
159
223
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
224
|
+
__name(toDateTime, "toDateTime");
|
|
225
|
+
const commonLocalDateTimeTransport = {
|
|
226
|
+
serialize: /* @__PURE__ */ __name((dt) => {
|
|
227
|
+
if (dt == null) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return dt.exportToString(DateTimeKind.Local, DateTimeKind.Local);
|
|
231
|
+
}, "serialize"),
|
|
232
|
+
deserialize: /* @__PURE__ */ __name((v) => {
|
|
233
|
+
return toDateTime(v, {
|
|
234
|
+
stringFormat: void 0,
|
|
235
|
+
stringInterpretAs: DateTimeStringInterpretation.Local,
|
|
236
|
+
numberFormat: DateTimeNumberFormat.UnixTimeSeconds,
|
|
237
|
+
numberInterpretAs: DateTimeKind.Local,
|
|
238
|
+
dateInterpretAs: DateTimeKind.Local,
|
|
239
|
+
precision: DateTimePrecision.Auto
|
|
240
|
+
});
|
|
241
|
+
}, "deserialize")
|
|
242
|
+
};
|
|
243
|
+
const utcDateTimeTransport = {
|
|
244
|
+
serialize: /* @__PURE__ */ __name((dt) => {
|
|
245
|
+
if (dt == null) {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
return dt.exportToString(DateTimeKind.Utc, DateTimeKind.Utc);
|
|
249
|
+
}, "serialize"),
|
|
250
|
+
deserialize: /* @__PURE__ */ __name((v) => {
|
|
251
|
+
return toDateTime(v, {
|
|
252
|
+
stringFormat: void 0,
|
|
253
|
+
stringInterpretAs: DateTimeStringInterpretation.Utc,
|
|
254
|
+
numberFormat: DateTimeNumberFormat.UnixTimeSeconds,
|
|
255
|
+
numberInterpretAs: DateTimeKind.Utc,
|
|
256
|
+
dateInterpretAs: DateTimeKind.Utc,
|
|
257
|
+
precision: DateTimePrecision.Auto
|
|
258
|
+
});
|
|
259
|
+
}, "deserialize")
|
|
260
|
+
};
|
|
261
|
+
const dateTimeTransports = {
|
|
262
|
+
commonLocal: commonLocalDateTimeTransport,
|
|
263
|
+
utc: utcDateTimeTransport
|
|
183
264
|
};
|
|
184
265
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
266
|
+
DateTimeExportInterpretation,
|
|
267
|
+
DateTimeKind,
|
|
268
|
+
DateTimeNumberFormat,
|
|
269
|
+
DateTimePrecision,
|
|
270
|
+
DateTimeStringInterpretation,
|
|
271
|
+
dateTimeTransports,
|
|
272
|
+
defaultToDateTimeOptions,
|
|
273
|
+
getDateTimeFromNumber,
|
|
274
|
+
getDateTimeFromString,
|
|
275
|
+
getDateTimeNumber,
|
|
276
|
+
isDateTimeExtended,
|
|
277
|
+
toDateTime
|
|
197
278
|
};
|
|
198
279
|
//# sourceMappingURL=dateTimeDataFormat.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeDataFormat.es.js","sources":["D:/Src/my/actdim/public/utico/src/dateTimeDataFormat.ts"],"sourcesContent":null,"names":["DateTimeNumberFormat","DateTimePrecision","DateTimeKind","DateTimeStringInterpretation","DateTimeExportInterpretation","$isDateTimeExtended","isDateTimeExtended","obj","truncateToPrecision","dt","precision","extend","isExtended","extended","formatOrKind","interpretAs","options","sourceForInterpretation","interpreted","format","s11nFormat","inferPrecisionFromFormat","defaultToDateTimeOptions","getDateTimeFromString","value","DateTime","getDateTimeFromNumber","dtNumberFormat","days","ms","jsDate","oaEpochMs","getDateTimeNumber","toDateTime","source","commonLocalDateTimeTransport","v","utcDateTimeTransport","dateTimeTransports"],"mappings":";AAIO,MAAMA,IAAuB;AAAA,EAChC,sBAAsB;AAAA,EACtB,iBAAiB;AAAA;AAAA,EAEjB,QAAQ;AACZ,GAIaC,IAAoB;AAAA,EAC7B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AACjB,GAIaC,IAAe;AAAA,EACxB,OAAO;AAAA,EACP,KAAK;AACT,GAKaC,IAA+B;AAAA,EACxC,MAAM;AAAA,EACN,OAAO;AAAA;AAAA,EACP,KAAK;AAAA;AACT,GAIaC,IAA+B;AAAA,EACxC,UAAU;AAAA,EACV,OAAO;AAAA;AAAA,EACP,KAAK;AAAA;AAAA,EACL,OAAO;AACX,GAIMC,IAAsB,OAAO,oBAAoB;AAWhD,SAASC,EAAmBC,GAAuC;AACtE,SAAQA,EAA2CF,CAAmB,KAAK;AAC/E;AAEA,SAASG,EAAoBC,GAAcC,GAAwC;AAC/E,UAAQA,GAAA;AAAA,IACJ,KAAKT,EAAkB;AACnB,aAAOQ,EAAG,QAAQ,KAAK;AAAA,IAC3B,KAAKR,EAAkB;AACnB,aAAOQ,EAAG,QAAQ,QAAQ;AAAA,IAC9B,KAAKR,EAAkB;AACnB,aAAOQ,EAAG,QAAQ,QAAQ;AAAA,IAC9B,KAAKR,EAAkB;AAAA,IACvB,KAAKA,EAAkB;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A,IAChD,cAAcH,EAAqB;AAAA,IACnC,mBAAmBE,EAAa;AAAA,IAChC,iBAAiBA,EAAa;AAAA,IAC9B,WAAWD,EAAkB;AAAA,EAAA,CAChC;AAET,GAEaqC,IAAqB;AAAA,EAC9B,aAAaH;AAAA,EACb,KAAKE;AACT;"}
|
|
1
|
+
{"version":3,"file":"dateTimeDataFormat.es.js","sources":["D:/Src/my/actdim/public/utico/src/dateTimeDataFormat.ts"],"sourcesContent":["import { DateTime, type LocaleOptions } from \"luxon\";\r\n\r\n// TODO: support tc39/proposal-temporal\r\n\r\nexport const DateTimeNumberFormat = {\r\n UnixTimeMilliseconds: \"unixTimeMilliseconds\",\r\n UnixTimeSeconds: \"unixTimeSeconds\",\r\n /** OLE Automation Date */\r\n OADate: \"oaDate\"\r\n} as const;\r\n\r\nexport type DateTimeNumberFormat = (typeof DateTimeNumberFormat)[keyof typeof DateTimeNumberFormat];\r\n\r\nexport const DateTimePrecision = {\r\n Auto: \"auto\",\r\n Date: \"date\",\r\n Minute: \"minute\",\r\n Second: \"second\",\r\n Millisecond: \"millisecond\"\r\n} as const;\r\n\r\nexport type DateTimePrecision = (typeof DateTimePrecision)[keyof typeof DateTimePrecision];\r\n\r\nexport const DateTimeKind = {\r\n Local: \"local\",\r\n Utc: \"utc\"\r\n} as const;\r\n\r\nexport type DateTimeKind = (typeof DateTimeKind)[keyof typeof DateTimeKind];\r\n\r\n// DateTimeImportInterpretation\r\nexport const DateTimeStringInterpretation = {\r\n Auto: \"auto\",\r\n Local: \"local\", // wall-clock, naive\r\n Utc: \"utc\" // universal, instant, absolute\r\n} as const;\r\n\r\nexport type DateTimeStringInterpretation = (typeof DateTimeStringInterpretation)[keyof typeof DateTimeStringInterpretation];\r\n\r\nexport const DateTimeExportInterpretation = {\r\n Original: \"original\",\r\n Local: \"local\", // wall-clock, naive\r\n Utc: \"utc\", // universal, instant, absolute\r\n Match: \"match\"\r\n} as const;\r\n\r\nexport type DateTimeExportInterpretation = (typeof DateTimeExportInterpretation)[keyof typeof DateTimeExportInterpretation];\r\n\r\nconst $isDateTimeExtended = Symbol(\"isDateTimeExtended\");\r\nexport type DateTimeExtended = DateTime & {\r\n [$isDateTimeExtended]: true;\r\n precision: DateTimePrecision;\r\n exportToString: (\r\n formatOrKind?: string | DateTimeKind,\r\n interpretAs?: DateTimeExportInterpretation,\r\n options?: LocaleOptions\r\n ) => string;\r\n};\r\n\r\nexport function isDateTimeExtended(obj: unknown): obj is DateTimeExtended {\r\n return (obj as { [$isDateTimeExtended]: unknown })[$isDateTimeExtended] == true;\r\n}\r\n\r\nfunction truncateToPrecision(dt: DateTime, precision: DateTimePrecision): DateTime {\r\n switch (precision) {\r\n case DateTimePrecision.Date:\r\n return dt.startOf(\"day\");\r\n case DateTimePrecision.Minute:\r\n return dt.startOf(\"minute\");\r\n case DateTimePrecision.Second:\r\n return dt.startOf(\"second\");\r\n case DateTimePrecision.Auto:\r\n case DateTimePrecision.Millisecond:\r\n default:\r\n return dt;\r\n }\r\n}\r\n\r\nfunction extend(dt: DateTime | DateTimeExtended, precision: DateTimePrecision = DateTimePrecision.Auto): DateTimeExtended {\r\n const isExtended = isDateTimeExtended(dt);\r\n if (isExtended) {\r\n if (precision === DateTimePrecision.Auto) {\r\n precision = dt.precision;\r\n }\r\n } else {\r\n if (precision === DateTimePrecision.Auto) {\r\n precision = DateTimePrecision.Millisecond;\r\n }\r\n }\r\n const extended = truncateToPrecision(dt, precision) as DateTimeExtended;\r\n if (!isExtended) {\r\n extended[$isDateTimeExtended] = true;\r\n extended.exportToString = (\r\n formatOrKind: string | DateTimeKind = DateTimeKind.Utc,\r\n interpretAs: DateTimeExportInterpretation = DateTimeExportInterpretation.Original,\r\n options?: LocaleOptions\r\n ): string => {\r\n // For date-only values keep calendar date stable; for datetime values\r\n // reinterpret from UTC to avoid browser zone surprises.\r\n const sourceForInterpretation = extended.precision === DateTimePrecision.Date\r\n ? extended\r\n : extended.toUTC();\r\n let interpreted = sourceForInterpretation as DateTime;\r\n if (interpretAs === DateTimeExportInterpretation.Local) {\r\n interpreted = sourceForInterpretation.setZone(\"local\", { keepLocalTime: true });\r\n } else if (interpretAs === DateTimeExportInterpretation.Utc) {\r\n interpreted = sourceForInterpretation.setZone(\"utc\", { keepLocalTime: true });\r\n } else if (interpretAs === DateTimeExportInterpretation.Match) {\r\n if (formatOrKind === DateTimeKind.Local) {\r\n interpreted = sourceForInterpretation.setZone(\"local\", { keepLocalTime: true });\r\n } else if (formatOrKind === DateTimeKind.Utc) {\r\n interpreted = sourceForInterpretation.setZone(\"utc\", { keepLocalTime: true });\r\n }\r\n }\r\n if (formatOrKind === DateTimeKind.Local) {\r\n const format = extended.precision === DateTimePrecision.Date\r\n ? s11nFormat.localDate\r\n : s11nFormat.localDateTime;\r\n return interpreted.setZone(\"local\").toFormat(format, options);\r\n }\r\n if (formatOrKind === DateTimeKind.Utc) {\r\n const format = extended.precision === DateTimePrecision.Date\r\n ? s11nFormat.utcDate\r\n : s11nFormat.utcDateTime;\r\n return interpreted.setZone(\"utc\").toFormat(format, options);\r\n }\r\n return interpreted.toFormat(formatOrKind, options);\r\n };\r\n }\r\n extended.precision = precision;\r\n return extended;\r\n}\r\n\r\nfunction inferPrecisionFromFormat(format?: string): DateTimePrecision | undefined {\r\n if (!format) return undefined;\r\n if (format.includes(\"S\")) return DateTimePrecision.Millisecond;\r\n if (format.includes(\"s\")) return DateTimePrecision.Second;\r\n if (format.includes(\"m\")) return DateTimePrecision.Minute;\r\n return DateTimePrecision.Date;\r\n}\r\n\r\nexport type ToDateTimeOptions = {\r\n stringFormat?: string;\r\n stringInterpretAs?: DateTimeStringInterpretation;\r\n numberFormat?: DateTimeNumberFormat;\r\n numberInterpretAs?: DateTimeKind;\r\n dateInterpretAs?: DateTimeKind;\r\n precision?: DateTimePrecision;\r\n}\r\n\r\nexport const defaultToDateTimeOptions: ToDateTimeOptions = {\r\n /** ISO 8601 (yyyy-MM-dd'T'HH:mm:ss.SSS[Z|±HH:mm] or yyyy-MM-dd'T'HH:mm:ss.SSS) */\r\n stringFormat: undefined,\r\n stringInterpretAs: DateTimeStringInterpretation.Auto,\r\n numberFormat: DateTimeNumberFormat.UnixTimeMilliseconds,\r\n numberInterpretAs: DateTimeKind.Utc,\r\n dateInterpretAs: DateTimeKind.Utc,\r\n precision: DateTimePrecision.Auto\r\n};\r\n\r\n// Serialization formats (Luxon tokens).\r\n// Local means \"without offset/timezone suffix\" in the resulting string.\r\nconst s11nFormat = {\r\n // ISO local date (without offset), example: 2026-02-24\r\n localDate: \"yyyy-MM-dd\",\r\n // ISO local datetime (without offset), example: 2026-02-24T13:45:30.123\r\n localDateTime: \"yyyy-MM-dd'T'HH:mm:ss.SSS\",\r\n // ISO UTC date (explicit UTC suffix), example: 2026-02-24Z\r\n utcDate: \"yyyy-MM-dd'Z'\",\r\n // ISO UTC datetime (explicit UTC suffix), example: 2026-02-24T13:45:30.123Z\r\n utcDateTime: \"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\",\r\n} as const;\r\n\r\nexport function getDateTimeFromString(\r\n value: string,\r\n format?: string,\r\n precision: DateTimePrecision = DateTimePrecision.Auto,\r\n interpretAs: DateTimeStringInterpretation = DateTimeStringInterpretation.Auto\r\n): DateTimeExtended | null {\r\n if (!value) {\r\n return null;\r\n }\r\n let dt = format\r\n ? DateTime.fromFormat(value, format, { setZone: true })\r\n : DateTime.fromISO(value, { setZone: true });\r\n if (interpretAs === DateTimeStringInterpretation.Local) {\r\n dt = dt.setZone(\"local\", { keepLocalTime: true });\r\n } else if (interpretAs === DateTimeStringInterpretation.Utc) {\r\n dt = dt.setZone(\"utc\", { keepLocalTime: true });\r\n }\r\n if (!dt.isValid) {\r\n throw new Error(\r\n `Assertion. Invalid datetime format: ${value}. Expected format: ${format ?? \"ISO 8601 (yyyy-MM-dd'T'HH:mm:ss.SSS[Z|±HH:mm] or yyyy-MM-dd'T'HH:mm:ss.SSS)\"}.`\r\n );\r\n }\r\n if (precision === DateTimePrecision.Auto) {\r\n precision = inferPrecisionFromFormat(format) ?? DateTimePrecision.Millisecond;\r\n }\r\n return extend(dt, precision);\r\n}\r\n\r\nexport function getDateTimeFromNumber(\r\n value: number,\r\n dtNumberFormat: DateTimeNumberFormat = DateTimeNumberFormat.UnixTimeMilliseconds,\r\n interpretAs: DateTimeKind = DateTimeKind.Utc,\r\n precision: DateTimePrecision = DateTimePrecision.Millisecond\r\n): DateTimeExtended | null {\r\n if (value == null) {\r\n return null;\r\n }\r\n let dt: DateTime;\r\n switch (dtNumberFormat) {\r\n case DateTimeNumberFormat.UnixTimeMilliseconds:\r\n dt = interpretAs === \"local\"\r\n ? DateTime.fromMillis(value)\r\n : DateTime.fromMillis(value, { zone: \"utc\" });\r\n break;\r\n case DateTimeNumberFormat.UnixTimeSeconds:\r\n dt = interpretAs === \"local\"\r\n ? DateTime.fromSeconds(value)\r\n : DateTime.fromSeconds(value, { zone: \"utc\" });\r\n break;\r\n case DateTimeNumberFormat.OADate: {\r\n if (interpretAs === \"local\") {\r\n const days = Math.floor(value);\r\n const ms = Math.abs((value - days) * 8.64e7);\r\n const jsDate = new Date(1899, 11, 30 + days, 0, 0, 0, ms);\r\n dt = DateTime.fromJSDate(jsDate);\r\n break;\r\n }\r\n const oaEpochMs = Date.UTC(1899, 11, 30, 0, 0, 0, 0);\r\n dt = DateTime.fromMillis(oaEpochMs + value * 8.64e7, { zone: \"utc\" });\r\n break;\r\n }\r\n }\r\n return extend(dt, precision);\r\n}\r\n\r\nexport function getDateTimeNumber(\r\n dt: DateTime | DateTimeExtended,\r\n dtNumberFormat: DateTimeNumberFormat = DateTimeNumberFormat.UnixTimeSeconds\r\n): number | null {\r\n if (dt == null) {\r\n return null;\r\n }\r\n switch (dtNumberFormat) {\r\n case DateTimeNumberFormat.UnixTimeMilliseconds:\r\n return dt.toMillis();\r\n case DateTimeNumberFormat.UnixTimeSeconds:\r\n return dt.toSeconds();\r\n case DateTimeNumberFormat.OADate: {\r\n const oaEpochMs = Date.UTC(1899, 11, 30, 0, 0, 0, 0);\r\n return (dt.toMillis() - oaEpochMs) / 8.64e7;\r\n }\r\n }\r\n}\r\n\r\n// getDateTime\r\nexport function toDateTime(\r\n source: string | number | Date | DateTime | DateTimeExtended | null | undefined,\r\n options = defaultToDateTimeOptions\r\n): DateTimeExtended | null {\r\n if (source == null) {\r\n return null;\r\n }\r\n options = { ...defaultToDateTimeOptions, ...options };\r\n if (!options.precision) {\r\n options.precision = DateTimePrecision.Auto;\r\n }\r\n if (DateTime.isDateTime(source)) {\r\n return extend(source, options.precision);\r\n }\r\n if (typeof source === \"string\") {\r\n return getDateTimeFromString(\r\n source,\r\n options.stringFormat,\r\n options.precision,\r\n options.stringInterpretAs\r\n );\r\n }\r\n if (typeof source === \"number\") {\r\n return getDateTimeFromNumber(\r\n source,\r\n options.numberFormat,\r\n options.numberInterpretAs,\r\n options.precision\r\n );\r\n }\r\n if (source instanceof Date) {\r\n const dt = options.dateInterpretAs === DateTimeKind.Utc\r\n ? DateTime.fromJSDate(source).toUTC()\r\n : DateTime.fromJSDate(source);\r\n return extend(dt, options.precision);\r\n }\r\n throw new Error(\"Unsupported DateTime source\");\r\n}\r\n\r\nexport type DateTimeTransport = {\r\n serialize: (dt: DateTimeExtended | null | undefined) => string | null;\r\n deserialize: (value: string | number | null | undefined) => DateTimeExtended | null;\r\n};\r\n\r\nconst commonLocalDateTimeTransport: DateTimeTransport = {\r\n serialize: (dt) => {\r\n if (dt == null) {\r\n return null;\r\n }\r\n return dt.exportToString(DateTimeKind.Local, DateTimeKind.Local);\r\n },\r\n deserialize: (v) => {\r\n return toDateTime(v, {\r\n stringFormat: undefined,\r\n stringInterpretAs: DateTimeStringInterpretation.Local,\r\n numberFormat: DateTimeNumberFormat.UnixTimeSeconds,\r\n numberInterpretAs: DateTimeKind.Local,\r\n dateInterpretAs: DateTimeKind.Local,\r\n precision: DateTimePrecision.Auto\r\n });\r\n }\r\n};\r\n\r\nconst utcDateTimeTransport: DateTimeTransport = {\r\n serialize: (dt) => {\r\n if (dt == null) {\r\n return null;\r\n }\r\n return dt.exportToString(DateTimeKind.Utc, DateTimeKind.Utc);\r\n },\r\n deserialize: (v) => {\r\n return toDateTime(v, {\r\n stringFormat: undefined,\r\n stringInterpretAs: DateTimeStringInterpretation.Utc,\r\n numberFormat: DateTimeNumberFormat.UnixTimeSeconds,\r\n numberInterpretAs: DateTimeKind.Utc,\r\n dateInterpretAs: DateTimeKind.Utc,\r\n precision: DateTimePrecision.Auto\r\n });\r\n }\r\n};\r\n\r\nexport const dateTimeTransports = {\r\n commonLocal: commonLocalDateTimeTransport,\r\n utc: utcDateTimeTransport\r\n}"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB;AAAA,EAChC,sBAAsB;AAAA,EACtB,iBAAiB;AAAA;AAAA,EAEjB,QAAQ;AACZ;AAIO,MAAM,oBAAoB;AAAA,EAC7B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AACjB;AAIO,MAAM,eAAe;AAAA,EACxB,OAAO;AAAA,EACP,KAAK;AACT;AAKO,MAAM,+BAA+B;AAAA,EACxC,MAAM;AAAA,EACN,OAAO;AAAA;AAAA,EACP,KAAK;AAAA;AACT;AAIO,MAAM,+BAA+B;AAAA,EACxC,UAAU;AAAA,EACV,OAAO;AAAA;AAAA,EACP,KAAK;AAAA;AAAA,EACL,OAAO;AACX;AAIA,MAAM,sBAAsB,OAAO,oBAAoB;AAWhD,SAAS,mBAAmB,KAAuC;AACtE,SAAQ,IAA2C,mBAAmB,KAAK;AAC/E;AAFgB;AAIhB,SAAS,oBAAoB,IAAc,WAAwC;AAC/E,UAAQ,WAAA;AAAA,IACJ,KAAK,kBAAkB;AACnB,aAAO,GAAG,QAAQ,KAAK;AAAA,IAC3B,KAAK,kBAAkB;AACnB,aAAO,GAAG,QAAQ,QAAQ;AAAA,IAC9B,KAAK,kBAAkB;AACnB,aAAO,GAAG,QAAQ,QAAQ;AAAA,IAC9B,KA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G;AAAA,MACjB,cAAc;AAAA,MACd,mBAAmB,6BAA6B;AAAA,MAChD,cAAc,qBAAqB;AAAA,MACnC,mBAAmB,aAAa;AAAA,MAChC,iBAAiB,aAAa;AAAA,MAC9B,WAAW,kBAAkB;AAAA,IAAA,CAChC;AAAA,EACL,GATa;AAUjB;AAEA,MAAM,uBAA0C;AAAA,EAC5C,WAAW,wBAAC,OAAO;AACf,QAAI,MAAM,MAAM;AACZ,aAAO;AAAA,IACX;AACA,WAAO,GAAG,eAAe,aAAa,KAAK,aAAa,GAAG;AAAA,EAC/D,GALW;AAAA,EAMX,aAAa,wBAAC,MAAM;AAChB,WAAO,WAAW,GAAG;AAAA,MACjB,cAAc;AAAA,MACd,mBAAmB,6BAA6B;AAAA,MAChD,cAAc,qBAAqB;AAAA,MACnC,mBAAmB,aAAa;AAAA,MAChC,iBAAiB,aAAa;AAAA,MAC9B,WAAW,kBAAkB;AAAA,IAAA,CAChC;AAAA,EACL,GATa;AAUjB;AAEO,MAAM,qBAAqB;AAAA,EAC9B,aAAa;AAAA,EACb,KAAK;AACT;"}
|
package/dist/decorators.es.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
function nonEnumerable(target, propertyKey) {
|
|
4
|
+
Object.defineProperty(target, propertyKey, {
|
|
3
5
|
get() {
|
|
6
|
+
return void 0;
|
|
4
7
|
},
|
|
5
|
-
set(
|
|
6
|
-
Object.defineProperty(this,
|
|
7
|
-
value
|
|
8
|
-
writable:
|
|
9
|
-
enumerable:
|
|
10
|
-
configurable:
|
|
8
|
+
set(value) {
|
|
9
|
+
Object.defineProperty(this, propertyKey, {
|
|
10
|
+
value,
|
|
11
|
+
writable: true,
|
|
12
|
+
enumerable: false,
|
|
13
|
+
configurable: true
|
|
11
14
|
});
|
|
12
15
|
},
|
|
13
|
-
enumerable:
|
|
14
|
-
configurable:
|
|
16
|
+
enumerable: false,
|
|
17
|
+
configurable: true
|
|
15
18
|
});
|
|
16
19
|
}
|
|
20
|
+
__name(nonEnumerable, "nonEnumerable");
|
|
17
21
|
export {
|
|
18
|
-
|
|
22
|
+
nonEnumerable
|
|
19
23
|
};
|
|
20
24
|
//# sourceMappingURL=decorators.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.es.js","sources":["D:/Src/my/actdim/public/utico/src/decorators.ts"],"sourcesContent":
|
|
1
|
+
{"version":3,"file":"decorators.es.js","sources":["D:/Src/my/actdim/public/utico/src/decorators.ts"],"sourcesContent":["export function nonEnumerable(target: any, propertyKey: string | symbol) {\r\n\r\n Object.defineProperty(target, propertyKey, {\r\n get() {\r\n return undefined;\r\n },\r\n set(value: any) {\r\n Object.defineProperty(this, propertyKey, {\r\n value,\r\n writable: true,\r\n enumerable: false,\r\n configurable: true\r\n });\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n}\r\n"],"names":[],"mappings":";;AAAO,SAAS,cAAc,QAAa,aAA8B;AAErE,SAAO,eAAe,QAAQ,aAAa;AAAA,IACvC,MAAM;AACF,aAAO;AAAA,IACX;AAAA,IACA,IAAI,OAAY;AACZ,aAAO,eAAe,MAAM,aAAa;AAAA,QACrC;AAAA,QACA,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,cAAc;AAAA,MAAA,CACjB;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,cAAc;AAAA,EAAA,CACjB;AACL;AAjBgB;"}
|