@halcyontech/vscode-ibmi-types 1.6.0 → 1.6.2

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,58 @@
1
+ /// <reference types="vscode" />
2
+ export declare namespace GlobalConfiguration {
3
+ function get<T>(prop: string): T | undefined;
4
+ function set(key: string, value: any): Thenable<void>;
5
+ }
6
+ export declare namespace ConnectionConfiguration {
7
+ interface Parameters extends ConnectionProfile {
8
+ host: string;
9
+ autoClearTempData: boolean;
10
+ connectionProfiles: ConnectionProfile[];
11
+ autoSortIFSShortcuts: boolean;
12
+ enableSQL: boolean;
13
+ tempLibrary: string;
14
+ tempDir: string;
15
+ sourceASP: string;
16
+ sourceFileCCSID: string;
17
+ autoConvertIFSccsid: boolean;
18
+ hideCompileErrors: string[];
19
+ enableSourceDates: boolean;
20
+ sourceDateMode: "edit" | "diff";
21
+ sourceDateGutter: boolean;
22
+ encodingFor5250: string;
23
+ terminalFor5250: string;
24
+ setDeviceNameFor5250: boolean;
25
+ connectringStringFor5250: string;
26
+ autoSaveBeforeAction: boolean;
27
+ showDescInLibList: boolean;
28
+ [name: string]: any;
29
+ }
30
+ interface ObjectFilters {
31
+ name: string;
32
+ library: string;
33
+ object: string;
34
+ types: string[];
35
+ member: string;
36
+ memberType: string;
37
+ }
38
+ interface CustomVariable {
39
+ name: string;
40
+ value: string;
41
+ }
42
+ interface ConnectionProfile {
43
+ name: string;
44
+ homeDirectory: string;
45
+ currentLibrary: string;
46
+ libraryList: string[];
47
+ objectFilters: ObjectFilters[];
48
+ ifsShortcuts: string[];
49
+ customVariables: CustomVariable[];
50
+ }
51
+ function update(parameters: Parameters): Promise<void>;
52
+ /**
53
+ * Will load an existing config if it exists, otherwise will create it with default values.
54
+ * @param name Connection name string for configuration
55
+ * @returns the parameters
56
+ */
57
+ function load(name: string): Promise<Parameters>;
58
+ }
@@ -0,0 +1,64 @@
1
+ export class CustomUI {
2
+ /** @type {Field[]} */
3
+ fields: Field[];
4
+ /**
5
+ * @param {Field} field
6
+ */
7
+ addField(field: Field): void;
8
+ /**
9
+ * If no callback is provided, a Promise will be returned
10
+ * @param {string} title
11
+ * @param {Function} [callback] ({panel, data}) => {}
12
+ * @returns {Promise<{panel: vscode.WebviewPanel, data: object}>}
13
+ */
14
+ loadPage(title: string, callback?: Function): Promise<{
15
+ panel: vscode.WebviewPanel;
16
+ data: object;
17
+ }>;
18
+ getHTML(panel: any): string;
19
+ }
20
+ export class Field {
21
+ /**
22
+ *
23
+ * @param {"input"|"password"|"submit"|"buttons"|"checkbox"|"file"|"tabs"|"tree"|"select"|"paragraph"|"hr"} type
24
+ * @param {string} [id]
25
+ * @param {string} [label]
26
+ */
27
+ constructor(type: "input" | "password" | "submit" | "buttons" | "checkbox" | "file" | "tabs" | "tree" | "select" | "paragraph" | "hr", id?: string, label?: string);
28
+ /** @type {"input"|"password"|"submit"|"buttons"|"checkbox"|"file"|"tabs"|"tree"|"select"|"paragraph"|"hr"} */
29
+ type: "input" | "password" | "submit" | "buttons" | "checkbox" | "file" | "tabs" | "tree" | "select" | "paragraph" | "hr";
30
+ /** @type {string} */
31
+ id: string;
32
+ /** @type {string} */
33
+ label: string;
34
+ /** @type {string|undefined} */
35
+ description: string | undefined;
36
+ /** @type {string|undefined} */
37
+ default: string | undefined;
38
+ /**
39
+ * Used only for `input` type
40
+ * @type {boolean|undefined}
41
+ */
42
+ readonly: boolean | undefined;
43
+ /**
44
+ * Used only for `input` type
45
+ * @type {boolean|undefined}
46
+ */
47
+ multiline: boolean | undefined;
48
+ /** @type {{label: string, value: string}[]|{selected?: boolean, value: string, description: string, text: string}[]|{label: string, id: string}[]|undefined} Used for select & button types. */
49
+ items: {
50
+ label: string;
51
+ value: string;
52
+ }[] | {
53
+ selected?: boolean;
54
+ value: string;
55
+ description: string;
56
+ text: string;
57
+ }[] | {
58
+ label: string;
59
+ id: string;
60
+ }[];
61
+ treeList: any;
62
+ getHTML(): string;
63
+ }
64
+ import vscode = require("vscode");
package/api/IBMi.d.ts ADDED
@@ -0,0 +1,76 @@
1
+ import * as vscode from "vscode";
2
+ import * as node_ssh from "node-ssh";
3
+ import { ConnectionConfiguration } from "./Configuration";
4
+ import { ConnectionData, CommandData, StandardIO, CommandResult } from "../typings";
5
+ interface MemberParts {
6
+ asp: string | undefined;
7
+ library: string | undefined;
8
+ file: string | undefined;
9
+ member: string | undefined;
10
+ extension: string | undefined;
11
+ basename: string | undefined;
12
+ }
13
+ export default class IBMi {
14
+ client: node_ssh.NodeSSH;
15
+ currentHost: string;
16
+ currentPort: number;
17
+ currentUser: string;
18
+ currentConnectionName: string;
19
+ tempRemoteFiles: {
20
+ [name: string]: string;
21
+ };
22
+ defaultUserLibraries: string[];
23
+ outputChannel: vscode.OutputChannel;
24
+ subscriptions: vscode.Disposable[];
25
+ aspInfo: {
26
+ [id: number]: string;
27
+ };
28
+ qccsid: number | null;
29
+ remoteFeatures: {
30
+ [name: string]: string | undefined;
31
+ };
32
+ variantChars: {
33
+ american: string;
34
+ local: string;
35
+ };
36
+ lastErrors: object[];
37
+ config?: ConnectionConfiguration.Parameters;
38
+ commandsExecuted: number;
39
+ constructor();
40
+ /**
41
+ * @returns {Promise<{success: boolean, error?: any}>} Was succesful at connecting or not.
42
+ */
43
+ connect(connectionObject: ConnectionData): Promise<{
44
+ success: boolean;
45
+ error?: any;
46
+ }>;
47
+ /**
48
+ * @param {string} command
49
+ * @param {string} [directory] If not passed, will use current home directory
50
+ */
51
+ remoteCommand(command: string, directory?: string): Promise<String | CommandResult>;
52
+ sendQsh(options: CommandData): Promise<CommandResult>;
53
+ /**
54
+ * @deprecated Use sendCommand instead
55
+ */
56
+ paseCommand(command: string, directory?: string, returnType?: number, standardIO?: StandardIO): Promise<String | CommandResult>;
57
+ sendCommand(options: CommandData): Promise<CommandResult>;
58
+ private determineClear;
59
+ /**
60
+ * Generates path to a temp file on the IBM i
61
+ * @param {string} key Key to the temp file to be re-used
62
+ */
63
+ getTempRemote(key: string): string;
64
+ parserMemberPath(string: string): MemberParts;
65
+ /**
66
+ * @param {string} string
67
+ * @returns {string} result
68
+ */
69
+ sysNameInLocal(string: string): string;
70
+ /**
71
+ * @param {string} string
72
+ * @returns {string} result
73
+ */
74
+ sysNameInAmerican(string: string): string;
75
+ }
76
+ export {};
@@ -0,0 +1,109 @@
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
+ */
13
+ downloadStreamfile(remotePath: string, localPath?: string): Promise<string>;
14
+ writeStreamfile(originalPath: any, content: any): Promise<void | String | import("../typings").CommandResult>;
15
+ /**
16
+ * 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
+ */
22
+ downloadMemberContent(asp: string | undefined, lib: string, spf: string, mbr: string): Promise<string>;
23
+ /**
24
+ * 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
+ */
31
+ uploadMemberContent(asp: string | undefined, lib: string, spf: string, mbr: string, content: string | Uint8Array): Promise<boolean>;
32
+ /**
33
+ * Run an SQL statement
34
+ * @param {string} statement
35
+ * @returns {Promise<Tools.DB2Row[]>} Result set
36
+ */
37
+ runSQL(statement: string): Promise<Tools.DB2Row[]>;
38
+ /**
39
+ * 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
44
+ */
45
+ getTable(lib: string, file: string, mbr?: string, deleteTable?: boolean): Promise<any>;
46
+ /**
47
+ * 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
50
+ */
51
+ getLibraryList(libraries: string[]): Promise<{
52
+ name: string;
53
+ text: string;
54
+ attribute: string;
55
+ }[]>;
56
+ /**
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
60
+ */
61
+ getObjectList(filters: {
62
+ library: string;
63
+ object?: string;
64
+ 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
+ }[]>;
73
+ /**
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
78
+ */
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
+ }[]>;
88
+ /**
89
+ * Get list of items in a path
90
+ * @param {string} remotePath
91
+ * @return {Promise<{type: "directory"|"streamfile", name: string, path: string}[]>} Resulting list
92
+ */
93
+ getFileList(remotePath: string): Promise<{
94
+ type: "directory" | "streamfile";
95
+ name: string;
96
+ path: string;
97
+ }[]>;
98
+ /**
99
+ * @param {string} errorsString
100
+ * @returns {{code: string, text: string}[]} errors
101
+ */
102
+ parseIBMiErrors(errorsString: string): {
103
+ code: string;
104
+ text: string;
105
+ }[];
106
+ }
107
+ import { default as IBMi } from "./IBMi";
108
+ import { Tools } from "./Tools";
109
+ import path = require("path");
@@ -0,0 +1,21 @@
1
+ import * as vscode from "vscode";
2
+ import IBMi from "./IBMi";
3
+ import IBMiContent from "./IBMiContent";
4
+ import { Storage } from "./Storage";
5
+ import { ConnectionConfiguration } from "./Configuration";
6
+ export default class Instance {
7
+ connection: IBMi | undefined;
8
+ content: IBMiContent | undefined;
9
+ storage: Storage | undefined;
10
+ emitter: vscode.EventEmitter<any> | undefined;
11
+ events: {
12
+ event: string;
13
+ func: Function;
14
+ }[];
15
+ constructor();
16
+ getConnection(): IBMi;
17
+ setConfig(newConfig: ConnectionConfiguration.Parameters): Promise<void>;
18
+ getConfig(): ConnectionConfiguration.Parameters;
19
+ getContent(): IBMiContent;
20
+ getStorage(): Storage;
21
+ }
@@ -0,0 +1,13 @@
1
+ import Instance from './Instance';
2
+ export declare namespace Search {
3
+ interface Result {
4
+ path: string;
5
+ lines: Line[];
6
+ }
7
+ interface Line {
8
+ number: number;
9
+ content: string;
10
+ }
11
+ function searchMembers(instance: Instance, library: string, sourceFile: string, memberFilter: string, searchTerm: string): Promise<Result[]>;
12
+ function searchIFS(instance: Instance, path: string, searchTerm: string): Promise<Result[]>;
13
+ }
@@ -0,0 +1,18 @@
1
+ import vscode from 'vscode';
2
+ export interface PathContent extends Record<string, string[]> {
3
+ }
4
+ export declare class Storage {
5
+ readonly context: vscode.ExtensionContext;
6
+ readonly connectionName: string;
7
+ constructor(context: vscode.ExtensionContext, connectionName: string);
8
+ private get;
9
+ private set;
10
+ getSourceList(): PathContent;
11
+ setSourceList(sourceList: PathContent): Promise<void>;
12
+ getLastProfile(): string;
13
+ setLastProfile(lastProfile: string): Promise<void>;
14
+ getPreviousCurLibs(): string[];
15
+ setPreviousCurLibs(previousCurLibs: string[]): Promise<void>;
16
+ getDeployment(): PathContent;
17
+ setDeployment(existingPaths: PathContent): Promise<void>;
18
+ }
@@ -0,0 +1,4 @@
1
+ import Instance from './Instance';
2
+ export declare namespace Terminal {
3
+ function selectAndOpen(instance: Instance): void;
4
+ }
package/api/Tools.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ export declare namespace Tools {
2
+ interface DB2Headers {
3
+ name: string;
4
+ from: number;
5
+ length: number;
6
+ }
7
+ interface DB2Row extends Record<string, string | number | null> {
8
+ }
9
+ /**
10
+ * Parse standard out for `/usr/bin/db2`
11
+ * @param output /usr/bin/db2's output
12
+ * @returns rows
13
+ */
14
+ function db2Parse(output: string): DB2Row[];
15
+ function makeid(): string;
16
+ /**
17
+ * Build the IFS path string to a member
18
+ * @param library
19
+ * @param object
20
+ * @param member
21
+ * @param iasp Optional: an iASP name
22
+ */
23
+ function qualifyPath(library: string, object: string, member: string, iasp?: string): string;
24
+ /**
25
+ * @param Path
26
+ * @returns the escaped path
27
+ */
28
+ function escapePath(Path: string): string;
29
+ }
package/extension.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { ExtensionContext } from "vscode";
2
+ import { CodeForIBMi } from "./typings";
3
+ export declare function activate(context: ExtensionContext): CodeForIBMi;
4
+ export declare function deactivate(): void;
@@ -0,0 +1,14 @@
1
+ import * as vscode from "vscode";
2
+ import Instance from "./api/Instance";
3
+ import IBMi from "./api/IBMi";
4
+ import { Search } from "./api/Search";
5
+ export declare const instance: Instance;
6
+ export declare function setupEmitter(): void;
7
+ export declare function setConnection(conn: IBMi): void;
8
+ export declare function setSearchResults(term: string, results: Search.Result[]): void;
9
+ export declare function disconnect(): Promise<boolean>;
10
+ export declare function loadAllofExtension(context: vscode.ExtensionContext): Promise<void>;
11
+ /**
12
+ * Register event
13
+ */
14
+ export declare function on(event: string, func: Function): void;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
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",
8
+ "deploy": "npm publish --access public"
8
9
  },
9
10
  "repository": {
10
11
  "url": "https://github.com/halcyon-tech/vscode-ibmi"
package/readme.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Type definitions for working with the Code for IBM i API.
4
4
 
5
- Install from this repository with `npm i halcyon-tech/vscode-ibmi-types`.
5
+ Install the types with `npm i npm i @halcyontech/vscode-ibmi-types`.
6
6
 
7
7
  Use in your extension:
8
8
 
9
9
  ```ts
10
- import {CodeForIBMi} from 'vscode-ibmi-types';
10
+ import {CodeForIBMi} from '@halcyontech/vscode-ibmi-types';
11
11
 
12
12
  //...
13
13
 
package/typings.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ /// <reference types="node" />
2
+ import { ExtensionContext } from "vscode";
3
+ import Instance from "./api/Instance";
4
+ export interface CodeForIBMi {
5
+ instance: Instance;
6
+ baseContext: ExtensionContext;
7
+ CustomUI: object;
8
+ Field: object;
9
+ }
10
+ export interface StandardIO {
11
+ onStdout?: (data: Buffer) => void;
12
+ onStderr?: (data: Buffer) => void;
13
+ stdin?: string;
14
+ }
15
+ /**
16
+ * External interface for extensions to call `code-for-ibmi.runCommand`
17
+ */
18
+ export interface RemoteCommand {
19
+ command: string;
20
+ environment?: "ile" | "qsh" | "pase";
21
+ cwd?: string;
22
+ env?: {
23
+ [name: string]: string;
24
+ };
25
+ }
26
+ export interface CommandData extends StandardIO {
27
+ command: string;
28
+ directory?: string;
29
+ env?: {
30
+ [name: string]: string;
31
+ };
32
+ }
33
+ export interface CommandResult {
34
+ code: number | null;
35
+ stdout: string;
36
+ stderr: string;
37
+ command?: string;
38
+ }
39
+ export interface Action {
40
+ name: string;
41
+ command: string;
42
+ type?: "member" | "streamfile" | "object" | "file";
43
+ environment: "ile" | "qsh" | "pase";
44
+ extensions: string[];
45
+ deployFirst?: boolean;
46
+ postDownload?: string[];
47
+ }
48
+ export interface ConnectionData {
49
+ name: string;
50
+ host: string;
51
+ port: number;
52
+ username: string;
53
+ password?: string;
54
+ privateKey: string | null;
55
+ keepaliveInterval: number;
56
+ }
57
+ export interface Server {
58
+ name: string;
59
+ }
60
+ export interface Profile {
61
+ profile: string;
62
+ }
63
+ export interface IBMiObject {
64
+ library: string;
65
+ name: string;
66
+ type: string;
67
+ text: string;
68
+ attribute?: string;
69
+ }