@sasjs/cli 3.19.5 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/build/commands/deploy/deploy.js +54 -108
  2. package/build/commands/deploy/spec/cbd.spec.js +31 -8
  3. package/build/commands/docs/internal/getDotFileContent.d.ts +2 -2
  4. package/build/commands/docs/internal/getDotFileContent.js +4 -4
  5. package/build/commands/fs/fsCommand.d.ts +11 -0
  6. package/build/commands/fs/fsCommand.js +335 -0
  7. package/build/commands/fs/internal/executeCode.d.ts +4 -0
  8. package/build/commands/fs/internal/executeCode.js +126 -0
  9. package/build/commands/fs/internal/extractHashArray.d.ts +1 -0
  10. package/build/commands/fs/internal/extractHashArray.js +20 -0
  11. package/build/commands/fs/spec/executeCode.spec.d.ts +1 -0
  12. package/build/commands/fs/spec/executeCode.spec.js +197 -0
  13. package/build/commands/fs/spec/extractHashArray.spec.d.ts +1 -0
  14. package/build/commands/fs/spec/extractHashArray.spec.js +14 -0
  15. package/build/commands/fs/spec/fsCommand.spec.d.ts +1 -0
  16. package/build/commands/fs/spec/fsCommand.spec.js +297 -0
  17. package/build/commands/job/internal/execute/sas9.d.ts +1 -1
  18. package/build/commands/job/internal/execute/sasjs.d.ts +3 -4
  19. package/build/commands/job/internal/execute/sasjs.js +36 -20
  20. package/build/commands/job/jobCommand.d.ts +4 -8
  21. package/build/commands/job/jobCommand.js +64 -98
  22. package/build/commands/job/spec/execute.spec.js +52 -7
  23. package/build/commands/request/spec/request.spec.server.sas9.js +2 -0
  24. package/build/commands/run/run.js +70 -107
  25. package/build/types/command/commandFactory.js +2 -0
  26. package/build/utils/config.d.ts +28 -1
  27. package/build/utils/config.js +71 -1
  28. package/build/utils/index.d.ts +1 -0
  29. package/build/utils/index.js +1 -0
  30. package/package.json +4 -4
@@ -23,6 +23,7 @@ var helpCommand_1 = require("../../commands/help/helpCommand");
23
23
  var jobCommand_1 = require("../../commands/job/jobCommand");
24
24
  var lintCommand_1 = require("../../commands/lint/lintCommand");
25
25
  var flowCommand_1 = require("../../commands/flow/flowCommand");
26
+ var fsCommand_1 = require("../../commands/fs/fsCommand");
26
27
  exports.commandFactory = new Map([
27
28
  ['add', function (args) { return new addCommand_1.AddCommand(args); }],
28
29
  ['build', function (args) { return new buildCommand_1.BuildCommand(args); }],
@@ -38,6 +39,7 @@ exports.commandFactory = new Map([
38
39
  ['deploy', function (args) { return new deployCommand_1.DeployCommand(args); }],
39
40
  ['doc', function (args) { return new docsCommand_1.DocsCommand(args); }],
40
41
  ['folder', function (args) { return new folderCommand_1.FolderCommand(args); }],
42
+ ['fs', function (args) { return new fsCommand_1.FSCommand(args); }],
41
43
  ['help', function (args) { return new helpCommand_1.HelpCommand(args); }],
42
44
  ['init', function (args) { return new initCommand_1.InitCommand(args); }],
43
45
  ['job', function (args) { return new jobCommand_1.JobCommand(args); }],
@@ -1,4 +1,5 @@
1
- import { Configuration, Target, AuthConfig, StreamConfig } from '@sasjs/utils';
1
+ import SASjs from '@sasjs/adapter/node';
2
+ import { Configuration, Target, AuthConfig, StreamConfig, AuthConfigSas9 } from '@sasjs/utils';
2
3
  import { TargetScope } from '../types/targetScope';
3
4
  /**
4
5
  * Returns an object that represents the SASjs CLI configuration in a given file.
@@ -64,6 +65,12 @@ export declare function getProjectRoot(): Promise<string>;
64
65
  * @returns {AuthConfig} - an object containing an access token, refresh token, client ID and secret.
65
66
  */
66
67
  export declare function getAuthConfig(target: Target): Promise<AuthConfig>;
68
+ /**
69
+ * Gets the auth config for the specified SAS9 target.
70
+ * @param {Target} target - the target to get an access token for.
71
+ * @returns {AuthConfigSas9} - an object containing an userName and password.
72
+ */
73
+ export declare function getAuthConfigSAS9(target: Target): AuthConfigSas9;
67
74
  /**
68
75
  * Gets an access token for the specified target.
69
76
  * If the target is from the global `.sasjsrc` file,
@@ -87,3 +94,23 @@ export declare function getAccessToken(target: Target, checkIfExpiring?: boolean
87
94
  export declare const overrideEnvVariables: (targetName: string) => Promise<void>;
88
95
  export declare const getTestSetUp: (target: Target) => Promise<string | undefined>;
89
96
  export declare const getTestTearDown: (target: Target) => Promise<string | undefined>;
97
+ /**
98
+ * Returns configuration object of SAS Adapter and authentication configuration
99
+ * @param {Target} target - the target to get auth configuration from.
100
+ */
101
+ export declare function getSASjs(target: Target): SASjs;
102
+ /**
103
+ * Returns configuration object of SAS Adapter and authentication configuration
104
+ * @param {Target} target - the target to get auth configuration from.
105
+ * @returns an object containing a SAS Adapter configuration object `sasjs`
106
+ * and auth configuration `authConfig` or `authConfigSas9`.
107
+ */
108
+ export declare function getSASjsAndAuthConfig(target: Target): Promise<{
109
+ sasjs: SASjs;
110
+ authConfigSas9: AuthConfigSas9;
111
+ authConfig?: undefined;
112
+ } | {
113
+ sasjs: SASjs;
114
+ authConfig: AuthConfig;
115
+ authConfigSas9?: undefined;
116
+ }>;
@@ -75,7 +75,7 @@ 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.getTestTearDown = exports.getTestSetUp = exports.overrideEnvVariables = exports.getAccessToken = exports.getAuthConfig = exports.getProjectRoot = exports.sanitizeAppLoc = exports.getStreamConfig = exports.getMacroFolders = exports.getBinaryFolders = exports.getProgramFolders = exports.getFolders = exports.saveToLocalConfig = exports.saveLocalConfigFile = exports.getLocalOrGlobalConfig = exports.getLocalConfig = exports.removeFromLocalConfig = exports.removeFromGlobalConfig = exports.saveToGlobalConfig = exports.saveGlobalRcFile = exports.getLocalRcFile = exports.getGlobalRcFile = exports.findTargetInConfiguration = exports.getConfiguration = void 0;
78
+ exports.getSASjsAndAuthConfig = exports.getSASjs = exports.getTestTearDown = exports.getTestSetUp = exports.overrideEnvVariables = exports.getAccessToken = exports.getAuthConfigSAS9 = exports.getAuthConfig = exports.getProjectRoot = exports.sanitizeAppLoc = exports.getStreamConfig = exports.getMacroFolders = exports.getBinaryFolders = exports.getProgramFolders = exports.getFolders = exports.saveToLocalConfig = exports.saveLocalConfigFile = exports.getLocalOrGlobalConfig = exports.getLocalConfig = exports.removeFromLocalConfig = exports.removeFromGlobalConfig = exports.saveToGlobalConfig = exports.saveGlobalRcFile = exports.getLocalRcFile = exports.getGlobalRcFile = exports.findTargetInConfiguration = exports.getConfiguration = void 0;
79
79
  var node_1 = __importDefault(require("@sasjs/adapter/node"));
80
80
  var utils_1 = require("@sasjs/utils");
81
81
  var auth_1 = require("./auth");
@@ -870,6 +870,31 @@ function getAuthConfig(target) {
870
870
  });
871
871
  }
872
872
  exports.getAuthConfig = getAuthConfig;
873
+ /**
874
+ * Gets the auth config for the specified SAS9 target.
875
+ * @param {Target} target - the target to get an access token for.
876
+ * @returns {AuthConfigSas9} - an object containing an userName and password.
877
+ */
878
+ function getAuthConfigSAS9(target) {
879
+ var _a = target.authConfigSas9
880
+ ? {
881
+ userName: target.authConfigSas9.userName,
882
+ password: target.authConfigSas9.password
883
+ }
884
+ : {
885
+ userName: process.env.SAS_USERNAME,
886
+ password: process.env.SAS_PASSWORD
887
+ }, userName = _a.userName, password = _a.password;
888
+ if (!userName || !password) {
889
+ var sas9CredentialsError = process.sasjsConstants.sas9CredentialsError;
890
+ throw new Error(sas9CredentialsError);
891
+ }
892
+ return {
893
+ userName: userName,
894
+ password: password
895
+ };
896
+ }
897
+ exports.getAuthConfigSAS9 = getAuthConfigSAS9;
873
898
  /**
874
899
  * Gets an access token for the specified target.
875
900
  * If the target is from the global `.sasjsrc` file,
@@ -1068,3 +1093,48 @@ var getTestTearDown = function (target) { return __awaiter(void 0, void 0, void
1068
1093
  });
1069
1094
  }); };
1070
1095
  exports.getTestTearDown = getTestTearDown;
1096
+ /**
1097
+ * Returns configuration object of SAS Adapter and authentication configuration
1098
+ * @param {Target} target - the target to get auth configuration from.
1099
+ */
1100
+ function getSASjs(target) {
1101
+ return new node_1.default({
1102
+ serverUrl: target.serverUrl,
1103
+ appLoc: target.appLoc,
1104
+ serverType: target.serverType,
1105
+ httpsAgentOptions: target.httpsAgentOptions,
1106
+ debug: true,
1107
+ useComputeApi: target.serverType === utils_1.ServerType.SasViya
1108
+ });
1109
+ }
1110
+ exports.getSASjs = getSASjs;
1111
+ /**
1112
+ * Returns configuration object of SAS Adapter and authentication configuration
1113
+ * @param {Target} target - the target to get auth configuration from.
1114
+ * @returns an object containing a SAS Adapter configuration object `sasjs`
1115
+ * and auth configuration `authConfig` or `authConfigSas9`.
1116
+ */
1117
+ function getSASjsAndAuthConfig(target) {
1118
+ return __awaiter(this, void 0, void 0, function () {
1119
+ var sasjs;
1120
+ var _a;
1121
+ return __generator(this, function (_b) {
1122
+ switch (_b.label) {
1123
+ case 0:
1124
+ sasjs = getSASjs(target);
1125
+ if (target.serverType === utils_1.ServerType.Sas9)
1126
+ return [2 /*return*/, {
1127
+ sasjs: sasjs,
1128
+ authConfigSas9: getAuthConfigSAS9(target)
1129
+ }];
1130
+ _a = {
1131
+ sasjs: sasjs
1132
+ };
1133
+ return [4 /*yield*/, getAuthConfig(target)];
1134
+ case 1: return [2 /*return*/, (_a.authConfig = _b.sent(),
1135
+ _a)];
1136
+ }
1137
+ });
1138
+ });
1139
+ }
1140
+ exports.getSASjsAndAuthConfig = getSASjsAndAuthConfig;
@@ -3,6 +3,7 @@ export * from './config';
3
3
  export * from './displayResult';
4
4
  export * from './file';
5
5
  export * from './loadEnvVariables';
6
+ export * from './saveLog';
6
7
  export * from './setConstants';
7
8
  export * from './setProjectDir';
8
9
  export * from './utils';
@@ -15,6 +15,7 @@ __exportStar(require("./config"), exports);
15
15
  __exportStar(require("./displayResult"), exports);
16
16
  __exportStar(require("./file"), exports);
17
17
  __exportStar(require("./loadEnvVariables"), exports);
18
+ __exportStar(require("./saveLog"), exports);
18
19
  __exportStar(require("./setConstants"), exports);
19
20
  __exportStar(require("./setProjectDir"), exports);
20
21
  __exportStar(require("./utils"), exports);
package/package.json CHANGED
@@ -49,10 +49,10 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@sasjs/adapter": "3.10.18",
53
- "@sasjs/core": "4.40.0",
52
+ "@sasjs/adapter": "4.0.1",
53
+ "@sasjs/core": "4.43.0",
54
54
  "@sasjs/lint": "1.12.0",
55
- "@sasjs/utils": "2.48.2",
55
+ "@sasjs/utils": "2.49.2",
56
56
  "adm-zip": "0.5.9",
57
57
  "chalk": "4.1.2",
58
58
  "csv-stringify": "5.6.5",
@@ -98,5 +98,5 @@
98
98
  "typescript": "4.5.4",
99
99
  "util": "0.12.4"
100
100
  },
101
- "version": "3.19.5"
101
+ "version": "3.20.0"
102
102
  }