@knime/scripting-editor 0.0.110 → 0.0.112
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/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/demo/main.d.ts +1 -0
- package/dist/demo/mock-services.d.ts +9 -1
- package/dist/initial-data-service-browser-mock.js +17 -21
- package/dist/lib/loading.d.ts +2 -0
- package/dist/lib/main.d.ts +6 -5
- package/dist/loading.d.ts +2 -0
- package/dist/loading.js +14 -0
- package/dist/main.js +2728 -2733
- package/dist/scripting-service-browser-mock.js +4 -1
- package/dist/settings-service-browser-mock.js +6 -4
- package/dist/src/components/LoadingApp.vue.d.ts +2 -0
- package/dist/src/init.d.ts +28 -0
- package/dist/src/initial-data-service-browser-mock.d.ts +1 -2
- package/dist/src/initial-data-service.d.ts +3 -10
- package/dist/src/lsp/knime-io.d.ts +3 -1
- package/dist/src/scripting-service.d.ts +22 -31
- package/dist/src/settings-service-browser-mock.d.ts +1 -1
- package/dist/src/settings-service.d.ts +24 -8
- package/dist/src/types/public-api.d.ts +10 -0
- package/package.json +2 -1
- package/dist/src/settings-helper.d.ts +0 -21
|
@@ -31,9 +31,12 @@ const l = 100, a = 2e3, g = (r, ...n) => {
|
|
|
31
31
|
Returning undefined.`
|
|
32
32
|
), Promise.resolve());
|
|
33
33
|
},
|
|
34
|
+
getOutputPreviewTableInitialData() {
|
|
35
|
+
return Promise.resolve(void 0);
|
|
36
|
+
},
|
|
34
37
|
// Settings and dialog window
|
|
35
38
|
isCallKnimeUiApiAvailable() {
|
|
36
|
-
return i("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!
|
|
39
|
+
return i("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!1);
|
|
37
40
|
},
|
|
38
41
|
isKaiEnabled() {
|
|
39
42
|
return i("Called scriptingService.isKaiEnabled"), Promise.resolve(!0);
|
|
@@ -13,7 +13,7 @@ const r = {
|
|
|
13
13
|
`Called settings service mock registerSettings callback unsetValue ${t}`
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
|
-
}), l = () => (e("Called settings service mock registerSettings"),
|
|
16
|
+
}), l = () => (e("Called settings service mock registerSettings"), () => (e("Called settings service mock registerSettings callback"), {
|
|
17
17
|
setValue: () => {
|
|
18
18
|
e("Called settings service mock registerSettings callback setValue");
|
|
19
19
|
},
|
|
@@ -23,9 +23,11 @@ const r = {
|
|
|
23
23
|
addControllingFlowVariable: () => (e(
|
|
24
24
|
"Called settings service mock registerSettings callback addControllingFlowVariable"
|
|
25
25
|
), s("addControllingFlowVariable"))
|
|
26
|
-
}))
|
|
27
|
-
getSettings: () => (e("Called settings service mock getSettings"),
|
|
28
|
-
registerSettingsGetterForApply: () =>
|
|
26
|
+
})), a = (t) => ({
|
|
27
|
+
getSettings: () => (e("Called settings service mock getSettings"), t ?? r),
|
|
28
|
+
registerSettingsGetterForApply: () => {
|
|
29
|
+
e("Called settings service mock registerSettingsGetterForApply");
|
|
30
|
+
},
|
|
29
31
|
registerSettings: l
|
|
30
32
|
});
|
|
31
33
|
export {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GenericInitialData } from './initial-data-service';
|
|
2
|
+
import { ScriptingServiceType } from './scripting-service';
|
|
3
|
+
import { SettingsServiceType } from './settings-service';
|
|
4
|
+
export declare const getScriptingService: () => ScriptingServiceType;
|
|
5
|
+
export declare const getInitialData: () => GenericInitialData;
|
|
6
|
+
export declare const getSettingsService: () => SettingsServiceType;
|
|
7
|
+
/**
|
|
8
|
+
* Initializes the scripting editor services and sets up the display mode.
|
|
9
|
+
*
|
|
10
|
+
* This function must be called before using any other scripting editor functionality.
|
|
11
|
+
* It creates and configures the singleton instances of ScriptingService and SettingsService,
|
|
12
|
+
* fetches initial data from the backend, and sets up display mode management.
|
|
13
|
+
*
|
|
14
|
+
* @returns A Promise that resolves when all services are initialized
|
|
15
|
+
*/
|
|
16
|
+
export declare const init: () => Promise<void>;
|
|
17
|
+
export type InitMockData = {
|
|
18
|
+
scriptingService?: ScriptingServiceType;
|
|
19
|
+
initialData?: GenericInitialData;
|
|
20
|
+
settingsService?: SettingsServiceType;
|
|
21
|
+
displayMode?: "small" | "large";
|
|
22
|
+
};
|
|
23
|
+
export declare const initMocked: (mockData: InitMockData) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Initialize the console event handler to forward console events from the
|
|
26
|
+
* backend to the frontend console handler.
|
|
27
|
+
*/
|
|
28
|
+
export declare const initConsoleEventHandler: () => void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { InputOutputModel } from './components/InputOutputItem.vue';
|
|
2
|
-
import { GenericInitialData,
|
|
2
|
+
import { GenericInitialData, InputConnectionInfo } from './initial-data-service';
|
|
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[];
|
|
6
6
|
export declare const DEFAULT_FLOW_VARIABLE_INPUTS: InputOutputModel;
|
|
7
7
|
export declare const DEFAULT_INITIAL_DATA: GenericInitialData;
|
|
8
|
-
export declare const createInitialDataServiceMock: (data?: GenericInitialData) => InitialDataServiceType;
|
|
@@ -4,10 +4,8 @@ export type PortViewConfig = {
|
|
|
4
4
|
portViewIdx: number;
|
|
5
5
|
};
|
|
6
6
|
export type PortConfig = {
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
nodeId: string | null;
|
|
7
|
+
/** undefined if no node is connected to an input port */
|
|
8
|
+
nodeId?: string;
|
|
11
9
|
portIdx: number;
|
|
12
10
|
portViewConfigs: PortViewConfig[];
|
|
13
11
|
portName: string;
|
|
@@ -39,10 +37,5 @@ export type GenericInitialData = {
|
|
|
39
37
|
inputConnectionInfo: InputConnectionInfo[];
|
|
40
38
|
outputObjects?: InputOutputModel[];
|
|
41
39
|
kAiConfig: KAIConfig;
|
|
40
|
+
[key: string]: unknown;
|
|
42
41
|
};
|
|
43
|
-
declare const initialDataService: {
|
|
44
|
-
getInitialData: () => Promise<GenericInitialData>;
|
|
45
|
-
};
|
|
46
|
-
export type InitialDataServiceType = typeof initialDataService;
|
|
47
|
-
export declare const getInitialDataService: () => InitialDataServiceType;
|
|
48
|
-
export {};
|
|
@@ -7,7 +7,7 @@ import { AbstractMessageReader, AbstractMessageWriter, DataCallback, Disposable,
|
|
|
7
7
|
export declare class KnimeMessageReader extends AbstractMessageReader implements MessageReader {
|
|
8
8
|
protected messageCache: string[];
|
|
9
9
|
protected callback: DataCallback | null;
|
|
10
|
-
constructor();
|
|
10
|
+
constructor(registerEventHandler: (eventHandler: (message: string) => void) => void);
|
|
11
11
|
listen(callback: DataCallback): Disposable;
|
|
12
12
|
readMessage(message: string): void;
|
|
13
13
|
}
|
|
@@ -15,6 +15,8 @@ export declare class KnimeMessageReader extends AbstractMessageReader implements
|
|
|
15
15
|
* This class is used to write messages to the language server.
|
|
16
16
|
*/
|
|
17
17
|
export declare class KnimeMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
|
18
|
+
private readonly sendMessage;
|
|
19
|
+
constructor(sendMessage: (message: string) => Promise<void>);
|
|
18
20
|
write(msg: Message): Promise<void>;
|
|
19
21
|
end(): void;
|
|
20
22
|
}
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
+
import { JsonDataService } from '@knime/ui-extension-service';
|
|
1
2
|
import { PortConfig } from './initial-data-service';
|
|
2
3
|
import { MonacoLSPConnection } from './lsp/connection';
|
|
4
|
+
import { PublicAPI } from './types/public-api';
|
|
3
5
|
export type UsageData = {
|
|
4
6
|
limit: number | null;
|
|
5
7
|
used: number;
|
|
6
8
|
};
|
|
7
|
-
declare
|
|
9
|
+
export declare class ScriptingService {
|
|
10
|
+
private readonly jsonDataService;
|
|
11
|
+
private readonly eventPoller;
|
|
12
|
+
/**
|
|
13
|
+
* Internal constructor — use `getScriptingService()` from `init.ts` instead.
|
|
14
|
+
*
|
|
15
|
+
* Client applications will call `init()` first, then use the getter to access
|
|
16
|
+
* the service. Within this repository, developers can assume `init()` has been
|
|
17
|
+
* called and the scripting service is available via `getScriptingService()`.
|
|
18
|
+
*
|
|
19
|
+
* This constructor should only be called from the `init()` function and in unit tests.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
* @param jsonDataService The JSON data service used for communication with the backend.
|
|
23
|
+
*/
|
|
24
|
+
constructor(jsonDataService: JsonDataService);
|
|
8
25
|
sendToService(methodName: string, options?: any[] | undefined): Promise<any>;
|
|
26
|
+
getOutputPreviewTableInitialData(): Promise<string | undefined>;
|
|
9
27
|
registerEventHandler(type: string, handler: (args: any) => void): void;
|
|
10
28
|
connectToLanguageServer(): Promise<MonacoLSPConnection>;
|
|
11
29
|
isCallKnimeUiApiAvailable(portToTestFor: PortConfig): Promise<boolean>;
|
|
@@ -13,33 +31,6 @@ declare const scriptingService: {
|
|
|
13
31
|
isLoggedIntoHub(): Promise<boolean>;
|
|
14
32
|
getAiDisclaimer(): Promise<string>;
|
|
15
33
|
getAiUsage(): Promise<UsageData | null>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* Get the singleton instance of the scripting service. The scripting service
|
|
20
|
-
* provides access to the backend KNIME instance.
|
|
21
|
-
*
|
|
22
|
-
* Note that it is possible to provide a custom scripting service instance in
|
|
23
|
-
* a browser development environment (see example).
|
|
24
|
-
*
|
|
25
|
-
* @returns the scripting service instance
|
|
26
|
-
* @example
|
|
27
|
-
* import { createScriptingServiceMock } from "@knime/scripting-editor/scripting-service-browser-mock";
|
|
28
|
-
* import { getScriptingService } from "@knime/scripting-editor";
|
|
29
|
-
*
|
|
30
|
-
* if (import.meta.env.MODE === "development.browser") {
|
|
31
|
-
* const scriptingService = createScriptingServiceMock({
|
|
32
|
-
* sendToServiceMockResponses: {
|
|
33
|
-
* myBackendFunction: (options) => {
|
|
34
|
-
* consola.log("called my backend function with", options);
|
|
35
|
-
* return Promise.resolve();
|
|
36
|
-
* },
|
|
37
|
-
* },
|
|
38
|
-
* });
|
|
39
|
-
*
|
|
40
|
-
* Object.assign(getScriptingService(), scriptingService);
|
|
41
|
-
* }
|
|
42
|
-
*/
|
|
43
|
-
export declare const getScriptingService: () => ScriptingServiceType;
|
|
44
|
-
export declare const initConsoleEventHandler: () => void;
|
|
45
|
-
export {};
|
|
34
|
+
}
|
|
35
|
+
/** Type representing the public API of ScriptingService */
|
|
36
|
+
export type ScriptingServiceType = PublicAPI<ScriptingService>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SettingState } from '@knime/ui-extension-service';
|
|
2
2
|
import { GenericNodeSettings, SettingsServiceType } from './settings-service';
|
|
3
3
|
export declare const DEFAULT_INITIAL_SETTINGS: GenericNodeSettings;
|
|
4
|
-
export declare const registerSettingsMock: () =>
|
|
4
|
+
export declare const registerSettingsMock: () => () => SettingState<unknown>;
|
|
5
5
|
export declare const createSettingsServiceMock: (data?: GenericNodeSettings) => SettingsServiceType;
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
+
import { DialogService, JsonDataService } from '@knime/ui-extension-service';
|
|
2
|
+
import { PublicAPI } from './types/public-api';
|
|
1
3
|
export type GenericNodeSettings = {
|
|
2
4
|
[key: string]: any;
|
|
3
5
|
settingsAreOverriddenByFlowVariable?: boolean;
|
|
4
6
|
};
|
|
5
|
-
declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export declare class SettingsService {
|
|
8
|
+
private readonly initialSettings;
|
|
9
|
+
private readonly dialogService;
|
|
10
|
+
private readonly jsonDataService;
|
|
11
|
+
/**
|
|
12
|
+
* Internal constructor — do not call directly.
|
|
13
|
+
*
|
|
14
|
+
* This constructor is intended for internal use only.
|
|
15
|
+
* Please use the `init` method in `init.ts` to create the singleton instance and
|
|
16
|
+
* access via `getScriptingService()`. Only one instance should be created via the
|
|
17
|
+
* designated initialization method.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
* @param jsonDataService The service used for JSON data operations.
|
|
21
|
+
*/
|
|
22
|
+
constructor(initialSettings: GenericNodeSettings, dialogService: DialogService, jsonDataService: JsonDataService);
|
|
23
|
+
getSettings(): GenericNodeSettings;
|
|
24
|
+
registerSettingsGetterForApply(settingsGetter: () => GenericNodeSettings): void;
|
|
25
|
+
registerSettings(modelOrView: "model" | "view"): <T>(initialSetting: T) => import('@knime/ui-extension-service').SettingState<T>;
|
|
26
|
+
}
|
|
27
|
+
/** Type representing the public API of SettingsService */
|
|
28
|
+
export type SettingsServiceType = PublicAPI<SettingsService>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility type that extracts the public API from a class.
|
|
3
|
+
* Automatically excludes private members and constructor.
|
|
4
|
+
* Only includes callable methods (functions).
|
|
5
|
+
*
|
|
6
|
+
* @template T The class type to extract the public API from
|
|
7
|
+
*/
|
|
8
|
+
export type PublicAPI<T> = Pick<T, {
|
|
9
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
10
|
+
}[keyof T]>;
|
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.112",
|
|
5
5
|
"description": "Shared Scripting Editor components for KNIME",
|
|
6
6
|
"author": "KNIME AG, Zurich, Switzerland",
|
|
7
7
|
"license": "See the file license.txt",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"module": "./dist/main.js",
|
|
87
87
|
"exports": {
|
|
88
88
|
".": "./dist/main.js",
|
|
89
|
+
"./loading": "./dist/loading.js",
|
|
89
90
|
"./scripting-service-browser-mock": "./dist/scripting-service-browser-mock.js",
|
|
90
91
|
"./settings-service-browser-mock": "./dist/settings-service-browser-mock.js",
|
|
91
92
|
"./initial-data-service-browser-mock": "./dist/initial-data-service-browser-mock.js"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SettingState } from '@knime/ui-extension-service';
|
|
2
|
-
import { GenericInitialData } from './initial-data-service';
|
|
3
|
-
import { GenericNodeSettings } from './settings-service';
|
|
4
|
-
type InitialDataAndSettings = {
|
|
5
|
-
initialData: GenericInitialData;
|
|
6
|
-
settings: GenericNodeSettings;
|
|
7
|
-
};
|
|
8
|
-
declare class SettingsHelper {
|
|
9
|
-
private static instance;
|
|
10
|
-
private jsonDataService;
|
|
11
|
-
private readonly dialogService;
|
|
12
|
-
private cachedInitialDataAndSettings;
|
|
13
|
-
private constructor();
|
|
14
|
-
private loadDataIntoCache;
|
|
15
|
-
getInitialDataAndSettings(): Promise<InitialDataAndSettings>;
|
|
16
|
-
registerApplyListener(settingsGetter: () => GenericNodeSettings): Promise<void>;
|
|
17
|
-
registerSettings<T>(modelOrView: "view" | "model"): Promise<(initialSetting: T) => SettingState<T>>;
|
|
18
|
-
static getInstance(): SettingsHelper;
|
|
19
|
-
}
|
|
20
|
-
export declare const getSettingsHelper: () => SettingsHelper;
|
|
21
|
-
export {};
|