@halcyontech/vscode-ibmi-types 2.9.0 → 2.10.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.
@@ -15,7 +15,6 @@ export declare namespace ConnectionConfiguration {
15
15
  connectionProfiles: ConnectionProfile[];
16
16
  commandProfiles: CommandProfile[];
17
17
  autoSortIFSShortcuts: boolean;
18
- enableSQL: boolean;
19
18
  tempLibrary: string;
20
19
  tempDir: string;
21
20
  sourceASP: string;
@@ -31,7 +30,6 @@ export declare namespace ConnectionConfiguration {
31
30
  connectringStringFor5250: string;
32
31
  autoSaveBeforeAction: boolean;
33
32
  showDescInLibList: boolean;
34
- debugCertDirectory: string;
35
33
  debugPort: string;
36
34
  debugSepPort: string;
37
35
  debugIsSecure: boolean;
package/api/IBMi.d.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  import * as node_ssh from "node-ssh";
2
2
  import * as vscode from "vscode";
3
3
  import { ConnectionConfiguration } from "./Configuration";
4
- import { CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand } from "../typings";
4
+ import { CcsidOrigin, CommandData, CommandResult, ConnectionData, IBMiMember, RemoteCommand, SpecialAuthorities } from "../typings";
5
+ import { Tools } from './Tools';
5
6
  export interface MemberParts extends IBMiMember {
6
7
  basename: string;
7
8
  }
8
9
  export default class IBMi {
10
+ private runtimeCcsidOrigin;
11
+ /** Runtime CCSID is either job CCSID or QCCSID */
12
+ private runtimeCcsid;
13
+ /** User default CCSID is job default CCSID */
14
+ private userDefaultCCSID;
9
15
  client: node_ssh.NodeSSH;
10
16
  currentHost: string;
11
17
  currentPort: number;
@@ -16,11 +22,14 @@ export default class IBMi {
16
22
  };
17
23
  defaultUserLibraries: string[];
18
24
  outputChannel?: vscode.OutputChannel;
25
+ /**
26
+ * Used to store ASP numbers and their names
27
+ * Their names usually maps up to a directory in
28
+ * the root of the IFS, thus why we store it.
29
+ */
19
30
  aspInfo: {
20
31
  [id: number]: string;
21
32
  };
22
- qccsid: number;
23
- defaultCCSID: number;
24
33
  remoteFeatures: {
25
34
  [name: string]: string | undefined;
26
35
  };
@@ -28,6 +37,10 @@ export default class IBMi {
28
37
  american: string;
29
38
  local: string;
30
39
  };
40
+ /**
41
+ * Strictly for storing errors from sendCommand.
42
+ * Used when creating issues on GitHub.
43
+ * */
31
44
  lastErrors: object[];
32
45
  config?: ConnectionConfiguration.Parameters;
33
46
  shell?: string;
@@ -60,6 +73,17 @@ export default class IBMi {
60
73
  private appendOutput;
61
74
  private determineClear;
62
75
  end(): Promise<void>;
76
+ /**
77
+ * SQL only available when runner is installed and CCSID is valid.
78
+ */
79
+ get enableSQL(): boolean;
80
+ /**
81
+ * Do not use this API directly.
82
+ * It exists to support some backwards compatability.
83
+ * @deprecated
84
+ */
85
+ set enableSQL(value: boolean);
86
+ sqlRunnerAvailable(): boolean;
63
87
  /**
64
88
  * Generates path to a temp file on the IBM i
65
89
  * @param {string} key Key to the temp file to be re-used
@@ -97,4 +121,29 @@ export default class IBMi {
97
121
  * @param name
98
122
  */
99
123
  upperCaseName(name: string): string;
124
+ /**
125
+ * Run SQL statements.
126
+ * Each statement must be separated by a semi-colon and a new line (i.e. ;\n).
127
+ * If a statement starts with @, it will be run as a CL command.
128
+ *
129
+ * @param statements
130
+ * @returns a Result set
131
+ */
132
+ runSQL(statements: string, opts?: {
133
+ userCcsid?: number;
134
+ }): Promise<Tools.DB2Row[]>;
135
+ getEncoding(): {
136
+ fallback: boolean;
137
+ ccsid: number;
138
+ invalid: boolean;
139
+ };
140
+ getCcsids(): {
141
+ origin: CcsidOrigin;
142
+ runtimeCcsid: number;
143
+ userDefaultCCSID: number;
144
+ };
145
+ checkUserSpecialAuthorities(authorities: SpecialAuthorities[], user?: string): Promise<{
146
+ valid: boolean;
147
+ missing: SpecialAuthorities[];
148
+ }>;
100
149
  }
@@ -58,6 +58,7 @@ export default class IBMiContent {
58
58
  *
59
59
  * @param statements
60
60
  * @returns a Result set
61
+ * @deprecated Use {@linkcode IBMi.runSQL IBMi.runSQL} instead
61
62
  */
62
63
  runSQL(statements: string): Promise<Tools.DB2Row[]>;
63
64
  /**
@@ -122,6 +123,12 @@ export default class IBMiContent {
122
123
  sort?: SortOptions;
123
124
  filterType?: FilterType;
124
125
  }): Promise<IBMiMember[]>;
126
+ /**
127
+ *
128
+ * @param filter: the criterias used to list the members
129
+ * @returns
130
+ */
131
+ getMemberInfo(library: string, sourceFile: string, member: string): Promise<IBMiMember | undefined>;
125
132
  /**
126
133
  * Get list of items in a path
127
134
  * @param remotePath
@@ -136,13 +143,6 @@ export default class IBMiContent {
136
143
  * @returns errors
137
144
  */
138
145
  parseIBMiErrors(errorsString: string): IBMiError[];
139
- /**
140
- * @param century; century code (1=20xx, 0=19xx)
141
- * @param dateString: string in YYMMDD
142
- * @param timeString: string in HHMMSS
143
- * @returns date
144
- */
145
- getDspObjDdDate(century?: string, MMDDYY?: string, HHMMSS?: string): Date;
146
146
  /**
147
147
  * Return `true` if `remotePath` denotes a directory
148
148
  *
@@ -155,7 +155,7 @@ export default class IBMiContent {
155
155
  type: string;
156
156
  member?: string;
157
157
  }, authorities?: Authority[]): Promise<boolean>;
158
- testStreamFile(path: string, right: "r" | "w" | "x"): Promise<boolean>;
158
+ testStreamFile(path: string, right: "f" | "d" | "r" | "w" | "x"): Promise<boolean>;
159
159
  isProtectedPath(path: string): boolean;
160
160
  /**
161
161
  *
package/api/Storage.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare type CachedServerSettings = {
23
23
  aspInfo: {
24
24
  [id: number]: string;
25
25
  };
26
- qccsid: number | null;
26
+ runtimeCcsid: number | null;
27
27
  remoteFeatures: {
28
28
  [name: string]: string | undefined;
29
29
  };
@@ -35,7 +35,8 @@ export declare type CachedServerSettings = {
35
35
  badDataAreasChecked: boolean | null;
36
36
  libraryListValidated: boolean | null;
37
37
  pathChecked?: boolean;
38
- defaultCCSID: number | null;
38
+ userDefaultCCSID: number | null;
39
+ debugConfigLoaded: boolean;
39
40
  } | undefined;
40
41
  export declare class GlobalStorage extends Storage {
41
42
  private static instance;
@@ -50,7 +51,7 @@ export declare class GlobalStorage extends Storage {
50
51
  aspInfo: {
51
52
  [id: number]: string;
52
53
  };
53
- qccsid: number;
54
+ runtimeCcsid: number;
54
55
  remoteFeatures: {
55
56
  [name: string]: string;
56
57
  };
@@ -62,7 +63,8 @@ export declare class GlobalStorage extends Storage {
62
63
  badDataAreasChecked: boolean;
63
64
  libraryListValidated: boolean;
64
65
  pathChecked?: boolean;
65
- defaultCCSID: number;
66
+ userDefaultCCSID: number;
67
+ debugConfigLoaded: boolean;
66
68
  };
67
69
  setServerSettingsCache(name: string, serverSettings: CachedServerSettings): Promise<void>;
68
70
  setServerSettingsCacheSpecific(name: string, newSettings: Partial<CachedServerSettings>): Promise<void>;
package/api/Tools.d.ts CHANGED
@@ -59,4 +59,13 @@ export declare namespace Tools {
59
59
  function fixSQL(statement: string): string;
60
60
  function generateTooltipHtmlTable(header: string, rows: Record<string, any>): string;
61
61
  function fixWindowsPath(path: string): string;
62
+ /**
63
+ * Runs a function while a context value is set to true.
64
+ *
65
+ * If multiple callers call this function with the same context, only the last one returning will unset the context value.
66
+ *
67
+ * @param context the context value that will be set to `true` during `task` execution
68
+ * @param task the function to run while the context value is `true`
69
+ */
70
+ function withContext<T>(context: string, task: () => Promise<T>): Promise<T>;
62
71
  }
@@ -1,14 +1,25 @@
1
+ import vscode from "vscode";
1
2
  import IBMi from "../IBMi";
3
+ import IBMiContent from '../IBMiContent';
4
+ import { DebugConfiguration } from './config';
5
+ export declare type ImportedCertificate = {
6
+ localFile?: vscode.Uri;
7
+ remoteFile?: string;
8
+ password: string;
9
+ };
10
+ export declare const SERVICE_CERTIFICATE = "debug_service.pfx";
11
+ export declare const CLIENT_CERTIFICATE = "debug_service.crt";
2
12
  export declare const LEGACY_CERT_DIRECTORY = "/QIBM/ProdData/IBMiDebugService/bin/certs";
3
- export declare const DEFAULT_CERT_DIRECTORY = "/QIBM/UserData/IBMiDebugService/certs";
4
- export declare function getRemoteCertificateDirectory(connection: IBMi): string;
5
- export declare function getRemoteServerCertificatePath(connection: IBMi): string;
6
- export declare function remoteServerCertificateExists(connection: IBMi, legacy?: boolean): Promise<boolean>;
7
13
  /**
8
- * Generate all certifcates on the server
14
+ * Generates or imports the debug service server certificate and generates the client certificate from it.
15
+ * The keystore containing the certificate and its key must use the PKCS12 format.
16
+ *
17
+ * @param connection the IBM i where the certificate must be generated/imported
18
+ * @param imported if defined, gives the location and password of a local or remote (i.e. on the IFS) service certificate to import
9
19
  */
10
- export declare function setup(connection: IBMi): Promise<void>;
20
+ export declare function setup(connection: IBMi, imported?: ImportedCertificate): Promise<void>;
21
+ export declare function remoteCertificatesExists(debugConfig?: DebugConfiguration): Promise<boolean>;
11
22
  export declare function downloadClientCert(connection: IBMi): Promise<void>;
12
23
  export declare function getLocalCertPath(connection: IBMi): string;
13
- export declare function localClientCertExists(connection: IBMi): Promise<boolean>;
14
- export declare function legacyCertificateChecks(connection: IBMi, existingDebugService: string | undefined): Promise<void>;
24
+ export declare function checkClientCertificate(connection: IBMi, debugConfig?: DebugConfiguration): Promise<void>;
25
+ export declare function sanityCheck(connection: IBMi, content: IBMiContent): Promise<void>;
@@ -0,0 +1,33 @@
1
+ declare type ConfigLine = {
2
+ key: string;
3
+ value?: string;
4
+ };
5
+ export declare const DEBUG_CONFIG_FILE = "/QIBM/ProdData/IBMiDebugService/bin/DebugService.env";
6
+ export declare class DebugConfiguration {
7
+ readonly configLines: ConfigLine[];
8
+ private getContent;
9
+ getOrDefault(key: string, defaultValue: string): string;
10
+ get(key: string): string;
11
+ delete(key: string): void;
12
+ set(key: string, value?: string): void;
13
+ load(): Promise<this>;
14
+ save(): Promise<void>;
15
+ getRemoteServiceCertificatePath(): string;
16
+ getRemoteClientCertificatePath(): string;
17
+ getRemoteServiceRoot(): string;
18
+ getRemoteServiceBin(): string;
19
+ getRemoteServiceWorkDir(): string;
20
+ }
21
+ interface DebugServiceDetails {
22
+ version: string;
23
+ java: string;
24
+ semanticVersion: () => {
25
+ major: number;
26
+ minor: number;
27
+ patch: number;
28
+ };
29
+ }
30
+ export declare function resetDebugServiceDetails(): void;
31
+ export declare function getDebugServiceDetails(): Promise<DebugServiceDetails>;
32
+ export declare function getJavaHome(version: string): "/QOpenSys/QIBM/ProdData/JavaVM/jdk11/64bit" | "/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit";
33
+ export {};
@@ -1,19 +1,23 @@
1
1
  import IBMi from "../IBMi";
2
- import IBMiContent from "../IBMiContent";
3
- import Instance from "../Instance";
4
- interface DebugServiceDetails {
5
- version: string;
6
- java: string;
7
- }
8
- export declare function resetDebugServiceDetails(): void;
9
- export declare function getDebugServiceDetails(content: IBMiContent): Promise<DebugServiceDetails>;
10
- export declare function startup(instance: Instance): Promise<void>;
11
- export declare function stop(instance: Instance): Promise<void>;
12
- export declare function getRunningJob(localPort: string, content: IBMiContent): Promise<string | undefined>;
13
- export declare function end(instance: Instance): Promise<void>;
2
+ import { Tools } from "../Tools";
3
+ export declare type DebugJob = {
4
+ name: string;
5
+ ports: number[];
6
+ };
7
+ export declare function debugPTFInstalled(): boolean;
8
+ export declare function isSEPSupported(): Promise<boolean>;
9
+ export declare function startService(connection: IBMi): Promise<boolean>;
10
+ export declare function stopService(connection: IBMi): Promise<boolean>;
11
+ export declare function getDebugServiceJob(): Promise<DebugJob>;
12
+ export declare function getDebugServerJob(): Promise<DebugJob>;
14
13
  /**
15
14
  * Gets a list of debug jobs stuck at MSGW in QSYSWRK
16
15
  */
17
- export declare function getStuckJobs(userProfile: string, content: IBMiContent): Promise<string[]>;
16
+ export declare function getStuckJobs(connection: IBMi): Promise<string[]>;
18
17
  export declare function endJobs(jobIds: string[], connection: IBMi): Promise<import("../../typings").CommandResult[]>;
19
- export {};
18
+ export declare function isDebugEngineRunning(): Promise<boolean>;
19
+ export declare function startServer(): Promise<boolean>;
20
+ export declare function stopServer(): Promise<boolean>;
21
+ export declare function refreshDebugSensitiveItems(): void;
22
+ export declare function readActiveJob(connection: IBMi, job: DebugJob): Promise<string | Tools.DB2Row>;
23
+ export declare function readJVMInfo(connection: IBMi, job: DebugJob): Promise<string | Tools.DB2Row>;
@@ -15,4 +15,4 @@ export declare function clearDiagnostics(): void;
15
15
  export declare function clearDiagnostic(uri: vscode.Uri, changeRange: vscode.Range): void;
16
16
  export declare function refreshDiagnosticsFromServer(instance: Instance, evfeventInfo: EvfEventInfo): Promise<void>;
17
17
  export declare function refreshDiagnosticsFromLocal(instance: Instance, evfeventInfo: EvfEventInfo): Promise<void>;
18
- export declare function handleEvfeventLines(lines: string[], instance: Instance, evfeventInfo: EvfEventInfo): Promise<void>;
18
+ export declare function handleEvfeventLines(lines: string[], instance: Instance, evfeventInfo: EvfEventInfo): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
package/typings.d.ts CHANGED
@@ -31,6 +31,10 @@ export interface StandardIO {
31
31
  export declare type ActionType = "member" | "streamfile" | "object" | "file";
32
32
  export declare type ActionRefresh = "no" | "parent" | "filter" | "browser";
33
33
  export declare type ActionEnvironment = "ile" | "qsh" | "pase";
34
+ export declare enum CcsidOrigin {
35
+ User = "user",
36
+ System = "system"
37
+ }
34
38
  export interface RemoteCommand {
35
39
  title?: string;
36
40
  command: string;
@@ -146,6 +150,7 @@ export declare type FocusOptions = {
146
150
  };
147
151
  export declare type BrowserItemParameters = {
148
152
  icon?: string;
153
+ color?: string;
149
154
  state?: TreeItemCollapsibleState;
150
155
  parent?: BrowserItem;
151
156
  };
@@ -179,3 +184,4 @@ export declare const IFS_BROWSER_MIMETYPE = "application/vnd.code.tree.ifsbrowse
179
184
  export declare type OpenEditableOptions = QsysFsOptions & {
180
185
  position?: Range;
181
186
  };
187
+ export declare type SpecialAuthorities = "*ALLOBJ" | "*AUDIT" | "*IOSYSCFG" | "*JOBCTL" | "*SAVSYS" | "*SECADM" | "*SERVICE" | "*SPLCTL";