ballerina-core 1.0.193 → 1.0.195
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/bin/main.d.ts +2 -0
- package/bin/main.d.ts.map +1 -1
- package/bin/main.js +2 -0
- package/bin/main.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/built-ins/state.d.ts +19 -0
- package/bin/src/forms/domains/dispatched-forms/built-ins/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/built-ins/state.js +80 -11
- package/bin/src/forms/domains/dispatched-forms/built-ins/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/apis/state.d.ts +28 -40
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/apis/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/apis/state.js +39 -30
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/apis/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/domains/readOnly/state.d.ts +59 -0
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/domains/readOnly/state.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/domains/readOnly/state.js +56 -0
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/domains/readOnly/state.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/state.d.ts +6 -0
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/state.js +26 -18
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/forms/domains/renderer/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/types/state.d.ts +18 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/types/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/types/state.js +49 -33
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/types/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/state.js +6 -0
- package/bin/src/forms/domains/dispatched-forms/deserializer/domains/specification/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/state.d.ts +2 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/template.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/template.js +12 -10
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/list/template.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/lookup-type/state.d.ts +4 -2
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/lookup-type/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/lookup-type/template.d.ts +2 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/lookup-type/template.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/lookup-type/template.js +3 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/lookup-type/template.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_debouncer.d.ts +55 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_debouncer.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_debouncer.js +24 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_debouncer.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeOne.d.ts +61 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeOne.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeOne.js +79 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeOne.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeStream.d.ts +52 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeStream.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeStream.js +36 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeStream.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/builder.d.ts +4004 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/builder.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/builder.js +6 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/builder.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/runner.d.ts +26 -62
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/runner.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/runner.js +26 -182
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/runner.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/state.d.ts +64 -244
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/state.js +39 -29
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.d.ts +5 -14
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.js +62 -305
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/state.d.ts +74 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/state.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/state.js +22 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/state.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/template.d.ts +50 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/template.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/template.js +66 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/readOnly/template.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/state.d.ts +2 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/template.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/template.js +9 -4
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/record/template.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/table/template.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/table/template.js +0 -3
- package/bin/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/table/template.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/deltas/state.d.ts +4 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/deltas/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/deltas/state.js +9 -12
- package/bin/src/forms/domains/dispatched-forms/runner/domains/deltas/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/lookup/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/lookup/state.js +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/lookup/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/one/state.d.ts +2 -2
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/one/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/one/state.js +44 -25
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/one/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/readOnly/state.d.ts +28 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/readOnly/state.d.ts.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/readOnly/state.js +41 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/readOnly/state.js.map +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/table/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/table/state.js +1 -0
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/table/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/state.js +25 -15
- package/bin/src/forms/domains/dispatched-forms/runner/domains/dispatcher/state.js.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/traversal/state.d.ts.map +1 -1
- package/bin/src/forms/domains/dispatched-forms/runner/domains/traversal/state.js +90 -11
- package/bin/src/forms/domains/dispatched-forms/runner/domains/traversal/state.js.map +1 -1
- package/bin/src/forms/domains/parser/domains/predicates/domains/extractor/state.d.ts.map +1 -1
- package/bin/src/forms/domains/parser/domains/predicates/domains/extractor/state.js +1 -0
- package/bin/src/forms/domains/parser/domains/predicates/domains/extractor/state.js.map +1 -1
- package/bin/src/forms/domains/parser/domains/predicates/state.d.ts +9 -2
- package/bin/src/forms/domains/parser/domains/predicates/state.d.ts.map +1 -1
- package/bin/src/forms/domains/parser/domains/predicates/state.js +11 -0
- package/bin/src/forms/domains/parser/domains/predicates/state.js.map +1 -1
- package/package.json +1 -1
- package/src/forms/domains/dispatched-forms/built-ins/state.ts +59 -33
- package/src/forms/domains/dispatched-forms/deserializer/domains/specification/domains/apis/state.ts +65 -71
- package/src/forms/domains/dispatched-forms/deserializer/state.ts +11 -8
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_debouncer.ts +36 -0
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeOne.ts +72 -0
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/_initializeStream.ts +42 -0
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/builder.ts +53 -0
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/coroutines/runner.ts +34 -237
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/state.ts +107 -110
- package/src/forms/domains/dispatched-forms/runner/domains/abstract-renderers/one/template.tsx +71 -313
- package/src/forms/domains/dispatched-forms/runner/domains/deltas/state.ts +2 -0
- package/src/forms/domains/dispatched-forms/runner/domains/dispatcher/domains/one/state.ts +33 -26
|
@@ -2,269 +2,59 @@ import { ValueInfiniteStreamLoader } from "../../../../../../../../value-infinit
|
|
|
2
2
|
import { ValueInfiniteStreamState } from "../../../../../../../../value-infinite-data-stream/state";
|
|
3
3
|
import {
|
|
4
4
|
OneAbstractRendererForeignMutationsExpected,
|
|
5
|
-
OneAbstractRendererReadonlyContext,
|
|
6
5
|
OneAbstractRendererState,
|
|
7
6
|
} from "../state";
|
|
8
7
|
import {
|
|
9
|
-
Debounce,
|
|
10
8
|
SimpleCallback,
|
|
11
9
|
Value,
|
|
12
|
-
CoTypedFactory,
|
|
13
|
-
ValueOption,
|
|
14
10
|
Debounced,
|
|
15
|
-
AsyncState,
|
|
16
|
-
Synchronize,
|
|
17
|
-
PredicateValue,
|
|
18
11
|
Unit,
|
|
19
|
-
Synchronized,
|
|
20
12
|
ValueOrErrors,
|
|
21
13
|
ValueRecord,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
replaceWith,
|
|
25
|
-
id as idUpdater,
|
|
26
|
-
DispatchDelta,
|
|
14
|
+
BaseFlags,
|
|
15
|
+
Sum,
|
|
27
16
|
} from "../../../../../../../../../main";
|
|
28
17
|
import { Map } from "immutable";
|
|
18
|
+
import { Co, DebouncerCo, InitializeCo } from "./builder";
|
|
19
|
+
import { initializeOne } from "./_initializeOne";
|
|
20
|
+
import { initializeStream } from "./_initializeStream";
|
|
21
|
+
import { debouncer } from "./_debouncer";
|
|
29
22
|
|
|
30
|
-
const
|
|
31
|
-
CoTypedFactory<
|
|
32
|
-
OneAbstractRendererReadonlyContext<CustomPresentationContext, ExtraContext>,
|
|
33
|
-
OneAbstractRendererState
|
|
34
|
-
>();
|
|
35
|
-
|
|
36
|
-
const DebouncerCo = <CustomPresentationContext = Unit, ExtraContext = Unit>() =>
|
|
37
|
-
CoTypedFactory<
|
|
38
|
-
OneAbstractRendererReadonlyContext<
|
|
39
|
-
CustomPresentationContext,
|
|
40
|
-
ExtraContext
|
|
41
|
-
> & {
|
|
42
|
-
onDebounce: SimpleCallback<void>;
|
|
43
|
-
},
|
|
44
|
-
OneAbstractRendererState
|
|
45
|
-
>();
|
|
46
|
-
|
|
47
|
-
const DebouncedCo = CoTypedFactory<
|
|
48
|
-
{ onDebounce: SimpleCallback<void> },
|
|
49
|
-
Value<Map<string, string>>
|
|
50
|
-
>();
|
|
51
|
-
|
|
52
|
-
const intializeOne = <
|
|
53
|
-
CustomPresentationContext = Unit,
|
|
54
|
-
ExtraContext = Unit,
|
|
55
|
-
>() =>
|
|
56
|
-
Co<CustomPresentationContext, ExtraContext>()
|
|
57
|
-
.GetState()
|
|
58
|
-
.then((current) => {
|
|
59
|
-
if (current.value == undefined) {
|
|
60
|
-
return Co<CustomPresentationContext, ExtraContext>().Wait(0);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/// When initailising, in both stages, inject the id to the get chunk
|
|
64
|
-
|
|
65
|
-
const local = current.bindings.get("local");
|
|
66
|
-
if (local == undefined) {
|
|
67
|
-
console.error(
|
|
68
|
-
`local binding is undefined when intialising one\n... in couroutine for\n...${current.domNodeAncestorPath + "[one]"}`,
|
|
69
|
-
);
|
|
70
|
-
return Co<CustomPresentationContext, ExtraContext>().Wait(0);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!PredicateValue.Operations.IsRecord(local)) {
|
|
74
|
-
console.error(
|
|
75
|
-
`local binding is not a record when intialising one\n... in couroutine for\n...${current.domNodeAncestorPath + "[one]"}`,
|
|
76
|
-
);
|
|
77
|
-
return Co<CustomPresentationContext, ExtraContext>().Wait(0);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (!local.fields.has("Id")) {
|
|
81
|
-
console.error(
|
|
82
|
-
`local binding is missing Id (check casing) when intialising one\n... in couroutine for\n...${current.domNodeAncestorPath + "[one]"}`,
|
|
83
|
-
);
|
|
84
|
-
return Co<CustomPresentationContext, ExtraContext>().Wait(0);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const id = local.fields.get("Id")!; // safe because of above check;
|
|
88
|
-
if (!PredicateValue.Operations.IsString(id)) {
|
|
89
|
-
console.error(
|
|
90
|
-
`local Id is not a string when intialising one\n... in couroutine for\n...${current.domNodeAncestorPath + "[one]"}`,
|
|
91
|
-
);
|
|
92
|
-
return Co<CustomPresentationContext, ExtraContext>().Wait(0);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const initializationCompletedCo = Co<
|
|
96
|
-
CustomPresentationContext,
|
|
97
|
-
ExtraContext
|
|
98
|
-
>().SetState(
|
|
99
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children
|
|
100
|
-
.initializationStatus(
|
|
101
|
-
replaceWith<
|
|
102
|
-
OneAbstractRendererState["customFormState"]["initializationStatus"]
|
|
103
|
-
>("initialized"),
|
|
104
|
-
)
|
|
105
|
-
.thenMany([
|
|
106
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children.previousRemoteEntityVersionIdentifier(
|
|
107
|
-
replaceWith(current.remoteEntityVersionIdentifier),
|
|
108
|
-
),
|
|
109
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children.shouldReinitialize(
|
|
110
|
-
replaceWith(false),
|
|
111
|
-
),
|
|
112
|
-
current.customFormState.initializationStatus == "reinitializing" &&
|
|
113
|
-
current.customFormState.status == "open"
|
|
114
|
-
? OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
|
|
115
|
-
ValueInfiniteStreamState.Updaters.Template.loadMore(),
|
|
116
|
-
)
|
|
117
|
-
: idUpdater,
|
|
118
|
-
]),
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
const hasInitialValue =
|
|
122
|
-
(PredicateValue.Operations.IsOption(current.value) &&
|
|
123
|
-
current.value.isSome) ||
|
|
124
|
-
PredicateValue.Operations.IsUnit(current.value);
|
|
125
|
-
if (hasInitialValue) {
|
|
126
|
-
const initialValue =
|
|
127
|
-
PredicateValue.Operations.IsOption(current.value) &&
|
|
128
|
-
current.value.isSome &&
|
|
129
|
-
PredicateValue.Operations.IsRecord(current.value.value)
|
|
130
|
-
? current.value.value
|
|
131
|
-
: PredicateValue.Default.unit();
|
|
132
|
-
|
|
133
|
-
return Co<CustomPresentationContext, ExtraContext>().Seq([
|
|
134
|
-
Co<CustomPresentationContext, ExtraContext>().SetState(
|
|
135
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children
|
|
136
|
-
.selectedValue(
|
|
137
|
-
Synchronized.Updaters.sync(
|
|
138
|
-
AsyncState.Updaters.toLoaded(
|
|
139
|
-
ValueOrErrors.Default.return(initialValue),
|
|
140
|
-
),
|
|
141
|
-
),
|
|
142
|
-
)
|
|
143
|
-
.then(
|
|
144
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
|
|
145
|
-
replaceWith(
|
|
146
|
-
ValueInfiniteStreamState.Default(
|
|
147
|
-
100,
|
|
148
|
-
current.customFormState.getChunkWithParams(id)(
|
|
149
|
-
current.customFormState.streamParams.value,
|
|
150
|
-
),
|
|
151
|
-
),
|
|
152
|
-
),
|
|
153
|
-
),
|
|
154
|
-
),
|
|
155
|
-
),
|
|
156
|
-
initializationCompletedCo,
|
|
157
|
-
]);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return Co<CustomPresentationContext, ExtraContext>().Seq([
|
|
161
|
-
Co<CustomPresentationContext, ExtraContext>().SetState(
|
|
162
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
|
|
163
|
-
replaceWith(
|
|
164
|
-
ValueInfiniteStreamState.Default(
|
|
165
|
-
100,
|
|
166
|
-
current.customFormState.getChunkWithParams(id)(
|
|
167
|
-
current.customFormState.streamParams.value,
|
|
168
|
-
),
|
|
169
|
-
),
|
|
170
|
-
),
|
|
171
|
-
),
|
|
172
|
-
),
|
|
173
|
-
Synchronize<ValueUnit, ValueOrErrors<ValueRecord | ValueUnit, string>>(
|
|
174
|
-
(_) =>
|
|
175
|
-
current.getApi(id).then((value) => {
|
|
176
|
-
return current.fromApiParser(value).Then((result) => {
|
|
177
|
-
return ValueOrErrors.Default.return(result);
|
|
178
|
-
});
|
|
179
|
-
}),
|
|
180
|
-
() => "transient failure",
|
|
181
|
-
5,
|
|
182
|
-
150,
|
|
183
|
-
).embed(
|
|
184
|
-
(_) => _.customFormState.selectedValue,
|
|
185
|
-
(_) =>
|
|
186
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children.selectedValue(
|
|
187
|
-
_,
|
|
188
|
-
),
|
|
189
|
-
),
|
|
190
|
-
initializationCompletedCo,
|
|
191
|
-
]);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
const debouncer = <CustomPresentationContext = Unit, ExtraContext = Unit>() =>
|
|
195
|
-
DebouncerCo<CustomPresentationContext, ExtraContext>().Repeat(
|
|
196
|
-
DebouncerCo<CustomPresentationContext, ExtraContext>().Seq([
|
|
197
|
-
Debounce<
|
|
198
|
-
Value<Map<string, string>>,
|
|
199
|
-
{ onDebounce: SimpleCallback<void> }
|
|
200
|
-
>(
|
|
201
|
-
DebouncedCo.GetState()
|
|
202
|
-
.then((current) => DebouncedCo.Do(() => current.onDebounce()))
|
|
203
|
-
//.SetState(SearchNow.Updaters.reloadsRequested(_ => _ + 1))
|
|
204
|
-
.then((_) => DebouncedCo.Return("success")),
|
|
205
|
-
250,
|
|
206
|
-
).embed(
|
|
207
|
-
(_) => ({
|
|
208
|
-
..._.customFormState.streamParams,
|
|
209
|
-
onDebounce: _.onDebounce,
|
|
210
|
-
}),
|
|
211
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children
|
|
212
|
-
.streamParams,
|
|
213
|
-
),
|
|
214
|
-
DebouncerCo<CustomPresentationContext, ExtraContext>().Wait(0),
|
|
215
|
-
]),
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
const reinitialize = <
|
|
219
|
-
CustomPresentationContext = Unit,
|
|
220
|
-
ExtraContext = Unit,
|
|
221
|
-
>() =>
|
|
222
|
-
Co<CustomPresentationContext, ExtraContext>()
|
|
223
|
-
.GetState()
|
|
224
|
-
.then((_) => {
|
|
225
|
-
return Co<CustomPresentationContext, ExtraContext>().SetState(
|
|
226
|
-
OneAbstractRendererState.Updaters.Core.customFormState.children.initializationStatus(
|
|
227
|
-
replaceWith<
|
|
228
|
-
OneAbstractRendererState["customFormState"]["initializationStatus"]
|
|
229
|
-
>("reinitializing"),
|
|
230
|
-
),
|
|
231
|
-
);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
export const reinitializeOneRunner = <
|
|
23
|
+
export const initializeOneRunner = <
|
|
235
24
|
CustomPresentationContext = Unit,
|
|
236
|
-
Flags =
|
|
25
|
+
Flags = BaseFlags,
|
|
237
26
|
ExtraContext = Unit,
|
|
238
27
|
>() =>
|
|
239
|
-
|
|
28
|
+
InitializeCo<CustomPresentationContext, ExtraContext>().Template<
|
|
240
29
|
OneAbstractRendererForeignMutationsExpected<Flags>
|
|
241
|
-
>(
|
|
30
|
+
>(initializeOne<CustomPresentationContext, ExtraContext>(), {
|
|
242
31
|
interval: 15,
|
|
243
32
|
runFilter: (props) =>
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
33
|
+
// if the value is some, we already have something to pass to the renderers
|
|
34
|
+
// -> we don't have to run the initialization coroutine
|
|
35
|
+
// if the inner value is unit, we are rendering a partial one
|
|
36
|
+
props.context.value.kind === "option" &&
|
|
37
|
+
!props.context.value.isSome &&
|
|
38
|
+
props.context.getApi != undefined,
|
|
248
39
|
});
|
|
249
40
|
|
|
250
|
-
export const
|
|
41
|
+
export const initializeStreamRunner = <
|
|
251
42
|
CustomPresentationContext = Unit,
|
|
252
|
-
Flags =
|
|
43
|
+
Flags = BaseFlags,
|
|
253
44
|
ExtraContext = Unit,
|
|
254
45
|
>() =>
|
|
255
46
|
Co<CustomPresentationContext, ExtraContext>().Template<
|
|
256
47
|
OneAbstractRendererForeignMutationsExpected<Flags>
|
|
257
|
-
>(
|
|
48
|
+
>(initializeStream<CustomPresentationContext, ExtraContext>(), {
|
|
258
49
|
interval: 15,
|
|
259
50
|
runFilter: (props) =>
|
|
260
|
-
props.context.customFormState.
|
|
261
|
-
|
|
262
|
-
props.context.customFormState.initializationStatus === "reinitializing",
|
|
51
|
+
props.context.customFormState.stream.kind === "r" &&
|
|
52
|
+
props.context.customFormState.getChunkWithParams !== undefined,
|
|
263
53
|
});
|
|
264
54
|
|
|
265
55
|
export const oneTableDebouncerRunner = <
|
|
266
56
|
CustomPresentationContext = Unit,
|
|
267
|
-
Flags =
|
|
57
|
+
Flags = BaseFlags,
|
|
268
58
|
ExtraContext = Unit,
|
|
269
59
|
>() =>
|
|
270
60
|
DebouncerCo<CustomPresentationContext, ExtraContext>().Template<
|
|
@@ -274,26 +64,33 @@ export const oneTableDebouncerRunner = <
|
|
|
274
64
|
runFilter: (props) =>
|
|
275
65
|
Debounced.Operations.shouldCoroutineRun(
|
|
276
66
|
props.context.customFormState.streamParams,
|
|
277
|
-
),
|
|
67
|
+
) && props.context.customFormState.getChunkWithParams !== undefined,
|
|
278
68
|
});
|
|
279
69
|
|
|
280
70
|
export const oneTableLoaderRunner = <
|
|
281
71
|
CustomPresentationContext = Unit,
|
|
282
|
-
Flags =
|
|
72
|
+
Flags = BaseFlags,
|
|
283
73
|
ExtraContext = Unit,
|
|
284
74
|
>() =>
|
|
285
75
|
Co<CustomPresentationContext, ExtraContext>().Template<
|
|
286
76
|
OneAbstractRendererForeignMutationsExpected<Flags>
|
|
287
77
|
>(
|
|
288
78
|
ValueInfiniteStreamLoader().embed(
|
|
289
|
-
(_) =>
|
|
290
|
-
|
|
79
|
+
(_) =>
|
|
80
|
+
_.customFormState.stream.kind === "l"
|
|
81
|
+
? _.customFormState.stream.value
|
|
82
|
+
: undefined,
|
|
83
|
+
(upd) =>
|
|
84
|
+
OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
|
|
85
|
+
Sum.Updaters.left(upd),
|
|
86
|
+
),
|
|
291
87
|
),
|
|
292
88
|
{
|
|
293
89
|
interval: 15,
|
|
294
90
|
runFilter: (props) =>
|
|
91
|
+
props.context.customFormState.stream.kind === "l" &&
|
|
295
92
|
ValueInfiniteStreamState.Operations.shouldCoroutineRun(
|
|
296
|
-
props.context.customFormState.stream,
|
|
93
|
+
props.context.customFormState.stream.value,
|
|
297
94
|
),
|
|
298
95
|
},
|
|
299
96
|
);
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
OneType,
|
|
15
15
|
ValueOrErrors,
|
|
16
16
|
Guid,
|
|
17
|
-
Synchronized,
|
|
18
17
|
Unit,
|
|
19
18
|
Template,
|
|
20
19
|
ValueRecord,
|
|
@@ -23,13 +22,15 @@ import {
|
|
|
23
22
|
MapRepo,
|
|
24
23
|
BasicFun2,
|
|
25
24
|
Value,
|
|
26
|
-
replaceWith,
|
|
27
25
|
ValueCallbackWithOptionalFlags,
|
|
28
26
|
VoidCallbackWithOptionalFlags,
|
|
29
27
|
DispatchOnChange,
|
|
30
28
|
CommonAbstractRendererState,
|
|
31
29
|
DispatchDelta,
|
|
32
30
|
CommonAbstractRendererViewOnlyReadonlyContext,
|
|
31
|
+
BaseFlags,
|
|
32
|
+
Sum,
|
|
33
|
+
PredicateValue,
|
|
33
34
|
} from "../../../../../../../../main";
|
|
34
35
|
import { Debounced } from "../../../../../../../debounced/state";
|
|
35
36
|
|
|
@@ -42,7 +43,7 @@ export type OneAbstractRendererReadonlyContext<
|
|
|
42
43
|
CustomPresentationContext,
|
|
43
44
|
ExtraContext
|
|
44
45
|
> & {
|
|
45
|
-
getApi
|
|
46
|
+
getApi?: BasicFun<Guid, Promise<unknown>>;
|
|
46
47
|
fromApiParser: (value: unknown) => ValueOrErrors<ValueRecord, string>;
|
|
47
48
|
remoteEntityVersionIdentifier: string;
|
|
48
49
|
};
|
|
@@ -51,50 +52,40 @@ export type OneAbstractRendererState = CommonAbstractRendererState & {
|
|
|
51
52
|
customFormState: {
|
|
52
53
|
detailsState: RecordAbstractRendererState;
|
|
53
54
|
previewStates: Map<string, RecordAbstractRendererState>;
|
|
54
|
-
selectedValue: Synchronized<
|
|
55
|
-
ValueUnit,
|
|
56
|
-
ValueOrErrors<ValueRecord | ValueUnit, string>
|
|
57
|
-
>;
|
|
58
55
|
streamParams: Debounced<Value<Map<string, string>>>;
|
|
59
56
|
status: "open" | "closed";
|
|
60
|
-
stream: ValueInfiniteStreamState
|
|
61
|
-
getChunkWithParams:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
shouldReinitialize: boolean;
|
|
57
|
+
stream: Sum<ValueInfiniteStreamState, "not initialized">;
|
|
58
|
+
getChunkWithParams:
|
|
59
|
+
| BasicFun<
|
|
60
|
+
string,
|
|
61
|
+
BasicFun<Map<string, string>, ValueInfiniteStreamState["getChunk"]>
|
|
62
|
+
>
|
|
63
|
+
| undefined;
|
|
68
64
|
};
|
|
69
65
|
};
|
|
70
66
|
|
|
71
67
|
export const OneAbstractRendererState = {
|
|
72
68
|
Default: (
|
|
73
|
-
getChunk:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
getChunk:
|
|
70
|
+
| BasicFun<
|
|
71
|
+
string,
|
|
72
|
+
BasicFun<Map<string, string>, ValueInfiniteStreamState["getChunk"]>
|
|
73
|
+
>
|
|
74
|
+
| undefined,
|
|
77
75
|
): OneAbstractRendererState => ({
|
|
78
76
|
...CommonAbstractRendererState.Default(),
|
|
79
77
|
customFormState: {
|
|
80
78
|
detailsState: RecordAbstractRendererState.Default.zero(),
|
|
81
79
|
previewStates: Map(),
|
|
82
|
-
selectedValue: Synchronized.Default(ValueUnit.Default()),
|
|
83
80
|
streamParams: Debounced.Default(Value.Default(Map())),
|
|
84
81
|
status: "closed",
|
|
85
82
|
getChunkWithParams: getChunk,
|
|
86
|
-
stream:
|
|
87
|
-
initializationStatus: "not initialized",
|
|
88
|
-
previousRemoteEntityVersionIdentifier: "",
|
|
89
|
-
shouldReinitialize: false,
|
|
83
|
+
stream: Sum.Default.right("not initialized"),
|
|
90
84
|
},
|
|
91
85
|
}),
|
|
92
86
|
Updaters: {
|
|
93
87
|
Core: {
|
|
94
88
|
...simpleUpdaterWithChildren<OneAbstractRendererState>()({
|
|
95
|
-
...simpleUpdater<OneAbstractRendererState["customFormState"]>()(
|
|
96
|
-
"selectedValue",
|
|
97
|
-
),
|
|
98
89
|
...simpleUpdater<OneAbstractRendererState["customFormState"]>()(
|
|
99
90
|
"status",
|
|
100
91
|
),
|
|
@@ -107,15 +98,6 @@ export const OneAbstractRendererState = {
|
|
|
107
98
|
...simpleUpdater<OneAbstractRendererState["customFormState"]>()(
|
|
108
99
|
"detailsState",
|
|
109
100
|
),
|
|
110
|
-
...simpleUpdater<OneAbstractRendererState["customFormState"]>()(
|
|
111
|
-
"previousRemoteEntityVersionIdentifier",
|
|
112
|
-
),
|
|
113
|
-
...simpleUpdater<OneAbstractRendererState["customFormState"]>()(
|
|
114
|
-
"shouldReinitialize",
|
|
115
|
-
),
|
|
116
|
-
...simpleUpdater<OneAbstractRendererState["customFormState"]>()(
|
|
117
|
-
"initializationStatus",
|
|
118
|
-
),
|
|
119
101
|
...simpleUpdater<OneAbstractRendererState["customFormState"]>()(
|
|
120
102
|
"previewStates",
|
|
121
103
|
),
|
|
@@ -136,16 +118,54 @@ export const OneAbstractRendererState = {
|
|
|
136
118
|
Value.Updaters.value(MapRepo.Updaters.upsert(key, () => "", _)),
|
|
137
119
|
),
|
|
138
120
|
),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
Operations: {
|
|
124
|
+
GetIdFromContext: <CustomPresentationContext = Unit, ExtraContext = Unit>(
|
|
125
|
+
ctx: OneAbstractRendererReadonlyContext<
|
|
126
|
+
CustomPresentationContext,
|
|
127
|
+
ExtraContext
|
|
128
|
+
>,
|
|
129
|
+
): ValueOrErrors<string, string | undefined> => {
|
|
130
|
+
if (ctx.value == undefined) {
|
|
131
|
+
return ValueOrErrors.Default.throwOne(undefined);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/// When initailising, in both stages, inject the id to the get chunk
|
|
135
|
+
|
|
136
|
+
const local = ctx.bindings.get("local");
|
|
137
|
+
if (local == undefined) {
|
|
138
|
+
return ValueOrErrors.Default.throwOne(
|
|
139
|
+
`local binding is undefined when intialising one`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!PredicateValue.Operations.IsRecord(local)) {
|
|
144
|
+
return ValueOrErrors.Default.throwOne(
|
|
145
|
+
`local binding is not a record when intialising one\n... in couroutine for\n...${ctx.domNodeAncestorPath + "[one]"}`,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (!local.fields.has("Id")) {
|
|
150
|
+
return ValueOrErrors.Default.throwOne(
|
|
151
|
+
`local binding is missing Id (check casing) when intialising one\n... in couroutine for\n...${ctx.domNodeAncestorPath + "[one]"}`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const id = local.fields.get("Id")!; // safe because of above check;
|
|
156
|
+
if (!PredicateValue.Operations.IsString(id)) {
|
|
157
|
+
return ValueOrErrors.Default.throwOne(
|
|
158
|
+
`local Id is not a string when intialising one\n... in couroutine for\n...${ctx.domNodeAncestorPath + "[one]"}`,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return ValueOrErrors.Default.return(id);
|
|
143
163
|
},
|
|
144
164
|
},
|
|
145
165
|
};
|
|
146
166
|
|
|
147
|
-
export type OneAbstractRendererForeignMutationsExpected<Flags =
|
|
148
|
-
onChange: DispatchOnChange<ValueOption | ValueUnit,
|
|
167
|
+
export type OneAbstractRendererForeignMutationsExpected<Flags = BaseFlags> = {
|
|
168
|
+
onChange: DispatchOnChange<ValueOption | ValueUnit, BaseFlags>;
|
|
149
169
|
clear?: () => void;
|
|
150
170
|
delete?: (delta: DispatchDelta<Flags>) => void;
|
|
151
171
|
select?: (
|
|
@@ -158,81 +178,58 @@ export type OneAbstractRendererForeignMutationsExpected<Flags = Unit> = {
|
|
|
158
178
|
) => void;
|
|
159
179
|
};
|
|
160
180
|
|
|
161
|
-
export type OneAbstractRendererViewForeignMutationsExpected<Flags =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
};
|
|
181
|
+
export type OneAbstractRendererViewForeignMutationsExpected<Flags = BaseFlags> =
|
|
182
|
+
{
|
|
183
|
+
onChange: DispatchOnChange<ValueOption | ValueUnit, Flags>;
|
|
184
|
+
toggleOpen: SimpleCallback<void>;
|
|
185
|
+
setStreamParam: BasicFun2<string, string, void>;
|
|
186
|
+
select: ValueCallbackWithOptionalFlags<ValueRecord, Flags>;
|
|
187
|
+
create: ValueCallbackWithOptionalFlags<ValueRecord, Flags>;
|
|
188
|
+
delete?: VoidCallbackWithOptionalFlags<Flags>;
|
|
189
|
+
clear?: SimpleCallback<void>;
|
|
190
|
+
loadMore: SimpleCallback<void>;
|
|
191
|
+
};
|
|
172
192
|
|
|
173
193
|
export type OneAbstractRendererView<
|
|
174
194
|
CustomPresentationContext = Unit,
|
|
175
|
-
Flags =
|
|
195
|
+
Flags = BaseFlags,
|
|
176
196
|
ExtraContext = Unit,
|
|
177
197
|
> = View<
|
|
178
|
-
|
|
179
|
-
|
|
198
|
+
OneAbstractRendererReadonlyContext<
|
|
199
|
+
CustomPresentationContext,
|
|
200
|
+
ExtraContext
|
|
201
|
+
> & {
|
|
202
|
+
hasMoreValues: boolean;
|
|
203
|
+
} & CommonAbstractRendererViewOnlyReadonlyContext &
|
|
204
|
+
OneAbstractRendererState,
|
|
205
|
+
OneAbstractRendererState,
|
|
206
|
+
OneAbstractRendererViewForeignMutationsExpected<Flags>,
|
|
207
|
+
{
|
|
208
|
+
DetailsRenderer?: (
|
|
209
|
+
flags: Flags | undefined,
|
|
210
|
+
) => Template<
|
|
211
|
+
OneAbstractRendererState &
|
|
180
212
|
OneAbstractRendererReadonlyContext<
|
|
181
213
|
CustomPresentationContext,
|
|
182
214
|
ExtraContext
|
|
183
215
|
>,
|
|
184
|
-
|
|
185
|
-
>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
},
|
|
204
|
-
| {
|
|
205
|
-
kind: "initialized";
|
|
206
|
-
DetailsRenderer: (flags: Flags | undefined) => Template<
|
|
207
|
-
Omit<
|
|
208
|
-
OneAbstractRendererReadonlyContext<
|
|
209
|
-
CustomPresentationContext,
|
|
210
|
-
ExtraContext
|
|
211
|
-
>,
|
|
212
|
-
"value"
|
|
213
|
-
> & {
|
|
214
|
-
value: ValueRecord | ValueUnit;
|
|
215
|
-
} & OneAbstractRendererState,
|
|
216
|
-
OneAbstractRendererState,
|
|
217
|
-
OneAbstractRendererViewForeignMutationsExpected<Flags>
|
|
218
|
-
>;
|
|
219
|
-
PreviewRenderer?: (value: ValueRecord) => (id: string) => (
|
|
220
|
-
flags: Flags | undefined,
|
|
221
|
-
) => Template<
|
|
222
|
-
Omit<
|
|
223
|
-
OneAbstractRendererReadonlyContext<
|
|
224
|
-
CustomPresentationContext,
|
|
225
|
-
ExtraContext
|
|
226
|
-
>,
|
|
227
|
-
"value"
|
|
228
|
-
> & {
|
|
229
|
-
value: ValueRecord | ValueUnit;
|
|
230
|
-
} & OneAbstractRendererState,
|
|
231
|
-
OneAbstractRendererState,
|
|
232
|
-
OneAbstractRendererViewForeignMutationsExpected<Flags>
|
|
233
|
-
>;
|
|
234
|
-
}
|
|
235
|
-
| {
|
|
236
|
-
kind: "uninitialized";
|
|
237
|
-
}
|
|
216
|
+
OneAbstractRendererState,
|
|
217
|
+
OneAbstractRendererViewForeignMutationsExpected<Flags>
|
|
218
|
+
>;
|
|
219
|
+
PreviewRenderer?: (
|
|
220
|
+
value: ValueRecord,
|
|
221
|
+
) => (
|
|
222
|
+
id: string,
|
|
223
|
+
) => (
|
|
224
|
+
flags: Flags | undefined,
|
|
225
|
+
) => Template<
|
|
226
|
+
OneAbstractRendererState &
|
|
227
|
+
OneAbstractRendererReadonlyContext<
|
|
228
|
+
CustomPresentationContext,
|
|
229
|
+
ExtraContext
|
|
230
|
+
>,
|
|
231
|
+
OneAbstractRendererState,
|
|
232
|
+
OneAbstractRendererViewForeignMutationsExpected<Flags>
|
|
233
|
+
>;
|
|
234
|
+
}
|
|
238
235
|
>;
|