@knime/scripting-editor 0.0.60 → 0.0.61
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/dist/lib/main.d.ts +2 -1
- package/dist/main.js +7704 -7201
- package/dist/scripting-service-browser-mock.js +60 -33
- package/dist/src/components/HeaderBar.vue.d.ts +2 -2
- package/dist/src/components/InputPortTableView.vue.d.ts +24 -0
- package/dist/src/components/InputPortTables.vue.d.ts +26 -0
- package/dist/src/components/ScriptingEditor.vue.d.ts +1 -1
- package/dist/src/scripting-service-browser-mock.d.ts +7 -0
- package/dist/src/scripting-service.d.ts +18 -0
- package/dist/src/store/ai-bar.d.ts +4 -0
- package/package.json +4 -4
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
function o(e) {
|
|
2
|
-
return new Promise((
|
|
2
|
+
return new Promise((i) => setTimeout(i, e));
|
|
3
3
|
}
|
|
4
|
-
const l =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const l = {
|
|
5
|
+
inputPorts: [
|
|
6
|
+
{
|
|
7
|
+
nodeId: "root",
|
|
8
|
+
portName: "firstPort",
|
|
9
|
+
portIdx: 1,
|
|
10
|
+
portViewConfigs: [
|
|
11
|
+
{ portViewIdx: 0, label: "firstView" },
|
|
12
|
+
{ portViewIdx: 1, label: "secondView" }
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
nodeId: "notRoot",
|
|
17
|
+
portName: "firstPort",
|
|
18
|
+
portIdx: 1,
|
|
19
|
+
portViewConfigs: [
|
|
20
|
+
{ portViewIdx: 0, label: "firstView" },
|
|
21
|
+
{ portViewIdx: 1, label: "secondView" }
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}, c = 100, a = 2e3, r = (e, ...i) => {
|
|
26
|
+
typeof consola > "u" ? console.log(e, ...i) : consola.log(e, ...i);
|
|
27
|
+
}, u = (e, ...i) => {
|
|
28
|
+
typeof consola > "u" ? console.error(e, ...i) : consola.error(e, ...i);
|
|
29
|
+
}, g = [
|
|
9
30
|
{
|
|
10
31
|
name: "Input Table 1",
|
|
11
32
|
subItems: [
|
|
@@ -23,11 +44,11 @@ const l = 100, c = 2e3, t = (e, ...n) => {
|
|
|
23
44
|
}
|
|
24
45
|
]
|
|
25
46
|
}
|
|
26
|
-
],
|
|
47
|
+
], d = [
|
|
27
48
|
{
|
|
28
49
|
name: "Output Table 1"
|
|
29
50
|
}
|
|
30
|
-
],
|
|
51
|
+
], p = {
|
|
31
52
|
name: "Flow Variables",
|
|
32
53
|
subItems: [
|
|
33
54
|
{
|
|
@@ -43,14 +64,14 @@ const l = 100, c = 2e3, t = (e, ...n) => {
|
|
|
43
64
|
type: "String"
|
|
44
65
|
}
|
|
45
66
|
]
|
|
46
|
-
},
|
|
47
|
-
const
|
|
67
|
+
}, S = (e) => {
|
|
68
|
+
const i = /* @__PURE__ */ new Map(), s = {
|
|
48
69
|
getHubId: () => Promise.resolve("My Mocked KNIME Hub"),
|
|
49
70
|
isLoggedIn: () => Promise.resolve(!0),
|
|
50
71
|
suggestCode: async () => {
|
|
51
|
-
await o(
|
|
52
|
-
const
|
|
53
|
-
return typeof
|
|
72
|
+
await o(a);
|
|
73
|
+
const t = i.get("codeSuggestion");
|
|
74
|
+
return typeof t < "u" && t({
|
|
54
75
|
status: "SUCCESS",
|
|
55
76
|
code: JSON.stringify({ code: "// THIS IS A FAKE AI SUGGESTION" })
|
|
56
77
|
}), {};
|
|
@@ -58,56 +79,62 @@ const l = 100, c = 2e3, t = (e, ...n) => {
|
|
|
58
79
|
abortSuggestCodeRequest: () => Promise.resolve()
|
|
59
80
|
};
|
|
60
81
|
return {
|
|
61
|
-
async sendToService(
|
|
62
|
-
return
|
|
63
|
-
`${
|
|
82
|
+
async sendToService(t, n) {
|
|
83
|
+
return r(`Called scriptingService.sendToService("${t}")`, n), await o(c), e.sendToServiceMockResponses && t in e.sendToServiceMockResponses ? e.sendToServiceMockResponses[t](n) : t in s ? s[t](n) : (u(
|
|
84
|
+
`${t} not implemented in sendToServiceMockResponses.
|
|
64
85
|
Returning undefined.`
|
|
65
86
|
), Promise.resolve());
|
|
66
87
|
},
|
|
67
88
|
// Settings and dialog window
|
|
68
89
|
getInitialSettings() {
|
|
69
|
-
return
|
|
90
|
+
return r("Called scriptingService.getInitialSettings"), Promise.resolve(e.initialSettings ?? { script: "Hello world" });
|
|
70
91
|
},
|
|
71
92
|
registerSettingsGetterForApply() {
|
|
72
|
-
return
|
|
93
|
+
return r("Called scriptingService.registerSettingsGetterForApply"), Promise.resolve();
|
|
73
94
|
},
|
|
74
95
|
// Input and output objects
|
|
75
96
|
inputsAvailable() {
|
|
76
|
-
return
|
|
97
|
+
return r("Called scriptingService.inputsAvailable"), Promise.resolve(e.inputsAvailable ?? !0);
|
|
77
98
|
},
|
|
78
99
|
getInputObjects() {
|
|
79
|
-
return
|
|
100
|
+
return r("Called scriptingService.getInputObjects"), Promise.resolve(e.inputObjects ?? g);
|
|
80
101
|
},
|
|
81
102
|
getOutputObjects() {
|
|
82
|
-
return
|
|
103
|
+
return r("Called scriptingService.getOutputObjects"), Promise.resolve(e.outputObjects ?? d);
|
|
83
104
|
},
|
|
84
105
|
getFlowVariableInputs() {
|
|
85
|
-
return
|
|
86
|
-
e.flowVariableInputs ??
|
|
106
|
+
return r("Called scriptingService.getFlowVariableInputs"), Promise.resolve(
|
|
107
|
+
e.flowVariableInputs ?? p
|
|
87
108
|
);
|
|
88
109
|
},
|
|
110
|
+
getPortConfigs() {
|
|
111
|
+
return r("Called scriptingService.getPortConfigs"), Promise.resolve(l);
|
|
112
|
+
},
|
|
113
|
+
isCallKnimeUiApiAvailable() {
|
|
114
|
+
return r("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!0);
|
|
115
|
+
},
|
|
89
116
|
// Code assistant
|
|
90
117
|
isCodeAssistantInstalled() {
|
|
91
|
-
return
|
|
118
|
+
return r("Called scriptingService.isCodeAssistantInstalled"), Promise.resolve(!0);
|
|
92
119
|
},
|
|
93
120
|
isCodeAssistantEnabled() {
|
|
94
|
-
return
|
|
121
|
+
return r("Called scriptingService.isCodeAssistantEnabled"), Promise.resolve(!0);
|
|
95
122
|
},
|
|
96
123
|
// Event handler
|
|
97
|
-
registerEventHandler(
|
|
98
|
-
|
|
124
|
+
registerEventHandler(t, n) {
|
|
125
|
+
r("Called scriptingService.registerEventHandler", t), i.set(t, n);
|
|
99
126
|
},
|
|
100
127
|
// Language server
|
|
101
128
|
connectToLanguageServer() {
|
|
102
|
-
return
|
|
129
|
+
return r("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
|
|
103
130
|
},
|
|
104
131
|
// Console handling
|
|
105
|
-
eventHandlers:
|
|
132
|
+
eventHandlers: i
|
|
106
133
|
};
|
|
107
134
|
};
|
|
108
135
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
136
|
+
p as DEFAULT_FLOW_VARIABLE_INPUTS,
|
|
137
|
+
g as DEFAULT_INPUT_OBJECTS,
|
|
138
|
+
d as DEFAULT_OUTPUT_OBJECTS,
|
|
139
|
+
S as createScriptingServiceMock
|
|
113
140
|
};
|
|
@@ -7,7 +7,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
7
7
|
default: null;
|
|
8
8
|
};
|
|
9
9
|
menuItems: {
|
|
10
|
-
type: PropType<MenuItem[]>;
|
|
10
|
+
type: PropType<MenuItem<any, any>[]>;
|
|
11
11
|
required: true;
|
|
12
12
|
};
|
|
13
13
|
}, unknown, unknown, {
|
|
@@ -20,7 +20,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
20
20
|
default: null;
|
|
21
21
|
};
|
|
22
22
|
menuItems: {
|
|
23
|
-
type: PropType<MenuItem[]>;
|
|
23
|
+
type: PropType<MenuItem<any, any>[]>;
|
|
24
24
|
required: true;
|
|
25
25
|
};
|
|
26
26
|
}>> & {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
inputNodeId: string;
|
|
3
|
+
portIdx: number;
|
|
4
|
+
viewIdx: number;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>>>, {}, {}>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
10
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
11
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
12
|
+
} : {
|
|
13
|
+
type: import('vue').PropType<T[K]>;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type __VLS_WithDefaults<P, D> = {
|
|
18
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
19
|
+
default: D[K];
|
|
20
|
+
}> : P[K];
|
|
21
|
+
};
|
|
22
|
+
type __VLS_Prettify<T> = {
|
|
23
|
+
[K in keyof T]: T[K];
|
|
24
|
+
} & {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PortViewConfig } from '../scripting-service';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
inputNodeId: string;
|
|
5
|
+
portIdx: number;
|
|
6
|
+
portViewConfigs: PortViewConfig[];
|
|
7
|
+
}
|
|
8
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>>>, {}, {}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
11
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
12
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
13
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
14
|
+
} : {
|
|
15
|
+
type: import('vue').PropType<T[K]>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type __VLS_WithDefaults<P, D> = {
|
|
20
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
21
|
+
default: D[K];
|
|
22
|
+
}> : P[K];
|
|
23
|
+
};
|
|
24
|
+
type __VLS_Prettify<T> = {
|
|
25
|
+
[K in keyof T]: T[K];
|
|
26
|
+
} & {};
|
|
@@ -44,7 +44,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
44
44
|
"onInput-output-item-insertion"?: ((...args: any[]) => any) | undefined;
|
|
45
45
|
"onMenu-item-clicked"?: ((...args: any[]) => any) | undefined;
|
|
46
46
|
}, {
|
|
47
|
-
menuItems: MenuItem[];
|
|
47
|
+
menuItems: MenuItem<any, any>[];
|
|
48
48
|
showControlBar: boolean;
|
|
49
49
|
fileName: string | null;
|
|
50
50
|
toSettings: (settings: NodeSettings) => NodeSettings;
|
|
@@ -36,6 +36,13 @@ export declare const createScriptingServiceMock: (opt: ScriptingServiceMockOptio
|
|
|
36
36
|
getFlowVariableInputs(): Promise<InputOutputModel>;
|
|
37
37
|
getInputObjects(): Promise<InputOutputModel[]>;
|
|
38
38
|
getOutputObjects(): Promise<InputOutputModel[]>;
|
|
39
|
+
getPortConfigs(): Promise<import('./scripting-service').PortConfigs>;
|
|
40
|
+
isCallKnimeUiApiAvailable(portToTestFor: {
|
|
41
|
+
nodeId: string | null;
|
|
42
|
+
portIdx: number;
|
|
43
|
+
portViewConfigs: import('./scripting-service').PortViewConfig[];
|
|
44
|
+
portName: string;
|
|
45
|
+
}): Promise<boolean>;
|
|
39
46
|
getInitialSettings: () => Promise<NodeSettings>;
|
|
40
47
|
registerSettingsGetterForApply: (settingsGetter: () => NodeSettings) => Promise<void>;
|
|
41
48
|
} & {
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { MonacoLSPConnection } from './lsp/connection';
|
|
2
2
|
import { InputOutputModel } from './components/InputOutputItem.vue';
|
|
3
3
|
|
|
4
|
+
export type PortViewConfig = {
|
|
5
|
+
label: string;
|
|
6
|
+
portViewIdx: number;
|
|
7
|
+
};
|
|
8
|
+
type PortConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* null if no node is connected to an input port
|
|
11
|
+
*/
|
|
12
|
+
nodeId: string | null;
|
|
13
|
+
portIdx: number;
|
|
14
|
+
portViewConfigs: PortViewConfig[];
|
|
15
|
+
portName: string;
|
|
16
|
+
};
|
|
17
|
+
export type PortConfigs = {
|
|
18
|
+
inputPorts: PortConfig[];
|
|
19
|
+
};
|
|
4
20
|
export type NodeSettings = {
|
|
5
21
|
script: string;
|
|
6
22
|
scriptUsedFlowVariable?: string;
|
|
@@ -15,6 +31,8 @@ declare const scriptingService: {
|
|
|
15
31
|
getFlowVariableInputs(): Promise<InputOutputModel>;
|
|
16
32
|
getInputObjects(): Promise<InputOutputModel[]>;
|
|
17
33
|
getOutputObjects(): Promise<InputOutputModel[]>;
|
|
34
|
+
getPortConfigs(): Promise<PortConfigs>;
|
|
35
|
+
isCallKnimeUiApiAvailable(portToTestFor: PortConfig): Promise<boolean>;
|
|
18
36
|
getInitialSettings: () => Promise<NodeSettings>;
|
|
19
37
|
registerSettingsGetterForApply: (settingsGetter: () => NodeSettings) => Promise<void>;
|
|
20
38
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UseCodeEditorReturn } from '../editor';
|
|
2
|
+
|
|
1
3
|
export interface Message {
|
|
2
4
|
role: "reply" | "request";
|
|
3
5
|
content: string;
|
|
@@ -12,3 +14,5 @@ export type PromptResponseStore = {
|
|
|
12
14
|
export declare const usePromptResponseStore: () => PromptResponseStore;
|
|
13
15
|
export declare const clearPromptResponseStore: () => void;
|
|
14
16
|
export declare const showDisclaimer: import('vue').Ref<boolean>;
|
|
17
|
+
export declare const activeEditorStore: import('vue').ShallowRef<UseCodeEditorReturn | undefined>;
|
|
18
|
+
export declare const setActiveEditorStoreForAi: (store: UseCodeEditorReturn | undefined) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/scripting-editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.61",
|
|
5
5
|
"description": "Shared Scripting Editor components for KNIME",
|
|
6
6
|
"author": "KNIME AG, Zurich, Switzerland",
|
|
7
7
|
"license": "See the file license.txt",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"ci:lint:css": "npm run lint:css -- -f json -o test-results/stylelint.json",
|
|
22
22
|
"audit": "npm audit --omit dev",
|
|
23
23
|
"coverage": "vitest run --coverage",
|
|
24
|
-
"install-husky": "cd .. && husky
|
|
24
|
+
"install-husky": "cd .. && husky ./org.knime.scripting.editor.js/.husky"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@knime/ui-extension-service": "0.
|
|
27
|
+
"@knime/ui-extension-service": "0.32.0",
|
|
28
28
|
"@vueuse/core": "10.9.0",
|
|
29
29
|
"handlebars": "4.7.8",
|
|
30
30
|
"splitpanes": "3.1.5",
|
|
31
31
|
"vscode-languageserver-protocol": "3.17.5",
|
|
32
|
-
"vue": "3.
|
|
32
|
+
"vue": "3.x",
|
|
33
33
|
"webapps-common": "file:webapps-common",
|
|
34
34
|
"xterm": "5.3.0",
|
|
35
35
|
"xterm-addon-fit": "0.8.0",
|