@actdim/utico 1.1.5 → 1.1.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 +126 -100
- package/dist/arrayExtensions.es.js +29 -29
- package/dist/arrayExtensions.es.js.map +1 -1
- package/dist/asyncMutex.d.ts +1 -0
- package/dist/asyncMutex.d.ts.map +1 -1
- package/dist/asyncMutex.es.js +10 -8
- package/dist/asyncMutex.es.js.map +1 -1
- package/dist/dataFormats.d.ts +6 -1
- package/dist/dataFormats.d.ts.map +1 -1
- package/dist/dataFormats.es.js +6 -4
- package/dist/dataFormats.es.js.map +1 -1
- package/dist/dateTimeDataFormat.d.ts +62 -26
- package/dist/dateTimeDataFormat.d.ts.map +1 -1
- package/dist/dateTimeDataFormat.es.js +184 -77
- package/dist/dateTimeDataFormat.es.js.map +1 -1
- package/dist/gfx/color.d.ts +9 -4
- package/dist/gfx/color.d.ts.map +1 -1
- package/dist/gfx/color.es.js +39 -35
- package/dist/gfx/color.es.js.map +1 -1
- package/dist/i18n/cultures.d.ts +36 -8
- package/dist/i18n/cultures.d.ts.map +1 -1
- package/dist/i18n/cultures.es.js +8 -6
- package/dist/i18n/cultures.es.js.map +1 -1
- package/dist/i18n/enUsCulture.d.ts +4 -4
- package/dist/i18n/enUsCulture.es.js +4 -4
- package/dist/i18n/euCulture.d.ts +30 -0
- package/dist/i18n/euCulture.d.ts.map +1 -0
- package/dist/i18n/euCulture.es.js +32 -0
- package/dist/i18n/euCulture.es.js.map +1 -0
- package/dist/i18n/invariantCulture.d.ts +30 -0
- package/dist/i18n/invariantCulture.d.ts.map +1 -0
- package/dist/i18n/invariantCulture.es.js +32 -0
- package/dist/i18n/invariantCulture.es.js.map +1 -0
- package/dist/typeCore.d.ts +1 -1
- package/dist/typeCore.d.ts.map +1 -1
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
A modern foundation toolkit for complex TypeScript apps.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@actdim/utico)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
5
9
|
## Table of Contents
|
|
6
10
|
|
|
7
11
|
- [Installation](#installation)
|
|
@@ -21,6 +25,18 @@ A modern foundation toolkit for complex TypeScript apps.
|
|
|
21
25
|
|
|
22
26
|
---
|
|
23
27
|
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
Try @actdim/utico instantly in your browser without any installation:
|
|
31
|
+
|
|
32
|
+
[](https://stackblitz.com/~/github.com/actdim/utico)
|
|
33
|
+
|
|
34
|
+
Once the project loads, run the tests to see it in action:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm run test
|
|
38
|
+
```
|
|
39
|
+
|
|
24
40
|
## Installation
|
|
25
41
|
|
|
26
42
|
```bash
|
|
@@ -573,106 +589,116 @@ user.passwordHash // => 'abc123' — still directly accessible
|
|
|
573
589
|
|
|
574
590
|
---
|
|
575
591
|
|
|
576
|
-
### dateTimeDataFormat — Date/Time Serialisation
|
|
577
|
-
|
|
578
|
-
**Import:** `@actdim/utico/dateTimeDataFormat`
|
|
579
|
-
|
|
580
|
-
**Peer dependency:** `luxon ^3`
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
| `
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
|
594
|
-
|
|
595
|
-
| `
|
|
596
|
-
| `
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
| `
|
|
604
|
-
| `
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
|
613
|
-
|
|
614
|
-
| `
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
//
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
//
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
//
|
|
661
|
-
//
|
|
662
|
-
|
|
663
|
-
//
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
592
|
+
### dateTimeDataFormat — Date/Time Serialisation
|
|
593
|
+
|
|
594
|
+
**Import:** `@actdim/utico/dateTimeDataFormat`
|
|
595
|
+
|
|
596
|
+
**Peer dependency:** `luxon ^3`
|
|
597
|
+
|
|
598
|
+
Date/time conversion utilities built on [Luxon](https://moment.github.io/luxon/).
|
|
599
|
+
The module converts values from string/number/`Date`/`DateTime`, tracks precision, and exports values either as local ISO (without suffix) or UTC ISO (`Z` suffix).
|
|
600
|
+
|
|
601
|
+
#### Core Types
|
|
602
|
+
|
|
603
|
+
| Type | Description |
|
|
604
|
+
|------|-------------|
|
|
605
|
+
| `DateTimeNumberFormat` | Numeric input/output format: Unix ms, Unix seconds, OADate |
|
|
606
|
+
| `DateTimePrecision` | `auto \| date \| minute \| second \| millisecond` |
|
|
607
|
+
| `DateTimeKind` | `local \| utc` |
|
|
608
|
+
| `DateTimeStringInterpretation` | `auto \| local \| utc` for parsing strings |
|
|
609
|
+
| `DateTimeExportInterpretation` | `original \| local \| utc \| match` for `exportToString` |
|
|
610
|
+
| `DateTimeExtended` | Luxon `DateTime` with extra fields: `precision`, `exportToString(...)` |
|
|
611
|
+
| `ToDateTimeOptions` | Options for `toDateTime(...)` |
|
|
612
|
+
| `DateTimeTransport` | `{ serialize(...), deserialize(...) }` pair for wire transport |
|
|
613
|
+
|
|
614
|
+
#### `DateTimeNumberFormat`
|
|
615
|
+
|
|
616
|
+
| Member | Description |
|
|
617
|
+
|--------|-------------|
|
|
618
|
+
| `UnixTimeMilliseconds` | Default — milliseconds since Unix epoch |
|
|
619
|
+
| `UnixTimeSeconds` | Seconds since Unix epoch |
|
|
620
|
+
| `OADate` | Microsoft OLE Automation date (fractional days since 1899-12-30) |
|
|
621
|
+
|
|
622
|
+
#### Functions
|
|
623
|
+
|
|
624
|
+
| Function | Description |
|
|
625
|
+
|----------|-------------|
|
|
626
|
+
| `toDateTime(source, options?)` | Converts `string \| number \| Date \| DateTime` to `DateTimeExtended` |
|
|
627
|
+
| `getDateTimeFromString(value, format?, precision?, interpretAs?)` | Parses string using explicit format or ISO |
|
|
628
|
+
| `getDateTimeFromNumber(value, numberFormat?, interpretAs?, precision?)` | Parses number into `DateTimeExtended` |
|
|
629
|
+
| `getDateTimeNumber(dt, numberFormat?)` | Converts `DateTime`/`DateTimeExtended` to number |
|
|
630
|
+
| `isDateTimeExtended(obj)` | Type guard for `DateTimeExtended` |
|
|
631
|
+
|
|
632
|
+
#### Ready-to-use transports
|
|
633
|
+
|
|
634
|
+
| Transport | Serialize | Deserialize |
|
|
635
|
+
|-----------|-----------|-------------|
|
|
636
|
+
| `invariantLocalDateTimeTransport` | local ISO without zone suffix | strings as auto, numbers as local Unix seconds |
|
|
637
|
+
| `utcDateTimeTransport` | UTC ISO with `Z` suffix | strings as auto, numbers as UTC Unix seconds |
|
|
638
|
+
|
|
639
|
+
#### Usage Examples
|
|
640
|
+
|
|
641
|
+
```typescript
|
|
642
|
+
import {
|
|
643
|
+
toDateTime,
|
|
644
|
+
getDateTimeFromString,
|
|
645
|
+
getDateTimeFromNumber,
|
|
646
|
+
getDateTimeNumber,
|
|
647
|
+
DateTimeKind,
|
|
648
|
+
DateTimePrecision,
|
|
649
|
+
DateTimeNumberFormat,
|
|
650
|
+
DateTimeStringInterpretation,
|
|
651
|
+
DateTimeExportInterpretation,
|
|
652
|
+
invariantLocalDateTimeTransport,
|
|
653
|
+
utcDateTimeTransport
|
|
654
|
+
} from '@actdim/utico/dateTimeDataFormat';
|
|
655
|
+
|
|
656
|
+
// Parse from string (ISO auto-detect)
|
|
657
|
+
const a = toDateTime("2024-03-15T10:30:45.123");
|
|
658
|
+
|
|
659
|
+
// Parse from custom string format
|
|
660
|
+
const b = toDateTime("03/15/2024", { stringFormat: "MM/dd/yyyy" });
|
|
661
|
+
|
|
662
|
+
// Parse from number
|
|
663
|
+
const c = getDateTimeFromNumber(1710496245000, DateTimeNumberFormat.UnixTimeMilliseconds);
|
|
664
|
+
|
|
665
|
+
// Parse string and force interpretation as UTC
|
|
666
|
+
const d = getDateTimeFromString(
|
|
667
|
+
"2024-03-15T10:30:45.123",
|
|
668
|
+
undefined,
|
|
669
|
+
DateTimePrecision.Auto,
|
|
670
|
+
DateTimeStringInterpretation.Utc
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
// Export as ISO local (without zone suffix)
|
|
674
|
+
a.exportToString(DateTimeKind.Local); // "2024-03-15T..."
|
|
675
|
+
|
|
676
|
+
// Export as ISO UTC (with Z)
|
|
677
|
+
a.exportToString(DateTimeKind.Utc); // "2024-03-15T...Z"
|
|
678
|
+
|
|
679
|
+
// Export with explicit interpretation
|
|
680
|
+
a.exportToString(
|
|
681
|
+
DateTimeKind.Local,
|
|
682
|
+
DateTimeExportInterpretation.Local
|
|
683
|
+
);
|
|
684
|
+
|
|
685
|
+
// Precision truncation
|
|
686
|
+
const minute = getDateTimeFromString(
|
|
687
|
+
"2024-03-15T10:30:45.123",
|
|
688
|
+
"yyyy-MM-dd'T'HH:mm:ss.SSS",
|
|
689
|
+
DateTimePrecision.Minute
|
|
690
|
+
);
|
|
691
|
+
minute.second; // 0
|
|
692
|
+
minute.millisecond; // 0
|
|
693
|
+
|
|
694
|
+
// Number conversion back
|
|
695
|
+
getDateTimeNumber(a, DateTimeNumberFormat.UnixTimeSeconds);
|
|
696
|
+
|
|
697
|
+
// Transport helpers
|
|
698
|
+
invariantLocalDateTimeTransport.serialize(a); // local string
|
|
699
|
+
utcDateTimeTransport.serialize(a); // UTC string with Z
|
|
700
|
+
utcDateTimeTransport.serialize(null); // null
|
|
701
|
+
```
|
|
676
702
|
|
|
677
703
|
---
|
|
678
704
|
|
|
@@ -6,28 +6,28 @@ class o {
|
|
|
6
6
|
return -o.asc(t, r);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
Array.prototype.unfold = function(
|
|
10
|
-
return this.reduce((t, r) => (Array.prototype.push.apply(t,
|
|
9
|
+
Array.prototype.unfold = function(n) {
|
|
10
|
+
return this.reduce((t, r) => (Array.prototype.push.apply(t, n(r)), t), []);
|
|
11
11
|
};
|
|
12
|
-
Array.prototype.max = function(
|
|
13
|
-
return this.length == 0 ? t : this.map(
|
|
12
|
+
Array.prototype.max = function(n, t) {
|
|
13
|
+
return this.length == 0 ? t : this.map(n).sort(o.desc)[0];
|
|
14
14
|
};
|
|
15
|
-
Array.prototype.min = function(
|
|
16
|
-
return this.length == 0 ? t : this.map(
|
|
15
|
+
Array.prototype.min = function(n, t) {
|
|
16
|
+
return this.length == 0 ? t : this.map(n).sort(o.asc)[0];
|
|
17
17
|
};
|
|
18
|
-
Array.prototype.orderBy = function(
|
|
19
|
-
return this.slice(0).sort((t, r) => o.asc(
|
|
18
|
+
Array.prototype.orderBy = function(n) {
|
|
19
|
+
return this.slice(0).sort((t, r) => o.asc(n(t), n(r)));
|
|
20
20
|
};
|
|
21
|
-
Array.prototype.orderByDesc = function(
|
|
22
|
-
return this.slice(0).sort((t, r) => o.desc(
|
|
21
|
+
Array.prototype.orderByDesc = function(n) {
|
|
22
|
+
return this.slice(0).sort((t, r) => o.desc(n(t), n(r)));
|
|
23
23
|
};
|
|
24
|
-
Array.prototype.groupBy = function(
|
|
24
|
+
Array.prototype.groupBy = function(n) {
|
|
25
25
|
return this.reduce((t, r) => {
|
|
26
|
-
const
|
|
27
|
-
return (t[
|
|
26
|
+
const i = n(r);
|
|
27
|
+
return (t[i] = t[i] || []).push(r), t;
|
|
28
28
|
}, {});
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class c {
|
|
31
31
|
static notNull(t) {
|
|
32
32
|
return t != null;
|
|
33
33
|
}
|
|
@@ -38,30 +38,30 @@ class y {
|
|
|
38
38
|
return t !== "";
|
|
39
39
|
}
|
|
40
40
|
// unique
|
|
41
|
-
static distinct(t, r,
|
|
42
|
-
return
|
|
41
|
+
static distinct(t, r, i) {
|
|
42
|
+
return i.indexOf(t) === r;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
Array.prototype.distinct = function(
|
|
46
|
-
if (!
|
|
47
|
-
return this.filter(
|
|
45
|
+
Array.prototype.distinct = function(n) {
|
|
46
|
+
if (!n)
|
|
47
|
+
return this.filter(c.distinct);
|
|
48
48
|
let t = [];
|
|
49
49
|
return this.filter(function(r) {
|
|
50
|
-
const
|
|
51
|
-
return t.indexOf(
|
|
50
|
+
const i = n(r);
|
|
51
|
+
return t.indexOf(i) >= 0 ? !1 : t.push(i);
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
|
-
Array.prototype.copy = function(
|
|
55
|
-
return
|
|
54
|
+
Array.prototype.copy = function(n, t = 0, r = 0, i) {
|
|
55
|
+
return p(n, this, t, r, i);
|
|
56
56
|
};
|
|
57
|
-
Array.prototype.copyTo = function(
|
|
58
|
-
return
|
|
57
|
+
Array.prototype.copyTo = function(n, t = 0, r = 0, i) {
|
|
58
|
+
return p(this, n, t, r, i);
|
|
59
59
|
};
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
let
|
|
60
|
+
function p(n, t, r = 0, i = 0, e) {
|
|
61
|
+
r < 0 && (r = 0), i < 0 && (i = 0), e == null && (e = Math.min(n.length, n.length - r));
|
|
62
|
+
let s = i;
|
|
63
63
|
for (let u = r; u < e; u++)
|
|
64
|
-
t[
|
|
64
|
+
t[s] = n[u], s++;
|
|
65
65
|
return t;
|
|
66
66
|
}
|
|
67
67
|
//# sourceMappingURL=arrayExtensions.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayExtensions.es.js","sources":["D:/Src/my/actdim/public/utico/src/arrayExtensions.ts"],"sourcesContent":null,"names":["Sorters","a","b","callback","res","element","selector","defaultValue","result","item","value","Filters","index","self","keys","key","src","srcIndex","dstIndex","length","copyArray","dst","j","i"],"mappings":"AAmBA,MAAMA,EAAQ;AAAA,EACV,OAAO,IAAIC,GAAQC,GAAQ;AAEvB,WAAQD,MAAMC,IAAK,IACZD,IAAIC,IAAK,IACN;AAAA,EAWd;AAAA,EAEA,OAAO,KAAKD,GAAQC,GAAQ;AACxB,WAAO,CAACF,EAAQ,IAAIC,GAAGC,CAAC;AAAA,EAE5B;AACJ;AAEA,MAAM,UAAU,SAAS,SAAUC,GAA0C;AACzE,SAAO,KAAK,OAAO,CAACC,GAAKC,OACrB,MAAM,UAAU,KAAK,MAAMD,GAAKD,EAASE,CAAO,CAAC,GAC1CD,IACR,CAAA,CAAE;AACT;AAEA,MAAM,UAAU,MAAM,SAAUE,GAAiCC,GAAyB;AACtF,SAAI,KAAK,UAAU,IACRA,IAEJ,KAAK,IAAID,CAAQ,EAAE,KAAKN,EAAQ,IAAI,EAAE,CAAC;AAMlD;AAEA,MAAM,UAAU,MAAM,SAAUM,GAAiCC,GAAyB;AACtF,SAAI,KAAK,UAAU,IACRA,IA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CAAC;AACL;AAGA,MAAM,UAAU,OAAO,SAAUC,GAAYC,IAAW,GAAGC,IAAW,GAAGC,GAAiB;AACtF,SAAOC,EAAUJ,GAAK,MAAMC,GAAUC,GAAUC,CAAM;AAC1D;AAEA,MAAM,UAAU,SAAS,SAAUE,GAAYJ,IAAW,GAAGC,IAAW,GAAGC,GAAiB;AACxF,SAAOC,EAAU,MAAMC,GAAKJ,GAAUC,GAAUC,CAAM;AAC1D;AAEA,SAASC,EAAUJ,GAAYK,GAAYJ,IAAW,GAAGC,IAAW,GAAGC,GAAiB;AACpF,
|
|
1
|
+
{"version":3,"file":"arrayExtensions.es.js","sources":["D:/Src/my/actdim/public/utico/src/arrayExtensions.ts"],"sourcesContent":null,"names":["Sorters","a","b","callback","res","element","selector","defaultValue","result","item","value","Filters","index","self","keys","key","src","srcIndex","dstIndex","length","copyArray","dst","j","i"],"mappings":"AAmBA,MAAMA,EAAQ;AAAA,EACV,OAAO,IAAIC,GAAQC,GAAQ;AAEvB,WAAQD,MAAMC,IAAK,IACZD,IAAIC,IAAK,IACN;AAAA,EAWd;AAAA,EAEA,OAAO,KAAKD,GAAQC,GAAQ;AACxB,WAAO,CAACF,EAAQ,IAAIC,GAAGC,CAAC;AAAA,EAE5B;AACJ;AAEA,MAAM,UAAU,SAAS,SAAUC,GAA0C;AACzE,SAAO,KAAK,OAAO,CAACC,GAAKC,OACrB,MAAM,UAAU,KAAK,MAAMD,GAAKD,EAASE,CAAO,CAAC,GAC1CD,IACR,CAAA,CAAE;AACT;AAEA,MAAM,UAAU,MAAM,SAAUE,GAAiCC,GAAyB;AACtF,SAAI,KAAK,UAAU,IACRA,IAEJ,KAAK,IAAID,CAAQ,EAAE,KAAKN,EAAQ,IAAI,EAAE,CAAC;AAMlD;AAEA,MAAM,UAAU,MAAM,SAAUM,GAAiCC,GAAyB;AACtF,SAAI,KAAK,UAAU,IACRA,IAEJ,KAAK,IAAID,CAAQ,EAAE,KAAKN,EAAQ,GAAG,EAAE,CAAC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,IAAW,GAAGC,GAAiB;AACtF,SAAOC,EAAUJ,GAAK,MAAMC,GAAUC,GAAUC,CAAM;AAC1D;AAEA,MAAM,UAAU,SAAS,SAAUE,GAAYJ,IAAW,GAAGC,IAAW,GAAGC,GAAiB;AACxF,SAAOC,EAAU,MAAMC,GAAKJ,GAAUC,GAAUC,CAAM;AAC1D;AAEA,SAASC,EAAUJ,GAAYK,GAAYJ,IAAW,GAAGC,IAAW,GAAGC,GAAiB;AACpF,EAAIF,IAAW,MACXA,IAAW,IAEXC,IAAW,MACXA,IAAW,IAEXC,KAAU,SACVA,IAAS,KAAK,IAAIH,EAAI,QAAQA,EAAI,SAASC,CAAQ;AAEvD,MAAIK,IAAIJ;AACR,WAASK,IAAIN,GAAUM,IAAIJ,GAAQI;AAC/B,IAAAF,EAAIC,CAAC,IAAIN,EAAIO,CAAC,GACdD;AAEJ,SAAOD;AACX;"}
|
package/dist/asyncMutex.d.ts
CHANGED
package/dist/asyncMutex.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncMutex.d.ts","sourceRoot":"","sources":["../src/asyncMutex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC,cAAM,UAAU;IACZ,OAAO,CAAC,KAAK,CAAqB;IAElC,OAAO,CAAC,MAAM,CAAS;IAEjB,IAAI,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"asyncMutex.d.ts","sourceRoot":"","sources":["../src/asyncMutex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC,eAAO,IAAI,mBAAmB,QAAW,CAAC;AAE1C,cAAM,UAAU;IACZ,OAAO,CAAC,KAAK,CAAqB;IAElC,OAAO,CAAC,MAAM,CAAS;IAEjB,IAAI,CAAC,SAAS,SAAsB,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;IAgChE,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAaxB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,SAAsB,GAAG,OAAO,CAAC,CAAC,CAAC;CAQlF;AAGD,OAAO,EACH,UAAU,EACb,CAAC"}
|
package/dist/asyncMutex.es.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
let i = 5e3;
|
|
1
2
|
class n {
|
|
2
3
|
// or Mutex
|
|
3
4
|
mutex = Promise.resolve();
|
|
4
5
|
locked = !1;
|
|
5
|
-
async lock(e) {
|
|
6
|
+
async lock(e = i) {
|
|
6
7
|
let t = () => {
|
|
7
8
|
}, s;
|
|
8
|
-
const
|
|
9
|
+
const r = this.mutex;
|
|
9
10
|
this.mutex = this.mutex.then(() => new Promise(t)), this.locked = !0;
|
|
10
|
-
const
|
|
11
|
+
const l = new Promise((o, c) => {
|
|
11
12
|
t = o, e && (s = setTimeout(() => {
|
|
12
|
-
|
|
13
|
+
c(new Error("Mutex lock timeout"));
|
|
13
14
|
}, e));
|
|
14
15
|
});
|
|
15
16
|
try {
|
|
16
|
-
const o = await
|
|
17
|
+
const o = await l;
|
|
17
18
|
return clearTimeout(s), () => {
|
|
18
19
|
this.locked = !1, o();
|
|
19
20
|
};
|
|
20
21
|
} catch (o) {
|
|
21
|
-
throw this.mutex =
|
|
22
|
+
throw this.mutex = r, this.locked = !1, o;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
tryLock() {
|
|
@@ -32,7 +33,7 @@ class n {
|
|
|
32
33
|
this.locked = !1, e();
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
async dispatch(e, t) {
|
|
36
|
+
async dispatch(e, t = i) {
|
|
36
37
|
const s = await this.lock(t);
|
|
37
38
|
try {
|
|
38
39
|
return await e();
|
|
@@ -42,6 +43,7 @@ class n {
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
export {
|
|
45
|
-
n as AsyncMutex
|
|
46
|
+
n as AsyncMutex,
|
|
47
|
+
i as defaultMutexTimeout
|
|
46
48
|
};
|
|
47
49
|
//# sourceMappingURL=asyncMutex.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncMutex.es.js","sources":["D:/Src/my/actdim/public/utico/src/asyncMutex.ts"],"sourcesContent":null,"names":["AsyncMutex","timeoutMs","begin","timer","previous","lockPromise","resolve","reject","unlock","err","promise","res","fn"],"mappings":"
|
|
1
|
+
{"version":3,"file":"asyncMutex.es.js","sources":["D:/Src/my/actdim/public/utico/src/asyncMutex.ts"],"sourcesContent":null,"names":["defaultMutexTimeout","AsyncMutex","timeoutMs","begin","timer","previous","lockPromise","resolve","reject","unlock","err","promise","res","fn"],"mappings":"AAQO,IAAIA,IAAsB;AAEjC,MAAMC,EAAW;AAAA;AAAA,EACL,QAAQ,QAAQ,QAAA;AAAA,EAEhB,SAAS;AAAA,EAEjB,MAAM,KAAKC,IAAYF,GAA0C;AAC7D,QAAIG,IAAsC,MAAM;AAAA,IAAE,GAC9CC;AAEJ,UAAMC,IAAW,KAAK;AACtB,SAAK,QAAQ,KAAK,MAAM,KAAK,MAAM,IAAI,QAAQF,CAAK,CAAC,GACrD,KAAK,SAAS;AAEd,UAAMG,IAAc,IAAI,QAAoB,CAACC,GAASC,MAAW;AAC7D,MAAAL,IAAQI,GAEJL,MACAE,IAAQ,WAAW,MAAM;AACrB,QAAAI,EAAO,IAAI,MAAM,oBAAoB,CAAC;AAAA,MAC1C,GAAGN,CAAS;AAAA,IAEpB,CAAC;AAED,QAAI;AACA,YAAMO,IAAS,MAAMH;AACrB,0BAAaF,CAAK,GACX,MAAM;AACT,aAAK,SAAS,IACdK,EAAA;AAAA,MACJ;AAAA,IACJ,SAASC,GAAK;AACV,iBAAK,QAAQL,GACb,KAAK,SAAS,IACRK;AAAA,IACV;AAAA,EACJ;AAAA,EAEA,UAA+B;AAC3B,QAAI,KAAK,OAAQ,QAAO;AAExB,SAAK,SAAS;AACd,QAAIH;AACJ,UAAMI,IAAU,IAAI,QAAc,CAAAC,MAAO;AAAE,MAAAL,IAAUK;AAAA,IAAK,CAAC;AAC3D,gBAAK,QAAQ,KAAK,MAAM,KAAK,MAAMD,CAAO,GACnC,MAAM;AACT,WAAK,SAAS,IACdJ,EAAA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,MAAM,SAAYM,GAAiBX,IAAYF,GAAiC;AAC5E,UAAMS,IAAS,MAAM,KAAK,KAAKP,CAAS;AACxC,QAAI;AACA,aAAO,MAAMW,EAAA;AAAA,IACjB,UAAA;AACI,MAAAJ,EAAA;AAAA,IACJ;AAAA,EACJ;AACJ;"}
|
package/dist/dataFormats.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
dateTime:
|
|
2
|
+
dateTime: {
|
|
3
|
+
transports: {
|
|
4
|
+
commonLocal: import('./dateTimeDataFormat').DateTimeTransport;
|
|
5
|
+
utc: import('./dateTimeDataFormat').DateTimeTransport;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
3
8
|
};
|
|
4
9
|
export default _default;
|
|
5
10
|
//# sourceMappingURL=dataFormats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataFormats.d.ts","sourceRoot":"","sources":["../src/dataFormats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataFormats.d.ts","sourceRoot":"","sources":["../src/dataFormats.ts"],"names":[],"mappings":";;;;;;;;AAEA,wBAIE"}
|
package/dist/dataFormats.es.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import t from "./dateTimeDataFormat.es.js";
|
|
2
|
-
const
|
|
3
|
-
dateTime:
|
|
1
|
+
import { dateTimeTransports as t } from "./dateTimeDataFormat.es.js";
|
|
2
|
+
const r = {
|
|
3
|
+
dateTime: {
|
|
4
|
+
transports: t
|
|
5
|
+
}
|
|
4
6
|
};
|
|
5
7
|
export {
|
|
6
|
-
|
|
8
|
+
r as default
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=dataFormats.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataFormats.es.js","sources":["D:/Src/my/actdim/public/utico/src/dataFormats.ts"],"sourcesContent":null,"names":["dataFormats","
|
|
1
|
+
{"version":3,"file":"dataFormats.es.js","sources":["D:/Src/my/actdim/public/utico/src/dataFormats.ts"],"sourcesContent":null,"names":["dataFormats","dateTimeTransports"],"mappings":";AAEA,MAAAA,IAAe;AAAA,EACX,UAAU;AAAA,IACN,YAAYC;AAAA,EAAA;AAEpB;"}
|
|
@@ -1,27 +1,63 @@
|
|
|
1
|
-
import { DateTime } from 'luxon';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
export
|
|
16
|
-
export declare
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export
|
|
1
|
+
import { DateTime, LocaleOptions } from 'luxon';
|
|
2
|
+
export declare const DateTimeNumberFormat: {
|
|
3
|
+
readonly UnixTimeMilliseconds: "unixTimeMilliseconds";
|
|
4
|
+
readonly UnixTimeSeconds: "unixTimeSeconds";
|
|
5
|
+
readonly OADate: "oaDate";
|
|
6
|
+
};
|
|
7
|
+
export type DateTimeNumberFormat = (typeof DateTimeNumberFormat)[keyof typeof DateTimeNumberFormat];
|
|
8
|
+
export declare const DateTimePrecision: {
|
|
9
|
+
readonly Auto: "auto";
|
|
10
|
+
readonly Date: "date";
|
|
11
|
+
readonly Minute: "minute";
|
|
12
|
+
readonly Second: "second";
|
|
13
|
+
readonly Millisecond: "millisecond";
|
|
14
|
+
};
|
|
15
|
+
export type DateTimePrecision = (typeof DateTimePrecision)[keyof typeof DateTimePrecision];
|
|
16
|
+
export declare const DateTimeKind: {
|
|
17
|
+
readonly Local: "local";
|
|
18
|
+
readonly Utc: "utc";
|
|
19
|
+
};
|
|
20
|
+
export type DateTimeKind = (typeof DateTimeKind)[keyof typeof DateTimeKind];
|
|
21
|
+
export declare const DateTimeStringInterpretation: {
|
|
22
|
+
readonly Auto: "auto";
|
|
23
|
+
readonly Local: "local";
|
|
24
|
+
readonly Utc: "utc";
|
|
25
|
+
};
|
|
26
|
+
export type DateTimeStringInterpretation = (typeof DateTimeStringInterpretation)[keyof typeof DateTimeStringInterpretation];
|
|
27
|
+
export declare const DateTimeExportInterpretation: {
|
|
28
|
+
readonly Original: "original";
|
|
29
|
+
readonly Local: "local";
|
|
30
|
+
readonly Utc: "utc";
|
|
31
|
+
readonly Match: "match";
|
|
32
|
+
};
|
|
33
|
+
export type DateTimeExportInterpretation = (typeof DateTimeExportInterpretation)[keyof typeof DateTimeExportInterpretation];
|
|
34
|
+
declare const $isDateTimeExtended: unique symbol;
|
|
35
|
+
export type DateTimeExtended = DateTime & {
|
|
36
|
+
[$isDateTimeExtended]: true;
|
|
37
|
+
precision: DateTimePrecision;
|
|
38
|
+
exportToString: (formatOrKind?: string | DateTimeKind, interpretAs?: DateTimeExportInterpretation, options?: LocaleOptions) => string;
|
|
39
|
+
};
|
|
40
|
+
export declare function isDateTimeExtended(obj: unknown): obj is DateTimeExtended;
|
|
41
|
+
export type ToDateTimeOptions = {
|
|
42
|
+
stringFormat?: string;
|
|
43
|
+
stringInterpretAs?: DateTimeStringInterpretation;
|
|
44
|
+
numberFormat?: DateTimeNumberFormat;
|
|
45
|
+
numberInterpretAs?: DateTimeKind;
|
|
46
|
+
dateInterpretAs?: DateTimeKind;
|
|
47
|
+
precision?: DateTimePrecision;
|
|
48
|
+
};
|
|
49
|
+
export declare const defaultToDateTimeOptions: ToDateTimeOptions;
|
|
50
|
+
export declare function getDateTimeFromString(value: string, format?: string, precision?: DateTimePrecision, interpretAs?: DateTimeStringInterpretation): DateTimeExtended | null;
|
|
51
|
+
export declare function getDateTimeFromNumber(value: number, dtNumberFormat?: DateTimeNumberFormat, interpretAs?: DateTimeKind, precision?: DateTimePrecision): DateTimeExtended | null;
|
|
52
|
+
export declare function getDateTimeNumber(dt: DateTime | DateTimeExtended, dtNumberFormat?: DateTimeNumberFormat): number | null;
|
|
53
|
+
export declare function toDateTime(source: string | number | Date | DateTime | DateTimeExtended | null | undefined, options?: ToDateTimeOptions): DateTimeExtended | null;
|
|
54
|
+
export type DateTimeTransport = {
|
|
55
|
+
serialize: (dt: DateTimeExtended | null | undefined) => string | null;
|
|
56
|
+
deserialize: (value: string | number | null | undefined) => DateTimeExtended | null;
|
|
57
|
+
};
|
|
58
|
+
export declare const dateTimeTransports: {
|
|
59
|
+
commonLocal: DateTimeTransport;
|
|
60
|
+
utc: DateTimeTransport;
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
27
63
|
//# sourceMappingURL=dateTimeDataFormat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeDataFormat.d.ts","sourceRoot":"","sources":["../src/dateTimeDataFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"dateTimeDataFormat.d.ts","sourceRoot":"","sources":["../src/dateTimeDataFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAIrD,eAAO,MAAM,oBAAoB;;;;CAKvB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEpG,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,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