@zowe/cli 7.16.6 → 7.18.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/config/auto-init/ApimlAutoInitHandler.js +42 -16
- package/lib/config/auto-init/ApimlAutoInitHandler.js.map +1 -1
- package/lib/daemon/DaemonDecider.js +4 -6
- package/lib/daemon/DaemonDecider.js.map +1 -1
- package/lib/zosfiles/-strings-/en.d.ts +32 -0
- package/lib/zosfiles/-strings-/en.js +36 -2
- 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 +176 -1232
- package/package.json +15 -16
- package/prebuilds/Cargo.lock +21 -33
- package/prebuilds/Cargo.toml +3 -3
- package/prebuilds/zowe-linux.tgz +0 -0
- package/prebuilds/zowe-macos.tgz +0 -0
- package/prebuilds/zowe-windows.tgz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-darwin-arm64.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-darwin-x64.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-linux-arm64.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-linux-armv7l.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-linux-ia32.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-linux-x64.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-linuxmusl-arm64.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-linuxmusl-x64.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-win32-arm64.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-win32-ia32.tar.gz +0 -0
- package/prebuilds/keytar-v7.9.0-napi-v3-win32-x64.tar.gz +0 -0
- package/scripts/preinstall.js +0 -18
|
@@ -40,7 +40,8 @@ class UssFileHandler extends ZosFilesBase_handler_1.ZosFilesBaseHandler {
|
|
|
40
40
|
encoding: commandParameters.arguments.encoding,
|
|
41
41
|
file: commandParameters.arguments.file,
|
|
42
42
|
task,
|
|
43
|
-
responseTimeout: commandParameters.arguments.responseTimeout
|
|
43
|
+
responseTimeout: commandParameters.arguments.responseTimeout,
|
|
44
|
+
overwrite: commandParameters.arguments.overwrite
|
|
44
45
|
});
|
|
45
46
|
});
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UssFile.handler.js","sourceRoot":"","sources":["../../../../src/zosfiles/download/uss/UssFile.handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;;;;;;;AAEF,qEAAiE;AACjE,iDAAmG;AACnG,yEAA2E;AAE3E;;;GAGG;AACH,MAAqB,cAAe,SAAQ,0CAAmB;IAC9C,kBAAkB,CAAC,iBAAqC,EAAE,OAAwB;;YAC3F,MAAM,IAAI,GAAoB;gBAC1B,eAAe,EAAE,CAAC;gBAClB,aAAa,EAAE,sBAAsB;gBACrC,SAAS,EAAE,sBAAS,CAAC,WAAW;aACnC,CAAC;YACF,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;YACrD,OAAO,iCAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,WAAW,EAAE;gBACtE,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,MAAM;gBAC1C,QAAQ,EAAE,iBAAiB,CAAC,SAAS,CAAC,QAAQ;gBAC9C,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,IAAI;gBACtC,IAAI;gBACJ,eAAe,EAAE,iBAAiB,CAAC,SAAS,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"UssFile.handler.js","sourceRoot":"","sources":["../../../../src/zosfiles/download/uss/UssFile.handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;;;;;;;AAEF,qEAAiE;AACjE,iDAAmG;AACnG,yEAA2E;AAE3E;;;GAGG;AACH,MAAqB,cAAe,SAAQ,0CAAmB;IAC9C,kBAAkB,CAAC,iBAAqC,EAAE,OAAwB;;YAC3F,MAAM,IAAI,GAAoB;gBAC1B,eAAe,EAAE,CAAC;gBAClB,aAAa,EAAE,sBAAsB;gBACrC,SAAS,EAAE,sBAAS,CAAC,WAAW;aACnC,CAAC;YACF,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;YACrD,OAAO,iCAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,WAAW,EAAE;gBACtE,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,MAAM;gBAC1C,QAAQ,EAAE,iBAAiB,CAAC,SAAS,CAAC,QAAQ;gBAC9C,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,IAAI;gBACtC,IAAI;gBACJ,eAAe,EAAE,iBAAiB,CAAC,SAAS,CAAC,eAAe;gBAC5D,SAAS,EAAE,iBAAiB,CAAC,SAAS,CAAC,SAAS;aACnD,CAAC,CAAC;QACP,CAAC;KAAA;CACJ;AAjBD,iCAiBC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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.EditDefinition = void 0;
|
|
14
|
+
const Dataset_definition_1 = require("./ds/Dataset.definition");
|
|
15
|
+
const USSFile_definition_1 = require("./uss/USSFile.definition");
|
|
16
|
+
// Does not use the import in anticipation of some internationalization work to be done later.
|
|
17
|
+
const strings = require("../-strings-/en").default.EDIT;
|
|
18
|
+
/**
|
|
19
|
+
* Edit group definition containing its description and children
|
|
20
|
+
* @type {ICommandDefinition}
|
|
21
|
+
*/
|
|
22
|
+
exports.EditDefinition = {
|
|
23
|
+
name: "edit",
|
|
24
|
+
aliases: ["ed"],
|
|
25
|
+
type: "group",
|
|
26
|
+
summary: strings.SUMMARY,
|
|
27
|
+
description: strings.DESCRIPTION,
|
|
28
|
+
children: [
|
|
29
|
+
Dataset_definition_1.DatasetDefinition,
|
|
30
|
+
USSFile_definition_1.USSFileDefinition
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=Edit.definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Edit.definition.js","sourceRoot":"","sources":["../../../src/zosfiles/edit/Edit.definition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;AAGF,gEAA0D;AAG1D,iEAA2D;AAE3D,8FAA8F;AAC9F,MAAM,OAAO,GAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAA8B,CAAC,IAAI,CAAC;AAEhF;;;GAGG;AACU,QAAA,cAAc,GAAuB;IAC9C,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,CAAC,IAAI,CAAC;IACf,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO,CAAC,OAAO;IACxB,WAAW,EAAE,OAAO,CAAC,WAAW;IAChC,QAAQ,EAAE;QACN,sCAAiB;QACjB,sCAAiB;KACpB;CACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractSession, IHandlerParameters } from "@zowe/imperative";
|
|
2
|
+
import { IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk";
|
|
3
|
+
import { ZosFilesBaseHandler } from "../ZosFilesBase.handler";
|
|
4
|
+
/**
|
|
5
|
+
* Handler to Edit USS or DS content locally
|
|
6
|
+
* @export
|
|
7
|
+
*/
|
|
8
|
+
export default class EditHandler extends ZosFilesBaseHandler {
|
|
9
|
+
processWithSession(commandParameters: IHandlerParameters, session: AbstractSession): Promise<IZosFilesResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
const imperative_1 = require("@zowe/imperative");
|
|
23
|
+
const ZosFilesBase_handler_1 = require("../ZosFilesBase.handler");
|
|
24
|
+
const Edit_utils_1 = require("../edit/Edit.utils");
|
|
25
|
+
/**
|
|
26
|
+
* Handler to Edit USS or DS content locally
|
|
27
|
+
* @export
|
|
28
|
+
*/
|
|
29
|
+
class EditHandler extends ZosFilesBase_handler_1.ZosFilesBaseHandler {
|
|
30
|
+
processWithSession(commandParameters, session) {
|
|
31
|
+
var _a;
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
// Setup - build temp and check for stash
|
|
34
|
+
let lfFile = {
|
|
35
|
+
tempPath: null,
|
|
36
|
+
fileName: (_a = commandParameters.arguments.ussFilePath) !== null && _a !== void 0 ? _a : commandParameters.arguments.dataSetName,
|
|
37
|
+
fileType: commandParameters.positionals[2].includes('d') ? "ds" : "uss",
|
|
38
|
+
guiAvail: imperative_1.ProcessUtils.isGuiAvailable() === imperative_1.GuiResult.GUI_AVAILABLE,
|
|
39
|
+
conflict: false,
|
|
40
|
+
zosResp: null
|
|
41
|
+
};
|
|
42
|
+
lfFile.tempPath = commandParameters.arguments.localFilePath = yield Edit_utils_1.EditUtilities.buildTempPath(lfFile, commandParameters);
|
|
43
|
+
// Use or override stash if exists
|
|
44
|
+
const stash = yield Edit_utils_1.EditUtilities.checkForStash(lfFile.tempPath);
|
|
45
|
+
let useStash, viewDiff = false;
|
|
46
|
+
if (stash) {
|
|
47
|
+
useStash = yield Edit_utils_1.EditUtilities.promptUser(Edit_utils_1.Prompt.useStash);
|
|
48
|
+
}
|
|
49
|
+
// Retrieve etag & download mf file to edit locally if not using stash
|
|
50
|
+
try {
|
|
51
|
+
const task = {
|
|
52
|
+
percentComplete: 10,
|
|
53
|
+
statusMessage: "Retrieving file",
|
|
54
|
+
stageName: imperative_1.TaskStage.IN_PROGRESS
|
|
55
|
+
};
|
|
56
|
+
commandParameters.response.progress.startBar({ task });
|
|
57
|
+
// Retrieve etag AND file contents if not using stash
|
|
58
|
+
lfFile = yield Edit_utils_1.EditUtilities.localDownload(session, lfFile, useStash);
|
|
59
|
+
commandParameters.response.progress.endBar();
|
|
60
|
+
// Show a file comparison for the purpose of seeing the current version of remote compared to past edits
|
|
61
|
+
if (useStash) {
|
|
62
|
+
viewDiff = yield Edit_utils_1.EditUtilities.promptUser(Edit_utils_1.Prompt.viewDiff);
|
|
63
|
+
if (viewDiff) {
|
|
64
|
+
yield Edit_utils_1.EditUtilities.fileComparison(session, commandParameters, lfFile);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error instanceof imperative_1.ImperativeError && error.errorCode === String(imperative_1.RestConstants.HTTP_STATUS_404)) {
|
|
70
|
+
throw new imperative_1.ImperativeError({
|
|
71
|
+
msg: imperative_1.TextUtils.chalk.red(`File not found on mainframe. Command terminated.`),
|
|
72
|
+
causeErrors: error
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Edit local copy of mf file (automatically open an editor for user if not in headless linux)
|
|
80
|
+
commandParameters.response.console.log(imperative_1.TextUtils.chalk.green(`Temp file location: `) +
|
|
81
|
+
imperative_1.TextUtils.chalk.blue(lfFile.tempPath));
|
|
82
|
+
const overwrite = yield Edit_utils_1.EditUtilities.makeEdits(lfFile, commandParameters.arguments.editor);
|
|
83
|
+
if (!overwrite) {
|
|
84
|
+
return {
|
|
85
|
+
success: true,
|
|
86
|
+
commandResponse: imperative_1.TextUtils.chalk.green("Exiting now. Temp file persists for editing.")
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Once done editing, user will provide terminal input. Upload local file with saved etag
|
|
90
|
+
let uploaded = false;
|
|
91
|
+
let canceled = false;
|
|
92
|
+
do {
|
|
93
|
+
[uploaded, canceled] = yield Edit_utils_1.EditUtilities.uploadEdits(session, commandParameters, lfFile);
|
|
94
|
+
} while (!uploaded && !canceled);
|
|
95
|
+
if (!canceled) {
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
commandResponse: imperative_1.TextUtils.chalk.green("Successfully uploaded edits to mainframe.")
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
commandResponse: imperative_1.TextUtils.chalk.green("Exiting now. Temp file persists for editing.")
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.default = EditHandler;
|
|
111
|
+
//# sourceMappingURL=Edit.handler.js.map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,CAAC,SAAS,EAAC;gBACX,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,eAAe,EAAE,sBAAS,CAAC,KAAK,CAAC,KAAK,CAClC,8CAA8C,CACjD;iBACJ,CAAC;aACL;YAED,yFAAyF;YACzF,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,GAAG;gBACC,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,MAAM,0BAAK,CAAC,WAAW,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;aACtF,QAAQ,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;YACjC,IAAI,CAAC,QAAQ,EAAC;gBACV,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,eAAe,EAAE,sBAAS,CAAC,KAAK,CAAC,KAAK,CAClC,2CAA2C,CAC9C;iBACJ,CAAC;aACL;iBAAM;gBACH,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,eAAe,EAAE,sBAAS,CAAC,KAAK,CAAC,KAAK,CAClC,8CAA8C,CACjD;iBACJ,CAAC;aACL;;KAEJ;CACJ;AA1FD,8BA0FC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.EditOptions = void 0;
|
|
14
|
+
// Does not use the import in anticipation of some internationalization work to be done later.
|
|
15
|
+
const strings = require("../-strings-/en").default.EDIT.OPTIONS;
|
|
16
|
+
/**
|
|
17
|
+
* Object containing all options to be used by the Edit API
|
|
18
|
+
*/
|
|
19
|
+
exports.EditOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* The option to set a default editor
|
|
22
|
+
* @type {ICommandOptionDefinition}
|
|
23
|
+
*/
|
|
24
|
+
editor: {
|
|
25
|
+
name: "editor",
|
|
26
|
+
aliases: ["ed"],
|
|
27
|
+
description: strings.EDITOR,
|
|
28
|
+
type: "string",
|
|
29
|
+
required: false
|
|
30
|
+
},
|
|
31
|
+
extension: {
|
|
32
|
+
name: "extension",
|
|
33
|
+
aliases: ["ext"],
|
|
34
|
+
description: strings.EXTENSION,
|
|
35
|
+
type: "string",
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=Edit.options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Edit.options.js","sourceRoot":"","sources":["../../../src/zosfiles/edit/Edit.options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;AAMF,8FAA8F;AAC9F,MAAM,OAAO,GAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAA8B,CAAC,IAAI,CAAC,OAAO,CAAC;AAExF;;GAEG;AACU,QAAA,WAAW,GAAgD;IAEpE;;;OAGG;IACH,MAAM,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,IAAI,CAAC;QACf,WAAW,EAAE,OAAO,CAAC,MAAM;QAC3B,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACP,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,CAAC,KAAK,CAAC;QAChB,WAAW,EAAE,OAAO,CAAC,SAAS;QAC9B,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;KAClB;CACJ,CAAC"}
|
|
@@ -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
|
+
}
|