@sasjs/cli 3.6.0 → 3.6.4
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/README.md +0 -3
- package/build/cli.js +4 -4
- package/build/cli.spec.js +6 -6
- package/build/commands/add/addCommand.js +2 -2
- package/build/commands/add/addCredential.js +27 -27
- package/build/commands/add/addTarget.js +10 -10
- package/build/commands/add/internal/input.js +30 -30
- package/build/commands/add/internal/saveConfig.js +2 -2
- package/build/commands/add/spec/addCommand.spec.js +24 -20
- package/build/commands/add/spec/addCredential.spec.js +14 -14
- package/build/commands/add/spec/addTarget.spec.js +22 -22
- package/build/commands/build/build.js +81 -77
- package/build/commands/build/buildCommand.js +3 -3
- package/build/commands/build/compileBuildCommand.js +4 -4
- package/build/commands/build/internal/config.js +8 -8
- package/build/commands/build/internal/getLaunchPageCode.js +2 -2
- package/build/commands/build/spec/build.spec.js +10 -10
- package/build/commands/build/spec/buildCommand.spec.js +16 -12
- package/build/commands/build/spec/cb.spec.server.js +18 -18
- package/build/commands/build/spec/compileBuildCommand.spec.js +17 -13
- package/build/commands/compile/compile.js +61 -61
- package/build/commands/compile/compileCommand.js +10 -10
- package/build/commands/compile/compileSingleFile.js +17 -17
- package/build/commands/compile/internal/checkCompileStatus.js +11 -11
- package/build/commands/compile/internal/compareFolders.js +11 -11
- package/build/commands/compile/internal/compileJobFile.js +3 -3
- package/build/commands/compile/internal/compileServiceFile.js +14 -14
- package/build/commands/compile/internal/compileTestFile.js +41 -37
- package/build/commands/compile/internal/getAllJobFolders.js +13 -9
- package/build/commands/compile/internal/getAllServiceFolders.js +13 -9
- package/build/commands/compile/internal/getServerType.js +1 -1
- package/build/commands/compile/internal/identifySasFile.js +2 -2
- package/build/commands/compile/internal/loadDependencies.js +5 -5
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +40 -40
- package/build/commands/compile/spec/compareFolders.spec.js +27 -27
- package/build/commands/compile/spec/compile.spec.js +93 -93
- package/build/commands/compile/spec/compileCommand.spec.js +37 -33
- package/build/commands/compile/spec/compileJobFile.spec.js +12 -22
- package/build/commands/compile/spec/compileServiceFile.spec.js +12 -22
- package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +7 -7
- package/build/commands/compile/spec/loadDependencies.spec.js +31 -162
- package/build/commands/context/contextCommand.js +16 -16
- package/build/commands/context/create.js +1 -1
- package/build/commands/context/delete.js +2 -2
- package/build/commands/context/edit.js +1 -1
- package/build/commands/context/export.js +5 -5
- package/build/commands/context/internal/validateConfigPath.js +1 -1
- package/build/commands/context/list.js +4 -4
- package/build/commands/context/spec/contextCommand.spec.js +80 -76
- package/build/commands/context/spec/create.spec.js +3 -3
- package/build/commands/context/spec/delete.spec.js +3 -3
- package/build/commands/context/spec/edit.spec.js +3 -3
- package/build/commands/context/spec/export.spec.js +8 -8
- package/build/commands/context/spec/list.spec.js +5 -5
- package/build/commands/create/create.js +12 -12
- package/build/commands/create/createCommand.js +2 -2
- package/build/commands/create/internal/createReadme.js +2 -2
- package/build/commands/create/spec/create.spec.js +39 -39
- package/build/commands/create/spec/createCommand.spec.js +14 -10
- package/build/commands/db/db.js +22 -22
- package/build/commands/db/dbCommand.js +1 -1
- package/build/commands/db/spec/db.spec.js +8 -8
- package/build/commands/db/spec/dbCommand.spec.js +11 -7
- package/build/commands/deploy/compileBuildDeployCommand.js +6 -6
- package/build/commands/deploy/deploy.js +39 -39
- package/build/commands/deploy/deployCommand.js +2 -2
- package/build/commands/deploy/internal/getDeployScripts.js +14 -10
- package/build/commands/deploy/spec/cbd.spec.js +14 -14
- package/build/commands/deploy/spec/cbd.spec.server.js +40 -40
- package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +18 -14
- package/build/commands/deploy/spec/deployCommand.spec.js +15 -11
- package/build/commands/deploy/spec/getDeployScripts.spec.js +8 -8
- package/build/commands/deploy/spec/utils.js +17 -17
- package/build/commands/docs/docsCommand.js +7 -7
- package/build/commands/docs/generateDocs.js +33 -29
- package/build/commands/docs/generateDot.js +12 -8
- package/build/commands/docs/initDocs.js +1 -1
- package/build/commands/docs/internal/createDotFiles.js +6 -6
- package/build/commands/docs/internal/getDotFileContent.js +17 -17
- package/build/commands/docs/internal/getFileInputs.js +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +1 -1
- package/build/commands/docs/internal/getFoldersForDocs.js +4 -4
- package/build/commands/docs/internal/populateNodeDictionary.js +1 -1
- package/build/commands/docs/spec/docsCommand.spec.js +25 -21
- package/build/commands/docs/spec/generateDocs.spec.js +60 -60
- package/build/commands/docs/spec/generateDot.spec.js +23 -23
- package/build/commands/docs/spec/getDocConfig.spec.js +2 -2
- package/build/commands/docs/spec/initDocs.spec.js +7 -7
- package/build/commands/flow/execute.js +8 -8
- package/build/commands/flow/flowCommand.js +5 -5
- package/build/commands/flow/internal/checkPredecessorDeadlock.js +11 -7
- package/build/commands/flow/internal/executeFlow.js +23 -23
- package/build/commands/flow/internal/failAllSuccessors.js +1 -1
- package/build/commands/flow/internal/generateFileName.js +2 -2
- package/build/commands/flow/internal/normalizeFilePath.js +1 -1
- package/build/commands/flow/internal/parseJobDetails.js +3 -3
- package/build/commands/flow/internal/printError.js +1 -1
- package/build/commands/flow/internal/saveLog.js +8 -8
- package/build/commands/flow/internal/saveToCsv.js +2 -2
- package/build/commands/flow/internal/spec/allFlowsCompleted.spec.js +4 -4
- package/build/commands/flow/internal/spec/checkPredecessorDeadlock.spec.js +4 -4
- package/build/commands/flow/internal/spec/executeFlow.spec.js +10 -10
- package/build/commands/flow/internal/spec/failAllSuccessors.spec.js +1 -1
- package/build/commands/flow/internal/spec/saveToCsv.spec.js +16 -16
- package/build/commands/flow/internal/spec/validateParams.spec.js +33 -33
- package/build/commands/flow/internal/validateParams.js +17 -17
- package/build/commands/flow/spec/flow.spec.js +1 -1
- package/build/commands/flow/spec/flow.spec.server.js +60 -60
- package/build/commands/flow/spec/flowCommand.spec.js +16 -12
- package/build/commands/folder/create.js +2 -2
- package/build/commands/folder/delete.js +2 -2
- package/build/commands/folder/folderCommand.js +11 -11
- package/build/commands/folder/move.js +2 -2
- package/build/commands/folder/spec/folder.spec.server.js +35 -35
- package/build/commands/folder/spec/folderCommand.spec.js +23 -19
- package/build/commands/help/help.js +46 -46
- package/build/commands/help/helpCommand.js +1 -1
- package/build/commands/help/spec/help.spec.js +8 -8
- package/build/commands/help/spec/helpCommand.spec.js +11 -7
- package/build/commands/init/init.js +7 -7
- package/build/commands/init/initCommand.js +1 -1
- package/build/commands/init/spec/init.spec.server.js +17 -17
- package/build/commands/init/spec/initCommand.spec.js +11 -7
- package/build/commands/job/internal/execute/sasjs.js +1 -1
- package/build/commands/job/internal/execute/viya.js +35 -35
- package/build/commands/job/internal/utils.js +6 -6
- package/build/commands/job/jobCommand.js +6 -6
- package/build/commands/job/spec/execute.spec.js +6 -6
- package/build/commands/job/spec/getContextName.spec.js +2 -2
- package/build/commands/job/spec/job.spec.server.js +53 -53
- package/build/commands/job/spec/jobCommand.spec.js +17 -13
- package/build/commands/lint/initLint.js +2 -2
- package/build/commands/lint/lintCommand.js +10 -10
- package/build/commands/lint/processLint.js +5 -5
- package/build/commands/lint/spec/lintCommand.spec.js +19 -15
- package/build/commands/request/request.js +16 -16
- package/build/commands/request/requestCommand.js +5 -5
- package/build/commands/request/spec/request.spec.server.js +210 -178
- package/build/commands/request/spec/requestCommand.spec.js +17 -13
- package/build/commands/run/run.js +23 -23
- package/build/commands/run/runCommand.js +2 -2
- package/build/commands/run/spec/run.spec.server.js +51 -51
- package/build/commands/run/spec/runCommand.spec.js +10 -6
- package/build/commands/servicepack/deploy.js +6 -6
- package/build/commands/servicepack/servicePackCommand.js +3 -3
- package/build/commands/servicepack/spec/servicepack.spec.server.js +6 -6
- package/build/commands/servicepack/spec/servicepackCommand.spec.js +10 -6
- package/build/commands/shared/createConfigFile.js +2 -2
- package/build/commands/shared/createFileStructure.js +6 -6
- package/build/commands/shared/createLintConfigFile.js +1 -1
- package/build/commands/shared/deployToSasViyaWithServicePack.js +4 -4
- package/build/commands/shared/fetchLogFileContent.js +10 -6
- package/build/commands/testing/internal/saveOutput.js +39 -35
- package/build/commands/testing/spec/testCommand.spec.js +17 -13
- package/build/commands/testing/spec/testing.spec.server.js +38 -38
- package/build/commands/testing/test.js +45 -41
- package/build/commands/testing/testCommand.js +2 -2
- package/build/commands/version/spec/version.spec.js +1 -1
- package/build/commands/version/spec/versionCommand.spec.js +11 -7
- package/build/commands/version/version.js +3 -3
- package/build/commands/version/versionCommand.js +2 -2
- package/build/commands/web/internal/createAssetServices.js +28 -24
- package/build/commands/web/internal/getWebServiceContent.js +6 -6
- package/build/commands/web/internal/sasjsout.d.ts +1 -1
- package/build/commands/web/internal/sasjsout.js +1 -1
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +2 -2
- package/build/commands/web/internal/spec/updateScriptTag.spec.js +10 -10
- package/build/commands/web/internal/updateAllTags.js +19 -15
- package/build/commands/web/internal/updateLinkTag.js +2 -2
- package/build/commands/web/internal/updateScriptTag.js +6 -6
- package/build/commands/web/spec/web.spec.js +23 -23
- package/build/commands/web/spec/webCommand.spec.js +16 -12
- package/build/commands/web/web.js +25 -25
- package/build/commands/web/webCommand.js +3 -3
- package/build/types/command/commandBase.js +19 -15
- package/build/types/command/parse.js +1 -1
- package/build/types/command/spec/commandBase.spec.js +16 -12
- package/build/types/command/targetCommand.js +4 -4
- package/build/types/command/unalias.js +9 -5
- package/build/utils/auth.js +7 -7
- package/build/utils/config.js +53 -49
- package/build/utils/displayResult.js +4 -4
- package/build/utils/file.js +11 -11
- package/build/utils/fileStructures/builtFiles.js +2 -2
- package/build/utils/fileStructures/builtFilesCustom1.js +2 -2
- package/build/utils/getLogFilePath.js +2 -3
- package/build/utils/loadEnvVariables.js +3 -3
- package/build/utils/prefixAppLoc.js +1 -1
- package/build/utils/saveLog.js +7 -7
- package/build/utils/setConstants.js +4 -4
- package/build/utils/setProjectDir.js +2 -2
- package/build/utils/spec/config.spec.js +80 -80
- package/build/utils/spec/displayResult.spec.js +7 -7
- package/build/utils/spec/file.spec.js +15 -15
- package/build/utils/spec/removeComments.spec.js +11 -11
- package/build/utils/spec/setConstants.spec.js +3 -3
- package/build/utils/spec/utils.spec.js +55 -55
- package/build/utils/test.js +59 -59
- package/build/utils/utils.js +47 -43
- package/package.json +11 -11
|
@@ -43,7 +43,7 @@ describe('getContextName', function () {
|
|
|
43
43
|
var target;
|
|
44
44
|
return __generator(this, function (_a) {
|
|
45
45
|
target = { contextName: 'Test Context' };
|
|
46
|
-
expect(execute_1.getContextName(target)).toEqual('Test Context');
|
|
46
|
+
expect((0, execute_1.getContextName)(target)).toEqual('Test Context');
|
|
47
47
|
return [2 /*return*/];
|
|
48
48
|
});
|
|
49
49
|
}); });
|
|
@@ -51,7 +51,7 @@ describe('getContextName', function () {
|
|
|
51
51
|
var target;
|
|
52
52
|
return __generator(this, function (_a) {
|
|
53
53
|
target = { contextName: undefined };
|
|
54
|
-
expect(execute_1.getContextName(target)).toEqual(utils_1.contextName);
|
|
54
|
+
expect((0, execute_1.getContextName)(target)).toEqual(utils_1.contextName);
|
|
55
55
|
return [2 /*return*/];
|
|
56
56
|
});
|
|
57
57
|
}); });
|
|
@@ -78,16 +78,16 @@ describe('sasjs job execute', function () {
|
|
|
78
78
|
switch (_a.label) {
|
|
79
79
|
case 0:
|
|
80
80
|
target = generateTarget();
|
|
81
|
-
return [4 /*yield*/, test_1.createTestApp(__dirname, target.name)];
|
|
81
|
+
return [4 /*yield*/, (0, test_1.createTestApp)(__dirname, target.name)];
|
|
82
82
|
case 1:
|
|
83
83
|
_a.sent();
|
|
84
84
|
return [4 /*yield*/, copyJobsAndServices(target.name)];
|
|
85
85
|
case 2:
|
|
86
86
|
_a.sent();
|
|
87
|
-
return [4 /*yield*/, build_1.build(target)];
|
|
87
|
+
return [4 /*yield*/, (0, build_1.build)(target)];
|
|
88
88
|
case 3:
|
|
89
89
|
_a.sent();
|
|
90
|
-
return [4 /*yield*/, deploy_1.deploy(target, false)];
|
|
90
|
+
return [4 /*yield*/, (0, deploy_1.deploy)(target, false)];
|
|
91
91
|
case 4:
|
|
92
92
|
_a.sent();
|
|
93
93
|
sasjs = new node_1.default({
|
|
@@ -97,7 +97,7 @@ describe('sasjs job execute', function () {
|
|
|
97
97
|
serverType: target.serverType,
|
|
98
98
|
debug: true
|
|
99
99
|
});
|
|
100
|
-
return [4 /*yield*/, config_1.getAuthConfig(target)];
|
|
100
|
+
return [4 /*yield*/, (0, config_1.getAuthConfig)(target)];
|
|
101
101
|
case 5:
|
|
102
102
|
authConfig = _a.sent();
|
|
103
103
|
process.logger = new utils_1.Logger(utils_1.LogLevel.Off);
|
|
@@ -108,10 +108,10 @@ describe('sasjs job execute', function () {
|
|
|
108
108
|
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
109
109
|
return __generator(this, function (_a) {
|
|
110
110
|
switch (_a.label) {
|
|
111
|
-
case 0: return [4 /*yield*/, test_1.removeTestServerFolder("/Public/app/cli-tests/"
|
|
111
|
+
case 0: return [4 /*yield*/, (0, test_1.removeTestServerFolder)("/Public/app/cli-tests/".concat(target.name), target)];
|
|
112
112
|
case 1:
|
|
113
113
|
_a.sent();
|
|
114
|
-
return [4 /*yield*/, test_1.removeTestApp(__dirname, target.name)];
|
|
114
|
+
return [4 /*yield*/, (0, test_1.removeTestApp)(__dirname, target.name)];
|
|
115
115
|
case 2:
|
|
116
116
|
_a.sent();
|
|
117
117
|
return [2 /*return*/];
|
|
@@ -122,7 +122,7 @@ describe('sasjs job execute', function () {
|
|
|
122
122
|
return __generator(this, function (_a) {
|
|
123
123
|
switch (_a.label) {
|
|
124
124
|
case 0: return [4 /*yield*/, expect(executeWrapper({
|
|
125
|
-
jobPath: "/Public/app/cli-tests/"
|
|
125
|
+
jobPath: "/Public/app/cli-tests/".concat(target.name, "/services/testJob/job")
|
|
126
126
|
})).toResolve()];
|
|
127
127
|
case 1:
|
|
128
128
|
_a.sent();
|
|
@@ -134,7 +134,7 @@ describe('sasjs job execute', function () {
|
|
|
134
134
|
return __generator(this, function (_a) {
|
|
135
135
|
switch (_a.label) {
|
|
136
136
|
case 0: return [4 /*yield*/, expect(executeWrapper({
|
|
137
|
-
jobPath: "/Public/app/cli-tests/"
|
|
137
|
+
jobPath: "/Public/app/cli-tests/".concat(target.name, "/services/testJob/job"),
|
|
138
138
|
waitForJob: true
|
|
139
139
|
})).toResolve()];
|
|
140
140
|
case 1:
|
|
@@ -147,7 +147,7 @@ describe('sasjs job execute', function () {
|
|
|
147
147
|
return __generator(this, function (_a) {
|
|
148
148
|
switch (_a.label) {
|
|
149
149
|
case 0: return [4 /*yield*/, expect(executeWrapper({
|
|
150
|
-
jobPath: "/Public/app/cli-tests/"
|
|
150
|
+
jobPath: "/Public/app/cli-tests/".concat(target.name, "/jobs/testJob/job"),
|
|
151
151
|
waitForJob: true,
|
|
152
152
|
output: true
|
|
153
153
|
})).toResolve()];
|
|
@@ -165,15 +165,15 @@ describe('sasjs job execute', function () {
|
|
|
165
165
|
folderPath = path_1.default.join(process.projectDir, 'testOutput');
|
|
166
166
|
filePath = path_1.default.join(process.projectDir, 'testOutput/output.json');
|
|
167
167
|
return [4 /*yield*/, expect(executeWrapper({
|
|
168
|
-
jobPath: "/Public/app/cli-tests/"
|
|
168
|
+
jobPath: "/Public/app/cli-tests/".concat(target.name, "/jobs/testJob/job"),
|
|
169
169
|
output: 'testOutput'
|
|
170
170
|
})).toResolve()];
|
|
171
171
|
case 1:
|
|
172
172
|
_a.sent();
|
|
173
|
-
return [4 /*yield*/, expect(utils_1.folderExists(folderPath)).resolves.toEqual(true)];
|
|
173
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(folderPath)).resolves.toEqual(true)];
|
|
174
174
|
case 2:
|
|
175
175
|
_a.sent();
|
|
176
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePath)).resolves.toEqual(true)];
|
|
176
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePath)).resolves.toEqual(true)];
|
|
177
177
|
case 3:
|
|
178
178
|
_a.sent();
|
|
179
179
|
return [2 /*return*/];
|
|
@@ -188,16 +188,16 @@ describe('sasjs job execute', function () {
|
|
|
188
188
|
folderPath = path_1.default.join(process.projectDir, 'testOutput');
|
|
189
189
|
filePath = path_1.default.join(process.projectDir, 'testOutput/output.json');
|
|
190
190
|
return [4 /*yield*/, expect(executeWrapper({
|
|
191
|
-
jobPath: "/Public/app/cli-tests/"
|
|
191
|
+
jobPath: "/Public/app/cli-tests/".concat(target.name, "/jobs/testJob/job"),
|
|
192
192
|
waitForJob: true,
|
|
193
193
|
output: 'testOutput'
|
|
194
194
|
})).toResolve()];
|
|
195
195
|
case 1:
|
|
196
196
|
_a.sent();
|
|
197
|
-
return [4 /*yield*/, expect(utils_1.folderExists(folderPath)).resolves.toEqual(true)];
|
|
197
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(folderPath)).resolves.toEqual(true)];
|
|
198
198
|
case 2:
|
|
199
199
|
_a.sent();
|
|
200
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePath)).resolves.toEqual(true)];
|
|
200
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePath)).resolves.toEqual(true)];
|
|
201
201
|
case 3:
|
|
202
202
|
_a.sent();
|
|
203
203
|
return [2 /*return*/];
|
|
@@ -213,20 +213,20 @@ describe('sasjs job execute', function () {
|
|
|
213
213
|
filePathOutput = path_1.default.join(process.projectDir, 'testOutput/output.json');
|
|
214
214
|
filePathLog = path_1.default.join(process.projectDir, 'testLog.txt');
|
|
215
215
|
return [4 /*yield*/, expect(executeWrapper({
|
|
216
|
-
jobPath: "/Public/app/cli-tests/"
|
|
216
|
+
jobPath: "/Public/app/cli-tests/".concat(target.name, "/jobs/testJob/job"),
|
|
217
217
|
waitForJob: true,
|
|
218
218
|
output: 'testOutput',
|
|
219
219
|
logFile: path_1.default.join(process.projectDir, 'testLog.txt')
|
|
220
220
|
})).toResolve()];
|
|
221
221
|
case 1:
|
|
222
222
|
_a.sent();
|
|
223
|
-
return [4 /*yield*/, expect(utils_1.folderExists(folderPathOutput)).resolves.toEqual(true)];
|
|
223
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(folderPathOutput)).resolves.toEqual(true)];
|
|
224
224
|
case 2:
|
|
225
225
|
_a.sent();
|
|
226
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePathOutput)).resolves.toEqual(true)];
|
|
226
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePathOutput)).resolves.toEqual(true)];
|
|
227
227
|
case 3:
|
|
228
228
|
_a.sent();
|
|
229
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePathLog)).resolves.toEqual(true)];
|
|
229
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePathLog)).resolves.toEqual(true)];
|
|
230
230
|
case 4:
|
|
231
231
|
_a.sent();
|
|
232
232
|
return [2 /*return*/];
|
|
@@ -240,12 +240,12 @@ describe('sasjs job execute', function () {
|
|
|
240
240
|
case 0:
|
|
241
241
|
filePath = path_1.default.join(process.projectDir, 'job.log');
|
|
242
242
|
return [4 /*yield*/, expect(executeWrapper({
|
|
243
|
-
jobPath: "/Public/app/cli-tests/"
|
|
243
|
+
jobPath: "/Public/app/cli-tests/".concat(target.name, "/jobs/testJob/job"),
|
|
244
244
|
logFile: path_1.default.join(process.projectDir, 'job.log')
|
|
245
245
|
})).toResolve()];
|
|
246
246
|
case 1:
|
|
247
247
|
_a.sent();
|
|
248
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePath)).resolves.toEqual(true)];
|
|
248
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePath)).resolves.toEqual(true)];
|
|
249
249
|
case 2:
|
|
250
250
|
_a.sent();
|
|
251
251
|
return [2 /*return*/];
|
|
@@ -267,10 +267,10 @@ describe('sasjs job execute', function () {
|
|
|
267
267
|
})).toResolve()];
|
|
268
268
|
case 1:
|
|
269
269
|
_a.sent();
|
|
270
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePath)).resolves.toEqual(true)];
|
|
270
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePath)).resolves.toEqual(true)];
|
|
271
271
|
case 2:
|
|
272
272
|
_a.sent();
|
|
273
|
-
return [4 /*yield*/, utils_1.readFile(filePath)];
|
|
273
|
+
return [4 /*yield*/, (0, utils_1.readFile)(filePath)];
|
|
274
274
|
case 3:
|
|
275
275
|
logContent = _a.sent();
|
|
276
276
|
count = 0;
|
|
@@ -296,7 +296,7 @@ describe('sasjs job execute', function () {
|
|
|
296
296
|
})).toResolve()];
|
|
297
297
|
case 1:
|
|
298
298
|
_a.sent();
|
|
299
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePath)).resolves.toEqual(true)];
|
|
299
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePath)).resolves.toEqual(true)];
|
|
300
300
|
case 2:
|
|
301
301
|
_a.sent();
|
|
302
302
|
return [2 /*return*/];
|
|
@@ -316,10 +316,10 @@ describe('sasjs job execute', function () {
|
|
|
316
316
|
})).toResolve()];
|
|
317
317
|
case 1:
|
|
318
318
|
_a.sent();
|
|
319
|
-
return [4 /*yield*/, expect(utils_1.folderExists(folderPath)).resolves.toEqual(true)];
|
|
319
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(folderPath)).resolves.toEqual(true)];
|
|
320
320
|
case 2:
|
|
321
321
|
_a.sent();
|
|
322
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePath)).resolves.toEqual(true)];
|
|
322
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePath)).resolves.toEqual(true)];
|
|
323
323
|
case 3:
|
|
324
324
|
_a.sent();
|
|
325
325
|
return [2 /*return*/];
|
|
@@ -341,16 +341,16 @@ describe('sasjs job execute', function () {
|
|
|
341
341
|
})).toResolve()];
|
|
342
342
|
case 1:
|
|
343
343
|
_a.sent();
|
|
344
|
-
return [4 /*yield*/, expect(utils_1.folderExists(folderPath)).resolves.toEqual(true)];
|
|
344
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(folderPath)).resolves.toEqual(true)];
|
|
345
345
|
case 2:
|
|
346
346
|
_a.sent();
|
|
347
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePath)).resolves.toEqual(true)];
|
|
347
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePath)).resolves.toEqual(true)];
|
|
348
348
|
case 3:
|
|
349
349
|
_a.sent();
|
|
350
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePathStatus)).resolves.toEqual(true)];
|
|
350
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePathStatus)).resolves.toEqual(true)];
|
|
351
351
|
case 4:
|
|
352
352
|
_a.sent();
|
|
353
|
-
return [4 /*yield*/, utils_1.readFile(filePathStatus)];
|
|
353
|
+
return [4 /*yield*/, (0, utils_1.readFile)(filePathStatus)];
|
|
354
354
|
case 5:
|
|
355
355
|
statusContent = _a.sent();
|
|
356
356
|
expect(statusContent).not.toEqual('');
|
|
@@ -368,20 +368,20 @@ describe('sasjs job execute', function () {
|
|
|
368
368
|
filePathStatus = path_1.default.join(process.projectDir, 'my/folder/status.txt');
|
|
369
369
|
jest.spyOn(process.logger, 'error');
|
|
370
370
|
return [4 /*yield*/, expect(executeWrapper({
|
|
371
|
-
jobPath: prefixAppLoc_1.prefixAppLoc(target.appLoc, 'job-not-present'),
|
|
371
|
+
jobPath: (0, prefixAppLoc_1.prefixAppLoc)(target.appLoc, 'job-not-present'),
|
|
372
372
|
waitForJob: true,
|
|
373
373
|
statusFile: path_1.default.join(process.projectDir, 'my/folder/status.txt')
|
|
374
374
|
})).resolves.toEqual('Error: Job was not found.')];
|
|
375
375
|
case 1:
|
|
376
376
|
_a.sent();
|
|
377
|
-
return [4 /*yield*/, expect(utils_1.folderExists(folderPath)).resolves.toEqual(true)];
|
|
377
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(folderPath)).resolves.toEqual(true)];
|
|
378
378
|
case 2:
|
|
379
379
|
_a.sent();
|
|
380
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePathStatus)).resolves.toEqual(true)];
|
|
380
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePathStatus)).resolves.toEqual(true)];
|
|
381
381
|
case 3:
|
|
382
382
|
_a.sent();
|
|
383
383
|
expect(process.logger.error).toHaveBeenNthCalledWith(1, "An error has occurred when executing a job.\n", 'Error: Job was not found.');
|
|
384
|
-
return [4 /*yield*/, utils_1.readFile(filePathStatus)];
|
|
384
|
+
return [4 /*yield*/, (0, utils_1.readFile)(filePathStatus)];
|
|
385
385
|
case 4:
|
|
386
386
|
statusContent = _a.sent();
|
|
387
387
|
expect(statusContent).not.toEqual('');
|
|
@@ -404,13 +404,13 @@ describe('sasjs job execute', function () {
|
|
|
404
404
|
})).toResolve()];
|
|
405
405
|
case 1:
|
|
406
406
|
_a.sent();
|
|
407
|
-
return [4 /*yield*/, expect(utils_1.folderExists(folderPath)).resolves.toEqual(true)];
|
|
407
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(folderPath)).resolves.toEqual(true)];
|
|
408
408
|
case 2:
|
|
409
409
|
_a.sent();
|
|
410
|
-
return [4 /*yield*/, expect(utils_1.fileExists(filePathStatus)).resolves.toEqual(true)];
|
|
410
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(filePathStatus)).resolves.toEqual(true)];
|
|
411
411
|
case 3:
|
|
412
412
|
_a.sent();
|
|
413
|
-
return [4 /*yield*/, utils_1.readFile(filePathStatus)];
|
|
413
|
+
return [4 /*yield*/, (0, utils_1.readFile)(filePathStatus)];
|
|
414
414
|
case 4:
|
|
415
415
|
statusContent = _a.sent();
|
|
416
416
|
expect(statusContent).not.toEqual('');
|
|
@@ -424,7 +424,7 @@ describe('sasjs job execute', function () {
|
|
|
424
424
|
return __generator(this, function (_a) {
|
|
425
425
|
switch (_a.label) {
|
|
426
426
|
case 0:
|
|
427
|
-
mockExit = test_1.mockProcessExit();
|
|
427
|
+
mockExit = (0, test_1.mockProcessExit)();
|
|
428
428
|
return [4 /*yield*/, expect(executeWrapper({
|
|
429
429
|
jobPath: 'jobs/testJob/job',
|
|
430
430
|
waitForJob: true,
|
|
@@ -442,7 +442,7 @@ describe('sasjs job execute', function () {
|
|
|
442
442
|
return __generator(this, function (_a) {
|
|
443
443
|
switch (_a.label) {
|
|
444
444
|
case 0:
|
|
445
|
-
mockExit = test_1.mockProcessExit();
|
|
445
|
+
mockExit = (0, test_1.mockProcessExit)();
|
|
446
446
|
return [4 /*yield*/, expect(executeWrapper({
|
|
447
447
|
jobPath: 'jobs/testJob/jobWithWarning',
|
|
448
448
|
waitForJob: true,
|
|
@@ -460,7 +460,7 @@ describe('sasjs job execute', function () {
|
|
|
460
460
|
return __generator(this, function (_a) {
|
|
461
461
|
switch (_a.label) {
|
|
462
462
|
case 0:
|
|
463
|
-
mockExit = test_1.mockProcessExit();
|
|
463
|
+
mockExit = (0, test_1.mockProcessExit)();
|
|
464
464
|
return [4 /*yield*/, expect(executeWrapper({
|
|
465
465
|
jobPath: 'jobs/testJob/jobWithWarning',
|
|
466
466
|
waitForJob: true,
|
|
@@ -479,7 +479,7 @@ describe('sasjs job execute', function () {
|
|
|
479
479
|
return __generator(this, function (_a) {
|
|
480
480
|
switch (_a.label) {
|
|
481
481
|
case 0:
|
|
482
|
-
mockExit = test_1.mockProcessExit();
|
|
482
|
+
mockExit = (0, test_1.mockProcessExit)();
|
|
483
483
|
return [4 /*yield*/, expect(executeWrapper({
|
|
484
484
|
jobPath: 'jobs/testJob/failingJob',
|
|
485
485
|
waitForJob: true,
|
|
@@ -489,14 +489,14 @@ describe('sasjs job execute', function () {
|
|
|
489
489
|
case 1:
|
|
490
490
|
_a.sent();
|
|
491
491
|
expect(mockExit).toHaveBeenCalledWith(2);
|
|
492
|
-
return [4 /*yield*/, expect(utils_1.folderExists(process.projectDir)).resolves.toEqual(true)];
|
|
492
|
+
return [4 /*yield*/, expect((0, utils_1.folderExists)(process.projectDir)).resolves.toEqual(true)];
|
|
493
493
|
case 2:
|
|
494
494
|
_a.sent();
|
|
495
495
|
logPath = path_1.default.join(process.projectDir, "failingJob.log");
|
|
496
|
-
return [4 /*yield*/, expect(utils_1.fileExists(logPath)).resolves.toEqual(true)];
|
|
496
|
+
return [4 /*yield*/, expect((0, utils_1.fileExists)(logPath)).resolves.toEqual(true)];
|
|
497
497
|
case 3:
|
|
498
498
|
_a.sent();
|
|
499
|
-
return [4 /*yield*/, utils_1.readFile(logPath)];
|
|
499
|
+
return [4 /*yield*/, (0, utils_1.readFile)(logPath)];
|
|
500
500
|
case 4:
|
|
501
501
|
logData = _a.sent();
|
|
502
502
|
expect(logData.match('ERROR: The %ABORT statement is not valid in open code.')).toBeTruthy();
|
|
@@ -510,7 +510,7 @@ describe('sasjs job execute', function () {
|
|
|
510
510
|
return __generator(this, function (_a) {
|
|
511
511
|
switch (_a.label) {
|
|
512
512
|
case 0:
|
|
513
|
-
mockExit = test_1.mockProcessExit();
|
|
513
|
+
mockExit = (0, test_1.mockProcessExit)();
|
|
514
514
|
return [4 /*yield*/, expect(executeWrapper({
|
|
515
515
|
jobPath: 'jobs/testJob/failingJob_DOES_NOT_EXIST',
|
|
516
516
|
waitForJob: true,
|
|
@@ -534,7 +534,7 @@ describe('sasjs job execute', function () {
|
|
|
534
534
|
appLoc: target.appLoc,
|
|
535
535
|
serverType: target.serverType
|
|
536
536
|
});
|
|
537
|
-
mockExit = test_1.mockProcessExit();
|
|
537
|
+
mockExit = (0, test_1.mockProcessExit)();
|
|
538
538
|
errorMessage = "Could not get session state. Server responded with 304 whilst checking state: <sessionStateUrl>";
|
|
539
539
|
err = new node_1.NoSessionStateError(304, '<sessionStateUrl>', '');
|
|
540
540
|
jest.spyOn(process.logger, 'error');
|
|
@@ -549,7 +549,7 @@ describe('sasjs job execute', function () {
|
|
|
549
549
|
case 1:
|
|
550
550
|
_a.sent();
|
|
551
551
|
terminationCode = 2;
|
|
552
|
-
expect(process.logger.info).toHaveBeenCalledWith("Process will be terminated with the status code "
|
|
552
|
+
expect(process.logger.info).toHaveBeenCalledWith("Process will be terminated with the status code ".concat(terminationCode, "."));
|
|
553
553
|
expect(process.logger.error).toHaveBeenNthCalledWith(1, '', errorMessage);
|
|
554
554
|
expect(mockExit).toHaveBeenCalledWith(terminationCode);
|
|
555
555
|
return [2 /*return*/];
|
|
@@ -560,15 +560,15 @@ describe('sasjs job execute', function () {
|
|
|
560
560
|
var generateTarget = function (serverType) {
|
|
561
561
|
if (serverType === void 0) { serverType = utils_1.ServerType.SasViya; }
|
|
562
562
|
dotenv_1.default.config();
|
|
563
|
-
var timestamp = utils_1.generateTimestamp();
|
|
564
|
-
var targetName = "cli-tests-job-"
|
|
563
|
+
var timestamp = (0, utils_1.generateTimestamp)();
|
|
564
|
+
var targetName = "cli-tests-job-".concat(timestamp);
|
|
565
565
|
return new utils_1.Target({
|
|
566
566
|
name: targetName,
|
|
567
567
|
serverType: serverType,
|
|
568
568
|
serverUrl: (serverType === utils_1.ServerType.SasViya
|
|
569
569
|
? process.env.VIYA_SERVER_URL
|
|
570
570
|
: process.env.SAS9_SERVER_URL),
|
|
571
|
-
appLoc: "/Public/app/cli-tests/"
|
|
571
|
+
appLoc: "/Public/app/cli-tests/".concat(targetName),
|
|
572
572
|
contextName: utils_2.contextName,
|
|
573
573
|
serviceConfig: {
|
|
574
574
|
serviceFolders: ['sasjs/testServices', 'sasjs/testJob', 'sasjs/services'],
|
|
@@ -597,10 +597,10 @@ var generateTarget = function (serverType) {
|
|
|
597
597
|
var copyJobsAndServices = function (appName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
598
598
|
return __generator(this, function (_a) {
|
|
599
599
|
switch (_a.label) {
|
|
600
|
-
case 0: return [4 /*yield*/, utils_1.copy(path_1.default.join(__dirname, 'testJob'), path_1.default.join(__dirname, appName, 'sasjs', 'testJob'))];
|
|
600
|
+
case 0: return [4 /*yield*/, (0, utils_1.copy)(path_1.default.join(__dirname, 'testJob'), path_1.default.join(__dirname, appName, 'sasjs', 'testJob'))];
|
|
601
601
|
case 1:
|
|
602
602
|
_a.sent();
|
|
603
|
-
return [4 /*yield*/, utils_1.copy(path_1.default.join(__dirname, 'testServices'), path_1.default.join(__dirname, appName, 'sasjs', 'testServices'))];
|
|
603
|
+
return [4 /*yield*/, (0, utils_1.copy)(path_1.default.join(__dirname, 'testServices'), path_1.default.join(__dirname, appName, 'sasjs', 'testServices'))];
|
|
604
604
|
case 2:
|
|
605
605
|
_a.sent();
|
|
606
606
|
return [2 /*return*/];
|
|
@@ -611,7 +611,7 @@ var executeWrapper = function (_a) {
|
|
|
611
611
|
var _b = _a.adapter, adapter = _b === void 0 ? sasjs : _b, jobPath = _a.jobPath, _c = _a.waitForJob, waitForJob = _c === void 0 ? false : _c, _d = _a.output, output = _d === void 0 ? false : _d, _e = _a.logFile, logFile = _e === void 0 ? undefined : _e, _f = _a.statusFile, statusFile = _f === void 0 ? undefined : _f, _g = _a.returnStatusOnly, returnStatusOnly = _g === void 0 ? false : _g, _h = _a.ignoreWarnings, ignoreWarnings = _h === void 0 ? false : _h, _j = _a.source, source = _j === void 0 ? undefined : _j, _k = _a.streamLog, streamLog = _k === void 0 ? false : _k;
|
|
612
612
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
613
613
|
return __generator(this, function (_l) {
|
|
614
|
-
return [2 /*return*/, execute_1.executeJobViya(adapter, authConfig, jobPath, target, waitForJob, output, logFile, statusFile, returnStatusOnly, ignoreWarnings, source, streamLog)];
|
|
614
|
+
return [2 /*return*/, (0, execute_1.executeJobViya)(adapter, authConfig, jobPath, target, waitForJob, output, logFile, statusFile, returnStatusOnly, ignoreWarnings, source, streamLog)];
|
|
615
615
|
});
|
|
616
616
|
});
|
|
617
617
|
};
|
|
@@ -81,10 +81,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
81
81
|
}
|
|
82
82
|
return ar;
|
|
83
83
|
};
|
|
84
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
85
|
-
for (var i = 0,
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
85
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
86
|
+
if (ar || !(i in from)) {
|
|
87
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
88
|
+
ar[i] = from[i];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
88
92
|
};
|
|
89
93
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
90
94
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -105,7 +109,7 @@ var target = new utils_1.Target({
|
|
|
105
109
|
});
|
|
106
110
|
var authConfig = {};
|
|
107
111
|
var jobFileName = 'someJob';
|
|
108
|
-
var jobPath = "/Public/folder/"
|
|
112
|
+
var jobPath = "/Public/folder/".concat(jobFileName);
|
|
109
113
|
var log = './jobLog.log';
|
|
110
114
|
var output = './jobOutput.json';
|
|
111
115
|
var statusFile = './status/file.txt';
|
|
@@ -128,7 +132,7 @@ describe('JobCommand', function () {
|
|
|
128
132
|
case 0: return [4 /*yield*/, executeCommandWrapper([jobPath])];
|
|
129
133
|
case 1:
|
|
130
134
|
_b.sent();
|
|
131
|
-
(_a = expect(viyaExecuteModule.executeJobViya)).toHaveBeenCalledWith.apply(_a, __spreadArray([], __read(executeCalledWith({ jobPath: jobPath }))));
|
|
135
|
+
(_a = expect(viyaExecuteModule.executeJobViya)).toHaveBeenCalledWith.apply(_a, __spreadArray([], __read(executeCalledWith({ jobPath: jobPath })), false));
|
|
132
136
|
return [2 /*return*/];
|
|
133
137
|
}
|
|
134
138
|
});
|
|
@@ -144,7 +148,7 @@ describe('JobCommand', function () {
|
|
|
144
148
|
jobPath: jobPath,
|
|
145
149
|
waitForJob: true,
|
|
146
150
|
logFile: path_1.default.join(projectFolder, log)
|
|
147
|
-
}))));
|
|
151
|
+
})), false));
|
|
148
152
|
return [2 /*return*/];
|
|
149
153
|
}
|
|
150
154
|
});
|
|
@@ -159,8 +163,8 @@ describe('JobCommand', function () {
|
|
|
159
163
|
(_a = expect(viyaExecuteModule.executeJobViya)).toHaveBeenCalledWith.apply(_a, __spreadArray([], __read(executeCalledWith({
|
|
160
164
|
jobPath: jobPath,
|
|
161
165
|
waitForJob: true,
|
|
162
|
-
logFile: path_1.default.join(process.projectDir, jobFileName
|
|
163
|
-
}))));
|
|
166
|
+
logFile: path_1.default.join(process.projectDir, "".concat(jobFileName, ".log"))
|
|
167
|
+
})), false));
|
|
164
168
|
return [2 /*return*/];
|
|
165
169
|
}
|
|
166
170
|
});
|
|
@@ -176,7 +180,7 @@ describe('JobCommand', function () {
|
|
|
176
180
|
jobPath: jobPath,
|
|
177
181
|
waitForJob: true,
|
|
178
182
|
returnStatusOnly: true
|
|
179
|
-
}))));
|
|
183
|
+
})), false));
|
|
180
184
|
return [2 /*return*/];
|
|
181
185
|
}
|
|
182
186
|
});
|
|
@@ -214,7 +218,7 @@ describe('JobCommand', function () {
|
|
|
214
218
|
ignoreWarnings: true,
|
|
215
219
|
source: source,
|
|
216
220
|
streamLog: true
|
|
217
|
-
}))));
|
|
221
|
+
})), false));
|
|
218
222
|
return [2 /*return*/];
|
|
219
223
|
}
|
|
220
224
|
});
|
|
@@ -252,7 +256,7 @@ describe('JobCommand', function () {
|
|
|
252
256
|
ignoreWarnings: true,
|
|
253
257
|
source: source,
|
|
254
258
|
streamLog: true
|
|
255
|
-
}))));
|
|
259
|
+
})), false));
|
|
256
260
|
return [2 /*return*/];
|
|
257
261
|
}
|
|
258
262
|
});
|
|
@@ -367,7 +371,7 @@ var executeCommandWrapper = function (additionalParams, checkTarget) {
|
|
|
367
371
|
switch (_a.label) {
|
|
368
372
|
case 0:
|
|
369
373
|
subCommand = 'execute';
|
|
370
|
-
args = __spreadArray(__spreadArray([], __read(defaultArgs)), __read(additionalParams)).map(function (arg) {
|
|
374
|
+
args = __spreadArray(__spreadArray([], __read(defaultArgs), false), __read(additionalParams), false).map(function (arg) {
|
|
371
375
|
if (arg === 'execute') {
|
|
372
376
|
arg = Math.random() > 0.5 ? 'exec' : arg;
|
|
373
377
|
subCommand = arg;
|
|
@@ -53,11 +53,11 @@ function initLint() {
|
|
|
53
53
|
switch (_a.label) {
|
|
54
54
|
case 0:
|
|
55
55
|
lintConfigPath = path_1.default.join(process.projectDir, '.sasjslint');
|
|
56
|
-
return [4 /*yield*/, utils_1.fileExists(lintConfigPath)];
|
|
56
|
+
return [4 /*yield*/, (0, utils_1.fileExists)(lintConfigPath)];
|
|
57
57
|
case 1:
|
|
58
58
|
if (!_a.sent()) return [3 /*break*/, 2];
|
|
59
59
|
return [2 /*return*/, { fileAlreadyExisted: true }];
|
|
60
|
-
case 2: return [4 /*yield*/, createLintConfigFile_1.createLintConfigFile('.')];
|
|
60
|
+
case 2: return [4 /*yield*/, (0, createLintConfigFile_1.createLintConfigFile)('.')];
|
|
61
61
|
case 3:
|
|
62
62
|
_a.sent();
|
|
63
63
|
_a.label = 4;
|
|
@@ -94,43 +94,43 @@ var LintCommand = /** @class */ (function (_super) {
|
|
|
94
94
|
case 0:
|
|
95
95
|
subCommand = this.parsed.subCommand;
|
|
96
96
|
if (!(subCommand === 'init')) return [3 /*break*/, 2];
|
|
97
|
-
return [4 /*yield*/, initLint_1.initLint()
|
|
97
|
+
return [4 /*yield*/, (0, initLint_1.initLint)()
|
|
98
98
|
.then(function (res) {
|
|
99
99
|
if (res.fileAlreadyExisted)
|
|
100
|
-
utils_1.displaySuccess('The lint configuration file `.sasjslint` is already present.');
|
|
100
|
+
(0, utils_1.displaySuccess)('The lint configuration file `.sasjslint` is already present.');
|
|
101
101
|
else
|
|
102
|
-
utils_1.displaySuccess('The lint configuration file `.sasjslint` has been created. You can now run `sasjs lint`.');
|
|
102
|
+
(0, utils_1.displaySuccess)('The lint configuration file `.sasjslint` has been created. You can now run `sasjs lint`.');
|
|
103
103
|
return command_1.ReturnCode.Success;
|
|
104
104
|
})
|
|
105
105
|
.catch(function (err) {
|
|
106
|
-
utils_1.displayError(err, 'An error has occurred whilst initialising SASjs Lint.');
|
|
106
|
+
(0, utils_1.displayError)(err, 'An error has occurred whilst initialising SASjs Lint.');
|
|
107
107
|
return command_1.ReturnCode.InternalError;
|
|
108
108
|
})];
|
|
109
109
|
case 1: return [2 /*return*/, _a.sent()];
|
|
110
110
|
case 2:
|
|
111
111
|
if (!(subCommand === 'fix')) return [3 /*break*/, 4];
|
|
112
|
-
return [4 /*yield*/, processLint_1.lintFix()
|
|
112
|
+
return [4 /*yield*/, (0, processLint_1.lintFix)()
|
|
113
113
|
.then(function () { return command_1.ReturnCode.Success; })
|
|
114
114
|
.catch(function (err) {
|
|
115
|
-
utils_1.displayError(err, 'An error has occurred while running SASjs Lint Fix.');
|
|
115
|
+
(0, utils_1.displayError)(err, 'An error has occurred while running SASjs Lint Fix.');
|
|
116
116
|
return command_1.ReturnCode.LintError;
|
|
117
117
|
})];
|
|
118
118
|
case 3: return [2 /*return*/, _a.sent()];
|
|
119
|
-
case 4: return [4 /*yield*/, processLint_1.processLint()
|
|
119
|
+
case 4: return [4 /*yield*/, (0, processLint_1.processLint)()
|
|
120
120
|
.then(function (result) {
|
|
121
121
|
if (result.errors) {
|
|
122
|
-
utils_1.displayError('Please fix the identified lint errors.');
|
|
122
|
+
(0, utils_1.displayError)('Please fix the identified lint errors.');
|
|
123
123
|
return command_1.ReturnCode.LintError;
|
|
124
124
|
}
|
|
125
125
|
if (result.warnings) {
|
|
126
126
|
process.logger.warn('Please fix the identified lint warnings.');
|
|
127
127
|
return command_1.ReturnCode.Success;
|
|
128
128
|
}
|
|
129
|
-
utils_1.displaySuccess('All matched files use @sasjs/lint code style!');
|
|
129
|
+
(0, utils_1.displaySuccess)('All matched files use @sasjs/lint code style!');
|
|
130
130
|
return command_1.ReturnCode.Success;
|
|
131
131
|
})
|
|
132
132
|
.catch(function (err) {
|
|
133
|
-
utils_1.displayError(err, 'An error has occurred when processing lint operation.');
|
|
133
|
+
(0, utils_1.displayError)(err, 'An error has occurred when processing lint operation.');
|
|
134
134
|
return command_1.ReturnCode.InternalError;
|
|
135
135
|
})];
|
|
136
136
|
case 5: return [2 /*return*/, _a.sent()];
|
|
@@ -50,9 +50,9 @@ function lintFix() {
|
|
|
50
50
|
return __awaiter(this, void 0, void 0, function () {
|
|
51
51
|
return __generator(this, function (_a) {
|
|
52
52
|
switch (_a.label) {
|
|
53
|
-
case 0: return [4 /*yield*/, lint_1.formatProject().then(function (result) {
|
|
53
|
+
case 0: return [4 /*yield*/, (0, lint_1.formatProject)().then(function (result) {
|
|
54
54
|
var _a, _b, _c;
|
|
55
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Resolved "
|
|
55
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Resolved ".concat(result.fixedDiagnosticsCount, " violations."));
|
|
56
56
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info('Updated files:');
|
|
57
57
|
result.updatedFilePaths.forEach(function (filePath) {
|
|
58
58
|
var _a;
|
|
@@ -82,7 +82,7 @@ function processLint() {
|
|
|
82
82
|
switch (_a.label) {
|
|
83
83
|
case 0:
|
|
84
84
|
found = { warnings: false, errors: false };
|
|
85
|
-
return [4 /*yield*/, lint_1.lintProject()];
|
|
85
|
+
return [4 /*yield*/, (0, lint_1.lintProject)()];
|
|
86
86
|
case 1:
|
|
87
87
|
sasjsDiagnosticsMap = _a.sent();
|
|
88
88
|
sasjsDiagnosticsMap.forEach(function (sasjsDiagnostics, filePath) {
|
|
@@ -109,7 +109,7 @@ exports.processLint = processLint;
|
|
|
109
109
|
*/
|
|
110
110
|
var displayDiagnostics = function (filePath, sasjsDiagnostics) {
|
|
111
111
|
var _a, _b;
|
|
112
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("File: "
|
|
112
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("File: ".concat(filePath));
|
|
113
113
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.table(sasjsDiagnostics.map(function (d) {
|
|
114
114
|
var severity = d.severity === lint_1.Severity.Info
|
|
115
115
|
? chalk_1.default.cyan.bold('Info')
|
|
@@ -118,7 +118,7 @@ var displayDiagnostics = function (filePath, sasjsDiagnostics) {
|
|
|
118
118
|
: d.severity === lint_1.Severity.Error
|
|
119
119
|
? chalk_1.default.red.bold('Error')
|
|
120
120
|
: 'Unknown';
|
|
121
|
-
return [severity, d.message, "["
|
|
121
|
+
return [severity, d.message, "[".concat(d.lineNumber, ", ").concat(d.startColumnNumber, "]")];
|
|
122
122
|
})),
|
|
123
123
|
{
|
|
124
124
|
head: ['Severity', 'Message', '[Line #, Col #]']
|