@zowe/cli 7.16.4 → 7.17.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.
- package/lib/zosfiles/-strings-/en.d.ts +32 -0
- package/lib/zosfiles/-strings-/en.js +34 -0
- package/lib/zosfiles/-strings-/en.js.map +1 -1
- package/lib/zosfiles/ZosFiles.definition.js +16 -14
- package/lib/zosfiles/ZosFiles.definition.js.map +1 -1
- package/lib/zosfiles/compare/CompareBaseHelper.d.ts +7 -6
- package/lib/zosfiles/compare/CompareBaseHelper.js +13 -10
- package/lib/zosfiles/compare/CompareBaseHelper.js.map +1 -1
- package/lib/zosfiles/compare/uss/UssFile.definition.js +1 -1
- package/lib/zosfiles/compare/uss/UssFile.definition.js.map +1 -1
- package/lib/zosfiles/download/ds/Dataset.handler.js +2 -1
- package/lib/zosfiles/download/ds/Dataset.handler.js.map +1 -1
- package/lib/zosfiles/download/uss/UssFile.handler.js +2 -1
- package/lib/zosfiles/download/uss/UssFile.handler.js.map +1 -1
- package/lib/zosfiles/edit/Edit.definition.d.ts +6 -0
- package/lib/zosfiles/edit/Edit.definition.js +33 -0
- package/lib/zosfiles/edit/Edit.definition.js.map +1 -0
- package/lib/zosfiles/edit/Edit.handler.d.ts +10 -0
- package/lib/zosfiles/edit/Edit.handler.js +111 -0
- package/lib/zosfiles/edit/Edit.handler.js.map +1 -0
- package/lib/zosfiles/edit/Edit.options.d.ts +7 -0
- package/lib/zosfiles/edit/Edit.options.js +39 -0
- package/lib/zosfiles/edit/Edit.options.js.map +1 -0
- package/lib/zosfiles/edit/Edit.utils.d.ts +118 -0
- package/lib/zosfiles/edit/Edit.utils.js +365 -0
- package/lib/zosfiles/edit/Edit.utils.js.map +1 -0
- package/lib/zosfiles/edit/ds/Dataset.definition.d.ts +6 -0
- package/lib/zosfiles/edit/ds/Dataset.definition.js +58 -0
- package/lib/zosfiles/edit/ds/Dataset.definition.js.map +1 -0
- package/lib/zosfiles/edit/uss/USSFile.definition.d.ts +6 -0
- package/lib/zosfiles/edit/uss/USSFile.definition.js +53 -0
- package/lib/zosfiles/edit/uss/USSFile.definition.js.map +1 -0
- package/npm-shrinkwrap.json +96 -203
- package/package.json +13 -13
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk";
|
|
2
|
+
import { AbstractSession, IHandlerParameters } from "@zowe/imperative";
|
|
3
|
+
/**
|
|
4
|
+
* enum of prompts to be used as input to {@link EditUtilities.promptUser} during the file editing process
|
|
5
|
+
* @export
|
|
6
|
+
* @enum
|
|
7
|
+
*/
|
|
8
|
+
export declare enum Prompt {
|
|
9
|
+
useStash = 0,
|
|
10
|
+
viewDiff = 1,
|
|
11
|
+
overwriteRemote = 2,
|
|
12
|
+
viewUpdatedRemote = 3,
|
|
13
|
+
continueToUpload = 4
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Type indicates which file system is being used for storage on mainframe {@link ILocalFile}
|
|
17
|
+
* @export
|
|
18
|
+
* @type
|
|
19
|
+
*/
|
|
20
|
+
export declare type EditFileType = "uss" | "ds";
|
|
21
|
+
/**
|
|
22
|
+
* A class to hold pertinent information about the local file during the editing process
|
|
23
|
+
* @export
|
|
24
|
+
* @interface
|
|
25
|
+
*/
|
|
26
|
+
export interface ILocalFile {
|
|
27
|
+
tempPath: string | null;
|
|
28
|
+
fileName: string;
|
|
29
|
+
fileType: EditFileType;
|
|
30
|
+
guiAvail: boolean;
|
|
31
|
+
zosResp: IZosFilesResponse | null;
|
|
32
|
+
conflict: boolean;
|
|
33
|
+
encoding?: string | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A shared utility class that uss and ds handlers use for local file editing
|
|
37
|
+
* @export
|
|
38
|
+
* @class
|
|
39
|
+
*/
|
|
40
|
+
export declare class EditUtilities {
|
|
41
|
+
/**
|
|
42
|
+
* Builds a temp path where local file will be saved. If uss file, file name will be hashed
|
|
43
|
+
* to prevent any conflicts with file naming. A given filename will always result in the
|
|
44
|
+
* same unique file path.
|
|
45
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
46
|
+
* @returns {Promise<string>} - returns unique file path for temp file
|
|
47
|
+
* @memberof EditUtilities
|
|
48
|
+
*/
|
|
49
|
+
static buildTempPath(lfFile: ILocalFile, commandParameters: IHandlerParameters): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Check for temp path's existence (check if previously 'stashed'/temp edits exist)
|
|
52
|
+
* @param {string} tempPath - unique file path for local file (stash/temp file)
|
|
53
|
+
* @returns {Promise<boolean>} - promise that resolves to true if stash exists or false if doesn't
|
|
54
|
+
* @memberof EditUtilities
|
|
55
|
+
*/
|
|
56
|
+
static checkForStash(tempPath: string): Promise<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Collection of prompts to be used at different points in editing process
|
|
59
|
+
* @param {Prompt} prompt - selected prompt from {@link Prompt} (enum object)
|
|
60
|
+
* @param {Boolean} conflict - optional. true if detected conflict between local and remote files
|
|
61
|
+
* @returns {Promise<boolean>} - promise whose resolution depends on user input
|
|
62
|
+
* @memberof EditUtilities
|
|
63
|
+
*/
|
|
64
|
+
static promptUser(prompt: Prompt, conflict?: boolean): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Download file and determine if downloading just to get etag (useStash) or to save file locally & get etag (!useStash)
|
|
67
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
68
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
69
|
+
* @param {boolean} useStash - should be true if don't want to overwrite local file when refreshing etag
|
|
70
|
+
* @returns {ILocalFile}
|
|
71
|
+
*/
|
|
72
|
+
static localDownload(session: AbstractSession, lfFile: ILocalFile, useStash: boolean): Promise<ILocalFile>;
|
|
73
|
+
/**
|
|
74
|
+
* Performs appropriate file comparison (either in browser or as a terminal diff) between local file and remote
|
|
75
|
+
* Local file (lf) will then be opened in default editor
|
|
76
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
77
|
+
* @param {IHandlerParameters} commandParameters - parameters supplied by args
|
|
78
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
79
|
+
* @param {boolean} promptUser - optional. if there are changes then prompt user to show diff, otherwise return
|
|
80
|
+
* @returns {Promise<IZosFilesResponse>} - the response generated by {@link CompareBaseHelper.getResponse}
|
|
81
|
+
* @memberof EditUtilities
|
|
82
|
+
*/
|
|
83
|
+
static fileComparison(session: AbstractSession, commandParameters: IHandlerParameters, lfFile: ILocalFile, promptUser?: boolean): Promise<IZosFilesResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Enable user to make their edits and wait for user input to indicate editing is complete
|
|
86
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
87
|
+
* @param {string} editor - optional parameter originally supplied by args
|
|
88
|
+
* @memberof EditUtilities
|
|
89
|
+
*/
|
|
90
|
+
static makeEdits(lfFile: ILocalFile, editor?: string): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Upload temp file with saved etag
|
|
93
|
+
* - if matching etag: successful upload, destroy stash/temp -> END
|
|
94
|
+
* - if non-matching etag: unsuccessful upload -> refresh etag -> perform file comparison/edit -> re-attempt upload
|
|
95
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
96
|
+
* @param {IHandlerParameters} commandParameters - parameters supplied by args
|
|
97
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
98
|
+
* @returns {Promise<[boolean, boolean]>} - [resolves to true if uploading was successful and
|
|
99
|
+
* false if not, resolves to true if user wishes to cancel command and false if not]
|
|
100
|
+
* @memberof EditUtilities
|
|
101
|
+
*/
|
|
102
|
+
static uploadEdits(session: AbstractSession, commandParameters: IHandlerParameters, lfFile: ILocalFile): Promise<[boolean, boolean]>;
|
|
103
|
+
/**
|
|
104
|
+
* When changes occur in the remote file, user will have to overwrite remote or account for the discrepancy between files
|
|
105
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
106
|
+
* @param {IHandlerParameters} commandParameters - parameters supplied by args
|
|
107
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
108
|
+
* @returns {Promise<boolean>} - returns a boolean where true means command is canceled and false means continue
|
|
109
|
+
* @memberof EditUtilities
|
|
110
|
+
*/
|
|
111
|
+
static etagMismatch(session: AbstractSession, commandParameters: IHandlerParameters, lfFile: ILocalFile): Promise<[boolean, boolean]>;
|
|
112
|
+
/**
|
|
113
|
+
* Destroy path of temporary local file (remove stash)
|
|
114
|
+
* @param {string} tempPath - unique file path for local file (stash)
|
|
115
|
+
* @memberof EditUtilities
|
|
116
|
+
*/
|
|
117
|
+
static destroyTempFile(tempPath: string): Promise<void>;
|
|
118
|
+
}
|
|
@@ -0,0 +1,365 @@
|
|
|
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.EditUtilities = exports.Prompt = void 0;
|
|
23
|
+
const zos_files_for_zowe_sdk_1 = require("@zowe/zos-files-for-zowe-sdk");
|
|
24
|
+
const imperative_1 = require("@zowe/imperative");
|
|
25
|
+
const CompareBaseHelper_1 = require("../compare/CompareBaseHelper");
|
|
26
|
+
const fs_1 = require("fs");
|
|
27
|
+
const os_1 = require("os");
|
|
28
|
+
const path = require("path");
|
|
29
|
+
const LocalfileDataset_handler_1 = require("../compare/lf-ds/LocalfileDataset.handler");
|
|
30
|
+
const LocalfileUss_handler_1 = require("../compare/lf-uss/LocalfileUss.handler");
|
|
31
|
+
/**
|
|
32
|
+
* enum of prompts to be used as input to {@link EditUtilities.promptUser} during the file editing process
|
|
33
|
+
* @export
|
|
34
|
+
* @enum
|
|
35
|
+
*/
|
|
36
|
+
var Prompt;
|
|
37
|
+
(function (Prompt) {
|
|
38
|
+
Prompt[Prompt["useStash"] = 0] = "useStash";
|
|
39
|
+
Prompt[Prompt["viewDiff"] = 1] = "viewDiff";
|
|
40
|
+
Prompt[Prompt["overwriteRemote"] = 2] = "overwriteRemote";
|
|
41
|
+
Prompt[Prompt["viewUpdatedRemote"] = 3] = "viewUpdatedRemote";
|
|
42
|
+
Prompt[Prompt["continueToUpload"] = 4] = "continueToUpload";
|
|
43
|
+
})(Prompt = exports.Prompt || (exports.Prompt = {}));
|
|
44
|
+
/**
|
|
45
|
+
* A shared utility class that uss and ds handlers use for local file editing
|
|
46
|
+
* @export
|
|
47
|
+
* @class
|
|
48
|
+
*/
|
|
49
|
+
class EditUtilities {
|
|
50
|
+
/**
|
|
51
|
+
* Builds a temp path where local file will be saved. If uss file, file name will be hashed
|
|
52
|
+
* to prevent any conflicts with file naming. A given filename will always result in the
|
|
53
|
+
* same unique file path.
|
|
54
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
55
|
+
* @returns {Promise<string>} - returns unique file path for temp file
|
|
56
|
+
* @memberof EditUtilities
|
|
57
|
+
*/
|
|
58
|
+
static buildTempPath(lfFile, commandParameters) {
|
|
59
|
+
var _a;
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
// find the appropriate extension for either uss or ds
|
|
62
|
+
const ussExt = (lfFile.fileType === 'uss' && lfFile.fileName.includes(".")) ? lfFile.fileName.split(".").pop() : "";
|
|
63
|
+
let ext = "." + (lfFile.fileType === 'uss' ? ussExt : ((_a = commandParameters.arguments.extension) !== null && _a !== void 0 ? _a : "txt"));
|
|
64
|
+
ext = (ext === "." ? "" : ext);
|
|
65
|
+
if (lfFile.fileType === 'uss') {
|
|
66
|
+
// Hash in a repeatable way if uss fileName (in case presence of special chars)
|
|
67
|
+
const crypto = require("crypto");
|
|
68
|
+
let hash = crypto.createHash('sha256').update(lfFile.fileName).digest('hex');
|
|
69
|
+
// shorten hash
|
|
70
|
+
const hashLen = 10;
|
|
71
|
+
hash = hash.slice(0, hashLen);
|
|
72
|
+
return path.join((0, os_1.tmpdir)(), path.parse(lfFile.fileName).name + '_' + hash + ext);
|
|
73
|
+
}
|
|
74
|
+
return path.join((0, os_1.tmpdir)(), lfFile.fileName + ext);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check for temp path's existence (check if previously 'stashed'/temp edits exist)
|
|
79
|
+
* @param {string} tempPath - unique file path for local file (stash/temp file)
|
|
80
|
+
* @returns {Promise<boolean>} - promise that resolves to true if stash exists or false if doesn't
|
|
81
|
+
* @memberof EditUtilities
|
|
82
|
+
*/
|
|
83
|
+
static checkForStash(tempPath) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
try {
|
|
86
|
+
return (0, fs_1.existsSync)(tempPath);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
throw new imperative_1.ImperativeError({
|
|
90
|
+
msg: 'Failure when checking for stash. Command terminated.',
|
|
91
|
+
causeErrors: err
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Collection of prompts to be used at different points in editing process
|
|
98
|
+
* @param {Prompt} prompt - selected prompt from {@link Prompt} (enum object)
|
|
99
|
+
* @param {Boolean} conflict - optional. true if detected conflict between local and remote files
|
|
100
|
+
* @returns {Promise<boolean>} - promise whose resolution depends on user input
|
|
101
|
+
* @memberof EditUtilities
|
|
102
|
+
*/
|
|
103
|
+
static promptUser(prompt, conflict) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
let input;
|
|
106
|
+
let promptText;
|
|
107
|
+
const promptPrefix = (conflict ? 'CONFLICT: ' : '');
|
|
108
|
+
switch (prompt) {
|
|
109
|
+
case Prompt.useStash:
|
|
110
|
+
promptText = 'Keep and continue editing found temp file? y/n';
|
|
111
|
+
break;
|
|
112
|
+
case Prompt.viewDiff:
|
|
113
|
+
promptText = 'View diff between temp and mainframe files? y/n';
|
|
114
|
+
break;
|
|
115
|
+
case Prompt.viewUpdatedRemote:
|
|
116
|
+
promptText = promptPrefix + 'Remote has changed. View diff between local and mainframe files? y/n';
|
|
117
|
+
break;
|
|
118
|
+
case Prompt.overwriteRemote:
|
|
119
|
+
promptText = promptPrefix + 'Overwrite remote with local edits? (Answer after editing) y/n';
|
|
120
|
+
break;
|
|
121
|
+
case Prompt.continueToUpload:
|
|
122
|
+
promptText = promptPrefix + 'Ignore conflicts and overwrite remote? y/n';
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
do {
|
|
126
|
+
input = yield imperative_1.CliUtils.readPrompt(imperative_1.TextUtils.chalk.green(promptText));
|
|
127
|
+
} while (input != null && input.toLowerCase() != 'y' && input.toLowerCase() != 'n');
|
|
128
|
+
if (input === null) {
|
|
129
|
+
throw new imperative_1.ImperativeError({
|
|
130
|
+
msg: imperative_1.TextUtils.chalk.red('No input provided. Command terminated. Temp file will persist.')
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return input.toLowerCase() === 'y';
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Download file and determine if downloading just to get etag (useStash) or to save file locally & get etag (!useStash)
|
|
138
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
139
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
140
|
+
* @param {boolean} useStash - should be true if don't want to overwrite local file when refreshing etag
|
|
141
|
+
* @returns {ILocalFile}
|
|
142
|
+
*/
|
|
143
|
+
static localDownload(session, lfFile, useStash) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
// account for both useStash|!useStash and uss|ds when downloading
|
|
146
|
+
const tempPath = useStash ? path.posix.join((0, os_1.tmpdir)(), "toDelete.txt") : lfFile.tempPath;
|
|
147
|
+
const args = [
|
|
148
|
+
session,
|
|
149
|
+
lfFile.fileName,
|
|
150
|
+
{
|
|
151
|
+
returnEtag: true,
|
|
152
|
+
binary: null,
|
|
153
|
+
encoding: null,
|
|
154
|
+
file: tempPath
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
if (lfFile.fileType === 'uss') {
|
|
158
|
+
lfFile.zosResp = yield zos_files_for_zowe_sdk_1.Download.ussFile(...args);
|
|
159
|
+
lfFile.encoding = args[2].encoding;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
lfFile.zosResp = yield zos_files_for_zowe_sdk_1.Download.dataSet(...args);
|
|
163
|
+
}
|
|
164
|
+
if (useStash) {
|
|
165
|
+
yield this.destroyTempFile(path.posix.join((0, os_1.tmpdir)(), "toDelete.txt"));
|
|
166
|
+
}
|
|
167
|
+
return lfFile;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Performs appropriate file comparison (either in browser or as a terminal diff) between local file and remote
|
|
172
|
+
* Local file (lf) will then be opened in default editor
|
|
173
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
174
|
+
* @param {IHandlerParameters} commandParameters - parameters supplied by args
|
|
175
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
176
|
+
* @param {boolean} promptUser - optional. if there are changes then prompt user to show diff, otherwise return
|
|
177
|
+
* @returns {Promise<IZosFilesResponse>} - the response generated by {@link CompareBaseHelper.getResponse}
|
|
178
|
+
* @memberof EditUtilities
|
|
179
|
+
*/
|
|
180
|
+
static fileComparison(session, commandParameters, lfFile, promptUser) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
const handlerDs = new LocalfileDataset_handler_1.default();
|
|
183
|
+
const handlerUss = new LocalfileUss_handler_1.default();
|
|
184
|
+
const helper = new CompareBaseHelper_1.CompareBaseHelper(commandParameters);
|
|
185
|
+
const gui = imperative_1.ProcessUtils.isGuiAvailable();
|
|
186
|
+
const options = {
|
|
187
|
+
name1: "local file",
|
|
188
|
+
name2: "remote file"
|
|
189
|
+
};
|
|
190
|
+
helper.browserView = (gui === imperative_1.GuiResult.GUI_AVAILABLE);
|
|
191
|
+
const lf = yield handlerDs.getFile1(session, commandParameters.arguments, helper);
|
|
192
|
+
let mf;
|
|
193
|
+
try {
|
|
194
|
+
if (commandParameters.positionals[2].includes('d')) {
|
|
195
|
+
mf = yield handlerDs.getFile2(session, commandParameters.arguments, helper);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
mf = yield handlerUss.getFile2(session, commandParameters.arguments, helper);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
throw new imperative_1.ImperativeError({
|
|
203
|
+
msg: imperative_1.TextUtils.chalk.red(err + '\nCommand terminated. Issue retrieving files for comparison.'),
|
|
204
|
+
causeErrors: err
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const localContent = helper.prepareContent(lf);
|
|
208
|
+
const remoteContent = helper.prepareContent(mf);
|
|
209
|
+
let viewUpdatedRemote = !promptUser;
|
|
210
|
+
if (localContent !== remoteContent) {
|
|
211
|
+
lfFile.conflict = true;
|
|
212
|
+
}
|
|
213
|
+
if (promptUser && lfFile.conflict) {
|
|
214
|
+
viewUpdatedRemote = yield this.promptUser(Prompt.viewUpdatedRemote, lfFile.conflict);
|
|
215
|
+
}
|
|
216
|
+
if (!viewUpdatedRemote) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const diffResponse = yield helper.getResponse(localContent, remoteContent, options);
|
|
220
|
+
if (!helper.browserView) {
|
|
221
|
+
if (diffResponse) {
|
|
222
|
+
commandParameters.response.console.log('\n' + diffResponse.commandResponse);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
throw new imperative_1.ImperativeError({
|
|
226
|
+
msg: imperative_1.TextUtils.chalk.red('Diff was unable to be generated')
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return diffResponse;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Enable user to make their edits and wait for user input to indicate editing is complete
|
|
235
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
236
|
+
* @param {string} editor - optional parameter originally supplied by args
|
|
237
|
+
* @memberof EditUtilities
|
|
238
|
+
*/
|
|
239
|
+
static makeEdits(lfFile, editor) {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
+
if (lfFile.guiAvail) {
|
|
242
|
+
imperative_1.ProcessUtils.openInEditor(lfFile.tempPath, editor, true);
|
|
243
|
+
}
|
|
244
|
+
return yield this.promptUser(Prompt.overwriteRemote, lfFile.conflict);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Upload temp file with saved etag
|
|
249
|
+
* - if matching etag: successful upload, destroy stash/temp -> END
|
|
250
|
+
* - if non-matching etag: unsuccessful upload -> refresh etag -> perform file comparison/edit -> re-attempt upload
|
|
251
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
252
|
+
* @param {IHandlerParameters} commandParameters - parameters supplied by args
|
|
253
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
254
|
+
* @returns {Promise<[boolean, boolean]>} - [resolves to true if uploading was successful and
|
|
255
|
+
* false if not, resolves to true if user wishes to cancel command and false if not]
|
|
256
|
+
* @memberof EditUtilities
|
|
257
|
+
*/
|
|
258
|
+
static uploadEdits(session, commandParameters, lfFile) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
const etagMismatchCode = 412;
|
|
261
|
+
const args = [
|
|
262
|
+
session,
|
|
263
|
+
lfFile.tempPath,
|
|
264
|
+
lfFile.fileName,
|
|
265
|
+
{
|
|
266
|
+
encoding: lfFile.encoding,
|
|
267
|
+
etag: lfFile.zosResp.apiResponse.etag,
|
|
268
|
+
returnEtag: true
|
|
269
|
+
},
|
|
270
|
+
];
|
|
271
|
+
let response;
|
|
272
|
+
try {
|
|
273
|
+
if (lfFile.fileType === 'uss') {
|
|
274
|
+
response = yield zos_files_for_zowe_sdk_1.Upload.fileToUssFile(...args);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
response = yield zos_files_for_zowe_sdk_1.Upload.fileToDataset(...args);
|
|
278
|
+
}
|
|
279
|
+
if (response.success) {
|
|
280
|
+
// If matching etag & successful upload, destroy temp file -> END
|
|
281
|
+
yield this.destroyTempFile(lfFile.tempPath);
|
|
282
|
+
return [true, false];
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
if (response.commandResponse.includes('412')) {
|
|
286
|
+
return yield this.etagMismatch(session, commandParameters, lfFile);
|
|
287
|
+
//returns [uploaded, canceled]
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
if (err.errorCode && err.errorCode == etagMismatchCode) {
|
|
293
|
+
return yield this.etagMismatch(session, commandParameters, lfFile);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
throw new imperative_1.ImperativeError({
|
|
297
|
+
msg: imperative_1.TextUtils.chalk.red((response === null || response === void 0 ? void 0 : response.errorMessage) +
|
|
298
|
+
'Command terminated. Issue uploading stash. Temp file will persist'),
|
|
299
|
+
causeErrors: response === null || response === void 0 ? void 0 : response.errorMessage
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* When changes occur in the remote file, user will have to overwrite remote or account for the discrepancy between files
|
|
305
|
+
* @param {AbstractSession} session - the session object generated from the connected profile
|
|
306
|
+
* @param {IHandlerParameters} commandParameters - parameters supplied by args
|
|
307
|
+
* @param {ILocalFile} lfFile - object containing pertinent information about the local file during the editing process
|
|
308
|
+
* @returns {Promise<boolean>} - returns a boolean where true means command is canceled and false means continue
|
|
309
|
+
* @memberof EditUtilities
|
|
310
|
+
*/
|
|
311
|
+
static etagMismatch(session, commandParameters, lfFile) {
|
|
312
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
313
|
+
lfFile.conflict = true;
|
|
314
|
+
try {
|
|
315
|
+
//alert user that the version of document they've been editing has changed
|
|
316
|
+
//ask if they want to see changes on the remote file before continuing
|
|
317
|
+
const viewUpdatedRemote = yield this.promptUser(Prompt.viewUpdatedRemote, lfFile.conflict);
|
|
318
|
+
if (viewUpdatedRemote) {
|
|
319
|
+
yield this.fileComparison(session, commandParameters, lfFile);
|
|
320
|
+
}
|
|
321
|
+
//ask if they want to keep editing or upload despite changes to remote
|
|
322
|
+
const continueToUpload = yield this.promptUser(Prompt.continueToUpload, lfFile.conflict);
|
|
323
|
+
// refresh etag, keep stash
|
|
324
|
+
yield this.localDownload(session, lfFile, true);
|
|
325
|
+
if (!continueToUpload) {
|
|
326
|
+
// create more edits & open stash/lf in editor
|
|
327
|
+
const readyToUpload = yield this.makeEdits(lfFile, commandParameters.arguments.editor);
|
|
328
|
+
if (readyToUpload) {
|
|
329
|
+
return yield EditUtilities.uploadEdits(session, commandParameters, lfFile);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
return [false, true]; //[uploaded, canceled]
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return [false, false]; //[uploaded, canceled]
|
|
336
|
+
}
|
|
337
|
+
catch (err) {
|
|
338
|
+
throw new imperative_1.ImperativeError({
|
|
339
|
+
msg: imperative_1.TextUtils.chalk.red('Command terminated. Issue with etag. Temp file will persist.'),
|
|
340
|
+
causeErrors: err
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Destroy path of temporary local file (remove stash)
|
|
347
|
+
* @param {string} tempPath - unique file path for local file (stash)
|
|
348
|
+
* @memberof EditUtilities
|
|
349
|
+
*/
|
|
350
|
+
static destroyTempFile(tempPath) {
|
|
351
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
+
try {
|
|
353
|
+
(0, fs_1.unlinkSync)(tempPath);
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
throw new imperative_1.ImperativeError({
|
|
357
|
+
msg: 'Temporary file could not be deleted: ${tempPath}',
|
|
358
|
+
causeErrors: err
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
exports.EditUtilities = EditUtilities;
|
|
365
|
+
//# sourceMappingURL=Edit.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Edit.utils.js","sourceRoot":"","sources":["../../../src/zosfiles/edit/Edit.utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;;;;;;;;AAEF,yEAAqH;AACrH,iDACoE;AACpE,oEAAiE;AACjE,2BAA4C;AAC5C,2BAA4B;AAC5B,6BAA6B;AAC7B,wFAAgF;AAChF,iFAAyE;AAGzE;;;;GAIG;AACH,IAAY,MAMX;AAND,WAAY,MAAM;IACd,2CAAQ,CAAA;IACR,2CAAQ,CAAA;IAC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;wBACD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,sBAAsB;qBAC/C;iBACJ;gBACD,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,sBAAsB;aAChD;YAAA,OAAM,GAAG,EAAC;gBACP,MAAM,IAAI,4BAAe,CAAC;oBACtB,GAAG,EAAE,sBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,8DAA8D,CAAC;oBACxF,WAAW,EAAE,GAAG;iBACnB,CAAC,CAAC;aACN;QACL,CAAC;KAAA;IAED;;;;OAIG;IACI,MAAM,CAAO,eAAe,CAAC,QAAe;;YAC/C,IAAI;gBACA,IAAA,eAAU,EAAC,QAAQ,CAAC,CAAC;aACxB;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,4BAAe,CAAC;oBACtB,GAAG,EAAE,kDAAkD;oBACvD,WAAW,EAAE,GAAG;iBACnB,CAAC,CAAC;aACN;QACL,CAAC;KAAA;CACJ;AA9SD,sCA8SC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
exports.DatasetDefinition = void 0;
|
|
14
|
+
const Edit_options_1 = require("../Edit.options");
|
|
15
|
+
// Does not use the import in anticipation of some internationalization work to be done later.
|
|
16
|
+
const strings = require("../../-strings-/en").default.EDIT;
|
|
17
|
+
/**
|
|
18
|
+
* Edit data set command definition containing its description, examples and/or options
|
|
19
|
+
* @type {ICommandDefinition}
|
|
20
|
+
*/
|
|
21
|
+
exports.DatasetDefinition = {
|
|
22
|
+
name: "data-set",
|
|
23
|
+
aliases: ["ds"],
|
|
24
|
+
summary: strings.ACTIONS.DATA_SET.SUMMARY,
|
|
25
|
+
description: strings.ACTIONS.DATA_SET.DESCRIPTION,
|
|
26
|
+
type: "command",
|
|
27
|
+
handler: __dirname + "/../Edit.handler",
|
|
28
|
+
profile: {
|
|
29
|
+
optional: ["zosmf"],
|
|
30
|
+
},
|
|
31
|
+
positionals: [
|
|
32
|
+
{
|
|
33
|
+
name: "dataSetName",
|
|
34
|
+
description: strings.ACTIONS.DATA_SET.POSITIONALS.DATASETNAME,
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
options: [
|
|
40
|
+
Edit_options_1.EditOptions.editor,
|
|
41
|
+
Edit_options_1.EditOptions.extension
|
|
42
|
+
],
|
|
43
|
+
examples: [
|
|
44
|
+
{
|
|
45
|
+
description: strings.ACTIONS.DATA_SET.EXAMPLES.EX1,
|
|
46
|
+
options: `ibmuser.cntl(iefbr14) --editor notepad`
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
description: strings.ACTIONS.DATA_SET.EXAMPLES.EX1,
|
|
50
|
+
options: `ibmuser.cntl(iefbr14) --editor C:\\Windows\\System32\\Notepad.exe`
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: strings.ACTIONS.USS_FILE.EXAMPLES.EX2,
|
|
54
|
+
options: `ibmuser.jcl(iefbr14) --editor notepad --extension jcl`
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=Dataset.definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dataset.definition.js","sourceRoot":"","sources":["../../../../src/zosfiles/edit/ds/Dataset.definition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;AAGF,kDAA8C;AAG9C,8FAA8F;AAC9F,MAAM,OAAO,GAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAA8B,CAAC,IAAI,CAAC;AAEnF;;;GAGG;AACU,QAAA,iBAAiB,GAAuB;IACjD,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,CAAC,IAAI,CAAC;IACf,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACzC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW;IACjD,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS,GAAG,kBAAkB;IACvC,OAAO,EAAE;QACL,QAAQ,EAAE,CAAC,OAAO,CAAC;KACtB;IACD,WAAW,EAAE;QACT;YACI,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW;YAC7D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACjB;KACJ;IACD,OAAO,EAAE;QACL,0BAAW,CAAC,MAAM;QAClB,0BAAW,CAAC,SAAS;KACxB;IACD,QAAQ,EAAE;QACN;YACI,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;YAClD,OAAO,EAAE,wCAAwC;SACpD;QACD;YACI,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;YAClD,OAAO,EAAE,mEAAmE;SAC/E;QACD;YACI,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;YAClD,OAAO,EAAE,uDAAuD;SACnE;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
exports.USSFileDefinition = void 0;
|
|
14
|
+
const Edit_options_1 = require("../Edit.options");
|
|
15
|
+
// Does not use the import in anticipation of some internationalization work to be done later.
|
|
16
|
+
const strings = require("../../-strings-/en").default.EDIT;
|
|
17
|
+
/**
|
|
18
|
+
* Edit USS file content command definition containing its description, examples and/or options
|
|
19
|
+
* @type {ICommandDefinition}
|
|
20
|
+
*/
|
|
21
|
+
exports.USSFileDefinition = {
|
|
22
|
+
name: "uss-file",
|
|
23
|
+
aliases: ["uss", "uf"],
|
|
24
|
+
summary: strings.ACTIONS.USS_FILE.SUMMARY,
|
|
25
|
+
description: strings.ACTIONS.USS_FILE.DESCRIPTION,
|
|
26
|
+
type: "command",
|
|
27
|
+
handler: __dirname + "/../Edit.handler",
|
|
28
|
+
profile: {
|
|
29
|
+
optional: ["zosmf"],
|
|
30
|
+
},
|
|
31
|
+
positionals: [
|
|
32
|
+
{
|
|
33
|
+
name: "ussFilePath",
|
|
34
|
+
description: strings.ACTIONS.USS_FILE.POSITIONALS.USSFILEPATH,
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
options: [
|
|
40
|
+
Edit_options_1.EditOptions.editor
|
|
41
|
+
],
|
|
42
|
+
examples: [
|
|
43
|
+
{
|
|
44
|
+
description: strings.ACTIONS.USS_FILE.EXAMPLES.EX1,
|
|
45
|
+
options: `/a/ibmuser/my_text.txt --editor notepad`
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
description: strings.ACTIONS.USS_FILE.EXAMPLES.EX1,
|
|
49
|
+
options: `/a/ibmuser/my_text.txt --editor C:\\Windows\\System32\\Notepad.exe`
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=USSFile.definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"USSFile.definition.js","sourceRoot":"","sources":["../../../../src/zosfiles/edit/uss/USSFile.definition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;AAGF,kDAA8C;AAG9C,8FAA8F;AAC9F,MAAM,OAAO,GAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAA8B,CAAC,IAAI,CAAC;AAEnF;;;GAGG;AACU,QAAA,iBAAiB,GAAuB;IACjD,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACzC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW;IACjD,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS,GAAG,kBAAkB;IACvC,OAAO,EAAE;QACL,QAAQ,EAAE,CAAC,OAAO,CAAC;KACtB;IACD,WAAW,EAAE;QACT;YACI,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW;YAC7D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACjB;KACJ;IACD,OAAO,EAAE;QACL,0BAAW,CAAC,MAAM;KACrB;IACD,QAAQ,EAAE;QACN;YACI,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;YAClD,OAAO,EAAE,yCAAyC;SACrD;QACD;YACI,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;YAClD,OAAO,EAAE,oEAAoE;SAChF;KACJ;CACJ,CAAC"}
|