ballerina-core 1.0.225 → 1.0.226

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
@@ -2,7 +2,7 @@
2
2
  "name": "ballerina-core",
3
3
  "author": "Dr. Giuseppe Maggiore",
4
4
  "private": false,
5
- "version": "1.0.225",
5
+ "version": "1.0.226",
6
6
  "main": "main.ts",
7
7
  "scripts": {
8
8
  "prettier": "prettier --write ."
@@ -1877,10 +1877,37 @@ export const dispatchToAPIRawValue =
1877
1877
  );
1878
1878
  }
1879
1879
 
1880
+ const filteredRawValues = raw.fields.filter((value) => {
1881
+ if (!PredicateValue.Operations.IsRecord(value)) {
1882
+ console.warn(
1883
+ "Received a non-record value in a multi selection, ignoring: ",
1884
+ JSON.stringify(value),
1885
+ );
1886
+ return false;
1887
+ }
1888
+
1889
+ const fieldsObject = value.fields.toJS();
1890
+
1891
+ if (
1892
+ !CollectionReference.Operations.IsCollectionReference(
1893
+ fieldsObject,
1894
+ ) &&
1895
+ !EnumReference.Operations.IsEnumReference(fieldsObject)
1896
+ ) {
1897
+ console.warn(
1898
+ "Received a non-collection or enum reference value in a multi selection, ignoring: ",
1899
+ JSON.stringify(value),
1900
+ );
1901
+ return false;
1902
+ }
1903
+ return true;
1904
+ });
1905
+
1880
1906
  const rawValue: Map<
1881
1907
  string,
1882
1908
  ValueOrErrors<CollectionReference | EnumReference, string>
1883
- > = raw.fields.map((value) => {
1909
+ > = filteredRawValues.map((value) => {
1910
+ // should never happen due to the filter above but is a type check
1884
1911
  if (!PredicateValue.Operations.IsRecord(value)) {
1885
1912
  return ValueOrErrors.Default.throwOne(
1886
1913
  `Record expected but got ${JSON.stringify(value)}`,
@@ -1900,6 +1927,7 @@ export const dispatchToAPIRawValue =
1900
1927
  )}`,
1901
1928
  );
1902
1929
  }
1930
+
1903
1931
  return ValueOrErrors.Default.return(fieldsObject);
1904
1932
  });
1905
1933