@halcyontech/vscode-ibmi-types 2.10.0 → 2.11.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,5 +1,5 @@
1
1
  import * as vscode from 'vscode';
2
- import { DeploymentMethod } from '../typings';
2
+ import { ConnectionData, DeploymentMethod } from '../typings';
3
3
  import { FilterType } from './Filter';
4
4
  export declare type SourceDateMode = "edit" | "diff";
5
5
  export declare type DefaultOpenMode = "browse" | "edit";
@@ -8,6 +8,21 @@ export declare namespace GlobalConfiguration {
8
8
  function get<T>(key: string): T | undefined;
9
9
  function set(key: string, value: any): Thenable<void>;
10
10
  }
11
+ export interface StoredConnection {
12
+ index: number;
13
+ data: ConnectionData;
14
+ }
15
+ export declare namespace ConnectionManager {
16
+ function getByName(name: string): StoredConnection | undefined;
17
+ function sort(): Thenable<void>;
18
+ function getAll(): ConnectionData[];
19
+ function storeNew(data: ConnectionData): Promise<StoredConnection>;
20
+ function deleteByName(name: string): Thenable<void>;
21
+ function updateByIndex(index: number, data: ConnectionData): Thenable<void>;
22
+ function getStoredPassword(context: vscode.ExtensionContext, connectionName: string): Thenable<string>;
23
+ function setStoredPassword(context: vscode.ExtensionContext, connectionName: string, password: string): Thenable<void>;
24
+ function deleteStoredPassword(context: vscode.ExtensionContext, connectionName: string): Thenable<void>;
25
+ }
11
26
  export declare namespace ConnectionConfiguration {
12
27
  interface Parameters extends ConnectionProfile {
13
28
  host: string;
package/api/IBMi.d.ts CHANGED
@@ -1,17 +1,19 @@
1
1
  import * as node_ssh from "node-ssh";
2
2
  import * as vscode from "vscode";
3
3
  import { ConnectionConfiguration } from "./Configuration";
4
- import { CcsidOrigin, CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand, SpecialAuthorities } from "../typings";
4
+ import { ComponentId } from "../components/component";
5
+ import { CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand, SpecialAuthorities } from "../typings";
6
+ import IBMiContent from "./IBMiContent";
5
7
  import { Tools } from './Tools';
6
8
  export interface MemberParts extends IBMiMember {
7
9
  basename: string;
8
10
  }
9
11
  export default class IBMi {
10
- private runtimeCcsidOrigin;
11
- /** Runtime CCSID is either job CCSID or QCCSID */
12
- private runtimeCcsid;
12
+ private qccsid;
13
+ private jobCcsid;
13
14
  /** User default CCSID is job default CCSID */
14
15
  private userDefaultCCSID;
16
+ private components;
15
17
  client: node_ssh.NodeSSH;
16
18
  currentHost: string;
17
19
  currentPort: number;
@@ -43,6 +45,7 @@ export default class IBMi {
43
45
  * */
44
46
  lastErrors: object[];
45
47
  config?: ConnectionConfiguration.Parameters;
48
+ content: IBMiContent;
46
49
  shell?: string;
47
50
  commandsExecuted: number;
48
51
  dangerousVariants: boolean;
@@ -115,12 +118,13 @@ export default class IBMi {
115
118
  * The directory is guaranteed to be empty when created and deleted after the `process` is done.
116
119
  * @param process the process that will run on the empty directory
117
120
  */
118
- withTempDirectory(process: (directory: string) => Promise<void>): Promise<void>;
121
+ withTempDirectory<T>(process: (directory: string) => Promise<T>): Promise<T>;
119
122
  /**
120
123
  * Uppercases an object name, keeping the variant chars case intact
121
124
  * @param name
122
125
  */
123
126
  upperCaseName(name: string): string;
127
+ getComponent<T>(id: ComponentId): T;
124
128
  /**
125
129
  * Run SQL statements.
126
130
  * Each statement must be separated by a semi-colon and a new line (i.e. ;\n).
@@ -129,16 +133,14 @@ export default class IBMi {
129
133
  * @param statements
130
134
  * @returns a Result set
131
135
  */
132
- runSQL(statements: string, opts?: {
133
- userCcsid?: number;
134
- }): Promise<Tools.DB2Row[]>;
136
+ runSQL(statements: string): Promise<Tools.DB2Row[]>;
135
137
  getEncoding(): {
136
138
  fallback: boolean;
137
139
  ccsid: number;
138
140
  invalid: boolean;
139
141
  };
140
142
  getCcsids(): {
141
- origin: CcsidOrigin;
143
+ qccsid: number;
142
144
  runtimeCcsid: number;
143
145
  userDefaultCCSID: number;
144
146
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { IBMiError, IBMiMember, IBMiObject, IFSFile, QsysPath } from '../typings';
2
+ import { AttrOperands, IBMiError, IBMiMember, IBMiObject, IFSFile, QsysPath } from '../typings';
3
3
  import { FilterType } from './Filter';
4
4
  import { default as IBMi } from './IBMi';
5
5
  import { Tools } from './Tools';
@@ -62,14 +62,7 @@ export default class IBMiContent {
62
62
  */
63
63
  runSQL(statements: string): Promise<Tools.DB2Row[]>;
64
64
  /**
65
- * @param ileCommand Command that would change the library list, like CHGLIBL
66
- */
67
- getLibraryListFromCommand(ileCommand: string): Promise<{
68
- currentLibrary: string;
69
- libraryList: string[];
70
- } | undefined>;
71
- /**
72
- * Download the contents of a table.
65
+ * Download the contents of a member from a table.
73
66
  * @param library
74
67
  * @param file
75
68
  * @param member Will default to file provided
@@ -166,5 +159,10 @@ export default class IBMiContent {
166
159
  toCl(command: string, parameters: {
167
160
  [parameter: string]: string | number | undefined;
168
161
  }): string;
162
+ getAttributes(path: string | (QsysPath & {
163
+ member?: string;
164
+ }), ...operands: AttrOperands[]): Promise<Record<string, string>>;
165
+ countMembers(path: QsysPath): Promise<number>;
166
+ countFiles(directory: string): Promise<number>;
169
167
  }
170
168
  export {};
package/api/Instance.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import * as vscode from "vscode";
2
+ import { IBMiEvent } from "../typings";
3
+ import { ConnectionConfiguration } from "./Configuration";
2
4
  import IBMi from "./IBMi";
3
- import IBMiContent from "./IBMiContent";
4
5
  import { ConnectionStorage } from "./Storage";
5
- import { ConnectionConfiguration } from "./Configuration";
6
- import { IBMiEvent } from "../typings";
7
6
  export default class Instance {
8
7
  private connection;
9
- private content;
10
8
  private storage;
11
9
  private emitter;
12
10
  private events;
@@ -15,7 +13,7 @@ export default class Instance {
15
13
  getConnection(): IBMi;
16
14
  setConfig(newConfig: ConnectionConfiguration.Parameters): Promise<void>;
17
15
  getConfig(): ConnectionConfiguration.Parameters;
18
- getContent(): IBMiContent;
16
+ getContent(): import("./IBMiContent").default;
19
17
  getStorage(): ConnectionStorage;
20
18
  onEvent(event: IBMiEvent, func: Function): void;
21
19
  fire(event: IBMiEvent): void;
package/api/Storage.d.ts CHANGED
@@ -23,7 +23,8 @@ export declare type CachedServerSettings = {
23
23
  aspInfo: {
24
24
  [id: number]: string;
25
25
  };
26
- runtimeCcsid: number | null;
26
+ qccsid: number | null;
27
+ jobCcsid: number | null;
27
28
  remoteFeatures: {
28
29
  [name: string]: string | undefined;
29
30
  };
@@ -51,7 +52,8 @@ export declare class GlobalStorage extends Storage {
51
52
  aspInfo: {
52
53
  [id: number]: string;
53
54
  };
54
- runtimeCcsid: number;
55
+ qccsid: number;
56
+ jobCcsid: number;
55
57
  remoteFeatures: {
56
58
  [name: string]: string;
57
59
  };
package/api/Tools.d.ts CHANGED
@@ -18,16 +18,16 @@ export declare namespace Tools {
18
18
  * @param output /usr/bin/db2's output
19
19
  * @returns rows
20
20
  */
21
- function db2Parse(output: string): DB2Row[];
21
+ function db2Parse(output: string, input?: string): DB2Row[];
22
22
  function makeid(length?: number): string;
23
23
  /**
24
- * Build the IFS path string to a member
24
+ * Build the IFS path string to an object or member
25
25
  * @param library
26
26
  * @param object
27
- * @param member
27
+ * @param member Optional
28
28
  * @param iasp Optional: an iASP name
29
29
  */
30
- function qualifyPath(library: string, object: string, member: string, iasp?: string, sanitise?: boolean): string;
30
+ function qualifyPath(library: string, object: string, member?: string, iasp?: string, sanitise?: boolean): string;
31
31
  /**
32
32
  * Unqualify member path from root
33
33
  */
@@ -44,11 +44,21 @@ export declare namespace Tools {
44
44
  function sanitizeLibraryNames(libraries: string[]): string[];
45
45
  function parseMessages(output: string): IBMiMessages;
46
46
  function parseQSysPath(path: string): QsysPath;
47
+ /**
48
+ * Check whether two given uris point to the same file/member
49
+ */
50
+ function areEquivalentUris(uriA: vscode.Uri, uriB: vscode.Uri): boolean;
47
51
  /**
48
52
  * We do this to find previously opened files with the same path, but different case OR readonly flags.
49
53
  * Without this, it's possible for the same document to be opened twice simply due to the readonly flag.
50
54
  */
51
55
  function findExistingDocumentUri(uri: vscode.Uri): vscode.Uri;
56
+ function findExistingDocument(uri: vscode.Uri): vscode.TextDocument;
57
+ /**
58
+ * Given the uri of a member or other resource, find all
59
+ * (if any) open tabs where that resource is being edited.
60
+ */
61
+ function findUriTabs(uriToFind: vscode.Uri): vscode.Tab[];
52
62
  /**
53
63
  * Fixes an SQL statement to make it compatible with db2 CLI program QZDFMDB2.
54
64
  * - Changes `@clCommand` statements into Call `QSYS2.QCMDEX('clCommand')` procedure calls
@@ -56,7 +66,7 @@ export declare namespace Tools {
56
66
  * @param statement the statement to fix
57
67
  * @returns statement compatible with QZDFMDB2
58
68
  */
59
- function fixSQL(statement: string): string;
69
+ function fixSQL(statement: string, removeComments?: boolean): string;
60
70
  function generateTooltipHtmlTable(header: string, rows: Record<string, any>): string;
61
71
  function fixWindowsPath(path: string): string;
62
72
  /**
@@ -13,6 +13,7 @@ export declare namespace Deployment {
13
13
  const workspaceChanges: Map<vscode.WorkspaceFolder, Map<string, vscode.Uri>>;
14
14
  function initialize(context: vscode.ExtensionContext): void;
15
15
  function getConnection(): IBMi;
16
+ function getContent(): import("../IBMiContent").default;
16
17
  function createRemoteDirectory(remotePath: string): Promise<import("../../typings").CommandResult>;
17
18
  function showErrorButton(): Promise<void>;
18
19
  function getWorkspaceFolder(workspaceIndex?: number): Promise<vscode.WorkspaceFolder>;
@@ -1,5 +1,4 @@
1
1
  import { WorkspaceFolder } from "vscode";
2
- export declare function getEnvConfig(currentWorkspace: WorkspaceFolder): Promise<{
3
- [key: string]: string;
4
- }>;
2
+ export declare type Env = Record<string, string>;
3
+ export declare function getEnvConfig(currentWorkspace: WorkspaceFolder): Promise<Env>;
5
4
  export declare function getBranchLibraryName(currentBranch: string): string;
@@ -0,0 +1,32 @@
1
+ import IBMi from "../api/IBMi";
2
+ import { CopyToImport } from "./copyToImport";
3
+ import { GetMemberInfo } from "./getMemberInfo";
4
+ import { GetNewLibl } from "./getNewLibl";
5
+ export declare enum ComponentState {
6
+ NotChecked = "NotChecked",
7
+ NotInstalled = "NotInstalled",
8
+ Installed = "Installed",
9
+ Error = "Error"
10
+ }
11
+ interface ComponentRegistry {
12
+ GetNewLibl?: GetNewLibl;
13
+ CopyToImport?: CopyToImport;
14
+ GetMemberInfo?: GetMemberInfo;
15
+ }
16
+ export declare type ComponentId = keyof ComponentRegistry;
17
+ export declare abstract class ComponentT {
18
+ connection: IBMi;
19
+ state: ComponentState;
20
+ currentVersion: number;
21
+ constructor(connection: IBMi);
22
+ abstract getInstalledVersion(): Promise<number | undefined>;
23
+ abstract checkState(): Promise<boolean>;
24
+ abstract getState(): ComponentState;
25
+ }
26
+ export declare class ComponentManager {
27
+ private registered;
28
+ startup(connection: IBMi): Promise<void>;
29
+ get<T>(id: ComponentId): T | undefined;
30
+ private static checkState;
31
+ }
32
+ export {};
@@ -0,0 +1,15 @@
1
+ import IBMi from "../api/IBMi";
2
+ import { WrapResult } from "../typings";
3
+ import { ComponentState, ComponentT } from "./component";
4
+ export declare class CopyToImport implements ComponentT {
5
+ connection: IBMi;
6
+ private readonly name;
7
+ state: ComponentState;
8
+ currentVersion: number;
9
+ constructor(connection: IBMi);
10
+ getInstalledVersion(): Promise<number>;
11
+ checkState(): Promise<boolean>;
12
+ getState(): ComponentState;
13
+ static isSimple(statement: string): boolean;
14
+ wrap(statement: string): WrapResult;
15
+ }
@@ -0,0 +1,19 @@
1
+ import IBMi from "../api/IBMi";
2
+ import { IBMiMember } from "../typings";
3
+ import { ComponentState, ComponentT } from "./component";
4
+ export declare class GetMemberInfo implements ComponentT {
5
+ connection: IBMi;
6
+ readonly name = "GETMBRINFO";
7
+ state: ComponentState;
8
+ currentVersion: number;
9
+ constructor(connection: IBMi);
10
+ getInstalledVersion(): Promise<number>;
11
+ checkState(): Promise<boolean>;
12
+ getState(): ComponentState;
13
+ /**
14
+ *
15
+ * @param filter: the criterias used to list the members
16
+ * @returns
17
+ */
18
+ getMemberInfo(library: string, sourceFile: string, member: string): Promise<IBMiMember | undefined>;
19
+ }
@@ -0,0 +1,15 @@
1
+ import IBMi from "../api/IBMi";
2
+ import { ComponentState, ComponentT } from "./component";
3
+ export declare class GetNewLibl implements ComponentT {
4
+ connection: IBMi;
5
+ state: ComponentState;
6
+ currentVersion: number;
7
+ constructor(connection: IBMi);
8
+ getInstalledVersion(): Promise<number>;
9
+ checkState(): Promise<boolean>;
10
+ getState(): ComponentState;
11
+ getLibraryListFromCommand(ileCommand: string): Promise<{
12
+ currentLibrary: string;
13
+ libraryList: string[];
14
+ } | undefined>;
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
package/typings.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { Ignore } from 'ignore';
3
- import { ProviderResult, Range, TreeItem, TreeItemCollapsibleState, WorkspaceFolder } from "vscode";
3
+ import { MarkdownString, ProviderResult, Range, TreeItem, TreeItemCollapsibleState, WorkspaceFolder } from "vscode";
4
4
  import { ConnectionConfiguration } from './api/Configuration';
5
5
  import { CustomUI } from "./api/CustomUI";
6
6
  import Instance from "./api/Instance";
@@ -91,9 +91,7 @@ export interface IBMiObject extends QsysPath {
91
91
  text: string;
92
92
  sourceFile?: boolean;
93
93
  attribute?: string;
94
- memberCount?: number;
95
94
  sourceLength?: number;
96
- CCSID?: number;
97
95
  size?: number;
98
96
  created?: Date;
99
97
  changed?: Date;
@@ -161,6 +159,7 @@ export declare class BrowserItem extends TreeItem {
161
159
  getChildren?(): ProviderResult<BrowserItem[]>;
162
160
  refresh?(): void;
163
161
  reveal?(options?: FocusOptions): Thenable<void>;
162
+ getToolTip?(): Promise<MarkdownString | undefined>;
164
163
  }
165
164
  export interface FilteredItem {
166
165
  filter: ConnectionConfiguration.ObjectFilters;
@@ -184,4 +183,9 @@ export declare const IFS_BROWSER_MIMETYPE = "application/vnd.code.tree.ifsbrowse
184
183
  export declare type OpenEditableOptions = QsysFsOptions & {
185
184
  position?: Range;
186
185
  };
186
+ export interface WrapResult {
187
+ newStatements: string[];
188
+ outStmf: string;
189
+ }
187
190
  export declare type SpecialAuthorities = "*ALLOBJ" | "*AUDIT" | "*IOSYSCFG" | "*JOBCTL" | "*SAVSYS" | "*SECADM" | "*SERVICE" | "*SPLCTL";
191
+ export declare type AttrOperands = 'ACCESS_TIME' | 'ALLOC_SIZE' | 'ALLOC_SIZE_64' | 'ALWCKPWR' | 'ALWSAV' | 'ASP' | 'AUDIT' | 'AUTH_GROUP' | 'AUTH_LIST_NAME' | 'AUTH_OWNER' | 'AUTH_USERS' | 'CCSID' | 'CHANGE_TIME' | 'CHECKED_OUT' | 'CHECKED_OUT_USER' | 'CHECKED_OUT_TIME' | 'CODEPAGE' | 'CREATE_TIME' | 'CRTOBJAUD' | 'CRTOBJSCAN' | 'DATA_SIZE' | 'DATA_SIZE_64' | 'DIR_FORMAT' | 'DISK_STG_OPT' | 'EXTENDED_ATTR_SIZE' | 'FILE_FORMAT' | 'FILE_ID' | 'JOURNAL_APPLY_CHANGES' | 'JOURNAL_ID' | 'JOURNAL_LIBRARY' | 'JOURNAL_NAME' | 'JOURNAL_OPTIONS' | 'JOURNAL_RCVR_ASP' | 'JOURNAL_RCVR_LIBRARY' | 'JOURNAL_RCVR_NAME' | 'JOURNAL_ROLLBACK_ENDED' | 'JOURNAL_START_TIME' | 'JOURNAL_STATUS' | 'LOCAL_REMOTE' | 'MAIN_STG_OPT' | 'MODIFY_TIME' | 'MULT_SIGS' | 'OBJTYPE' | 'PC_ARCHIVE' | 'PC_HIDDEN' | 'PC_READ_ONLY' | 'PC_SYSTEM' | 'RSTDRNMUNL' | 'SCAN' | 'SCAN_BINARY' | 'SCAN_CCSID1' | 'SCAN_CCSID2' | 'SCAN_SIGS_DIFF' | 'SCAN_STATUS' | 'SGID' | 'SIGNED' | 'STG_FREE' | 'SUID' | 'SYSTEM_ARCHIVE' | 'SYSTEM_USE' | 'SYS_SIGNED' | 'UDFS_DEFAULT_FORMAT' | 'USAGE_DAYS_USED' | 'USAGE_LAST_USED_TIME' | 'USAGE_RESET_TIME';
@@ -1,2 +0,0 @@
1
- import { Locale } from "..";
2
- export declare const da: Locale;
@@ -1,2 +0,0 @@
1
- import { Locale } from "..";
2
- export declare const en: Locale;
@@ -1,2 +0,0 @@
1
- import { Locale } from "..";
2
- export declare const fr: Locale;