@sasjs/cli 2.38.7 → 3.0.1

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 (78) hide show
  1. package/build/commands/add/addCredential.d.ts +2 -2
  2. package/build/commands/add/addCredential.js +26 -28
  3. package/build/commands/add/internal/input.js +15 -2
  4. package/build/commands/build/build.d.ts +1 -1
  5. package/build/commands/build/build.js +67 -56
  6. package/build/commands/build/internal/getLaunchPageCode.js +2 -1
  7. package/build/commands/compile/compile.js +18 -22
  8. package/build/commands/compile/internal/checkCompileStatus.js +6 -8
  9. package/build/commands/compile/internal/compileServiceFile.js +18 -16
  10. package/build/commands/compile/internal/spec/compileTestFile.spec.js +16 -4
  11. package/build/commands/compile/spec/loadDependencies.spec.js +3 -3
  12. package/build/commands/context/contextCommand.js +5 -5
  13. package/build/commands/deploy/deploy.d.ts +2 -1
  14. package/build/commands/deploy/deploy.js +92 -46
  15. package/build/commands/deploy/spec/cbd.spec.d.ts +1 -0
  16. package/build/commands/deploy/spec/cbd.spec.js +141 -0
  17. package/build/commands/deploy/spec/cbd.spec.server.js +6 -57
  18. package/build/commands/deploy/spec/utils.d.ts +6 -0
  19. package/build/commands/deploy/spec/utils.js +242 -0
  20. package/build/commands/docs/internal/getDocConfig.js +8 -3
  21. package/build/commands/docs/spec/generateDot.spec.js +0 -1
  22. package/build/commands/docs/spec/getDocConfig.spec.d.ts +1 -0
  23. package/build/commands/docs/spec/getDocConfig.spec.js +27 -0
  24. package/build/commands/flow/flowCommand.js +1 -1
  25. package/build/commands/flow/spec/flow.spec.server.js +1 -1
  26. package/build/commands/folder/folderCommand.js +2 -2
  27. package/build/commands/folder/spec/folder.spec.server.js +1 -1
  28. package/build/commands/job/internal/execute/index.d.ts +2 -0
  29. package/build/commands/job/internal/execute/index.js +14 -0
  30. package/build/commands/job/internal/execute/sasjs.d.ts +8 -0
  31. package/build/commands/job/internal/execute/sasjs.js +69 -0
  32. package/build/commands/job/{execute.d.ts → internal/execute/viya.d.ts} +1 -1
  33. package/build/commands/job/{execute.js → internal/execute/viya.js} +29 -68
  34. package/build/commands/job/internal/utils.d.ts +1 -0
  35. package/build/commands/job/internal/utils.js +81 -0
  36. package/build/commands/job/jobCommand.d.ts +2 -1
  37. package/build/commands/job/jobCommand.js +65 -23
  38. package/build/commands/job/spec/execute.spec.js +41 -21
  39. package/build/commands/job/spec/getContextName.spec.js +1 -1
  40. package/build/commands/job/spec/job.spec.server.js +4 -4
  41. package/build/commands/job/spec/jobCommand.spec.js +10 -10
  42. package/build/commands/request/request.js +1 -1
  43. package/build/commands/run/run.js +2 -2
  44. package/build/commands/servicepack/spec/servicepack.spec.server.js +0 -1
  45. package/build/commands/shared/dependencies.js +6 -9
  46. package/build/commands/shared/deployToSasViyaWithServicePack.js +1 -1
  47. package/build/commands/testing/test.js +1 -1
  48. package/build/commands/web/internal/createAssetServices.d.ts +5 -0
  49. package/build/commands/web/internal/createAssetServices.js +219 -0
  50. package/build/commands/web/internal/getTags.d.ts +4 -0
  51. package/build/commands/web/internal/getTags.js +21 -0
  52. package/build/commands/web/internal/getWebServiceContent.d.ts +2 -0
  53. package/build/commands/web/internal/getWebServiceContent.js +84 -0
  54. package/build/commands/web/{spec → internal/spec}/testFiles/script1.d.ts +0 -0
  55. package/build/commands/web/{spec → internal/spec}/testFiles/script1.js +0 -0
  56. package/build/commands/web/{spec → internal/spec}/testFiles/script2.d.ts +0 -0
  57. package/build/commands/web/{spec → internal/spec}/testFiles/script2.js +0 -0
  58. package/build/commands/web/{spec/updateTagSource.spec.d.ts → internal/spec/updateScriptTag.spec.d.ts} +0 -0
  59. package/build/commands/web/{spec/updateTagSource.spec.js → internal/spec/updateScriptTag.spec.js} +7 -7
  60. package/build/commands/web/internal/updateAllTags.d.ts +13 -0
  61. package/build/commands/web/internal/updateAllTags.js +94 -0
  62. package/build/commands/web/internal/updateLinkHref.d.ts +4 -0
  63. package/build/commands/web/internal/updateLinkHref.js +18 -0
  64. package/build/commands/web/internal/updateScriptTag.d.ts +5 -0
  65. package/build/commands/web/internal/updateScriptTag.js +85 -0
  66. package/build/commands/web/web.d.ts +0 -4
  67. package/build/commands/web/web.js +64 -378
  68. package/build/config.json +3 -1
  69. package/build/utils/config.d.ts +1 -1
  70. package/build/utils/config.js +106 -71
  71. package/build/utils/file.d.ts +1 -1
  72. package/build/utils/file.js +1 -1
  73. package/build/utils/spec/removeComments.spec.d.ts +1 -1
  74. package/build/utils/spec/removeComments.spec.js +1 -1
  75. package/build/utils/test.js +1 -1
  76. package/build/utils/utils.d.ts +1 -0
  77. package/build/utils/utils.js +8 -2
  78. package/package.json +13 -13
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
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 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ exports.generateTarget = exports.copyJobsAndServices = exports.updateLocalTarget = exports.createLocalTarget = exports.createGlobalTarget = void 0;
54
+ var utils_1 = require("@sasjs/utils");
55
+ var utils_2 = require("../../../utils");
56
+ var config_1 = require("../../../utils/config");
57
+ var dotenv_1 = __importDefault(require("dotenv"));
58
+ var utils_3 = require("@sasjs/utils");
59
+ var path_1 = __importDefault(require("path"));
60
+ var utils_4 = require("../../../utils");
61
+ var createGlobalTarget = function (serverType) {
62
+ if (serverType === void 0) { serverType = utils_1.ServerType.SasViya; }
63
+ return __awaiter(void 0, void 0, void 0, function () {
64
+ var timestamp, targetName, target;
65
+ return __generator(this, function (_a) {
66
+ switch (_a.label) {
67
+ case 0:
68
+ dotenv_1.default.config();
69
+ timestamp = utils_1.generateTimestamp();
70
+ targetName = "cli-tests-cbd-" + timestamp;
71
+ return [4 /*yield*/, utils_2.setConstants()];
72
+ case 1:
73
+ _a.sent();
74
+ target = new utils_1.Target({
75
+ name: targetName,
76
+ serverType: serverType,
77
+ serverUrl: (serverType === utils_1.ServerType.SasViya
78
+ ? process.env.VIYA_SERVER_URL
79
+ : process.env.SAS9_SERVER_URL),
80
+ appLoc: "/Public/app/cli-tests/" + targetName,
81
+ contextName: process.sasjsConstants.contextName,
82
+ serviceConfig: {
83
+ serviceFolders: ['sasjs/testServices', 'sasjs/testJob'],
84
+ initProgram: 'sasjs/testServices/serviceinit.sas',
85
+ termProgram: 'sasjs/testServices/serviceterm.sas',
86
+ macroVars: {}
87
+ },
88
+ jobConfig: {
89
+ jobFolders: ['sasjs/testJob'],
90
+ initProgram: 'sasjs/testServices/serviceinit.sas',
91
+ termProgram: 'sasjs/testServices/serviceterm.sas',
92
+ macroVars: {}
93
+ },
94
+ authConfig: {
95
+ client: process.env.CLIENT,
96
+ secret: process.env.SECRET,
97
+ access_token: process.env.ACCESS_TOKEN,
98
+ refresh_token: process.env.REFRESH_TOKEN
99
+ },
100
+ deployConfig: {
101
+ deployServicePack: true,
102
+ deployScripts: []
103
+ }
104
+ });
105
+ return [4 /*yield*/, config_1.saveToGlobalConfig(target)];
106
+ case 2:
107
+ _a.sent();
108
+ return [2 /*return*/, target];
109
+ }
110
+ });
111
+ });
112
+ };
113
+ exports.createGlobalTarget = createGlobalTarget;
114
+ var createLocalTarget = function (serverType) {
115
+ if (serverType === void 0) { serverType = utils_1.ServerType.SasViya; }
116
+ return __awaiter(void 0, void 0, void 0, function () {
117
+ var timestamp, targetName, target, configContent, configJSON;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0:
121
+ dotenv_1.default.config();
122
+ timestamp = utils_1.generateTimestamp();
123
+ targetName = "cli-tests-cbd-" + timestamp;
124
+ target = new utils_1.Target({
125
+ name: targetName,
126
+ serverType: serverType,
127
+ serverUrl: (serverType === utils_1.ServerType.SasViya
128
+ ? process.env.VIYA_SERVER_URL
129
+ : process.env.SAS9_SERVER_URL),
130
+ appLoc: "/Public/app/cli-tests/" + targetName,
131
+ contextName: process.sasjsConstants.contextName,
132
+ serviceConfig: {
133
+ serviceFolders: ['sasjs/testServices', 'sasjs/testJob', 'sasjs/services'],
134
+ initProgram: 'sasjs/testServices/serviceinit.sas',
135
+ termProgram: 'sasjs/testServices/serviceterm.sas',
136
+ macroVars: {}
137
+ },
138
+ jobConfig: {
139
+ jobFolders: ['sasjs/testJob'],
140
+ initProgram: 'sasjs/testServices/serviceinit.sas',
141
+ termProgram: 'sasjs/testServices/serviceterm.sas',
142
+ macroVars: {}
143
+ },
144
+ deployConfig: {
145
+ deployServicePack: true,
146
+ deployScripts: []
147
+ }
148
+ });
149
+ return [4 /*yield*/, utils_3.readFile(path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json'))];
150
+ case 1:
151
+ configContent = _a.sent();
152
+ configJSON = JSON.parse(configContent);
153
+ configJSON.targets = [
154
+ __assign(__assign({}, target.toJson()), { deployConfig: {
155
+ deployScripts: ['sasjs/build/copyscript.sh'],
156
+ deployServicePack: true
157
+ } })
158
+ ];
159
+ return [4 /*yield*/, utils_3.createFile(path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json'), JSON.stringify(configJSON, null, 2))];
160
+ case 2:
161
+ _a.sent();
162
+ return [2 /*return*/, target];
163
+ }
164
+ });
165
+ });
166
+ };
167
+ exports.createLocalTarget = createLocalTarget;
168
+ var updateLocalTarget = function (targetName, data) { return __awaiter(void 0, void 0, void 0, function () {
169
+ var configContent, configJSON, target;
170
+ var _a;
171
+ return __generator(this, function (_b) {
172
+ switch (_b.label) {
173
+ case 0:
174
+ dotenv_1.default.config();
175
+ return [4 /*yield*/, utils_3.readFile(path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json'))];
176
+ case 1:
177
+ configContent = _b.sent();
178
+ configJSON = JSON.parse(configContent);
179
+ target = (_a = configJSON === null || configJSON === void 0 ? void 0 : configJSON.targets) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.name === targetName; });
180
+ configJSON.targets = [
181
+ __assign(__assign({}, target), data)
182
+ ];
183
+ return [4 /*yield*/, utils_3.createFile(path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json'), JSON.stringify(configJSON, null, 2))];
184
+ case 2:
185
+ _b.sent();
186
+ return [2 /*return*/];
187
+ }
188
+ });
189
+ }); };
190
+ exports.updateLocalTarget = updateLocalTarget;
191
+ var copyJobsAndServices = function (appName) { return __awaiter(void 0, void 0, void 0, function () {
192
+ return __generator(this, function (_a) {
193
+ switch (_a.label) {
194
+ case 0: return [4 /*yield*/, utils_3.copy(path_1.default.join(__dirname, 'testJob'), path_1.default.join(__dirname, appName, 'sasjs', 'testJob'))];
195
+ case 1:
196
+ _a.sent();
197
+ return [4 /*yield*/, utils_3.copy(path_1.default.join(__dirname, 'testServices'), path_1.default.join(__dirname, appName, 'sasjs', 'testServices'))];
198
+ case 2:
199
+ _a.sent();
200
+ return [2 /*return*/];
201
+ }
202
+ });
203
+ }); };
204
+ exports.copyJobsAndServices = copyJobsAndServices;
205
+ var generateTarget = function (isLocal) {
206
+ dotenv_1.default.config();
207
+ var timestamp = utils_1.generateTimestamp();
208
+ var targetName = "cli-tests-cbd-" + timestamp;
209
+ var authConfig = isLocal
210
+ ? undefined
211
+ : {
212
+ client: process.env.CLIENT,
213
+ secret: process.env.SECRET,
214
+ access_token: process.env.ACCESS_TOKEN,
215
+ refresh_token: process.env.REFRESH_TOKEN
216
+ };
217
+ return new utils_1.Target({
218
+ name: targetName,
219
+ serverType: utils_1.ServerType.SasViya,
220
+ serverUrl: process.env.VIYA_SERVER_URL,
221
+ appLoc: "/Public/app/cli-tests/" + targetName,
222
+ contextName: utils_4.contextName,
223
+ serviceConfig: {
224
+ serviceFolders: ['sasjs/testServices', 'sasjs/testJob', 'sasjs/services'],
225
+ initProgram: 'sasjs/testServices/serviceinit.sas',
226
+ termProgram: 'sasjs/testServices/serviceterm.sas',
227
+ macroVars: {}
228
+ },
229
+ jobConfig: {
230
+ jobFolders: ['sasjs/testJob'],
231
+ initProgram: 'sasjs/testServices/serviceinit.sas',
232
+ termProgram: 'sasjs/testServices/serviceterm.sas',
233
+ macroVars: {}
234
+ },
235
+ authConfig: authConfig,
236
+ deployConfig: {
237
+ deployServicePack: true,
238
+ deployScripts: ['']
239
+ }
240
+ });
241
+ };
242
+ exports.generateTarget = generateTarget;
@@ -19,11 +19,13 @@ exports.getDocConfig = void 0;
19
19
  * @param {string} outDirectory- the name of the output folder, provided using command.
20
20
  */
21
21
  function getDocConfig(target, config, outDirectory) {
22
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
23
23
  var buildDestinationDocsFolder = process.sasjsConstants.buildDestinationDocsFolder;
24
24
  if (!outDirectory) {
25
- outDirectory = ((_a = config === null || config === void 0 ? void 0 : config.docConfig) === null || _a === void 0 ? void 0 : _a.outDirectory) || buildDestinationDocsFolder;
26
- outDirectory = ((_b = target === null || target === void 0 ? void 0 : target.docConfig) === null || _b === void 0 ? void 0 : _b.outDirectory) || outDirectory;
25
+ outDirectory =
26
+ ((_a = target === null || target === void 0 ? void 0 : target.docConfig) === null || _a === void 0 ? void 0 : _a.outDirectory) ||
27
+ ((_b = config === null || config === void 0 ? void 0 : config.docConfig) === null || _b === void 0 ? void 0 : _b.outDirectory) ||
28
+ buildDestinationDocsFolder;
27
29
  }
28
30
  var serverUrl = '';
29
31
  serverUrl = ((_c = config === null || config === void 0 ? void 0 : config.docConfig) === null || _c === void 0 ? void 0 : _c.dataControllerUrl)
@@ -34,6 +36,9 @@ function getDocConfig(target, config, outDirectory) {
34
36
  : serverUrl;
35
37
  var enableLineage = (_h = (_f = (_e = target === null || target === void 0 ? void 0 : target.docConfig) === null || _e === void 0 ? void 0 : _e.enableLineage) !== null && _f !== void 0 ? _f : (_g = config === null || config === void 0 ? void 0 : config.docConfig) === null || _g === void 0 ? void 0 : _g.enableLineage) !== null && _h !== void 0 ? _h : true;
36
38
  var doxyContent = __assign(__assign({}, (_j = config === null || config === void 0 ? void 0 : config.docConfig) === null || _j === void 0 ? void 0 : _j.doxyContent), (_k = target === null || target === void 0 ? void 0 : target.docConfig) === null || _k === void 0 ? void 0 : _k.doxyContent);
39
+ if ((_l = doxyContent.path) === null || _l === void 0 ? void 0 : _l.startsWith('//')) {
40
+ throw new Error('UNC paths are not supported.\nPlease map to a network drive, or migrate the project to an existing path (with a drive letter).');
41
+ }
37
42
  return {
38
43
  target: target,
39
44
  serverUrl: serverUrl,
@@ -60,7 +60,6 @@ var types_1 = require("../../../types");
60
60
  describe('sasjs doc lineage', function () {
61
61
  var appName = "test-app-doc-" + utils_1.generateTimestamp();
62
62
  var docOutputDefault = path_1.default.join(__dirname, appName, 'sasjsbuild', 'docs');
63
- var doxyContentPath = path_1.default.join(__dirname, appName, 'sasjs', 'doxy');
64
63
  var defaultTarget;
65
64
  var defaultConfig;
66
65
  beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var getDocConfig_1 = require("../internal/getDocConfig");
4
+ var UNCErrorMessage = "UNC paths are not supported.\nPlease map to a network drive, or migrate the project to an existing path (with a drive letter).";
5
+ describe('getDocConfig', function () {
6
+ var sasjsConstants;
7
+ beforeAll(function () {
8
+ ;
9
+ (sasjsConstants = process.sasjsConstants);
10
+ process.sasjsConstants = {};
11
+ });
12
+ afterAll(function () {
13
+ process.sasjsConstants = sasjsConstants;
14
+ });
15
+ it('should throw for having UNC path picked up from target', function () {
16
+ var target = {
17
+ docConfig: { doxyContent: { path: '//server1/unc/path' } }
18
+ };
19
+ expect(function () { return getDocConfig_1.getDocConfig(target); }).toThrowError(UNCErrorMessage);
20
+ });
21
+ it('should throw for having UNC path picked up from config', function () {
22
+ var config = {
23
+ docConfig: { doxyContent: { path: '//server1/unc/path' } }
24
+ };
25
+ expect(function () { return getDocConfig_1.getDocConfig(undefined, config); }).toThrowError(UNCErrorMessage);
26
+ });
27
+ });
@@ -125,7 +125,7 @@ var FlowCommand = /** @class */ (function (_super) {
125
125
  target = (_b.sent()).target;
126
126
  sasjs = new node_1.default({
127
127
  serverUrl: target.serverUrl,
128
- allowInsecureRequests: target.allowInsecureRequests,
128
+ httpsAgentOptions: target.httpsAgentOptions,
129
129
  appLoc: target.appLoc,
130
130
  serverType: target.serverType
131
131
  });
@@ -54,7 +54,7 @@ describe('sasjs flow', function () {
54
54
  var target = generateTarget();
55
55
  var sasjs = new node_1.default({
56
56
  serverUrl: target.serverUrl,
57
- allowInsecureRequests: target.allowInsecureRequests,
57
+ httpsAgentOptions: target.httpsAgentOptions,
58
58
  appLoc: target.appLoc,
59
59
  serverType: target.serverType
60
60
  });
@@ -132,7 +132,7 @@ var FolderCommand = /** @class */ (function (_super) {
132
132
  }
133
133
  sasjs = new node_1.default({
134
134
  serverUrl: target.serverUrl,
135
- allowInsecureRequests: target.allowInsecureRequests,
135
+ httpsAgentOptions: target.httpsAgentOptions,
136
136
  appLoc: target.appLoc,
137
137
  serverType: target.serverType
138
138
  });
@@ -259,7 +259,7 @@ var FolderCommand = /** @class */ (function (_super) {
259
259
  }
260
260
  sasjs = new node_1.default({
261
261
  serverUrl: target.serverUrl,
262
- allowInsecureRequests: target.allowInsecureRequests,
262
+ httpsAgentOptions: target.httpsAgentOptions,
263
263
  appLoc: target.appLoc,
264
264
  serverType: target.serverType
265
265
  });
@@ -52,7 +52,7 @@ describe('sasjs folder operations', function () {
52
52
  var target = generateTarget();
53
53
  var sasjs = new node_1.default({
54
54
  serverUrl: target.serverUrl,
55
- allowInsecureRequests: target.allowInsecureRequests,
55
+ httpsAgentOptions: target.httpsAgentOptions,
56
56
  appLoc: target.appLoc,
57
57
  serverType: target.serverType
58
58
  });
@@ -0,0 +1,2 @@
1
+ export * from './viya';
2
+ export * from './sasjs';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./viya"), exports);
14
+ __exportStar(require("./sasjs"), exports);
@@ -0,0 +1,8 @@
1
+ import SASjs from '@sasjs/adapter/node';
2
+ export declare function executeJobSasjs(sasjs: SASjs, jobPath: string, logFile: string | undefined): Promise<{
3
+ status: string;
4
+ message: string;
5
+ log?: string | undefined;
6
+ logPath?: string | undefined;
7
+ error?: {} | undefined;
8
+ } | undefined>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
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 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.executeJobSasjs = void 0;
40
+ var utils_1 = require("../utils");
41
+ function executeJobSasjs(sasjs, jobPath, logFile) {
42
+ return __awaiter(this, void 0, void 0, function () {
43
+ var result;
44
+ return __generator(this, function (_a) {
45
+ switch (_a.label) {
46
+ case 0: return [4 /*yield*/, sasjs.executeJobSASjs({
47
+ _program: jobPath
48
+ })];
49
+ case 1:
50
+ result = _a.sent();
51
+ if (!result) return [3 /*break*/, 5];
52
+ if (!(result.status === 'success')) return [3 /*break*/, 4];
53
+ process.logger.success('Job executed successfully!');
54
+ if (!(logFile && result.log)) return [3 /*break*/, 3];
55
+ return [4 /*yield*/, utils_1.saveLog(result.log, logFile, jobPath, false)];
56
+ case 2:
57
+ _a.sent();
58
+ _a.label = 3;
59
+ case 3: return [3 /*break*/, 5];
60
+ case 4:
61
+ process.logger.error(result.message);
62
+ process.logger.error(JSON.stringify(result.error, null, 2));
63
+ _a.label = 5;
64
+ case 5: return [2 /*return*/, result];
65
+ }
66
+ });
67
+ });
68
+ }
69
+ exports.executeJobSasjs = executeJobSasjs;
@@ -15,5 +15,5 @@ import { Target, AuthConfig } from '@sasjs/utils';
15
15
  * @param {string | undefined} source - an optional path to a JSON file containing macro variables.
16
16
  * @param {boolean} streamLog - a flag indicating if the logs should be streamed to the supplied log path during job execution. This is useful for getting feedback on long running jobs.
17
17
  */
18
- export declare function execute(sasjs: SASjs, authConfig: AuthConfig, jobPath: string, target: Target, waitForJob: boolean, output: string | boolean, logFile: string | undefined, statusFile: string | undefined, returnStatusOnly: boolean, ignoreWarnings: boolean, source: string | undefined, streamLog: boolean): Promise<any>;
18
+ export declare function executeJobViya(sasjs: SASjs, authConfig: AuthConfig, jobPath: string, target: Target, waitForJob: boolean, output: string | boolean, logFile: string | undefined, statusFile: string | undefined, returnStatusOnly: boolean, ignoreWarnings: boolean, source: string | undefined, streamLog: boolean): Promise<any>;
19
19
  export declare function getContextName(target: Target, returnStatusOnly?: boolean): string;