@shjjs/visual-ui 1.0.33 → 1.0.34
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/es/commons/core/useChart.mjs +1 -1
- package/es/commons/plugins/datasource/index.d.ts +73 -73
- package/es/commons/plugins/datasource/index.mjs +214 -214
- package/es/commons/plugins/datasource/sources/api.d.ts +1 -1
- package/es/commons/plugins/datasource/sources/api.mjs +32 -32
- package/es/commons/plugins/datasource/sources/static.d.ts +1 -1
- package/es/commons/plugins/datasource/sources/static.mjs +17 -17
- package/es/commons/plugins/datasource/sources/storage.d.ts +1 -1
- package/es/commons/plugins/datasource/sources/storage.mjs +28 -28
- package/es/commons/plugins/datasource/sources/url.d.ts +1 -1
- package/es/commons/plugins/datasource/sources/url.mjs +17 -17
- package/es/commons/plugins/datasource/sources/variable.d.ts +1 -1
- package/es/commons/plugins/datasource/sources/variable.mjs +17 -17
- package/es/commons/plugins/datasource/sources/ws.d.ts +32 -32
- package/es/commons/plugins/datasource/sources/ws.mjs +139 -139
- package/es/commons/plugins/datasource/utils/axios.d.ts +70 -70
- package/es/commons/plugins/datasource/utils/axios.mjs +134 -134
- package/es/commons/plugins/datasource/utils/request.d.ts +3 -3
- package/es/commons/plugins/datasource/utils/request.mjs +5 -5
- package/es/commons/plugins/datasource/utils/utils.d.ts +115 -115
- package/es/commons/plugins/datasource/utils/utils.mjs +229 -229
- package/es/commons/plugins/datasource/utils/wsManager.d.ts +16 -16
- package/es/commons/plugins/datasource/utils/wsManager.mjs +78 -78
- package/es/commons/plugins/event/actions/fullScreenAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/fullScreenAction.mjs +8 -8
- package/es/commons/plugins/event/actions/invokeAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/invokeAction.mjs +11 -11
- package/es/commons/plugins/event/actions/linkAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/linkAction.mjs +8 -8
- package/es/commons/plugins/event/actions/moveAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/moveAction.mjs +15 -15
- package/es/commons/plugins/event/actions/refreshVariableAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/refreshVariableAction.mjs +18 -18
- package/es/commons/plugins/event/actions/rotateAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/rotateAction.mjs +19 -19
- package/es/commons/plugins/event/actions/scaleAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/scaleAction.mjs +24 -24
- package/es/commons/plugins/event/actions/sendApiAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/sendApiAction.mjs +16 -16
- package/es/commons/plugins/event/actions/ueCommonsWebscoketAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/ueCommonsWebscoketAction.mjs +31 -31
- package/es/commons/plugins/event/actions/ueShjExecMethodAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/ueShjExecMethodAction.mjs +31 -31
- package/es/commons/plugins/event/actions/unityIframeExecMethodAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/unityIframeExecMethodAction.mjs +28 -28
- package/es/commons/plugins/event/actions/unityWebglExecMethodAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/unityWebglExecMethodAction.mjs +28 -28
- package/es/commons/plugins/event/actions/updatePageAction.d.ts +8 -8
- package/es/commons/plugins/event/actions/updatePageAction.mjs +6 -6
- package/es/commons/plugins/event/actions/updateVariableAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/updateVariableAction.mjs +25 -25
- package/es/commons/plugins/event/actions/updateWidgetAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/updateWidgetAction.mjs +14 -14
- package/es/commons/plugins/event/actions/vrSceneMethodAction.d.ts +7 -7
- package/es/commons/plugins/event/actions/vrSceneMethodAction.mjs +12 -12
- package/es/commons/plugins/event/index.d.ts +206 -206
- package/es/commons/plugins/event/index.mjs +161 -161
- package/es/commons/plugins/event/utils/utils.d.ts +22 -22
- package/es/commons/plugins/event/utils/utils.mjs +50 -50
- package/es/commons/utils/componentRefs.d.ts +28 -28
- package/es/commons/utils/componentRefs.mjs +37 -37
- package/es/commons/utils/getNextElement.d.ts +7 -7
- package/es/commons/utils/getNextElement.mjs +12 -12
- package/es/components/chart/commons/components/common-chart/index.vue.mjs +10 -11
- package/es/components/chart/commons/components/common-chart-map/index.vue.mjs +6 -7
- package/es/components/chart/commons/hooks/useChart.mjs +1 -1
- package/es/components/chart-other-candlestick-basic/index.vue.mjs +7 -8
- package/es/components/chart-other-candlestick-demo/index.vue.mjs +16 -17
- package/es/components/chart-other-candlestick-shanghai/index.vue.mjs +14 -15
- package/es/components/chart-other-circular-graph/index.vue.mjs +16 -17
- package/es/components/chart-other-force/index.vue.mjs +19 -20
- package/es/components/chart-other-force2/index.vue.mjs +19 -20
- package/es/components/chart-other-funnel/index.vue.mjs +16 -17
- package/es/components/chart-other-funnel-contrast/index.vue.mjs +16 -17
- package/es/components/chart-other-funnel-split/index.vue.mjs +16 -17
- package/es/components/chart-other-funnel2/index.vue.mjs +16 -17
- package/es/components/chart-other-gauge/index.vue.mjs +21 -22
- package/es/components/chart-other-gauge-grade/index.vue.mjs +20 -21
- package/es/components/chart-other-gauge-stage/index.vue.mjs +21 -22
- package/es/components/chart-other-graph-basic/index.vue.mjs +8 -9
- package/es/components/chart-other-graph-basic2/index.vue.mjs +8 -9
- package/es/components/chart-other-graph-calendar/index.vue.mjs +7 -8
- package/es/components/chart-other-grid-percentage/index.vue.mjs +3 -4
- package/es/components/chart-other-heatmap/index.vue.mjs +19 -20
- package/es/components/chart-other-label-gauge/index.vue.mjs +9 -10
- package/es/components/chart-other-liquidfill/index.vue.mjs +11 -12
- package/es/components/chart-other-parallel-basic/index.vue.mjs +15 -16
- package/es/components/chart-other-parallel-mul/index.vue.mjs +6 -7
- package/es/components/chart-other-radar/index.vue.mjs +20 -21
- package/es/components/chart-other-radar-stack/index.vue.mjs +6 -7
- package/es/components/chart-other-sunburst-basic/index.vue.mjs +12 -13
- package/es/components/chart-other-sunburst-basic2/index.vue.mjs +12 -13
- package/es/components/chart-other-sunburst-basic3/index.vue.mjs +12 -13
- package/es/components/chart-other-sunburst-basic4/index.vue.mjs +12 -13
- package/es/components/chart-other-sunburst-book/index.vue.mjs +7 -8
- package/es/components/chart-other-sunburst-flavors/index.vue.mjs +16 -17
- package/es/components/chart-other-sunburst-radius/index.vue.mjs +18 -19
- package/es/components/chart-other-theme-river/index.vue.mjs +3 -4
- package/es/components/chart-other-tree/index.vue.mjs +8 -9
- package/es/components/chart-other-tree-line/index.vue.mjs +7 -8
- package/es/components/chart-other-treemap/index.vue.mjs +9 -10
- package/es/components/chart-other-treemap-basic/index.vue.mjs +14 -15
- package/es/components/chart-other-word-cloud/index.vue.mjs +11 -12
- package/es/components/commons-echarts/compileAndRunEcharts.mjs +8 -9
- package/es/components/commons-loop-iterator/index.vue.mjs +2 -2
- package/es/components/commons-loop-iterator/index.vue2.mjs +3 -4
- package/es/components/commons-product-model/index.vue.mjs +2 -2
- package/es/components/commons-product-model/index.vue2.mjs +1 -1
- package/es/components/commons-three-loader/index.vue.mjs +1 -1
- package/es/components/commons-three-loader/index.vue2.mjs +1 -1
- package/es/components/commons-three-loader3/index.vue.mjs +1 -1
- package/es/components/commons-three-loader3/index.vue2.mjs +1 -1
- package/es/components/commons-weather/index.vue.mjs +2 -2
- package/es/components/commons-weather/index.vue2.mjs +1 -1
- package/es/components/commons-weather-dynamic/index.vue.mjs +1 -1
- package/es/components/commons-weather-dynamic/index.vue2.mjs +3 -4
- package/es/components/interaction/button/index.vue.mjs +2 -2
- package/es/components/interaction/button/index.vue2.mjs +65 -65
- package/es/components/interaction/date-picker/components/common-date-picker/index.vue.mjs +2 -2
- package/es/components/interaction/date-picker/components/common-date-picker/index.vue2.mjs +64 -65
- package/es/components/interaction/tabs/index.vue.mjs +11 -12
- package/es/components/interaction/tabs-icon/index.vue.mjs +6 -7
- package/es/components/interaction-input/index.vue.mjs +1 -1
- package/es/components/interaction-input/index.vue2.mjs +3 -4
- package/es/components/interaction-select/index.vue.mjs +1 -1
- package/es/components/interaction-select/index.vue2.mjs +6 -7
- package/es/components/interaction-slider/index.vue.mjs +2 -2
- package/es/components/interaction-slider/index.vue2.mjs +34 -35
- package/es/components/interaction-switch/index.vue.mjs +2 -2
- package/es/components/interaction-switch/index.vue2.mjs +20 -20
- package/es/components/interaction-tabs/index.vue.mjs +2 -2
- package/es/components/interaction-tabs/index.vue2.mjs +1 -1
- package/es/components/interaction-tabs2/index.vue.mjs +2 -2
- package/es/components/interaction-tabs2/index.vue2.mjs +1 -1
- package/es/components/map-earth-basic/index.vue.d.ts +0 -2
- package/es/components/map-earth-basic/index.vue.mjs +14 -15
- package/es/components/map-earth-cool-tech/index.vue.mjs +14 -15
- package/es/components/map-earth-fly-line/index.vue.d.ts +0 -4
- package/es/components/map-earth-fly-line/index.vue.mjs +8 -9
- package/es/components/map-earth-hacker/index.vue.d.ts +2 -4
- package/es/components/map-earth-hacker/index.vue.mjs +19 -20
- package/es/components/map-earth-particle/index.vue.d.ts +0 -4
- package/es/components/map-earth-particle/index.vue.mjs +14 -15
- package/es/components/media-audio/index.vue.mjs +2 -2
- package/es/components/media-audio/index.vue2.mjs +5 -5
- package/es/components/media-audio-dynamic/index.vue.mjs +1 -1
- package/es/components/media-audio-dynamic/index.vue2.mjs +4 -5
- package/es/components/media-flv/index.vue.mjs +1 -1
- package/es/components/media-iframe/index.vue.mjs +2 -2
- package/es/components/media-iframe/index.vue2.mjs +1 -1
- package/es/components/media-image-dynamic/index.vue.mjs +2 -2
- package/es/components/media-image-dynamic/index.vue2.mjs +6 -7
- package/es/components/media-m3u8/index.vue.mjs +1 -1
- package/es/components/media-m3u8-dynamic/index.vue.mjs +3 -4
- package/es/components/media-video/index.vue.mjs +2 -2
- package/es/components/media-video/index.vue2.mjs +1 -1
- package/es/components/media-video-dynamic/index.vue.mjs +2 -2
- package/es/components/media-video-dynamic/index.vue2.mjs +3 -4
- package/es/components/scene-amap2d/index.vue.mjs +1 -1
- package/es/components/scene-amap2d/index.vue2.mjs +13 -14
- package/es/components/scene-amap3d/index.vue.mjs +2 -2
- package/es/components/scene-amap3d/index.vue2.mjs +4 -5
- package/es/components/scene-default/index.vue.mjs +2 -2
- package/es/components/scene-default/index.vue2.mjs +1 -1
- package/es/components/scene-map3d/index.vue.mjs +2 -2
- package/es/components/scene-map3d/index.vue2.mjs +19 -20
- package/es/components/scene-ue-iframe/index.vue.mjs +2 -2
- package/es/components/scene-ue-iframe/index.vue2.mjs +1 -1
- package/es/components/scene-ue-shj/index.vue.mjs +2 -2
- package/es/components/scene-ue-shj/index.vue2.mjs +1 -1
- package/es/components/scene-unity-iframe/index.vue.mjs +2 -2
- package/es/components/scene-unity-iframe/index.vue2.mjs +1 -1
- package/es/components/scene-unity-webgl/index.vue.mjs +1 -1
- package/es/components/scene-unity-webgl/index.vue2.mjs +1 -1
- package/es/components/scene-vr/index.vue.mjs +2 -2
- package/es/components/scene-vr/index.vue2.mjs +3 -3
- package/es/components/text/list/index.vue.mjs +10 -11
- package/es/components/text-count-down/index.vue.mjs +1 -1
- package/es/components/text-count-down/index.vue2.mjs +1 -1
- package/es/components/text-over-number/index.vue.mjs +1 -1
- package/es/components/text-over-number/index.vue2.mjs +15 -16
- package/es/components/text-real-time/index.vue.mjs +1 -1
- package/es/components/text-real-time/index.vue2.mjs +2 -2
- package/es/components/text-row-scroll/index.vue.mjs +2 -2
- package/es/components/text-row-scroll/index.vue2.mjs +30 -31
- package/es/components/text-table-basic/index.vue.mjs +1 -1
- package/es/components/text-table-basic/index.vue2.mjs +43 -44
- package/es/components/text-table-scroll/index.vue.mjs +2 -2
- package/es/components/text-table-scroll/index.vue2.mjs +58 -59
- package/es/components/text-text-dynamic/index.vue.mjs +1 -1
- package/es/components/text-text-dynamic/index.vue2.mjs +16 -17
- package/es/env.d.ts +0 -1
- package/es/index.d.ts +0 -7
- package/es/index.mjs +359 -373
- package/es/widgets.css +1 -1
- package/package.json +1 -1
|
@@ -4,9 +4,9 @@ import { debounce as M, cloneDeep as y, isArray as n } from "lodash";
|
|
|
4
4
|
import T from "is-electron";
|
|
5
5
|
import * as m from "echarts";
|
|
6
6
|
import { nanoid as x } from "nanoid";
|
|
7
|
+
import { SHJParseEvent as f } from "@zerov/core";
|
|
7
8
|
import "echarts-wordcloud";
|
|
8
9
|
import "echarts-liquidfill";
|
|
9
|
-
import { SHJParseEvent as f } from "../plugins/event/index.mjs";
|
|
10
10
|
import { HoverLoop as L } from "../utils/hoverLoop.mjs";
|
|
11
11
|
const z = (l) => {
|
|
12
12
|
const e = [];
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
export declare class SHJDatasourceV2 {
|
|
2
|
-
private static wsInstances;
|
|
3
|
-
static datasourceTimer: {
|
|
4
|
-
id: string;
|
|
5
|
-
timer: any;
|
|
6
|
-
}[];
|
|
7
|
-
private static parsers;
|
|
8
|
-
static addParser(type: string, parser: Function): void;
|
|
9
|
-
static getParser(type: string): Function | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* 解析数据源
|
|
12
|
-
* @param sources 数据源
|
|
13
|
-
* @param callback 回调函数
|
|
14
|
-
* @param tId 组件id
|
|
15
|
-
* @param isStore 是否存储
|
|
16
|
-
* @param noUseMapping 是否不使用映射
|
|
17
|
-
* @param isInterval 是否开启定时任务
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
static parse({ sources, callback, tId, isStore, noUseMapping, isInterval }: {
|
|
21
|
-
sources: any;
|
|
22
|
-
callback: any;
|
|
23
|
-
tId: any;
|
|
24
|
-
isStore?: boolean;
|
|
25
|
-
noUseMapping?: boolean;
|
|
26
|
-
isInterval?: boolean;
|
|
27
|
-
}): Promise<unknown>;
|
|
28
|
-
/**
|
|
29
|
-
* 执行数据源任务
|
|
30
|
-
* @param sources 数据源
|
|
31
|
-
* @param isStore 是否存储
|
|
32
|
-
* @param noUseMapping 是否不使用映射
|
|
33
|
-
* @param tId 组件id
|
|
34
|
-
* @param callback 回调函数
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
static task(sources: any, isStore: boolean, noUseMapping: boolean, tId: string, callback?: Function): Promise<unknown> | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* 过滤数据
|
|
40
|
-
* @param filter 过滤器
|
|
41
|
-
* @param data 数据
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
static filterData(filter: any, data: any): Promise<unknown>;
|
|
45
|
-
/**
|
|
46
|
-
* 处理数据
|
|
47
|
-
* @param filter 过滤器
|
|
48
|
-
* @param data 数据
|
|
49
|
-
* @param mappings 映射
|
|
50
|
-
* @param id 组件id
|
|
51
|
-
* @param dynamicMapping 是否动态映射
|
|
52
|
-
* @param noUseMapping 是否不使用映射
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
static processData(filter: any, data: any, mappings: any[], id: string, dynamicMapping?: boolean, noUseMapping?: boolean, isUserdata?: boolean): Promise<unknown>;
|
|
56
|
-
/**
|
|
57
|
-
* 解析数据为Key、Data格式
|
|
58
|
-
* @param data 数据
|
|
59
|
-
* @param mappings 映射
|
|
60
|
-
* @param id 组件id
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
static parseMappedData(data: any[], mappings: any[], id: string): {
|
|
64
|
-
key: string;
|
|
65
|
-
data: any[];
|
|
66
|
-
}[];
|
|
67
|
-
/**
|
|
68
|
-
* 处理数据存储
|
|
69
|
-
* @param sources 数据源
|
|
70
|
-
* @returns
|
|
71
|
-
*/
|
|
72
|
-
static taskStorage(sources: any, data: any): void;
|
|
73
|
-
}
|
|
1
|
+
export declare class SHJDatasourceV2 {
|
|
2
|
+
private static wsInstances;
|
|
3
|
+
static datasourceTimer: {
|
|
4
|
+
id: string;
|
|
5
|
+
timer: any;
|
|
6
|
+
}[];
|
|
7
|
+
private static parsers;
|
|
8
|
+
static addParser(type: string, parser: Function): void;
|
|
9
|
+
static getParser(type: string): Function | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* 解析数据源
|
|
12
|
+
* @param sources 数据源
|
|
13
|
+
* @param callback 回调函数
|
|
14
|
+
* @param tId 组件id
|
|
15
|
+
* @param isStore 是否存储
|
|
16
|
+
* @param noUseMapping 是否不使用映射
|
|
17
|
+
* @param isInterval 是否开启定时任务
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
static parse({ sources, callback, tId, isStore, noUseMapping, isInterval }: {
|
|
21
|
+
sources: any;
|
|
22
|
+
callback: any;
|
|
23
|
+
tId: any;
|
|
24
|
+
isStore?: boolean;
|
|
25
|
+
noUseMapping?: boolean;
|
|
26
|
+
isInterval?: boolean;
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* 执行数据源任务
|
|
30
|
+
* @param sources 数据源
|
|
31
|
+
* @param isStore 是否存储
|
|
32
|
+
* @param noUseMapping 是否不使用映射
|
|
33
|
+
* @param tId 组件id
|
|
34
|
+
* @param callback 回调函数
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
static task(sources: any, isStore: boolean, noUseMapping: boolean, tId: string, callback?: Function): Promise<unknown> | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* 过滤数据
|
|
40
|
+
* @param filter 过滤器
|
|
41
|
+
* @param data 数据
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
static filterData(filter: any, data: any): Promise<unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* 处理数据
|
|
47
|
+
* @param filter 过滤器
|
|
48
|
+
* @param data 数据
|
|
49
|
+
* @param mappings 映射
|
|
50
|
+
* @param id 组件id
|
|
51
|
+
* @param dynamicMapping 是否动态映射
|
|
52
|
+
* @param noUseMapping 是否不使用映射
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
static processData(filter: any, data: any, mappings: any[], id: string, dynamicMapping?: boolean, noUseMapping?: boolean, isUserdata?: boolean): Promise<unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* 解析数据为Key、Data格式
|
|
58
|
+
* @param data 数据
|
|
59
|
+
* @param mappings 映射
|
|
60
|
+
* @param id 组件id
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
static parseMappedData(data: any[], mappings: any[], id: string): {
|
|
64
|
+
key: string;
|
|
65
|
+
data: any[];
|
|
66
|
+
}[];
|
|
67
|
+
/**
|
|
68
|
+
* 处理数据存储
|
|
69
|
+
* @param sources 数据源
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
static taskStorage(sources: any, data: any): void;
|
|
73
|
+
}
|
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
var A = Object.defineProperty;
|
|
2
|
-
var U = (w, t, a) => t in w ? A(w, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : w[t] = a;
|
|
3
|
-
var I = (w, t, a) => U(w, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
-
import { isArray as F, isString as b, cloneDeep as P } from "lodash";
|
|
5
|
-
import { parseStaticData as j } from "./sources/static.mjs";
|
|
6
|
-
import { parseUrlData as E } from "./sources/url.mjs";
|
|
7
|
-
import { parseVariableData as W } from "./sources/variable.mjs";
|
|
8
|
-
import { parseAPIPort as $ } from "./sources/api.mjs";
|
|
9
|
-
import { parseWebSocket as M } from "./sources/ws.mjs";
|
|
10
|
-
import { DataSourceUtils as T } from "./utils/utils.mjs";
|
|
11
|
-
import { parseStorage as N } from "./sources/storage.mjs";
|
|
12
|
-
const D = class D {
|
|
13
|
-
static addParser(t, a) {
|
|
14
|
-
this.parsers.add({ type: t, parser: a });
|
|
15
|
-
}
|
|
16
|
-
static getParser(t) {
|
|
17
|
-
const a = Array.from(this.parsers).find((e) => e.type === t);
|
|
18
|
-
return a == null ? void 0 : a.parser;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 解析数据源
|
|
22
|
-
* @param sources 数据源
|
|
23
|
-
* @param callback 回调函数
|
|
24
|
-
* @param tId 组件id
|
|
25
|
-
* @param isStore 是否存储
|
|
26
|
-
* @param noUseMapping 是否不使用映射
|
|
27
|
-
* @param isInterval 是否开启定时任务
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
static parse({ sources: t, callback: a, tId: e, isStore: s = !1, noUseMapping: i = !1, isInterval: n = !0 }) {
|
|
31
|
-
return a ?? (a = () => {
|
|
32
|
-
}), t && F(t) && t.length > 0 && t[0] ? new Promise((p, o) => {
|
|
33
|
-
T.cleanupPreviousWebSockets(this.wsInstances, t.map((r) => r.id), e);
|
|
34
|
-
const h = /* @__PURE__ */ new Set(), l = this.wsInstances.get(e) || /* @__PURE__ */ new Set();
|
|
35
|
-
t.forEach((r) => {
|
|
36
|
-
var u;
|
|
37
|
-
if (n) {
|
|
38
|
-
const { source: f } = r;
|
|
39
|
-
if (!f) {
|
|
40
|
-
a([]), p([]);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const d = `${e}-${r.id}`, m = this.datasourceTimer.findIndex((S) => S.id === d);
|
|
44
|
-
if (m !== -1 && (clearInterval(this.datasourceTimer[m].timer), this.datasourceTimer.splice(m, 1)), f.isAutoUpdate) {
|
|
45
|
-
const S = setInterval(() => {
|
|
46
|
-
var g;
|
|
47
|
-
(g = this.task(r, s, i, e, (c) => {
|
|
48
|
-
a(c);
|
|
49
|
-
})) == null || g.then((c) => {
|
|
50
|
-
p(c);
|
|
51
|
-
});
|
|
52
|
-
}, f.autoUpdateTime * 1e3);
|
|
53
|
-
this.datasourceTimer.push({ id: d, timer: S });
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (r.source.type !== "ws") {
|
|
57
|
-
(u = this.task(r, s, i, e, (f) => a(f))) == null || u.then((f) => p(f));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (T.hasValidWebSocket(this.wsInstances, e, r.id))
|
|
61
|
-
l.forEach((f) => {
|
|
62
|
-
f.getId() === r.id && h.add(f);
|
|
63
|
-
});
|
|
64
|
-
else {
|
|
65
|
-
const f = M(r, r.id, i, e, (d) => {
|
|
66
|
-
p(d), a({ data: [{ data: d.finalUserData.data }] }), this.taskStorage(t, d.finalUserData.data);
|
|
67
|
-
});
|
|
68
|
-
h.add(f);
|
|
69
|
-
}
|
|
70
|
-
}), h.size > 0 && this.wsInstances.set(e, h);
|
|
71
|
-
}) : (a([]), Promise.resolve([]));
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* 执行数据源任务
|
|
75
|
-
* @param sources 数据源
|
|
76
|
-
* @param isStore 是否存储
|
|
77
|
-
* @param noUseMapping 是否不使用映射
|
|
78
|
-
* @param tId 组件id
|
|
79
|
-
* @param callback 回调函数
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
static task(t, a = !1, e = !1, s, i = () => {
|
|
83
|
-
}) {
|
|
84
|
-
return t ? new Promise((n, p) => {
|
|
85
|
-
let o = null;
|
|
86
|
-
const { source: h } = t, l = this.getParser(h.type);
|
|
87
|
-
l && (o = l(t, t.id, e)), o.then((r) => {
|
|
88
|
-
n(r), e && (this.taskStorage(t, r.noMappingData), i(r.noMappingData)), e || (this.taskStorage(t, r.finalKeyData), i(r.finalKeyData));
|
|
89
|
-
});
|
|
90
|
-
}) : (i([]), Promise.resolve([]));
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 过滤数据
|
|
94
|
-
* @param filter 过滤器
|
|
95
|
-
* @param data 数据
|
|
96
|
-
* @returns
|
|
97
|
-
*/
|
|
98
|
-
static filterData(t, a) {
|
|
99
|
-
return new Promise((e, s) => {
|
|
100
|
-
if (b(t)) {
|
|
101
|
-
try {
|
|
102
|
-
const i = T.getVariableData();
|
|
103
|
-
let n = `
|
|
104
|
-
${t}
|
|
105
|
-
|
|
106
|
-
// 在这里调用 filter 函数,并传递 data 参数
|
|
107
|
-
return filter(data);
|
|
108
|
-
`;
|
|
109
|
-
n = n.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, ""), n = T.replaceStringVariables(n, i);
|
|
110
|
-
const p = new Function("data", n);
|
|
111
|
-
e(p(a));
|
|
112
|
-
} catch {
|
|
113
|
-
e(a);
|
|
114
|
-
}
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
e(a);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* 处理数据
|
|
122
|
-
* @param filter 过滤器
|
|
123
|
-
* @param data 数据
|
|
124
|
-
* @param mappings 映射
|
|
125
|
-
* @param id 组件id
|
|
126
|
-
* @param dynamicMapping 是否动态映射
|
|
127
|
-
* @param noUseMapping 是否不使用映射
|
|
128
|
-
* @returns
|
|
129
|
-
*/
|
|
130
|
-
static processData(t, a, e, s, i, n, p) {
|
|
131
|
-
return new Promise(function(o) {
|
|
132
|
-
const h = P({ id: s, data: a });
|
|
133
|
-
D.filterData(t, a).then((l) => {
|
|
134
|
-
const r = P({ id: s, data: l });
|
|
135
|
-
if (n)
|
|
136
|
-
o({
|
|
137
|
-
id: s,
|
|
138
|
-
finalKeyData: [],
|
|
139
|
-
finalUserData: { id: s, data: l },
|
|
140
|
-
filteredData: r,
|
|
141
|
-
rawData: h,
|
|
142
|
-
noMappingData: l
|
|
143
|
-
});
|
|
144
|
-
else {
|
|
145
|
-
let u = [];
|
|
146
|
-
F(l) && (u = l.map((m, S) => {
|
|
147
|
-
const g = {};
|
|
148
|
-
if (i && i && S === 0) {
|
|
149
|
-
const c = [];
|
|
150
|
-
for (const y in m) {
|
|
151
|
-
const k = e.find((x) => x.name === y);
|
|
152
|
-
k ? c.push({ alias: k.alias, name: y, type: "any", label: y, mapping: k.mapping, status: !0 }) : c.push({ alias: y, name: y, type: "any", label: y, mapping: y, status: !0 });
|
|
153
|
-
}
|
|
154
|
-
e.splice(0, e.length), e.push(...c);
|
|
155
|
-
}
|
|
156
|
-
return e.forEach((c) => {
|
|
157
|
-
try {
|
|
158
|
-
c.alias ? g[c.alias] = m[c.mapping] : g[c.name] = m[c.mapping];
|
|
159
|
-
} catch {
|
|
160
|
-
}
|
|
161
|
-
}), p && (g.userdata = m), g;
|
|
162
|
-
}));
|
|
163
|
-
const f = P({ id: s, data: u }), d = P({ id: s, data: D.parseMappedData(u, e, s) });
|
|
164
|
-
o({
|
|
165
|
-
id: s,
|
|
166
|
-
finalKeyData: u.length === 0 ? { id: s, data: l } : d,
|
|
167
|
-
finalUserData: u.length === 0 ? { id: s, data: l } : f,
|
|
168
|
-
filteredData: r,
|
|
169
|
-
rawData: h,
|
|
170
|
-
noMappingData: []
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* 解析数据为Key、Data格式
|
|
178
|
-
* @param data 数据
|
|
179
|
-
* @param mappings 映射
|
|
180
|
-
* @param id 组件id
|
|
181
|
-
* @returns
|
|
182
|
-
*/
|
|
183
|
-
static parseMappedData(t, a, e) {
|
|
184
|
-
return t.reduce(
|
|
185
|
-
(s, i) => {
|
|
186
|
-
let n = "系列一";
|
|
187
|
-
a && a.find((o) => o.name === "series") && (n = i[a.find((o) => o.name === "series").name], delete i[a.find((o) => o.name === "series").name]);
|
|
188
|
-
const p = s.find((o) => o.key === n);
|
|
189
|
-
return p ? p.data.push(i) : s.push({ key: n, data: [i] }), s;
|
|
190
|
-
},
|
|
191
|
-
[]
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* 处理数据存储
|
|
196
|
-
* @param sources 数据源
|
|
197
|
-
* @returns
|
|
198
|
-
*/
|
|
199
|
-
static taskStorage(t, a) {
|
|
200
|
-
const { source: e } = t;
|
|
201
|
-
e.storage && e.storage.setField && e.storage.setType !== 0 && (e.storage.setType === 1 && localStorage.setItem("Local_" + e.storage.setField, JSON.stringify(a)), e.storage.setType === 2 && sessionStorage.setItem("Session_" + e.storage.setField, JSON.stringify(a)));
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
I(D, "wsInstances", /* @__PURE__ */ new Map()), I(D, "datasourceTimer", []), I(D, "parsers", /* @__PURE__ */ new Set([
|
|
205
|
-
{ type: "url", parser: E },
|
|
206
|
-
{ type: "static", parser: j },
|
|
207
|
-
{ type: "variable", parser: W },
|
|
208
|
-
{ type: "api", parser: $ },
|
|
209
|
-
{ type: "storage", parser: N }
|
|
210
|
-
]));
|
|
211
|
-
let K = D;
|
|
212
|
-
export {
|
|
213
|
-
K as SHJDatasourceV2
|
|
214
|
-
};
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var U = (w, t, a) => t in w ? A(w, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : w[t] = a;
|
|
3
|
+
var I = (w, t, a) => U(w, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import { isArray as F, isString as b, cloneDeep as P } from "lodash";
|
|
5
|
+
import { parseStaticData as j } from "./sources/static.mjs";
|
|
6
|
+
import { parseUrlData as E } from "./sources/url.mjs";
|
|
7
|
+
import { parseVariableData as W } from "./sources/variable.mjs";
|
|
8
|
+
import { parseAPIPort as $ } from "./sources/api.mjs";
|
|
9
|
+
import { parseWebSocket as M } from "./sources/ws.mjs";
|
|
10
|
+
import { DataSourceUtils as T } from "./utils/utils.mjs";
|
|
11
|
+
import { parseStorage as N } from "./sources/storage.mjs";
|
|
12
|
+
const D = class D {
|
|
13
|
+
static addParser(t, a) {
|
|
14
|
+
this.parsers.add({ type: t, parser: a });
|
|
15
|
+
}
|
|
16
|
+
static getParser(t) {
|
|
17
|
+
const a = Array.from(this.parsers).find((e) => e.type === t);
|
|
18
|
+
return a == null ? void 0 : a.parser;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 解析数据源
|
|
22
|
+
* @param sources 数据源
|
|
23
|
+
* @param callback 回调函数
|
|
24
|
+
* @param tId 组件id
|
|
25
|
+
* @param isStore 是否存储
|
|
26
|
+
* @param noUseMapping 是否不使用映射
|
|
27
|
+
* @param isInterval 是否开启定时任务
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
static parse({ sources: t, callback: a, tId: e, isStore: s = !1, noUseMapping: i = !1, isInterval: n = !0 }) {
|
|
31
|
+
return a ?? (a = () => {
|
|
32
|
+
}), t && F(t) && t.length > 0 && t[0] ? new Promise((p, o) => {
|
|
33
|
+
T.cleanupPreviousWebSockets(this.wsInstances, t.map((r) => r.id), e);
|
|
34
|
+
const h = /* @__PURE__ */ new Set(), l = this.wsInstances.get(e) || /* @__PURE__ */ new Set();
|
|
35
|
+
t.forEach((r) => {
|
|
36
|
+
var u;
|
|
37
|
+
if (n) {
|
|
38
|
+
const { source: f } = r;
|
|
39
|
+
if (!f) {
|
|
40
|
+
a([]), p([]);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const d = `${e}-${r.id}`, m = this.datasourceTimer.findIndex((S) => S.id === d);
|
|
44
|
+
if (m !== -1 && (clearInterval(this.datasourceTimer[m].timer), this.datasourceTimer.splice(m, 1)), f.isAutoUpdate) {
|
|
45
|
+
const S = setInterval(() => {
|
|
46
|
+
var g;
|
|
47
|
+
(g = this.task(r, s, i, e, (c) => {
|
|
48
|
+
a(c);
|
|
49
|
+
})) == null || g.then((c) => {
|
|
50
|
+
p(c);
|
|
51
|
+
});
|
|
52
|
+
}, f.autoUpdateTime * 1e3);
|
|
53
|
+
this.datasourceTimer.push({ id: d, timer: S });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (r.source.type !== "ws") {
|
|
57
|
+
(u = this.task(r, s, i, e, (f) => a(f))) == null || u.then((f) => p(f));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (T.hasValidWebSocket(this.wsInstances, e, r.id))
|
|
61
|
+
l.forEach((f) => {
|
|
62
|
+
f.getId() === r.id && h.add(f);
|
|
63
|
+
});
|
|
64
|
+
else {
|
|
65
|
+
const f = M(r, r.id, i, e, (d) => {
|
|
66
|
+
p(d), a({ data: [{ data: d.finalUserData.data }] }), this.taskStorage(t, d.finalUserData.data);
|
|
67
|
+
});
|
|
68
|
+
h.add(f);
|
|
69
|
+
}
|
|
70
|
+
}), h.size > 0 && this.wsInstances.set(e, h);
|
|
71
|
+
}) : (a([]), Promise.resolve([]));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 执行数据源任务
|
|
75
|
+
* @param sources 数据源
|
|
76
|
+
* @param isStore 是否存储
|
|
77
|
+
* @param noUseMapping 是否不使用映射
|
|
78
|
+
* @param tId 组件id
|
|
79
|
+
* @param callback 回调函数
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
static task(t, a = !1, e = !1, s, i = () => {
|
|
83
|
+
}) {
|
|
84
|
+
return t ? new Promise((n, p) => {
|
|
85
|
+
let o = null;
|
|
86
|
+
const { source: h } = t, l = this.getParser(h.type);
|
|
87
|
+
l && (o = l(t, t.id, e)), o.then((r) => {
|
|
88
|
+
n(r), e && (this.taskStorage(t, r.noMappingData), i(r.noMappingData)), e || (this.taskStorage(t, r.finalKeyData), i(r.finalKeyData));
|
|
89
|
+
});
|
|
90
|
+
}) : (i([]), Promise.resolve([]));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 过滤数据
|
|
94
|
+
* @param filter 过滤器
|
|
95
|
+
* @param data 数据
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
static filterData(t, a) {
|
|
99
|
+
return new Promise((e, s) => {
|
|
100
|
+
if (b(t)) {
|
|
101
|
+
try {
|
|
102
|
+
const i = T.getVariableData();
|
|
103
|
+
let n = `
|
|
104
|
+
${t}
|
|
105
|
+
|
|
106
|
+
// 在这里调用 filter 函数,并传递 data 参数
|
|
107
|
+
return filter(data);
|
|
108
|
+
`;
|
|
109
|
+
n = n.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, ""), n = T.replaceStringVariables(n, i);
|
|
110
|
+
const p = new Function("data", n);
|
|
111
|
+
e(p(a));
|
|
112
|
+
} catch {
|
|
113
|
+
e(a);
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
e(a);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 处理数据
|
|
122
|
+
* @param filter 过滤器
|
|
123
|
+
* @param data 数据
|
|
124
|
+
* @param mappings 映射
|
|
125
|
+
* @param id 组件id
|
|
126
|
+
* @param dynamicMapping 是否动态映射
|
|
127
|
+
* @param noUseMapping 是否不使用映射
|
|
128
|
+
* @returns
|
|
129
|
+
*/
|
|
130
|
+
static processData(t, a, e, s, i, n, p) {
|
|
131
|
+
return new Promise(function(o) {
|
|
132
|
+
const h = P({ id: s, data: a });
|
|
133
|
+
D.filterData(t, a).then((l) => {
|
|
134
|
+
const r = P({ id: s, data: l });
|
|
135
|
+
if (n)
|
|
136
|
+
o({
|
|
137
|
+
id: s,
|
|
138
|
+
finalKeyData: [],
|
|
139
|
+
finalUserData: { id: s, data: l },
|
|
140
|
+
filteredData: r,
|
|
141
|
+
rawData: h,
|
|
142
|
+
noMappingData: l
|
|
143
|
+
});
|
|
144
|
+
else {
|
|
145
|
+
let u = [];
|
|
146
|
+
F(l) && (u = l.map((m, S) => {
|
|
147
|
+
const g = {};
|
|
148
|
+
if (i && i && S === 0) {
|
|
149
|
+
const c = [];
|
|
150
|
+
for (const y in m) {
|
|
151
|
+
const k = e.find((x) => x.name === y);
|
|
152
|
+
k ? c.push({ alias: k.alias, name: y, type: "any", label: y, mapping: k.mapping, status: !0 }) : c.push({ alias: y, name: y, type: "any", label: y, mapping: y, status: !0 });
|
|
153
|
+
}
|
|
154
|
+
e.splice(0, e.length), e.push(...c);
|
|
155
|
+
}
|
|
156
|
+
return e.forEach((c) => {
|
|
157
|
+
try {
|
|
158
|
+
c.alias ? g[c.alias] = m[c.mapping] : g[c.name] = m[c.mapping];
|
|
159
|
+
} catch {
|
|
160
|
+
}
|
|
161
|
+
}), p && (g.userdata = m), g;
|
|
162
|
+
}));
|
|
163
|
+
const f = P({ id: s, data: u }), d = P({ id: s, data: D.parseMappedData(u, e, s) });
|
|
164
|
+
o({
|
|
165
|
+
id: s,
|
|
166
|
+
finalKeyData: u.length === 0 ? { id: s, data: l } : d,
|
|
167
|
+
finalUserData: u.length === 0 ? { id: s, data: l } : f,
|
|
168
|
+
filteredData: r,
|
|
169
|
+
rawData: h,
|
|
170
|
+
noMappingData: []
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* 解析数据为Key、Data格式
|
|
178
|
+
* @param data 数据
|
|
179
|
+
* @param mappings 映射
|
|
180
|
+
* @param id 组件id
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
183
|
+
static parseMappedData(t, a, e) {
|
|
184
|
+
return t.reduce(
|
|
185
|
+
(s, i) => {
|
|
186
|
+
let n = "系列一";
|
|
187
|
+
a && a.find((o) => o.name === "series") && (n = i[a.find((o) => o.name === "series").name], delete i[a.find((o) => o.name === "series").name]);
|
|
188
|
+
const p = s.find((o) => o.key === n);
|
|
189
|
+
return p ? p.data.push(i) : s.push({ key: n, data: [i] }), s;
|
|
190
|
+
},
|
|
191
|
+
[]
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* 处理数据存储
|
|
196
|
+
* @param sources 数据源
|
|
197
|
+
* @returns
|
|
198
|
+
*/
|
|
199
|
+
static taskStorage(t, a) {
|
|
200
|
+
const { source: e } = t;
|
|
201
|
+
e.storage && e.storage.setField && e.storage.setType !== 0 && (e.storage.setType === 1 && localStorage.setItem("Local_" + e.storage.setField, JSON.stringify(a)), e.storage.setType === 2 && sessionStorage.setItem("Session_" + e.storage.setField, JSON.stringify(a)));
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
I(D, "wsInstances", /* @__PURE__ */ new Map()), I(D, "datasourceTimer", []), I(D, "parsers", /* @__PURE__ */ new Set([
|
|
205
|
+
{ type: "url", parser: E },
|
|
206
|
+
{ type: "static", parser: j },
|
|
207
|
+
{ type: "variable", parser: W },
|
|
208
|
+
{ type: "api", parser: $ },
|
|
209
|
+
{ type: "storage", parser: N }
|
|
210
|
+
]));
|
|
211
|
+
let K = D;
|
|
212
|
+
export {
|
|
213
|
+
K as SHJDatasourceV2
|
|
214
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const parseAPIPort: (source: any, id: string, noUseMapping: boolean) => Promise<unknown>;
|
|
1
|
+
export declare const parseAPIPort: (source: any, id: string, noUseMapping: boolean) => Promise<unknown>;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { SHJDatasourceV2 as U } from "../index.mjs";
|
|
2
|
-
import { httpRequest as p } from "../utils/request.mjs";
|
|
3
|
-
import { DataSourceUtils as t } from "../utils/utils.mjs";
|
|
4
|
-
const q = (f, e, y) => new Promise(function(r, j) {
|
|
5
|
-
const { api: n } = f.source;
|
|
6
|
-
try {
|
|
7
|
-
if (n) {
|
|
8
|
-
let { isHeaders: m, isBody: h, headers: c, contentType: u, url: a, postParam: o } = n;
|
|
9
|
-
const E = t.getEnvironments(), l = t.getVariableData(), i = (P) => {
|
|
10
|
-
P.then((D) => {
|
|
11
|
-
if (D.status === 200) {
|
|
12
|
-
const { filter: V, mapping: g, isUserdata: T } = f.source;
|
|
13
|
-
U.processData(V, D.data, g, e, f.source.dynamicMapping, y, T).then((b) => {
|
|
14
|
-
b && r(b);
|
|
15
|
-
}).catch(() => r(t.noneData(e)));
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
r(t.noneData(e));
|
|
19
|
-
}).catch(() => {
|
|
20
|
-
r(t.noneData(e));
|
|
21
|
-
});
|
|
22
|
-
}, s = t.replaceEnvVariables(a, E);
|
|
23
|
-
a = t.replaceURLVariables(a, l), h && (o = t.replaceObjectVariables(o, l)), m && (c = t.replaceObjectVariables(c, l)), n.type === "GET" && i(p.get(s + a, { headers: c })), n.type === "POST" && i(p.post(s + a, o, { headers: c }, u)), n.type === "PUT" && i(p.put(s + a, o, { headers: c }, u)), n.type === "DELETE" && i(p.delete(s + a, { headers: c }));
|
|
24
|
-
} else
|
|
25
|
-
r(t.noneData(e));
|
|
26
|
-
} catch {
|
|
27
|
-
r(t.noneData(e));
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
export {
|
|
31
|
-
q as parseAPIPort
|
|
32
|
-
};
|
|
1
|
+
import { SHJDatasourceV2 as U } from "../index.mjs";
|
|
2
|
+
import { httpRequest as p } from "../utils/request.mjs";
|
|
3
|
+
import { DataSourceUtils as t } from "../utils/utils.mjs";
|
|
4
|
+
const q = (f, e, y) => new Promise(function(r, j) {
|
|
5
|
+
const { api: n } = f.source;
|
|
6
|
+
try {
|
|
7
|
+
if (n) {
|
|
8
|
+
let { isHeaders: m, isBody: h, headers: c, contentType: u, url: a, postParam: o } = n;
|
|
9
|
+
const E = t.getEnvironments(), l = t.getVariableData(), i = (P) => {
|
|
10
|
+
P.then((D) => {
|
|
11
|
+
if (D.status === 200) {
|
|
12
|
+
const { filter: V, mapping: g, isUserdata: T } = f.source;
|
|
13
|
+
U.processData(V, D.data, g, e, f.source.dynamicMapping, y, T).then((b) => {
|
|
14
|
+
b && r(b);
|
|
15
|
+
}).catch(() => r(t.noneData(e)));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
r(t.noneData(e));
|
|
19
|
+
}).catch(() => {
|
|
20
|
+
r(t.noneData(e));
|
|
21
|
+
});
|
|
22
|
+
}, s = t.replaceEnvVariables(a, E);
|
|
23
|
+
a = t.replaceURLVariables(a, l), h && (o = t.replaceObjectVariables(o, l)), m && (c = t.replaceObjectVariables(c, l)), n.type === "GET" && i(p.get(s + a, { headers: c })), n.type === "POST" && i(p.post(s + a, o, { headers: c }, u)), n.type === "PUT" && i(p.put(s + a, o, { headers: c }, u)), n.type === "DELETE" && i(p.delete(s + a, { headers: c }));
|
|
24
|
+
} else
|
|
25
|
+
r(t.noneData(e));
|
|
26
|
+
} catch {
|
|
27
|
+
r(t.noneData(e));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
q as parseAPIPort
|
|
32
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const parseStaticData: (source: any, id: string, noUseMapping: boolean) => Promise<unknown>;
|
|
1
|
+
export declare const parseStaticData: (source: any, id: string, noUseMapping: boolean) => Promise<unknown>;
|