@halcyontech/vscode-ibmi-types 1.7.10 → 1.9.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,6 @@
1
1
  import vscode from 'vscode';
2
- import Instance from './Instance';
3
2
  import { CommandResult, RemoteCommand } from '../typings';
3
+ import Instance from './Instance';
4
4
  export interface ILELibrarySettings {
5
5
  currentLibrary: string;
6
6
  libraryList: string[];
@@ -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
@@ -43,12 +43,15 @@ export declare class Section {
43
43
  }
44
44
  export declare class CustomUI extends Section {
45
45
  /**
46
- * 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
+ *
47
49
  * @param title
48
50
  * @param callback
49
51
  * @returns a Promise<Page<T>> if no callback is provided
50
52
  */
51
53
  loadPage<T>(title: string, callback?: (page: Page<T>) => void): Promise<Page<T>> | undefined;
54
+ private createPage;
52
55
  private getHTML;
53
56
  }
54
57
  export declare type FieldType = "input" | "password" | "submit" | "buttons" | "checkbox" | "file" | "complexTabs" | "tabs" | "tree" | "select" | "paragraph" | "hr" | "heading";
package/api/IBMi.d.ts CHANGED
@@ -1,13 +1,8 @@
1
- import * as vscode from "vscode";
2
1
  import * as node_ssh from "node-ssh";
2
+ import * as vscode from "vscode";
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 { CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand, StandardIO } 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
+ import { IBMiError, IBMiFile, IBMiMember, IBMiObject, IFSFile, QsysPath } from '../typings';
1
2
  import { default as IBMi } from './IBMi';
2
3
  import { Tools } from './Tools';
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,16 +71,39 @@ 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
+ memberResolve(member: string, files: QsysPath[]): Promise<IBMiMember | undefined>;
82
+ objectResolve(object: string, libraries: string[]): Promise<string | undefined>;
83
+ streamfileResolve(name: string, directories: string[]): Promise<string | undefined>;
84
+ /**
85
+ * Fix Comments in an SQL string so that the comments always start at position 0 of the line.
86
+ * Required to work with QZDFMDB2.
87
+ * @param inSql; sql statement
88
+ * @returns correctly formattted sql string containing comments
89
+ */
90
+ private fixCommentsInSQLString;
64
91
  /**
65
92
  * @param errorsString; several lines of `code:text`...
66
93
  * @returns errors
67
94
  */
68
95
  parseIBMiErrors(errorsString: string): IBMiError[];
96
+ /**
97
+ * @param century; century code (1=20xx, 0=19xx)
98
+ * @param dateString: string in YYMMDD
99
+ * @param timeString: string in HHMMSS
100
+ * @returns date
101
+ */
102
+ getDspfdDate(century?: string, YYMMDD?: string, HHMMSS?: string): Date;
103
+ /**
104
+ * Return `true` if `remotePath` denotes a directory
105
+ *
106
+ * @param remotePath: a remote IFS path
107
+ */
108
+ isDirectory(remotePath: string): Promise<boolean>;
69
109
  }
package/api/Storage.d.ts CHANGED
@@ -13,6 +13,21 @@ 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
+ remoteFeaturesKeys: string | null;
25
+ variantChars: {
26
+ american: string;
27
+ local: string;
28
+ };
29
+ badDataAreasChecked: boolean | null;
30
+ } | undefined;
16
31
  export declare class GlobalStorage extends Storage {
17
32
  private static instance;
18
33
  static initialize(context: vscode.ExtensionContext): void;
@@ -22,6 +37,23 @@ export declare class GlobalStorage extends Storage {
22
37
  getLastConnections(): LastConnection[];
23
38
  setLastConnection(name: string): Promise<void>;
24
39
  setLastConnections(lastConnections: LastConnection[]): Promise<void>;
40
+ getServerSettingsCache(name: string): {
41
+ aspInfo: {
42
+ [id: number]: string;
43
+ };
44
+ qccsid: number;
45
+ remoteFeatures: {
46
+ [name: string]: string;
47
+ };
48
+ remoteFeaturesKeys: string;
49
+ variantChars: {
50
+ american: string;
51
+ local: string;
52
+ };
53
+ badDataAreasChecked: boolean;
54
+ };
55
+ setServerSettingsCache(name: string, serverSettings: CachedServerSettings): Promise<void>;
56
+ deleteServerSettingsCache(name: string): Promise<void>;
25
57
  }
26
58
  export declare class ConnectionStorage extends Storage {
27
59
  private connectionName;
package/api/Terminal.d.ts CHANGED
@@ -1,4 +1,9 @@
1
+ import vscode from 'vscode';
1
2
  import Instance from './Instance';
2
3
  export declare namespace Terminal {
3
- function selectAndOpen(instance: Instance): void;
4
+ enum TerminalType {
5
+ PASE = "PASE",
6
+ _5250 = "5250"
7
+ }
8
+ function selectAndOpen(instance: Instance, openType?: TerminalType): Promise<vscode.Terminal>;
4
9
  }
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;
@@ -22,10 +26,15 @@ export declare namespace Tools {
22
26
  * @param iasp Optional: an iASP name
23
27
  */
24
28
  function qualifyPath(library: string, object: string, member: string, iasp?: string): string;
29
+ /**
30
+ * Unqualify member path from root
31
+ */
32
+ function unqualifyPath(memberPath: string): string;
25
33
  /**
26
34
  * @param Path
27
35
  * @returns the escaped path
28
36
  */
29
37
  function escapePath(Path: string): string;
30
38
  function getGitAPI(): API | undefined;
39
+ function distinct(value: any, index: number, array: any[]): boolean;
31
40
  }
@@ -1,6 +1,7 @@
1
1
  import IBMi from "../IBMi";
2
2
  import IBMiContent from "../IBMiContent";
3
3
  export declare function startup(connection: IBMi): Promise<void>;
4
+ export declare function stop(connection: IBMi): Promise<void>;
4
5
  export declare function getRunningJob(localPort: string, content: IBMiContent): Promise<string | undefined>;
5
6
  export declare function end(connection: IBMi): Promise<void>;
6
7
  /**
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "1.7.10",
3
+ "version": "1.9.0",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
7
- "prepublish": "rm -rf filesystems schemas views webviews languages",
7
+ "prepublish": "rm -rf filesystems schemas views webviews languages testing",
8
8
  "deploy": "npm publish --access public"
9
9
  },
10
10
  "repository": {
package/typings.d.ts CHANGED
@@ -1,19 +1,18 @@
1
1
  /// <reference types="node" />
2
- import { ExtensionContext, Uri } from "vscode";
2
+ import { WorkspaceFolder } 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
  }
13
12
  export declare type DeploymentMethod = "all" | "staged" | "unstaged" | "changed" | "compare";
14
13
  export interface DeploymentParameters {
15
14
  method: DeploymentMethod;
16
- localFolder: Uri;
15
+ workspaceFolder: WorkspaceFolder;
17
16
  remotePath: string;
18
17
  ignoreRules?: Ignore;
19
18
  }
@@ -66,9 +65,11 @@ export interface Server {
66
65
  export interface Profile {
67
66
  profile: string;
68
67
  }
69
- export interface IBMiObject {
68
+ export interface QsysPath {
70
69
  library: string;
71
70
  name: string;
71
+ }
72
+ export interface IBMiObject extends QsysPath {
72
73
  type: string;
73
74
  text: string;
74
75
  attribute?: string;
@@ -81,14 +82,20 @@ export interface IBMiMember {
81
82
  file: string;
82
83
  name: string;
83
84
  extension: string;
84
- recordLength: number;
85
- text: string;
85
+ recordLength?: number;
86
+ text?: string;
86
87
  asp?: string;
88
+ lines?: number;
89
+ created?: Date;
90
+ changed?: Date;
87
91
  }
88
92
  export interface IFSFile {
89
93
  type: "directory" | "streamfile";
90
94
  name: string;
91
95
  path: string;
96
+ size?: number;
97
+ modified?: Date | string;
98
+ owner?: string;
92
99
  }
93
100
  export interface IBMiError {
94
101
  code: string;
@@ -109,4 +116,7 @@ export interface FileError {
109
116
  export interface QsysFsOptions {
110
117
  readonly?: boolean;
111
118
  }
112
- export declare type IBMiEvent = "connected" | "disconnected" | "deployLocation";
119
+ export declare type IBMiEvent = "connected" | "disconnected" | "deployLocation" | "deploy";
120
+ export interface Library {
121
+ path: string;
122
+ }