@halcyontech/vscode-ibmi-types 1.7.6 → 1.8.0

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,6 +1,10 @@
1
1
  import vscode from 'vscode';
2
2
  import Instance from './Instance';
3
3
  import { CommandResult, RemoteCommand } from '../typings';
4
+ export interface ILELibrarySettings {
5
+ currentLibrary: string;
6
+ libraryList: string[];
7
+ }
4
8
  export declare namespace CompileTools {
5
9
  interface EvfEventInfo {
6
10
  asp?: string;
@@ -19,6 +23,6 @@ export declare namespace CompileTools {
19
23
  /**
20
24
  * Execute a command
21
25
  */
22
- export function runCommand(instance: Instance, options: RemoteCommand): Promise<CommandResult | null>;
26
+ export function runCommand(instance: Instance, options: RemoteCommand, title?: string): Promise<CommandResult | null>;
23
27
  export {};
24
28
  }
@@ -9,6 +9,7 @@ export declare namespace ConnectionConfiguration {
9
9
  host: string;
10
10
  autoClearTempData: boolean;
11
11
  connectionProfiles: ConnectionProfile[];
12
+ commandProfiles: CommandProfile[];
12
13
  autoSortIFSShortcuts: boolean;
13
14
  enableSQL: boolean;
14
15
  tempLibrary: string;
@@ -31,6 +32,7 @@ export declare namespace ConnectionConfiguration {
31
32
  debugUpdateProductionFiles: boolean;
32
33
  debugEnableDebugTracing: boolean;
33
34
  readOnlyMode: boolean;
35
+ quickConnect: boolean;
34
36
  [name: string]: any;
35
37
  }
36
38
  interface ObjectFilters {
@@ -55,6 +57,10 @@ export declare namespace ConnectionConfiguration {
55
57
  ifsShortcuts: string[];
56
58
  customVariables: CustomVariable[];
57
59
  }
60
+ interface CommandProfile {
61
+ name: string;
62
+ command: string;
63
+ }
58
64
  function update(parameters: Parameters): Promise<void>;
59
65
  /**
60
66
  * Will load an existing config if it exists, otherwise will create it with default values.
package/api/CustomUI.d.ts CHANGED
@@ -23,12 +23,13 @@ export interface ComplexTab {
23
23
  }
24
24
  export declare class Section {
25
25
  readonly fields: Field[];
26
+ addHeading(label: string, level?: 1 | 2 | 3 | 4 | 5 | 6): this;
26
27
  addHorizontalRule(): this;
27
28
  addCheckbox(id: string, label: string, description?: string, checked?: boolean): this;
28
29
  addInput(id: string, label: string, description?: string, options?: {
29
30
  default?: string;
30
31
  readonly?: boolean;
31
- multiline?: boolean;
32
+ rows?: number;
32
33
  }): this;
33
34
  addParagraph(label: string): this;
34
35
  addFile(id: string, label: string, description?: string): this;
@@ -42,15 +43,18 @@ export declare class Section {
42
43
  }
43
44
  export declare class CustomUI extends Section {
44
45
  /**
45
- * If no callback is provided, a Promise will be returned
46
+ * If no callback is provided, a Promise will be returned.
47
+ * If the page is already opened, it grabs the focus and return no Promise (as it's alreay handled by the first call).
48
+ *
46
49
  * @param title
47
50
  * @param callback
48
51
  * @returns a Promise<Page<T>> if no callback is provided
49
52
  */
50
53
  loadPage<T>(title: string, callback?: (page: Page<T>) => void): Promise<Page<T>> | undefined;
54
+ private createPage;
51
55
  private getHTML;
52
56
  }
53
- export declare type FieldType = "input" | "password" | "submit" | "buttons" | "checkbox" | "file" | "complexTabs" | "tabs" | "tree" | "select" | "paragraph" | "hr";
57
+ export declare type FieldType = "input" | "password" | "submit" | "buttons" | "checkbox" | "file" | "complexTabs" | "tabs" | "tree" | "select" | "paragraph" | "hr" | "heading";
54
58
  export interface TreeListItemIcon {
55
59
  branch?: string;
56
60
  open?: string;
@@ -84,7 +88,7 @@ export declare class Field {
84
88
  complexTabItems?: ComplexTab[];
85
89
  default?: string;
86
90
  readonly?: boolean;
87
- multiline?: boolean;
91
+ rows?: number;
88
92
  constructor(type: FieldType, id: string, label: string, description?: string);
89
93
  getHTML(): string;
90
94
  private renderLabel;
package/api/IBMi.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import * as vscode from "vscode";
2
2
  import * as node_ssh from "node-ssh";
3
3
  import { ConnectionConfiguration } from "./Configuration";
4
- import { ConnectionData, CommandData, StandardIO, CommandResult } from "../typings";
5
- export interface MemberParts {
6
- asp?: string;
7
- library: string;
8
- file: string;
9
- member: string;
10
- extension: string;
4
+ import { ConnectionData, CommandData, StandardIO, CommandResult, IBMiMember, RemoteCommand } from "../typings";
5
+ export interface MemberParts extends IBMiMember {
11
6
  basename: string;
12
7
  }
13
8
  export default class IBMi {
@@ -39,20 +34,34 @@ export default class IBMi {
39
34
  /**
40
35
  * @returns {Promise<{success: boolean, error?: any}>} Was succesful at connecting or not.
41
36
  */
42
- connect(connectionObject: ConnectionData): Promise<{
37
+ connect(connectionObject: ConnectionData, reconnecting?: boolean, reloadServerSettings?: boolean): Promise<{
43
38
  success: boolean;
44
39
  error?: any;
45
40
  }>;
46
41
  /**
42
+ * @deprecated Use runCommand instead
47
43
  * @param {string} command
48
44
  * @param {string} [directory] If not passed, will use current home directory
49
45
  */
50
46
  remoteCommand(command: string, directory?: string): Promise<String | CommandResult>;
47
+ /**
48
+ * - Send PASE/QSH/ILE commands simply
49
+ * - Commands sent here end in the 'IBM i Output' channel
50
+ * - When sending `ile` commands:
51
+ * By default, it will use the library list of the connection,
52
+ * but `&LIBL` and `&CURLIB` can be passed in the property
53
+ * `env` to customise them.
54
+ */
55
+ runCommand(data: RemoteCommand): Promise<CommandResult>;
51
56
  sendQsh(options: CommandData): Promise<CommandResult>;
52
57
  /**
53
58
  * @deprecated Use sendCommand instead
54
59
  */
55
60
  paseCommand(command: string, directory?: string, returnType?: number, standardIO?: StandardIO): Promise<String | CommandResult>;
61
+ /**
62
+ * Send commands to pase through the SSH connection.
63
+ * Commands sent here end up in the 'Code for IBM i' output channel.
64
+ */
56
65
  sendCommand(options: CommandData): Promise<CommandResult>;
57
66
  private appendOutput;
58
67
  private determineClear;
@@ -1,6 +1,10 @@
1
1
  import { default as IBMi } from './IBMi';
2
2
  import { Tools } from './Tools';
3
3
  import { IBMiError, IBMiFile, IBMiMember, IBMiObject, IFSFile } from '../typings';
4
+ export declare type SortOptions = {
5
+ order: "name" | "date" | "?";
6
+ ascending?: boolean;
7
+ };
4
8
  export default class IBMiContent {
5
9
  readonly ibmi: IBMi;
6
10
  constructor(ibmi: IBMi);
@@ -24,6 +28,13 @@ export default class IBMiContent {
24
28
  * @returns a Result set
25
29
  */
26
30
  runSQL(statement: string): Promise<Tools.DB2Row[]>;
31
+ /**
32
+ * @param ileCommand Command that would change the library list, like CHGLIBL
33
+ */
34
+ getLibraryListFromCommand(ileCommand: string): Promise<{
35
+ currentLibrary: string;
36
+ libraryList: string[];
37
+ } | undefined>;
27
38
  /**
28
39
  * Download the contents of a table.
29
40
  * @param library
@@ -38,6 +49,12 @@ export default class IBMiContent {
38
49
  * @returns an array of libraries as IBMiObject
39
50
  */
40
51
  getLibraryList(libraries: string[]): Promise<IBMiObject[]>;
52
+ /**
53
+ * Validates a list of libraries
54
+ * @param newLibl Array of libraries to validate
55
+ * @returns Bad libraries
56
+ */
57
+ validateLibraryList(newLibl: string[]): Promise<string[]>;
41
58
  /**
42
59
  * @param filters
43
60
  * @param sortOrder
@@ -54,13 +71,20 @@ export default class IBMiContent {
54
71
  * @param mbr
55
72
  * @returns an array of IBMiMember
56
73
  */
57
- getMemberList(lib: string, spf: string, mbr?: string, ext?: string): Promise<IBMiMember[]>;
74
+ getMemberList(lib: string, spf: string, mbr?: string, ext?: string, sort?: SortOptions): Promise<IBMiMember[]>;
58
75
  /**
59
76
  * Get list of items in a path
60
77
  * @param remotePath
61
78
  * @return an array of IFSFile
62
79
  */
63
- getFileList(remotePath: string): Promise<IFSFile[]>;
80
+ getFileList(remotePath: string, sort?: SortOptions): Promise<IFSFile[]>;
81
+ /**
82
+ * Fix Comments in an SQL string so that the comments always start at position 0 of the line.
83
+ * Required to work with QZDFMDB2.
84
+ * @param inSql; sql statement
85
+ * @returns correctly formattted sql string containing comments
86
+ */
87
+ private fixCommentsInSQLString;
64
88
  /**
65
89
  * @param errorsString; several lines of `code:text`...
66
90
  * @returns errors
package/api/Search.d.ts CHANGED
@@ -3,7 +3,7 @@ export declare namespace Search {
3
3
  interface Result {
4
4
  path: string;
5
5
  lines: Line[];
6
- filter?: string;
6
+ readonly?: boolean;
7
7
  label?: string;
8
8
  }
9
9
  interface Line {
package/api/Storage.d.ts CHANGED
@@ -13,6 +13,20 @@ export declare type LastConnection = {
13
13
  name: string;
14
14
  timestamp: number;
15
15
  };
16
+ export declare type CachedServerSettings = {
17
+ aspInfo: {
18
+ [id: number]: string;
19
+ };
20
+ qccsid: number | null;
21
+ remoteFeatures: {
22
+ [name: string]: string | undefined;
23
+ };
24
+ variantChars: {
25
+ american: string;
26
+ local: string;
27
+ };
28
+ badDataAreasChecked: boolean | null;
29
+ } | undefined;
16
30
  export declare class GlobalStorage extends Storage {
17
31
  private static instance;
18
32
  static initialize(context: vscode.ExtensionContext): void;
@@ -22,6 +36,22 @@ export declare class GlobalStorage extends Storage {
22
36
  getLastConnections(): LastConnection[];
23
37
  setLastConnection(name: string): Promise<void>;
24
38
  setLastConnections(lastConnections: LastConnection[]): Promise<void>;
39
+ getServerSettingsCache(name: string): {
40
+ aspInfo: {
41
+ [id: number]: string;
42
+ };
43
+ qccsid: number;
44
+ remoteFeatures: {
45
+ [name: string]: string;
46
+ };
47
+ variantChars: {
48
+ american: string;
49
+ local: string;
50
+ };
51
+ badDataAreasChecked: boolean;
52
+ };
53
+ setServerSettingsCache(name: string, serverSettings: CachedServerSettings): Promise<void>;
54
+ deleteServerSettingsCache(name: string): Promise<void>;
25
55
  }
26
56
  export declare class ConnectionStorage extends Storage {
27
57
  private connectionName;
@@ -39,5 +69,6 @@ export declare class ConnectionStorage extends Storage {
39
69
  setDeployment(existingPaths: DeploymentPath): Promise<void>;
40
70
  getDebugCommands(): DebugCommands;
41
71
  setDebugCommands(existingCommands: DebugCommands): Promise<void>;
72
+ getWorkspaceDeployPath(workspaceFolder: vscode.WorkspaceFolder): string;
42
73
  }
43
74
  export {};
package/api/Tools.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { API } from "./import/git";
2
2
  export declare namespace Tools {
3
+ class SqlError extends Error {
4
+ sqlstate: string;
5
+ constructor(message: string);
6
+ }
3
7
  interface DB2Headers {
4
8
  name: string;
5
9
  from: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "1.7.6",
3
+ "version": "1.8.0",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,2 @@
1
+ import { TestSuite } from ".";
2
+ export declare const ConnectionSuite: TestSuite;
@@ -0,0 +1,2 @@
1
+ import { TestSuite } from ".";
2
+ export declare const ContentSuite: TestSuite;
@@ -0,0 +1,12 @@
1
+ import vscode from "vscode";
2
+ export declare type TestSuite = {
3
+ name: string;
4
+ tests: TestCase[];
5
+ };
6
+ export interface TestCase {
7
+ name: string;
8
+ status?: "running" | "failed" | "pass";
9
+ failure?: string;
10
+ test: () => Promise<void>;
11
+ }
12
+ export declare function initialise(context: vscode.ExtensionContext): void;
@@ -0,0 +1,21 @@
1
+ import vscode from "vscode";
2
+ import { TestCase, TestSuite } from ".";
3
+ export declare class TestSuitesTreeProvider implements vscode.TreeDataProvider<vscode.TreeItem> {
4
+ readonly testSuites: TestSuite[];
5
+ private readonly emitter;
6
+ readonly onDidChangeTreeData: vscode.Event<void | vscode.TreeItem | vscode.TreeItem[] | null | undefined>;
7
+ constructor(testSuites: TestSuite[]);
8
+ refresh(element?: TestSuiteItem): void;
9
+ getTreeItem(element: vscode.TreeItem): vscode.TreeItem | Thenable<vscode.TreeItem>;
10
+ getChildren(element?: TestSuiteItem): vscode.ProviderResult<vscode.TreeItem[]>;
11
+ }
12
+ declare class TestSuiteItem extends vscode.TreeItem {
13
+ readonly testSuite: TestSuite;
14
+ constructor(testSuite: TestSuite);
15
+ getChilren(): TestCaseItem[];
16
+ }
17
+ declare class TestCaseItem extends vscode.TreeItem {
18
+ readonly testCase: TestCase;
19
+ constructor(suiteName: string, testCase: TestCase);
20
+ }
21
+ export {};
package/typings.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  /// <reference types="node" />
2
- import { ExtensionContext, Uri } from "vscode";
2
+ import { Uri } from "vscode";
3
3
  import Instance from "./api/Instance";
4
4
  import { Ignore } from 'ignore';
5
+ import { CustomUI } from "./api/CustomUI";
5
6
  export interface CodeForIBMi {
6
7
  instance: Instance;
7
- baseContext: ExtensionContext;
8
- CustomUI: object;
9
- Field: object;
8
+ customUI: () => CustomUI;
10
9
  deploy: (parameters: DeploymentParameters) => Promise<boolean>;
11
10
  evfeventParser: (lines: string[]) => Map<string, FileError[]>;
12
11
  }
@@ -81,8 +80,9 @@ export interface IBMiMember {
81
80
  file: string;
82
81
  name: string;
83
82
  extension: string;
84
- recordLength: number;
85
- text: string;
83
+ changed: string;
84
+ recordLength?: number;
85
+ text?: string;
86
86
  asp?: string;
87
87
  }
88
88
  export interface IFSFile {
@@ -107,7 +107,6 @@ export interface FileError {
107
107
  code: string;
108
108
  }
109
109
  export interface QsysFsOptions {
110
- filter?: string;
111
110
  readonly?: boolean;
112
111
  }
113
112
  export declare type IBMiEvent = "connected" | "disconnected" | "deployLocation";