@zowe/cli 7.10.4 → 7.11.1

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.
Files changed (36) hide show
  1. package/lib/daemon/DaemonDecider.js +3 -0
  2. package/lib/daemon/DaemonDecider.js.map +1 -1
  3. package/lib/zosfiles/compare/CompareBase.handler.d.ts +38 -0
  4. package/lib/zosfiles/compare/CompareBase.handler.js +62 -0
  5. package/lib/zosfiles/compare/CompareBase.handler.js.map +1 -0
  6. package/lib/zosfiles/compare/CompareBaseHelper.d.ts +92 -0
  7. package/lib/zosfiles/compare/CompareBaseHelper.js +173 -0
  8. package/lib/zosfiles/compare/CompareBaseHelper.js.map +1 -0
  9. package/lib/zosfiles/compare/doc/ICompareFileOptions.d.ts +14 -0
  10. package/lib/zosfiles/compare/doc/ICompareFileOptions.js +13 -0
  11. package/lib/zosfiles/compare/doc/ICompareFileOptions.js.map +1 -0
  12. package/lib/zosfiles/compare/ds/Dataset.handler.d.ts +7 -5
  13. package/lib/zosfiles/compare/ds/Dataset.handler.js +9 -80
  14. package/lib/zosfiles/compare/ds/Dataset.handler.js.map +1 -1
  15. package/lib/zosfiles/compare/lf-ds/LocalfileDataset.handler.d.ts +8 -6
  16. package/lib/zosfiles/compare/lf-ds/LocalfileDataset.handler.js +10 -94
  17. package/lib/zosfiles/compare/lf-ds/LocalfileDataset.handler.js.map +1 -1
  18. package/lib/zosfiles/compare/lf-sdd/LocalfileSpooldd.handler.d.ts +7 -5
  19. package/lib/zosfiles/compare/lf-sdd/LocalfileSpooldd.handler.js +10 -90
  20. package/lib/zosfiles/compare/lf-sdd/LocalfileSpooldd.handler.js.map +1 -1
  21. package/lib/zosfiles/compare/lf-uss/LocalfileUss.handler.d.ts +7 -5
  22. package/lib/zosfiles/compare/lf-uss/LocalfileUss.handler.js +9 -91
  23. package/lib/zosfiles/compare/lf-uss/LocalfileUss.handler.js.map +1 -1
  24. package/lib/zosfiles/compare/sdd/Spooldd.handler.d.ts +7 -5
  25. package/lib/zosfiles/compare/sdd/Spooldd.handler.js +11 -58
  26. package/lib/zosfiles/compare/sdd/Spooldd.handler.js.map +1 -1
  27. package/lib/zosfiles/compare/uss/UssFile.handler.d.ts +7 -5
  28. package/lib/zosfiles/compare/uss/UssFile.handler.js +9 -71
  29. package/lib/zosfiles/compare/uss/UssFile.handler.js.map +1 -1
  30. package/npm-shrinkwrap.json +86 -86
  31. package/package.json +13 -13
  32. package/prebuilds/Cargo.lock +1 -1
  33. package/prebuilds/Cargo.toml +1 -1
  34. package/prebuilds/zowe-linux.tgz +0 -0
  35. package/prebuilds/zowe-macos.tgz +0 -0
  36. package/prebuilds/zowe-windows.tgz +0 -0
@@ -45,6 +45,9 @@ class DaemonDecider {
45
45
  this.initialParse();
46
46
  if (this.startServer) {
47
47
  this.mUser = os.userInfo().username;
48
+ if (process.platform === "win32") {
49
+ this.mUser = this.mUser.toLowerCase();
50
+ }
48
51
  this.mServer = net.createServer((c) => {
49
52
  new DaemonClient_1.DaemonClient(c, this.mServer, this.mUser).run();
50
53
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DaemonDecider.js","sourceRoot":"","sources":["../../src/daemon/DaemonDecider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;AAEF,yBAAyB;AACzB,2BAA2B;AAC3B,yBAAyB;AACzB,6BAA6B;AAC7B,iDAA2D;AAC3D,iDAA8C;AAC9C,6CAA0C;AAI1C,2DAA2D;AAC3D,6DAA6D;AAC7D,2HAA2H;AAC3H,wBAAwB;AACxB,iCAAiC;AAEjC;;;;GAIG;AACH,MAAa,aAAa;IAyCtB;;;;OAIG;IACH,YAAoB,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;IAAI,CAAC;IAEzC;;;OAGG;IACI,IAAI;QAEP,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE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AQ,KAAK,OAAO,EAAE;oBAC9B,+CAA+C;oBAC/C,IAAI,CAAA,MAAA,MAAA,OAAO,CAAC,GAAG,0CAAE,gBAAgB,0CAAE,MAAM,IAAG,CAAC,EAAE;wBAC3C,iCAAiC;wBACjC,IAAI,CAAC,OAAO,GAAG,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;qBACjE;yBAAM;wBACH,6BAA6B;wBAC7B,IAAI,CAAC,OAAO,GAAG,gBAAgB,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,cAAc,CAAC;qBACvE;iBACJ;qBAAM;oBACH,wCAAwC;oBACxC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,uBAAU,CAAC,YAAY,EAAE,EAAE,aAAa,CAAC,CAAC;iBACtE;gBAED,uBAAU,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,gCAAgC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;aAClF;SACJ;IACL,CAAC;IAED;;;;OAIG;IACH,IAAY,WAAW;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,IAAY,WAAW,CAAC,WAAW;QAC/B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;;AAxML,sCAyMC;AAxMG;;;;;GAKG;AACqB,wBAAU,GAAG,UAAU,CAAC"}
@@ -0,0 +1,38 @@
1
+ /// <reference types="node" />
2
+ import { AbstractSession, ICommandArguments, IHandlerParameters } from "@zowe/imperative";
3
+ import { IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk";
4
+ import { ZosFilesBaseHandler } from "../ZosFilesBase.handler";
5
+ import { CompareBaseHelper } from "./CompareBaseHelper";
6
+ /**
7
+ * This class is used by the various zosfiles-compare handlers as the base class for their implementation.
8
+ * All handlers within zosfiles-compare should extend this class.
9
+ *
10
+ * This class should not be used outside of the zosfiles-compare package.
11
+ *
12
+ * @private
13
+ */
14
+ export declare abstract class CompareBaseHandler extends ZosFilesBaseHandler {
15
+ /**
16
+ * This will grab the zosmf profile and create a session before calling the subclass
17
+ * {@link ZosFilesBaseHandler#processWithSession} method.
18
+ *
19
+ * @param {IHandlerParameters} commandParameters Command parameters sent by imperative.
20
+ *
21
+ * @returns {Promise<void>}
22
+ */
23
+ processWithSession(commandParameters: IHandlerParameters, session: AbstractSession): Promise<IZosFilesResponse>;
24
+ /**
25
+ * Abstract method required for compare handlers to determine how they gather the contents of the file/dataset to compare
26
+ * @param session Gives access to the session object in case the handler needs to submit a request to get the first file
27
+ * @param args Command arguments required for getting the dataset, filepath, or spool descriptor
28
+ * @param helper CompareBaseHelper instance to access prepare- functions
29
+ */
30
+ abstract getFile1(session: AbstractSession, args: ICommandArguments, helper: CompareBaseHelper): Promise<string | Buffer>;
31
+ /**
32
+ * Abstract method required for compare handlers to determine how they gather the contents of the file/dataset to compare
33
+ * @param session Gives access to the session object in case the handler needs to submit a request to get the contents
34
+ * @param args Command arguments required for getting the dataset, filepath, or spool descriptor
35
+ * @param helper CompareBaseHelper instance to access prepare- functions
36
+ */
37
+ abstract getFile2(session: AbstractSession, args: ICommandArguments, helper: CompareBaseHelper): Promise<string | Buffer>;
38
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /*
3
+ * This program and the accompanying materials are made available under the terms of the
4
+ * Eclipse Public License v2.0 which accompanies this distribution, and is available at
5
+ * https://www.eclipse.org/legal/epl-v20.html
6
+ *
7
+ * SPDX-License-Identifier: EPL-2.0
8
+ *
9
+ * Copyright Contributors to the Zowe Project.
10
+ *
11
+ */
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.CompareBaseHandler = void 0;
23
+ const imperative_1 = require("@zowe/imperative");
24
+ const ZosFilesBase_handler_1 = require("../ZosFilesBase.handler");
25
+ const CompareBaseHelper_1 = require("./CompareBaseHelper");
26
+ /**
27
+ * This class is used by the various zosfiles-compare handlers as the base class for their implementation.
28
+ * All handlers within zosfiles-compare should extend this class.
29
+ *
30
+ * This class should not be used outside of the zosfiles-compare package.
31
+ *
32
+ * @private
33
+ */
34
+ class CompareBaseHandler extends ZosFilesBase_handler_1.ZosFilesBaseHandler {
35
+ /**
36
+ * This will grab the zosmf profile and create a session before calling the subclass
37
+ * {@link ZosFilesBaseHandler#processWithSession} method.
38
+ *
39
+ * @param {IHandlerParameters} commandParameters Command parameters sent by imperative.
40
+ *
41
+ * @returns {Promise<void>}
42
+ */
43
+ processWithSession(commandParameters, session) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const helper = new CompareBaseHelper_1.CompareBaseHelper(commandParameters);
46
+ helper.task = {
47
+ percentComplete: 0,
48
+ statusMessage: `Retrieving content for the first file/dataset`,
49
+ stageName: imperative_1.TaskStage.IN_PROGRESS
50
+ };
51
+ commandParameters.response.progress.startBar({ task: helper.task });
52
+ const fileContent1 = yield this.getFile1(session, commandParameters.arguments, helper);
53
+ commandParameters.response.progress.endBar();
54
+ commandParameters.response.progress.startBar({ task: helper.task });
55
+ helper.task.statusMessage = `Retrieving content for the second file/dataset`;
56
+ const fileContent2 = yield this.getFile2(session, commandParameters.arguments, helper);
57
+ return helper.getResponse(helper.prepareContent(fileContent1), helper.prepareContent(fileContent2));
58
+ });
59
+ }
60
+ }
61
+ exports.CompareBaseHandler = CompareBaseHandler;
62
+ //# sourceMappingURL=CompareBase.handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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,92 @@
1
+ /// <reference types="node" />
2
+ import { IHandlerParameters, ITaskWithStatus } from "@zowe/imperative";
3
+ import { IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk";
4
+ import { ICompareFileOptions } from "./doc/ICompareFileOptions";
5
+ /**
6
+ * Base helper for compare command to handle common operations through the comparison
7
+ * @export
8
+ */
9
+ export declare class CompareBaseHelper {
10
+ /**
11
+ * file compare option for file1
12
+ * @public
13
+ * @memberof CompareBaseHelper
14
+ */
15
+ file1Options: ICompareFileOptions;
16
+ /**
17
+ * file compare option for file2
18
+ * @public
19
+ * @memberof CompareBaseHelper
20
+ */
21
+ file2Options: ICompareFileOptions;
22
+ /**
23
+ * responseTimeout option
24
+ * @public
25
+ * @memberof CompareBaseHelper
26
+ */
27
+ responseTimeout: number;
28
+ /**
29
+ * seqnum option
30
+ * @public
31
+ * @memberof CompareBaseHelper
32
+ */
33
+ seqnum: boolean;
34
+ /**
35
+ * contextLines option
36
+ * @private
37
+ * @memberof CompareBaseHelper
38
+ */
39
+ contextLines: number;
40
+ /**
41
+ * browserView option
42
+ * @private
43
+ * @memberof CompareBaseHelper
44
+ */
45
+ browserView: boolean;
46
+ /**
47
+ * task
48
+ * @private
49
+ * @memberof CompareBaseHelper
50
+ */
51
+ task: ITaskWithStatus;
52
+ /**
53
+ * Creates an instance of CompareBaseHelper
54
+ * @param {IHandlerParameters} commandParameters Command parameters sent to the handler
55
+ * @memberof CompareBaseHelper
56
+ */
57
+ constructor(commandParameters: IHandlerParameters);
58
+ /**
59
+ * Parse the spool description and split them into individual properties
60
+ * @param spoolDescription Colon-separated (:) spool descriptor
61
+ * @returns Object containing the name, job id, and spool id
62
+ */
63
+ prepareSpoolDescriptor(spoolDescription: string): {
64
+ jobName: string;
65
+ jobId: string;
66
+ spoolId: number;
67
+ };
68
+ /**
69
+ * Helper function that compare-related handlers will use to get the contents of a local file
70
+ * @param filePath Path to the file to compate against
71
+ * @returns Buffer with the contents of the file
72
+ */
73
+ prepareLocalFile(filePath: string): Buffer;
74
+ /**
75
+ * This method will prepare the strings for comparison ready
76
+ * @param {string | Buffer } content - Content string or buffer of file 1
77
+ * @param {string | Buffer } content2 - - Content string or buffer of file 2
78
+ * @returns
79
+ * @public
80
+ * @memberof CompareBaseHelper
81
+ */
82
+ prepareContent(content: string | Buffer): string;
83
+ /**
84
+ * To get the difference string in ternninal or in browser
85
+ * @param {string} string1 - string of file 1 comtent
86
+ * @param {string} string2 - string of file 2 comtent
87
+ * @returns {IZosFilesResponse}
88
+ * @public
89
+ * @memberof CompareBaseHelper
90
+ */
91
+ getResponse(string1: string, string2: string): Promise<IZosFilesResponse>;
92
+ }
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ /*
3
+ * This program and the accompanying materials are made available under the terms of the
4
+ * Eclipse Public License v2.0 which accompanies this distribution, and is available at
5
+ * https://www.eclipse.org/legal/epl-v20.html
6
+ *
7
+ * SPDX-License-Identifier: EPL-2.0
8
+ *
9
+ * Copyright Contributors to the Zowe Project.
10
+ *
11
+ */
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.CompareBaseHelper = void 0;
23
+ const path = require("path");
24
+ const fs = require("fs");
25
+ const imperative_1 = require("@zowe/imperative");
26
+ /**
27
+ * Base helper for compare command to handle common operations through the comparison
28
+ * @export
29
+ */
30
+ class CompareBaseHelper {
31
+ /**
32
+ * Creates an instance of CompareBaseHelper
33
+ * @param {IHandlerParameters} commandParameters Command parameters sent to the handler
34
+ * @memberof CompareBaseHelper
35
+ */
36
+ constructor(commandParameters) {
37
+ var _a;
38
+ /**
39
+ * file compare option for file1
40
+ * @public
41
+ * @memberof CompareBaseHelper
42
+ */
43
+ this.file1Options = {};
44
+ /**
45
+ * file compare option for file2
46
+ * @public
47
+ * @memberof CompareBaseHelper
48
+ */
49
+ this.file2Options = {};
50
+ this.file1Options.binary = commandParameters.arguments.binary;
51
+ this.file2Options.binary = commandParameters.arguments.binary2;
52
+ this.file1Options.encoding = commandParameters.arguments.encoding;
53
+ this.file2Options.encoding = commandParameters.arguments.encoding2;
54
+ this.file1Options.record = commandParameters.arguments.record;
55
+ this.file2Options.record = commandParameters.arguments.record2;
56
+ this.file1Options.volumeSerial = commandParameters.arguments.volumeSerial;
57
+ this.file2Options.volumeSerial = commandParameters.arguments.volumeSerial2;
58
+ if (((_a = this.file2Options) === null || _a === void 0 ? void 0 : _a.binary) == null) {
59
+ this.file2Options.binary = this.file1Options.binary;
60
+ }
61
+ if (this.file2Options.encoding == null) {
62
+ this.file2Options.encoding = this.file1Options.encoding;
63
+ }
64
+ if (this.file2Options.record == null) {
65
+ this.file2Options.record = this.file1Options.record;
66
+ }
67
+ this.seqnum = commandParameters.arguments.seqnum;
68
+ this.browserView = commandParameters.arguments.browserView;
69
+ this.contextLines = commandParameters.arguments.contextLines;
70
+ this.responseTimeout = commandParameters.arguments.responseTimeout;
71
+ this.file1Options.responseTimeout = this.responseTimeout;
72
+ this.file2Options.responseTimeout = this.responseTimeout;
73
+ // Clear undefined properties
74
+ this.file1Options = JSON.parse(JSON.stringify(this.file1Options));
75
+ this.file2Options = JSON.parse(JSON.stringify(this.file2Options));
76
+ }
77
+ /**
78
+ * Parse the spool description and split them into individual properties
79
+ * @param spoolDescription Colon-separated (:) spool descriptor
80
+ * @returns Object containing the name, job id, and spool id
81
+ */
82
+ prepareSpoolDescriptor(spoolDescription) {
83
+ const descriptionSeperator = ":";
84
+ const spoolDescArr = spoolDescription.split(descriptionSeperator);
85
+ const jobName = spoolDescArr[0];
86
+ const jobId = spoolDescArr[1];
87
+ const spoolId = Number(spoolDescArr[2]);
88
+ return { jobName, jobId, spoolId };
89
+ }
90
+ /**
91
+ * Helper function that compare-related handlers will use to get the contents of a local file
92
+ * @param filePath Path to the file to compate against
93
+ * @returns Buffer with the contents of the file
94
+ */
95
+ prepareLocalFile(filePath) {
96
+ const localFile = path.isAbsolute(filePath) ? filePath : path.resolve(filePath);
97
+ let lfContentBuf;
98
+ let localFileHandle;
99
+ try {
100
+ try {
101
+ // check if the path given is of a file or not
102
+ localFileHandle = fs.openSync(localFile, 'r');
103
+ if (!fs.fstatSync(localFileHandle).isFile()) {
104
+ throw new imperative_1.ImperativeError({
105
+ msg: 'Path is not of a file. Please check the path and try again'
106
+ });
107
+ }
108
+ }
109
+ catch (error) {
110
+ if (error instanceof imperative_1.ImperativeError)
111
+ throw error;
112
+ throw new imperative_1.ImperativeError({
113
+ msg: 'Path not found. Please check the path and try again'
114
+ });
115
+ }
116
+ // reading local file as buffer
117
+ lfContentBuf = fs.readFileSync(localFileHandle);
118
+ }
119
+ finally {
120
+ if (localFileHandle != null)
121
+ fs.closeSync(localFileHandle);
122
+ }
123
+ return lfContentBuf;
124
+ }
125
+ /**
126
+ * This method will prepare the strings for comparison ready
127
+ * @param {string | Buffer } content - Content string or buffer of file 1
128
+ * @param {string | Buffer } content2 - - Content string or buffer of file 2
129
+ * @returns
130
+ * @public
131
+ * @memberof CompareBaseHelper
132
+ */
133
+ prepareContent(content) {
134
+ let contentString = content.toString();
135
+ if (this.seqnum === false) {
136
+ const seqnumlen = 8;
137
+ contentString = content.toString().split("\n").map((line) => line.slice(0, -seqnumlen)).join("\n");
138
+ }
139
+ return contentString;
140
+ }
141
+ /**
142
+ * To get the difference string in ternninal or in browser
143
+ * @param {string} string1 - string of file 1 comtent
144
+ * @param {string} string2 - string of file 2 comtent
145
+ * @returns {IZosFilesResponse}
146
+ * @public
147
+ * @memberof CompareBaseHelper
148
+ */
149
+ getResponse(string1, string2) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ // CHECHKING IIF THE BROWSER VIEW IS TRUE, OPEN UP THE DIFFS IN BROWSER
152
+ if (this.browserView) {
153
+ yield imperative_1.DiffUtils.openDiffInbrowser(string1, string2);
154
+ return {
155
+ success: true,
156
+ commandResponse: "Launching data-sets diffs in browser...",
157
+ apiResponse: {}
158
+ };
159
+ }
160
+ const jsonDiff = yield imperative_1.DiffUtils.getDiffString(string1, string2, {
161
+ outputFormat: 'terminal',
162
+ contextLinesArg: this.contextLines
163
+ });
164
+ return {
165
+ success: true,
166
+ commandResponse: jsonDiff,
167
+ apiResponse: {}
168
+ };
169
+ });
170
+ }
171
+ }
172
+ exports.CompareBaseHelper = CompareBaseHelper;
173
+ //# sourceMappingURL=CompareBaseHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompareBaseHelper.js","sourceRoot":"","sources":["../../../src/zosfiles/compare/CompareBaseHelper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,yBAAyB;AACzB,iDAAmG;AAInG;;;GAGG;AACH,MAAa,iBAAiB;IAmD1B;;;;OAIG;IACH,YAAY,iBAAqC;;QAtDjD;;;;WAIG;QACI,iBAAY,GAAwB,EAAE,CAAC;QAE9C;;;;WAIG;QACI,iBAAY,GAAwB,EAAE,CAAC;QA2C1C,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAAC;QAC9D,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC;QAC/D,IAAI,CAAC,YAAY,CAAC,QAAQ,GAAG,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC;QAClE,IAAI,CAAC,YAAY,CAAC,QAAQ,GAAG,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC;QACnE,IAAI,CAAC,YAAY,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AClB,CAAC;QACN,CAAC;KAAA;CACJ;AApLD,8CAoLC"}
@@ -0,0 +1,14 @@
1
+ import { IZosFilesOptions } from "@zowe/zos-files-for-zowe-sdk";
2
+ /**
3
+ * These are the options to be used in file comaparison to handle the
4
+ * binary, encoding, record and volumeSerial operations in the comparison process
5
+ *
6
+ * @exports
7
+ * @interface ICompareFileOptions
8
+ */
9
+ export interface ICompareFileOptions extends IZosFilesOptions {
10
+ binary?: boolean;
11
+ encoding?: string;
12
+ record?: boolean;
13
+ volumeSerial?: string;
14
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /*
3
+ * This program and the accompanying materials are made available under the terms of the
4
+ * Eclipse Public License v2.0 which accompanies this distribution, and is available at
5
+ * https://www.eclipse.org/legal/epl-v20.html
6
+ *
7
+ * SPDX-License-Identifier: EPL-2.0
8
+ *
9
+ * Copyright Contributors to the Zowe Project.
10
+ *
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=ICompareFileOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICompareFileOptions.js","sourceRoot":"","sources":["../../../../src/zosfiles/compare/doc/ICompareFileOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE"}
@@ -1,10 +1,12 @@
1
- import { AbstractSession, IHandlerParameters } from "@zowe/imperative";
2
- import { IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk";
3
- import { ZosFilesBaseHandler } from "../../ZosFilesBase.handler";
1
+ /// <reference types="node" />
2
+ import { AbstractSession, ICommandArguments } from "@zowe/imperative";
3
+ import { CompareBaseHandler } from "../CompareBase.handler";
4
+ import { CompareBaseHelper } from '../CompareBaseHelper';
4
5
  /**
5
6
  * Handler to view a data set's content
6
7
  * @export
7
8
  */
8
- export default class DatasetHandler extends ZosFilesBaseHandler {
9
- processWithSession(commandParameters: IHandlerParameters, session: AbstractSession): Promise<IZosFilesResponse>;
9
+ export default class DatasetHandler extends CompareBaseHandler {
10
+ getFile1(session: AbstractSession, args: ICommandArguments, helper: CompareBaseHelper): Promise<string | Buffer>;
11
+ getFile2(session: AbstractSession, args: ICommandArguments, helper: CompareBaseHelper): Promise<string | Buffer>;
10
12
  }
@@ -19,92 +19,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
19
  });
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- const imperative_1 = require("@zowe/imperative");
23
22
  const zos_files_for_zowe_sdk_1 = require("@zowe/zos-files-for-zowe-sdk");
24
- const ZosFilesBase_handler_1 = require("../../ZosFilesBase.handler");
23
+ const CompareBase_handler_1 = require("../CompareBase.handler");
25
24
  /**
26
25
  * Handler to view a data set's content
27
26
  * @export
28
27
  */
29
- class DatasetHandler extends ZosFilesBase_handler_1.ZosFilesBaseHandler {
30
- processWithSession(commandParameters, session) {
28
+ class DatasetHandler extends CompareBase_handler_1.CompareBaseHandler {
29
+ getFile1(session, args, helper) {
31
30
  return __awaiter(this, void 0, void 0, function* () {
32
- const task = {
33
- percentComplete: 0,
34
- statusMessage: "Retrieving first dataset",
35
- stageName: imperative_1.TaskStage.IN_PROGRESS
36
- };
37
- // RETRIEVING THE FIRST DATA-SET
38
- commandParameters.response.progress.startBar({ task });
39
- const dsContentBuf1 = yield zos_files_for_zowe_sdk_1.Get.dataSet(session, commandParameters.arguments.dataSetName1, {
40
- binary: commandParameters.arguments.binary,
41
- encoding: commandParameters.arguments.encoding,
42
- record: commandParameters.arguments.record,
43
- volume: commandParameters.arguments.volumeSerial,
44
- responseTimeout: commandParameters.arguments.responseTimeout,
45
- task: task
46
- });
47
- commandParameters.response.progress.endBar();
48
- // RETRIEVING THE DATA-SET TO COMPARE
49
- task.statusMessage = "Retrieving second dataset";
50
- commandParameters.response.progress.startBar({ task });
51
- let binary2 = commandParameters.arguments.binary2;
52
- let encoding2 = commandParameters.arguments.encoding2;
53
- let record2 = commandParameters.arguments.record2;
54
- const volumeSerial2 = commandParameters.arguments.volumeSerial2;
55
- if (binary2 == undefined) {
56
- binary2 = commandParameters.arguments.binary;
57
- }
58
- if (encoding2 == undefined) {
59
- encoding2 = commandParameters.arguments.encoding;
60
- }
61
- if (record2 == undefined) {
62
- record2 = commandParameters.arguments.record;
63
- }
64
- const dsContentBuf2 = yield zos_files_for_zowe_sdk_1.Get.dataSet(session, commandParameters.arguments.dataSetName2, {
65
- binary: binary2,
66
- encoding: encoding2,
67
- record: record2,
68
- volume: volumeSerial2,
69
- responseTimeout: commandParameters.arguments.responseTimeout,
70
- task: task
71
- });
72
- commandParameters.response.progress.endBar();
73
- //CHECKING IF NEEDING TO SPLIT CONTENT STRINGS FOR SEQNUM OPTION
74
- let dsContentString1 = "";
75
- let dsContentString2 = "";
76
- const seqnumlen = 8;
77
- if (commandParameters.arguments.seqnum === false) {
78
- dsContentString1 = dsContentBuf1.toString().split("\n")
79
- .map((line) => line.slice(0, -seqnumlen))
80
- .join("\n");
81
- dsContentString2 = dsContentBuf2.toString().split("\n")
82
- .map((line) => line.slice(0, -seqnumlen))
83
- .join("\n");
84
- }
85
- else {
86
- dsContentString1 = dsContentBuf1.toString();
87
- dsContentString2 = dsContentBuf2.toString();
88
- }
89
- // CHECK TO OPEN UP DIFF IN BROWSER WINDOW
90
- if (commandParameters.arguments.browserView) {
91
- yield imperative_1.DiffUtils.openDiffInbrowser(dsContentString1, dsContentString2);
92
- return {
93
- success: true,
94
- commandResponse: "Launching data-sets diffs in browser...",
95
- apiResponse: {}
96
- };
97
- }
98
- // RETURNING DIFF
99
- const jsonDiff = yield imperative_1.DiffUtils.getDiffString(dsContentString1, dsContentString2, {
100
- outputFormat: 'terminal',
101
- contextLinesArg: commandParameters.arguments.contextLines
102
- });
103
- return {
104
- success: true,
105
- commandResponse: jsonDiff,
106
- apiResponse: {}
107
- };
31
+ return yield zos_files_for_zowe_sdk_1.Get.dataSet(session, args.dataSetName1, Object.assign(Object.assign({}, helper.file1Options), { task: helper.task }));
32
+ });
33
+ }
34
+ getFile2(session, args, helper) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ return yield zos_files_for_zowe_sdk_1.Get.dataSet(session, args.dataSetName2, Object.assign(Object.assign({}, helper.file2Options), { task: helper.task }));
108
37
  });
109
38
  }
110
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Dataset.handler.js","sourceRoot":"","sources":["../../../../src/zosfiles/compare/ds/Dataset.handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;;;;;;;AAEF,iDAA8G;AAC9G,yEAAsE;AACtE,qEAAiE;AACjE;;;GAGG;AACH,MAAqB,cAAe,SAAQ,0CAAmB;IAC9C,kBAAkB,CAAC,iBAAqC,EAAE,OAAwB;;YAC3F,MAAM,IAAI,GAAoB;gBAC1B,eAAe,EAAE,CAAC;gBAClB,aAAa,EAAE,0BAA0B;gBACzC,SAAS,EAAE,sBAAS,CAAC,WAAW;aACnC,CAAC;YAEF,gCAAgC;YAChC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YACvD,MAAM,aAAa,GAAG,MAAM,4BAAG,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,YAAY,EACrF;gBACI,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,MAAM;gBAC1C,QAAQ,EAAE,iBAAiB,CAAC,SAAS,CAAC,QAAQ;gBAC9C,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,MAAM;gBAC1C,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,YAAY;gBAChD,eAAe,EAAE,iBAAiB,CAAC,SAAS,CAAC,eAAe;gBAC5D,IAAI,EAAE,IAAI;aACb,CACJ,CAAC;YACF,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAG7C,qCAAqC;YACrC,IAAI,CAAC,aAAa,GAAG,2BAA2B,CAAC;YACjD,iBAAiB,CAAC,QAAQ,CA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;AACnD,gEAA4D;AAE5D;;;GAGG;AACH,MAAqB,cAAe,SAAQ,wCAAkB;IAC7C,QAAQ,CAAC,OAAwB,EAAE,IAAuB,EAAE,MAAyB;;YAC9F,OAAO,MAAM,4BAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,kCAAO,MAAM,CAAC,YAAY,KAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAG,CAAC;QACxG,CAAC;KAAA;IACY,QAAQ,CAAC,OAAwB,EAAE,IAAuB,EAAE,MAAyB;;YAC9F,OAAO,MAAM,4BAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,kCAAO,MAAM,CAAC,YAAY,KAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAG,CAAC;QACxG,CAAC;KAAA;CACJ;AAPD,iCAOC"}
@@ -1,10 +1,12 @@
1
- import { AbstractSession, IHandlerParameters } from "@zowe/imperative";
2
- import { IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk";
3
- import { ZosFilesBaseHandler } from "../../ZosFilesBase.handler";
1
+ /// <reference types="node" />
2
+ import { AbstractSession, ICommandArguments } from "@zowe/imperative";
3
+ import { CompareBaseHelper } from '../CompareBaseHelper';
4
+ import { CompareBaseHandler } from '../CompareBase.handler';
4
5
  /**
5
- * Handler to view a data set's content
6
+ * Handler to compare a localfile and a dataset content
6
7
  * @export
7
8
  */
8
- export default class LocalfileDatasetHandler extends ZosFilesBaseHandler {
9
- processWithSession(commandParameters: IHandlerParameters, session: AbstractSession): Promise<IZosFilesResponse>;
9
+ export default class LocalfileDatasetHandler extends CompareBaseHandler {
10
+ getFile1(session: AbstractSession, args: ICommandArguments, helper: CompareBaseHelper): Promise<Buffer>;
11
+ getFile2(session: AbstractSession, args: ICommandArguments, helper: CompareBaseHelper): Promise<Buffer>;
10
12
  }