@halcyontech/vscode-ibmi-types 2.14.3 → 2.14.4

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/api/CustomUI.d.ts CHANGED
@@ -58,7 +58,7 @@ export declare class CustomUI extends Section {
58
58
  * @param callback
59
59
  * @returns a Promise<Page<T>> if no callback is provided
60
60
  */
61
- loadPage<T>(title: string, callback?: (page: Page<T>) => void): Promise<Page<T>> | undefined;
61
+ loadPage<T>(title: string): Promise<Page<T>> | undefined;
62
62
  setOptions(options: PanelOptions): this;
63
63
  private createPage;
64
64
  private getHTML;
package/api/IBMi.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as node_ssh from "node-ssh";
2
2
  import * as vscode from "vscode";
3
- import { IBMiComponent, IBMiComponentType } from "../components/component";
3
+ import { IBMiComponent } from "../components/component";
4
4
  import { CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand, SpecialAuthorities } from "../typings";
5
5
  import { ConnectionConfiguration } from "./Configuration";
6
6
  import IBMiContent from "./IBMiContent";
@@ -144,7 +144,11 @@ export default class IBMi {
144
144
  * @param name
145
145
  */
146
146
  upperCaseName(name: string): string;
147
- getComponent<T extends IBMiComponent>(type: IBMiComponentType<T>, ignoreState?: boolean): T | undefined;
147
+ getComponent<T extends IBMiComponent>(name: string, ignoreState?: boolean): T;
148
+ getComponentStates(): {
149
+ id: import("../components/component").ComponentIdentification;
150
+ state: import("../components/component").ComponentState;
151
+ }[];
148
152
  /**
149
153
  * Run SQL statements.
150
154
  * Each statement must be separated by a semi-colon and a new line (i.e. ;\n).
package/api/Tools.d.ts CHANGED
@@ -87,4 +87,21 @@ export declare namespace Tools {
87
87
  * @returns a Date object
88
88
  */
89
89
  function parseAttrDate(timestamp: string): number;
90
+ /**
91
+ * Transforms a file path into an OS agnostic path.
92
+ * - Replaces full home directory path by ~
93
+ * - Replaces all \ into / on Windows
94
+ *
95
+ * @param filePath
96
+ * @returns
97
+ */
98
+ function normalizePath(filePath: string): string;
99
+ /**
100
+ * Transforms a normalized path into an OS specific path.
101
+ * - Replaces ~ with the current home directory
102
+ * - Changes all / to \ on Windows
103
+ * @param path
104
+ * @returns
105
+ */
106
+ function resolvePath(path: string): string;
90
107
  }
@@ -4,7 +4,6 @@ export declare type ComponentIdentification = {
4
4
  name: string;
5
5
  version: number;
6
6
  };
7
- export declare type IBMiComponentType<T extends IBMiComponent> = new (c: IBMi) => T;
8
7
  /**
9
8
  * Defines a component that is managed per IBM i.
10
9
  *
@@ -12,8 +11,8 @@ export declare type IBMiComponentType<T extends IBMiComponent> = new (c: IBMi) =
12
11
  *
13
12
  * For example, this class:
14
13
  * ```
15
- * class MyIBMIComponent extends IBMiComponent {
16
- * //implements getName(), getRemoteState() and update()
14
+ * class MyIBMIComponent implements IBMiComponent {
15
+ * //implements getName, getRemoteState and update
17
16
  * }
18
17
  * ```
19
18
  * Must be registered like this, when the extension providing the component gets activated:
@@ -28,26 +27,17 @@ export declare type IBMiComponentType<T extends IBMiComponent> = new (c: IBMi) =
28
27
  * ```
29
28
  *
30
29
  */
31
- export declare abstract class IBMiComponent {
32
- protected readonly connection: IBMi;
33
- static readonly InstallDirectory = "$HOME/.vscode/";
34
- private state;
35
- private cachedInstallDirectory;
36
- constructor(connection: IBMi);
37
- getInstallDirectory(): Promise<string>;
38
- getState(): ComponentState;
39
- check(): Promise<this>;
40
- toString(): string;
30
+ export declare type IBMiComponent = {
41
31
  /**
42
- * The name of this component; mainly used for display and logging purposes
32
+ * The identification of this component; name must be unique
43
33
  *
44
34
  * @returns a human-readable name
45
35
  */
46
- abstract getIdentification(): ComponentIdentification;
36
+ getIdentification(): ComponentIdentification;
47
37
  /**
48
38
  * @returns the component's {@link ComponentState state} on the IBM i
49
39
  */
50
- protected abstract getRemoteState(): ComponentState | Promise<ComponentState>;
40
+ getRemoteState(connection: IBMi, installDirectory: string): ComponentState | Promise<ComponentState>;
51
41
  /**
52
42
  * Called whenever the components needs to be installed or updated, depending on its {@link ComponentState state}.
53
43
  *
@@ -55,5 +45,9 @@ export declare abstract class IBMiComponent {
55
45
  *
56
46
  * @returns the component's {@link ComponentState state} after the update is done
57
47
  */
58
- protected abstract update(): ComponentState | Promise<ComponentState>;
59
- }
48
+ update(connection: IBMi, installDirectory: string): ComponentState | Promise<ComponentState>;
49
+ /**
50
+ * Called when connecting to clear every persitent information related to the previous connection
51
+ */
52
+ reset?(): void | Promise<void>;
53
+ };
@@ -1,12 +1,14 @@
1
+ import IBMi from "../api/IBMi";
1
2
  import { WrapResult } from "../typings";
2
3
  import { ComponentState, IBMiComponent } from "./component";
3
- export declare class CopyToImport extends IBMiComponent {
4
+ export declare class CopyToImport implements IBMiComponent {
5
+ static ID: string;
4
6
  static isSimple(statement: string): boolean;
5
7
  getIdentification(): {
6
8
  name: string;
7
9
  version: number;
8
10
  };
9
- protected getRemoteState(): ComponentState;
10
- protected update(): ComponentState | Promise<ComponentState>;
11
- wrap(statement: string): WrapResult;
11
+ getRemoteState(): ComponentState;
12
+ update(): ComponentState | Promise<ComponentState>;
13
+ wrap(connection: IBMi, statement: string): WrapResult;
12
14
  }
@@ -1,12 +1,14 @@
1
+ import IBMi from "../../api/IBMi";
1
2
  import { ComponentState, IBMiComponent } from "../component";
2
- export declare class cqsh extends IBMiComponent {
3
+ export declare class CustomQSh implements IBMiComponent {
4
+ static ID: string;
5
+ installPath: string;
3
6
  getIdentification(): {
4
7
  name: string;
5
8
  version: number;
6
9
  };
7
10
  getFileName(): string;
8
- getPath(): Promise<string>;
9
- protected getRemoteState(): Promise<ComponentState>;
10
- protected update(): Promise<ComponentState>;
11
- testCommand(): Promise<boolean>;
11
+ getRemoteState(connection: IBMi, installDirectory: string): Promise<ComponentState>;
12
+ update(connection: IBMi): Promise<ComponentState>;
13
+ testCommand(connection: IBMi): Promise<boolean>;
12
14
  }
@@ -1,15 +1,18 @@
1
+ import IBMi from "../api/IBMi";
1
2
  import { IBMiMember } from "../typings";
2
3
  import { ComponentState, IBMiComponent } from "./component";
3
- export declare class GetMemberInfo extends IBMiComponent {
4
+ export declare class GetMemberInfo implements IBMiComponent {
5
+ static ID: string;
4
6
  private readonly procedureName;
5
7
  private readonly currentVersion;
6
8
  private installedVersion;
9
+ reset(): void;
7
10
  getIdentification(): {
8
11
  name: string;
9
12
  version: number;
10
13
  };
11
- protected getRemoteState(): Promise<ComponentState>;
12
- protected update(): Promise<ComponentState>;
13
- getMemberInfo(library: string, sourceFile: string, member: string): Promise<IBMiMember | undefined>;
14
- getMultipleMemberInfo(members: IBMiMember[]): Promise<IBMiMember[] | undefined>;
14
+ getRemoteState(connection: IBMi): Promise<ComponentState>;
15
+ update(connection: IBMi): Promise<ComponentState>;
16
+ getMemberInfo(connection: IBMi, library: string, sourceFile: string, member: string): Promise<IBMiMember | undefined>;
17
+ getMultipleMemberInfo(connection: IBMi, members: IBMiMember[]): Promise<IBMiMember[] | undefined>;
15
18
  }
@@ -1,12 +1,14 @@
1
+ import IBMi from "../api/IBMi";
1
2
  import { ComponentState, IBMiComponent } from "./component";
2
- export declare class GetNewLibl extends IBMiComponent {
3
+ export declare class GetNewLibl implements IBMiComponent {
4
+ static ID: string;
3
5
  getIdentification(): {
4
6
  name: string;
5
7
  version: number;
6
8
  };
7
- protected getRemoteState(): Promise<ComponentState>;
8
- protected update(): Promise<ComponentState>;
9
- getLibraryListFromCommand(ileCommand: string): Promise<{
9
+ getRemoteState(connection: IBMi): Promise<ComponentState>;
10
+ update(connection: IBMi): Promise<ComponentState>;
11
+ getLibraryListFromCommand(connection: IBMi, ileCommand: string): Promise<{
10
12
  currentLibrary: string;
11
13
  libraryList: string[];
12
14
  }>;
@@ -1,10 +1,10 @@
1
1
  import vscode from "vscode";
2
2
  import IBMi from "../api/IBMi";
3
- import { ComponentState, IBMiComponent, IBMiComponentType } from "./component";
3
+ import { ComponentState, IBMiComponent } from "./component";
4
4
  export declare class ComponentRegistry {
5
5
  private readonly components;
6
- registerComponent(context: vscode.ExtensionContext, component: IBMiComponentType<any>): void;
7
- getComponents(): Map<string, IBMiComponentType<any>[]>;
6
+ registerComponent(context: vscode.ExtensionContext, component: IBMiComponent): void;
7
+ getComponents(): Map<string, IBMiComponent[]>;
8
8
  }
9
9
  export declare const extensionComponentRegistry: ComponentRegistry;
10
10
  export declare class ComponentManager {
@@ -16,5 +16,5 @@ export declare class ComponentManager {
16
16
  state: ComponentState;
17
17
  }[];
18
18
  startup(): Promise<void>;
19
- get<T extends IBMiComponent>(type: IBMiComponentType<T>, ignoreState?: boolean): T | undefined;
19
+ get<T extends IBMiComponent>(id: string, ignoreState?: boolean): T;
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "2.14.3",
3
+ "version": "2.14.4",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
package/typings.d.ts CHANGED
@@ -74,7 +74,6 @@ export interface ConnectionData {
74
74
  port: number;
75
75
  username: string;
76
76
  password?: string;
77
- privateKey?: string;
78
77
  privateKeyPath?: string;
79
78
  keepaliveInterval?: number;
80
79
  }