@xuda.io/xuda-worker-bundle-min 1.3.323 → 1.3.325
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/index.js +35 -74
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1781,8 +1781,6 @@ func.datasource.execute = async function (
|
|
|
1781
1781
|
break;
|
|
1782
1782
|
}
|
|
1783
1783
|
case "url": {
|
|
1784
|
-
debugger;
|
|
1785
|
-
|
|
1786
1784
|
let opt = {
|
|
1787
1785
|
method: prog_obj.progDataSource.dataSourceMethod || "POST",
|
|
1788
1786
|
headers: {
|
|
@@ -1809,6 +1807,14 @@ func.datasource.execute = async function (
|
|
|
1809
1807
|
const json = await response.json();
|
|
1810
1808
|
return json.data;
|
|
1811
1809
|
} catch (err) {
|
|
1810
|
+
func.utils.debug_report(
|
|
1811
|
+
SESSION_ID,
|
|
1812
|
+
"Data source",
|
|
1813
|
+
err.message +
|
|
1814
|
+
" https://" +
|
|
1815
|
+
prog_obj.progDataSource.dataSourceDataUrl,
|
|
1816
|
+
"E"
|
|
1817
|
+
);
|
|
1812
1818
|
return null;
|
|
1813
1819
|
}
|
|
1814
1820
|
|
|
@@ -1819,74 +1825,6 @@ func.datasource.execute = async function (
|
|
|
1819
1825
|
return null;
|
|
1820
1826
|
break;
|
|
1821
1827
|
}
|
|
1822
|
-
|
|
1823
|
-
var val;
|
|
1824
|
-
|
|
1825
|
-
// if (v.viewDataSourceSelect === "url") {
|
|
1826
|
-
// $_ajax({
|
|
1827
|
-
// url: val,
|
|
1828
|
-
// dataType: "json",
|
|
1829
|
-
// type: "GET",
|
|
1830
|
-
// success: function (json) {
|
|
1831
|
-
// callbackP(json);
|
|
1832
|
-
// },
|
|
1833
|
-
// fail: function (jqXHR, textStatus) {
|
|
1834
|
-
// func.common.debug.report(
|
|
1835
|
-
// "datasource json/array url call error",
|
|
1836
|
-
// textStatus,
|
|
1837
|
-
// "E"
|
|
1838
|
-
// );
|
|
1839
|
-
// callbackP(textStatus);
|
|
1840
|
-
// },
|
|
1841
|
-
// error: function (jqXHR, textStatus, errorThrown) {
|
|
1842
|
-
// func.common.debug.report(
|
|
1843
|
-
// "datasource json/array url call error",
|
|
1844
|
-
// textStatus,
|
|
1845
|
-
// "E"
|
|
1846
|
-
// );
|
|
1847
|
-
// callbackP(textStatus);
|
|
1848
|
-
// },
|
|
1849
|
-
// timeout: 60000, //60 seconds timeout
|
|
1850
|
-
// });
|
|
1851
|
-
// } else callbackP(val);
|
|
1852
|
-
|
|
1853
|
-
// get_val(function (valP) {
|
|
1854
|
-
// if (
|
|
1855
|
-
// ["array", "json"].includes(prog_obj.progDataSource.dataSourceSrcType)
|
|
1856
|
-
// ) {
|
|
1857
|
-
// if (typeof valP === "object") callbackP(valP);
|
|
1858
|
-
// else
|
|
1859
|
-
// try {
|
|
1860
|
-
// var val_to_parse = valP;
|
|
1861
|
-
// if (
|
|
1862
|
-
// valP &&
|
|
1863
|
-
// valP.substr(0, 1) === "(" &&
|
|
1864
|
-
// valP.substr(valP.length - 1, 1) === ")"
|
|
1865
|
-
// )
|
|
1866
|
-
// val_to_parse = valP.substr(1, valP.length - 2);
|
|
1867
|
-
// var obj = {};
|
|
1868
|
-
// if (v.viewDataSourceType === "json") {
|
|
1869
|
-
// var tmp_obj = JSON.parse(val_to_parse);
|
|
1870
|
-
// Object.keys(tmp_obj)
|
|
1871
|
-
// .sort()
|
|
1872
|
-
// .forEach(function (v, i) {
|
|
1873
|
-
// obj[v] = tmp_obj[v];
|
|
1874
|
-
// });
|
|
1875
|
-
// } else obj = JSON.parse(val_to_parse);
|
|
1876
|
-
// callbackP(obj);
|
|
1877
|
-
// } catch (e) {
|
|
1878
|
-
// func.common.debug.report(
|
|
1879
|
-
// "datasource json/array parse error",
|
|
1880
|
-
// e,
|
|
1881
|
-
// "E"
|
|
1882
|
-
// );
|
|
1883
|
-
// callbackP();
|
|
1884
|
-
// }
|
|
1885
|
-
// }
|
|
1886
|
-
// if (v.viewDataSourceType === "csv") {
|
|
1887
|
-
// callbackP(valP.split(","));
|
|
1888
|
-
// }
|
|
1889
|
-
// });
|
|
1890
1828
|
};
|
|
1891
1829
|
|
|
1892
1830
|
switch (prog_obj.progDataSource?.dataSourceType) {
|
|
@@ -1961,6 +1899,10 @@ func.datasource.execute = async function (
|
|
|
1961
1899
|
case "array": {
|
|
1962
1900
|
let data = await get_data_from_source();
|
|
1963
1901
|
|
|
1902
|
+
if (data === null) {
|
|
1903
|
+
data = [];
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1964
1906
|
if (!_ds.v.raw_data) {
|
|
1965
1907
|
_ds.v.raw_data = { rows: [] };
|
|
1966
1908
|
}
|
|
@@ -1974,19 +1916,38 @@ func.datasource.execute = async function (
|
|
|
1974
1916
|
|
|
1975
1917
|
case "json": {
|
|
1976
1918
|
let data = await get_data_from_source();
|
|
1977
|
-
|
|
1919
|
+
if (data === null) {
|
|
1920
|
+
data = {};
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1978
1923
|
if (!_ds.v.raw_data) {
|
|
1979
1924
|
_ds.v.raw_data = { rows: [] };
|
|
1980
1925
|
}
|
|
1981
|
-
|
|
1982
|
-
for (
|
|
1926
|
+
|
|
1927
|
+
for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
1983
1928
|
_ds.v.raw_data.rows[_KEY] = { id: _KEY, value: { _KEY, _VAL } };
|
|
1984
|
-
_KEY++;
|
|
1985
1929
|
}
|
|
1930
|
+
|
|
1986
1931
|
break;
|
|
1987
1932
|
}
|
|
1988
1933
|
|
|
1989
1934
|
case "csv":
|
|
1935
|
+
let data = await get_data_from_source();
|
|
1936
|
+
if (data === null) {
|
|
1937
|
+
data = "";
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
if (!_ds.v.raw_data) {
|
|
1941
|
+
_ds.v.raw_data = { rows: [] };
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
let _KEY = 0;
|
|
1945
|
+
let arr = data.split(",");
|
|
1946
|
+
for (const _VAL of arr) {
|
|
1947
|
+
_ds.v.raw_data.rows[_KEY] = { id: _KEY, value: { _KEY, _VAL } };
|
|
1948
|
+
_KEY++;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1990
1951
|
break;
|
|
1991
1952
|
|
|
1992
1953
|
default:
|