@sasjs/cli 3.20.2 → 3.20.4

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.
@@ -1,3 +1,4 @@
1
- import { Target } from '@sasjs/utils';
1
+ import { Target, ServerType } from '@sasjs/utils';
2
2
  export declare function build(target: Target): Promise<void>;
3
+ export declare function getWebServiceScriptInvocation(serverType: ServerType, isSASFile?: boolean, encoded?: boolean): string;
3
4
  export declare function getBuildVars(target: Target): 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.getBuildVars = exports.build = void 0;
89
+ exports.getBuildVars = exports.getWebServiceScriptInvocation = exports.build = void 0;
90
90
  var path_1 = __importDefault(require("path"));
91
91
  var utils_1 = require("@sasjs/utils");
92
92
  var error_1 = require("@sasjs/utils/error");
@@ -311,18 +311,21 @@ function getWebServiceScriptInvocation(serverType, isSASFile, encoded) {
311
311
  switch (serverType) {
312
312
  case utils_1.ServerType.SasViya:
313
313
  return isSASFile
314
- ? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
314
+ ? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode,replace=yes)"
315
315
  : "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
316
316
  case utils_1.ServerType.Sas9:
317
- return "%mm_createwebservice(path=&appLoc/&path, name=&service, code=sascode, server=&serverName, replace=yes)";
317
+ return isSASFile
318
+ ? "%mm_createwebservice(path=&appLoc/&path, name=&service, code=sascode, server=&serverName, replace=yes)"
319
+ : "%mm_createwebservice(path=&appLoc/&path, name=&filename, code=filecode, server=&serverName, replace=yes)";
318
320
  case utils_1.ServerType.Sasjs:
319
321
  return isSASFile
320
- ? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
322
+ ? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode,replace=yes)"
321
323
  : "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
322
324
  default:
323
325
  throw new error_1.ServerTypeError();
324
326
  }
325
327
  }
328
+ exports.getWebServiceScriptInvocation = getWebServiceScriptInvocation;
326
329
  /**
327
330
  * Folders inside of `SASJS` folder are converted to JSON structure.
328
331
  * That JSON file is used to deploy services, jobs and tests.
@@ -149,3 +149,38 @@ describe('sasjs build', function () {
149
149
  });
150
150
  }); });
151
151
  });
152
+ describe('getWebServiceScriptInvocation', function () {
153
+ describe(utils_1.ServerType.SasViya, function () {
154
+ it('should return macro invocation for stored program', function () {
155
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.SasViya, true, false)).toEqual('%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode,replace=yes)');
156
+ });
157
+ it('should return macro invocation for stored program', function () {
158
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.SasViya, true, true)).toEqual('%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode,replace=yes)');
159
+ });
160
+ it('should return macro invocation for stored file when encoded is equal to true', function () {
161
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.SasViya, false, true)).toEqual('%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode, intype=BASE64)');
162
+ });
163
+ });
164
+ describe(utils_1.ServerType.Sas9, function () {
165
+ it('should return macro invocation for stored program', function () {
166
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.Sas9, true, false)).toEqual('%mm_createwebservice(path=&appLoc/&path, name=&service, code=sascode, server=&serverName, replace=yes)');
167
+ });
168
+ it('should return macro invocation for stored program', function () {
169
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.Sas9, true, true)).toEqual('%mm_createwebservice(path=&appLoc/&path, name=&service, code=sascode, server=&serverName, replace=yes)');
170
+ });
171
+ it('should return macro invocation for stored file when encoded is equal to true', function () {
172
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.Sas9, false, true)).toEqual('%mm_createwebservice(path=&appLoc/&path, name=&filename, code=filecode, server=&serverName, replace=yes)');
173
+ });
174
+ });
175
+ describe(utils_1.ServerType.Sasjs, function () {
176
+ it('should return macro invocation for stored program', function () {
177
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.Sasjs, true, false)).toEqual('%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode,replace=yes)');
178
+ });
179
+ it('should return macro invocation for stored program', function () {
180
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.Sasjs, true, true)).toEqual('%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode,replace=yes)');
181
+ });
182
+ it('should return macro invocation for stored file when encoded is equal to true', function () {
183
+ expect((0, build_1.getWebServiceScriptInvocation)(utils_1.ServerType.Sasjs, false, true)).toEqual('%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode, intype=BASE64)');
184
+ });
185
+ });
186
+ });
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  "@sasjs/adapter": "4.0.1",
54
54
  "@sasjs/core": "4.43.1",
55
55
  "@sasjs/lint": "1.13.0",
56
- "@sasjs/utils": "2.49.2",
56
+ "@sasjs/utils": "2.49.3",
57
57
  "adm-zip": "0.5.9",
58
58
  "chalk": "4.1.2",
59
59
  "csv-stringify": "5.6.5",
@@ -99,5 +99,5 @@
99
99
  "typescript": "4.5.4",
100
100
  "util": "0.12.4"
101
101
  },
102
- "version": "3.20.2"
102
+ "version": "3.20.4"
103
103
  }