@sasjs/cli 4.20.1 → 4.20.3
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 +11 -0
- package/build/cli.js +4 -5
- package/build/cli.spec.js +19 -9
- package/build/commands/add/addCommand.js +2 -2
- package/build/commands/add/addCredential.js +2 -2
- package/build/commands/add/addTarget.js +13 -14
- package/build/commands/add/internal/input.js +14 -14
- package/build/commands/add/internal/saveConfig.js +3 -4
- package/build/commands/add/spec/addCommand.spec.js +19 -9
- package/build/commands/add/spec/addCredential.spec.js +19 -9
- package/build/commands/add/spec/addTarget.spec.js +19 -9
- package/build/commands/auth/authCommand.js +8 -8
- package/build/commands/auth/login.js +40 -14
- package/build/commands/auth/spec/authCommand.spec.js +19 -9
- package/build/commands/auth/spec/login.spec.js +19 -9
- package/build/commands/build/build.js +25 -26
- package/build/commands/build/buildCommand.js +2 -2
- package/build/commands/build/compileBuildCommand.js +3 -3
- package/build/commands/build/internal/config.js +2 -2
- package/build/commands/build/spec/build.spec.js +2 -2
- package/build/commands/build/spec/buildCommand.spec.js +19 -9
- package/build/commands/build/spec/cb.spec.server.viya.js +2 -2
- package/build/commands/build/spec/compileBuildCommand.spec.js +19 -9
- package/build/commands/compile/compile.js +29 -20
- package/build/commands/compile/compileCommand.js +2 -2
- package/build/commands/compile/compileSingleFile.js +15 -15
- package/build/commands/compile/internal/checkCompileStatus.js +3 -4
- package/build/commands/compile/internal/compareFolders.js +2 -2
- package/build/commands/compile/internal/compileFile.js +6 -7
- package/build/commands/compile/internal/compileTestFile.js +17 -13
- package/build/commands/compile/internal/copySyncFolder.js +2 -2
- package/build/commands/compile/internal/getAllFolders.js +3 -3
- package/build/commands/compile/internal/identifySasFile.js +2 -2
- package/build/commands/compile/internal/loadDependencies.js +10 -10
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +2 -2
- package/build/commands/compile/internal/spec/getAllFolders.spec.js +19 -9
- package/build/commands/compile/spec/compareFolders.spec.js +3 -3
- package/build/commands/compile/spec/compile.spec.js +19 -9
- package/build/commands/compile/spec/compileCommand.spec.js +19 -9
- package/build/commands/compile/spec/compileFile.spec.js +19 -9
- package/build/commands/compile/spec/compileSingleFile.spec.js +19 -9
- package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +20 -10
- package/build/commands/compile/spec/loadDependencies.spec.js +19 -9
- package/build/commands/context/contextCommand.js +3 -3
- package/build/commands/context/create.js +4 -5
- package/build/commands/context/delete.js +4 -5
- package/build/commands/context/edit.js +4 -5
- package/build/commands/context/export.js +4 -5
- package/build/commands/context/internal/parseConfig.js +1 -2
- package/build/commands/context/internal/validateConfigPath.js +3 -4
- package/build/commands/context/list.js +4 -5
- package/build/commands/context/spec/contextCommand.spec.js +19 -9
- package/build/commands/context/spec/create.spec.js +2 -2
- package/build/commands/context/spec/delete.spec.js +2 -2
- package/build/commands/context/spec/edit.spec.js +2 -2
- package/build/commands/context/spec/export.spec.js +19 -9
- package/build/commands/context/spec/list.spec.js +2 -2
- package/build/commands/create/create.js +4 -5
- package/build/commands/create/createCommand.js +2 -2
- package/build/commands/create/createTemplate.js +1 -1
- package/build/commands/create/internal/createReadme.js +3 -4
- package/build/commands/create/spec/create.spec.js +2 -2
- package/build/commands/create/spec/createCommand.spec.js +19 -9
- package/build/commands/db/db.js +8 -9
- package/build/commands/db/dbCommand.js +2 -2
- package/build/commands/db/spec/db.spec.js +2 -2
- package/build/commands/db/spec/dbCommand.spec.js +19 -9
- package/build/commands/deploy/compileBuildDeployCommand.js +8 -8
- package/build/commands/deploy/deploy.js +4 -5
- package/build/commands/deploy/deployCommand.js +2 -2
- package/build/commands/deploy/internal/deployToSASJSWithServicePack.js +11 -12
- package/build/commands/deploy/internal/executeDeployScript.js +3 -4
- package/build/commands/deploy/internal/executeDeployScriptSas9.js +10 -11
- package/build/commands/deploy/internal/executeDeployScriptSasViya.js +11 -12
- package/build/commands/deploy/internal/executeDeployScriptSasjs.js +12 -13
- package/build/commands/deploy/internal/executeNonSasScript.js +4 -5
- package/build/commands/deploy/internal/executeSasScript.js +5 -6
- package/build/commands/deploy/internal/getDeployScripts.js +4 -5
- package/build/commands/deploy/spec/cbd.spec.js +19 -9
- package/build/commands/deploy/spec/cbd.spec.server.viya.js +19 -9
- package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +19 -9
- package/build/commands/deploy/spec/deploy.spec.js +19 -9
- package/build/commands/deploy/spec/deployCommand.spec.js +19 -9
- package/build/commands/deploy/spec/getDeployScripts.spec.js +2 -2
- package/build/commands/deploy/spec/utils.js +41 -8
- package/build/commands/docs/docsCommand.js +2 -2
- package/build/commands/docs/generateDocs.js +11 -12
- package/build/commands/docs/generateDot.js +3 -4
- package/build/commands/docs/initDocs.js +3 -4
- package/build/commands/docs/internal/createDotFiles.js +4 -5
- package/build/commands/docs/internal/getDocConfig.d.ts +8 -8
- package/build/commands/docs/internal/getDocConfig.js +1 -2
- package/build/commands/docs/internal/getDotFileContent.js +3 -4
- package/build/commands/docs/internal/getFileInputs.js +1 -2
- package/build/commands/docs/internal/getFileOutputs.js +1 -2
- package/build/commands/docs/internal/getFoldersForDocs.js +1 -2
- package/build/commands/docs/internal/populateNodeDictionary.js +1 -2
- package/build/commands/docs/internal/populateParamNodeTypes.js +21 -22
- package/build/commands/docs/spec/docsCommand.spec.js +19 -9
- package/build/commands/docs/spec/generateDocs.spec.js +2 -2
- package/build/commands/docs/spec/generateDot.spec.js +2 -2
- package/build/commands/docs/spec/getDocConfig.spec.js +2 -2
- package/build/commands/docs/spec/initDocs.spec.js +2 -2
- package/build/commands/flow/execute.js +6 -7
- package/build/commands/flow/flowCommand.js +2 -2
- package/build/commands/flow/internal/executeFlow.js +2 -2
- package/build/commands/flow/internal/saveLog.js +34 -5
- package/build/commands/flow/internal/saveToCsv.js +2 -2
- package/build/commands/flow/internal/spec/executeFlow.spec.js +19 -9
- package/build/commands/flow/internal/spec/saveToCsv.spec.js +2 -2
- package/build/commands/flow/internal/spec/validateParams.spec.js +19 -9
- package/build/commands/flow/internal/validateParams.d.ts +4 -4
- package/build/commands/flow/internal/validateParams.js +2 -2
- package/build/commands/flow/spec/flow.spec.js +19 -9
- package/build/commands/flow/spec/flow.spec.server.viya.js +2 -2
- package/build/commands/flow/spec/flowCommand.spec.js +19 -9
- package/build/commands/folder/create.js +2 -2
- package/build/commands/folder/delete.js +2 -2
- package/build/commands/folder/folderCommand.js +13 -13
- package/build/commands/folder/list.js +2 -2
- package/build/commands/folder/move.js +2 -2
- package/build/commands/folder/spec/folder.spec.server.viya.js +2 -2
- package/build/commands/folder/spec/folderCommand.spec.js +19 -9
- package/build/commands/fs/fsCommand.js +34 -36
- package/build/commands/fs/internal/executeCode.js +2 -2
- package/build/commands/fs/spec/executeCode.spec.js +19 -9
- package/build/commands/fs/spec/fsCommand.spec.js +19 -9
- package/build/commands/help/help.js +3 -4
- package/build/commands/help/helpCommand.js +2 -2
- package/build/commands/help/spec/help.spec.js +2 -2
- package/build/commands/help/spec/helpCommand.spec.js +19 -9
- package/build/commands/index.js +1 -1
- package/build/commands/init/init.js +5 -5
- package/build/commands/init/initCommand.js +2 -2
- package/build/commands/init/spec/init.spec.js +2 -2
- package/build/commands/init/spec/initCommand.spec.js +19 -9
- package/build/commands/job/internal/execute/sas9.js +3 -4
- package/build/commands/job/internal/execute/sasjs.js +4 -5
- package/build/commands/job/internal/execute/viya.js +9 -10
- package/build/commands/job/internal/utils.js +2 -2
- package/build/commands/job/jobCommand.js +19 -19
- package/build/commands/job/spec/execute.spec.js +19 -9
- package/build/commands/job/spec/getContextName.spec.js +2 -2
- package/build/commands/job/spec/job.spec.server.viya.js +24 -16
- package/build/commands/job/spec/jobCommand.spec.js +19 -9
- package/build/commands/lint/initLint.js +3 -4
- package/build/commands/lint/lintCommand.js +2 -2
- package/build/commands/lint/processLint.js +13 -14
- package/build/commands/lint/spec/lintCommand.spec.js +19 -9
- package/build/commands/request/request.js +3 -4
- package/build/commands/request/requestCommand.js +2 -2
- package/build/commands/request/spec/request.spec.server.sas9.js +19 -9
- package/build/commands/request/spec/request.spec.server.viya.js +19 -9
- package/build/commands/request/spec/requestCommand.spec.js +19 -9
- package/build/commands/request/spec/utils.js +2 -2
- package/build/commands/run/run.js +29 -30
- package/build/commands/run/runCommand.js +2 -2
- package/build/commands/run/spec/run.spec.js +19 -9
- package/build/commands/run/spec/run.spec.server.sas9.js +2 -2
- package/build/commands/run/spec/run.spec.server.sasjs.js +2 -2
- package/build/commands/run/spec/run.spec.server.viya.js +4 -4
- package/build/commands/run/spec/runCommand.spec.js +19 -9
- package/build/commands/servicepack/deploy.js +7 -8
- package/build/commands/servicepack/servicePackCommand.js +7 -7
- package/build/commands/servicepack/spec/servicepack.spec.server.viya.js +2 -2
- package/build/commands/servicepack/spec/servicepackCommand.spec.js +19 -9
- package/build/commands/shared/createConfigFile.js +2 -2
- package/build/commands/shared/createFileStructure.js +2 -2
- package/build/commands/shared/createLintConfigFile.js +2 -2
- package/build/commands/shared/deployToSasViyaWithServicePack.js +6 -7
- package/build/commands/shared/fetchLogFileContent.js +2 -2
- package/build/commands/shared/spec/deployToSasViyaWithServicePack.spec.js +19 -9
- package/build/commands/snippets/snippets.js +3 -4
- package/build/commands/snippets/snippetsCommand.js +2 -2
- package/build/commands/snippets/spec/snippets.spec.js +2 -2
- package/build/commands/snippets/spec/snippetsCommand.spec.js +19 -9
- package/build/commands/testing/internal/saveOutput.js +23 -15
- package/build/commands/testing/spec/testCommand.spec.js +19 -9
- package/build/commands/testing/spec/testing.spec.js +19 -9
- package/build/commands/testing/test.js +14 -14
- package/build/commands/testing/testCommand.js +2 -2
- package/build/commands/version/spec/version.spec.js +2 -2
- package/build/commands/version/spec/versionCommand.spec.js +19 -9
- package/build/commands/version/version.js +4 -5
- package/build/commands/version/versionCommand.js +2 -2
- package/build/commands/web/internal/createAssetServices.js +39 -41
- package/build/commands/web/internal/sas9/createClickMeService.js +2 -2
- package/build/commands/web/internal/sas9/generateAssetService.js +2 -2
- package/build/commands/web/internal/sas9/getWebServiceContent.js +34 -5
- package/build/commands/web/internal/sasViya/createClickMeFile.js +2 -2
- package/build/commands/web/internal/spec/updateSasjstag.spec.js +2 -2
- package/build/commands/web/internal/spec/updateScriptTag.spec.js +2 -2
- package/build/commands/web/internal/spec/updateStyleTag.spec.js +2 -2
- package/build/commands/web/internal/updateAllTags.js +86 -88
- package/build/commands/web/internal/updateLinkTag.d.ts +1 -1
- package/build/commands/web/internal/updateScriptTag.js +2 -2
- package/build/commands/web/internal/updateStyleTag.js +2 -2
- package/build/commands/web/spec/web.spec.js +2 -2
- package/build/commands/web/spec/webCommand.spec.js +19 -9
- package/build/commands/web/web.js +10 -11
- package/build/commands/web/webCommand.js +2 -2
- package/build/types/command/commandAliases.d.ts +1 -1
- package/build/types/command/commandBase.js +2 -2
- package/build/types/command/commandFactory.d.ts +1 -1
- package/build/types/command/returnCode.js +1 -1
- package/build/types/command/spec/commandBase.spec.js +2 -2
- package/build/types/command/spec/targetCommand.spec.js +19 -9
- package/build/types/command/targetCommand.js +2 -2
- package/build/types/flow.js +1 -1
- package/build/types/targetScope.js +1 -1
- package/build/types/testing.js +3 -3
- package/build/utils/auth.js +8 -8
- package/build/utils/compressAndSave.js +11 -6
- package/build/utils/config.js +82 -84
- package/build/utils/displayResult.js +2 -3
- package/build/utils/file.js +13 -13
- package/build/utils/loadEnvVariables.js +4 -5
- package/build/utils/parseSourceFile.js +3 -4
- package/build/utils/saveLog.js +34 -5
- package/build/utils/setConstants.js +34 -5
- package/build/utils/setProjectDir.js +2 -2
- package/build/utils/spec/auth.spec.js +2 -2
- package/build/utils/spec/config.spec.js +19 -9
- package/build/utils/spec/file.spec.js +2 -2
- package/build/utils/spec/saveLog.spec.js +2 -2
- package/build/utils/spec/setConstants.spec.js +20 -10
- package/build/utils/spec/utils.spec.js +2 -2
- package/build/utils/spec/zip.spec.d.ts +1 -0
- package/build/utils/spec/zip.spec.js +282 -0
- package/build/utils/test.d.ts +2 -3
- package/build/utils/test.js +103 -40
- package/build/utils/utils.js +102 -78
- package/build/utils/zip.d.ts +20 -0
- package/build/utils/zip.js +277 -0
- package/package.json +37 -34
package/README.md
CHANGED
|
@@ -53,6 +53,17 @@ Running `npm i -g @sasjs/cli@latest` does not always upgrade properly. This is d
|
|
|
53
53
|
|
|
54
54
|
If you are running NPM in version 6 or below, you can try running `npm update -g @sasjs/cli` instead, or - the sledgehammer approach - delete the files from the NPM folder and then do a fresh install.
|
|
55
55
|
|
|
56
|
+
## Contributing
|
|
57
|
+
|
|
58
|
+
1. Clone the repo and install dependencies (`npm install`).
|
|
59
|
+
2. One-time setup: point git at this repo's hooks directory:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
git config core.hooksPath ./.git-hooks
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This enables the pre-commit checks (gitleaks secret scan, 2MB commit size limit). This step is required because the repo's `.npmrc` sets `ignore-scripts=true`, so the `prepare` script that would configure the hooks path automatically never runs on install. If you skip it, your commits are not scanned for secrets and you may push them that way.
|
|
66
|
+
|
|
56
67
|
## Star Gazing
|
|
57
68
|
|
|
58
69
|
If you find this library useful, please leave a star and help us grow our star graph!
|
package/build/cli.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.cli = cli;
|
|
40
|
+
exports.instantiateLogger = instantiateLogger;
|
|
40
41
|
var logger_1 = require("@sasjs/utils/logger");
|
|
41
42
|
var utils_1 = require("./utils");
|
|
42
43
|
var parse_1 = require("./types/command/parse");
|
|
@@ -64,7 +65,6 @@ function cli(args) {
|
|
|
64
65
|
});
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
|
-
exports.cli = cli;
|
|
68
68
|
function instantiateLogger() {
|
|
69
69
|
return __awaiter(this, void 0, void 0, function () {
|
|
70
70
|
var logLevel, logger;
|
|
@@ -76,4 +76,3 @@ function instantiateLogger() {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
exports.instantiateLogger = instantiateLogger;
|
package/build/cli.spec.js
CHANGED
|
@@ -30,13 +30,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
30
30
|
}) : function(o, v) {
|
|
31
31
|
o["default"] = v;
|
|
32
32
|
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
40
50
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
51
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
52
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -47,8 +57,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
47
57
|
});
|
|
48
58
|
};
|
|
49
59
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
-
return g =
|
|
60
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
61
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
62
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
63
|
function step(op) {
|
|
54
64
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -24,8 +24,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g =
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
29
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
30
|
function step(op) {
|
|
31
31
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.addTarget =
|
|
50
|
+
exports.addTarget = addTarget;
|
|
51
51
|
var types_1 = require("@sasjs/utils/types");
|
|
52
52
|
var targetScope_1 = require("../../types/targetScope");
|
|
53
53
|
var input_1 = require("./internal/input");
|
|
@@ -59,25 +59,25 @@ var utils_1 = require("../../utils");
|
|
|
59
59
|
* @param {boolean} insecure- boolean to use insecure connection, default is false. lf true the server will not reject any connection which is not authorized with the list of supplied CAs
|
|
60
60
|
*/
|
|
61
61
|
function addTarget(insecure) {
|
|
62
|
-
var _a, _b, _c;
|
|
63
62
|
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
var
|
|
63
|
+
var _a, scope, serverType, name, appLoc, serverUrl, existingTarget, targetJson, target, filePath, _b, _c, serverName, repositoryName, userName, password, _d, contextName, updatedViyaTarget, updatedSasjsTarget, isDefault;
|
|
64
|
+
var _e, _f, _g;
|
|
65
65
|
return __generator(this, function (_h) {
|
|
66
66
|
switch (_h.label) {
|
|
67
67
|
case 0:
|
|
68
68
|
if (insecure)
|
|
69
|
-
(
|
|
69
|
+
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.warn('Executing with insecure connection.');
|
|
70
70
|
return [4 /*yield*/, (0, input_1.getCommonFields)()];
|
|
71
71
|
case 1:
|
|
72
|
-
|
|
72
|
+
_a = _h.sent(), scope = _a.scope, serverType = _a.serverType, name = _a.name, appLoc = _a.appLoc, serverUrl = _a.serverUrl, existingTarget = _a.existingTarget;
|
|
73
73
|
targetJson = __assign(__assign({}, existingTarget), { name: name, serverType: serverType, serverUrl: serverUrl, appLoc: appLoc });
|
|
74
74
|
target = new types_1.Target(targetJson);
|
|
75
75
|
return [4 /*yield*/, (0, saveConfig_1.saveConfig)(scope, target, false, false)];
|
|
76
76
|
case 2:
|
|
77
77
|
filePath = _h.sent();
|
|
78
|
-
(
|
|
79
|
-
|
|
80
|
-
switch (
|
|
78
|
+
(_f = process.logger) === null || _f === void 0 ? void 0 : _f.info("Target configuration has been saved to ".concat(filePath, " ."));
|
|
79
|
+
_b = serverType;
|
|
80
|
+
switch (_b) {
|
|
81
81
|
case types_1.ServerType.Sas9: return [3 /*break*/, 3];
|
|
82
82
|
case types_1.ServerType.SasViya: return [3 /*break*/, 5];
|
|
83
83
|
case types_1.ServerType.Sasjs: return [3 /*break*/, 7];
|
|
@@ -85,7 +85,7 @@ function addTarget(insecure) {
|
|
|
85
85
|
return [3 /*break*/, 11];
|
|
86
86
|
case 3: return [4 /*yield*/, (0, input_1.getAndValidateSas9Fields)(target, scope)];
|
|
87
87
|
case 4:
|
|
88
|
-
|
|
88
|
+
_c = _h.sent(), serverName = _c.serverName, repositoryName = _c.repositoryName, userName = _c.userName, password = _c.password;
|
|
89
89
|
targetJson = __assign(__assign({}, targetJson), { serverName: serverName, repositoryName: repositoryName });
|
|
90
90
|
if (scope === targetScope_1.TargetScope.Local) {
|
|
91
91
|
(0, addCredential_1.createEnvFileForSas9)(name, userName, password);
|
|
@@ -96,7 +96,7 @@ function addTarget(insecure) {
|
|
|
96
96
|
return [3 /*break*/, 12];
|
|
97
97
|
case 5: return [4 /*yield*/, (0, input_1.getAndValidateSasViyaFields)(target, scope, serverUrl, insecure, addCredential_1.addCredential)];
|
|
98
98
|
case 6:
|
|
99
|
-
|
|
99
|
+
_d = _h.sent(), contextName = _d.contextName, updatedViyaTarget = _d.target;
|
|
100
100
|
targetJson = {
|
|
101
101
|
contextName: contextName
|
|
102
102
|
};
|
|
@@ -118,10 +118,9 @@ function addTarget(insecure) {
|
|
|
118
118
|
return [4 /*yield*/, (0, saveConfig_1.saveConfig)(scope, new types_1.Target(targetJson), isDefault, false)];
|
|
119
119
|
case 14:
|
|
120
120
|
filePath = _h.sent();
|
|
121
|
-
(
|
|
121
|
+
(_g = process.logger) === null || _g === void 0 ? void 0 : _g.info("Target configuration has been saved to ".concat(filePath));
|
|
122
122
|
return [2 /*return*/, true];
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
exports.addTarget = addTarget;
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -50,7 +50,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.getIsDefault = exports.getDefaultValues = exports.getCredentialsInputSas9 = exports.getCredentialsInputSasjs = exports.getCredentialsInputForViya = exports.
|
|
53
|
+
exports.getIsDefault = exports.getDefaultValues = exports.getCredentialsInputSas9 = exports.getCredentialsInputSasjs = exports.getCredentialsInputForViya = exports.shouldAuthenticate = void 0;
|
|
54
|
+
exports.getCommonFields = getCommonFields;
|
|
55
|
+
exports.getAndValidateServerUrl = getAndValidateServerUrl;
|
|
56
|
+
exports.getAndValidateSas9Fields = getAndValidateSas9Fields;
|
|
57
|
+
exports.getAndValidateSasViyaFields = getAndValidateSasViyaFields;
|
|
58
|
+
exports.getAndValidateSasjsFields = getAndValidateSasjsFields;
|
|
54
59
|
var input_1 = require("@sasjs/utils/input");
|
|
55
60
|
var types_1 = require("@sasjs/utils/types");
|
|
56
61
|
var utils_1 = require("@sasjs/utils");
|
|
@@ -59,9 +64,9 @@ var dotenv_1 = __importDefault(require("dotenv"));
|
|
|
59
64
|
var targetScope_1 = require("../../../types/targetScope");
|
|
60
65
|
var utils_2 = require("../../../utils");
|
|
61
66
|
function getCommonFields() {
|
|
62
|
-
var _a;
|
|
63
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
var scope, serverType, name,
|
|
68
|
+
var scope, serverType, name, _a, existingTarget, retry, appLoc, serverUrl;
|
|
69
|
+
var _b;
|
|
65
70
|
return __generator(this, function (_c) {
|
|
66
71
|
switch (_c.label) {
|
|
67
72
|
case 0: return [4 /*yield*/, getAndValidateScope()];
|
|
@@ -75,13 +80,13 @@ function getCommonFields() {
|
|
|
75
80
|
name = _c.sent();
|
|
76
81
|
return [4 /*yield*/, getAndValidateUpdateExisting(scope, name)];
|
|
77
82
|
case 4:
|
|
78
|
-
|
|
83
|
+
_a = _c.sent(), existingTarget = _a.targetJson, retry = _a.retry;
|
|
79
84
|
if (!retry) return [3 /*break*/, 6];
|
|
80
85
|
return [4 /*yield*/, getCommonFields()];
|
|
81
86
|
case 5: return [2 /*return*/, _c.sent()];
|
|
82
87
|
case 6:
|
|
83
88
|
if (existingTarget) {
|
|
84
|
-
(
|
|
89
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Updating current target '".concat(name, "'"));
|
|
85
90
|
}
|
|
86
91
|
return [4 /*yield*/, getAndValidateAppLoc(name, existingTarget)];
|
|
87
92
|
case 7:
|
|
@@ -101,7 +106,6 @@ function getCommonFields() {
|
|
|
101
106
|
});
|
|
102
107
|
});
|
|
103
108
|
}
|
|
104
|
-
exports.getCommonFields = getCommonFields;
|
|
105
109
|
function getAndValidateScope() {
|
|
106
110
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
111
|
var errorMessage, scope;
|
|
@@ -163,7 +167,6 @@ function getAndValidateServerUrl(target) {
|
|
|
163
167
|
});
|
|
164
168
|
});
|
|
165
169
|
}
|
|
166
|
-
exports.getAndValidateServerUrl = getAndValidateServerUrl;
|
|
167
170
|
function getAndValidateTargetName(serverType) {
|
|
168
171
|
return __awaiter(this, void 0, void 0, function () {
|
|
169
172
|
var validator, defaultName, targetName;
|
|
@@ -198,9 +201,9 @@ function getAndValidateTargetName(serverType) {
|
|
|
198
201
|
});
|
|
199
202
|
}
|
|
200
203
|
function getAndValidateUpdateExisting(targetScope, targetName) {
|
|
201
|
-
var _a;
|
|
202
204
|
return __awaiter(this, void 0, void 0, function () {
|
|
203
205
|
var targetJson, errorMessage_1, choice;
|
|
206
|
+
var _a;
|
|
204
207
|
return __generator(this, function (_b) {
|
|
205
208
|
switch (_b.label) {
|
|
206
209
|
case 0: return [4 /*yield*/, (0, utils_2.findTargetInConfiguration)(targetName, targetScope)
|
|
@@ -247,7 +250,6 @@ function getAndValidateSas9Fields(target, scope) {
|
|
|
247
250
|
});
|
|
248
251
|
});
|
|
249
252
|
}
|
|
250
|
-
exports.getAndValidateSas9Fields = getAndValidateSas9Fields;
|
|
251
253
|
var shouldAuthenticate = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
252
254
|
return [2 /*return*/, (0, input_1.getConfirmation)('Would you like to authenticate against this target?', true)];
|
|
253
255
|
}); }); };
|
|
@@ -300,7 +302,6 @@ function getAndValidateSasViyaFields(target, scope, serverUrl, insecure, authent
|
|
|
300
302
|
});
|
|
301
303
|
});
|
|
302
304
|
}
|
|
303
|
-
exports.getAndValidateSasViyaFields = getAndValidateSasViyaFields;
|
|
304
305
|
function getAndValidateSasjsFields(target, scope, insecure, authenticateCallback) {
|
|
305
306
|
return __awaiter(this, void 0, void 0, function () {
|
|
306
307
|
return __generator(this, function (_a) {
|
|
@@ -317,11 +318,10 @@ function getAndValidateSasjsFields(target, scope, insecure, authenticateCallback
|
|
|
317
318
|
});
|
|
318
319
|
});
|
|
319
320
|
}
|
|
320
|
-
exports.getAndValidateSasjsFields = getAndValidateSasjsFields;
|
|
321
321
|
function getAndValidateAppLoc(targetName, target) {
|
|
322
|
-
var _a;
|
|
323
322
|
return __awaiter(this, void 0, void 0, function () {
|
|
324
323
|
var errorMessage, appLoc;
|
|
324
|
+
var _a;
|
|
325
325
|
return __generator(this, function (_b) {
|
|
326
326
|
switch (_b.label) {
|
|
327
327
|
case 0:
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.saveConfig =
|
|
39
|
+
exports.saveConfig = saveConfig;
|
|
40
40
|
var types_1 = require("../../../types");
|
|
41
41
|
var utils_1 = require("../../../utils");
|
|
42
42
|
function saveConfig(scope, target, isDefault, saveWithDefaultValues) {
|
|
@@ -62,4 +62,3 @@ function saveConfig(scope, target, isDefault, saveWithDefaultValues) {
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
exports.saveConfig = saveConfig;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,8 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g =
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
47
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
48
|
function step(op) {
|
|
39
49
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,8 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g =
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
47
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
48
|
function step(op) {
|
|
39
49
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
26
26
|
}) : function(o, v) {
|
|
27
27
|
o["default"] = v;
|
|
28
28
|
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
36
46
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
47
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
48
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -43,8 +53,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
53
|
});
|
|
44
54
|
};
|
|
45
55
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g =
|
|
56
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
58
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
59
|
function step(op) {
|
|
50
60
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -24,8 +24,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g =
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
29
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
30
|
function step(op) {
|
|
31
31
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -151,9 +151,9 @@ var AuthCommand = /** @class */ (function (_super) {
|
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
153
|
AuthCommand.prototype.executeLogin = function () {
|
|
154
|
-
var _a;
|
|
155
154
|
return __awaiter(this, void 0, void 0, function () {
|
|
156
155
|
var target, err_1;
|
|
156
|
+
var _a;
|
|
157
157
|
return __generator(this, function (_b) {
|
|
158
158
|
switch (_b.label) {
|
|
159
159
|
case 0: return [4 /*yield*/, this.getTargetInfo()];
|
|
@@ -176,14 +176,14 @@ var AuthCommand = /** @class */ (function (_super) {
|
|
|
176
176
|
});
|
|
177
177
|
};
|
|
178
178
|
AuthCommand.prototype.executeCred = function () {
|
|
179
|
-
var _a, _b;
|
|
180
179
|
return __awaiter(this, void 0, void 0, function () {
|
|
181
|
-
var
|
|
180
|
+
var _a, target, isLocal, scope, err_2;
|
|
181
|
+
var _b, _c;
|
|
182
182
|
return __generator(this, function (_d) {
|
|
183
183
|
switch (_d.label) {
|
|
184
184
|
case 0: return [4 /*yield*/, this.getTargetInfo()];
|
|
185
185
|
case 1:
|
|
186
|
-
|
|
186
|
+
_a = _d.sent(), target = _a.target, isLocal = _a.isLocal;
|
|
187
187
|
scope = isLocal ? types_1.TargetScope.Local : types_1.TargetScope.Global;
|
|
188
188
|
_d.label = 2;
|
|
189
189
|
case 2:
|
|
@@ -191,11 +191,11 @@ var AuthCommand = /** @class */ (function (_super) {
|
|
|
191
191
|
return [4 /*yield*/, (0, addCredential_1.addCredential)(target, this.insecure, scope)];
|
|
192
192
|
case 3:
|
|
193
193
|
_d.sent();
|
|
194
|
-
(
|
|
194
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.success('Credentials successfully added!');
|
|
195
195
|
return [2 /*return*/, command_1.ReturnCode.Success];
|
|
196
196
|
case 4:
|
|
197
197
|
err_2 = _d.sent();
|
|
198
|
-
(
|
|
198
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.error('Error adding credentials.', err_2.toString());
|
|
199
199
|
return [2 /*return*/, command_1.ReturnCode.InternalError];
|
|
200
200
|
case 5: return [2 /*return*/];
|
|
201
201
|
}
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -53,6 +53,31 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
53
53
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
54
54
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
55
55
|
};
|
|
56
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
57
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
58
|
+
if (!m) return o;
|
|
59
|
+
var i = m.call(o), r, ar = [], e;
|
|
60
|
+
try {
|
|
61
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
62
|
+
}
|
|
63
|
+
catch (error) { e = { error: error }; }
|
|
64
|
+
finally {
|
|
65
|
+
try {
|
|
66
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
67
|
+
}
|
|
68
|
+
finally { if (e) throw e.error; }
|
|
69
|
+
}
|
|
70
|
+
return ar;
|
|
71
|
+
};
|
|
72
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
73
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
|
+
if (ar || !(i in from)) {
|
|
75
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
76
|
+
ar[i] = from[i];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
|
+
};
|
|
56
81
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
57
82
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
58
83
|
};
|
|
@@ -83,15 +108,12 @@ var readPasswordFromStdin = function () { return __awaiter(void 0, void 0, void
|
|
|
83
108
|
if (!(_c = _g.sent(), _d = _c.done, !_d)) return [3 /*break*/, 5];
|
|
84
109
|
_f = _c.value;
|
|
85
110
|
_a = false;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
data += chunk.toString();
|
|
89
|
-
}
|
|
90
|
-
finally {
|
|
91
|
-
_a = true;
|
|
92
|
-
}
|
|
111
|
+
chunk = _f;
|
|
112
|
+
data += chunk.toString();
|
|
93
113
|
_g.label = 4;
|
|
94
|
-
case 4:
|
|
114
|
+
case 4:
|
|
115
|
+
_a = true;
|
|
116
|
+
return [3 /*break*/, 2];
|
|
95
117
|
case 5: return [3 /*break*/, 12];
|
|
96
118
|
case 6:
|
|
97
119
|
e_1_1 = _g.sent();
|
|
@@ -147,12 +169,16 @@ var readPasswordFromStdin = function () { return __awaiter(void 0, void 0, void
|
|
|
147
169
|
* (like `docker login --password-stdin`) instead of prompting or reading
|
|
148
170
|
* the SAS_PASSWORD env var. The username must then come from SAS_USERNAME.
|
|
149
171
|
*/
|
|
150
|
-
var authLogin = function (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
172
|
+
var authLogin = function (target_1) {
|
|
173
|
+
var args_1 = [];
|
|
174
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
175
|
+
args_1[_i - 1] = arguments[_i];
|
|
176
|
+
}
|
|
177
|
+
return __awaiter(void 0, __spreadArray([target_1], __read(args_1), false), void 0, function (target, insecure, passwordStdin) {
|
|
154
178
|
var isTty, envUser, envPass, user, hint, pass, promptedPass, _a, access_token, refresh_token, _b, id, name;
|
|
155
179
|
var _c, _d, _e;
|
|
180
|
+
if (insecure === void 0) { insecure = false; }
|
|
181
|
+
if (passwordStdin === void 0) { passwordStdin = false; }
|
|
156
182
|
return __generator(this, function (_f) {
|
|
157
183
|
switch (_f.label) {
|
|
158
184
|
case 0:
|