@knime/scripting-editor 0.0.59 → 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.
@@ -1,11 +1,32 @@
1
1
  function o(e) {
2
- return new Promise((n) => setTimeout(n, e));
2
+ return new Promise((i) => setTimeout(i, e));
3
3
  }
4
- const l = 100, c = 2e3, t = (e, ...n) => {
5
- typeof consola > "u" ? console.log(e, ...n) : consola.log(e, ...n);
6
- }, a = (e, ...n) => {
7
- typeof consola > "u" ? console.error(e, ...n) : consola.error(e, ...n);
8
- }, u = [
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
- ], g = [
47
+ ], d = [
27
48
  {
28
49
  name: "Output Table 1"
29
50
  }
30
- ], S = {
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
- }, d = (e) => {
47
- const n = /* @__PURE__ */ new Map(), i = {
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(c);
52
- const r = n.get("codeSuggestion");
53
- return typeof r < "u" && r({
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(r, s) {
62
- return t(`Called scriptingService.sendToService("${r}")`, s), await o(l), e.sendToServiceMockResponses && r in e.sendToServiceMockResponses ? e.sendToServiceMockResponses[r](s) : r in i ? i[r](s) : (a(
63
- `${r} not implemented in sendToServiceMockResponses.
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 t("Called scriptingService.getInitialSettings"), Promise.resolve(e.initialSettings ?? { script: "Hello world" });
90
+ return r("Called scriptingService.getInitialSettings"), Promise.resolve(e.initialSettings ?? { script: "Hello world" });
70
91
  },
71
92
  registerSettingsGetterForApply() {
72
- return t("Called scriptingService.registerSettingsGetterForApply"), Promise.resolve();
93
+ return r("Called scriptingService.registerSettingsGetterForApply"), Promise.resolve();
73
94
  },
74
95
  // Input and output objects
75
96
  inputsAvailable() {
76
- return t("Called scriptingService.inputsAvailable"), Promise.resolve(e.inputsAvailable ?? !0);
97
+ return r("Called scriptingService.inputsAvailable"), Promise.resolve(e.inputsAvailable ?? !0);
77
98
  },
78
99
  getInputObjects() {
79
- return t("Called scriptingService.getInputObjects"), Promise.resolve(e.inputObjects ?? u);
100
+ return r("Called scriptingService.getInputObjects"), Promise.resolve(e.inputObjects ?? g);
80
101
  },
81
102
  getOutputObjects() {
82
- return t("Called scriptingService.getOutputObjects"), Promise.resolve(e.outputObjects ?? g);
103
+ return r("Called scriptingService.getOutputObjects"), Promise.resolve(e.outputObjects ?? d);
83
104
  },
84
105
  getFlowVariableInputs() {
85
- return t("Called scriptingService.getFlowVariableInputs"), Promise.resolve(
86
- e.flowVariableInputs ?? S
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 t("Called scriptingService.isCodeAssistantInstalled"), Promise.resolve(!0);
118
+ return r("Called scriptingService.isCodeAssistantInstalled"), Promise.resolve(!0);
92
119
  },
93
120
  isCodeAssistantEnabled() {
94
- return t("Called scriptingService.isCodeAssistantEnabled"), Promise.resolve(!0);
121
+ return r("Called scriptingService.isCodeAssistantEnabled"), Promise.resolve(!0);
95
122
  },
96
123
  // Event handler
97
- registerEventHandler(r, s) {
98
- t("Called scriptingService.registerEventHandler", r), n.set(r, s);
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 t("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
129
+ return r("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
103
130
  },
104
131
  // Console handling
105
- eventHandlers: n
132
+ eventHandlers: i
106
133
  };
107
134
  };
108
135
  export {
109
- S as DEFAULT_FLOW_VARIABLE_INPUTS,
110
- u as DEFAULT_INPUT_OBJECTS,
111
- g as DEFAULT_OUTPUT_OBJECTS,
112
- d as createScriptingServiceMock
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
  }>> & {
@@ -29,9 +29,13 @@ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimePr
29
29
  toggleExpansion: () => void;
30
30
  setExpanded: (b: boolean) => void;
31
31
  isExpanded: () => any;
32
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
32
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
+ "input-output-item-clicked": (...args: any[]) => void;
34
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
33
35
  inputOutputItem: InputOutputModel;
34
- }>>>, {}, {}>;
36
+ }>>> & {
37
+ "onInput-output-item-clicked"?: ((...args: any[]) => any) | undefined;
38
+ }, {}, {}>;
35
39
  export default _default;
36
40
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
37
41
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,6 +1,8 @@
1
1
  declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
2
  "drop-event-handler-created": (dropEventHandler: (payload: DragEvent) => void) => void;
3
+ "input-output-item-insertion": (codeToInsert: string, requiredImport: string | undefined) => void;
3
4
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
4
5
  "onDrop-event-handler-created"?: ((dropEventHandler: (payload: DragEvent) => void) => any) | undefined;
6
+ "onInput-output-item-insertion"?: ((codeToInsert: string, requiredImport: string | undefined) => any) | undefined;
5
7
  }, {}, {}>;
6
8
  export default _default;
@@ -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
+ } & {};
@@ -26,6 +26,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
26
26
  rightPaneMinimumWidthInPixel: () => 0;
27
27
  toSettings: (settings: NodeSettings) => NodeSettings;
28
28
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
29
+ "input-output-item-insertion": (...args: any[]) => void;
29
30
  "menu-item-clicked": (...args: any[]) => void;
30
31
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
31
32
  fileName: null;
@@ -40,9 +41,10 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
40
41
  rightPaneMinimumWidthInPixel: () => 0;
41
42
  toSettings: (settings: NodeSettings) => NodeSettings;
42
43
  }>>> & {
44
+ "onInput-output-item-insertion"?: ((...args: any[]) => any) | undefined;
43
45
  "onMenu-item-clicked"?: ((...args: any[]) => any) | undefined;
44
46
  }, {
45
- menuItems: MenuItem[];
47
+ menuItems: MenuItem<any, any>[];
46
48
  showControlBar: boolean;
47
49
  fileName: string | null;
48
50
  toSettings: (settings: NodeSettings) => NodeSettings;
@@ -33,6 +33,11 @@ export type UseCodeEditorReturn = {
33
33
  * @param text the text to set
34
34
  */
35
35
  setInitialText: (text: string) => void;
36
+ /**
37
+ * Inserts the specified text at the current cursor position in the editor.
38
+ * @param text the text to insert.
39
+ */
40
+ insertText: (text: string) => void;
36
41
  };
37
42
  export type UseDiffEditorParams = ContainerParams & {
38
43
  originalModel: monaco.editor.ITextModel;
@@ -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.59",
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 install ./org.knime.scripting.editor.js/.husky"
24
+ "install-husky": "cd .. && husky ./org.knime.scripting.editor.js/.husky"
25
25
  },
26
26
  "dependencies": {
27
- "@knime/ui-extension-service": "0.30.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.4.21",
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",