@halcyontech/vscode-ibmi-types 1.6.1 → 1.6.8

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,84 @@
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
+ 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;
83
+ }
84
+ export {};
@@ -0,0 +1,69 @@
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;
11
+ downloadStreamfile(remotePath: string, localPath?: string): Promise<string>;
12
+ writeStreamfile(originalPath: any, content: any): Promise<string | void>;
13
+ /**
14
+ * Download the contents of a source member
15
+ */
16
+ downloadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string): Promise<string>;
17
+ /**
18
+ * Upload to a member
19
+ */
20
+ uploadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string, content: string | Uint8Array): Promise<boolean>;
21
+ /**
22
+ * Run an SQL statement
23
+ * @param statement
24
+ * @returns a Result set
25
+ */
26
+ runSQL(statement: string): Promise<Tools.DB2Row[]>;
27
+ /**
28
+ * Download the contents of a table.
29
+ * @param library
30
+ * @param file
31
+ * @param member Will default to file provided
32
+ * @param deleteTable Will delete the table after download
33
+ */
34
+ getTable(library: string, file: string, member: string, deleteTable: boolean): Promise<Tools.DB2Row[]>;
35
+ /**
36
+ * Get list of libraries with description and attribute
37
+ * @param libraries Array of libraries to retrieve
38
+ * @returns an array of libraries as IBMiObject
39
+ */
40
+ getLibraryList(libraries: string[]): Promise<IBMiObject[]>;
41
+ /**
42
+ * @param filters
43
+ * @param sortOrder
44
+ * @returns an array of IBMiFile
45
+ */
46
+ getObjectList(filters: {
47
+ library: string;
48
+ object?: string;
49
+ types?: string[];
50
+ }, sortOrder?: `name` | `type`): Promise<IBMiFile[]>;
51
+ /**
52
+ * @param lib
53
+ * @param spf
54
+ * @param mbr
55
+ * @returns an array of IBMiMember
56
+ */
57
+ getMemberList(lib: string, spf: string, mbr?: string, ext?: string): Promise<IBMiMember[]>;
58
+ /**
59
+ * Get list of items in a path
60
+ * @param remotePath
61
+ * @return an array of IFSFile
62
+ */
63
+ getFileList(remotePath: string): Promise<IFSFile[]>;
64
+ /**
65
+ * @param errorsString; several lines of `code:text`...
66
+ * @returns errors
67
+ */
68
+ parseIBMiErrors(errorsString: string): IBMiError[];
69
+ }
@@ -0,0 +1,22 @@
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
+ onEvent(event: "connected", func: Function): void;
22
+ }
@@ -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,11 +1,11 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "1.6.1",
3
+ "version": "1.6.8",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
7
7
  "prepublish": "rm -rf filesystems schemas views webviews languages",
8
- "publish": "npm publish --access public"
8
+ "deploy": "npm publish --access public"
9
9
  },
10
10
  "repository": {
11
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,90 @@
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
+ }
70
+ export interface IBMiFile extends IBMiObject {
71
+ count?: number;
72
+ }
73
+ export interface IBMiMember {
74
+ library: string;
75
+ file: string;
76
+ name: string;
77
+ extension: string;
78
+ recordLength: number;
79
+ text: string;
80
+ asp?: string;
81
+ }
82
+ export interface IFSFile {
83
+ type: "directory" | "streamfile";
84
+ name: string;
85
+ path: string;
86
+ }
87
+ export interface IBMiError {
88
+ code: string;
89
+ text: string;
90
+ }