@thisisagile/easy 17.31.0 → 17.32.0
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/dist/{chunk-NIWK2A5T.mjs → chunk-2RHBJLH7.mjs} +8 -12
- package/dist/{chunk-NIWK2A5T.mjs.map → chunk-2RHBJLH7.mjs.map} +1 -1
- package/dist/{chunk-OOWOFPDC.mjs → chunk-4TGUPVQN.mjs} +2 -2
- package/dist/{chunk-GQ7XGATB.mjs → chunk-AMBSWR6J.mjs} +7 -9
- package/dist/{chunk-GQ7XGATB.mjs.map → chunk-AMBSWR6J.mjs.map} +1 -1
- package/dist/{chunk-DY33LKDP.mjs → chunk-BZNMKX6O.mjs} +2 -2
- package/dist/{chunk-6RSZTLCP.mjs → chunk-ESECEXXM.mjs} +4 -4
- package/dist/{chunk-PZFHPGDR.mjs → chunk-FCJ4TDW7.mjs} +2 -2
- package/dist/{chunk-6PR3OZQP.mjs → chunk-H7NA23T6.mjs} +3 -3
- package/dist/{chunk-UNU355PL.mjs → chunk-I5VS3NUO.mjs} +5 -5
- package/dist/{chunk-DV7PHOM6.mjs → chunk-JSALAKCR.mjs} +3 -3
- package/dist/{chunk-QSB4QYYE.mjs → chunk-KTK2V5FC.mjs} +2 -2
- package/dist/{chunk-LKBFD66J.mjs → chunk-KX7RRPEZ.mjs} +3 -5
- package/dist/{chunk-LKBFD66J.mjs.map → chunk-KX7RRPEZ.mjs.map} +1 -1
- package/dist/{chunk-5O2BGB5V.mjs → chunk-LAY4XDIL.mjs} +3 -3
- package/dist/{chunk-PIZ7IORV.mjs → chunk-LP2MEIWU.mjs} +2 -2
- package/dist/{chunk-X24AKSPO.mjs → chunk-PCKGK5AF.mjs} +2 -2
- package/dist/{chunk-3BJH75JQ.mjs → chunk-PQTYEEZC.mjs} +2 -2
- package/dist/{chunk-PKA5XEUC.mjs → chunk-R6UXMGTJ.mjs} +3 -3
- package/dist/{chunk-TYH6CVJL.mjs → chunk-RBGF26S7.mjs} +4 -4
- package/dist/{chunk-IYFZMJYO.mjs → chunk-TNPMWL7Y.mjs} +7 -11
- package/dist/{chunk-IYFZMJYO.mjs.map → chunk-TNPMWL7Y.mjs.map} +1 -1
- package/dist/{chunk-GJL7E2EJ.mjs → chunk-TPGAM536.mjs} +4 -4
- package/dist/{chunk-2MNT7B4T.mjs → chunk-UYBPL7PM.mjs} +7 -7
- package/dist/{chunk-HI2JE5PJ.mjs → chunk-XAIZBTVQ.mjs} +2 -2
- package/dist/chunk-ZBS4A3QI.mjs +614 -0
- package/dist/chunk-ZBS4A3QI.mjs.map +1 -0
- package/dist/data/InMemoryGateway.mjs +5 -11
- package/dist/data/InMemoryGateway.mjs.map +1 -1
- package/dist/domain/Audit.mjs +6 -11
- package/dist/domain/Child.mjs +6 -11
- package/dist/domain/Child.mjs.map +1 -1
- package/dist/domain/DateTime.mjs +3 -8
- package/dist/domain/Entity.mjs +11 -16
- package/dist/domain/Entity.mjs.map +1 -1
- package/dist/domain/Repo.mjs +5 -11
- package/dist/domain/Repo.mjs.map +1 -1
- package/dist/domain/Struct.mjs +3 -8
- package/dist/domain/Typo.mjs +4 -10
- package/dist/domain/Typo.mjs.map +1 -1
- package/dist/http/CacheControl.mjs +4 -9
- package/dist/http/CacheControl.mjs.map +1 -1
- package/dist/http/LocalRequestStore.mjs +6 -2
- package/dist/http/LocalRequestStore.mjs.map +1 -1
- package/dist/http/RequestOptions.mjs +6 -4
- package/dist/http/RestResult.mjs +4 -9
- package/dist/http/toResponse.mjs +5 -10
- package/dist/index.js +317 -306
- package/dist/index.js.map +1 -1
- package/dist/process/App.mjs +5 -2
- package/dist/process/App.mjs.map +1 -1
- package/dist/process/Manage.mjs +4 -9
- package/dist/process/Manage.mjs.map +1 -1
- package/dist/process/Scope.mjs +5 -2
- package/dist/process/Search.mjs +4 -9
- package/dist/process/UseCase.mjs +4 -1
- package/dist/process/UseCase.mjs.map +1 -1
- package/dist/resources/Req.mjs +3 -8
- package/dist/resources/Req.mjs.map +1 -1
- package/dist/services/Api.mjs +11 -16
- package/dist/services/ApiGateway.mjs +14 -19
- package/dist/services/AxiosProvider.mjs +10 -15
- package/dist/services/MappedRouteGateway.mjs +15 -20
- package/dist/services/MappedRouteGateway.mjs.map +1 -1
- package/dist/services/RouteGateway.mjs +15 -20
- package/dist/services/ViewRouteGateway.mjs +17 -22
- package/dist/services/ViewRouteGateway.mjs.map +1 -1
- package/dist/sql/Column.mjs +3 -8
- package/dist/sql/Table.mjs +3 -8
- package/dist/sql/Table.mjs.map +1 -1
- package/dist/sql/TableGateway.mjs +4 -9
- package/dist/sql/TableGateway.mjs.map +1 -1
- package/dist/types/CacheAge.mjs +4 -9
- package/dist/types/Case.d.ts +16 -0
- package/dist/types/Case.mjs +2 -7
- package/dist/types/Context.mjs +6 -2
- package/dist/types/Exception.mjs +4 -2
- package/dist/types/Gateway.mjs +4 -3
- package/dist/types/IsEqual.mjs +3 -8
- package/dist/types/Number.mjs +3 -8
- package/dist/types/PageList.mjs +3 -8
- package/dist/types/Parser.mjs +2 -7
- package/dist/types/Parser.mjs.map +1 -1
- package/dist/types/Repository.mjs +4 -3
- package/dist/types/Result.mjs +6 -3
- package/dist/types/Results.mjs +6 -4
- package/dist/types/Template.d.ts +1 -0
- package/dist/types/Template.mjs +6 -1
- package/dist/types/ToText.mjs +6 -1
- package/dist/types/Try.mjs +2 -7
- package/dist/types/Uri.mjs +3 -9
- package/dist/types/Uri.mjs.map +1 -1
- package/dist/utils/Sentence.mjs +6 -1
- package/dist/utils/Sentence.mjs.map +1 -1
- package/dist/utils/View.mjs +5 -10
- package/dist/validation/Contraints.mjs +3 -8
- package/dist/validation/Validate.mjs +2 -7
- package/dist/validation/When.mjs +2 -7
- package/package.json +1 -1
- package/src/types/Case.ts +12 -0
- package/src/types/Template.ts +7 -3
- package/src/types/ToText.ts +1 -1
- package/dist/chunk-6JA2EI2T.mjs +0 -20
- package/dist/chunk-6JA2EI2T.mjs.map +0 -1
- package/dist/chunk-HTHNHACU.mjs +0 -94
- package/dist/chunk-HTHNHACU.mjs.map +0 -1
- package/dist/chunk-MIYBZDW6.mjs +0 -35
- package/dist/chunk-MIYBZDW6.mjs.map +0 -1
- package/dist/chunk-SOUOSMQ6.mjs +0 -165
- package/dist/chunk-SOUOSMQ6.mjs.map +0 -1
- package/dist/chunk-VTEGCABM.mjs +0 -40
- package/dist/chunk-VTEGCABM.mjs.map +0 -1
- package/dist/chunk-WIQKEALP.mjs +0 -324
- package/dist/chunk-WIQKEALP.mjs.map +0 -1
- /package/dist/{chunk-OOWOFPDC.mjs.map → chunk-4TGUPVQN.mjs.map} +0 -0
- /package/dist/{chunk-DY33LKDP.mjs.map → chunk-BZNMKX6O.mjs.map} +0 -0
- /package/dist/{chunk-6RSZTLCP.mjs.map → chunk-ESECEXXM.mjs.map} +0 -0
- /package/dist/{chunk-PZFHPGDR.mjs.map → chunk-FCJ4TDW7.mjs.map} +0 -0
- /package/dist/{chunk-6PR3OZQP.mjs.map → chunk-H7NA23T6.mjs.map} +0 -0
- /package/dist/{chunk-UNU355PL.mjs.map → chunk-I5VS3NUO.mjs.map} +0 -0
- /package/dist/{chunk-DV7PHOM6.mjs.map → chunk-JSALAKCR.mjs.map} +0 -0
- /package/dist/{chunk-QSB4QYYE.mjs.map → chunk-KTK2V5FC.mjs.map} +0 -0
- /package/dist/{chunk-5O2BGB5V.mjs.map → chunk-LAY4XDIL.mjs.map} +0 -0
- /package/dist/{chunk-PIZ7IORV.mjs.map → chunk-LP2MEIWU.mjs.map} +0 -0
- /package/dist/{chunk-X24AKSPO.mjs.map → chunk-PCKGK5AF.mjs.map} +0 -0
- /package/dist/{chunk-3BJH75JQ.mjs.map → chunk-PQTYEEZC.mjs.map} +0 -0
- /package/dist/{chunk-PKA5XEUC.mjs.map → chunk-R6UXMGTJ.mjs.map} +0 -0
- /package/dist/{chunk-TYH6CVJL.mjs.map → chunk-RBGF26S7.mjs.map} +0 -0
- /package/dist/{chunk-GJL7E2EJ.mjs.map → chunk-TPGAM536.mjs.map} +0 -0
- /package/dist/{chunk-2MNT7B4T.mjs.map → chunk-UYBPL7PM.mjs.map} +0 -0
- /package/dist/{chunk-HI2JE5PJ.mjs.map → chunk-XAIZBTVQ.mjs.map} +0 -0
package/dist/types/Case.d.ts
CHANGED
|
@@ -4,11 +4,15 @@ import { Func } from './Func';
|
|
|
4
4
|
declare class CaseBuilder<V> {
|
|
5
5
|
readonly v: V;
|
|
6
6
|
is: {
|
|
7
|
+
true: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
8
|
+
false: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
7
9
|
defined: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
8
10
|
empty: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
9
11
|
valid: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
10
12
|
in: <T>(prop: Get<Array<V>, V>, out: Get<T, V>) => Case<T, V>;
|
|
11
13
|
not: {
|
|
14
|
+
true: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
15
|
+
false: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
12
16
|
defined: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
13
17
|
empty: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
14
18
|
valid: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
@@ -16,11 +20,15 @@ declare class CaseBuilder<V> {
|
|
|
16
20
|
};
|
|
17
21
|
};
|
|
18
22
|
if: {
|
|
23
|
+
true: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
24
|
+
false: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
19
25
|
defined: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
20
26
|
empty: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
21
27
|
valid: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
22
28
|
in: <T>(prop: Get<Array<V>, V>, out: Get<T, V>) => Case<T, V>;
|
|
23
29
|
not: {
|
|
30
|
+
true: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
31
|
+
false: <T>(pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
24
32
|
defined: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
25
33
|
empty: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
26
34
|
valid: <T>(prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
@@ -36,11 +44,15 @@ declare class Case<T, V = unknown> {
|
|
|
36
44
|
protected value: V;
|
|
37
45
|
protected outcome?: T | undefined;
|
|
38
46
|
is: {
|
|
47
|
+
true: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
48
|
+
false: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
39
49
|
defined: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
40
50
|
empty: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
41
51
|
valid: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
42
52
|
in: (prop: Get<Array<V>, V>, out: Get<T, V>) => Case<T, V>;
|
|
43
53
|
not: {
|
|
54
|
+
true: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
55
|
+
false: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
44
56
|
defined: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
45
57
|
empty: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
46
58
|
valid: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
@@ -48,11 +60,15 @@ declare class Case<T, V = unknown> {
|
|
|
48
60
|
};
|
|
49
61
|
};
|
|
50
62
|
if: {
|
|
63
|
+
true: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
64
|
+
false: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
51
65
|
defined: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
52
66
|
empty: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
53
67
|
valid: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
54
68
|
in: (prop: Get<Array<V>, V>, out: Get<T, V>) => Case<T, V>;
|
|
55
69
|
not: {
|
|
70
|
+
true: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
71
|
+
false: (pred: Predicate<V>, out: Get<T, V>) => Case<T, V>;
|
|
56
72
|
defined: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
57
73
|
empty: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
|
58
74
|
valid: (prop: Func<unknown, V>, out: Get<T, V>) => Case<T, V>;
|
package/dist/types/Case.mjs
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
choose
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
5
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
6
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
3
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
7
4
|
import "../chunk-2EJYJ4HI.mjs";
|
|
8
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
9
6
|
import "../chunk-WSBULPUZ.mjs";
|
|
10
|
-
import "../chunk-HTHNHACU.mjs";
|
|
11
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
12
7
|
import "../chunk-AG3P2RCU.mjs";
|
|
13
8
|
import "../chunk-MK2UX4IH.mjs";
|
|
14
9
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/Context.mjs
CHANGED
|
@@ -4,8 +4,12 @@ import {
|
|
|
4
4
|
Context,
|
|
5
5
|
DotEnvContext,
|
|
6
6
|
ctx
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
8
|
+
import "../chunk-2EJYJ4HI.mjs";
|
|
9
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
10
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
11
|
+
import "../chunk-AG3P2RCU.mjs";
|
|
12
|
+
import "../chunk-MK2UX4IH.mjs";
|
|
9
13
|
import "../chunk-ZKLQJX4N.mjs";
|
|
10
14
|
import "../chunk-HOVTNDHS.mjs";
|
|
11
15
|
import "../chunk-SSROJBD5.mjs";
|
package/dist/types/Exception.mjs
CHANGED
|
@@ -2,8 +2,10 @@ import {
|
|
|
2
2
|
Exception,
|
|
3
3
|
isDoesNotExist,
|
|
4
4
|
isException
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
6
|
+
import "../chunk-2EJYJ4HI.mjs";
|
|
7
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
8
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
7
9
|
import "../chunk-AG3P2RCU.mjs";
|
|
8
10
|
import "../chunk-MK2UX4IH.mjs";
|
|
9
11
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/Gateway.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Gateway
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ESECEXXM.mjs";
|
|
4
|
+
import "../chunk-ZBS4A3QI.mjs";
|
|
4
5
|
import "../chunk-2EJYJ4HI.mjs";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
7
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
7
8
|
import "../chunk-AG3P2RCU.mjs";
|
|
8
9
|
import "../chunk-MK2UX4IH.mjs";
|
|
9
10
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/IsEqual.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isEqual
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
6
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
7
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
3
|
+
} from "../chunk-FCJ4TDW7.mjs";
|
|
4
|
+
import "../chunk-ZBS4A3QI.mjs";
|
|
8
5
|
import "../chunk-2EJYJ4HI.mjs";
|
|
9
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
10
7
|
import "../chunk-WSBULPUZ.mjs";
|
|
11
|
-
import "../chunk-HTHNHACU.mjs";
|
|
12
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
13
8
|
import "../chunk-AG3P2RCU.mjs";
|
|
14
9
|
import "../chunk-MK2UX4IH.mjs";
|
|
15
10
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/Number.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asNumber
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
6
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
7
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
3
|
+
} from "../chunk-XAIZBTVQ.mjs";
|
|
4
|
+
import "../chunk-ZBS4A3QI.mjs";
|
|
8
5
|
import "../chunk-2EJYJ4HI.mjs";
|
|
9
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
10
7
|
import "../chunk-WSBULPUZ.mjs";
|
|
11
|
-
import "../chunk-HTHNHACU.mjs";
|
|
12
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
13
8
|
import "../chunk-AG3P2RCU.mjs";
|
|
14
9
|
import "../chunk-MK2UX4IH.mjs";
|
|
15
10
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/PageList.mjs
CHANGED
|
@@ -5,16 +5,11 @@ import {
|
|
|
5
5
|
toFilter,
|
|
6
6
|
toPageList,
|
|
7
7
|
toShortFilter
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
11
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
12
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
8
|
+
} from "../chunk-PQTYEEZC.mjs";
|
|
9
|
+
import "../chunk-ZBS4A3QI.mjs";
|
|
13
10
|
import "../chunk-2EJYJ4HI.mjs";
|
|
14
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
15
12
|
import "../chunk-WSBULPUZ.mjs";
|
|
16
|
-
import "../chunk-HTHNHACU.mjs";
|
|
17
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
18
13
|
import "../chunk-AG3P2RCU.mjs";
|
|
19
14
|
import "../chunk-MK2UX4IH.mjs";
|
|
20
15
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/Parser.mjs
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isValid
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
5
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
6
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
3
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
7
4
|
import "../chunk-2EJYJ4HI.mjs";
|
|
8
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
9
6
|
import "../chunk-WSBULPUZ.mjs";
|
|
10
|
-
import "../chunk-HTHNHACU.mjs";
|
|
11
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
12
7
|
import "../chunk-AG3P2RCU.mjs";
|
|
13
8
|
import "../chunk-MK2UX4IH.mjs";
|
|
14
9
|
import "../chunk-ZKLQJX4N.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/Parser.ts"],"sourcesContent":["import { Get, ofGet, Predicate } from './Get';\nimport { isDefined, isEmpty, isIn, isObject, isString, isTrue } from './Is';\nimport { isValid } from '../validation/Validate';\nimport { Constructor, on } from './Constructor';\nimport { toArray } from './Array';\n\nexport class Parser<T, V> {\n if = {\n equals: (pred?: Predicate<T>): this => this.evaluate(isTrue, pred),\n empty: <U>(pred?: Get<U, T>): this => this.evaluate(isEmpty, pred),\n defined: <U>(pred?: Get<U, T>): this => this.evaluate(isDefined, pred),\n valid: <U>(pred?: Get<U, T>): this => this.evaluate(isValid, pred),\n in: (...items: T[]): this => this.evaluate(() => isIn(this.value, toArray(...items))),\n is: {\n object: <U>(pred?: Get<U, T>): this => this.evaluate(isObject, pred),\n string: <U>(pred?: Get<U, T>): this => this.evaluate(isString, pred),\n instance: <U>(c: Constructor<U>, pred?: Get<U, T>): this => this.evaluate(() => this.value instanceof c, pred),\n },\n not: {\n empty: <U>(pred?: Get<U, T>): this => this.evaluateNot(isEmpty, pred),\n defined: <U>(pred?: Get<U, T>): this => this.evaluateNot(isDefined, pred),\n valid: <U>(pred?: Get<U, T>): this => this.evaluateNot(isValid, pred),\n isObject: <U>(pred?: Get<U, T>): this => this.evaluateNot(isObject, pred),\n in: (...items: T[]): this => this.evaluate(() => !isIn(this.value, toArray(...items))),\n is: {\n object: <U>(pred?: Get<U, T>): this => this.evaluateNot(isObject, pred),\n string: <U>(pred?: Get<U, T>): this => this.evaluateNot(isString, pred),\n instance: <U>(c: Constructor<U>, pred?: Get<U, T>): this => this.evaluate(() => !(this.value instanceof c), pred),\n },\n },\n };\n\n constructor(\n protected value: T,\n protected valid = true\n ) {}\n\n protected evaluate<U>(meta: Get<boolean>, pred?: Get<U, T>): this {\n return on(this, t => (t.valid = ofGet(meta, pred ? ofGet(pred, this.value) : this.value)));\n }\n\n protected evaluateNot<U>(meta: Get<boolean>, pred?: Get<U, T>): this {\n return on(this, t => (t.valid = !ofGet(meta, pred ? ofGet(pred, this.value) : this.value)));\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/types/Parser.ts"],"sourcesContent":["import { Get, ofGet, Predicate } from './Get';\nimport { isDefined, isEmpty, isIn, isObject, isString, isTrue } from './Is';\nimport { isValid } from '../validation/Validate';\nimport { Constructor, on } from './Constructor';\nimport { toArray } from './Array';\n\nexport class Parser<T, V> {\n if = {\n equals: (pred?: Predicate<T>): this => this.evaluate(isTrue, pred),\n empty: <U>(pred?: Get<U, T>): this => this.evaluate(isEmpty, pred),\n defined: <U>(pred?: Get<U, T>): this => this.evaluate(isDefined, pred),\n valid: <U>(pred?: Get<U, T>): this => this.evaluate(isValid, pred),\n in: (...items: T[]): this => this.evaluate(() => isIn(this.value, toArray(...items))),\n is: {\n object: <U>(pred?: Get<U, T>): this => this.evaluate(isObject, pred),\n string: <U>(pred?: Get<U, T>): this => this.evaluate(isString, pred),\n instance: <U>(c: Constructor<U>, pred?: Get<U, T>): this => this.evaluate(() => this.value instanceof c, pred),\n },\n not: {\n empty: <U>(pred?: Get<U, T>): this => this.evaluateNot(isEmpty, pred),\n defined: <U>(pred?: Get<U, T>): this => this.evaluateNot(isDefined, pred),\n valid: <U>(pred?: Get<U, T>): this => this.evaluateNot(isValid, pred),\n isObject: <U>(pred?: Get<U, T>): this => this.evaluateNot(isObject, pred),\n in: (...items: T[]): this => this.evaluate(() => !isIn(this.value, toArray(...items))),\n is: {\n object: <U>(pred?: Get<U, T>): this => this.evaluateNot(isObject, pred),\n string: <U>(pred?: Get<U, T>): this => this.evaluateNot(isString, pred),\n instance: <U>(c: Constructor<U>, pred?: Get<U, T>): this => this.evaluate(() => !(this.value instanceof c), pred),\n },\n },\n };\n\n constructor(\n protected value: T,\n protected valid = true\n ) {}\n\n protected evaluate<U>(meta: Get<boolean>, pred?: Get<U, T>): this {\n return on(this, t => (t.valid = ofGet(meta, pred ? ofGet(pred, this.value) : this.value)));\n }\n\n protected evaluateNot<U>(meta: Get<boolean>, pred?: Get<U, T>): this {\n return on(this, t => (t.valid = !ofGet(meta, pred ? ofGet(pred, this.value) : this.value)));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAM,SAAN,MAAmB;AAAA,EA0BxB,YACY,OACA,QAAQ,MAClB;AAFU;AACA;AAAA,EACT;AAAA,EA5BH,KAAK;AAAA,IACH,QAAQ,CAAC,SAA8B,KAAK,SAAS,QAAQ,IAAI;AAAA,IACjE,OAAO,CAAI,SAA2B,KAAK,SAAS,SAAS,IAAI;AAAA,IACjE,SAAS,CAAI,SAA2B,KAAK,SAAS,WAAW,IAAI;AAAA,IACrE,OAAO,CAAI,SAA2B,KAAK,SAAS,SAAS,IAAI;AAAA,IACjE,IAAI,IAAI,UAAqB,KAAK,SAAS,MAAM,KAAK,KAAK,OAAO,QAAQ,GAAG,KAAK,CAAC,CAAC;AAAA,IACpF,IAAI;AAAA,MACF,QAAQ,CAAI,SAA2B,KAAK,SAAS,UAAU,IAAI;AAAA,MACnE,QAAQ,CAAI,SAA2B,KAAK,SAAS,UAAU,IAAI;AAAA,MACnE,UAAU,CAAI,GAAmB,SAA2B,KAAK,SAAS,MAAM,KAAK,iBAAiB,GAAG,IAAI;AAAA,IAC/G;AAAA,IACA,KAAK;AAAA,MACH,OAAO,CAAI,SAA2B,KAAK,YAAY,SAAS,IAAI;AAAA,MACpE,SAAS,CAAI,SAA2B,KAAK,YAAY,WAAW,IAAI;AAAA,MACxE,OAAO,CAAI,SAA2B,KAAK,YAAY,SAAS,IAAI;AAAA,MACpE,UAAU,CAAI,SAA2B,KAAK,YAAY,UAAU,IAAI;AAAA,MACxE,IAAI,IAAI,UAAqB,KAAK,SAAS,MAAM,CAAC,KAAK,KAAK,OAAO,QAAQ,GAAG,KAAK,CAAC,CAAC;AAAA,MACrF,IAAI;AAAA,QACF,QAAQ,CAAI,SAA2B,KAAK,YAAY,UAAU,IAAI;AAAA,QACtE,QAAQ,CAAI,SAA2B,KAAK,YAAY,UAAU,IAAI;AAAA,QACtE,UAAU,CAAI,GAAmB,SAA2B,KAAK,SAAS,MAAM,EAAE,KAAK,iBAAiB,IAAI,IAAI;AAAA,MAClH;AAAA,IACF;AAAA,EACF;AAAA,EAOU,SAAY,MAAoB,MAAwB;AAChE,WAAO,GAAG,MAAM,OAAM,EAAE,QAAQ,MAAM,MAAM,OAAO,MAAM,MAAM,KAAK,KAAK,IAAI,KAAK,KAAK,CAAE;AAAA,EAC3F;AAAA,EAEU,YAAe,MAAoB,MAAwB;AACnE,WAAO,GAAG,MAAM,OAAM,EAAE,QAAQ,CAAC,MAAM,MAAM,OAAO,MAAM,MAAM,KAAK,KAAK,IAAI,KAAK,KAAK,CAAE;AAAA,EAC5F;AACF;","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Repository
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-TPGAM536.mjs";
|
|
4
|
+
import "../chunk-ZBS4A3QI.mjs";
|
|
4
5
|
import "../chunk-2EJYJ4HI.mjs";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
7
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
7
8
|
import "../chunk-AG3P2RCU.mjs";
|
|
8
9
|
import "../chunk-MK2UX4IH.mjs";
|
|
9
10
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/Result.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isResult,
|
|
3
3
|
toResult
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
5
|
+
import "../chunk-2EJYJ4HI.mjs";
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
7
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
8
|
+
import "../chunk-AG3P2RCU.mjs";
|
|
9
|
+
import "../chunk-MK2UX4IH.mjs";
|
|
7
10
|
import "../chunk-ZKLQJX4N.mjs";
|
|
8
11
|
import "../chunk-HOVTNDHS.mjs";
|
|
9
12
|
import "../chunk-SSROJBD5.mjs";
|
package/dist/types/Results.mjs
CHANGED
|
@@ -2,10 +2,12 @@ import {
|
|
|
2
2
|
Results,
|
|
3
3
|
isResults,
|
|
4
4
|
toResults
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
6
|
+
import "../chunk-2EJYJ4HI.mjs";
|
|
7
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
8
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
9
|
+
import "../chunk-AG3P2RCU.mjs";
|
|
10
|
+
import "../chunk-MK2UX4IH.mjs";
|
|
9
11
|
import "../chunk-ZKLQJX4N.mjs";
|
|
10
12
|
import "../chunk-HOVTNDHS.mjs";
|
|
11
13
|
import "../chunk-SSROJBD5.mjs";
|
package/dist/types/Template.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare class Template implements Text {
|
|
|
9
9
|
private readonly template;
|
|
10
10
|
private readonly subject;
|
|
11
11
|
private readonly options;
|
|
12
|
+
private knownPrefixes;
|
|
12
13
|
constructor(template: string, subject?: unknown, options?: TemplateOptions);
|
|
13
14
|
toString: () => string;
|
|
14
15
|
private readonly props;
|
package/dist/types/Template.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Template,
|
|
3
3
|
template
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
5
|
+
import "../chunk-2EJYJ4HI.mjs";
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
7
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
8
|
+
import "../chunk-AG3P2RCU.mjs";
|
|
9
|
+
import "../chunk-MK2UX4IH.mjs";
|
|
5
10
|
import "../chunk-ZKLQJX4N.mjs";
|
|
6
11
|
import "../chunk-HOVTNDHS.mjs";
|
|
7
12
|
import "../chunk-SSROJBD5.mjs";
|
package/dist/types/ToText.mjs
CHANGED
|
@@ -2,7 +2,12 @@ import {
|
|
|
2
2
|
ToText,
|
|
3
3
|
text,
|
|
4
4
|
textValue
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
6
|
+
import "../chunk-2EJYJ4HI.mjs";
|
|
7
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
8
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
9
|
+
import "../chunk-AG3P2RCU.mjs";
|
|
10
|
+
import "../chunk-MK2UX4IH.mjs";
|
|
6
11
|
import "../chunk-ZKLQJX4N.mjs";
|
|
7
12
|
import "../chunk-HOVTNDHS.mjs";
|
|
8
13
|
import "../chunk-SSROJBD5.mjs";
|
package/dist/types/Try.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Try,
|
|
3
3
|
tryTo
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
6
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
7
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
4
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
8
5
|
import "../chunk-2EJYJ4HI.mjs";
|
|
9
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
10
7
|
import "../chunk-WSBULPUZ.mjs";
|
|
11
|
-
import "../chunk-HTHNHACU.mjs";
|
|
12
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
13
8
|
import "../chunk-AG3P2RCU.mjs";
|
|
14
9
|
import "../chunk-MK2UX4IH.mjs";
|
|
15
10
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/types/Uri.mjs
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ctx,
|
|
2
3
|
tryTo
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
5
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
6
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
4
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
7
5
|
import "../chunk-2EJYJ4HI.mjs";
|
|
8
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
9
7
|
import "../chunk-WSBULPUZ.mjs";
|
|
10
|
-
import {
|
|
11
|
-
ctx
|
|
12
|
-
} from "../chunk-HTHNHACU.mjs";
|
|
13
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
14
8
|
import "../chunk-AG3P2RCU.mjs";
|
|
15
9
|
import {
|
|
16
10
|
meta
|
package/dist/types/Uri.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/Uri.ts"],"sourcesContent":["import { isBoolean, isNotEmpty, isTrue } from './Is';\nimport { asString, Text } from './Text';\nimport { toName } from './Constructor';\nimport { ctx } from './Context';\nimport { List, toList } from './List';\nimport { meta } from './Meta';\nimport { tryTo } from './Try';\nimport { Optional } from './Types';\nimport { OneOrMore, toArray } from './Array';\nimport { entries } from './Object';\n\nexport type Segment = Text & { key?: string; segment?: string; query?: (value: unknown) => string };\n\nexport const toSegment = (\n key?: Text,\n {\n segment,\n query,\n }: {\n segment?: string;\n query?: (value: unknown) => string;\n } = {}\n): Segment => ({\n key: key as string,\n segment,\n query,\n toString: () => asString(key),\n});\n\nexport const uri = {\n host: (key?: string): Segment => toSegment(key, { segment: key ?? ctx.env.host ?? '$host' }),\n resource: <Props extends UriExpandProps>(resource: Uri<Props>): Segment => toSegment(toName(resource, 'Uri'), { segment: toName(resource, 'Uri') }),\n segment: (key?: Text): Segment => toSegment(key, { segment: key as string }),\n path: (key: Text): Segment => toSegment(key, { segment: `:${key}` }),\n query: (key: Text): Segment =>\n toSegment(key, {\n query: (value: unknown): string =>\n tryTo(value)\n .is.defined()\n .map(v => encodeURIComponent(asString(v)))\n .map(v => `${key}=${v}`)\n .orElse('') ?? '',\n }),\n boolean: (key: Text): Segment => toSegment(key, { query: (value: unknown): string => (isTrue(value) ? `${key}` : '') }),\n};\n\ntype Prop = { segment: Segment; value: any };\n\nconst toRoute = (...segments: Segment[]): string =>\n toList(segments)\n .mapDefined(s => s.segment)\n .join('/');\n\nexport type Uri<Props extends UriExpandProps = UriExpandProps> = {\n id: (id?: unknown) => Uri<Props>;\n ids: (ids: OneOrMore<unknown>) => Uri<Props>;\n query: (q?: unknown) => Uri<Props>;\n sort: (q?: any) => Uri<Props>;\n skip: (n?: number) => Uri<Props>;\n take: (n?: number) => Uri<Props>;\n path: string;\n route: (resource: string) => string;\n isInternal: boolean;\n toString: () => string;\n expand: (props: Partial<Props>) => Uri<Props>;\n};\n\nexport type UriExpandProps = { q?: string; s?: string; skip?: number; take?: number };\n\nexport class EasyUri<Props extends UriExpandProps = UriExpandProps> implements Uri<Props> {\n static readonly id = uri.path('id');\n static readonly ids = uri.query('ids');\n static readonly query = uri.query('q');\n static readonly sort = uri.query('s');\n static readonly skip = uri.query('skip');\n static readonly take = uri.query('take');\n\n readonly host = uri.host();\n protected resource: Segment = uri.resource(this);\n\n protected state: any = {};\n\n constructor(readonly segments: Segment[] = []) {}\n\n get path(): string {\n return toRoute(uri.segment(''), this.resource, ...this.segments);\n }\n\n get complete(): string {\n return toRoute(this.host, this.resource, ...this.segments);\n }\n\n get isInternal(): boolean {\n return toRoute(this.host) === (ctx.env.host ?? '$host');\n }\n\n protected get props(): List<Prop> {\n return meta(this.state).values<Prop>();\n }\n\n route = (resource: Optional<string> = this.resource.key): string => toRoute(uri.segment(''), uri.segment(resource?.toLowerCase()), ...this.segments);\n\n set = (segment: Segment, value?: unknown): this => {\n tryTo(value)\n .is.defined()\n .accept(value => (this.state[segment.key ?? ''] = { segment, value }));\n return this;\n };\n\n toString(): string {\n return tryTo(() => this.props)\n .map(ps => ps.filter(p => p.segment?.segment))\n .map(ps => ps.reduce((r: string, p: Prop) => r.replace(asString(p.segment.segment), asString(p.value)), this.complete))\n .map(route => ({\n route,\n query: this.props.mapDefined(p => (p.segment?.query ? p.segment?.query(p.value) : undefined))?.join('&'),\n }))\n .map(({ route, query }) => (isNotEmpty(query) ? `${route}?${query}` : route)).value;\n }\n\n id = (id?: unknown): this => this.set(EasyUri.id, id);\n ids = (ids: OneOrMore<unknown>): this => this.set(EasyUri.ids, toArray(ids).join(','));\n query = (q?: unknown): this => this.set(EasyUri.query, q);\n sort = (s?: any): this => this.set(EasyUri.sort, asString(s));\n\n skip = (index?: number): this => this.set(EasyUri.skip, index);\n take = (items?: number): this => this.set(EasyUri.take, items);\n\n expand(props: Partial<Props>): this {\n return entries(props as any)\n .filter(([_, v]) => isNotEmpty(v))\n .reduce((u, [k, v]) => (isBoolean(v) ? u.set(uri.boolean(k), v) : u.set(uri.query(k), toArray(v).join(','))), this);\n }\n}\n\nexport const clipUri = (uri?: EasyUri | string | null): string =>\n tryTo(() => asString(uri))\n .map(uri => uri.replace(/^(https?:\\/\\/)?(www\\.)?/, ''))\n .map(uri => uri.replace(/\\/$/, '')).value;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/types/Uri.ts"],"sourcesContent":["import { isBoolean, isNotEmpty, isTrue } from './Is';\nimport { asString, Text } from './Text';\nimport { toName } from './Constructor';\nimport { ctx } from './Context';\nimport { List, toList } from './List';\nimport { meta } from './Meta';\nimport { tryTo } from './Try';\nimport { Optional } from './Types';\nimport { OneOrMore, toArray } from './Array';\nimport { entries } from './Object';\n\nexport type Segment = Text & { key?: string; segment?: string; query?: (value: unknown) => string };\n\nexport const toSegment = (\n key?: Text,\n {\n segment,\n query,\n }: {\n segment?: string;\n query?: (value: unknown) => string;\n } = {}\n): Segment => ({\n key: key as string,\n segment,\n query,\n toString: () => asString(key),\n});\n\nexport const uri = {\n host: (key?: string): Segment => toSegment(key, { segment: key ?? ctx.env.host ?? '$host' }),\n resource: <Props extends UriExpandProps>(resource: Uri<Props>): Segment => toSegment(toName(resource, 'Uri'), { segment: toName(resource, 'Uri') }),\n segment: (key?: Text): Segment => toSegment(key, { segment: key as string }),\n path: (key: Text): Segment => toSegment(key, { segment: `:${key}` }),\n query: (key: Text): Segment =>\n toSegment(key, {\n query: (value: unknown): string =>\n tryTo(value)\n .is.defined()\n .map(v => encodeURIComponent(asString(v)))\n .map(v => `${key}=${v}`)\n .orElse('') ?? '',\n }),\n boolean: (key: Text): Segment => toSegment(key, { query: (value: unknown): string => (isTrue(value) ? `${key}` : '') }),\n};\n\ntype Prop = { segment: Segment; value: any };\n\nconst toRoute = (...segments: Segment[]): string =>\n toList(segments)\n .mapDefined(s => s.segment)\n .join('/');\n\nexport type Uri<Props extends UriExpandProps = UriExpandProps> = {\n id: (id?: unknown) => Uri<Props>;\n ids: (ids: OneOrMore<unknown>) => Uri<Props>;\n query: (q?: unknown) => Uri<Props>;\n sort: (q?: any) => Uri<Props>;\n skip: (n?: number) => Uri<Props>;\n take: (n?: number) => Uri<Props>;\n path: string;\n route: (resource: string) => string;\n isInternal: boolean;\n toString: () => string;\n expand: (props: Partial<Props>) => Uri<Props>;\n};\n\nexport type UriExpandProps = { q?: string; s?: string; skip?: number; take?: number };\n\nexport class EasyUri<Props extends UriExpandProps = UriExpandProps> implements Uri<Props> {\n static readonly id = uri.path('id');\n static readonly ids = uri.query('ids');\n static readonly query = uri.query('q');\n static readonly sort = uri.query('s');\n static readonly skip = uri.query('skip');\n static readonly take = uri.query('take');\n\n readonly host = uri.host();\n protected resource: Segment = uri.resource(this);\n\n protected state: any = {};\n\n constructor(readonly segments: Segment[] = []) {}\n\n get path(): string {\n return toRoute(uri.segment(''), this.resource, ...this.segments);\n }\n\n get complete(): string {\n return toRoute(this.host, this.resource, ...this.segments);\n }\n\n get isInternal(): boolean {\n return toRoute(this.host) === (ctx.env.host ?? '$host');\n }\n\n protected get props(): List<Prop> {\n return meta(this.state).values<Prop>();\n }\n\n route = (resource: Optional<string> = this.resource.key): string => toRoute(uri.segment(''), uri.segment(resource?.toLowerCase()), ...this.segments);\n\n set = (segment: Segment, value?: unknown): this => {\n tryTo(value)\n .is.defined()\n .accept(value => (this.state[segment.key ?? ''] = { segment, value }));\n return this;\n };\n\n toString(): string {\n return tryTo(() => this.props)\n .map(ps => ps.filter(p => p.segment?.segment))\n .map(ps => ps.reduce((r: string, p: Prop) => r.replace(asString(p.segment.segment), asString(p.value)), this.complete))\n .map(route => ({\n route,\n query: this.props.mapDefined(p => (p.segment?.query ? p.segment?.query(p.value) : undefined))?.join('&'),\n }))\n .map(({ route, query }) => (isNotEmpty(query) ? `${route}?${query}` : route)).value;\n }\n\n id = (id?: unknown): this => this.set(EasyUri.id, id);\n ids = (ids: OneOrMore<unknown>): this => this.set(EasyUri.ids, toArray(ids).join(','));\n query = (q?: unknown): this => this.set(EasyUri.query, q);\n sort = (s?: any): this => this.set(EasyUri.sort, asString(s));\n\n skip = (index?: number): this => this.set(EasyUri.skip, index);\n take = (items?: number): this => this.set(EasyUri.take, items);\n\n expand(props: Partial<Props>): this {\n return entries(props as any)\n .filter(([_, v]) => isNotEmpty(v))\n .reduce((u, [k, v]) => (isBoolean(v) ? u.set(uri.boolean(k), v) : u.set(uri.query(k), toArray(v).join(','))), this);\n }\n}\n\nexport const clipUri = (uri?: EasyUri | string | null): string =>\n tryTo(() => asString(uri))\n .map(uri => uri.replace(/^(https?:\\/\\/)?(www\\.)?/, ''))\n .map(uri => uri.replace(/\\/$/, '')).value;\n"],"mappings":"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","names":["value","uri"]}
|
package/dist/utils/Sentence.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
text
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
4
|
+
import "../chunk-2EJYJ4HI.mjs";
|
|
5
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
6
|
+
import "../chunk-WSBULPUZ.mjs";
|
|
7
|
+
import "../chunk-AG3P2RCU.mjs";
|
|
8
|
+
import "../chunk-MK2UX4IH.mjs";
|
|
4
9
|
import "../chunk-ZKLQJX4N.mjs";
|
|
5
10
|
import "../chunk-HOVTNDHS.mjs";
|
|
6
11
|
import "../chunk-SSROJBD5.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/Sentence.ts"],"sourcesContent":["import type { Text } from '../types/Text';\nimport { Id } from '../types/Id';\nimport { text } from '../types/ToText';\n\nexport class Sentence implements Text {\n constructor(\n word: Text,\n pre?: Sentence,\n private sentence: Text[] = (pre?.sentence ?? []).concat(word)\n ) {}\n\n toString(): string {\n return text(this.sentence.join(' ')).sentence.toString();\n }\n}\n\nclass Topic extends Sentence {\n it = new Sentence('it', this);\n anything = new Sentence('anything', this);\n id = (id: Id) => new Sentence(`id '${id}'`, this);\n your = (subject?: Text) => new Sentence(`your ${subject ?? 'item'}`, this);\n a = (subject?: Text) => new Sentence(subject ? `a ${subject}` : 'an item', this);\n an = (subject?: Text) => new Sentence(`an ${subject ?? 'item'}`, this);\n any = (subjects?: Text) => new Sentence(`any ${subjects ?? 'items'}`, this);\n}\n\nclass Verb extends Sentence {\n add = new Topic('add', this);\n check = new Topic('check', this);\n fetch = new Topic('fetch', this);\n find = new Topic('find', this);\n like = new Topic('like', this);\n process = new Topic('process', this);\n remove = new Topic('remove', this);\n translate = new Topic('translate', this);\n update = new Topic('update', this);\n validate = new Topic('validate', this);\n}\n\nclass Not extends Verb {}\n\nclass SupportVerb extends Verb {\n not = new Not('not', this);\n}\n\nclass We extends Sentence {\n could = new SupportVerb('could', this);\n did = new SupportVerb('did', this);\n\n added = new Topic('added', this);\n checked = new Topic('checked', this);\n fetched = new Topic('fetched', this);\n found = new Topic('found', this);\n liked = new Topic('liked', this);\n processed = new Topic('processed', this);\n removed = new Topic('removed', this);\n translated = new Topic('translated', this);\n updated = new Topic('updated', this);\n validated = new Topic('validated', this);\n}\n\nexport const we = new We('we');\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Sentence.ts"],"sourcesContent":["import type { Text } from '../types/Text';\nimport { Id } from '../types/Id';\nimport { text } from '../types/ToText';\n\nexport class Sentence implements Text {\n constructor(\n word: Text,\n pre?: Sentence,\n private sentence: Text[] = (pre?.sentence ?? []).concat(word)\n ) {}\n\n toString(): string {\n return text(this.sentence.join(' ')).sentence.toString();\n }\n}\n\nclass Topic extends Sentence {\n it = new Sentence('it', this);\n anything = new Sentence('anything', this);\n id = (id: Id) => new Sentence(`id '${id}'`, this);\n your = (subject?: Text) => new Sentence(`your ${subject ?? 'item'}`, this);\n a = (subject?: Text) => new Sentence(subject ? `a ${subject}` : 'an item', this);\n an = (subject?: Text) => new Sentence(`an ${subject ?? 'item'}`, this);\n any = (subjects?: Text) => new Sentence(`any ${subjects ?? 'items'}`, this);\n}\n\nclass Verb extends Sentence {\n add = new Topic('add', this);\n check = new Topic('check', this);\n fetch = new Topic('fetch', this);\n find = new Topic('find', this);\n like = new Topic('like', this);\n process = new Topic('process', this);\n remove = new Topic('remove', this);\n translate = new Topic('translate', this);\n update = new Topic('update', this);\n validate = new Topic('validate', this);\n}\n\nclass Not extends Verb {}\n\nclass SupportVerb extends Verb {\n not = new Not('not', this);\n}\n\nclass We extends Sentence {\n could = new SupportVerb('could', this);\n did = new SupportVerb('did', this);\n\n added = new Topic('added', this);\n checked = new Topic('checked', this);\n fetched = new Topic('fetched', this);\n found = new Topic('found', this);\n liked = new Topic('liked', this);\n processed = new Topic('processed', this);\n removed = new Topic('removed', this);\n translated = new Topic('translated', this);\n updated = new Topic('updated', this);\n validated = new Topic('validated', this);\n}\n\nexport const we = new We('we');\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,WAAN,MAA+B;AAAA,EACpC,YACE,MACA,KACQ,YAAoB,KAAK,YAAY,CAAC,GAAG,OAAO,IAAI,GAC5D;AADQ;AAAA,EACP;AAAA,EAEH,WAAmB;AACjB,WAAO,KAAK,KAAK,SAAS,KAAK,GAAG,CAAC,EAAE,SAAS,SAAS;AAAA,EACzD;AACF;AAEA,IAAM,QAAN,cAAoB,SAAS;AAAA,EAC3B,KAAK,IAAI,SAAS,MAAM,IAAI;AAAA,EAC5B,WAAW,IAAI,SAAS,YAAY,IAAI;AAAA,EACxC,KAAK,CAAC,OAAW,IAAI,SAAS,OAAO,EAAE,KAAK,IAAI;AAAA,EAChD,OAAO,CAAC,YAAmB,IAAI,SAAS,QAAQ,WAAW,MAAM,IAAI,IAAI;AAAA,EACzE,IAAI,CAAC,YAAmB,IAAI,SAAS,UAAU,KAAK,OAAO,KAAK,WAAW,IAAI;AAAA,EAC/E,KAAK,CAAC,YAAmB,IAAI,SAAS,MAAM,WAAW,MAAM,IAAI,IAAI;AAAA,EACrE,MAAM,CAAC,aAAoB,IAAI,SAAS,OAAO,YAAY,OAAO,IAAI,IAAI;AAC5E;AAEA,IAAM,OAAN,cAAmB,SAAS;AAAA,EAC1B,MAAM,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3B,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,EAC7B,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,EAC7B,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,SAAS,IAAI,MAAM,UAAU,IAAI;AAAA,EACjC,YAAY,IAAI,MAAM,aAAa,IAAI;AAAA,EACvC,SAAS,IAAI,MAAM,UAAU,IAAI;AAAA,EACjC,WAAW,IAAI,MAAM,YAAY,IAAI;AACvC;AAEA,IAAM,MAAN,cAAkB,KAAK;AAAC;AAExB,IAAM,cAAN,cAA0B,KAAK;AAAA,EAC7B,MAAM,IAAI,IAAI,OAAO,IAAI;AAC3B;AAEA,IAAM,KAAN,cAAiB,SAAS;AAAA,EACxB,QAAQ,IAAI,YAAY,SAAS,IAAI;AAAA,EACrC,MAAM,IAAI,YAAY,OAAO,IAAI;AAAA,EAEjC,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,QAAQ,IAAI,MAAM,SAAS,IAAI;AAAA,EAC/B,YAAY,IAAI,MAAM,aAAa,IAAI;AAAA,EACvC,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,aAAa,IAAI,MAAM,cAAc,IAAI;AAAA,EACzC,UAAU,IAAI,MAAM,WAAW,IAAI;AAAA,EACnC,YAAY,IAAI,MAAM,aAAa,IAAI;AACzC;AAEO,IAAM,KAAK,IAAI,GAAG,IAAI;","names":[]}
|
package/dist/utils/View.mjs
CHANGED
|
@@ -4,19 +4,14 @@ import {
|
|
|
4
4
|
toViewer,
|
|
5
5
|
view,
|
|
6
6
|
views
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-3BJH75JQ.mjs";
|
|
7
|
+
} from "../chunk-UYBPL7PM.mjs";
|
|
8
|
+
import "../chunk-FCJ4TDW7.mjs";
|
|
10
9
|
import "../chunk-YQC25ZQ4.mjs";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
14
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
10
|
+
import "../chunk-PQTYEEZC.mjs";
|
|
11
|
+
import "../chunk-ZBS4A3QI.mjs";
|
|
15
12
|
import "../chunk-2EJYJ4HI.mjs";
|
|
16
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
17
14
|
import "../chunk-WSBULPUZ.mjs";
|
|
18
|
-
import "../chunk-HTHNHACU.mjs";
|
|
19
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
20
15
|
import "../chunk-AG3P2RCU.mjs";
|
|
21
16
|
import "../chunk-MK2UX4IH.mjs";
|
|
22
17
|
import "../chunk-ZKLQJX4N.mjs";
|
|
@@ -17,17 +17,12 @@ import {
|
|
|
17
17
|
required,
|
|
18
18
|
rule,
|
|
19
19
|
valid
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-KX7RRPEZ.mjs";
|
|
21
21
|
import "../chunk-ADJAEGCT.mjs";
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
24
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
25
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
22
|
+
import "../chunk-ZBS4A3QI.mjs";
|
|
26
23
|
import "../chunk-2EJYJ4HI.mjs";
|
|
27
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
28
25
|
import "../chunk-WSBULPUZ.mjs";
|
|
29
|
-
import "../chunk-HTHNHACU.mjs";
|
|
30
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
31
26
|
import "../chunk-AG3P2RCU.mjs";
|
|
32
27
|
import "../chunk-MK2UX4IH.mjs";
|
|
33
28
|
import "../chunk-ZKLQJX4N.mjs";
|
|
@@ -3,15 +3,10 @@ import {
|
|
|
3
3
|
isValid,
|
|
4
4
|
validate,
|
|
5
5
|
validateReject
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
8
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
9
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
6
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
10
7
|
import "../chunk-2EJYJ4HI.mjs";
|
|
11
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
12
9
|
import "../chunk-WSBULPUZ.mjs";
|
|
13
|
-
import "../chunk-HTHNHACU.mjs";
|
|
14
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
15
10
|
import "../chunk-AG3P2RCU.mjs";
|
|
16
11
|
import "../chunk-MK2UX4IH.mjs";
|
|
17
12
|
import "../chunk-ZKLQJX4N.mjs";
|
package/dist/validation/When.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
When,
|
|
3
3
|
when
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-OFGI5FLG.mjs";
|
|
6
|
-
import "../chunk-MIYBZDW6.mjs";
|
|
7
|
-
import "../chunk-6JA2EI2T.mjs";
|
|
4
|
+
} from "../chunk-ZBS4A3QI.mjs";
|
|
8
5
|
import "../chunk-2EJYJ4HI.mjs";
|
|
9
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-OFGI5FLG.mjs";
|
|
10
7
|
import "../chunk-WSBULPUZ.mjs";
|
|
11
|
-
import "../chunk-HTHNHACU.mjs";
|
|
12
|
-
import "../chunk-SOUOSMQ6.mjs";
|
|
13
8
|
import "../chunk-AG3P2RCU.mjs";
|
|
14
9
|
import "../chunk-MK2UX4IH.mjs";
|
|
15
10
|
import "../chunk-ZKLQJX4N.mjs";
|
package/package.json
CHANGED
package/src/types/Case.ts
CHANGED
|
@@ -7,11 +7,15 @@ import { tryTo } from './Try';
|
|
|
7
7
|
|
|
8
8
|
class CaseBuilder<V> {
|
|
9
9
|
is = {
|
|
10
|
+
true: <T>(pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(pred, out),
|
|
11
|
+
false: <T>(pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!ofGet(pred, this.v), out),
|
|
10
12
|
defined: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(isDefined(prop(this.v)), out),
|
|
11
13
|
empty: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(isEmpty(prop(this.v)), out),
|
|
12
14
|
valid: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(validate(prop(this.v)).isValid, out),
|
|
13
15
|
in: <T>(prop: Get<Array<V>, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(ofGet(prop, this.v).includes(this.v), out),
|
|
14
16
|
not: {
|
|
17
|
+
true: <T>(pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!ofGet(pred, this.v), out),
|
|
18
|
+
false: <T>(pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(pred, out),
|
|
15
19
|
defined: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!isDefined(prop(this.v)), out),
|
|
16
20
|
empty: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!isEmpty(prop(this.v)), out),
|
|
17
21
|
valid: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!validate(prop(this.v)).isValid, out),
|
|
@@ -37,11 +41,15 @@ class CaseBuilder<V> {
|
|
|
37
41
|
|
|
38
42
|
class Case<T, V = unknown> {
|
|
39
43
|
is = {
|
|
44
|
+
true: (pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(pred, out),
|
|
45
|
+
false: (pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!ofGet(pred, this.value), out),
|
|
40
46
|
defined: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(isDefined(prop(this.value)), out),
|
|
41
47
|
empty: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(isEmpty(prop(this.value)), out),
|
|
42
48
|
valid: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(validate(prop(this.value)).isValid, out),
|
|
43
49
|
in: (prop: Get<Array<V>, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(ofGet(prop, this.value).includes(this.value), out),
|
|
44
50
|
not: {
|
|
51
|
+
true: (pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!ofGet(pred, this.value), out),
|
|
52
|
+
false: (pred: Predicate<V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(pred, out),
|
|
45
53
|
defined: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!isDefined(prop(this.value)), out),
|
|
46
54
|
empty: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!isEmpty(prop(this.value)), out),
|
|
47
55
|
valid: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!validate(prop(this.value)).isValid, out),
|
|
@@ -82,11 +90,15 @@ class Case<T, V = unknown> {
|
|
|
82
90
|
|
|
83
91
|
class Found<T, V> extends Case<T, V> {
|
|
84
92
|
is = {
|
|
93
|
+
true: (_pred: Predicate<V>, _out: Get<T, V>): Case<T, V> => this,
|
|
94
|
+
false: (_pred: Predicate<V>, _out: Get<T, V>): Case<T, V> => this,
|
|
85
95
|
defined: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,
|
|
86
96
|
empty: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,
|
|
87
97
|
valid: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,
|
|
88
98
|
in: (_prop: Get<Array<V>, V>, _out: Get<T, V>): Case<T, V> => this,
|
|
89
99
|
not: {
|
|
100
|
+
true: (_pred: Predicate<V>, _out: Get<T, V>): Case<T, V> => this,
|
|
101
|
+
false: (_pred: Predicate<V>, _out: Get<T, V>): Case<T, V> => this,
|
|
90
102
|
defined: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,
|
|
91
103
|
empty: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,
|
|
92
104
|
valid: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,
|
package/src/types/Template.ts
CHANGED
|
@@ -3,10 +3,13 @@ import { asString, Text } from './Text';
|
|
|
3
3
|
import { toName } from './Constructor';
|
|
4
4
|
import { entries } from './Object';
|
|
5
5
|
import { text, textValue } from './ToText';
|
|
6
|
+
import { tryTo } from './Try';
|
|
6
7
|
|
|
7
8
|
export type TemplateOptions = { type?: Text; property?: Text; actual?: Text; subject?: Text };
|
|
8
9
|
|
|
9
10
|
export class Template implements Text {
|
|
11
|
+
private knownPrefixes = new Set(['type', 'property', 'actual', 'subject']);
|
|
12
|
+
|
|
10
13
|
constructor(
|
|
11
14
|
private readonly template: string,
|
|
12
15
|
private readonly subject: unknown = {},
|
|
@@ -28,9 +31,10 @@ export class Template implements Text {
|
|
|
28
31
|
return this.props(tmpl.slice(i2 + 1), key, result.add(tmpl.substring(i1 + 1, i2)));
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
private readonly object = (): string =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
private readonly object = (): string =>
|
|
35
|
+
tryTo(() => this.template.replace(/\{this\./g, '{'))
|
|
36
|
+
.map(t => t.replace(/\{([^}]+)}/g, (match, p) => (this.knownPrefixes.has(p.split('.')[0]) ? match : textValue(this.subject, p))))
|
|
37
|
+
.or('');
|
|
34
38
|
|
|
35
39
|
private readonly option = (tmpl: string, prop: string): string => {
|
|
36
40
|
return this.props(tmpl, prop).reduce((t: string, p) => t.replace(`{${p}}`, textValue(this.options, p)), tmpl);
|
package/src/types/ToText.ts
CHANGED
|
@@ -163,7 +163,7 @@ export function textValue(subject: any, prop: string): string {
|
|
|
163
163
|
return (
|
|
164
164
|
p
|
|
165
165
|
.splice(1)
|
|
166
|
-
.reduce((t, s) => t?.[s], initial)
|
|
166
|
+
.reduce((t, s) => (typeof t === 'object' && t !== null ? t : text(t))?.[s], initial)
|
|
167
167
|
?.toString() ?? ''
|
|
168
168
|
);
|
|
169
169
|
}
|