@thisisagile/easy 12.7.21 → 12.7.22
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/data/Condition.js.map +1 -1
- package/dist/domain/Typo.js.map +1 -1
- package/dist/domain/enums/Currency.js +3 -1
- package/dist/domain/enums/Currency.js.map +1 -1
- package/dist/http/CacheControl.js +12 -9
- package/dist/http/CacheControl.js.map +1 -1
- package/dist/http/LocalRequestStore.d.ts +7 -0
- package/dist/http/LocalRequestStore.js +15 -0
- package/dist/http/LocalRequestStore.js.map +1 -0
- package/dist/http/NoRequestStore.d.ts +3 -3
- package/dist/http/NoRequestStore.js.map +1 -1
- package/dist/http/RestResult.js.map +1 -1
- package/dist/services/Api.d.ts +5 -3
- package/dist/services/Api.js +12 -10
- package/dist/services/Api.js.map +1 -1
- package/dist/services/RouteGateway.js.map +1 -1
- package/dist/types/Cache.d.ts +3 -3
- package/dist/types/CacheAge.js +1 -1
- package/dist/types/CacheAge.js.map +1 -1
- package/dist/types/Constructor.js.map +1 -1
- package/dist/types/Gateway.d.ts +1 -1
- package/dist/types/Gateway.js.map +1 -1
- package/dist/types/List.js +1 -1
- package/dist/types/List.js.map +1 -1
- package/dist/utils/View.js +1 -1
- package/dist/utils/View.js.map +1 -1
- package/package.json +2 -2
- package/src/data/Condition.ts +3 -5
- package/src/domain/Typo.ts +2 -15
- package/src/domain/enums/Currency.ts +3 -1
- package/src/http/CacheControl.ts +26 -24
- package/src/http/LocalRequestStore.ts +12 -0
- package/src/http/NoRequestStore.ts +6 -6
- package/src/http/RestResult.ts +1 -1
- package/src/services/Api.ts +57 -68
- package/src/services/RouteGateway.ts +88 -78
- package/src/types/Cache.ts +6 -6
- package/src/types/CacheAge.ts +48 -48
- package/src/types/Constructor.ts +3 -3
- package/src/types/Gateway.ts +1 -2
- package/src/types/List.ts +1 -1
- package/src/types/PageList.ts +2 -2
- package/src/types/Types.ts +0 -1
- package/src/utils/View.ts +9 -11
package/src/utils/View.ts
CHANGED
|
@@ -36,9 +36,9 @@ const toFunc = (a: any, col: string, f: Func = a => a): Func =>
|
|
|
36
36
|
const toViewer = (key: string, value: unknown): Viewer =>
|
|
37
37
|
choose(value)
|
|
38
38
|
.is.not.defined(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
v => v,
|
|
40
|
+
() => toViewer(key, () => undefined)
|
|
41
|
+
)
|
|
42
42
|
.type(isBoolean, b => toViewer(key, () => b))
|
|
43
43
|
.type(isNumber, n => toViewer(key, () => n))
|
|
44
44
|
.type(isString, s => toViewer(key, (a: any) => toFunc(a, s)(a)))
|
|
@@ -55,15 +55,13 @@ const toViewers = (views: Views): Viewer[] =>
|
|
|
55
55
|
.map(([k, v]) => toViewer(k, v));
|
|
56
56
|
|
|
57
57
|
export class View<V = Json> {
|
|
58
|
-
constructor(private views: Views<V> = {} as Views<V>, readonly startsFrom: 'scratch' | 'source' = 'scratch', readonly viewers: Viewer[] = toViewers(views)) {
|
|
59
|
-
}
|
|
58
|
+
constructor(private views: Views<V> = {} as Views<V>, readonly startsFrom: 'scratch' | 'source' = 'scratch', readonly viewers: Viewer[] = toViewers(views)) {}
|
|
60
59
|
|
|
61
60
|
get fromSource(): View<V> {
|
|
62
61
|
return new View(this.views, 'source', this.viewers);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
from = <T = unknown>(source: T | T[]): T extends [] ? V[] : V =>
|
|
66
|
-
isArray(source) ? source.map(s => this.reduce(asJson(s))) : this.reduce(asJson(source));
|
|
64
|
+
from = <T = unknown>(source: T | T[]): T extends [] ? V[] : V => (isArray(source) ? source.map(s => this.reduce(asJson(s))) : this.reduce(asJson(source)));
|
|
67
65
|
|
|
68
66
|
same = (one?: unknown, another?: unknown): boolean => isEqual(this.from(one), this.from(another));
|
|
69
67
|
|
|
@@ -80,11 +78,11 @@ export const views = {
|
|
|
80
78
|
keepOr: (alt?: string) => (a: unknown, key?: string) => traverse(a, key) ?? alt,
|
|
81
79
|
or:
|
|
82
80
|
(key: string, alt = '') =>
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
(a: unknown) =>
|
|
82
|
+
traverse(a, key) ?? alt,
|
|
85
83
|
value: (value: unknown) => () => value,
|
|
86
84
|
to:
|
|
87
85
|
<T>(ctor: Constructor<T>) =>
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
(a: unknown, key?: string) =>
|
|
87
|
+
new ctor(traverse(a, key)),
|
|
90
88
|
};
|