@knime/scripting-editor 0.0.77 → 0.0.79

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,86 +1,16 @@
1
- function o(e) {
2
- return new Promise((s) => setTimeout(s, e));
1
+ function c(n) {
2
+ return new Promise((r) => setTimeout(r, n));
3
3
  }
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
- }, a = 100, c = 2e3, r = (e, ...s) => {
26
- typeof consola > "u" ? console.log(e, ...s) : consola.log(e, ...s);
27
- }, u = (e, ...s) => {
28
- typeof consola > "u" ? console.error(e, ...s) : consola.error(e, ...s);
29
- }, p = [
30
- {
31
- name: "Input table 1",
32
- portType: "table",
33
- subItems: [
34
- {
35
- name: "Column 1",
36
- type: "Number",
37
- supported: !0
38
- },
39
- {
40
- name: "Column 2",
41
- type: "String",
42
- supported: !0
43
- },
44
- {
45
- name: "Column 3",
46
- type: "Bit Vector",
47
- supported: !1
48
- }
49
- ]
50
- }
51
- ], d = [
52
- {
53
- name: "Output table 1",
54
- portType: "table"
55
- }
56
- ], g = {
57
- name: "Flow Variables",
58
- portType: "flowVariable",
59
- subItems: [
60
- {
61
- name: "flowVar1",
62
- type: "Number",
63
- supported: !0
64
- },
65
- {
66
- name: "flowVar2",
67
- type: "String",
68
- supported: !0
69
- },
70
- {
71
- name: "flowVar3",
72
- type: "Something",
73
- supported: !1
74
- }
75
- ]
76
- }, S = (e) => {
77
- const s = /* @__PURE__ */ new Map(), n = {
78
- getHubId: () => Promise.resolve("My Mocked KNIME Hub"),
79
- isLoggedIn: () => Promise.resolve(!0),
4
+ const t = 100, l = 2e3, s = (n, ...r) => {
5
+ typeof consola > "u" ? console.log(n, ...r) : consola.log(n, ...r);
6
+ }, S = (n, ...r) => {
7
+ typeof consola > "u" ? console.error(n, ...r) : consola.error(n, ...r);
8
+ }, a = (n) => {
9
+ const r = /* @__PURE__ */ new Map(), i = {
80
10
  suggestCode: async () => {
81
- await o(c);
82
- const t = s.get("codeSuggestion");
83
- return typeof t < "u" && t({
11
+ await c(l);
12
+ const e = r.get("codeSuggestion");
13
+ return typeof e < "u" && e({
84
14
  status: "SUCCESS",
85
15
  code: JSON.stringify({ code: "// THIS IS A FAKE AI SUGGESTION" })
86
16
  }), {};
@@ -88,62 +18,28 @@ const l = {
88
18
  abortSuggestCodeRequest: () => Promise.resolve()
89
19
  };
90
20
  return {
91
- async sendToService(t, i) {
92
- return r(`Called scriptingService.sendToService("${t}")`, i), await o(a), e.sendToServiceMockResponses && t in e.sendToServiceMockResponses ? e.sendToServiceMockResponses[t](i) : t in n ? n[t](i) : (u(
93
- `${t} not implemented in sendToServiceMockResponses.
21
+ async sendToService(e, o) {
22
+ return s(`Called scriptingService.sendToService("${e}")`, o), await c(t), n.sendToServiceMockResponses && e in n.sendToServiceMockResponses ? n.sendToServiceMockResponses[e](o) : e in i ? i[e](o) : (S(
23
+ `${e} not implemented in sendToServiceMockResponses.
94
24
  Returning undefined.`
95
25
  ), Promise.resolve());
96
26
  },
97
27
  // Settings and dialog window
98
- getInitialSettings() {
99
- return r("Called scriptingService.getInitialSettings"), Promise.resolve(e.initialSettings ?? { script: "Hello world" });
100
- },
101
- registerSettingsGetterForApply() {
102
- return r("Called scriptingService.registerSettingsGetterForApply"), Promise.resolve();
103
- },
104
- // Input and output objects
105
- inputsAvailable() {
106
- return r("Called scriptingService.inputsAvailable"), Promise.resolve(e.inputsAvailable ?? !0);
107
- },
108
- getInputObjects() {
109
- return r("Called scriptingService.getInputObjects"), Promise.resolve(e.inputObjects ?? p);
110
- },
111
- getOutputObjects() {
112
- return r("Called scriptingService.getOutputObjects"), Promise.resolve(e.outputObjects ?? d);
113
- },
114
- getFlowVariableInputs() {
115
- return r("Called scriptingService.getFlowVariableInputs"), Promise.resolve(
116
- e.flowVariableInputs ?? g
117
- );
118
- },
119
- getPortConfigs() {
120
- return r("Called scriptingService.getPortConfigs"), Promise.resolve(l);
121
- },
122
28
  isCallKnimeUiApiAvailable() {
123
- return r("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!0);
124
- },
125
- // Code assistant
126
- isCodeAssistantInstalled() {
127
- return r("Called scriptingService.isCodeAssistantInstalled"), Promise.resolve(!0);
128
- },
129
- isCodeAssistantEnabled() {
130
- return r("Called scriptingService.isCodeAssistantEnabled"), Promise.resolve(!0);
29
+ return s("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!0);
131
30
  },
132
31
  // Event handler
133
- registerEventHandler(t, i) {
134
- r("Called scriptingService.registerEventHandler", t), s.set(t, i);
32
+ registerEventHandler(e, o) {
33
+ s("Called scriptingService.registerEventHandler", e), r.set(e, o);
135
34
  },
136
35
  // Language server
137
36
  connectToLanguageServer() {
138
- return r("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
37
+ return s("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
139
38
  },
140
39
  // Console handling
141
- eventHandlers: s
40
+ eventHandlers: r
142
41
  };
143
42
  };
144
43
  export {
145
- g as DEFAULT_FLOW_VARIABLE_INPUTS,
146
- p as DEFAULT_INPUT_OBJECTS,
147
- d as DEFAULT_OUTPUT_OBJECTS,
148
- S as createScriptingServiceMock
44
+ a as createScriptingServiceMock
149
45
  };
@@ -0,0 +1 @@
1
+ export * from './src/settings-service-browser-mock'
@@ -0,0 +1,13 @@
1
+ const r = {
2
+ settingsAreOverriddenByFlowVariable: !1,
3
+ script: "hello world (from browser mock)"
4
+ }, o = (e, ...t) => {
5
+ typeof consola > "u" ? console.log(e, ...t) : consola.log(e, ...t);
6
+ }, s = (e) => ({
7
+ getSettings: () => (o("Called settings service mock getSettings"), Promise.resolve(e ?? r)),
8
+ registerSettingsGetterForApply: () => (o("Called settings service mock registerSettingsGetterForApply"), Promise.resolve())
9
+ });
10
+ export {
11
+ r as DEFAULT_INITIAL_SETTINGS,
12
+ s as createSettingsServiceMock
13
+ };
@@ -1,4 +1,4 @@
1
- import { PortViewConfig } from '../scripting-service';
1
+ import { PortViewConfig } from '../initial-data-service';
2
2
 
3
3
  interface Props {
4
4
  inputNodeId: string;
@@ -1,20 +1,20 @@
1
- import { NodeSettings } from '../scripting-service';
1
+ import { GenericNodeSettings } from '../settings-service';
2
2
 
3
3
  interface Props {
4
4
  showControlBar: boolean;
5
5
  language: string;
6
6
  fileName: string;
7
- toSettings?: (settings: NodeSettings) => NodeSettings;
7
+ toSettings?: (settings: GenericNodeSettings) => GenericNodeSettings;
8
8
  dropEventHandler?: (event: DragEvent) => void;
9
9
  }
10
10
  declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
11
- toSettings: (settings: NodeSettings) => NodeSettings;
11
+ toSettings: (settings: GenericNodeSettings) => GenericNodeSettings;
12
12
  dropEventHandler: () => void;
13
13
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
14
- toSettings: (settings: NodeSettings) => NodeSettings;
14
+ toSettings: (settings: GenericNodeSettings) => GenericNodeSettings;
15
15
  dropEventHandler: () => void;
16
16
  }>>>, {
17
- toSettings: (settings: NodeSettings) => NodeSettings;
17
+ toSettings: (settings: GenericNodeSettings) => GenericNodeSettings;
18
18
  dropEventHandler: (event: DragEvent) => void;
19
19
  }, {}>;
20
20
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { MenuItem } from '@knime/components';
2
- import { NodeSettings } from '../scripting-service';
3
2
  import { PaneSizes } from './utils/paneSizes';
3
+ import { GenericNodeSettings } from '../settings-service';
4
4
 
5
5
  type TabItem = {
6
6
  label: string;
@@ -15,7 +15,7 @@ interface Props {
15
15
  showControlBar?: boolean;
16
16
  initialPaneSizes?: PaneSizes;
17
17
  rightPaneMinimumWidthInPixel?: number;
18
- toSettings?: (settings: NodeSettings) => NodeSettings;
18
+ toSettings?: (settings: GenericNodeSettings) => GenericNodeSettings;
19
19
  additionalBottomPaneTabContent?: TabItem[];
20
20
  }
21
21
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
@@ -30,8 +30,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
30
30
  bottom: number;
31
31
  };
32
32
  rightPaneMinimumWidthInPixel: () => 0;
33
- toSettings: (settings: NodeSettings) => NodeSettings;
34
33
  additionalBottomPaneTabContent: () => TabItem[];
34
+ toSettings: (settings: GenericNodeSettings) => GenericNodeSettings;
35
35
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
36
36
  "menu-item-clicked": (...args: any[]) => void;
37
37
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
@@ -46,8 +46,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
46
46
  bottom: number;
47
47
  };
48
48
  rightPaneMinimumWidthInPixel: () => 0;
49
- toSettings: (settings: NodeSettings) => NodeSettings;
50
49
  additionalBottomPaneTabContent: () => TabItem[];
50
+ toSettings: (settings: GenericNodeSettings) => GenericNodeSettings;
51
51
  }>>> & {
52
52
  "onMenu-item-clicked"?: ((...args: any[]) => any) | undefined;
53
53
  }, {
@@ -55,7 +55,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
55
55
  menuItems: MenuItem<any, any>[];
56
56
  showControlBar: boolean;
57
57
  fileName: string | null;
58
- toSettings: (settings: NodeSettings) => NodeSettings;
58
+ toSettings: (settings: GenericNodeSettings) => GenericNodeSettings;
59
59
  initialPaneSizes: PaneSizes;
60
60
  rightPaneMinimumWidthInPixel: number;
61
61
  rightPaneLayout: "fixed" | "relative";
@@ -0,0 +1,8 @@
1
+ import { GenericInitialData, InitialDataServiceType } from './initial-data-service';
2
+ import { InputOutputModel } from 'lib/main';
3
+
4
+ export declare const DEFAULT_INPUT_OBJECTS: InputOutputModel[];
5
+ export declare const DEFAULT_OUTPUT_OBJECTS: InputOutputModel[];
6
+ export declare const DEFAULT_FLOW_VARIABLE_INPUTS: InputOutputModel;
7
+ export declare const DEFAULT_INITIAL_DATA: GenericInitialData;
8
+ export declare const createInitialDataServiceMock: (data?: GenericInitialData) => InitialDataServiceType;
@@ -0,0 +1,38 @@
1
+ import { InputOutputModel } from './components/InputOutputItem.vue';
2
+
3
+ export type PortViewConfig = {
4
+ label: string;
5
+ portViewIdx: number;
6
+ };
7
+ export type PortConfig = {
8
+ /**
9
+ * null if no node is connected to an input port
10
+ */
11
+ nodeId: string | null;
12
+ portIdx: number;
13
+ portViewConfigs: PortViewConfig[];
14
+ portName: string;
15
+ };
16
+ export type PortConfigs = {
17
+ inputPorts: PortConfig[];
18
+ };
19
+ export type KAIConfig = {
20
+ codeAssistantEnabled: boolean;
21
+ codeAssistantInstalled: boolean;
22
+ hubId: string;
23
+ loggedIn: boolean;
24
+ };
25
+ export type GenericInitialData = {
26
+ inputPortConfigs: PortConfigs;
27
+ inputObjects: InputOutputModel[];
28
+ flowVariables: InputOutputModel;
29
+ inputsAvailable: boolean;
30
+ outputObjects?: InputOutputModel[];
31
+ kAiConfig: KAIConfig;
32
+ };
33
+ declare const initialDataService: {
34
+ getInitialData: () => Promise<GenericInitialData>;
35
+ };
36
+ export type InitialDataServiceType = typeof initialDataService;
37
+ export declare const getInitialDataService: () => InitialDataServiceType;
38
+ export {};
@@ -1,16 +1,7 @@
1
- import { InputOutputModel } from './components/InputOutputItem.vue';
2
- import { NodeSettings, ScriptingServiceType } from './scripting-service';
1
+ import { ScriptingServiceType } from './scripting-service';
3
2
 
4
- export declare const DEFAULT_INPUT_OBJECTS: InputOutputModel[];
5
- export declare const DEFAULT_OUTPUT_OBJECTS: InputOutputModel[];
6
- export declare const DEFAULT_FLOW_VARIABLE_INPUTS: InputOutputModel;
7
3
  export type ScriptingServiceMockOptions = {
8
4
  sendToServiceMockResponses?: Record<string, (options?: any[]) => Promise<any>>;
9
- initialSettings?: NodeSettings;
10
- inputsAvailable?: boolean;
11
- inputObjects?: InputOutputModel[];
12
- outputObjects?: InputOutputModel[];
13
- flowVariableInputs?: InputOutputModel;
14
5
  };
15
6
  export declare const createScriptingServiceMock: (opt: ScriptingServiceMockOptions) => ScriptingServiceType & {
16
7
  eventHandlers: Map<string, (args: any) => void>;
@@ -1,40 +1,11 @@
1
- import { InputOutputModel } from './components/InputOutputItem.vue';
2
1
  import { MonacoLSPConnection } from './lsp/connection';
2
+ import { PortConfig } from './initial-data-service';
3
3
 
4
- export type PortViewConfig = {
5
- label: string;
6
- portViewIdx: number;
7
- };
8
- export 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
- };
20
- export type NodeSettings = {
21
- script: string;
22
- scriptUsedFlowVariable?: string | null;
23
- };
24
4
  declare const scriptingService: {
25
5
  sendToService(methodName: string, options?: any[] | undefined): Promise<any>;
26
6
  registerEventHandler(type: string, handler: (args: any) => void): void;
27
7
  connectToLanguageServer(): Promise<MonacoLSPConnection>;
28
- isCodeAssistantEnabled(): Promise<boolean>;
29
- isCodeAssistantInstalled(): Promise<boolean>;
30
- inputsAvailable(): Promise<boolean>;
31
- getFlowVariableInputs(): Promise<InputOutputModel>;
32
- getInputObjects(): Promise<InputOutputModel[]>;
33
- getOutputObjects(): Promise<InputOutputModel[]>;
34
- getPortConfigs(): Promise<PortConfigs>;
35
8
  isCallKnimeUiApiAvailable(portToTestFor: PortConfig): Promise<boolean>;
36
- getInitialSettings: () => Promise<NodeSettings>;
37
- registerSettingsGetterForApply: (settingsGetter: () => NodeSettings) => Promise<void>;
38
9
  };
39
10
  export type ScriptingServiceType = typeof scriptingService;
40
11
  /**
@@ -0,0 +1,19 @@
1
+ import { GenericInitialData } from './initial-data-service';
2
+ import { GenericNodeSettings } from './settings-service';
3
+
4
+ type InitialDataAndSettings = {
5
+ initialData: GenericInitialData;
6
+ settings: GenericNodeSettings;
7
+ };
8
+ declare class SettingsHelper {
9
+ private static instance;
10
+ private jsonDataService;
11
+ private cachedInitialDataAndSettings;
12
+ private constructor();
13
+ private loadDataIntoCache;
14
+ getInitialDataAndSettings(): Promise<InitialDataAndSettings>;
15
+ registerApplyListener(settingsGetter: () => GenericNodeSettings): Promise<void>;
16
+ static getInstance(): SettingsHelper;
17
+ }
18
+ export declare const getSettingsHelper: () => SettingsHelper;
19
+ export {};
@@ -0,0 +1,4 @@
1
+ import { GenericNodeSettings, SettingsServiceType } from './settings-service';
2
+
3
+ export declare const DEFAULT_INITIAL_SETTINGS: GenericNodeSettings;
4
+ export declare const createSettingsServiceMock: (data?: GenericNodeSettings) => SettingsServiceType;
@@ -0,0 +1,11 @@
1
+ export type GenericNodeSettings = {
2
+ [key: string]: any;
3
+ settingsAreOverriddenByFlowVariable?: boolean;
4
+ };
5
+ declare const settingsService: {
6
+ getSettings: () => Promise<GenericNodeSettings>;
7
+ registerSettingsGetterForApply: (settingsGetter: () => GenericNodeSettings) => Promise<void>;
8
+ };
9
+ export type SettingsServiceType = typeof settingsService;
10
+ export declare const getSettingsService: () => SettingsServiceType;
11
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knime/scripting-editor",
3
3
  "type": "module",
4
- "version": "0.0.77",
4
+ "version": "0.0.79",
5
5
  "description": "Shared Scripting Editor components for KNIME",
6
6
  "author": "KNIME AG, Zurich, Switzerland",
7
7
  "license": "See the file license.txt",
@@ -27,7 +27,6 @@
27
27
  "dependencies": {
28
28
  "@knime/components": "^1.0.5",
29
29
  "@knime/styles": "^1.0.0",
30
- "@knime/ui-extension-service": "0.36.0",
31
30
  "@knime/ui-extensions-renderer": "^1.0.11",
32
31
  "@knime/utils": "^1.0.4",
33
32
  "@vueuse/core": "10.09.0",
@@ -72,7 +71,8 @@
72
71
  },
73
72
  "peerDependencies": {
74
73
  "monaco-editor": "0.45.x",
75
- "vue": "3.4.27"
74
+ "vue": "3.4.27",
75
+ "@knime/ui-extension-service": "0.36.0"
76
76
  },
77
77
  "files": [
78
78
  "dist"
@@ -82,7 +82,9 @@
82
82
  "module": "./dist/main.js",
83
83
  "exports": {
84
84
  ".": "./dist/main.js",
85
- "./scripting-service-browser-mock": "./dist/scripting-service-browser-mock.js"
85
+ "./scripting-service-browser-mock": "./dist/scripting-service-browser-mock.js",
86
+ "./settings-service-browser-mock": "./dist/settings-service-browser-mock.js",
87
+ "./initial-data-service-browser-mock": "./dist/initial-data-service-browser-mock.js"
86
88
  },
87
89
  "engines": {
88
90
  "node": "20.x"