@sasjs/cli 4.20.1 → 4.20.2
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/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 +2 -2
- 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/test.d.ts +2 -3
- package/build/utils/test.js +103 -40
- package/build/utils/utils.js +22 -22
- package/package.json +32 -32
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const commandFactory: Map<string, Function>;
|
|
2
|
-
export declare const getAllSupportedCommands: () =>
|
|
2
|
+
export declare const getAllSupportedCommands: () => MapIterator<string>;
|
|
@@ -7,4 +7,4 @@ var ReturnCode;
|
|
|
7
7
|
ReturnCode[ReturnCode["InvalidCommand"] = 1] = "InvalidCommand";
|
|
8
8
|
ReturnCode[ReturnCode["InternalError"] = 2] = "InternalError";
|
|
9
9
|
ReturnCode[ReturnCode["LintError"] = 3] = "LintError";
|
|
10
|
-
})(ReturnCode
|
|
10
|
+
})(ReturnCode || (exports.ReturnCode = ReturnCode = {}));
|
|
@@ -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.");
|
|
@@ -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.");
|
|
@@ -35,8 +35,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
-
return g =
|
|
38
|
+
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);
|
|
39
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
40
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
41
|
function step(op) {
|
|
42
42
|
if (f) throw new TypeError("Generator is already executing.");
|
package/build/types/flow.js
CHANGED
|
@@ -6,4 +6,4 @@ var FlowWaveJobStatus;
|
|
|
6
6
|
FlowWaveJobStatus["Runnning"] = "running";
|
|
7
7
|
FlowWaveJobStatus["Success"] = "success";
|
|
8
8
|
FlowWaveJobStatus["Failure"] = "failure";
|
|
9
|
-
})(FlowWaveJobStatus
|
|
9
|
+
})(FlowWaveJobStatus || (exports.FlowWaveJobStatus = FlowWaveJobStatus = {}));
|
package/build/types/testing.js
CHANGED
|
@@ -7,15 +7,15 @@ var CoverageType;
|
|
|
7
7
|
CoverageType["job"] = "job";
|
|
8
8
|
CoverageType["macro"] = "macro";
|
|
9
9
|
CoverageType["test"] = "test";
|
|
10
|
-
})(CoverageType
|
|
10
|
+
})(CoverageType || (exports.CoverageType = CoverageType = {}));
|
|
11
11
|
var CoverageState;
|
|
12
12
|
(function (CoverageState) {
|
|
13
13
|
CoverageState["notCovered"] = "not covered";
|
|
14
14
|
CoverageState["standalone"] = "standalone";
|
|
15
|
-
})(CoverageState
|
|
15
|
+
})(CoverageState || (exports.CoverageState = CoverageState = {}));
|
|
16
16
|
var TestResultStatus;
|
|
17
17
|
(function (TestResultStatus) {
|
|
18
18
|
TestResultStatus["pass"] = "PASS";
|
|
19
19
|
TestResultStatus["fail"] = "FAIL";
|
|
20
20
|
TestResultStatus["notProvided"] = "not provided";
|
|
21
|
-
})(TestResultStatus
|
|
21
|
+
})(TestResultStatus || (exports.TestResultStatus = TestResultStatus = {}));
|
package/build/utils/auth.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,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.SAS_CLI_CLIENT_ID = exports.getAuthUrl = void 0;
|
|
40
|
+
exports.getAuthCode = getAuthCode;
|
|
41
|
+
exports.refreshTokens = refreshTokens;
|
|
42
|
+
exports.getTokensWithPasswordGrant = getTokensWithPasswordGrant;
|
|
43
|
+
exports.fetchLoggedInUser = fetchLoggedInUser;
|
|
44
|
+
exports.getNewAccessToken = getNewAccessToken;
|
|
40
45
|
var utils_1 = require("@sasjs/utils");
|
|
41
46
|
var node_1 = require("@sasjs/adapter/node");
|
|
42
47
|
var getAuthUrl = function (serverType, serverUrl, clientId) {
|
|
@@ -64,7 +69,6 @@ function getAuthCode(authUrl) {
|
|
|
64
69
|
});
|
|
65
70
|
});
|
|
66
71
|
}
|
|
67
|
-
exports.getAuthCode = getAuthCode;
|
|
68
72
|
/**
|
|
69
73
|
* Exchanges a refresh token for a new access/refresh token pair.
|
|
70
74
|
* SAS Viya's refresh tokens are single-use and rotate on every call: the
|
|
@@ -86,7 +90,6 @@ function refreshTokens(sasjsInstance, clientId, clientSecret, refreshToken) {
|
|
|
86
90
|
});
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
|
-
exports.refreshTokens = refreshTokens;
|
|
90
93
|
/**
|
|
91
94
|
* The pre-registered, secret-less OAuth client that ships with every SAS Viya
|
|
92
95
|
* deployment (used by the official SAS Viya CLI). Allows authenticating with a
|
|
@@ -151,7 +154,6 @@ function getTokensWithPasswordGrant(target, user, pass) {
|
|
|
151
154
|
});
|
|
152
155
|
});
|
|
153
156
|
}
|
|
154
|
-
exports.getTokensWithPasswordGrant = getTokensWithPasswordGrant;
|
|
155
157
|
/**
|
|
156
158
|
* Verifies an access token by fetching the identity it belongs to.
|
|
157
159
|
* @param {Target} target - the SASVIYA target the token was minted for.
|
|
@@ -182,7 +184,6 @@ function fetchLoggedInUser(target, accessToken) {
|
|
|
182
184
|
});
|
|
183
185
|
});
|
|
184
186
|
}
|
|
185
|
-
exports.fetchLoggedInUser = fetchLoggedInUser;
|
|
186
187
|
function getNewAccessToken(sasjsInstance, clientId, clientSecret, target) {
|
|
187
188
|
return __awaiter(this, void 0, void 0, function () {
|
|
188
189
|
var authUrl, authCode, _a, access_token, refresh_token;
|
|
@@ -210,4 +211,3 @@ function getNewAccessToken(sasjsInstance, clientId, clientSecret, target) {
|
|
|
210
211
|
});
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
|
-
exports.getNewAccessToken = getNewAccessToken;
|
|
@@ -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.");
|
package/build/utils/config.js
CHANGED
|
@@ -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.");
|
|
@@ -75,7 +75,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
75
75
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
76
76
|
};
|
|
77
77
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
78
|
-
exports.
|
|
78
|
+
exports.getTestTearDown = exports.getTestSetUp = exports.overrideEnvVariables = exports.persistTokensRefreshedByAdapter = exports.saveTokens = void 0;
|
|
79
|
+
exports.getConfiguration = getConfiguration;
|
|
80
|
+
exports.findTargetInConfiguration = findTargetInConfiguration;
|
|
81
|
+
exports.getGlobalRcFile = getGlobalRcFile;
|
|
82
|
+
exports.getLocalRcFile = getLocalRcFile;
|
|
83
|
+
exports.saveGlobalRcFile = saveGlobalRcFile;
|
|
84
|
+
exports.saveToGlobalConfig = saveToGlobalConfig;
|
|
85
|
+
exports.removeFromGlobalConfig = removeFromGlobalConfig;
|
|
86
|
+
exports.removeFromLocalConfig = removeFromLocalConfig;
|
|
87
|
+
exports.getLocalConfig = getLocalConfig;
|
|
88
|
+
exports.getLocalOrGlobalConfig = getLocalOrGlobalConfig;
|
|
89
|
+
exports.getSyncDirectories = getSyncDirectories;
|
|
90
|
+
exports.saveLocalConfigFile = saveLocalConfigFile;
|
|
91
|
+
exports.saveToLocalConfig = saveToLocalConfig;
|
|
92
|
+
exports.getFolders = getFolders;
|
|
93
|
+
exports.getProgramFolders = getProgramFolders;
|
|
94
|
+
exports.getBinaryFolders = getBinaryFolders;
|
|
95
|
+
exports.getMacroFolders = getMacroFolders;
|
|
96
|
+
exports.getStreamConfig = getStreamConfig;
|
|
97
|
+
exports.sanitizeAppLoc = sanitizeAppLoc;
|
|
98
|
+
exports.getProjectRoot = getProjectRoot;
|
|
99
|
+
exports.getAuthConfig = getAuthConfig;
|
|
100
|
+
exports.getAuthConfigSAS9 = getAuthConfigSAS9;
|
|
101
|
+
exports.getAccessToken = getAccessToken;
|
|
102
|
+
exports.getSASjs = getSASjs;
|
|
103
|
+
exports.getSASjsAndAuthConfig = getSASjsAndAuthConfig;
|
|
79
104
|
var node_1 = __importDefault(require("@sasjs/adapter/node"));
|
|
80
105
|
var utils_1 = require("@sasjs/utils");
|
|
81
106
|
var auth_1 = require("./auth");
|
|
@@ -126,7 +151,6 @@ function getConfiguration(pathToFile) {
|
|
|
126
151
|
});
|
|
127
152
|
});
|
|
128
153
|
}
|
|
129
|
-
exports.getConfiguration = getConfiguration;
|
|
130
154
|
/**
|
|
131
155
|
* Returns the target with the given name.
|
|
132
156
|
* If the target is not found in the local configuration,
|
|
@@ -247,11 +271,10 @@ function findTargetInConfiguration(targetName, targetScope) {
|
|
|
247
271
|
});
|
|
248
272
|
});
|
|
249
273
|
}
|
|
250
|
-
exports.findTargetInConfiguration = findTargetInConfiguration;
|
|
251
274
|
function getLocalTarget(targetName) {
|
|
252
|
-
var _a;
|
|
253
275
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
|
-
var localConfig, targetJson,
|
|
276
|
+
var localConfig, targetJson, _a;
|
|
277
|
+
var _b;
|
|
255
278
|
return __generator(this, function (_c) {
|
|
256
279
|
switch (_c.label) {
|
|
257
280
|
case 0: return [4 /*yield*/, getConfiguration(path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json')).catch(function () { return null; })];
|
|
@@ -260,16 +283,16 @@ function getLocalTarget(targetName) {
|
|
|
260
283
|
if (!(localConfig === null || localConfig === void 0 ? void 0 : localConfig.targets)) return [3 /*break*/, 3];
|
|
261
284
|
targetJson = localConfig.targets.find(function (t) { return t.name === targetName; });
|
|
262
285
|
if (!targetJson) return [3 /*break*/, 3];
|
|
263
|
-
(
|
|
286
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Target ".concat(targetName, " was found in your local sasjsconfig.json file."));
|
|
264
287
|
targetJson.appLoc = sanitizeAppLoc(targetJson.appLoc);
|
|
265
288
|
if (!targetJson.hasOwnProperty('serverUrl')) {
|
|
266
289
|
targetJson.serverUrl = '';
|
|
267
290
|
}
|
|
268
291
|
targetJson.serverUrl = (0, utils_1.urlOrigin)(targetJson.serverUrl);
|
|
269
|
-
|
|
292
|
+
_a = targetJson;
|
|
270
293
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(localConfig, targetJson)];
|
|
271
294
|
case 2:
|
|
272
|
-
|
|
295
|
+
_a.httpsAgentOptions =
|
|
273
296
|
_c.sent();
|
|
274
297
|
return [2 /*return*/, new utils_1.Target(targetJson, localConfig)];
|
|
275
298
|
case 3: throw new Error(ERROR_MESSAGE(targetName).NOT_FOUND_TARGET_NAME);
|
|
@@ -278,9 +301,9 @@ function getLocalTarget(targetName) {
|
|
|
278
301
|
});
|
|
279
302
|
}
|
|
280
303
|
function getLocalFallbackTarget() {
|
|
281
|
-
var _a, _b;
|
|
282
304
|
return __awaiter(this, void 0, void 0, function () {
|
|
283
|
-
var localConfig, fallBackTargetJson, defaultTargetName_1,
|
|
305
|
+
var localConfig, fallBackTargetJson, defaultTargetName_1, _a;
|
|
306
|
+
var _b, _c;
|
|
284
307
|
return __generator(this, function (_d) {
|
|
285
308
|
switch (_d.label) {
|
|
286
309
|
case 0: return [4 /*yield*/, getConfiguration(path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json')).catch(function () { return null; })];
|
|
@@ -289,19 +312,19 @@ function getLocalFallbackTarget() {
|
|
|
289
312
|
if (!(localConfig === null || localConfig === void 0 ? void 0 : localConfig.targets)) return [3 /*break*/, 4];
|
|
290
313
|
defaultTargetName_1 = localConfig === null || localConfig === void 0 ? void 0 : localConfig.defaultTarget;
|
|
291
314
|
if (defaultTargetName_1) {
|
|
292
|
-
fallBackTargetJson = (
|
|
315
|
+
fallBackTargetJson = (_b = localConfig === null || localConfig === void 0 ? void 0 : localConfig.targets) === null || _b === void 0 ? void 0 : _b.find(function (t) { return t.name === defaultTargetName_1; });
|
|
293
316
|
}
|
|
294
317
|
if (!fallBackTargetJson) return [3 /*break*/, 4];
|
|
295
|
-
(
|
|
318
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("No target was specified. Falling back to default target '".concat(fallBackTargetJson.name, "' from your local sasjsconfig.json file."));
|
|
296
319
|
fallBackTargetJson.appLoc = sanitizeAppLoc(fallBackTargetJson.appLoc);
|
|
297
320
|
if (!fallBackTargetJson.hasOwnProperty('serverUrl')) {
|
|
298
321
|
fallBackTargetJson.serverUrl = '';
|
|
299
322
|
}
|
|
300
323
|
fallBackTargetJson.serverUrl = (0, utils_1.urlOrigin)(fallBackTargetJson.serverUrl);
|
|
301
|
-
|
|
324
|
+
_a = fallBackTargetJson;
|
|
302
325
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(localConfig, fallBackTargetJson)];
|
|
303
326
|
case 2:
|
|
304
|
-
|
|
327
|
+
_a.httpsAgentOptions =
|
|
305
328
|
_d.sent();
|
|
306
329
|
return [4 /*yield*/, (0, utils_2.loadEnvVariables)(".env.".concat(fallBackTargetJson.name))];
|
|
307
330
|
case 3:
|
|
@@ -313,9 +336,9 @@ function getLocalFallbackTarget() {
|
|
|
313
336
|
});
|
|
314
337
|
}
|
|
315
338
|
function getGlobalTarget(targetName) {
|
|
316
|
-
var _a;
|
|
317
339
|
return __awaiter(this, void 0, void 0, function () {
|
|
318
|
-
var globalConfig, targetJson,
|
|
340
|
+
var globalConfig, targetJson, _a;
|
|
341
|
+
var _b;
|
|
319
342
|
return __generator(this, function (_c) {
|
|
320
343
|
switch (_c.label) {
|
|
321
344
|
case 0: return [4 /*yield*/, getGlobalRcFile()];
|
|
@@ -324,16 +347,16 @@ function getGlobalTarget(targetName) {
|
|
|
324
347
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.targets)) return [3 /*break*/, 3];
|
|
325
348
|
targetJson = globalConfig.targets.find(function (t) { return t.name === targetName; });
|
|
326
349
|
if (!targetJson) return [3 /*break*/, 3];
|
|
327
|
-
(
|
|
350
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Target ".concat(targetName, " was found in your global .sasjsrc file."));
|
|
328
351
|
targetJson.appLoc = sanitizeAppLoc(targetJson.appLoc);
|
|
329
352
|
if (!targetJson.hasOwnProperty('serverUrl')) {
|
|
330
353
|
targetJson.serverUrl = '';
|
|
331
354
|
}
|
|
332
355
|
targetJson.serverUrl = (0, utils_1.urlOrigin)(targetJson.serverUrl);
|
|
333
|
-
|
|
356
|
+
_a = targetJson;
|
|
334
357
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(globalConfig, targetJson)];
|
|
335
358
|
case 2:
|
|
336
|
-
|
|
359
|
+
_a.httpsAgentOptions =
|
|
337
360
|
_c.sent();
|
|
338
361
|
return [2 /*return*/, new utils_1.Target(targetJson, globalConfig)];
|
|
339
362
|
case 3: throw new Error(ERROR_MESSAGE(targetName).NOT_FOUND_TARGET_NAME);
|
|
@@ -342,9 +365,9 @@ function getGlobalTarget(targetName) {
|
|
|
342
365
|
});
|
|
343
366
|
}
|
|
344
367
|
function getGlobalFallbackTarget() {
|
|
345
|
-
var _a, _b;
|
|
346
368
|
return __awaiter(this, void 0, void 0, function () {
|
|
347
|
-
var globalConfig, fallBackTargetJson, defaultTargetName,
|
|
369
|
+
var globalConfig, fallBackTargetJson, defaultTargetName, _a;
|
|
370
|
+
var _b, _c;
|
|
348
371
|
return __generator(this, function (_d) {
|
|
349
372
|
switch (_d.label) {
|
|
350
373
|
case 0: return [4 /*yield*/, getGlobalRcFile()];
|
|
@@ -352,19 +375,19 @@ function getGlobalFallbackTarget() {
|
|
|
352
375
|
globalConfig = (_d.sent());
|
|
353
376
|
defaultTargetName = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.defaultTarget;
|
|
354
377
|
if (defaultTargetName) {
|
|
355
|
-
fallBackTargetJson = (
|
|
378
|
+
fallBackTargetJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.targets) === null || _b === void 0 ? void 0 : _b.find(function (t) { return t.name === defaultTargetName; });
|
|
356
379
|
}
|
|
357
380
|
if (!fallBackTargetJson) return [3 /*break*/, 3];
|
|
358
|
-
(
|
|
381
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("No target was specified. Falling back to default target '".concat(fallBackTargetJson.name, "' from your global .sasjsrc file."));
|
|
359
382
|
fallBackTargetJson.appLoc = sanitizeAppLoc(fallBackTargetJson.appLoc);
|
|
360
383
|
if (!fallBackTargetJson.hasOwnProperty('serverUrl')) {
|
|
361
384
|
fallBackTargetJson.serverUrl = '';
|
|
362
385
|
}
|
|
363
386
|
fallBackTargetJson.serverUrl = (0, utils_1.urlOrigin)(fallBackTargetJson.serverUrl);
|
|
364
|
-
|
|
387
|
+
_a = fallBackTargetJson;
|
|
365
388
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(globalConfig, fallBackTargetJson)];
|
|
366
389
|
case 2:
|
|
367
|
-
|
|
390
|
+
_a.httpsAgentOptions =
|
|
368
391
|
_d.sent();
|
|
369
392
|
return [2 /*return*/, new utils_1.Target(fallBackTargetJson, globalConfig)];
|
|
370
393
|
case 3: throw new Error(ERROR_MESSAGE().NOT_FOUND_FALLBACK);
|
|
@@ -389,7 +412,6 @@ function getGlobalRcFile() {
|
|
|
389
412
|
});
|
|
390
413
|
});
|
|
391
414
|
}
|
|
392
|
-
exports.getGlobalRcFile = getGlobalRcFile;
|
|
393
415
|
function getLocalRcFile() {
|
|
394
416
|
return __awaiter(this, void 0, void 0, function () {
|
|
395
417
|
var projectRoot, config;
|
|
@@ -409,7 +431,6 @@ function getLocalRcFile() {
|
|
|
409
431
|
});
|
|
410
432
|
});
|
|
411
433
|
}
|
|
412
|
-
exports.getLocalRcFile = getLocalRcFile;
|
|
413
434
|
function saveGlobalRcFile(content) {
|
|
414
435
|
return __awaiter(this, void 0, void 0, function () {
|
|
415
436
|
var homeDir, rcFilePath;
|
|
@@ -426,13 +447,12 @@ function saveGlobalRcFile(content) {
|
|
|
426
447
|
});
|
|
427
448
|
});
|
|
428
449
|
}
|
|
429
|
-
|
|
430
|
-
function
|
|
431
|
-
var _a;
|
|
432
|
-
if (isDefault === void 0) { isDefault = false; }
|
|
433
|
-
if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
|
|
434
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
450
|
+
function saveToGlobalConfig(target_1) {
|
|
451
|
+
return __awaiter(this, arguments, void 0, function (target, isDefault, saveWithDefaultValues) {
|
|
435
452
|
var globalConfig, targetJson, existingTargetIndex;
|
|
453
|
+
var _a;
|
|
454
|
+
if (isDefault === void 0) { isDefault = false; }
|
|
455
|
+
if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
|
|
436
456
|
return __generator(this, function (_b) {
|
|
437
457
|
switch (_b.label) {
|
|
438
458
|
case 0: return [4 /*yield*/, getGlobalRcFile()];
|
|
@@ -468,7 +488,6 @@ function saveToGlobalConfig(target, isDefault, saveWithDefaultValues) {
|
|
|
468
488
|
});
|
|
469
489
|
});
|
|
470
490
|
}
|
|
471
|
-
exports.saveToGlobalConfig = saveToGlobalConfig;
|
|
472
491
|
function removeFromGlobalConfig(targetName) {
|
|
473
492
|
return __awaiter(this, void 0, void 0, function () {
|
|
474
493
|
var globalConfig, targets;
|
|
@@ -491,7 +510,6 @@ function removeFromGlobalConfig(targetName) {
|
|
|
491
510
|
});
|
|
492
511
|
});
|
|
493
512
|
}
|
|
494
|
-
exports.removeFromGlobalConfig = removeFromGlobalConfig;
|
|
495
513
|
function removeFromLocalConfig(targetName) {
|
|
496
514
|
return __awaiter(this, void 0, void 0, function () {
|
|
497
515
|
var config, targets, configPath;
|
|
@@ -515,7 +533,6 @@ function removeFromLocalConfig(targetName) {
|
|
|
515
533
|
});
|
|
516
534
|
});
|
|
517
535
|
}
|
|
518
|
-
exports.removeFromLocalConfig = removeFromLocalConfig;
|
|
519
536
|
function getLocalConfig() {
|
|
520
537
|
return __awaiter(this, void 0, void 0, function () {
|
|
521
538
|
var config;
|
|
@@ -529,7 +546,6 @@ function getLocalConfig() {
|
|
|
529
546
|
});
|
|
530
547
|
});
|
|
531
548
|
}
|
|
532
|
-
exports.getLocalConfig = getLocalConfig;
|
|
533
549
|
function getLocalOrGlobalConfig() {
|
|
534
550
|
return __awaiter(this, void 0, void 0, function () {
|
|
535
551
|
var e_5;
|
|
@@ -551,7 +567,6 @@ function getLocalOrGlobalConfig() {
|
|
|
551
567
|
});
|
|
552
568
|
});
|
|
553
569
|
}
|
|
554
|
-
exports.getLocalOrGlobalConfig = getLocalOrGlobalConfig;
|
|
555
570
|
function getSyncDirectories(target, isLocal) {
|
|
556
571
|
return __awaiter(this, void 0, void 0, function () {
|
|
557
572
|
var config, _a, rootLevelSyncDirectories, targetLevelSyncDirectories;
|
|
@@ -576,7 +591,6 @@ function getSyncDirectories(target, isLocal) {
|
|
|
576
591
|
});
|
|
577
592
|
});
|
|
578
593
|
}
|
|
579
|
-
exports.getSyncDirectories = getSyncDirectories;
|
|
580
594
|
function saveLocalConfigFile(content) {
|
|
581
595
|
return __awaiter(this, void 0, void 0, function () {
|
|
582
596
|
var configPath;
|
|
@@ -592,13 +606,12 @@ function saveLocalConfigFile(content) {
|
|
|
592
606
|
});
|
|
593
607
|
});
|
|
594
608
|
}
|
|
595
|
-
|
|
596
|
-
function
|
|
597
|
-
var _a, _b;
|
|
598
|
-
if (isDefault === void 0) { isDefault = false; }
|
|
599
|
-
if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
|
|
600
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
609
|
+
function saveToLocalConfig(target_1) {
|
|
610
|
+
return __awaiter(this, arguments, void 0, function (target, isDefault, saveWithDefaultValues) {
|
|
601
611
|
var targetJson, config, existingTargetIndex, configPath;
|
|
612
|
+
var _a, _b;
|
|
613
|
+
if (isDefault === void 0) { isDefault = false; }
|
|
614
|
+
if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
|
|
602
615
|
return __generator(this, function (_c) {
|
|
603
616
|
switch (_c.label) {
|
|
604
617
|
case 0:
|
|
@@ -638,7 +651,6 @@ function saveToLocalConfig(target, isDefault, saveWithDefaultValues) {
|
|
|
638
651
|
});
|
|
639
652
|
});
|
|
640
653
|
}
|
|
641
|
-
exports.saveToLocalConfig = saveToLocalConfig;
|
|
642
654
|
function getFolders() {
|
|
643
655
|
return __awaiter(this, void 0, void 0, function () {
|
|
644
656
|
var configPath, config, configJson;
|
|
@@ -658,7 +670,6 @@ function getFolders() {
|
|
|
658
670
|
});
|
|
659
671
|
});
|
|
660
672
|
}
|
|
661
|
-
exports.getFolders = getFolders;
|
|
662
673
|
/**
|
|
663
674
|
* Returns SAS program folders from configuration.
|
|
664
675
|
* This list includes both common and target-specific folders.
|
|
@@ -684,7 +695,6 @@ function getProgramFolders(target) {
|
|
|
684
695
|
});
|
|
685
696
|
});
|
|
686
697
|
}
|
|
687
|
-
exports.getProgramFolders = getProgramFolders;
|
|
688
698
|
function getBinaryFolders(target) {
|
|
689
699
|
return __awaiter(this, void 0, void 0, function () {
|
|
690
700
|
var binaryFolders, configuration, buildSourceFolder, binaryFoldersWithAbsolutePath;
|
|
@@ -705,7 +715,6 @@ function getBinaryFolders(target) {
|
|
|
705
715
|
});
|
|
706
716
|
});
|
|
707
717
|
}
|
|
708
|
-
exports.getBinaryFolders = getBinaryFolders;
|
|
709
718
|
/**
|
|
710
719
|
* Returns SAS macro folders from configuration.
|
|
711
720
|
* This list includes both common and target-specific folders.
|
|
@@ -730,7 +739,6 @@ function getMacroFolders(target) {
|
|
|
730
739
|
});
|
|
731
740
|
});
|
|
732
741
|
}
|
|
733
|
-
exports.getMacroFolders = getMacroFolders;
|
|
734
742
|
/**
|
|
735
743
|
* Returns StreamConfig from configuration.
|
|
736
744
|
* This configuration includes both common and target-specific configuration.
|
|
@@ -745,7 +753,6 @@ function getStreamConfig(target) {
|
|
|
745
753
|
});
|
|
746
754
|
});
|
|
747
755
|
}
|
|
748
|
-
exports.getStreamConfig = getStreamConfig;
|
|
749
756
|
/**
|
|
750
757
|
* Sanitizes app location string.
|
|
751
758
|
* @param {string} appLoc - app location
|
|
@@ -762,7 +769,6 @@ function sanitizeAppLoc(appLoc) {
|
|
|
762
769
|
appLoc = appLoc.replace(/^\/{2,}/, '/');
|
|
763
770
|
return appLoc;
|
|
764
771
|
}
|
|
765
|
-
exports.sanitizeAppLoc = sanitizeAppLoc;
|
|
766
772
|
function getProjectRoot() {
|
|
767
773
|
return __awaiter(this, void 0, void 0, function () {
|
|
768
774
|
var root, rootFound, i, currentLocation, maxLevels, isRoot, _a;
|
|
@@ -802,7 +808,6 @@ function getProjectRoot() {
|
|
|
802
808
|
});
|
|
803
809
|
});
|
|
804
810
|
}
|
|
805
|
-
exports.getProjectRoot = getProjectRoot;
|
|
806
811
|
/**
|
|
807
812
|
* Gets the auth config for the specified target, refreshing the access token
|
|
808
813
|
* (via the refresh token) if it is expiring.
|
|
@@ -820,9 +825,9 @@ exports.getProjectRoot = getProjectRoot;
|
|
|
820
825
|
* @returns {AuthConfig} - an object containing an access token, refresh token, client ID and secret.
|
|
821
826
|
*/
|
|
822
827
|
function getAuthConfig(target) {
|
|
823
|
-
var _a, _b, _c, _d;
|
|
824
828
|
return __awaiter(this, void 0, void 0, function () {
|
|
825
829
|
var access_token, refresh_token, client, passwordGrantHint, secret, sasjs, tokens, sasjs, tokens;
|
|
830
|
+
var _a, _b, _c, _d;
|
|
826
831
|
return __generator(this, function (_e) {
|
|
827
832
|
switch (_e.label) {
|
|
828
833
|
case 0:
|
|
@@ -925,7 +930,6 @@ function getAuthConfig(target) {
|
|
|
925
930
|
});
|
|
926
931
|
});
|
|
927
932
|
}
|
|
928
|
-
exports.getAuthConfig = getAuthConfig;
|
|
929
933
|
/**
|
|
930
934
|
* Persists an access/refresh token pair to wherever the target's credentials
|
|
931
935
|
* live: `.env.{targetName}` for a local target, or `authConfig` in the global
|
|
@@ -990,26 +994,24 @@ exports.saveTokens = saveTokens;
|
|
|
990
994
|
* {@link saveTokens} does not drop it from `.env.{target}`.
|
|
991
995
|
*/
|
|
992
996
|
var persistTokensRefreshedByAdapter = function (target) {
|
|
993
|
-
return function (_a) {
|
|
994
|
-
var
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
}
|
|
1010
|
-
});
|
|
997
|
+
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
998
|
+
var rawClient, rawSecret, client, secret;
|
|
999
|
+
var _c, _d;
|
|
1000
|
+
var access_token = _b.access_token, refresh_token = _b.refresh_token;
|
|
1001
|
+
return __generator(this, function (_e) {
|
|
1002
|
+
switch (_e.label) {
|
|
1003
|
+
case 0:
|
|
1004
|
+
rawClient = ((_c = target.authConfig) === null || _c === void 0 ? void 0 : _c.client) || process.env.CLIENT;
|
|
1005
|
+
rawSecret = ((_d = target.authConfig) === null || _d === void 0 ? void 0 : _d.secret) || process.env.SECRET;
|
|
1006
|
+
client = sanitizeEnvValue(rawClient);
|
|
1007
|
+
secret = sanitizeEnvValue(rawSecret);
|
|
1008
|
+
return [4 /*yield*/, (0, exports.saveTokens)(target.name, access_token, refresh_token, client, secret)];
|
|
1009
|
+
case 1:
|
|
1010
|
+
_e.sent();
|
|
1011
|
+
return [2 /*return*/];
|
|
1012
|
+
}
|
|
1011
1013
|
});
|
|
1012
|
-
};
|
|
1014
|
+
}); };
|
|
1013
1015
|
};
|
|
1014
1016
|
exports.persistTokensRefreshedByAdapter = persistTokensRefreshedByAdapter;
|
|
1015
1017
|
/**
|
|
@@ -1036,7 +1038,6 @@ function getAuthConfigSAS9(target) {
|
|
|
1036
1038
|
password: password
|
|
1037
1039
|
};
|
|
1038
1040
|
}
|
|
1039
|
-
exports.getAuthConfigSAS9 = getAuthConfigSAS9;
|
|
1040
1041
|
/**
|
|
1041
1042
|
* Gets an access token for the specified target.
|
|
1042
1043
|
* If the target is from the global `.sasjsrc` file,
|
|
@@ -1062,10 +1063,10 @@ exports.getAuthConfigSAS9 = getAuthConfigSAS9;
|
|
|
1062
1063
|
* @param {string} checkIfExpiring - flag that indicates whether to do an expiry check.
|
|
1063
1064
|
* @internal One-shot/test-only. User-facing commands must use {@link getAuthConfig}.
|
|
1064
1065
|
*/
|
|
1065
|
-
function getAccessToken(
|
|
1066
|
-
|
|
1067
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1066
|
+
function getAccessToken(target_1) {
|
|
1067
|
+
return __awaiter(this, arguments, void 0, function (target, checkIfExpiring) {
|
|
1068
1068
|
var accessToken, sasjs, passwordGrantHint, client, secret, refreshToken, tokens;
|
|
1069
|
+
if (checkIfExpiring === void 0) { checkIfExpiring = true; }
|
|
1069
1070
|
return __generator(this, function (_a) {
|
|
1070
1071
|
switch (_a.label) {
|
|
1071
1072
|
case 0:
|
|
@@ -1125,7 +1126,6 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
1125
1126
|
});
|
|
1126
1127
|
});
|
|
1127
1128
|
}
|
|
1128
|
-
exports.getAccessToken = getAccessToken;
|
|
1129
1129
|
/**
|
|
1130
1130
|
* Overrides environment variables with values from a target-specific env file if available.
|
|
1131
1131
|
* Displays a warning if the file is unavailable.
|
|
@@ -1264,11 +1264,10 @@ function getSASjs(target) {
|
|
|
1264
1264
|
contextName: target.contextName,
|
|
1265
1265
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
1266
1266
|
debug: true,
|
|
1267
|
-
useComputeApi: target.serverType === utils_1.ServerType.SasViya,
|
|
1267
|
+
useComputeApi: target.serverType === utils_1.ServerType.SasViya, // compute api is used only on Viya server
|
|
1268
1268
|
verbose: verbose
|
|
1269
1269
|
});
|
|
1270
1270
|
}
|
|
1271
|
-
exports.getSASjs = getSASjs;
|
|
1272
1271
|
/**
|
|
1273
1272
|
* Returns configuration object of SAS Adapter and authentication configuration
|
|
1274
1273
|
* @param {Target} target - the target to get auth configuration from.
|
|
@@ -1323,4 +1322,3 @@ function getSASjsAndAuthConfig(target) {
|
|
|
1323
1322
|
});
|
|
1324
1323
|
});
|
|
1325
1324
|
}
|
|
1326
|
-
exports.getSASjsAndAuthConfig = getSASjsAndAuthConfig;
|