@sasjs/cli 3.12.4 → 3.13.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.
package/build/cli.js CHANGED
@@ -48,13 +48,13 @@ function cli(args) {
48
48
  case 0: return [4 /*yield*/, (0, utils_1.setProjectDir)(args)];
49
49
  case 1:
50
50
  _a.sent();
51
- return [4 /*yield*/, (0, utils_1.setConstants)()];
51
+ return [4 /*yield*/, instantiateLogger()];
52
52
  case 2:
53
53
  _a.sent();
54
- return [4 /*yield*/, (0, utils_1.loadProjectEnvVariables)()];
54
+ return [4 /*yield*/, (0, utils_1.setConstants)()];
55
55
  case 3:
56
56
  _a.sent();
57
- return [4 /*yield*/, instantiateLogger()];
57
+ return [4 /*yield*/, (0, utils_1.loadProjectEnvVariables)()];
58
58
  case 4:
59
59
  _a.sent();
60
60
  command = (0, parse_1.parse)(args);
@@ -10,6 +10,25 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
13
32
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
33
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
34
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -54,7 +73,7 @@ exports.createEnvFileForSasjs = exports.createEnvFileForSas9 = exports.createEnv
54
73
  var path_1 = __importDefault(require("path"));
55
74
  var logger_1 = require("@sasjs/utils/logger");
56
75
  var types_1 = require("@sasjs/utils/types");
57
- var node_1 = __importDefault(require("@sasjs/adapter/node"));
76
+ var node_1 = __importStar(require("@sasjs/adapter/node"));
58
77
  var auth_1 = require("../../utils/auth");
59
78
  var utils_1 = require("@sasjs/utils");
60
79
  var input_1 = require("./internal/input");
@@ -174,7 +193,12 @@ var getTokens = function (target, client, secret, httpsAgentOptions) { return __
174
193
  });
175
194
  return [4 /*yield*/, (0, auth_1.getNewAccessToken)(adapter, client, secret, target).catch(function (e) {
176
195
  var _a;
177
- (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error("An error has occurred while validating your credentials: ".concat(e, "\nPlease check your Client ID ").concat(target.serverType === types_1.ServerType.Sasjs ? '' : 'and Client Secret ', "and try again.\n"));
196
+ var errorMessage = "An error has occurred while validating your credentials: ".concat(e);
197
+ var checkCredentialsMessage = "Please check your Client ID ".concat(target.serverType === types_1.ServerType.Sasjs ? '' : 'and Client Secret ', "and try again.\n");
198
+ var errorMessageToDisplay = e instanceof node_1.CertificateError
199
+ ? errorMessage
200
+ : "".concat(errorMessage, "\n").concat(checkCredentialsMessage);
201
+ (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(errorMessageToDisplay);
178
202
  throw e;
179
203
  })];
180
204
  case 1:
@@ -96,6 +96,7 @@ var config_1 = require("../../utils/config");
96
96
  var compile_1 = require("../compile/compile");
97
97
  var config_2 = require("./internal/config");
98
98
  var getLaunchPageCode_1 = require("./internal/getLaunchPageCode");
99
+ var types_1 = require("@sasjs/utils/types");
99
100
  function build(target) {
100
101
  return __awaiter(this, void 0, void 0, function () {
101
102
  return __generator(this, function (_a) {
@@ -115,7 +116,7 @@ exports.build = build;
115
116
  function createFinalSasFiles(target) {
116
117
  var _a, _b, _c, _d, _e, _f, _g;
117
118
  return __awaiter(this, void 0, void 0, function () {
118
- var streamConfig, streamWeb, buildConfig, serverType, name, macroFolders, buildOutputFileName, buildDestinationFolder, finalSasFileContent, finalFilePath, finalFilePathJSON, buildInfo, buildInit, buildTerm, macroCorePath, dependencyFilePaths, dependenciesContent, _h, folderContent, folderContentJSON;
119
+ var streamConfig, streamWeb, buildConfig, serverType, name, macroFolders, buildOutputFileName, buildDestinationFolder, finalSasFileContent, finalFilePath, finalFilePathJSON, buildInfo, buildInit, buildTerm, macroCorePath, dependencyFilePaths, dependenciesContent, _h, folderContent, folderContentJSON, servicePackSASjs, servicePack;
119
120
  return __generator(this, function (_j) {
120
121
  switch (_j.label) {
121
122
  case 0:
@@ -143,7 +144,7 @@ function createFinalSasFiles(target) {
143
144
  return [4 /*yield*/, (0, config_2.getBuildTerm)(target)];
144
145
  case 5:
145
146
  buildTerm = _j.sent();
146
- macroCorePath = (0, config_1.getMacroCorePath)();
147
+ macroCorePath = process.sasjsConstants.macroCorePath;
147
148
  return [4 /*yield*/, (0, utils_1.getDependencyPaths)("".concat(buildTerm, "\n").concat(buildInit), macroFolders, macroCorePath)];
148
149
  case 6:
149
150
  dependencyFilePaths = _j.sent();
@@ -154,6 +155,10 @@ function createFinalSasFiles(target) {
154
155
  return [4 /*yield*/, getFolderContent(serverType)];
155
156
  case 8:
156
157
  _h = _j.sent(), folderContent = _h.folderContent, folderContentJSON = _h.folderContentJSON;
158
+ servicePackSASjs = {
159
+ appLoc: target.appLoc,
160
+ fileTree: folderContentJSON
161
+ };
157
162
  finalSasFileContent += "\n".concat(folderContent);
158
163
  finalSasFileContent += "\n".concat(buildTerm);
159
164
  if (streamWeb) {
@@ -161,6 +166,11 @@ function createFinalSasFiles(target) {
161
166
  target.serverType === utils_1.ServerType.Sas9) {
162
167
  finalSasFileContent += (0, getLaunchPageCode_1.getLaunchPageCode)(target.serverType, streamConfig.streamServiceName);
163
168
  }
169
+ else if (target.serverType === utils_1.ServerType.Sasjs) {
170
+ servicePackSASjs.streamLogo = streamConfig.streamLogo;
171
+ servicePackSASjs.streamServiceName = streamConfig.streamServiceName;
172
+ servicePackSASjs.streamWebFolder = streamConfig.streamWebFolder;
173
+ }
164
174
  }
165
175
  finalSasFileContent = (0, utils_2.removeComments)(finalSasFileContent);
166
176
  (_d = process.logger) === null || _d === void 0 ? void 0 : _d.debug("Creating file ".concat(finalFilePath, " ."));
@@ -169,7 +179,10 @@ function createFinalSasFiles(target) {
169
179
  _j.sent();
170
180
  (_e = process.logger) === null || _e === void 0 ? void 0 : _e.success("File ".concat(finalFilePath, " has been created."));
171
181
  (_f = process.logger) === null || _f === void 0 ? void 0 : _f.debug("Creating file ".concat(finalFilePathJSON, " ."));
172
- return [4 /*yield*/, (0, utils_1.createFile)(finalFilePathJSON, JSON.stringify(folderContentJSON, null, 1))];
182
+ servicePack = target.serverType === utils_1.ServerType.Sasjs
183
+ ? servicePackSASjs
184
+ : folderContentJSON;
185
+ return [4 /*yield*/, (0, utils_1.createFile)(finalFilePathJSON, JSON.stringify(servicePack, null, 1))];
173
186
  case 10:
174
187
  _j.sent();
175
188
  (_g = process.logger) === null || _g === void 0 ? void 0 : _g.success("File ".concat(finalFilePathJSON, " has been created."));
@@ -192,7 +205,7 @@ function getBuildInfo(target, streamWeb) {
192
205
  return [4 /*yield*/, getCreateWebServiceScript(serverType)];
193
206
  case 2:
194
207
  createWebServiceScript = _a.sent();
195
- macroCorePath = (0, config_1.getMacroCorePath)();
208
+ macroCorePath = process.sasjsConstants.macroCorePath;
196
209
  buildConfig += "".concat(createWebServiceScript, "\n");
197
210
  return [4 /*yield*/, (0, utils_1.getDependencyPaths)(buildConfig, macroFolders, macroCorePath)];
198
211
  case 3:
@@ -209,7 +222,7 @@ function getBuildInfo(target, streamWeb) {
209
222
  ];
210
223
  case 5:
211
224
  dependencyFilePathsForCreateFile = _a.sent();
212
- return [4 /*yield*/, (0, utils_1.readFile)("".concat((0, config_1.getMacroCorePath)(), "/base/mp_replace.sas"))];
225
+ return [4 /*yield*/, (0, utils_1.readFile)("".concat(process.sasjsConstants.macroCorePath, "/base/mp_replace.sas"))];
213
226
  case 6:
214
227
  gsubScript = _a.sent();
215
228
  buildConfig += "".concat(gsubScript, "\n");
@@ -231,10 +244,11 @@ function getBuildInfo(target, streamWeb) {
231
244
  }
232
245
  function getCreateWebServiceScript(serverType) {
233
246
  return __awaiter(this, void 0, void 0, function () {
234
- var _a;
247
+ var macroCorePath, _a;
235
248
  return __generator(this, function (_b) {
236
249
  switch (_b.label) {
237
250
  case 0:
251
+ macroCorePath = process.sasjsConstants.macroCorePath;
238
252
  _a = serverType;
239
253
  switch (_a) {
240
254
  case utils_1.ServerType.SasViya: return [3 /*break*/, 1];
@@ -242,15 +256,15 @@ function getCreateWebServiceScript(serverType) {
242
256
  case utils_1.ServerType.Sasjs: return [3 /*break*/, 5];
243
257
  }
244
258
  return [3 /*break*/, 7];
245
- case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat((0, config_1.getMacroCorePath)(), "/viya/mv_createwebservice.sas"))];
259
+ case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createwebservice.sas"))];
246
260
  case 2: return [2 /*return*/, _b.sent()];
247
- case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat((0, config_1.getMacroCorePath)(), "/meta/mm_createwebservice.sas"))
261
+ case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/meta/mm_createwebservice.sas"))
248
262
  // FIXME: use sasjs/mv_createwebservice.sas ones created
249
263
  ];
250
264
  case 4: return [2 /*return*/, _b.sent()
251
265
  // FIXME: use sasjs/mv_createwebservice.sas ones created
252
266
  ];
253
- case 5: return [4 /*yield*/, (0, utils_1.readFile)("".concat((0, config_1.getMacroCorePath)(), "/viya/mv_createwebservice.sas"))];
267
+ case 5: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createwebservice.sas"))];
254
268
  case 6: return [2 /*return*/, _b.sent()];
255
269
  case 7: throw new error_1.ServerTypeError();
256
270
  }
@@ -259,23 +273,24 @@ function getCreateWebServiceScript(serverType) {
259
273
  }
260
274
  function getCreateFileScript(serverType) {
261
275
  return __awaiter(this, void 0, void 0, function () {
262
- var _a;
276
+ var macroCorePath, _a;
263
277
  return __generator(this, function (_b) {
264
278
  switch (_b.label) {
265
279
  case 0:
280
+ macroCorePath = process.sasjsConstants.macroCorePath;
266
281
  _a = serverType;
267
282
  switch (_a) {
268
283
  case utils_1.ServerType.SasViya: return [3 /*break*/, 1];
269
284
  case utils_1.ServerType.Sasjs: return [3 /*break*/, 3];
270
285
  }
271
286
  return [3 /*break*/, 5];
272
- case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat((0, config_1.getMacroCorePath)(), "/viya/mv_createfile.sas"))
287
+ case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createfile.sas"))
273
288
  // FIXME: use sasjs/mv_createfile.sas ones created
274
289
  ];
275
290
  case 2: return [2 /*return*/, _b.sent()
276
291
  // FIXME: use sasjs/mv_createfile.sas ones created
277
292
  ];
278
- case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat((0, config_1.getMacroCorePath)(), "/viya/mv_createfile.sas"))];
293
+ case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createfile.sas"))];
279
294
  case 4: return [2 /*return*/, _b.sent()];
280
295
  case 5: throw new error_1.ServerTypeError([utils_1.ServerType.SasViya, utils_1.ServerType.Sasjs]);
281
296
  }
@@ -384,7 +399,7 @@ function getContentFor(rootDirectory, folderPath, serverType) {
384
399
  .join('/'), ";\n");
385
400
  contentJSON = {
386
401
  name: folderName,
387
- type: 'folder',
402
+ type: types_1.MemberType.folder,
388
403
  members: []
389
404
  };
390
405
  return [4 /*yield*/, (0, utils_1.listFilesInFolder)(folderPath)];
@@ -404,7 +419,7 @@ function getContentFor(rootDirectory, folderPath, serverType) {
404
419
  content += "\n".concat(transformedContent, "\n");
405
420
  contentJSON.members.push({
406
421
  name: file.replace(/.sas$/, ''),
407
- type: 'service',
422
+ type: types_1.MemberType.service,
408
423
  code: (0, utils_2.removeComments)(fileContent)
409
424
  });
410
425
  return [3 /*break*/, 4];
@@ -415,7 +430,7 @@ function getContentFor(rootDirectory, folderPath, serverType) {
415
430
  content += "\n".concat(transformedContent, "\n");
416
431
  contentJSON.members.push({
417
432
  name: file.replace(/.sas$/, ''),
418
- type: 'file',
433
+ type: types_1.MemberType.file,
419
434
  code: fileContentEncoded
420
435
  });
421
436
  _a.label = 4;
@@ -37,7 +37,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getPreCodeForServicePack = exports.compileServiceFile = void 0;
40
- var config_1 = require("../../../utils/config");
41
40
  var utils_1 = require("@sasjs/utils");
42
41
  var types_1 = require("@sasjs/utils/types");
43
42
  var error_1 = require("@sasjs/utils/error");
@@ -75,7 +74,7 @@ function getPreCodeForServicePack(serverType) {
75
74
  switch (_l.label) {
76
75
  case 0:
77
76
  content = '';
78
- macroCorePath = (0, config_1.getMacroCorePath)();
77
+ macroCorePath = process.sasjsConstants.macroCorePath;
79
78
  _a = serverType;
80
79
  switch (_a) {
81
80
  case types_1.ServerType.SasViya: return [3 /*break*/, 1];
@@ -57,12 +57,12 @@ var deployToSasViyaWithServicePack_1 = require("../shared/deployToSasViyaWithSer
57
57
  * @param {object} sasjs - optional configuration object of SAS adapter.
58
58
  */
59
59
  function deploy(target, isLocal, sasjs) {
60
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
60
+ var _a, _b, _c, _d, _e, _f, _g, _h;
61
61
  return __awaiter(this, void 0, void 0, function () {
62
- var appLoc, buildDestinationFolder_1, finalFilePathJSON, jsonObject, webIndexFileName, deployScripts, buildDestinationFolder, logFilePath, streamConfig;
62
+ var appLoc, buildDestinationFolder_1, finalFilePathJSON, jsonObject, servicesFolder, webIndexFileName, deployScripts, buildDestinationFolder, logFilePath, streamConfig;
63
63
  var _this = this;
64
- return __generator(this, function (_k) {
65
- switch (_k.label) {
64
+ return __generator(this, function (_j) {
65
+ switch (_j.label) {
66
66
  case 0:
67
67
  if (!(target.serverType === utils_2.ServerType.SasViya &&
68
68
  ((_a = target.deployConfig) === null || _a === void 0 ? void 0 : _a.deployServicePack))) return [3 /*break*/, 2];
@@ -72,30 +72,31 @@ function deploy(target, isLocal, sasjs) {
72
72
  finalFilePathJSON = path_1.default.join(buildDestinationFolder_1, "".concat(target.name, ".json"));
73
73
  return [4 /*yield*/, (0, deployToSasViyaWithServicePack_1.deployToSasViyaWithServicePack)(finalFilePathJSON, target, isLocal, true)];
74
74
  case 1:
75
- jsonObject = _k.sent();
76
- webIndexFileName = (_f = (_e = (_d = (_c = jsonObject === null || jsonObject === void 0 ? void 0 : jsonObject.members.find(function (member) {
77
- return (member === null || member === void 0 ? void 0 : member.name) === 'services' && (member === null || member === void 0 ? void 0 : member.type) === 'folder';
78
- })) === null || _c === void 0 ? void 0 : _c.members) === null || _d === void 0 ? void 0 : _d.find(function (member) { return (member === null || member === void 0 ? void 0 : member.type) === 'file'; })) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '';
79
- (_g = process.logger) === null || _g === void 0 ? void 0 : _g.success('Build pack has been successfully deployed.');
80
- (_h = process.logger) === null || _h === void 0 ? void 0 : _h.success(target.serverType === utils_2.ServerType.SasViya && webIndexFileName
75
+ jsonObject = _j.sent();
76
+ servicesFolder = jsonObject === null || jsonObject === void 0 ? void 0 : jsonObject.members.find(function (member) {
77
+ return (member === null || member === void 0 ? void 0 : member.name) === 'services' && (member === null || member === void 0 ? void 0 : member.type) === utils_2.MemberType.folder;
78
+ });
79
+ webIndexFileName = (_e = (_d = (_c = servicesFolder === null || servicesFolder === void 0 ? void 0 : servicesFolder.members) === null || _c === void 0 ? void 0 : _c.find(function (member) { return (member === null || member === void 0 ? void 0 : member.type) === utils_2.MemberType.file; })) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : '';
80
+ (_f = process.logger) === null || _f === void 0 ? void 0 : _f.success('Build pack has been successfully deployed.');
81
+ (_g = process.logger) === null || _g === void 0 ? void 0 : _g.success(target.serverType === utils_2.ServerType.SasViya && webIndexFileName
81
82
  ? "".concat(target.serverUrl, "/SASJobExecution?_file=").concat(appLoc, "/services/").concat(webIndexFileName, "&_debug=2")
82
83
  : "".concat(target.serverUrl, "/SASJobExecution?_folder=").concat(appLoc));
83
- _k.label = 2;
84
+ _j.label = 2;
84
85
  case 2: return [4 /*yield*/, (0, getDeployScripts_1.getDeployScripts)(target)];
85
86
  case 3:
86
- deployScripts = _k.sent();
87
- if (deployScripts.length === 0 && !((_j = target.deployConfig) === null || _j === void 0 ? void 0 : _j.deployServicePack)) {
87
+ deployScripts = _j.sent();
88
+ if (deployScripts.length === 0 && !((_h = target.deployConfig) === null || _h === void 0 ? void 0 : _h.deployServicePack)) {
88
89
  throw new Error("Deployment failed.\nPlease either enable the 'deployServicePack' option or add deployment script paths to 'deployScripts' in your target's 'deployConfig'.");
89
90
  }
90
91
  buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
91
92
  logFilePath = buildDestinationFolder;
92
93
  return [4 /*yield*/, (0, config_1.getStreamConfig)(target)];
93
94
  case 4:
94
- streamConfig = _k.sent();
95
+ streamConfig = _j.sent();
95
96
  if (!(target.serverType === utils_2.ServerType.Sasjs)) return [3 /*break*/, 6];
96
97
  return [4 /*yield*/, deployToSasjs(target, sasjs, streamConfig)];
97
98
  case 5:
98
- _k.sent();
99
+ _j.sent();
99
100
  return [3 /*break*/, 8];
100
101
  case 6: return [4 /*yield*/, (0, utils_2.asyncForEach)(deployScripts, function (deployScript) { return __awaiter(_this, void 0, void 0, function () {
101
102
  var deployScriptPath, deployScriptContent, linesToExecute, deployScriptName, logPath;
@@ -139,8 +140,8 @@ function deploy(target, isLocal, sasjs) {
139
140
  });
140
141
  }); })];
141
142
  case 7:
142
- _k.sent();
143
- _k.label = 8;
143
+ _j.sent();
144
+ _j.label = 8;
144
145
  case 8: return [2 /*return*/];
145
146
  }
146
147
  });
@@ -364,7 +365,7 @@ function deployToSasjs(target, sasjs, streamConfig) {
364
365
  e_2 = _d.sent();
365
366
  return [3 /*break*/, 5];
366
367
  case 5: return [4 /*yield*/, sasjs
367
- .deployToSASjs(payload, undefined, streamConfig, authConfig)
368
+ .deployToSASjs(payload, undefined, authConfig)
368
369
  .catch(function (err) {
369
370
  var _a;
370
371
  (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
@@ -90,7 +90,7 @@ var DeployCommand = /** @class */ (function (_super) {
90
90
  })
91
91
  .catch(function (err) {
92
92
  var _a;
93
- (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('An error has occurred when deploying services: ', err);
93
+ (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error("An error has occurred when deploying services: ".concat(err));
94
94
  return command_1.ReturnCode.InternalError;
95
95
  })];
96
96
  case 2: return [2 /*return*/, _b.sent()];
@@ -133,33 +133,36 @@ describe('sasjs cbd with server type SASJS', function () {
133
133
  webSourcePath: ''
134
134
  };
135
135
  expect(sasjs.deployToSASjs).toHaveBeenCalledWith({
136
- members: [
137
- {
138
- name: 'services',
139
- type: 'folder',
140
- members: [
141
- {
142
- name: 'common',
143
- type: 'folder',
144
- members: [
145
- {
146
- name: 'appinit',
147
- type: 'service',
148
- code: (0, utils_3.removeComments)("".concat(mf_getuser).concat(mp_jsonout).concat(ms_webout).concat(webout) +
149
- '/* provide additional debug info */\n%global _program;\n%put &=syscc;\n%put user=%mf_getuser();\n%put pgm=&_program;\n%put timestamp=%sysfunc(datetime(),datetime19.);\n* Service Variables start;\n* Service Variables end;\n* SAS Macros start;\n* SAS Macros end;\n* SAS Includes start;\n* SAS Includes end;\n* Binary Files start;\n* Binary Files end;\n* Service start;\nproc sql;\ncreate table areas as select distinct area\n from sashelp.springs;\n%webout(OPEN)\n%webout(OBJ,areas)\n%webout(CLOSE)\n* Service end;')
150
- },
151
- {
152
- name: 'getdata',
153
- type: 'service',
154
- code: (0, utils_3.removeComments)("".concat(mf_getuser).concat(mp_jsonout).concat(ms_webout).concat(webout) +
155
- '/* provide additional debug info */\n%global _program;\n%put &=syscc;\n%put user=%mf_getuser();\n%put pgm=&_program;\n%put timestamp=%sysfunc(datetime(),datetime19.);\n* Service Variables start;\n* Service Variables end;\n* SAS Macros start;\n* SAS Macros end;\n* SAS Includes start;\n* SAS Includes end;\n* Binary Files start;\n* Binary Files end;\n* Service start;\n%webout(FETCH)\nproc sql;\ncreate table springs as select * from sashelp.springs\n where area in (select area from work.areas);\n%webout(OPEN)\n%webout(OBJ,springs)\n%webout(CLOSE)\n* Service end;')
156
- }
157
- ]
158
- }
159
- ]
160
- }
161
- ]
162
- }, undefined, streamConfig, undefined);
136
+ appLoc: target.appLoc,
137
+ fileTree: {
138
+ members: [
139
+ {
140
+ name: 'services',
141
+ type: 'folder',
142
+ members: [
143
+ {
144
+ name: 'common',
145
+ type: 'folder',
146
+ members: [
147
+ {
148
+ name: 'appinit',
149
+ type: 'service',
150
+ code: (0, utils_3.removeComments)("".concat(mf_getuser).concat(mp_jsonout).concat(ms_webout).concat(webout) +
151
+ '/* provide additional debug info */\n%global _program;\n%put &=syscc;\n%put user=%mf_getuser();\n%put pgm=&_program;\n%put timestamp=%sysfunc(datetime(),datetime19.);\n* Service Variables start;\n* Service Variables end;\n* SAS Macros start;\n* SAS Macros end;\n* SAS Includes start;\n* SAS Includes end;\n* Binary Files start;\n* Binary Files end;\n* Service start;\nproc sql;\ncreate table areas as select distinct area\n from sashelp.springs;\n%webout(OPEN)\n%webout(OBJ,areas)\n%webout(CLOSE)\n* Service end;')
152
+ },
153
+ {
154
+ name: 'getdata',
155
+ type: 'service',
156
+ code: (0, utils_3.removeComments)("".concat(mf_getuser).concat(mp_jsonout).concat(ms_webout).concat(webout) +
157
+ '/* provide additional debug info */\n%global _program;\n%put &=syscc;\n%put user=%mf_getuser();\n%put pgm=&_program;\n%put timestamp=%sysfunc(datetime(),datetime19.);\n* Service Variables start;\n* Service Variables end;\n* SAS Macros start;\n* SAS Macros end;\n* SAS Includes start;\n* SAS Includes end;\n* Binary Files start;\n* Binary Files end;\n* Service start;\n%webout(FETCH)\nproc sql;\ncreate table springs as select * from sashelp.springs\n where area in (select area from work.areas);\n%webout(OPEN)\n%webout(OBJ,springs)\n%webout(CLOSE)\n* Service end;')
158
+ }
159
+ ]
160
+ }
161
+ ]
162
+ }
163
+ ]
164
+ }
165
+ }, undefined, undefined);
163
166
  return [2 /*return*/];
164
167
  }
165
168
  });
@@ -1,3 +1,2 @@
1
- import { Target } from '@sasjs/utils';
2
- import { ServicePack } from '../../types';
3
- export declare function deployToSasViyaWithServicePack(jsonFilePath: string, target: Target, isLocal: boolean, isForced?: boolean): Promise<ServicePack>;
1
+ import { FileTree, Target } from '@sasjs/utils';
2
+ export declare function deployToSasViyaWithServicePack(jsonFilePath: string, target: Target, isLocal: boolean, isForced?: boolean): Promise<FileTree>;
@@ -85,9 +85,9 @@ exports.deployToSasViyaWithServicePack = deployToSasViyaWithServicePack;
85
85
  var populateCodeInServicePack = function (json) {
86
86
  var _a;
87
87
  return (_a = json === null || json === void 0 ? void 0 : json.members) === null || _a === void 0 ? void 0 : _a.forEach(function (member) {
88
- if (member.type === 'file')
88
+ if (member.type === utils_1.MemberType.file)
89
89
  member.code = (0, js_base64_1.decode)(member.code);
90
- if (member.type === 'folder')
90
+ if (member.type === utils_1.MemberType.folder)
91
91
  populateCodeInServicePack(member);
92
92
  });
93
93
  };
@@ -4,4 +4,3 @@ export { Folder } from './folder';
4
4
  export { TargetScope } from './targetScope';
5
5
  export { TestFlow, Coverage, CoverageType, CoverageState, TestResults, TestResultStatus, TestDescription, TestResult, TestResultDescription, TestResultCsv } from './testing';
6
6
  export { Flow, FlowWave, FlowWaveJob } from './flow';
7
- export { ServicePack, ServicePackMember } from './servicePack';
@@ -52,7 +52,6 @@ export declare function getMacroFolders(target?: Target): Promise<string[]>;
52
52
  * @param {Target} target- the target to check stream configuration for.
53
53
  */
54
54
  export declare function getStreamConfig(target?: Target): Promise<StreamConfig>;
55
- export declare const getMacroCorePath: () => string;
56
55
  /**
57
56
  * Sanitizes app location string.
58
57
  * @param {string} appLoc - app location
@@ -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.getMacroCorePath = 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.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;
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");
@@ -415,16 +415,20 @@ function saveGlobalRcFile(content) {
415
415
  }
416
416
  exports.saveGlobalRcFile = saveGlobalRcFile;
417
417
  function saveToGlobalConfig(target, isDefault, saveWithDefaultValues) {
418
+ var _a;
418
419
  if (isDefault === void 0) { isDefault = false; }
419
420
  if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
420
421
  return __awaiter(this, void 0, void 0, function () {
421
422
  var globalConfig, targetJson, existingTargetIndex;
422
- return __generator(this, function (_a) {
423
- switch (_a.label) {
423
+ return __generator(this, function (_b) {
424
+ switch (_b.label) {
424
425
  case 0: return [4 /*yield*/, getGlobalRcFile()];
425
426
  case 1:
426
- globalConfig = _a.sent();
427
+ globalConfig = _b.sent();
427
428
  targetJson = target.toJson(saveWithDefaultValues);
429
+ if ((_a = targetJson.httpsAgentOptions) === null || _a === void 0 ? void 0 : _a.ca) {
430
+ targetJson.httpsAgentOptions.ca = undefined;
431
+ }
428
432
  if (globalConfig) {
429
433
  if (globalConfig.targets && globalConfig.targets.length) {
430
434
  existingTargetIndex = globalConfig.targets.findIndex(function (t) { return t.name === target.name; });
@@ -446,7 +450,7 @@ function saveToGlobalConfig(target, isDefault, saveWithDefaultValues) {
446
450
  globalConfig.defaultTarget = target.name;
447
451
  }
448
452
  return [4 /*yield*/, saveGlobalRcFile(JSON.stringify(globalConfig, null, 2))];
449
- case 2: return [2 /*return*/, _a.sent()];
453
+ case 2: return [2 /*return*/, _b.sent()];
450
454
  }
451
455
  });
452
456
  });
@@ -552,20 +556,23 @@ function saveLocalConfigFile(content) {
552
556
  }
553
557
  exports.saveLocalConfigFile = saveLocalConfigFile;
554
558
  function saveToLocalConfig(target, isDefault, saveWithDefaultValues) {
555
- var _a;
559
+ var _a, _b;
556
560
  if (isDefault === void 0) { isDefault = false; }
557
561
  if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
558
562
  return __awaiter(this, void 0, void 0, function () {
559
563
  var targetJson, config, existingTargetIndex, configPath;
560
- return __generator(this, function (_b) {
561
- switch (_b.label) {
564
+ return __generator(this, function (_c) {
565
+ switch (_c.label) {
562
566
  case 0:
563
567
  targetJson = target.toJson(saveWithDefaultValues);
568
+ if ((_a = targetJson.httpsAgentOptions) === null || _a === void 0 ? void 0 : _a.ca) {
569
+ targetJson.httpsAgentOptions.ca = undefined;
570
+ }
564
571
  return [4 /*yield*/, getLocalConfig()];
565
572
  case 1:
566
- config = _b.sent();
573
+ config = _c.sent();
567
574
  if (config) {
568
- if ((_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.length) {
575
+ if ((_b = config === null || config === void 0 ? void 0 : config.targets) === null || _b === void 0 ? void 0 : _b.length) {
569
576
  existingTargetIndex = config.targets.findIndex(function (t) { return t.name === target.name; });
570
577
  if (existingTargetIndex > -1) {
571
578
  config.targets[existingTargetIndex] = targetJson;
@@ -587,7 +594,7 @@ function saveToLocalConfig(target, isDefault, saveWithDefaultValues) {
587
594
  configPath = path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json');
588
595
  return [4 /*yield*/, (0, utils_1.createFile)(configPath, JSON.stringify(config, null, 2))];
589
596
  case 2:
590
- _b.sent();
597
+ _c.sent();
591
598
  return [2 /*return*/, configPath];
592
599
  }
593
600
  });
@@ -720,8 +727,6 @@ function getStreamConfig(target) {
720
727
  });
721
728
  }
722
729
  exports.getStreamConfig = getStreamConfig;
723
- var getMacroCorePath = function () { return process.sasjsConstants.macroCorePath; };
724
- exports.getMacroCorePath = getMacroCorePath;
725
730
  /**
726
731
  * Sanitizes app location string.
727
732
  * @param {string} appLoc - app location
@@ -988,32 +993,30 @@ var overrideEnvVariables = function (targetName) { return __awaiter(void 0, void
988
993
  }); };
989
994
  exports.overrideEnvVariables = overrideEnvVariables;
990
995
  var getPrecedenceOfHttpsAgentOptionsAndContent = function (config, target) { return __awaiter(void 0, void 0, void 0, function () {
991
- var httpsAgentOptions, _a, _b, _c;
992
- return __generator(this, function (_d) {
993
- switch (_d.label) {
996
+ var httpsAgentOptions, rootCas, _a, _b;
997
+ return __generator(this, function (_c) {
998
+ switch (_c.label) {
994
999
  case 0:
995
1000
  httpsAgentOptions = getHttpsAgentOptionsForInsecure(__assign(__assign({ allowInsecureRequests: false }, config.httpsAgentOptions), target.httpsAgentOptions));
996
- if (!httpsAgentOptions.caPath) return [3 /*break*/, 2];
1001
+ if (httpsAgentOptions.caPath) {
1002
+ rootCas = require('ssl-root-cas');
1003
+ rootCas.addFile(path_1.default.resolve(httpsAgentOptions.caPath));
1004
+ httpsAgentOptions.ca = rootCas;
1005
+ }
1006
+ if (!httpsAgentOptions.keyPath) return [3 /*break*/, 2];
997
1007
  _a = httpsAgentOptions;
998
- return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.caPath)];
1008
+ return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.keyPath)];
999
1009
  case 1:
1000
- _a.ca = _d.sent();
1001
- _d.label = 2;
1010
+ _a.key = _c.sent();
1011
+ _c.label = 2;
1002
1012
  case 2:
1003
- if (!httpsAgentOptions.keyPath) return [3 /*break*/, 4];
1013
+ if (!httpsAgentOptions.certPath) return [3 /*break*/, 4];
1004
1014
  _b = httpsAgentOptions;
1005
- return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.keyPath)];
1006
- case 3:
1007
- _b.key = _d.sent();
1008
- _d.label = 4;
1009
- case 4:
1010
- if (!httpsAgentOptions.certPath) return [3 /*break*/, 6];
1011
- _c = httpsAgentOptions;
1012
1015
  return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.certPath)];
1013
- case 5:
1014
- _c.cert = _d.sent();
1015
- _d.label = 6;
1016
- case 6: return [2 /*return*/, httpsAgentOptions];
1016
+ case 3:
1017
+ _b.cert = _c.sent();
1018
+ _c.label = 4;
1019
+ case 4: return [2 /*return*/, httpsAgentOptions];
1017
1020
  }
1018
1021
  });
1019
1022
  }); };
@@ -41,62 +41,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.setConstants = exports.contextName = void 0;
43
43
  var path_1 = __importDefault(require("path"));
44
- var get_installed_path_1 = require("get-installed-path");
45
44
  var config_1 = require("./config");
46
- var utils_1 = require("@sasjs/utils");
45
+ var utils_1 = require("./utils");
46
+ var utils_2 = require("@sasjs/utils");
47
47
  exports.contextName = 'sasjs cli compute context';
48
48
  var setConstants = function () { return __awaiter(void 0, void 0, void 0, function () {
49
- var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, getMacroCoreGlobalPath, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, _b, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError;
50
- var _c, _d;
51
- return __generator(this, function (_e) {
52
- switch (_e.label) {
49
+ var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError;
50
+ var _b, _c;
51
+ return __generator(this, function (_d) {
52
+ switch (_d.label) {
53
53
  case 0: return [4 /*yield*/, (0, config_1.getLocalOrGlobalConfig)().catch(function () { return ({
54
54
  configuration: null,
55
55
  isLocal: false
56
56
  }); })];
57
57
  case 1:
58
- _a = _e.sent(), configuration = _a.configuration, isLocal = _a.isLocal;
59
- buildOutputFolder = ((_c = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _c === void 0 ? void 0 : _c.buildOutputFolder) ||
58
+ _a = _d.sent(), configuration = _a.configuration, isLocal = _a.isLocal;
59
+ buildOutputFolder = ((_b = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _b === void 0 ? void 0 : _b.buildOutputFolder) ||
60
60
  (isLocal ? 'sasjsbuild' : '.sasjs/sasjsbuild');
61
- buildResultsFolder = ((_d = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _d === void 0 ? void 0 : _d.buildResultsFolder) ||
61
+ buildResultsFolder = ((_c = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _c === void 0 ? void 0 : _c.buildResultsFolder) ||
62
62
  (isLocal ? 'sasjsresults' : '.sasjs/sasjsresults');
63
63
  homeDir = require('os').homedir();
64
- getMacroCoreGlobalPath = function () { return __awaiter(void 0, void 0, void 0, function () {
65
- var sasjsPath, macroCoreGlobal, e_1;
66
- return __generator(this, function (_a) {
67
- switch (_a.label) {
68
- case 0:
69
- _a.trys.push([0, 2, , 3]);
70
- return [4 /*yield*/, (0, get_installed_path_1.getInstalledPath)('@sasjs/cli')];
71
- case 1:
72
- sasjsPath = _a.sent();
73
- macroCoreGlobal = path_1.default.join(sasjsPath, 'node_modules', '@sasjs', 'core');
74
- return [2 /*return*/, macroCoreGlobal];
75
- case 2:
76
- e_1 = _a.sent();
77
- throw 'Please install SASjs cli `npm i -g @sasjs/cli`';
78
- case 3: return [2 /*return*/];
79
- }
80
- });
81
- }); };
82
64
  buildSourceFolder = path_1.default.join(isLocal ? process.projectDir : homeDir);
83
65
  buildSourceDbFolder = path_1.default.join(isLocal ? process.projectDir : homeDir, 'sasjs', 'db');
84
- buildDestinationFolder = (0, utils_1.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
66
+ buildDestinationFolder = (0, utils_2.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
85
67
  buildDestinationServicesFolder = path_1.default.join(buildDestinationFolder, 'services');
86
68
  buildDestinationTestFolder = path_1.default.join(buildDestinationFolder, 'tests');
87
69
  buildDestinationJobsFolder = path_1.default.join(buildDestinationFolder, 'jobs');
88
70
  buildDestinationDbFolder = path_1.default.join(buildDestinationFolder, 'db');
89
71
  buildDestinationDocsFolder = path_1.default.join(buildDestinationFolder, 'docs');
90
- if (!isLocal) return [3 /*break*/, 2];
91
- _b = path_1.default.join(buildSourceFolder, 'node_modules', '@sasjs/core');
92
- return [3 /*break*/, 4];
93
- case 2: return [4 /*yield*/, getMacroCoreGlobalPath()];
94
- case 3:
95
- _b = _e.sent();
96
- _e.label = 4;
97
- case 4:
98
- macroCorePath = _b;
99
- buildDestinationResultsFolder = (0, utils_1.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
72
+ return [4 /*yield*/, (0, utils_1.getCliNodeModulePath)('@sasjs/core')];
73
+ case 2:
74
+ macroCorePath = _d.sent();
75
+ buildDestinationResultsFolder = (0, utils_2.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
100
76
  buildDestinationResultsLogsFolder = path_1.default.join(buildDestinationResultsFolder, 'logs');
101
77
  sas9CredentialsError = 'The following attributes were not found:' +
102
78
  '\n* SAS_USERNAME' +
@@ -58,10 +58,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
58
58
  return (mod && mod.__esModule) ? mod : { "default": mod };
59
59
  };
60
60
  Object.defineProperty(exports, "__esModule", { value: true });
61
- var utils_1 = require("@sasjs/utils");
62
61
  var path_1 = __importDefault(require("path"));
63
62
  var configUtils = __importStar(require("../config"));
64
63
  var setConstants_1 = require("../setConstants");
64
+ var fileModule = __importStar(require("@sasjs/utils/file"));
65
65
  describe('setConstants', function () {
66
66
  var config;
67
67
  beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -71,17 +71,20 @@ describe('setConstants', function () {
71
71
  case 0:
72
72
  ;
73
73
  _b = (_a = JSON).parse;
74
- return [4 /*yield*/, (0, utils_1.readFile)(path_1.default.join(__dirname, '..', '..', 'config.json'))];
74
+ return [4 /*yield*/, fileModule.readFile(path_1.default.join(__dirname, '..', '..', 'config.json'))];
75
75
  case 1:
76
76
  (config = _b.apply(_a, [_c.sent()]).config);
77
77
  return [2 /*return*/];
78
78
  }
79
79
  });
80
80
  }); });
81
- test('should set contants inside appFolder', function () { return __awaiter(void 0, void 0, void 0, function () {
81
+ test('should set constants inside appFolder', function () { return __awaiter(void 0, void 0, void 0, function () {
82
+ var appFolder;
82
83
  return __generator(this, function (_a) {
83
84
  switch (_a.label) {
84
85
  case 0:
86
+ appFolder = ['some', 'app', 'folder'].join(path_1.default.sep);
87
+ process.projectDir = appFolder;
85
88
  jest
86
89
  .spyOn(configUtils, 'getLocalOrGlobalConfig')
87
90
  .mockImplementation(function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -92,7 +95,10 @@ describe('setConstants', function () {
92
95
  })];
93
96
  });
94
97
  }); });
95
- process.projectDir = ['some', 'app', 'folder'].join(path_1.default.sep);
98
+ jest.spyOn(process, 'cwd').mockImplementation(function () { return appFolder; });
99
+ jest
100
+ .spyOn(fileModule, 'folderExists')
101
+ .mockImplementation(function () { return Promise.resolve(true); });
96
102
  return [4 /*yield*/, (0, setConstants_1.setConstants)()];
97
103
  case 1:
98
104
  _a.sent();
@@ -101,7 +107,7 @@ describe('setConstants', function () {
101
107
  }
102
108
  });
103
109
  }); });
104
- test('should set contants outside appFolder', function () { return __awaiter(void 0, void 0, void 0, function () {
110
+ test('should set constants outside appFolder', function () { return __awaiter(void 0, void 0, void 0, function () {
105
111
  return __generator(this, function (_a) {
106
112
  switch (_a.label) {
107
113
  case 0:
@@ -137,15 +143,11 @@ var verifySasjsConstants = function (appFolder) {
137
143
  expect(sasjsConstants.buildDestinationResultsFolder).toEqual([prefixAppFolder, 'sasjsresults'].join(path_1.default.sep));
138
144
  expect(sasjsConstants.buildDestinationResultsLogsFolder).toEqual([prefixAppFolder, 'sasjsresults', 'logs'].join(path_1.default.sep));
139
145
  expect(sasjsConstants.buildDestinationTestFolder).toEqual([prefixAppFolder, 'sasjsbuild', 'tests'].join(path_1.default.sep));
140
- if (appFolder)
141
- expect(sasjsConstants.macroCorePath).toEqual([prefixAppFolder, 'node_modules', '@sasjs', 'core'].join(path_1.default.sep));
142
- else
143
- expect(sasjsConstants.macroCorePath).toEqual(expect.toEndWith([
144
- 'node_modules',
145
- '@sasjs',
146
- 'cli',
147
- 'node_modules',
148
- '@sasjs',
149
- 'core'
150
- ].join(path_1.default.sep)));
146
+ var corePath = path_1.default.join('cli', 'node_modules', '@sasjs', 'core');
147
+ if (appFolder) {
148
+ expect(sasjsConstants.macroCorePath).toEqual(path_1.default.join(prefixAppFolder, 'node_modules', '@sasjs', corePath));
149
+ }
150
+ else {
151
+ expect(sasjsConstants.macroCorePath).toEqual(expect.toEndWith(corePath));
152
+ }
151
153
  };
@@ -43,3 +43,4 @@ export declare const terminateProcess: (status: number) => never;
43
43
  * @returns boolean
44
44
  */
45
45
  export declare const isSASjsProject: () => Promise<boolean>;
46
+ export declare const getCliNodeModulePath: (module: string) => Promise<string>;
@@ -86,7 +86,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
86
86
  return (mod && mod.__esModule) ? mod : { "default": mod };
87
87
  };
88
88
  Object.defineProperty(exports, "__esModule", { value: true });
89
- exports.isSASjsProject = exports.terminateProcess = exports.prefixAppLoc = exports.loadEnvVariables = exports.displaySasjsRunnerError = exports.getAdapterInstance = exports.checkNodeVersion = exports.millisecondsToDdHhMmSs = exports.arrToObj = exports.parseLogLines = exports.executeShellScript = exports.getUniqServicesObj = exports.removeComments = exports.setupDoxygen = exports.setupGhooks = exports.setupGitIgnore = exports.setupNpmProject = exports.createTemplateApp = exports.createMinimalApp = exports.createAngularApp = exports.createReactApp = exports.diff = exports.inExistingProject = void 0;
89
+ exports.getCliNodeModulePath = exports.isSASjsProject = exports.terminateProcess = exports.prefixAppLoc = exports.loadEnvVariables = exports.displaySasjsRunnerError = exports.getAdapterInstance = exports.checkNodeVersion = exports.millisecondsToDdHhMmSs = exports.arrToObj = exports.parseLogLines = exports.executeShellScript = exports.getUniqServicesObj = exports.removeComments = exports.setupDoxygen = exports.setupGhooks = exports.setupGitIgnore = exports.setupNpmProject = exports.createTemplateApp = exports.createMinimalApp = exports.createAngularApp = exports.createReactApp = exports.diff = exports.inExistingProject = void 0;
90
90
  var shelljs_1 = __importDefault(require("shelljs"));
91
91
  var path_1 = __importDefault(require("path"));
92
92
  var ora_1 = __importDefault(require("ora"));
@@ -605,3 +605,24 @@ var isSASjsProject = function () { return __awaiter(void 0, void 0, void 0, func
605
605
  });
606
606
  }); };
607
607
  exports.isSASjsProject = isSASjsProject;
608
+ var getCliNodeModulePath = function (module) { return __awaiter(void 0, void 0, void 0, function () {
609
+ var cliDepsPath, localPath, globalPath;
610
+ return __generator(this, function (_a) {
611
+ switch (_a.label) {
612
+ case 0:
613
+ cliDepsPath = path_1.default.join('@sasjs', 'cli', 'node_modules');
614
+ localPath = path_1.default.join(process.cwd(), 'node_modules', cliDepsPath, module);
615
+ return [4 /*yield*/, (0, utils_1.folderExists)(localPath)];
616
+ case 1:
617
+ if (_a.sent())
618
+ return [2 /*return*/, localPath];
619
+ globalPath = path_1.default.join(shelljs_1.default.exec("npm root -g", { silent: true }).stdout.replace(/\n/, ''), cliDepsPath, module);
620
+ return [4 /*yield*/, (0, utils_1.folderExists)(globalPath)];
621
+ case 2:
622
+ if (_a.sent())
623
+ return [2 /*return*/, globalPath];
624
+ return [2 /*return*/, ''];
625
+ }
626
+ });
627
+ }); };
628
+ exports.getCliNodeModulePath = getCliNodeModulePath;
package/package.json CHANGED
@@ -47,16 +47,15 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@sasjs/adapter": "3.8.1",
51
- "@sasjs/core": "4.15.3",
50
+ "@sasjs/adapter": "3.8.5",
51
+ "@sasjs/core": "4.18.11",
52
52
  "@sasjs/lint": "1.11.2",
53
- "@sasjs/utils": "2.41.0",
53
+ "@sasjs/utils": "2.42.0",
54
54
  "chalk": "4.1.2",
55
55
  "csv-stringify": "5.6.5",
56
56
  "dotenv": "10.0.0",
57
57
  "esm": "3.2.25",
58
58
  "find": "0.3.0",
59
- "get-installed-path": "4.0.8",
60
59
  "js-base64": "3.7.2",
61
60
  "jsdom": "19.0.0",
62
61
  "jwt-decode": "3.1.2",
@@ -66,6 +65,7 @@
66
65
  "ora": "5.4.1",
67
66
  "rimraf": "3.0.2",
68
67
  "shelljs": "0.8.5",
68
+ "ssl-root-cas": "^1.3.1",
69
69
  "xml": "1.0.1",
70
70
  "yargs": "17.2.1"
71
71
  },
@@ -73,7 +73,6 @@
73
73
  "@babel/preset-env": "7.15.6",
74
74
  "@babel/preset-typescript": "7.15.0",
75
75
  "@types/find": "0.2.1",
76
- "@types/get-installed-path": "4.0.1",
77
76
  "@types/jest": "27.0.2",
78
77
  "@types/jsdom": "16.2.13",
79
78
  "@types/lodash.groupby": "4.6.6",
@@ -94,5 +93,5 @@
94
93
  "typescript": "4.5.4",
95
94
  "util": "0.12.4"
96
95
  },
97
- "version": "3.12.4"
96
+ "version": "3.13.0"
98
97
  }
@@ -1,9 +0,0 @@
1
- export interface ServicePack {
2
- members: ServicePackMember[];
3
- }
4
- export interface ServicePackMember {
5
- name: string;
6
- type: 'folder' | 'service' | 'file';
7
- code?: string;
8
- members?: ServicePackMember[];
9
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });