@halcyontech/vscode-ibmi-types 2.6.5 → 2.7.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,6 @@
1
1
  import * as vscode from 'vscode';
2
2
  import { DeploymentMethod } from '../typings';
3
+ import { FilterType } from './Filter';
3
4
  export declare type SourceDateMode = "edit" | "diff";
4
5
  export declare type DefaultOpenMode = "browse" | "edit";
5
6
  export declare function onCodeForIBMiConfigurationChange<T>(props: string | string[], todo: (value: vscode.ConfigurationChangeEvent) => void): vscode.Disposable;
@@ -39,10 +40,12 @@ export declare namespace ConnectionConfiguration {
39
40
  quickConnect: boolean;
40
41
  defaultDeploymentMethod: DeploymentMethod | '';
41
42
  protectedPaths: string[];
43
+ showHiddenFiles: boolean;
42
44
  [name: string]: any;
43
45
  }
44
46
  interface ObjectFilters {
45
47
  name: string;
48
+ filterType: FilterType;
46
49
  library: string;
47
50
  object: string;
48
51
  types: string[];
@@ -0,0 +1,13 @@
1
+ declare type Filter = {
2
+ test: (text: string) => boolean;
3
+ noFilter: boolean;
4
+ };
5
+ export declare type FilterType = 'simple' | 'regex';
6
+ export declare function parseFilter(filterString?: string, type?: FilterType): Filter;
7
+ /**
8
+ * Return filterString if it is a single, generic name filter (e.g. QSYS*)
9
+ * @param filterString
10
+ * @returns filterString if it is a single generic name or undefined otherwise
11
+ */
12
+ export declare function singleGenericName(filterString?: string): string;
13
+ export {};
package/api/IBMi.d.ts CHANGED
@@ -19,7 +19,8 @@ export default class IBMi {
19
19
  aspInfo: {
20
20
  [id: number]: string;
21
21
  };
22
- qccsid: number | null;
22
+ qccsid: number;
23
+ defaultCCSID: number;
23
24
  remoteFeatures: {
24
25
  [name: string]: string | undefined;
25
26
  };
@@ -1,21 +1,43 @@
1
- import { IBMiError, IBMiFile, IBMiMember, IBMiObject, IFSFile, QsysPath } from '../typings';
1
+ /// <reference types="node" />
2
+ import { IBMiError, IBMiMember, IBMiObject, IFSFile, QsysPath } from '../typings';
3
+ import { FilterType } from './Filter';
2
4
  import { default as IBMi } from './IBMi';
3
5
  import { Tools } from './Tools';
4
6
  declare type Authority = "*ADD" | "*DLT" | "*EXECUTE" | "*READ" | "*UPD" | "*NONE" | "*ALL" | "*CHANGE" | "*USE" | "*EXCLUDE" | "*AUTLMGT";
5
7
  export declare type SortOrder = `name` | `type`;
6
8
  export declare type SortOptions = {
7
- order: "name" | "date" | "?";
9
+ order: "name" | "date";
8
10
  ascending?: boolean;
9
11
  };
10
12
  export default class IBMiContent {
11
13
  readonly ibmi: IBMi;
14
+ private chgJobCCSID;
12
15
  constructor(ibmi: IBMi);
13
16
  private get config();
14
17
  private getTempRemote;
15
18
  private getNotUTF8CCSID;
16
19
  private convertToUTF8;
20
+ /**
21
+ *
22
+ * @param remotePath Remote IFS path
23
+ * @param localPath Local path to download file to
24
+ */
25
+ downloadStreamfileRaw(remotePath: string, localPath?: string): Promise<Buffer>;
26
+ /**
27
+ * @deprecated Use downloadStreamfileRaw instead
28
+ */
17
29
  downloadStreamfile(remotePath: string, localPath?: string): Promise<string>;
18
- writeStreamfile(originalPath: any, content: any): Promise<string | void>;
30
+ /**
31
+ * @param originalPath
32
+ * @param content Raw content
33
+ * @param encoding Optional encoding to write.
34
+ */
35
+ writeStreamfileRaw(originalPath: string, content: Uint8Array, encoding?: string): Promise<string | void>;
36
+ /**
37
+ * Write utf8 content to a streamfile
38
+ * @deprecated Use writeStreamfileRaw instead
39
+ */
40
+ writeStreamfile(originalPath: string, content: string): Promise<string | void>;
19
41
  /**
20
42
  * Download the contents of a source member
21
43
  */
@@ -25,11 +47,14 @@ export default class IBMiContent {
25
47
  */
26
48
  uploadMemberContent(asp: string | undefined, library: string, sourceFile: string, member: string, content: string | Uint8Array): Promise<boolean>;
27
49
  /**
28
- * Run an SQL statement
29
- * @param statement
50
+ * Run SQL statements.
51
+ * Each statement must be separated by a semi-colon and a new line (i.e. ;\n).
52
+ * If a statement starts with @, it will be run as a CL command.
53
+ *
54
+ * @param statements
30
55
  * @returns a Result set
31
56
  */
32
- runSQL(statement: string): Promise<Tools.DB2Row[]>;
57
+ runSQL(statements: string): Promise<Tools.DB2Row[]>;
33
58
  /**
34
59
  * @param ileCommand Command that would change the library list, like CHGLIBL
35
60
  */
@@ -44,7 +69,14 @@ export default class IBMiContent {
44
69
  * @param member Will default to file provided
45
70
  * @param deleteTable Will delete the table after download
46
71
  */
47
- getTable(library: string, file: string, member: string, deleteTable?: boolean): Promise<Tools.DB2Row[]>;
72
+ getTable(library: string, file: string, member?: string, deleteTable?: boolean): Promise<Tools.DB2Row[]>;
73
+ /**
74
+ * Prepare a table in QTEMP using any number of preparation queries and return its content.
75
+ * @param prepareQueries : SQL statements that should create a table in QTEMP
76
+ * @param table : the name of the table expected to be found in QTEMP
77
+ * @returns : the table's content
78
+ */
79
+ getQTempTable(prepareQueries: string[], table: string): Promise<Tools.DB2Row[]>;
48
80
  /**
49
81
  * Get list of libraries with description and attribute
50
82
  * @param libraries Array of libraries to retrieve
@@ -57,6 +89,10 @@ export default class IBMiContent {
57
89
  * @returns Bad libraries
58
90
  */
59
91
  validateLibraryList(newLibl: string[]): Promise<string[]>;
92
+ getLibraries(filters: {
93
+ library: string;
94
+ filterType?: FilterType;
95
+ }): Promise<IBMiObject[]>;
60
96
  /**
61
97
  * @param filters
62
98
  * @param sortOrder
@@ -66,14 +102,21 @@ export default class IBMiContent {
66
102
  library: string;
67
103
  object?: string;
68
104
  types?: string[];
69
- }, sortOrder?: SortOrder): Promise<IBMiFile[]>;
105
+ filterType?: FilterType;
106
+ }, sortOrder?: SortOrder): Promise<IBMiObject[]>;
70
107
  /**
71
- * @param lib
72
- * @param spf
73
- * @param mbr
74
- * @returns an array of IBMiMember
108
+ *
109
+ * @param filter: the criterias used to list the members
110
+ * @returns
75
111
  */
76
- getMemberList(lib: string, spf: string, mbr?: string, ext?: string, sort?: SortOptions): Promise<IBMiMember[]>;
112
+ getMemberList(filter: {
113
+ library: string;
114
+ sourceFile: string;
115
+ members?: string;
116
+ extensions?: string;
117
+ sort?: SortOptions;
118
+ filterType?: FilterType;
119
+ }): Promise<IBMiMember[]>;
77
120
  /**
78
121
  * Get list of items in a path
79
122
  * @param remotePath
@@ -83,13 +126,6 @@ export default class IBMiContent {
83
126
  memberResolve(member: string, files: QsysPath[]): Promise<IBMiMember | undefined>;
84
127
  objectResolve(object: string, libraries: string[]): Promise<string | undefined>;
85
128
  streamfileResolve(names: string[], directories: string[]): Promise<string | undefined>;
86
- /**
87
- * Fix Comments in an SQL string so that the comments always start at position 0 of the line.
88
- * Required to work with QZDFMDB2.
89
- * @param inSql; sql statement
90
- * @returns correctly formattted sql string containing comments
91
- */
92
- private fixCommentsInSQLString;
93
129
  /**
94
130
  * @param errorsString; several lines of `code:text`...
95
131
  * @returns errors
@@ -112,8 +148,18 @@ export default class IBMiContent {
112
148
  library: string;
113
149
  name: string;
114
150
  type: string;
115
- }, ...authorities: Authority[]): Promise<boolean>;
151
+ member?: string;
152
+ }, authorities?: Authority[]): Promise<boolean>;
116
153
  testStreamFile(path: string, right: "r" | "w" | "x"): Promise<boolean>;
117
154
  isProtectedPath(path: string): boolean;
155
+ /**
156
+ *
157
+ * @param command Optionally qualified CL command
158
+ * @param parameters A key/value object of parameters
159
+ * @returns Formatted CL string
160
+ */
161
+ static toCl(command: string, parameters: {
162
+ [parameter: string]: string | number | undefined;
163
+ }): string;
118
164
  }
119
165
  export {};
package/api/Storage.d.ts CHANGED
@@ -29,6 +29,7 @@ export declare type CachedServerSettings = {
29
29
  badDataAreasChecked: boolean | null;
30
30
  libraryListValidated: boolean | null;
31
31
  pathChecked?: boolean;
32
+ defaultCCSID: number | null;
32
33
  } | undefined;
33
34
  export declare class GlobalStorage extends Storage {
34
35
  private static instance;
@@ -55,6 +56,7 @@ export declare class GlobalStorage extends Storage {
55
56
  badDataAreasChecked: boolean;
56
57
  libraryListValidated: boolean;
57
58
  pathChecked?: boolean;
59
+ defaultCCSID: number;
58
60
  };
59
61
  setServerSettingsCache(name: string, serverSettings: CachedServerSettings): Promise<void>;
60
62
  deleteServerSettingsCache(name: string): Promise<void>;
package/api/Tools.d.ts CHANGED
@@ -44,4 +44,17 @@ 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
+ * We do this to find previously opened files with the same path, but different case OR readonly flags.
49
+ * Without this, it's possible for the same document to be opened twice simply due to the readonly flag.
50
+ */
51
+ function findExistingDocumentUri(uri: vscode.Uri): vscode.Uri;
52
+ /**
53
+ * Fixes an SQL statement to make it compatible with db2 CLI program QZDFMDB2.
54
+ * - Changes `@clCommand` statements into Call `QSYS2.QCMDEX('clCommand')` procedure calls
55
+ * - Makes sure each comment (`--`) starts on a new line
56
+ * @param statement the statement to fix
57
+ * @returns statement compatible with QZDFMDB2
58
+ */
59
+ function fixSQL(statement: string): string;
47
60
  }
@@ -0,0 +1,3 @@
1
+ import { ExtensionContext, WorkspaceFolder } from "vscode";
2
+ export declare function getGitBranch(workspaceFolder: WorkspaceFolder): string;
3
+ export declare function setupGitEventHandler(context: ExtensionContext): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyontech/vscode-ibmi-types",
3
- "version": "2.6.5",
3
+ "version": "2.7.0",
4
4
  "description": "Types for vscode-ibmi",
5
5
  "typings": "./typings.d.ts",
6
6
  "scripts": {
package/typings.d.ts CHANGED
@@ -85,10 +85,9 @@ export interface QsysPath {
85
85
  export interface IBMiObject extends QsysPath {
86
86
  type: string;
87
87
  text: string;
88
+ sourceFile?: boolean;
88
89
  attribute?: string;
89
- }
90
- export interface IBMiFile extends IBMiObject {
91
- count?: number;
90
+ memberCount?: number;
92
91
  }
93
92
  export interface IBMiMember {
94
93
  library: string;
@@ -157,7 +156,7 @@ export interface ObjectItem extends FilteredItem, WithPath {
157
156
  object: IBMiObject;
158
157
  }
159
158
  export interface SourcePhysicalFileItem extends FilteredItem, WithPath {
160
- sourceFile: IBMiFile;
159
+ sourceFile: IBMiObject;
161
160
  }
162
161
  export interface MemberItem extends FilteredItem, WithPath {
163
162
  member: IBMiMember;