@sasjs/cli 3.0.2 → 3.2.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 (81) hide show
  1. package/build/commands/add/addCredential.d.ts +6 -2
  2. package/build/commands/add/addCredential.js +79 -47
  3. package/build/commands/add/addTarget.js +32 -20
  4. package/build/commands/add/internal/input.d.ts +7 -0
  5. package/build/commands/add/internal/input.js +53 -8
  6. package/build/commands/add/spec/addTarget.spec.js +78 -0
  7. package/build/commands/build/build.js +11 -11
  8. package/build/commands/build/internal/config.d.ts +1 -1
  9. package/build/commands/build/internal/config.js +5 -6
  10. package/build/commands/compile/compile.js +4 -4
  11. package/build/commands/compile/compileCommand.js +2 -1
  12. package/build/commands/compile/compileSingleFile.d.ts +1 -1
  13. package/build/commands/compile/compileSingleFile.js +6 -7
  14. package/build/commands/compile/internal/compareFolders.js +1 -2
  15. package/build/commands/compile/internal/compileJobFile.js +1 -1
  16. package/build/commands/compile/internal/compileServiceFile.js +32 -16
  17. package/build/commands/compile/internal/compileTestFile.d.ts +0 -2
  18. package/build/commands/compile/internal/compileTestFile.js +10 -14
  19. package/build/commands/compile/internal/getAllJobFolders.js +1 -1
  20. package/build/commands/compile/internal/getAllServiceFolders.js +1 -1
  21. package/build/commands/compile/internal/loadDependencies.d.ts +2 -3
  22. package/build/commands/compile/internal/loadDependencies.js +43 -230
  23. package/build/commands/compile/internal/spec/compileTestFile.spec.js +8 -8
  24. package/build/commands/compile/spec/compileJobFile.spec.js +3 -3
  25. package/build/commands/compile/spec/compileServiceFile.spec.js +3 -3
  26. package/build/commands/compile/spec/loadDependencies.spec.js +37 -37
  27. package/build/commands/create/spec/reactAppFiles.js +5 -5
  28. package/build/commands/deploy/deploy.js +1 -1
  29. package/build/commands/deploy/spec/cbd.spec.js +19 -3
  30. package/build/commands/docs/generateDocs.js +4 -5
  31. package/build/commands/docs/internal/getFileInputs.d.ts +1 -1
  32. package/build/commands/docs/internal/getFileInputs.js +2 -2
  33. package/build/commands/docs/internal/getFileOutputs.d.ts +1 -1
  34. package/build/commands/docs/internal/getFileOutputs.js +2 -2
  35. package/build/commands/docs/internal/getFoldersForDocs.d.ts +1 -1
  36. package/build/commands/docs/internal/getFoldersForDocs.js +1 -1
  37. package/build/commands/job/internal/execute/viya.js +0 -6
  38. package/build/commands/job/internal/utils.js +6 -8
  39. package/build/commands/job/jobCommand.d.ts +1 -0
  40. package/build/commands/job/jobCommand.js +8 -3
  41. package/build/commands/job/spec/jobCommand.spec.js +10 -3
  42. package/build/commands/request/request.js +2 -2
  43. package/build/commands/run/run.js +1 -1
  44. package/build/commands/servicepack/deploy.js +1 -1
  45. package/build/commands/shared/fetchLogFileContent.js +6 -8
  46. package/build/commands/testing/test.js +1 -1
  47. package/build/commands/web/internal/getTags.d.ts +2 -1
  48. package/build/commands/web/internal/getTags.js +10 -12
  49. package/build/commands/web/internal/getWebServiceContent.js +1 -2
  50. package/build/commands/web/internal/sasjsout.d.ts +1 -1
  51. package/build/commands/web/internal/sasjsout.js +1 -1
  52. package/build/commands/web/internal/spec/updateLinkTag.spec.d.ts +4 -0
  53. package/build/commands/web/internal/spec/updateLinkTag.spec.js +32 -0
  54. package/build/commands/web/internal/updateAllTags.js +33 -8
  55. package/build/commands/web/internal/updateLinkTag.d.ts +4 -0
  56. package/build/commands/web/internal/updateLinkTag.js +24 -0
  57. package/build/commands/web/web.js +12 -13
  58. package/build/utils/auth.d.ts +10 -4
  59. package/build/utils/auth.js +17 -15
  60. package/build/utils/config.d.ts +2 -3
  61. package/build/utils/config.js +14 -16
  62. package/build/utils/file.d.ts +0 -6
  63. package/build/utils/file.js +1 -43
  64. package/build/utils/setConstants.js +1 -1
  65. package/build/utils/spec/utils.spec.js +31 -5
  66. package/build/utils/utils.d.ts +0 -2
  67. package/build/utils/utils.js +2 -21
  68. package/package.json +8 -14
  69. package/CHANGELOG.md +0 -30
  70. package/build/commands/compile/internal/config.d.ts +0 -25
  71. package/build/commands/compile/internal/config.js +0 -259
  72. package/build/commands/compile/spec/getDependencyPaths.spec.d.ts +0 -1
  73. package/build/commands/compile/spec/getDependencyPaths.spec.js +0 -263
  74. package/build/commands/compile/spec/getProgramDependencies.spec.d.ts +0 -1
  75. package/build/commands/compile/spec/getProgramDependencies.spec.js +0 -403
  76. package/build/commands/shared/dependencies.d.ts +0 -12
  77. package/build/commands/shared/dependencies.js +0 -332
  78. package/build/commands/web/internal/updateLinkHref.d.ts +0 -4
  79. package/build/commands/web/internal/updateLinkHref.js +0 -18
  80. package/build/utils/spec/utils.spec.server.d.ts +0 -1
  81. package/build/utils/spec/utils.spec.server.js +0 -72
@@ -71,7 +71,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
71
71
  Object.defineProperty(exports, "__esModule", { value: true });
72
72
  var path_1 = __importDefault(require("path"));
73
73
  var utils_1 = require("@sasjs/utils");
74
- var internalModule = __importStar(require("../internal/config"));
74
+ var internalModule = __importStar(require("@sasjs/utils/sasjsCli/getInitTerm"));
75
75
  var test_1 = require("../../../utils/test");
76
76
  var loadDependencies_1 = require("../internal/loadDependencies");
77
77
  var fakeInit = "/**\n @file serviceinit.sas\n @brief this file is called with every service\n @details This file is included in *every* service, *after* the macros and *before* the service code.\n\n <h4> SAS Macros </h4>\n @li mf_abort.sas\n\n**/\n\noptions\n DATASTMTCHK=ALLKEYWORDS /* some sites have this enabled */\n PS=MAX /* reduce log size slightly */\n;\n%put service is starting!!;";
@@ -162,19 +162,19 @@ describe('loadDependencies', function () {
162
162
  return __generator(this, function (_a) {
163
163
  switch (_a.label) {
164
164
  case 0:
165
- jest.spyOn(internalModule, 'getServiceInit').mockImplementation(function () {
165
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
166
166
  return Promise.resolve({
167
167
  content: "\n* ServiceInit start;\n" + fakeInit + "\n* ServiceInit end;",
168
168
  filePath: ''
169
169
  });
170
170
  });
171
- jest.spyOn(internalModule, 'getServiceTerm').mockImplementation(function () {
171
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
172
172
  return Promise.resolve({
173
173
  content: "\n* ServiceTerm start;\n" + fakeTerm + "\n* ServiceTerm end;",
174
174
  filePath: ''
175
175
  });
176
176
  });
177
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], 'service')];
177
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.service)];
178
178
  case 1:
179
179
  dependencies = _a.sent();
180
180
  expect(dependencies).toStartWith(compiledVars('Service'));
@@ -193,19 +193,19 @@ describe('loadDependencies', function () {
193
193
  return __generator(this, function (_a) {
194
194
  switch (_a.label) {
195
195
  case 0:
196
- jest.spyOn(internalModule, 'getJobInit').mockImplementation(function () {
196
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
197
197
  return Promise.resolve({
198
198
  content: "\n* JobInit start;\n" + fakeInit + "\n* JobInit end;",
199
199
  filePath: ''
200
200
  });
201
201
  });
202
- jest.spyOn(internalModule, 'getJobTerm').mockImplementation(function () {
202
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
203
203
  return Promise.resolve({
204
204
  content: "\n* JobTerm start;\n" + fakeTerm + "\n* JobTerm end;",
205
205
  filePath: ''
206
206
  });
207
207
  });
208
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], 'job')];
208
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.job)];
209
209
  case 1:
210
210
  dependencies = _a.sent();
211
211
  expect(dependencies).toStartWith(compiledVars('Job'));
@@ -224,19 +224,19 @@ describe('loadDependencies', function () {
224
224
  return __generator(this, function (_a) {
225
225
  switch (_a.label) {
226
226
  case 0:
227
- jest.spyOn(internalModule, 'getServiceInit').mockImplementation(function () {
227
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
228
228
  return Promise.resolve({
229
229
  content: "\n* ServiceInit start;\n" + fakeInit2 + "\n* ServiceInit end;",
230
230
  filePath: ''
231
231
  });
232
232
  });
233
- jest.spyOn(internalModule, 'getServiceTerm').mockImplementation(function () {
233
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
234
234
  return Promise.resolve({
235
235
  content: "\n* ServiceTerm start;\n" + fakeTerm2 + "\n* ServiceTerm end;",
236
236
  filePath: ''
237
237
  });
238
238
  });
239
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], 'service')];
239
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.service)];
240
240
  case 1:
241
241
  dependencies = _a.sent();
242
242
  expect(dependencies).toStartWith(compiledVars('Service'));
@@ -255,19 +255,19 @@ describe('loadDependencies', function () {
255
255
  return __generator(this, function (_a) {
256
256
  switch (_a.label) {
257
257
  case 0:
258
- jest.spyOn(internalModule, 'getJobInit').mockImplementation(function () {
258
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
259
259
  return Promise.resolve({
260
260
  content: "\n* JobInit start;\n" + fakeInit2 + "\n* JobInit end;",
261
261
  filePath: ''
262
262
  });
263
263
  });
264
- jest.spyOn(internalModule, 'getJobTerm').mockImplementation(function () {
264
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
265
265
  return Promise.resolve({
266
266
  content: "\n* JobTerm start;\n" + fakeTerm2 + "\n* JobTerm end;",
267
267
  filePath: ''
268
268
  });
269
269
  });
270
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], 'job')];
270
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.job)];
271
271
  case 1:
272
272
  dependencies = _a.sent();
273
273
  expect(dependencies).toStartWith(compiledVars('Job'));
@@ -286,19 +286,19 @@ describe('loadDependencies', function () {
286
286
  return __generator(this, function (_a) {
287
287
  switch (_a.label) {
288
288
  case 0:
289
- jest.spyOn(internalModule, 'getServiceInit').mockImplementation(function () {
289
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
290
290
  return Promise.resolve({
291
291
  content: "\n* ServiceInit start;\n" + fakeJobInit + "\n* ServiceInit end;",
292
292
  filePath: ''
293
293
  });
294
294
  });
295
- jest.spyOn(internalModule, 'getServiceTerm').mockImplementation(function () {
295
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
296
296
  return Promise.resolve({
297
297
  content: "\n* ServiceTerm start;\n" + fakeTerm + "\n* ServiceTerm end;",
298
298
  filePath: ''
299
299
  });
300
300
  });
301
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'service')];
301
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.service)];
302
302
  case 1:
303
303
  dependencies = _a.sent();
304
304
  expect(dependencies).toStartWith(compiledVars('Service'));
@@ -317,19 +317,19 @@ describe('loadDependencies', function () {
317
317
  return __generator(this, function (_a) {
318
318
  switch (_a.label) {
319
319
  case 0:
320
- jest.spyOn(internalModule, 'getJobInit').mockImplementation(function () {
320
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
321
321
  return Promise.resolve({
322
322
  content: "\n* JobInit start;\n" + fakeJobInit + "\n* JobInit end;",
323
323
  filePath: ''
324
324
  });
325
325
  });
326
- jest.spyOn(internalModule, 'getJobTerm').mockImplementation(function () {
326
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
327
327
  return Promise.resolve({
328
328
  content: "\n* JobTerm start;\n" + fakeTerm + "\n* JobTerm end;",
329
329
  filePath: ''
330
330
  });
331
331
  });
332
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'job')];
332
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.job)];
333
333
  case 1:
334
334
  dependencies = _a.sent();
335
335
  expect(dependencies).toStartWith(compiledVars('Job'));
@@ -348,19 +348,19 @@ describe('loadDependencies', function () {
348
348
  return __generator(this, function (_a) {
349
349
  switch (_a.label) {
350
350
  case 0:
351
- jest.spyOn(internalModule, 'getServiceInit').mockImplementation(function () {
351
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
352
352
  return Promise.resolve({
353
353
  content: "\n* ServiceInit start;\n" + fakeJobInit2 + "\n* ServiceInit end;",
354
354
  filePath: ''
355
355
  });
356
356
  });
357
- jest.spyOn(internalModule, 'getServiceTerm').mockImplementation(function () {
357
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
358
358
  return Promise.resolve({
359
359
  content: "\n* ServiceTerm start;\n" + fakeTerm2 + "\n* ServiceTerm end;",
360
360
  filePath: ''
361
361
  });
362
362
  });
363
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'service')];
363
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.service)];
364
364
  case 1:
365
365
  dependencies = _a.sent();
366
366
  expect(dependencies).toStartWith(compiledVars('Service'));
@@ -379,19 +379,19 @@ describe('loadDependencies', function () {
379
379
  return __generator(this, function (_a) {
380
380
  switch (_a.label) {
381
381
  case 0:
382
- jest.spyOn(internalModule, 'getJobInit').mockImplementation(function () {
382
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
383
383
  return Promise.resolve({
384
384
  content: "\n* JobInit start;\n" + fakeJobInit2 + "\n* JobInit end;",
385
385
  filePath: ''
386
386
  });
387
387
  });
388
- jest.spyOn(internalModule, 'getJobTerm').mockImplementation(function () {
388
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
389
389
  return Promise.resolve({
390
390
  content: "\n* JobTerm start;\n" + fakeTerm2 + "\n* JobTerm end;",
391
391
  filePath: ''
392
392
  });
393
393
  });
394
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'job')];
394
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.job)];
395
395
  case 1:
396
396
  dependencies = _a.sent();
397
397
  expect(dependencies).toStartWith(compiledVars('Job'));
@@ -410,19 +410,19 @@ describe('loadDependencies', function () {
410
410
  return __generator(this, function (_a) {
411
411
  switch (_a.label) {
412
412
  case 0:
413
- jest.spyOn(internalModule, 'getJobInit').mockImplementation(function () {
413
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
414
414
  return Promise.resolve({
415
415
  content: "\n* JobInit start;\n" + fakeJobInit + "\n* JobInit end;",
416
416
  filePath: ''
417
417
  });
418
418
  });
419
- jest.spyOn(internalModule, 'getJobTerm').mockImplementation(function () {
419
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
420
420
  return Promise.resolve({
421
421
  content: "\n* JobTerm start;\n" + fakeTerm2 + "\n* JobTerm end;",
422
422
  filePath: ''
423
423
  });
424
424
  });
425
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'job')];
425
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.job)];
426
426
  case 1:
427
427
  dependencies = _a.sent();
428
428
  expect(dependencies).toStartWith(compiledVars('Job'));
@@ -444,19 +444,19 @@ describe('loadDependencies', function () {
444
444
  return __generator(this, function (_a) {
445
445
  switch (_a.label) {
446
446
  case 0:
447
- jest.spyOn(internalModule, 'getJobInit').mockImplementation(function () {
447
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
448
448
  return Promise.resolve({
449
449
  content: "\n* JobInit start;\n" + fakeInit2 + "\n* JobInit end;",
450
450
  filePath: ''
451
451
  });
452
452
  });
453
- jest.spyOn(internalModule, 'getJobTerm').mockImplementation(function () {
453
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
454
454
  return Promise.resolve({
455
455
  content: "\n* JobTerm start;\n" + fakeJobInit + "\n* JobTerm end;",
456
456
  filePath: ''
457
457
  });
458
458
  });
459
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'job')];
459
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.job)];
460
460
  case 1:
461
461
  dependencies = _a.sent();
462
462
  expect(dependencies).toStartWith(compiledVars('Job'));
@@ -477,19 +477,19 @@ describe('loadDependencies', function () {
477
477
  return __generator(this, function (_a) {
478
478
  switch (_a.label) {
479
479
  case 0:
480
- jest.spyOn(internalModule, 'getServiceInit').mockImplementation(function () {
480
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
481
481
  return Promise.resolve({
482
482
  content: "\n* ServiceInit start;\n" + fakeJobInit + "\n* ServiceInit end;",
483
483
  filePath: ''
484
484
  });
485
485
  });
486
- jest.spyOn(internalModule, 'getServiceTerm').mockImplementation(function () {
486
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
487
487
  return Promise.resolve({
488
488
  content: "\n* ServiceTerm start;\n" + fakeTerm2 + "\n* ServiceTerm end;",
489
489
  filePath: ''
490
490
  });
491
491
  });
492
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'service')];
492
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.service)];
493
493
  case 1:
494
494
  dependencies = _a.sent();
495
495
  expect(dependencies).toStartWith(compiledVars('Service'));
@@ -511,19 +511,19 @@ describe('loadDependencies', function () {
511
511
  return __generator(this, function (_a) {
512
512
  switch (_a.label) {
513
513
  case 0:
514
- jest.spyOn(internalModule, 'getServiceInit').mockImplementation(function () {
514
+ jest.spyOn(internalModule, 'getInit').mockImplementation(function () {
515
515
  return Promise.resolve({
516
516
  content: "\n* ServiceInit start;\n" + fakeInit2 + "\n* ServiceInit end;",
517
517
  filePath: ''
518
518
  });
519
519
  });
520
- jest.spyOn(internalModule, 'getServiceTerm').mockImplementation(function () {
520
+ jest.spyOn(internalModule, 'getTerm').mockImplementation(function () {
521
521
  return Promise.resolve({
522
522
  content: "\n* ServiceTerm start;\n" + fakeJobInit + "\n* ServiceTerm end;",
523
523
  filePath: ''
524
524
  });
525
525
  });
526
- return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], 'service')];
526
+ return [4 /*yield*/, loadDependencies_1.loadDependencies(target, path_1.default.join(__dirname, './service.sas'), [path_1.default.join(__dirname, './macros')], [path_1.default.join(__dirname, './'), path_1.default.join(__dirname, './services')], utils_1.SASJsFileType.service)];
527
527
  case 1:
528
528
  dependencies = _a.sent();
529
529
  expect(dependencies).toStartWith(compiledVars('Service'));
@@ -7,7 +7,10 @@ exports.reactAppFiles = {
7
7
  { fileName: 'package.json' },
8
8
  { fileName: 'package-lock.json' },
9
9
  { fileName: 'tsconfig.json' },
10
- { fileName: 'README.md' }
10
+ { fileName: 'README.md' },
11
+ { fileName: 'webpack.common.js' },
12
+ { fileName: 'webpack.dev.js' },
13
+ { fileName: 'webpack.prod.js' }
11
14
  ],
12
15
  subFolders: [
13
16
  {
@@ -36,12 +39,9 @@ exports.reactAppFiles = {
36
39
  folderName: 'src',
37
40
  files: [
38
41
  { fileName: 'App.scss' },
39
- { fileName: 'cached_data.ts' },
40
42
  { fileName: 'index.scss' },
41
43
  { fileName: 'index.tsx' },
42
- { fileName: 'logo.svg' },
43
- { fileName: 'react-app-env.d.ts' },
44
- { fileName: 'serviceWorker.ts' }
44
+ { fileName: 'logo.svg' }
45
45
  ],
46
46
  subFolders: [
47
47
  {
@@ -93,7 +93,7 @@ function deploy(target, isLocal, sasjs) {
93
93
  return __generator(this, function (_d) {
94
94
  switch (_d.label) {
95
95
  case 0:
96
- deployScriptPath = utils_1.getAbsolutePath(deployScript, process.projectDir);
96
+ deployScriptPath = utils_2.getAbsolutePath(deployScript, process.projectDir);
97
97
  if (!file_1.isSasFile(deployScript)) return [3 /*break*/, 7];
98
98
  (_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Processing SAS file " + path_1.default.basename(deployScript) + " ...");
99
99
  return [4 /*yield*/, utils_2.readFile(deployScriptPath)
@@ -47,6 +47,7 @@ var build_1 = require("../../build/build");
47
47
  var deploy_1 = require("../deploy");
48
48
  var utils_2 = require("./utils");
49
49
  var config_1 = require("../../../utils/config");
50
+ var utils_3 = require("../../../utils");
50
51
  describe('sasjs cbd with server type SASJS', function () {
51
52
  var target;
52
53
  var appName;
@@ -77,7 +78,7 @@ describe('sasjs cbd with server type SASJS', function () {
77
78
  });
78
79
  }); });
79
80
  it("should deploy compile and build to sasjs/server", function () { return __awaiter(void 0, void 0, void 0, function () {
80
- var sasjs, customTarget;
81
+ var sasjs, customTarget, macroCorePath, mf_getuser, mp_jsonout, ms_webout, webout;
81
82
  return __generator(this, function (_a) {
82
83
  switch (_a.label) {
83
84
  case 0:
@@ -108,6 +109,19 @@ describe('sasjs cbd with server type SASJS', function () {
108
109
  return [4 /*yield*/, deploy_1.deploy(customTarget, true, sasjs)];
109
110
  case 4:
110
111
  _a.sent();
112
+ macroCorePath = process.sasjsConstants.macroCorePath;
113
+ return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
114
+ case 5:
115
+ mf_getuser = _a.sent();
116
+ return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
117
+ case 6:
118
+ mp_jsonout = _a.sent();
119
+ return [4 /*yield*/, utils_1.readFile(macroCorePath + "/server/ms_webout.sas")];
120
+ case 7:
121
+ ms_webout = _a.sent();
122
+ webout = ' %macro webout(action,ds,dslabel=,fmt=);\n' +
123
+ ' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
124
+ ' %mend;\n';
111
125
  expect(sasjs.deployToSASjs).toHaveBeenCalledWith({
112
126
  members: [
113
127
  {
@@ -121,12 +135,14 @@ describe('sasjs cbd with server type SASJS', function () {
121
135
  {
122
136
  name: 'appinit',
123
137
  type: 'service',
124
- code: '/* 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* Dependencies start;\n* Dependencies end;\n* Programs start;\n*Programs 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;'
138
+ code: utils_3.removeComments("" + mf_getuser + mp_jsonout + ms_webout + webout +
139
+ '/* 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* Dependencies start;\n* Dependencies end;\n* Programs start;\n*Programs 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;')
125
140
  },
126
141
  {
127
142
  name: 'getdata',
128
143
  type: 'service',
129
- code: '/* 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* Dependencies start;\n* Dependencies end;\n* Programs start;\n*Programs 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;'
144
+ code: utils_3.removeComments("" + mf_getuser + mp_jsonout + ms_webout + webout +
145
+ '/* 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* Dependencies start;\n* Dependencies end;\n* Programs start;\n*Programs 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;')
130
146
  }
131
147
  ]
132
148
  }
@@ -80,7 +80,6 @@ var utils_1 = require("@sasjs/utils");
80
80
  var getFoldersForDocs_1 = require("./internal/getFoldersForDocs");
81
81
  var createDotFiles_1 = require("./internal/createDotFiles");
82
82
  var getDocConfig_1 = require("./internal/getDocConfig");
83
- var logger_1 = require("@sasjs/utils/logger");
84
83
  var utils_2 = require("../../utils");
85
84
  /**
86
85
  * Generates documentation(Doxygen)
@@ -129,7 +128,7 @@ function generateDocs(target, config, outDirectory) {
129
128
  case 4:
130
129
  doxyContent = __assign({ favIcon: 'favicon.ico', footer: 'new_footer.html', header: 'new_header.html', layout: 'DoxygenLayout.xml', logo: 'logo.png', readMe: '../../README.md', stylesheet: 'new_stylesheet.css', path: path_1.default.join(process.projectDir, 'sasjs', 'doxy') }, doxyContentFromConfig);
131
130
  if (doxyContentFromConfig === null || doxyContentFromConfig === void 0 ? void 0 : doxyContentFromConfig.path)
132
- doxyContent.path = utils_2.getAbsolutePath(doxyContentFromConfig.path, process.projectDir);
131
+ doxyContent.path = utils_1.getAbsolutePath(doxyContentFromConfig.path, process.projectDir);
133
132
  doxyParams = setVariableCmd({
134
133
  DOXY_HTML_OUTPUT: newOutDirectory,
135
134
  DOXY_INPUT: "\"" + path_1.default.join(doxyContent.path, doxyContent.readMe) + "\" " + combinedFolders,
@@ -147,7 +146,7 @@ function generateDocs(target, config, outDirectory) {
147
146
  doxyConfigPath = _f.sent();
148
147
  (_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Using " + doxyConfigPath + " as Doxygen Configuration.");
149
148
  spinner = ora_1.default(chalk_1.default.greenBright('Generating docs', chalk_1.default.cyanBright(newOutDirectory)));
150
- if (process.env.LOG_LEVEL !== logger_1.LogLevel.Debug)
149
+ if (process.env.LOG_LEVEL !== utils_1.LogLevel.Debug)
151
150
  spinner.start();
152
151
  return [4 /*yield*/, utils_1.fileExists(newOutDirectory)];
153
152
  case 6:
@@ -161,9 +160,9 @@ function generateDocs(target, config, outDirectory) {
161
160
  case 9:
162
161
  _f.sent();
163
162
  _e = shelljs_1.default.exec(doxyParams + " doxygen \"" + doxyConfigPath + "\"", {
164
- silent: process.env.LOG_LEVEL !== logger_1.LogLevel.Debug
163
+ silent: process.env.LOG_LEVEL !== utils_1.LogLevel.Debug
165
164
  }), stderr = _e.stderr, code = _e.code;
166
- if (process.env.LOG_LEVEL !== logger_1.LogLevel.Debug)
165
+ if (process.env.LOG_LEVEL !== utils_1.LogLevel.Debug)
167
166
  spinner.stop();
168
167
  if (code !== 0) {
169
168
  if (stderr.startsWith('error: ')) {
@@ -7,4 +7,4 @@
7
7
  export declare function getFileInputs(fileName: string, fileContent: string, paramNodes: Map<string, {
8
8
  edges: string[];
9
9
  label: string;
10
- }>): any[];
10
+ }>): string[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFileInputs = void 0;
4
- var file_1 = require("../../../utils/file");
4
+ var utils_1 = require("@sasjs/utils");
5
5
  /**
6
6
  * Returns list of Inputs and populates Map of Nodes
7
7
  * @param {string} fileName- Name of the file from which Inputs need to extract
@@ -9,7 +9,7 @@ var file_1 = require("../../../utils/file");
9
9
  * @param {Map} paramNodes- Map for params(Inputs/Outputs)
10
10
  */
11
11
  function getFileInputs(fileName, fileContent, paramNodes) {
12
- var fileInputs = file_1.getList('<h4> Data Inputs </h4>', fileContent)
12
+ var fileInputs = utils_1.getList('<h4> Data Inputs </h4>', fileContent)
13
13
  .map(function (input) { return input.toUpperCase(); })
14
14
  .filter(function (input) { return !input.endsWith('.DLL'); });
15
15
  fileInputs.forEach(function (inputParam) {
@@ -6,4 +6,4 @@
6
6
  export declare function getFileOutputs(fileContent: string, paramNodes: Map<string, {
7
7
  edges: string[];
8
8
  label: string;
9
- }>): any[];
9
+ }>): string[];
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFileOutputs = void 0;
4
- var file_1 = require("../../../utils/file");
4
+ var utils_1 = require("@sasjs/utils");
5
5
  /**
6
6
  * Returns list of Outputs and populates Map of Nodes
7
7
  * @param {string} fileContent- Contents of the file from which Outputs need to extract
8
8
  * @param {Map} paramNodes- Map for params(Inputs/Outputs)
9
9
  */
10
10
  function getFileOutputs(fileContent, paramNodes) {
11
- var fileOutputs = file_1.getList('<h4> Data Outputs </h4>', fileContent)
11
+ var fileOutputs = utils_1.getList('<h4> Data Outputs </h4>', fileContent)
12
12
  .map(function (output) { return output.toUpperCase(); })
13
13
  .filter(function (output) { return !output.endsWith('.DLL'); });
14
14
  fileOutputs.forEach(function (outputParam) {
@@ -1,4 +1,4 @@
1
- import { Target, Configuration } from '@sasjs/utils/types';
1
+ import { Target, Configuration } from '@sasjs/utils';
2
2
  /**
3
3
  * Returns list of folders for documentation( macroCore / macros / SAS programs/ services / jobs )
4
4
  * @param {Target} target- target for docs.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFoldersForDocs = void 0;
4
- var utils_1 = require("../../../utils/utils");
4
+ var utils_1 = require("@sasjs/utils");
5
5
  /**
6
6
  * Returns list of folders for documentation( macroCore / macros / SAS programs/ services / jobs )
7
7
  * @param {Target} target- target for docs.
@@ -170,12 +170,6 @@ function executeJobViya(sasjs, authConfig, jobPath, target, waitForJob, output,
170
170
  if (!result)
171
171
  result = true;
172
172
  sessionLink = submittedJob.links.find(function (l) { return l.method === 'GET' && l.rel === 'self'; }).href;
173
- if (!returnStatusOnly) {
174
- displayResult_1.displaySuccess((waitForJob
175
- ? "Job located at '" + jobPath + "' has been executed.\nJob details"
176
- : "Job session") +
177
- (" can be found at " + (target.serverUrl + sessionLink)));
178
- }
179
173
  if (!(output || logFile)) return [3 /*break*/, 20];
180
174
  _c.label = 9;
181
175
  case 9:
@@ -46,9 +46,8 @@ var utils_2 = require("../../../utils/utils");
46
46
  var displayResult_1 = require("../../../utils/displayResult");
47
47
  var saveLog = function (logData, logFile, jobPath, returnStatusOnly) { return __awaiter(void 0, void 0, void 0, function () {
48
48
  var logPath, folderPath, parentFolderPath, logLines;
49
- var _a;
50
- return __generator(this, function (_b) {
51
- switch (_b.label) {
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
52
51
  case 0:
53
52
  if (logFile) {
54
53
  logPath = logFile;
@@ -61,17 +60,16 @@ var saveLog = function (logData, logFile, jobPath, returnStatusOnly) { return __
61
60
  parentFolderPath = folderPath.join(path_1.default.sep);
62
61
  return [4 /*yield*/, utils_1.folderExists(parentFolderPath)];
63
62
  case 1:
64
- if (!!(_b.sent())) return [3 /*break*/, 3];
63
+ if (!!(_a.sent())) return [3 /*break*/, 3];
65
64
  return [4 /*yield*/, utils_1.createFolder(parentFolderPath)];
66
65
  case 2:
67
- _b.sent();
68
- _b.label = 3;
66
+ _a.sent();
67
+ _a.label = 3;
69
68
  case 3:
70
69
  logLines = typeof logData === 'object' ? utils_2.parseLogLines(logData) : logData;
71
- (_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Creating log file at " + logPath + " .");
72
70
  return [4 /*yield*/, utils_1.createFile(logPath, logLines)];
73
71
  case 4:
74
- _b.sent();
72
+ _a.sent();
75
73
  if (!returnStatusOnly)
76
74
  displayResult_1.displaySuccess("Log saved to " + logPath);
77
75
  return [2 /*return*/];
@@ -3,6 +3,7 @@ import { AuthConfig, Target } from '@sasjs/utils';
3
3
  import { ReturnCode } from '../../types/command';
4
4
  import { TargetCommand } from '../../types/command/targetCommand';
5
5
  export declare class JobCommand extends TargetCommand {
6
+ private jobSubCommands;
6
7
  constructor(args: string[]);
7
8
  execute(): Promise<ReturnCode>;
8
9
  executeJobSasjs(sasjs: SASjs, target: Target): Promise<ReturnCode>;
@@ -66,6 +66,7 @@ var execute_1 = require("./internal/execute");
66
66
  var JobSubCommand;
67
67
  (function (JobSubCommand) {
68
68
  JobSubCommand["Execute"] = "execute";
69
+ JobSubCommand["Exec"] = "exec";
69
70
  })(JobSubCommand || (JobSubCommand = {}));
70
71
  var syntax = 'job <subCommand> <jobPath> [options]';
71
72
  var usage = 'sasjs job <execute> <jobPath> [options]';
@@ -123,8 +124,11 @@ var JobCommand = /** @class */ (function (_super) {
123
124
  __extends(JobCommand, _super);
124
125
  function JobCommand(args) {
125
126
  var _this = this;
127
+ var jobSubCommands = Object.values(JobSubCommand);
126
128
  var subCommand = args[3];
127
- var parseOptions = subCommand === JobSubCommand.Execute ? executeParseOptions : {};
129
+ var parseOptions = jobSubCommands.includes(subCommand)
130
+ ? executeParseOptions
131
+ : {};
128
132
  _this = _super.call(this, args, {
129
133
  parseOptions: parseOptions,
130
134
  usage: usage,
@@ -132,6 +136,7 @@ var JobCommand = /** @class */ (function (_super) {
132
136
  examples: examples,
133
137
  syntax: syntax
134
138
  }) || this;
139
+ _this.jobSubCommands = jobSubCommands;
135
140
  return _this;
136
141
  }
137
142
  JobCommand.prototype.execute = function () {
@@ -166,7 +171,7 @@ var JobCommand = /** @class */ (function (_super) {
166
171
  authConfig = _e.sent();
167
172
  if (!authConfig)
168
173
  return [2 /*return*/, command_1.ReturnCode.InternalError];
169
- if (!(this.parsed.subCommand === JobSubCommand.Execute)) return [3 /*break*/, 5];
174
+ if (!this.jobSubCommands.includes(this.parsed.subCommand)) return [3 /*break*/, 5];
170
175
  return [4 /*yield*/, this.executeJobViya(target, sasjs, authConfig)];
171
176
  case 4:
172
177
  _c = _e.sent();
@@ -182,7 +187,7 @@ var JobCommand = /** @class */ (function (_super) {
182
187
  });
183
188
  if (typeof this.parsed.jobPath !== 'string')
184
189
  return [2 /*return*/, command_1.ReturnCode.InvalidCommand];
185
- if (!(this.parsed.subCommand === JobSubCommand.Execute)) return [3 /*break*/, 9];
190
+ if (!this.jobSubCommands.includes(this.parsed.subCommand)) return [3 /*break*/, 9];
186
191
  return [4 /*yield*/, this.executeJobSasjs(sasjs, target)];
187
192
  case 8:
188
193
  _d = _e.sent();
@@ -362,17 +362,24 @@ var executeCalledWith = function (_a) {
362
362
  var executeCommandWrapper = function (additionalParams, checkTarget) {
363
363
  if (checkTarget === void 0) { checkTarget = true; }
364
364
  return __awaiter(void 0, void 0, void 0, function () {
365
- var args, command, returnCode, targetInfo;
365
+ var subCommand, args, command, returnCode, targetInfo;
366
366
  return __generator(this, function (_a) {
367
367
  switch (_a.label) {
368
368
  case 0:
369
- args = __spreadArray(__spreadArray([], __read(defaultArgs)), __read(additionalParams));
369
+ subCommand = 'execute';
370
+ args = __spreadArray(__spreadArray([], __read(defaultArgs)), __read(additionalParams)).map(function (arg) {
371
+ if (arg === 'execute') {
372
+ arg = Math.random() > 0.5 ? 'exec' : arg;
373
+ subCommand = arg;
374
+ }
375
+ return arg;
376
+ });
370
377
  command = new jobCommand_1.JobCommand(args);
371
378
  return [4 /*yield*/, command.execute()];
372
379
  case 1:
373
380
  returnCode = _a.sent();
374
381
  expect(command.name).toEqual('job');
375
- expect(command.subCommand).toEqual('execute');
382
+ expect(command.subCommand).toEqual(subCommand);
376
383
  if (!checkTarget) return [3 /*break*/, 3];
377
384
  return [4 /*yield*/, command.getTargetInfo()];
378
385
  case 2: