@halcyontech/vscode-ibmi-types 2.8.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,8 +30,8 @@ export declare namespace ConnectionConfiguration {
31
30
  connectringStringFor5250: string;
32
31
  autoSaveBeforeAction: boolean;
33
32
  showDescInLibList: boolean;
34
- debugCertDirectory: string;
35
33
  debugPort: string;
34
+ debugSepPort: string;
36
35
  debugIsSecure: boolean;
37
36
  debugUpdateProductionFiles: boolean;
38
37
  debugEnableDebugTracing: 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,9 +37,15 @@ 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;
46
+ shell?: string;
33
47
  commandsExecuted: number;
48
+ dangerousVariants: boolean;
34
49
  constructor();
35
50
  /**
36
51
  * @returns {Promise<{success: boolean, error?: any}>} Was succesful at connecting or not.
@@ -39,6 +54,7 @@ export default class IBMi {
39
54
  success: boolean;
40
55
  error?: any;
41
56
  }>;
57
+ usingBash(): boolean;
42
58
  /**
43
59
  * - Send PASE/QSH/ILE commands simply
44
60
  * - Commands sent here end in the 'IBM i Output' channel
@@ -57,6 +73,17 @@ export default class IBMi {
57
73
  private appendOutput;
58
74
  private determineClear;
59
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;
60
87
  /**
61
88
  * Generates path to a temp file on the IBM i
62
89
  * @param {string} key Key to the temp file to be re-used
@@ -89,4 +116,34 @@ export default class IBMi {
89
116
  * @param process the process that will run on the empty directory
90
117
  */
91
118
  withTempDirectory(process: (directory: string) => Promise<void>): Promise<void>;
119
+ /**
120
+ * Uppercases an object name, keeping the variant chars case intact
121
+ * @param name
122
+ */
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
+ }>;
92
149
  }
@@ -46,6 +46,11 @@ export default class IBMiContent {
46
46
  * Upload to a member
47
47
  */
48
48
  uploadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string, content: string | Uint8Array): Promise<boolean>;
49
+ /**
50
+ * @param statements Either an SQL statement or CL statement. CL statements start with @
51
+ * @returns result set
52
+ */
53
+ runStatements(...statements: string[]): Promise<Tools.DB2Row[]>;
49
54
  /**
50
55
  * Run SQL statements.
51
56
  * Each statement must be separated by a semi-colon and a new line (i.e. ;\n).
@@ -53,6 +58,7 @@ export default class IBMiContent {
53
58
  *
54
59
  * @param statements
55
60
  * @returns a Result set
61
+ * @deprecated Use {@linkcode IBMi.runSQL IBMi.runSQL} instead
56
62
  */
57
63
  runSQL(statements: string): Promise<Tools.DB2Row[]>;
58
64
  /**
@@ -117,6 +123,12 @@ export default class IBMiContent {
117
123
  sort?: SortOptions;
118
124
  filterType?: FilterType;
119
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>;
120
132
  /**
121
133
  * Get list of items in a path
122
134
  * @param remotePath
@@ -131,13 +143,6 @@ export default class IBMiContent {
131
143
  * @returns errors
132
144
  */
133
145
  parseIBMiErrors(errorsString: string): IBMiError[];
134
- /**
135
- * @param century; century code (1=20xx, 0=19xx)
136
- * @param dateString: string in YYMMDD
137
- * @param timeString: string in HHMMSS
138
- * @returns date
139
- */
140
- getDspObjDdDate(century?: string, MMDDYY?: string, HHMMSS?: string): Date;
141
146
  /**
142
147
  * Return `true` if `remotePath` denotes a directory
143
148
  *
@@ -150,7 +155,7 @@ export default class IBMiContent {
150
155
  type: string;
151
156
  member?: string;
152
157
  }, authorities?: Authority[]): Promise<boolean>;
153
- testStreamFile(path: string, right: "r" | "w" | "x"): Promise<boolean>;
158
+ testStreamFile(path: string, right: "f" | "d" | "r" | "w" | "x"): Promise<boolean>;
154
159
  isProtectedPath(path: string): boolean;
155
160
  /**
156
161
  *
@@ -158,7 +163,7 @@ export default class IBMiContent {
158
163
  * @param parameters A key/value object of parameters
159
164
  * @returns Formatted CL string
160
165
  */
161
- static toCl(command: string, parameters: {
166
+ toCl(command: string, parameters: {
162
167
  [parameter: string]: string | number | undefined;
163
168
  }): string;
164
169
  }
package/api/Storage.d.ts CHANGED
@@ -2,6 +2,12 @@ import vscode from 'vscode';
2
2
  export declare type PathContent = Record<string, string[]>;
3
3
  export declare type DeploymentPath = Record<string, string>;
4
4
  export declare type DebugCommands = Record<string, string>;
5
+ declare type AuthorisedExtension = {
6
+ id: string;
7
+ displayName: string;
8
+ since: number;
9
+ lastAccess: number;
10
+ };
5
11
  declare abstract class Storage {
6
12
  protected readonly globalState: any;
7
13
  constructor(context: vscode.ExtensionContext);
@@ -17,7 +23,7 @@ export declare type CachedServerSettings = {
17
23
  aspInfo: {
18
24
  [id: number]: string;
19
25
  };
20
- qccsid: number | null;
26
+ runtimeCcsid: number | null;
21
27
  remoteFeatures: {
22
28
  [name: string]: string | undefined;
23
29
  };
@@ -29,7 +35,8 @@ export declare type CachedServerSettings = {
29
35
  badDataAreasChecked: boolean | null;
30
36
  libraryListValidated: boolean | null;
31
37
  pathChecked?: boolean;
32
- defaultCCSID: number | null;
38
+ userDefaultCCSID: number | null;
39
+ debugConfigLoaded: boolean;
33
40
  } | undefined;
34
41
  export declare class GlobalStorage extends Storage {
35
42
  private static instance;
@@ -44,7 +51,7 @@ export declare class GlobalStorage extends Storage {
44
51
  aspInfo: {
45
52
  [id: number]: string;
46
53
  };
47
- qccsid: number;
54
+ runtimeCcsid: number;
48
55
  remoteFeatures: {
49
56
  [name: string]: string;
50
57
  };
@@ -56,7 +63,8 @@ export declare class GlobalStorage extends Storage {
56
63
  badDataAreasChecked: boolean;
57
64
  libraryListValidated: boolean;
58
65
  pathChecked?: boolean;
59
- defaultCCSID: number;
66
+ userDefaultCCSID: number;
67
+ debugConfigLoaded: boolean;
60
68
  };
61
69
  setServerSettingsCache(name: string, serverSettings: CachedServerSettings): Promise<void>;
62
70
  setServerSettingsCacheSpecific(name: string, newSettings: Partial<CachedServerSettings>): Promise<void>;
@@ -84,5 +92,10 @@ export declare class ConnectionStorage extends Storage {
84
92
  getRecentlyOpenedFiles(): string[];
85
93
  setRecentlyOpenedFiles(recentlyOpenedFiles: string[]): Promise<void>;
86
94
  clearRecentlyOpenedFiles(): Promise<void>;
95
+ grantExtensionAuthorisation(extension: vscode.Extension<any>): Promise<void>;
96
+ getExtensionAuthorisation(extension: vscode.Extension<any>): AuthorisedExtension;
97
+ getAuthorisedExtensions(): AuthorisedExtension[];
98
+ revokeAllExtensionAuthorisations(): void;
99
+ revokeExtensionAuthorisation(...extensions: AuthorisedExtension[]): Promise<void>;
87
100
  }
88
101
  export {};
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,12 +1,25 @@
1
+ import vscode from "vscode";
1
2
  import IBMi from "../IBMi";
2
- export declare function getRemoteServerCertPath(connection: IBMi): string;
3
- export declare function getRemoteClientCertPath(connection: IBMi): string;
4
- export declare function remoteServerCertExists(connection: IBMi): Promise<boolean>;
5
- export declare function remoteClientCertExists(connection: IBMi): Promise<boolean>;
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";
12
+ export declare const LEGACY_CERT_DIRECTORY = "/QIBM/ProdData/IBMiDebugService/bin/certs";
6
13
  /**
7
- * 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
8
19
  */
9
- 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>;
10
22
  export declare function downloadClientCert(connection: IBMi): Promise<void>;
11
23
  export declare function getLocalCertPath(connection: IBMi): string;
12
- export declare function localClientCertExists(connection: IBMi): Promise<boolean>;
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 {};
@@ -8,6 +8,12 @@ interface DebugOptions {
8
8
  library: string;
9
9
  object: string;
10
10
  libraries: ILELibrarySettings;
11
+ sep?: {
12
+ type: DebugObjectType;
13
+ moduleName?: string;
14
+ procedureName?: string;
15
+ };
11
16
  }
17
+ declare type DebugObjectType = "*PGM" | "*SRVPGM";
12
18
  export declare function startDebug(instance: Instance, options: DebugOptions): Promise<void>;
13
19
  export {};
@@ -1,11 +1,23 @@
1
1
  import IBMi from "../IBMi";
2
- import IBMiContent from "../IBMiContent";
3
- export declare function startup(connection: IBMi): Promise<void>;
4
- export declare function stop(connection: IBMi): Promise<void>;
5
- export declare function getRunningJob(localPort: string, content: IBMiContent): Promise<string | undefined>;
6
- export declare function end(connection: IBMi): 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>;
7
13
  /**
8
14
  * Gets a list of debug jobs stuck at MSGW in QSYSWRK
9
15
  */
10
- export declare function getStuckJobs(userProfile: string, content: IBMiContent): Promise<string[]>;
16
+ export declare function getStuckJobs(connection: IBMi): Promise<string[]>;
11
17
  export declare function endJobs(jobIds: string[], connection: IBMi): Promise<import("../../typings").CommandResult[]>;
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.8.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;
@@ -136,7 +140,8 @@ export declare type IBMiEvent = "connected" | "disconnected" | "deployLocation"
136
140
  export interface WithPath {
137
141
  path: string;
138
142
  }
139
- export interface Library extends WithPath {
143
+ export interface WithLibrary {
144
+ library: string;
140
145
  }
141
146
  export declare type FocusOptions = {
142
147
  select?: boolean;
@@ -145,6 +150,7 @@ export declare type FocusOptions = {
145
150
  };
146
151
  export declare type BrowserItemParameters = {
147
152
  icon?: string;
153
+ color?: string;
148
154
  state?: TreeItemCollapsibleState;
149
155
  parent?: BrowserItem;
150
156
  };
@@ -178,3 +184,4 @@ export declare const IFS_BROWSER_MIMETYPE = "application/vnd.code.tree.ifsbrowse
178
184
  export declare type OpenEditableOptions = QsysFsOptions & {
179
185
  position?: Range;
180
186
  };
187
+ export declare type SpecialAuthorities = "*ALLOBJ" | "*AUDIT" | "*IOSYSCFG" | "*JOBCTL" | "*SAVSYS" | "*SECADM" | "*SERVICE" | "*SPLCTL";