@knime/scripting-editor 0.0.86 → 0.0.88

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,15 +1,14 @@
1
- function c(n) {
2
- return new Promise((r) => setTimeout(r, n));
1
+ import { l as i } from "./log-BmIREpQ5.js";
2
+ function c(r) {
3
+ return new Promise((n) => setTimeout(n, r));
3
4
  }
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
- }, u = (n) => {
9
- const r = /* @__PURE__ */ new Map(), i = {
5
+ const t = 100, l = 2e3, S = (r, ...n) => {
6
+ typeof consola > "u" ? console.error(r, ...n) : consola.error(r, ...n);
7
+ }, a = (r) => {
8
+ const n = /* @__PURE__ */ new Map(), o = {
10
9
  suggestCode: async () => {
11
10
  await c(l);
12
- const e = r.get("codeSuggestion");
11
+ const e = n.get("codeSuggestion");
13
12
  return typeof e < "u" && e({
14
13
  status: "SUCCESS",
15
14
  code: JSON.stringify({ code: "// THIS IS A FAKE AI SUGGESTION" })
@@ -18,31 +17,31 @@ const t = 100, l = 2e3, s = (n, ...r) => {
18
17
  abortSuggestCodeRequest: () => Promise.resolve()
19
18
  };
20
19
  return {
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(
20
+ async sendToService(e, s) {
21
+ return i(`Called scriptingService.sendToService("${e}")`, s), await c(t), r.sendToServiceMockResponses && e in r.sendToServiceMockResponses ? r.sendToServiceMockResponses[e](s) : e in o ? o[e](s) : (S(
23
22
  `${e} not implemented in sendToServiceMockResponses.
24
23
  Returning undefined.`
25
24
  ), Promise.resolve());
26
25
  },
27
26
  // Settings and dialog window
28
27
  isCallKnimeUiApiAvailable() {
29
- return s("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!0);
28
+ return i("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!0);
30
29
  },
31
30
  isLoggedIntoHub() {
32
- return s("Called scriptingService.isLoggedIntoHub"), Promise.resolve(!0);
31
+ return i("Called scriptingService.isLoggedIntoHub"), Promise.resolve(!0);
33
32
  },
34
33
  // Event handler
35
- registerEventHandler(e, o) {
36
- s("Called scriptingService.registerEventHandler", e), r.set(e, o);
34
+ registerEventHandler(e, s) {
35
+ i("Called scriptingService.registerEventHandler", e), n.set(e, s);
37
36
  },
38
37
  // Language server
39
38
  connectToLanguageServer() {
40
- return s("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
39
+ return i("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
41
40
  },
42
41
  // Console handling
43
- eventHandlers: r
42
+ eventHandlers: n
44
43
  };
45
44
  };
46
45
  export {
47
- u as createScriptingServiceMock
46
+ a as createScriptingServiceMock
48
47
  };
@@ -1,13 +1,35 @@
1
+ import { l as e } from "./log-BmIREpQ5.js";
1
2
  const r = {
2
3
  settingsAreOverriddenByFlowVariable: !1,
3
4
  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())
5
+ }, s = (t) => ({
6
+ set: () => {
7
+ e(
8
+ `Called settings service mock registerSettings callback setValue ${t}`
9
+ );
10
+ },
11
+ unset: () => {
12
+ e(
13
+ `Called settings service mock registerSettings callback unsetValue ${t}`
14
+ );
15
+ }
16
+ }), l = () => (e("Called settings service mock registerSettings"), Promise.resolve(() => (e("Called settings service mock registerSettings callback"), {
17
+ setValue: () => {
18
+ e("Called settings service mock registerSettings callback setValue");
19
+ },
20
+ addExposedFlowVariable: () => (e(
21
+ "Called settings service mock registerSettings callback addExposedFlowVariable"
22
+ ), s("addExposedFlowVariable")),
23
+ addControllingFlowVariable: () => (e(
24
+ "Called settings service mock registerSettings callback addControllingFlowVariable"
25
+ ), s("addControllingFlowVariable"))
26
+ }))), a = (t) => ({
27
+ getSettings: () => (e("Called settings service mock getSettings"), Promise.resolve(t ?? r)),
28
+ registerSettingsGetterForApply: () => (e("Called settings service mock registerSettingsGetterForApply"), Promise.resolve()),
29
+ registerSettings: l
9
30
  });
10
31
  export {
11
32
  r as DEFAULT_INITIAL_SETTINGS,
12
- s as createSettingsServiceMock
33
+ a as createSettingsServiceMock,
34
+ l as registerSettingsMock
13
35
  };
@@ -1,11 +1,26 @@
1
1
  import { Component } from 'vue';
2
2
  export type SubItem<PropType extends Record<string, any>> = {
3
3
  name: string;
4
+ /**
5
+ * The type of the subItem. Can be a string, in which case that is displayed as
6
+ * the type, or a component with optional props, in which case the component is
7
+ * responsible for displaying the type.
8
+ */
4
9
  type: string | {
5
10
  component: Component;
6
11
  props?: PropType;
7
12
  };
13
+ /**
14
+ * Whether the subItem is supported in the current editor or not. If not, it is
15
+ * displayed differently and does not support insertion.
16
+ */
8
17
  supported: boolean;
18
+ /**
19
+ * A text that is provided to the template when this sub item is inserted into
20
+ * the code. Note that this is optional. The template also has access to the name
21
+ * which can be enough.
22
+ */
23
+ insertionText?: string | null;
9
24
  };
10
25
  export type InputOutputModel = {
11
26
  name: string;
@@ -34,6 +49,9 @@ export type InputOutputModel = {
34
49
  * Whether multi selection of subItems is supported or not
35
50
  */
36
51
  multiSelection?: boolean;
52
+ /**
53
+ * List of SubItems for this I/O-Object
54
+ */
37
55
  subItems?: SubItem<Record<string, any>>[];
38
56
  };
39
57
  export declare const INPUT_OUTPUT_DRAG_EVENT_ID = "input_output_drag_event";
@@ -0,0 +1 @@
1
+ export declare const useRegisterScriptSettingsChange: (modelOrView: "model" | "view", getScript: () => string) => void;
@@ -1,5 +1,5 @@
1
1
  import { GenericInitialData, InitialDataServiceType, InputConnectionInfo } from './initial-data-service';
2
- import { InputOutputModel } from 'lib/main';
2
+ import { InputOutputModel } from './components/InputOutputItem.vue';
3
3
  export declare const DEFAULT_INPUT_OBJECTS: InputOutputModel[];
4
4
  export declare const DEFAULT_PORT_INFORMATION: InputConnectionInfo[];
5
5
  export declare const DEFAULT_OUTPUT_OBJECTS: InputOutputModel[];
@@ -0,0 +1 @@
1
+ export declare const log: (message: any, ...args: any[]) => void;
@@ -1,3 +1,4 @@
1
+ import { SettingState } from '@knime/ui-extension-service';
1
2
  import { GenericInitialData } from './initial-data-service';
2
3
  import { GenericNodeSettings } from './settings-service';
3
4
  type InitialDataAndSettings = {
@@ -7,11 +8,13 @@ type InitialDataAndSettings = {
7
8
  declare class SettingsHelper {
8
9
  private static instance;
9
10
  private jsonDataService;
11
+ private readonly dialogService;
10
12
  private cachedInitialDataAndSettings;
11
13
  private constructor();
12
14
  private loadDataIntoCache;
13
15
  getInitialDataAndSettings(): Promise<InitialDataAndSettings>;
14
16
  registerApplyListener(settingsGetter: () => GenericNodeSettings): Promise<void>;
17
+ registerSettings<T>(modelOrView: "view" | "model"): Promise<(initialSetting: T) => SettingState>;
15
18
  static getInstance(): SettingsHelper;
16
19
  }
17
20
  export declare const getSettingsHelper: () => SettingsHelper;
@@ -1,3 +1,5 @@
1
1
  import { GenericNodeSettings, SettingsServiceType } from './settings-service';
2
+ import { SettingState } from '@knime/ui-extension-service';
2
3
  export declare const DEFAULT_INITIAL_SETTINGS: GenericNodeSettings;
4
+ export declare const registerSettingsMock: () => Promise<() => SettingState<any>>;
3
5
  export declare const createSettingsServiceMock: (data?: GenericNodeSettings) => SettingsServiceType;
@@ -5,6 +5,7 @@ export type GenericNodeSettings = {
5
5
  declare const settingsService: {
6
6
  getSettings: () => Promise<GenericNodeSettings>;
7
7
  registerSettingsGetterForApply: (settingsGetter: () => GenericNodeSettings) => Promise<void>;
8
+ registerSettings: (modelOrView: "model" | "view") => Promise<(initialSetting: unknown) => import('@knime/ui-extension-service').SettingState>;
8
9
  };
9
10
  export type SettingsServiceType = typeof settingsService;
10
11
  export declare const getSettingsService: () => SettingsServiceType;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knime/scripting-editor",
3
3
  "type": "module",
4
- "version": "0.0.86",
4
+ "version": "0.0.88",
5
5
  "description": "Shared Scripting Editor components for KNIME",
6
6
  "author": "KNIME AG, Zurich, Switzerland",
7
7
  "license": "See the file license.txt",