@sasjs/cli 3.7.0 → 3.7.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.
@@ -294,23 +294,21 @@ function getCreateFileScript(serverType) {
294
294
  });
295
295
  });
296
296
  }
297
- function getWebServiceScriptInvocation(serverType, filePath, isSASFile, encoded) {
298
- if (filePath === void 0) { filePath = ''; }
297
+ function getWebServiceScriptInvocation(serverType, isSASFile, encoded) {
299
298
  if (isSASFile === void 0) { isSASFile = true; }
300
299
  if (encoded === void 0) { encoded = false; }
301
- var loc = filePath === '' ? 'services' : 'tests';
302
300
  var encodedParam = encoded ? ', intype=BASE64' : '';
303
301
  switch (serverType) {
304
302
  case utils_1.ServerType.SasViya:
305
303
  return isSASFile
306
- ? "%mv_createwebservice(path=&appLoc/".concat(loc, "/&path, name=&service, code=sascode ,replace=yes)")
307
- : "%mv_createfile(path=&appLoc/".concat(loc, "/&path, name=&filename, inref=filecode").concat(encodedParam, ")");
304
+ ? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
305
+ : "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
308
306
  case utils_1.ServerType.Sas9:
309
- return "%mm_createwebservice(path=&appLoc/".concat(loc, "/&path, name=&service, code=sascode ,replace=yes)");
307
+ return "%mm_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)";
310
308
  case utils_1.ServerType.Sasjs:
311
309
  return isSASFile
312
- ? "%mv_createwebservice(path=&appLoc/".concat(loc, "/&path, name=&service, code=sascode ,replace=yes)")
313
- : "%mv_createfile(path=&appLoc/".concat(loc, "/&path, name=&filename, inref=filecode").concat(encodedParam, ")");
310
+ ? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
311
+ : "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
314
312
  default:
315
313
  throw new error_1.ServerTypeError();
316
314
  }
@@ -340,7 +338,7 @@ function getFolderContent(serverType) {
340
338
  var _a, content, contentJSON;
341
339
  return __generator(this, function (_b) {
342
340
  switch (_b.label) {
343
- case 0: return [4 /*yield*/, getContentFor(path_1.default.join(buildDestinationFolder, subFolder), path_1.default.join(buildDestinationFolder, subFolder), serverType)];
341
+ case 0: return [4 /*yield*/, getContentFor(buildDestinationFolder, path_1.default.join(buildDestinationFolder, subFolder), serverType)];
344
342
  case 1:
345
343
  _a = _b.sent(), content = _a.content, contentJSON = _a.contentJSON;
346
344
  folderContent += "\n".concat(content);
@@ -383,28 +381,19 @@ function getDependencies(filePaths) {
383
381
  });
384
382
  });
385
383
  }
386
- function getContentFor(rootDirectory, folderPath, serverType, testPath) {
387
- if (testPath === void 0) { testPath = undefined; }
384
+ function getContentFor(rootDirectory, folderPath, serverType) {
388
385
  return __awaiter(this, void 0, void 0, function () {
389
- var folderName, isRootDir, content, contentJSON, files, subFolders;
386
+ var folderName, content, contentJSON, files, subFolders;
390
387
  var _this = this;
391
388
  return __generator(this, function (_a) {
392
389
  switch (_a.label) {
393
390
  case 0:
394
391
  folderName = path_1.default.basename(folderPath);
395
- if (!testPath && folderName === 'tests') {
396
- testPath = '';
397
- }
398
- isRootDir = folderPath === rootDirectory;
399
- content = "\n%let path=".concat(isRootDir
400
- ? ''
401
- : testPath !== undefined
402
- ? testPath
403
- : folderPath
404
- .replace(rootDirectory, '')
405
- .substr(1)
406
- .split(path_1.default.sep)
407
- .join('/'), ";\n");
392
+ content = "\n%let path=".concat(folderPath
393
+ .replace(rootDirectory, '')
394
+ .substr(1)
395
+ .split(path_1.default.sep)
396
+ .join('/'), ";\n");
408
397
  contentJSON = {
409
398
  name: folderName,
410
399
  type: 'folder',
@@ -423,7 +412,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
423
412
  return [4 /*yield*/, (0, utils_1.readFile)(filePath)];
424
413
  case 1:
425
414
  fileContent = _a.sent();
426
- transformedContent = getServiceText(file, fileContent, serverType, testPath);
415
+ transformedContent = getServiceText(file, fileContent, serverType);
427
416
  content += "\n".concat(transformedContent, "\n");
428
417
  contentJSON.members.push({
429
418
  name: file.replace(/.sas$/, ''),
@@ -455,11 +444,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
455
444
  var _a, childContent, childContentJSON;
456
445
  return __generator(this, function (_b) {
457
446
  switch (_b.label) {
458
- case 0: return [4 /*yield*/, getContentFor(rootDirectory, path_1.default.join(folderPath, subFolder), serverType, testPath !== undefined
459
- ? testPath === ''
460
- ? subFolder
461
- : "".concat(testPath, "/").concat(subFolder)
462
- : undefined)];
447
+ case 0: return [4 /*yield*/, getContentFor(rootDirectory, path_1.default.join(folderPath, subFolder), serverType)];
463
448
  case 1:
464
449
  _a = _b.sent(), childContent = _a.content, childContentJSON = _a.contentJSON;
465
450
  contentJSON.members.push(childContentJSON);
@@ -475,7 +460,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
475
460
  });
476
461
  });
477
462
  }
478
- function getServiceText(serviceFileName, fileContent, serverType, testPath) {
463
+ function getServiceText(serviceFileName, fileContent, serverType) {
479
464
  var serviceName = serviceFileName.replace(/.sas$/, '');
480
465
  var sourceCodeLines = getLines((0, utils_2.removeComments)(fileContent));
481
466
  var content = "";
@@ -486,14 +471,14 @@ function getServiceText(serviceFileName, fileContent, serverType, testPath) {
486
471
  }
487
472
  });
488
473
  return "%let service=".concat(serviceName, ";\nfilename sascode temp lrecl=32767;\ndata _null_;\nfile sascode;\n").concat(content, "\n\nrun;\n").concat(serverType !== utils_1.ServerType.Sasjs
489
- ? getWebServiceScriptInvocation(serverType, (0, utils_1.isTestFile)(serviceFileName) && testPath ? "".concat(testPath) : '')
474
+ ? getWebServiceScriptInvocation(serverType)
490
475
  : '', "\nfilename sascode clear;\n");
491
476
  }
492
477
  function getFileText(fileName, fileContent, serverType) {
493
478
  var fileExtension = path_1.default.extname(fileName).substring(1).toUpperCase();
494
479
  var _a = getWebFileContent(fileContent, fileExtension), content = _a.content, maxLineLength = _a.maxLineLength;
495
480
  return "%let filename=".concat(fileName, ";\nfilename filecode temp lrecl=").concat(maxLineLength, ";\ndata _null_;\nfile filecode;\n").concat(content, "\n\nrun;\n").concat(serverType !== utils_1.ServerType.Sasjs
496
- ? getWebServiceScriptInvocation(serverType, undefined, false, true)
481
+ ? getWebServiceScriptInvocation(serverType, false, true)
497
482
  : '', "\nfilename filecode clear;\n");
498
483
  }
499
484
  function getWebFileContent(filecontent, type) {
package/package.json CHANGED
@@ -97,5 +97,5 @@
97
97
  "typescript": "4.5.4",
98
98
  "util": "0.12.4"
99
99
  },
100
- "version": "3.7.0"
100
+ "version": "3.7.1"
101
101
  }