ballerina-core 1.0.113 → 1.0.115
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/package.json
CHANGED
|
@@ -664,7 +664,7 @@ export const fromAPIRawValue =
|
|
|
664
664
|
let errors: List<string> = List();
|
|
665
665
|
t.fields.forEach((fieldType, fieldName) => {
|
|
666
666
|
const fieldValue = raw[fieldName];
|
|
667
|
-
if (fieldValue == undefined) {
|
|
667
|
+
if (fieldValue != null && fieldValue == undefined) {
|
|
668
668
|
return;
|
|
669
669
|
}
|
|
670
670
|
const parsedValue = fromAPIRawValue(
|
|
@@ -705,7 +705,7 @@ export const fromAPIRawValue =
|
|
|
705
705
|
let rowResult: Map<string, PredicateValue> = Map();
|
|
706
706
|
tableType.fields.forEach((fieldType, fieldName) => {
|
|
707
707
|
const fieldValue = row[fieldName];
|
|
708
|
-
if (fieldValue == undefined) {
|
|
708
|
+
if (fieldValue != null && fieldValue == undefined) {
|
|
709
709
|
return;
|
|
710
710
|
}
|
|
711
711
|
const parsedValue = fromAPIRawValue(
|
|
@@ -505,6 +505,7 @@ export type ParsedLaunchers = {
|
|
|
505
505
|
parseGlobalConfiguration: (
|
|
506
506
|
raw: any,
|
|
507
507
|
) => ValueOrErrors<PredicateValue, string>;
|
|
508
|
+
parsedFormType: ParsedType<any>;
|
|
508
509
|
}
|
|
509
510
|
>;
|
|
510
511
|
};
|
|
@@ -663,7 +664,7 @@ export const parseFormsToLaunchers =
|
|
|
663
664
|
disabledFields: _.disabledFields,
|
|
664
665
|
globalConfiguration: parentContext.globalConfiguration.sync,
|
|
665
666
|
})),
|
|
666
|
-
}
|
|
667
|
+
} as any),
|
|
667
668
|
)
|
|
668
669
|
.withViewFromProps((props) => props.context.submitButtonWrapper)
|
|
669
670
|
.mapForeignMutationsFromProps(
|
|
@@ -874,7 +875,7 @@ export const parseFormsToLaunchers =
|
|
|
874
875
|
injectedPrimitives,
|
|
875
876
|
)(value),
|
|
876
877
|
})),
|
|
877
|
-
}
|
|
878
|
+
} as any),
|
|
878
879
|
)
|
|
879
880
|
.withViewFromProps((props) => props.context.containerWrapper)
|
|
880
881
|
.mapForeignMutationsFromProps(
|
|
@@ -884,6 +885,7 @@ export const parseFormsToLaunchers =
|
|
|
884
885
|
initialState.formFieldStates,
|
|
885
886
|
initialState.commonFormState,
|
|
886
887
|
),
|
|
888
|
+
parsedFormType: formType,
|
|
887
889
|
fromApiParser: (value: any): ValueOrErrors<PredicateValue, string> =>
|
|
888
890
|
fromAPIRawValue(
|
|
889
891
|
formType,
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import { AsyncState } from "../../async/state";
|
|
2
|
+
import { Coroutine } from "../../coroutines/state";
|
|
3
|
+
import { Unit } from "../../fun/domains/unit/state";
|
|
2
4
|
import { replaceWith } from "../../fun/domains/updater/domains/replaceWith/state";
|
|
3
|
-
import { InfiniteStreamState, StreamPosition } from "../state";
|
|
5
|
+
import { InfiniteStreamState, InfiniteStreamWritableState, StreamPosition } from "../state";
|
|
4
6
|
import { StreamCo } from "./builder";
|
|
5
7
|
|
|
6
|
-
export const InfiniteStreamLoader = <Element extends { Id: string }>() => {
|
|
8
|
+
export const InfiniteStreamLoader = <Element extends { Id: string }>(maxRetries: number = 3) => {
|
|
7
9
|
const Co = StreamCo<Element>();
|
|
8
10
|
const updaters = InfiniteStreamState<Element>().Updaters;
|
|
9
|
-
// const operations = InfiniteStreamState<Element>().Operations;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Co.GetState().then((current) => {
|
|
18
|
-
return Co.Await(
|
|
12
|
+
const attemptLoad = (retryCount = 0): Coroutine<InfiniteStreamWritableState<Element>, InfiniteStreamWritableState<Element>, Unit> => Co.GetState().then((current) => {
|
|
13
|
+
if (current.loadingMore.kind === "loaded") {
|
|
14
|
+
return Co.Return(true);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return Co.Await(
|
|
19
18
|
() => current.getChunk([current.position]),
|
|
20
19
|
() => "error" as const,
|
|
21
|
-
).then((apiResult) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
).then((apiResult) => apiResult.kind === "l" ? Co.SetState(
|
|
21
|
+
updaters.Core.loadingMore(
|
|
22
|
+
replaceWith(AsyncState.Default.loaded({})),
|
|
23
|
+
).then(
|
|
24
|
+
updaters.Coroutine.addLoadedChunk(
|
|
25
|
+
current.position.chunkIndex,
|
|
26
|
+
apiResult.value,
|
|
26
27
|
).then(
|
|
27
|
-
updaters.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
).then(
|
|
31
|
-
updaters.Core.position(
|
|
32
|
-
StreamPosition.Updaters.Core.shouldLoad(
|
|
33
|
-
replaceWith<StreamPosition["shouldLoad"]>(false),
|
|
34
|
-
),
|
|
28
|
+
updaters.Core.position(
|
|
29
|
+
StreamPosition.Updaters.Core.shouldLoad(
|
|
30
|
+
replaceWith<StreamPosition["shouldLoad"]>(false),
|
|
35
31
|
),
|
|
36
32
|
),
|
|
37
33
|
),
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
),
|
|
35
|
+
) : retryCount < maxRetries ? Co.Wait(500).then(() => attemptLoad(retryCount + 1)) : Co.Return(false)
|
|
36
|
+
)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return Co.Seq([
|
|
40
|
+
Co.SetState(
|
|
41
|
+
updaters.Core.loadingMore(replaceWith(AsyncState.Default.loading())),
|
|
44
42
|
),
|
|
43
|
+
attemptLoad(),
|
|
44
|
+
Co.GetState().then((current) => current.loadingMore.kind !== "loaded" ? Co.SetState(updaters.Core.loadingMore(replaceWith(AsyncState.Default.error("max retries reached")))) : Co.Wait(0))
|
|
45
45
|
]);
|
|
46
46
|
};
|
|
47
47
|
|