@xuda.io/xuda-worker-bundle-min 1.3.317 → 1.3.319

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.
Files changed (2) hide show
  1. package/index.js +43 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1781,9 +1781,39 @@ func.datasource.execute = async function (
1781
1781
  break;
1782
1782
  }
1783
1783
  case "url": {
1784
+ debugger;
1785
+
1786
+ let opt = {
1787
+ method: prog_obj.progDataSource.dataSourceMethod || "POST",
1788
+ headers: {
1789
+ Accept: "application/json",
1790
+ "Content-Type": "application/json",
1791
+ },
1792
+ };
1793
+ let data = {};
1794
+ if (
1795
+ prog_obj.progDataSource.dataSourceUrl == "POST" &&
1796
+ prog_obj.progDataSource.dataSourceParameters
1797
+ ) {
1798
+ for (let val of prog_obj.progDataSource.dataSourceParameters) {
1799
+ data[val.key] = val.val;
1800
+ }
1801
+
1802
+ opt.body = JSON.stringify(data);
1803
+ }
1804
+
1805
+ const response = await fetch(
1806
+ prog_obj.progDataSource.dataSourceUrl,
1807
+ opt
1808
+ );
1809
+ const json = await response.json();
1810
+ return json.data;
1811
+
1784
1812
  break;
1785
1813
  }
1814
+
1786
1815
  default:
1816
+ return null;
1787
1817
  break;
1788
1818
  }
1789
1819
 
@@ -1927,7 +1957,7 @@ func.datasource.execute = async function (
1927
1957
 
1928
1958
  case "array": {
1929
1959
  let data = await get_data_from_source();
1930
- console.log("data", data);
1960
+
1931
1961
  if (!_ds.v.raw_data) {
1932
1962
  _ds.v.raw_data = { rows: [] };
1933
1963
  }
@@ -1939,8 +1969,19 @@ func.datasource.execute = async function (
1939
1969
  break;
1940
1970
  }
1941
1971
 
1942
- case "json":
1972
+ case "json": {
1973
+ let data = await get_data_from_source();
1974
+ console.log("data", data);
1975
+ if (!_ds.v.raw_data) {
1976
+ _ds.v.raw_data = { rows: [] };
1977
+ }
1978
+ let _KEY = 0;
1979
+ for (const _VAL of data) {
1980
+ _ds.v.raw_data.rows[_KEY] = { id: _KEY, value: { _KEY, _VAL } };
1981
+ _KEY++;
1982
+ }
1943
1983
  break;
1984
+ }
1944
1985
 
1945
1986
  case "csv":
1946
1987
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.317",
3
+ "version": "1.3.319",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {