@halcyontech/vscode-ibmi-types 1.6.2 → 1.6.13

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.
@@ -0,0 +1,69 @@
1
+ export = CompileTools;
2
+ declare class CompileTools {
3
+ /**
4
+ * @param {vscode.ExtensionContext} context
5
+ */
6
+ static register(context: vscode.ExtensionContext): void;
7
+ /**
8
+ * Does what it says on the tin.
9
+ */
10
+ static clearDiagnostics(): void;
11
+ /**
12
+ * @param {Instance} instance
13
+ * @param {{asp?: string, lib: string, object: string, ext?: string, workspace?: number}} evfeventInfo
14
+ */
15
+ static refreshDiagnostics(instance: Instance, evfeventInfo: {
16
+ asp?: string;
17
+ lib: string;
18
+ object: string;
19
+ ext?: string;
20
+ workspace?: number;
21
+ }): Promise<void>;
22
+ /**
23
+ *
24
+ * @param {string} string
25
+ * @param {{[name: string]: string}} variables
26
+ */
27
+ static replaceValues(string: string, variables: {
28
+ [name: string]: string;
29
+ }): string;
30
+ /**
31
+ *
32
+ * @param {Instance} instance
33
+ * @returns
34
+ */
35
+ static getDefaultVariables(instance: Instance): {
36
+ [name: string]: string;
37
+ };
38
+ /**
39
+ * @param {Instance} instance
40
+ * @param {vscode.Uri} uri
41
+ */
42
+ static RunAction(instance: Instance, uri: vscode.Uri): Promise<void>;
43
+ /**
44
+ * Execute command
45
+ * @param {Instance} instance
46
+ * @param {import("../typings").RemoteCommand} options
47
+ * @returns {Promise<import("../typings").CommandResult|null>}
48
+ */
49
+ static runCommand(instance: Instance, options: import("../typings").RemoteCommand): Promise<import("../typings").CommandResult | null>;
50
+ static showOutput(): void;
51
+ static appendOutput(output: any): void;
52
+ /**
53
+ * @param {string} name Name of action
54
+ * @param {string} command Command string
55
+ * @return {Promise<string>} new command
56
+ */
57
+ static showCustomInputs(name: string, command: string): Promise<string>;
58
+ /**
59
+ *
60
+ * @param {string} baseCommand
61
+ * @returns {{lib?: string, object: string}}
62
+ */
63
+ static getObjectFromCommand(baseCommand: string): {
64
+ lib?: string;
65
+ object: string;
66
+ };
67
+ }
68
+ import vscode = require("vscode");
69
+ import { default as Instance } from "./Instance";
package/api/IBMi.d.ts CHANGED
@@ -72,5 +72,13 @@ export default class IBMi {
72
72
  * @returns {string} result
73
73
  */
74
74
  sysNameInAmerican(string: string): string;
75
+ uploadFiles(files: {
76
+ local: string | vscode.Uri;
77
+ remote: string;
78
+ }[], options?: node_ssh.SSHPutFilesOptions): Promise<void>;
79
+ downloadFile(localFile: string | vscode.Uri, remoteFile: string): Promise<void>;
80
+ uploadDirectory(localDirectory: string | vscode.Uri, remoteDirectory: string, options?: node_ssh.SSHGetPutDirectoryOptions): Promise<void>;
81
+ downloadDirectory(localDirectory: string | vscode.Uri, remoteDirectory: string, options?: node_ssh.SSHGetPutDirectoryOptions): Promise<void>;
82
+ fileToPath(file: string | vscode.Uri): string;
75
83
  }
76
84
  export {};
@@ -1,109 +1,69 @@
1
- /// <reference types="node" />
2
- export = IBMiContent;
3
- declare class IBMiContent {
4
- /**
5
- * @param {IBMi} instance
6
- */
7
- constructor(instance: IBMi);
8
- ibmi: IBMi;
9
- /**
10
- * @param {string} remotePath
11
- * @param {string} localPath
12
- */
1
+ import { default as IBMi } from './IBMi';
2
+ import { Tools } from './Tools';
3
+ import { IBMiError, IBMiFile, IBMiMember, IBMiObject, IFSFile } from '../typings';
4
+ export default class IBMiContent {
5
+ readonly ibmi: IBMi;
6
+ constructor(ibmi: IBMi);
7
+ private get config();
8
+ private getTempRemote;
9
+ private getNotUTF8CCSID;
10
+ private convertToUTF8;
13
11
  downloadStreamfile(remotePath: string, localPath?: string): Promise<string>;
14
- writeStreamfile(originalPath: any, content: any): Promise<void | String | import("../typings").CommandResult>;
12
+ writeStreamfile(originalPath: any, content: any): Promise<string | void>;
15
13
  /**
16
14
  * Download the contents of a source member
17
- * @param {string|undefined} asp
18
- * @param {string} lib
19
- * @param {string} spf
20
- * @param {string} mbr
21
15
  */
22
- downloadMemberContent(asp: string | undefined, lib: string, spf: string, mbr: string): Promise<string>;
16
+ downloadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string): Promise<string>;
23
17
  /**
24
18
  * Upload to a member
25
- * @param {string|undefined} asp
26
- * @param {string} lib
27
- * @param {string} spf
28
- * @param {string} mbr
29
- * @param {string|Uint8Array} content
30
19
  */
31
- uploadMemberContent(asp: string | undefined, lib: string, spf: string, mbr: string, content: string | Uint8Array): Promise<boolean>;
20
+ uploadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string, content: string | Uint8Array): Promise<boolean>;
32
21
  /**
33
22
  * Run an SQL statement
34
- * @param {string} statement
35
- * @returns {Promise<Tools.DB2Row[]>} Result set
23
+ * @param statement
24
+ * @returns a Result set
36
25
  */
37
26
  runSQL(statement: string): Promise<Tools.DB2Row[]>;
38
27
  /**
39
28
  * Download the contents of a table.
40
- * @param {string} lib
41
- * @param {string} file
42
- * @param {string} [mbr] Will default to file provided
43
- * @param {boolean} [deleteTable] Will delete the table after download
29
+ * @param library
30
+ * @param file
31
+ * @param member Will default to file provided
32
+ * @param deleteTable Will delete the table after download
44
33
  */
45
- getTable(lib: string, file: string, mbr?: string, deleteTable?: boolean): Promise<any>;
34
+ getTable(library: string, file: string, member: string, deleteTable: boolean): Promise<Tools.DB2Row[]>;
46
35
  /**
47
36
  * Get list of libraries with description and attribute
48
- * @param {string[]} libraries Array of libraries to retrieve
49
- * @returns {Promise<{name: string, text: string, attribute: string}[]>} List of libraries
37
+ * @param libraries Array of libraries to retrieve
38
+ * @returns an array of libraries as IBMiObject
50
39
  */
51
- getLibraryList(libraries: string[]): Promise<{
52
- name: string;
53
- text: string;
54
- attribute: string;
55
- }[]>;
40
+ getLibraryList(libraries: string[]): Promise<IBMiObject[]>;
56
41
  /**
57
- * @param {{library: string, object?: string, types?: string[]}} filters
58
- * @param {string?} sortOrder
59
- * @returns {Promise<{library: string, name: string, type: string, text: string, attribute: string, count?: number}[]>} List of members
42
+ * @param filters
43
+ * @param sortOrder
44
+ * @returns an array of IBMiFile
60
45
  */
61
46
  getObjectList(filters: {
62
47
  library: string;
63
48
  object?: string;
64
49
  types?: string[];
65
- }, sortOrder?: string | null): Promise<{
66
- library: string;
67
- name: string;
68
- type: string;
69
- text: string;
70
- attribute: string;
71
- count?: number;
72
- }[]>;
50
+ }, sortOrder?: `name` | `type`): Promise<IBMiFile[]>;
73
51
  /**
74
- * @param {string} lib
75
- * @param {string} spf
76
- * @param {string} [mbr]
77
- * @returns {Promise<{asp?: string, library: string, file: string, name: string, extension: string, recordLength: number, text: string}[]>} List of members
52
+ * @param lib
53
+ * @param spf
54
+ * @param mbr
55
+ * @returns an array of IBMiMember
78
56
  */
79
- getMemberList(lib: string, spf: string, mbr?: string, ext?: string): Promise<{
80
- asp?: string;
81
- library: string;
82
- file: string;
83
- name: string;
84
- extension: string;
85
- recordLength: number;
86
- text: string;
87
- }[]>;
57
+ getMemberList(lib: string, spf: string, mbr?: string, ext?: string): Promise<IBMiMember[]>;
88
58
  /**
89
59
  * Get list of items in a path
90
- * @param {string} remotePath
91
- * @return {Promise<{type: "directory"|"streamfile", name: string, path: string}[]>} Resulting list
60
+ * @param remotePath
61
+ * @return an array of IFSFile
92
62
  */
93
- getFileList(remotePath: string): Promise<{
94
- type: "directory" | "streamfile";
95
- name: string;
96
- path: string;
97
- }[]>;
63
+ getFileList(remotePath: string): Promise<IFSFile[]>;
98
64
  /**
99
- * @param {string} errorsString
100
- * @returns {{code: string, text: string}[]} errors
65
+ * @param errorsString; several lines of `code:text`...
66
+ * @returns errors
101
67
  */
102
- parseIBMiErrors(errorsString: string): {
103
- code: string;
104
- text: string;
105
- }[];
68
+ parseIBMiErrors(errorsString: string): IBMiError[];
106
69
  }
107
- import { default as IBMi } from "./IBMi";
108
- import { Tools } from "./Tools";
109
- import path = require("path");
package/api/Instance.d.ts CHANGED
@@ -18,4 +18,5 @@ export default class Instance {
18
18
  getConfig(): ConnectionConfiguration.Parameters;
19
19
  getContent(): IBMiContent;
20
20
  getStorage(): Storage;
21
+ onEvent(event: "connected" | "disconnected", func: Function): void;
21
22
  }
package/api/Storage.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import vscode from 'vscode';
2
- export interface PathContent extends Record<string, string[]> {
3
- }
2
+ export declare type PathContent = Record<string, string[]>;
3
+ export declare type DeploymentPath = Record<string, string>;
4
4
  export declare class Storage {
5
5
  readonly context: vscode.ExtensionContext;
6
6
  readonly connectionName: string;
@@ -13,6 +13,6 @@ export declare class Storage {
13
13
  setLastProfile(lastProfile: string): Promise<void>;
14
14
  getPreviousCurLibs(): string[];
15
15
  setPreviousCurLibs(previousCurLibs: string[]): Promise<void>;
16
- getDeployment(): PathContent;
17
- setDeployment(existingPaths: PathContent): Promise<void>;
16
+ getDeployment(): DeploymentPath;
17
+ setDeployment(existingPaths: DeploymentPath): Promise<void>;
18
18
  }
@@ -0,0 +1,3 @@
1
+ import { ConnectionData } from "../typings";
2
+ export declare function replace(data: string): string;
3
+ export declare function replaceAll(connectionObject: ConnectionData): void;
@@ -0,0 +1,4 @@
1
+ import { FileError } from "../../typings";
2
+ export declare function formatName(input: string): string;
3
+ export declare function formatIFS(path: string): string;
4
+ export declare function parseErrors(lines: string[]): Map<string, FileError[]>;
@@ -0,0 +1,9 @@
1
+ import { FileError } from '../../../typings';
2
+ export declare namespace NewHandler {
3
+ /**
4
+ * Returns object of files and their errors
5
+ * @param lines file contents
6
+ * @returns Errors object
7
+ */
8
+ function parse(lines: string[]): Map<string, FileError[]>;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { FileError } from '../../../typings';
2
+ export declare namespace OldHandler {
3
+ /**
4
+ * Returns object of files and their errors
5
+ * @param lines file contents
6
+ * @returns Errors object
7
+ */
8
+ function parse(lines: string[]): Map<string, FileError[]>;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { WorkspaceFolder } from "vscode";
2
+ import { Action } from "../../typings";
3
+ export declare function getLocalActions(currentWorkspace: WorkspaceFolder): Promise<Action[]>;
4
+ /**
5
+ * Gets actions from the `iproj.json` file
6
+ */
7
+ export declare function getiProjActions(currentWorkspace: WorkspaceFolder): Promise<Action[]>;
@@ -0,0 +1,27 @@
1
+ import vscode from 'vscode';
2
+ import Instance from '../Instance';
3
+ import { Ignore } from 'ignore';
4
+ export declare namespace Deployment {
5
+ interface DeploymentParameters {
6
+ method: Method;
7
+ localFolder: vscode.Uri;
8
+ remotePath: string;
9
+ ignoreRules?: Ignore;
10
+ }
11
+ enum Method {
12
+ "all" = 0,
13
+ "staged" = 1,
14
+ "unstaged" = 2,
15
+ "changed" = 3,
16
+ "compare" = 4
17
+ }
18
+ function initialize(context: vscode.ExtensionContext, instance: Instance): void;
19
+ /**
20
+ * Deploy a workspace to a remote IFS location.
21
+ * @param workspaceIndex if no index is provided, a prompt will be shown to pick one if there are multiple workspaces,
22
+ * otherwise the current workspace will be used.
23
+ * @returns the index of the deployed workspace or `undefined` if the deployment failed
24
+ */
25
+ function launchDeploy(workspaceIndex?: number): Promise<number | undefined>;
26
+ function deploy(parameters: DeploymentParameters): Promise<boolean>;
27
+ }
@@ -0,0 +1,4 @@
1
+ import { WorkspaceFolder } from "vscode";
2
+ export declare function getEnvConfig(currentWorkspace: WorkspaceFolder): Promise<{
3
+ [key: string]: string;
4
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "1.6.2",
3
+ "version": "1.6.13",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
package/sandbox.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { ExtensionContext } from "vscode";
2
+ export declare function registerUriHandler(context: ExtensionContext): Promise<void>;
3
+ export declare function handleStartup(): Promise<void>;
package/typings.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  /// <reference types="node" />
2
2
  import { ExtensionContext } from "vscode";
3
3
  import Instance from "./api/Instance";
4
+ import { Deployment } from "./api/local/deployment";
4
5
  export interface CodeForIBMi {
5
6
  instance: Instance;
6
7
  baseContext: ExtensionContext;
7
8
  CustomUI: object;
8
9
  Field: object;
10
+ deploy: (parameters: Deployment.DeploymentParameters) => Promise<boolean>;
11
+ evfeventParser: (lines: string[]) => Map<string, FileError[]>;
9
12
  }
10
13
  export interface StandardIO {
11
14
  onStdout?: (data: Buffer) => void;
@@ -52,7 +55,7 @@ export interface ConnectionData {
52
55
  username: string;
53
56
  password?: string;
54
57
  privateKey: string | null;
55
- keepaliveInterval: number;
58
+ keepaliveInterval?: number;
56
59
  }
57
60
  export interface Server {
58
61
  name: string;
@@ -67,3 +70,36 @@ export interface IBMiObject {
67
70
  text: string;
68
71
  attribute?: string;
69
72
  }
73
+ export interface IBMiFile extends IBMiObject {
74
+ count?: number;
75
+ }
76
+ export interface IBMiMember {
77
+ library: string;
78
+ file: string;
79
+ name: string;
80
+ extension: string;
81
+ recordLength: number;
82
+ text: string;
83
+ asp?: string;
84
+ }
85
+ export interface IFSFile {
86
+ type: "directory" | "streamfile";
87
+ name: string;
88
+ path: string;
89
+ }
90
+ export interface IBMiError {
91
+ code: string;
92
+ text: string;
93
+ }
94
+ export interface Filter {
95
+ library: string;
96
+ filter: string;
97
+ }
98
+ export interface FileError {
99
+ sev: number;
100
+ linenum: number;
101
+ column: number;
102
+ toColumn: number;
103
+ text: string;
104
+ code: string;
105
+ }