@sasjs/cli 3.8.8 → 3.10.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/commands/build/build.js +33 -45
- package/build/commands/compile/compile.d.ts +2 -1
- package/build/commands/compile/compile.js +15 -12
- package/build/commands/compile/compileSingleFile.js +5 -3
- package/build/commands/compile/internal/compileJobFile.d.ts +2 -1
- package/build/commands/compile/internal/compileJobFile.js +2 -2
- package/build/commands/compile/internal/compileServiceFile.d.ts +2 -1
- package/build/commands/compile/internal/compileServiceFile.js +2 -2
- package/build/commands/compile/internal/compileTestFile.js +4 -2
- package/build/commands/compile/internal/loadDependencies.d.ts +3 -2
- package/build/commands/compile/internal/loadDependencies.js +37 -16
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +2 -2
- package/build/commands/compile/spec/compileJobFile.spec.js +6 -4
- package/build/commands/compile/spec/compileServiceFile.spec.js +6 -4
- package/build/commands/compile/spec/loadDependencies.spec.js +38 -32
- package/build/commands/deploy/deploy.js +44 -39
- package/build/commands/docs/generateDocs.js +3 -7
- package/build/commands/docs/internal/getFileInputs.js +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +1 -1
- package/build/commands/request/request.js +28 -4
- package/build/commands/web/web.js +34 -24
- package/build/utils/spec/removeComments.spec.d.ts +1 -1
- package/build/utils/spec/removeComments.spec.js +2 -1
- package/build/utils/utils.d.ts +0 -1
- package/build/utils/utils.js +2 -4
- package/package.json +2 -2
|
@@ -74,13 +74,14 @@ var utils_1 = require("@sasjs/utils");
|
|
|
74
74
|
var internalModule = __importStar(require("@sasjs/utils/sasjsCli/getInitTerm"));
|
|
75
75
|
var getInitTerm_1 = require("@sasjs/utils/sasjsCli/getInitTerm");
|
|
76
76
|
var test_1 = require("../../../utils/test");
|
|
77
|
+
var utils_2 = require("../../../utils");
|
|
77
78
|
var loadDependencies_1 = require("../internal/loadDependencies");
|
|
78
|
-
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
|
|
79
|
-
var fakeTerm = "/**\n @file serviceterm.sas\n @brief this file is called at the end of every service\n @details This file is included at the *end* of every service.\n\n
|
|
80
|
-
var fakeInit2 = "/**\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
|
|
81
|
-
var fakeTerm2 = "/**\n @file serviceterm.sas\n @brief this file is called at the end of every service\n @details This file is included at the *end* of every service.\n\n
|
|
82
|
-
var fakeJobInit = "/**\n @file\n @brief This code is inserted into the beginning of each Viya Job.\n @details Inserted during the `sasjs compile` step. Add any code here that\n should go at the beginning of every deployed job.\n\n The path to this file should be listed in the `jobInit` property of the\n sasjsconfig file.\n\n
|
|
83
|
-
var fakeJobInit2 = "/**\n @file\n @brief This code is inserted into the beginning of each Viya Job.\n @details Inserted during the `sasjs compile` step. Add any code here that\n should go at the beginning of every deployed job.\n\n The path to this file should be listed in the `jobInit` property of the\n sasjsconfig file.\n\n
|
|
79
|
+
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 ".concat(utils_1.DependencyHeader.Macro, "\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!!;");
|
|
80
|
+
var fakeTerm = "/**\n @file serviceterm.sas\n @brief this file is called at the end of every service\n @details This file is included at the *end* of every service.\n\n ".concat(utils_1.DependencyHeader.Macro, "\n @li mf_abort.sas\n @li mf_existds.sas\n\n**/\n\n%put service is finishing. Thanks, SASjs!;");
|
|
81
|
+
var fakeInit2 = "/**\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 ".concat(utils_1.DependencyHeader.Macro, "\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!!;");
|
|
82
|
+
var fakeTerm2 = "/**\n @file serviceterm.sas\n @brief this file is called at the end of every service\n @details This file is included at the *end* of every service.\n\n ".concat(utils_1.DependencyHeader.Macro, "\n @li mf_abort.sas\n @li mf_existds.sas\n\n**/\n\n%put service is finishing. Thanks, SASjs!;");
|
|
83
|
+
var fakeJobInit = "/**\n @file\n @brief This code is inserted into the beginning of each Viya Job.\n @details Inserted during the `sasjs compile` step. Add any code here that\n should go at the beginning of every deployed job.\n\n The path to this file should be listed in the `jobInit` property of the\n sasjsconfig file.\n\n ".concat(utils_1.DependencyHeader.DeprecatedInclude, "\n @li test.sas TEST\n\n ").concat(utils_1.DependencyHeader.Macro, "\n @li examplemacro.sas\n\n**/\n\n%example(Job Init is executing!)\n\n%let mylib=WORK;");
|
|
84
|
+
var fakeJobInit2 = "/**\n @file\n @brief This code is inserted into the beginning of each Viya Job.\n @details Inserted during the `sasjs compile` step. Add any code here that\n should go at the beginning of every deployed job.\n\n The path to this file should be listed in the `jobInit` property of the\n sasjsconfig file.\n\n ".concat(utils_1.DependencyHeader.Include, "\n @li test.sas TEST\n\n ").concat(utils_1.DependencyHeader.Macro, "\n @li examplemacro.sas\n\n**/\n\n%example(Job Init is executing!)\n\n%let mylib=WORK;");
|
|
84
85
|
var fakeProgramLines = [
|
|
85
86
|
'filename TEST temp;',
|
|
86
87
|
'data _null_;',
|
|
@@ -132,17 +133,22 @@ describe('loadDependencies', function () {
|
|
|
132
133
|
macroVars: {}
|
|
133
134
|
}, utils_1.ServerType.SasViya);
|
|
134
135
|
var target = new utils_1.Target(__assign(__assign({}, temp.toJson()), { jobConfig: jobConfig(false), serviceConfig: serviceConfig(false) }));
|
|
136
|
+
var compileTree;
|
|
135
137
|
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
136
138
|
return __generator(this, function (_a) {
|
|
137
139
|
switch (_a.label) {
|
|
138
|
-
case 0: return [4 /*yield*/, (0,
|
|
140
|
+
case 0: return [4 /*yield*/, (0, utils_2.setConstants)()];
|
|
139
141
|
case 1:
|
|
142
|
+
_a.sent();
|
|
143
|
+
compileTree = (0, loadDependencies_1.getCompileTree)(target);
|
|
144
|
+
return [4 /*yield*/, (0, test_1.createTestMinimalApp)(__dirname, target.name)];
|
|
145
|
+
case 2:
|
|
140
146
|
_a.sent();
|
|
141
147
|
return [4 /*yield*/, (0, test_1.updateConfig)({
|
|
142
148
|
jobConfig: jobConfig(),
|
|
143
149
|
serviceConfig: serviceConfig()
|
|
144
150
|
})];
|
|
145
|
-
case
|
|
151
|
+
case 3:
|
|
146
152
|
_a.sent();
|
|
147
153
|
return [2 /*return*/];
|
|
148
154
|
}
|
|
@@ -158,13 +164,13 @@ describe('loadDependencies', function () {
|
|
|
158
164
|
}
|
|
159
165
|
});
|
|
160
166
|
}); });
|
|
161
|
-
test(
|
|
167
|
+
test("it should load dependencies for a service with ".concat(utils_1.DependencyHeader.DeprecatedMacro), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
162
168
|
var dependencies;
|
|
163
169
|
return __generator(this, function (_a) {
|
|
164
170
|
switch (_a.label) {
|
|
165
171
|
case 0:
|
|
166
172
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeInit, fakeTerm);
|
|
167
|
-
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.service)];
|
|
173
|
+
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.service, compileTree)];
|
|
168
174
|
case 1:
|
|
169
175
|
dependencies = _a.sent();
|
|
170
176
|
expect(dependencies).toStartWith(compiledVars('Service'));
|
|
@@ -178,13 +184,13 @@ describe('loadDependencies', function () {
|
|
|
178
184
|
}
|
|
179
185
|
});
|
|
180
186
|
}); });
|
|
181
|
-
test(
|
|
187
|
+
test("it should load dependencies for a job ".concat(utils_1.DependencyHeader.Macro), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
182
188
|
var dependencies;
|
|
183
189
|
return __generator(this, function (_a) {
|
|
184
190
|
switch (_a.label) {
|
|
185
191
|
case 0:
|
|
186
192
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeInit, fakeTerm);
|
|
187
|
-
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.job)];
|
|
193
|
+
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.job, compileTree)];
|
|
188
194
|
case 1:
|
|
189
195
|
dependencies = _a.sent();
|
|
190
196
|
expect(dependencies).toStartWith(compiledVars('Job'));
|
|
@@ -198,13 +204,13 @@ describe('loadDependencies', function () {
|
|
|
198
204
|
}
|
|
199
205
|
});
|
|
200
206
|
}); });
|
|
201
|
-
test(
|
|
207
|
+
test("it should load dependencies for a service with ".concat(utils_1.DependencyHeader.Macro), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
202
208
|
var dependencies;
|
|
203
209
|
return __generator(this, function (_a) {
|
|
204
210
|
switch (_a.label) {
|
|
205
211
|
case 0:
|
|
206
212
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeInit2, fakeTerm2);
|
|
207
|
-
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.service)];
|
|
213
|
+
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.service, compileTree)];
|
|
208
214
|
case 1:
|
|
209
215
|
dependencies = _a.sent();
|
|
210
216
|
expect(dependencies).toStartWith(compiledVars('Service'));
|
|
@@ -218,13 +224,13 @@ describe('loadDependencies', function () {
|
|
|
218
224
|
}
|
|
219
225
|
});
|
|
220
226
|
}); });
|
|
221
|
-
test(
|
|
227
|
+
test("it should load dependencies for a job ".concat(utils_1.DependencyHeader.Macro), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
222
228
|
var dependencies;
|
|
223
229
|
return __generator(this, function (_a) {
|
|
224
230
|
switch (_a.label) {
|
|
225
231
|
case 0:
|
|
226
232
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeInit2, fakeTerm2);
|
|
227
|
-
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.job)];
|
|
233
|
+
return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, path_1.default.join(__dirname, './service.sas'), [], [], utils_1.SASJsFileType.job, compileTree)];
|
|
228
234
|
case 1:
|
|
229
235
|
dependencies = _a.sent();
|
|
230
236
|
expect(dependencies).toStartWith(compiledVars('Job'));
|
|
@@ -238,13 +244,13 @@ describe('loadDependencies', function () {
|
|
|
238
244
|
}
|
|
239
245
|
});
|
|
240
246
|
}); });
|
|
241
|
-
test(
|
|
247
|
+
test("it should load programs for a service with ".concat(utils_1.DependencyHeader.DeprecatedInclude), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
242
248
|
var dependencies;
|
|
243
249
|
return __generator(this, function (_a) {
|
|
244
250
|
switch (_a.label) {
|
|
245
251
|
case 0:
|
|
246
252
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeJobInit, fakeTerm);
|
|
247
|
-
return [4 /*yield*/, (0, 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)];
|
|
253
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
248
254
|
case 1:
|
|
249
255
|
dependencies = _a.sent();
|
|
250
256
|
expect(dependencies).toStartWith(compiledVars('Service'));
|
|
@@ -258,13 +264,13 @@ describe('loadDependencies', function () {
|
|
|
258
264
|
}
|
|
259
265
|
});
|
|
260
266
|
}); });
|
|
261
|
-
test(
|
|
267
|
+
test("it should load programs for a job ".concat(utils_1.DependencyHeader.DeprecatedInclude), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
262
268
|
var dependencies;
|
|
263
269
|
return __generator(this, function (_a) {
|
|
264
270
|
switch (_a.label) {
|
|
265
271
|
case 0:
|
|
266
272
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeJobInit, fakeTerm);
|
|
267
|
-
return [4 /*yield*/, (0, 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)];
|
|
273
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
268
274
|
case 1:
|
|
269
275
|
dependencies = _a.sent();
|
|
270
276
|
expect(dependencies).toStartWith(compiledVars('Job'));
|
|
@@ -278,13 +284,13 @@ describe('loadDependencies', function () {
|
|
|
278
284
|
}
|
|
279
285
|
});
|
|
280
286
|
}); });
|
|
281
|
-
test(
|
|
287
|
+
test("it should load programs for a service with ".concat(utils_1.DependencyHeader.Include), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
282
288
|
var dependencies;
|
|
283
289
|
return __generator(this, function (_a) {
|
|
284
290
|
switch (_a.label) {
|
|
285
291
|
case 0:
|
|
286
292
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeJobInit2, fakeTerm2);
|
|
287
|
-
return [4 /*yield*/, (0, 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)];
|
|
293
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
288
294
|
case 1:
|
|
289
295
|
dependencies = _a.sent();
|
|
290
296
|
expect(dependencies).toStartWith(compiledVars('Service'));
|
|
@@ -298,13 +304,13 @@ describe('loadDependencies', function () {
|
|
|
298
304
|
}
|
|
299
305
|
});
|
|
300
306
|
}); });
|
|
301
|
-
test(
|
|
307
|
+
test("it should load programs for a job ".concat(utils_1.DependencyHeader.Include), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
302
308
|
var dependencies;
|
|
303
309
|
return __generator(this, function (_a) {
|
|
304
310
|
switch (_a.label) {
|
|
305
311
|
case 0:
|
|
306
312
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeJobInit2, fakeTerm2);
|
|
307
|
-
return [4 /*yield*/, (0, 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)];
|
|
313
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
308
314
|
case 1:
|
|
309
315
|
dependencies = _a.sent();
|
|
310
316
|
expect(dependencies).toStartWith(compiledVars('Job'));
|
|
@@ -318,13 +324,13 @@ describe('loadDependencies', function () {
|
|
|
318
324
|
}
|
|
319
325
|
});
|
|
320
326
|
}); });
|
|
321
|
-
test("it should load dependencies for a job having jobInit's
|
|
327
|
+
test("it should load dependencies for a job having jobInit's ".concat(utils_1.DependencyHeader.DeprecatedInclude), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
322
328
|
var dependencies;
|
|
323
329
|
return __generator(this, function (_a) {
|
|
324
330
|
switch (_a.label) {
|
|
325
331
|
case 0:
|
|
326
332
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeJobInit, fakeTerm2);
|
|
327
|
-
return [4 /*yield*/, (0, 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
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
328
334
|
case 1:
|
|
329
335
|
dependencies = _a.sent();
|
|
330
336
|
expect(dependencies).toStartWith(compiledVars('Job'));
|
|
@@ -341,13 +347,13 @@ describe('loadDependencies', function () {
|
|
|
341
347
|
}
|
|
342
348
|
});
|
|
343
349
|
}); });
|
|
344
|
-
test("it should load dependencies for a job having jobTerm's
|
|
350
|
+
test("it should load dependencies for a job having jobTerm's ".concat(utils_1.DependencyHeader.DeprecatedInclude), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
345
351
|
var dependencies;
|
|
346
352
|
return __generator(this, function (_a) {
|
|
347
353
|
switch (_a.label) {
|
|
348
354
|
case 0:
|
|
349
355
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeInit2, fakeJobInit);
|
|
350
|
-
return [4 /*yield*/, (0, 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)];
|
|
356
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
351
357
|
case 1:
|
|
352
358
|
dependencies = _a.sent();
|
|
353
359
|
expect(dependencies).toStartWith(compiledVars('Job'));
|
|
@@ -363,13 +369,13 @@ describe('loadDependencies', function () {
|
|
|
363
369
|
}
|
|
364
370
|
});
|
|
365
371
|
}); });
|
|
366
|
-
test("it should load dependencies for a service having serviceInit's
|
|
372
|
+
test("it should load dependencies for a service having serviceInit's ".concat(utils_1.DependencyHeader.DeprecatedInclude), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
367
373
|
var dependencies;
|
|
368
374
|
return __generator(this, function (_a) {
|
|
369
375
|
switch (_a.label) {
|
|
370
376
|
case 0:
|
|
371
377
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeJobInit, fakeTerm2);
|
|
372
|
-
return [4 /*yield*/, (0, 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)];
|
|
378
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
373
379
|
case 1:
|
|
374
380
|
dependencies = _a.sent();
|
|
375
381
|
expect(dependencies).toStartWith(compiledVars('Service'));
|
|
@@ -386,13 +392,13 @@ describe('loadDependencies', function () {
|
|
|
386
392
|
}
|
|
387
393
|
});
|
|
388
394
|
}); });
|
|
389
|
-
test("it should load dependencies for a service having serviceTerm's
|
|
395
|
+
test("it should load dependencies for a service having serviceTerm's ".concat(utils_1.DependencyHeader.DeprecatedInclude), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
390
396
|
var dependencies;
|
|
391
397
|
return __generator(this, function (_a) {
|
|
392
398
|
switch (_a.label) {
|
|
393
399
|
case 0:
|
|
394
400
|
(0, getInitTerm_1.mockGetProgram)(internalModule, fakeInit2, fakeJobInit);
|
|
395
|
-
return [4 /*yield*/, (0, 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)];
|
|
401
|
+
return [4 /*yield*/, (0, 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, compileTree)];
|
|
396
402
|
case 1:
|
|
397
403
|
dependencies = _a.sent();
|
|
398
404
|
expect(dependencies).toStartWith(compiledVars('Service'));
|
|
@@ -59,14 +59,14 @@ var deployToSasViyaWithServicePack_1 = require("../shared/deployToSasViyaWithSer
|
|
|
59
59
|
function deploy(target, isLocal, sasjs) {
|
|
60
60
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
61
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var appLoc, buildDestinationFolder_1, finalFilePathJSON, jsonObject, webIndexFileName, deployScripts, buildDestinationFolder, logFilePath;
|
|
62
|
+
var appLoc, buildDestinationFolder_1, finalFilePathJSON, jsonObject, webIndexFileName, deployScripts, buildDestinationFolder, logFilePath, streamConfig;
|
|
63
63
|
var _this = this;
|
|
64
64
|
return __generator(this, function (_k) {
|
|
65
65
|
switch (_k.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];
|
|
69
|
-
appLoc = target.appLoc
|
|
69
|
+
appLoc = encodeURI(target.appLoc);
|
|
70
70
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Deploying service pack to ".concat(target.serverUrl, " at location ").concat(appLoc, " ."));
|
|
71
71
|
buildDestinationFolder_1 = process.sasjsConstants.buildDestinationFolder;
|
|
72
72
|
finalFilePathJSON = path_1.default.join(buildDestinationFolder_1, "".concat(target.name, ".json"));
|
|
@@ -89,19 +89,22 @@ function deploy(target, isLocal, sasjs) {
|
|
|
89
89
|
}
|
|
90
90
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
91
91
|
logFilePath = buildDestinationFolder;
|
|
92
|
-
|
|
93
|
-
return [4 /*yield*/, deployToSasjs(target, sasjs)];
|
|
92
|
+
return [4 /*yield*/, (0, config_1.getStreamConfig)(target)];
|
|
94
93
|
case 4:
|
|
94
|
+
streamConfig = _k.sent();
|
|
95
|
+
if (!(target.serverType === utils_2.ServerType.Sasjs)) return [3 /*break*/, 6];
|
|
96
|
+
return [4 /*yield*/, deployToSasjs(target, sasjs, streamConfig)];
|
|
97
|
+
case 5:
|
|
95
98
|
_k.sent();
|
|
96
|
-
return [3 /*break*/,
|
|
97
|
-
case
|
|
98
|
-
var deployScriptPath, deployScriptContent, linesToExecute,
|
|
99
|
+
return [3 /*break*/, 8];
|
|
100
|
+
case 6: return [4 /*yield*/, (0, utils_2.asyncForEach)(deployScripts, function (deployScript) { return __awaiter(_this, void 0, void 0, function () {
|
|
101
|
+
var deployScriptPath, deployScriptContent, linesToExecute, deployScriptName, logPath;
|
|
99
102
|
var _a, _b, _c;
|
|
100
103
|
return __generator(this, function (_d) {
|
|
101
104
|
switch (_d.label) {
|
|
102
105
|
case 0:
|
|
103
106
|
deployScriptPath = (0, utils_2.getAbsolutePath)(deployScript, process.projectDir);
|
|
104
|
-
if (!(0, file_1.isSasFile)(deployScript)) return [3 /*break*/,
|
|
107
|
+
if (!(0, file_1.isSasFile)(deployScript)) return [3 /*break*/, 6];
|
|
105
108
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Processing SAS file ".concat(path_1.default.basename(deployScript), " ..."));
|
|
106
109
|
return [4 /*yield*/, (0, utils_2.readFile)(deployScriptPath)
|
|
107
110
|
// split into lines
|
|
@@ -111,37 +114,34 @@ function deploy(target, isLocal, sasjs) {
|
|
|
111
114
|
linesToExecute = deployScriptContent
|
|
112
115
|
.replace(/\r\n/g, '\n')
|
|
113
116
|
.split('\n');
|
|
114
|
-
return [4 /*yield*/, (0, config_1.getStreamConfig)(target)];
|
|
115
|
-
case 2:
|
|
116
|
-
streamConfig = _d.sent();
|
|
117
117
|
deployScriptName = path_1.default.basename(deployScript);
|
|
118
|
-
if (!(target.serverType === utils_2.ServerType.SasViya)) return [3 /*break*/,
|
|
118
|
+
if (!(target.serverType === utils_2.ServerType.SasViya)) return [3 /*break*/, 3];
|
|
119
119
|
return [4 /*yield*/, deployToSasViya(deployScriptName, target, isLocal, linesToExecute, logFilePath, streamConfig)];
|
|
120
|
-
case
|
|
120
|
+
case 2:
|
|
121
121
|
_d.sent();
|
|
122
|
-
return [3 /*break*/,
|
|
123
|
-
case
|
|
124
|
-
case
|
|
122
|
+
return [3 /*break*/, 5];
|
|
123
|
+
case 3: return [4 /*yield*/, deployToSas9(deployScriptName, target, linesToExecute, logFilePath, streamConfig)];
|
|
124
|
+
case 4:
|
|
125
125
|
_d.sent();
|
|
126
|
-
_d.label =
|
|
127
|
-
case
|
|
128
|
-
case
|
|
129
|
-
if (!(0, file_1.isShellScript)(deployScript)) return [3 /*break*/,
|
|
126
|
+
_d.label = 5;
|
|
127
|
+
case 5: return [3 /*break*/, 8];
|
|
128
|
+
case 6:
|
|
129
|
+
if (!(0, file_1.isShellScript)(deployScript)) return [3 /*break*/, 8];
|
|
130
130
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Executing shell script ".concat(deployScript, " ..."));
|
|
131
131
|
logPath = path_1.default.join(process.projectDir, 'sasjsbuild', "".concat(path_1.default.basename(deployScript).replace('.sh', ''), ".log"));
|
|
132
132
|
return [4 /*yield*/, (0, utils_1.executeShellScript)(deployScriptPath, logPath)];
|
|
133
|
-
case
|
|
133
|
+
case 7:
|
|
134
134
|
_d.sent();
|
|
135
135
|
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Shell script execution completed! Log is here: ".concat(logPath));
|
|
136
|
-
_d.label =
|
|
137
|
-
case
|
|
136
|
+
_d.label = 8;
|
|
137
|
+
case 8: return [2 /*return*/];
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
}); })];
|
|
141
|
-
case
|
|
141
|
+
case 7:
|
|
142
142
|
_k.sent();
|
|
143
|
-
_k.label =
|
|
144
|
-
case
|
|
143
|
+
_k.label = 8;
|
|
144
|
+
case 8: return [2 /*return*/];
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
});
|
|
@@ -239,7 +239,7 @@ function deployToSasViya(deployScriptName, target, isLocal, linesToExecute, logF
|
|
|
239
239
|
_g.label = 5;
|
|
240
240
|
case 5:
|
|
241
241
|
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
242
|
-
appLoc = target.appLoc
|
|
242
|
+
appLoc = encodeURI(target.appLoc);
|
|
243
243
|
webAppStreamUrl = "".concat(target.serverUrl, "/SASJobExecution?_FILE=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName, ".html&_debug=2");
|
|
244
244
|
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.info("Web app is available at ".concat(webAppStreamUrl));
|
|
245
245
|
}
|
|
@@ -317,7 +317,7 @@ function deployToSas9(deployScriptName, target, linesToExecute, logFolder, strea
|
|
|
317
317
|
}
|
|
318
318
|
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.success("Deployment completed! Log is available at ".concat(logFilePath));
|
|
319
319
|
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
320
|
-
appLoc = target.appLoc
|
|
320
|
+
appLoc = encodeURI(target.appLoc);
|
|
321
321
|
webAppStreamUrl = "".concat(target.serverUrl, "/SASStoredProcess/?_PROGRAM=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName);
|
|
322
322
|
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.info("Web app is available at ".concat(webAppStreamUrl));
|
|
323
323
|
}
|
|
@@ -331,18 +331,18 @@ function deployToSas9(deployScriptName, target, linesToExecute, logFolder, strea
|
|
|
331
331
|
* @param {Target} target- the target having deploy configuration.
|
|
332
332
|
* @param {object} sasjs - optional configuration object of SAS adapter.
|
|
333
333
|
*/
|
|
334
|
-
function deployToSasjs(target, sasjs) {
|
|
335
|
-
var _a, _b;
|
|
334
|
+
function deployToSasjs(target, sasjs, streamConfig) {
|
|
335
|
+
var _a, _b, _c;
|
|
336
336
|
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
-
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, authConfig, e_2, result;
|
|
338
|
-
return __generator(this, function (
|
|
339
|
-
switch (
|
|
337
|
+
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, authConfig, e_2, result, appLoc, webAppStreamUrl;
|
|
338
|
+
return __generator(this, function (_d) {
|
|
339
|
+
switch (_d.label) {
|
|
340
340
|
case 0:
|
|
341
341
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
342
342
|
finalFilePathJSON = path_1.default.join(buildDestinationFolder, "".concat(target.name, ".json"));
|
|
343
343
|
return [4 /*yield*/, (0, utils_2.readFile)(finalFilePathJSON)];
|
|
344
344
|
case 1:
|
|
345
|
-
jsonContent =
|
|
345
|
+
jsonContent = _d.sent();
|
|
346
346
|
payload = JSON.parse(jsonContent);
|
|
347
347
|
if (!!sasjs) return [3 /*break*/, 5];
|
|
348
348
|
sasjs = new node_1.default({
|
|
@@ -352,15 +352,15 @@ function deployToSasjs(target, sasjs) {
|
|
|
352
352
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
353
353
|
debug: true
|
|
354
354
|
});
|
|
355
|
-
|
|
355
|
+
_d.label = 2;
|
|
356
356
|
case 2:
|
|
357
|
-
|
|
357
|
+
_d.trys.push([2, 4, , 5]);
|
|
358
358
|
return [4 /*yield*/, (0, config_1.getAuthConfig)(target)];
|
|
359
359
|
case 3:
|
|
360
|
-
authConfig =
|
|
360
|
+
authConfig = _d.sent();
|
|
361
361
|
return [3 /*break*/, 5];
|
|
362
362
|
case 4:
|
|
363
|
-
e_2 =
|
|
363
|
+
e_2 = _d.sent();
|
|
364
364
|
return [3 /*break*/, 5];
|
|
365
365
|
case 5: return [4 /*yield*/, sasjs
|
|
366
366
|
.deployToSASjs(payload, undefined, authConfig)
|
|
@@ -369,13 +369,18 @@ function deployToSasjs(target, sasjs) {
|
|
|
369
369
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
|
|
370
370
|
})];
|
|
371
371
|
case 6:
|
|
372
|
-
result =
|
|
372
|
+
result = _d.sent();
|
|
373
373
|
if ((result === null || result === void 0 ? void 0 : result.status) === 'failure') {
|
|
374
374
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(result.message);
|
|
375
375
|
if (result.example) {
|
|
376
376
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Payload example:\n".concat(JSON.stringify(result.example, null, 2)));
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
+
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
380
|
+
appLoc = encodeURI(target.appLoc);
|
|
381
|
+
webAppStreamUrl = "".concat(target.serverUrl, "/AppStream").concat(appLoc);
|
|
382
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Web app is available at ".concat(webAppStreamUrl));
|
|
383
|
+
}
|
|
379
384
|
return [2 /*return*/];
|
|
380
385
|
}
|
|
381
386
|
});
|
|
@@ -84,7 +84,6 @@ var utils_1 = require("@sasjs/utils");
|
|
|
84
84
|
var getFoldersForDocs_1 = require("./internal/getFoldersForDocs");
|
|
85
85
|
var createDotFiles_1 = require("./internal/createDotFiles");
|
|
86
86
|
var getDocConfig_1 = require("./internal/getDocConfig");
|
|
87
|
-
var utils_2 = require("../../utils");
|
|
88
87
|
/**
|
|
89
88
|
* Generates documentation(Doxygen)
|
|
90
89
|
* By default the docs will be at 'sasjsbuild/docs' folder
|
|
@@ -188,16 +187,13 @@ function generateDocs(target, config, outDirectory) {
|
|
|
188
187
|
exports.generateDocs = generateDocs;
|
|
189
188
|
function setVariableCmd(params) {
|
|
190
189
|
var command = '';
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
for (var param in params) {
|
|
190
|
+
if ((0, utils_1.isWindows)()) {
|
|
191
|
+
for (var param in params)
|
|
194
192
|
command += "set ".concat(param, "=").concat(params[param], " && ");
|
|
195
|
-
}
|
|
196
193
|
}
|
|
197
194
|
else {
|
|
198
|
-
for (var param in params)
|
|
195
|
+
for (var param in params)
|
|
199
196
|
command += "".concat(param, "='").concat(params[param], "' ");
|
|
200
|
-
}
|
|
201
197
|
}
|
|
202
198
|
return command;
|
|
203
199
|
}
|
|
@@ -9,7 +9,7 @@ var utils_1 = require("@sasjs/utils");
|
|
|
9
9
|
* @param {Map} paramNodes- Map for params(Inputs/Outputs)
|
|
10
10
|
*/
|
|
11
11
|
function getFileInputs(fileName, fileContent, paramNodes) {
|
|
12
|
-
var fileInputs = (0, utils_1.getList)(
|
|
12
|
+
var fileInputs = (0, utils_1.getList)(utils_1.DependencyHeader.DataInput, fileContent)
|
|
13
13
|
.map(function (input) { return input.toUpperCase(); })
|
|
14
14
|
.filter(function (input) { return !input.endsWith('.DLL'); });
|
|
15
15
|
fileInputs.forEach(function (inputParam) {
|
|
@@ -8,7 +8,7 @@ var utils_1 = require("@sasjs/utils");
|
|
|
8
8
|
* @param {Map} paramNodes- Map for params(Inputs/Outputs)
|
|
9
9
|
*/
|
|
10
10
|
function getFileOutputs(fileContent, paramNodes) {
|
|
11
|
-
var fileOutputs = (0, utils_1.getList)(
|
|
11
|
+
var fileOutputs = (0, utils_1.getList)(utils_1.DependencyHeader.DataOutput, fileContent)
|
|
12
12
|
.map(function (output) { return output.toUpperCase(); })
|
|
13
13
|
.filter(function (output) { return !output.endsWith('.DLL'); });
|
|
14
14
|
fileOutputs.forEach(function (outputParam) {
|
|
@@ -130,12 +130,32 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
|
|
|
130
130
|
case 2:
|
|
131
131
|
output = '';
|
|
132
132
|
if (res === null || res === void 0 ? void 0 : res.result)
|
|
133
|
-
|
|
133
|
+
res = res.result;
|
|
134
|
+
// In sasjs request debug is always on, meaning the response object always contains the log
|
|
135
|
+
// This log goes to a seperate .log file, and should not be added to the output file (*.json)
|
|
136
|
+
// Therefore, we delete it now from the result object
|
|
137
|
+
else if (res === null || res === void 0 ? void 0 : res.log)
|
|
138
|
+
delete res.log;
|
|
139
|
+
// Sometimes res.result contains the log (eg when there is a SAS error)
|
|
140
|
+
// Here we make sure that the content in the output file (*.json) will be in json format
|
|
141
|
+
if (typeof res === 'string') {
|
|
142
|
+
try {
|
|
143
|
+
output = JSON.parse(res);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
(0, displayResult_1.displayError)('Error parsing response. JSON is expected.');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
output = res;
|
|
151
|
+
}
|
|
152
|
+
if (!!!output) return [3 /*break*/, 4];
|
|
134
153
|
return [4 /*yield*/, writeOutput(outputPathParam, output, isLocal)];
|
|
135
154
|
case 3:
|
|
136
155
|
_a.sent();
|
|
137
|
-
|
|
138
|
-
case 4:
|
|
156
|
+
_a.label = 4;
|
|
157
|
+
case 4: return [4 /*yield*/, saveLogFile(sasjs, sasJobLocation, logFile, jobPath)];
|
|
158
|
+
case 5:
|
|
139
159
|
_a.sent();
|
|
140
160
|
result = true;
|
|
141
161
|
return [2 /*return*/];
|
|
@@ -143,6 +163,7 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
|
|
|
143
163
|
});
|
|
144
164
|
}); })
|
|
145
165
|
.catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
+
var error;
|
|
146
167
|
return __generator(this, function (_a) {
|
|
147
168
|
switch (_a.label) {
|
|
148
169
|
case 0:
|
|
@@ -150,7 +171,10 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
|
|
|
150
171
|
(0, utils_2.displaySasjsRunnerError)(configJson.username);
|
|
151
172
|
}
|
|
152
173
|
else {
|
|
153
|
-
|
|
174
|
+
error = {};
|
|
175
|
+
if (err.message)
|
|
176
|
+
error.message = err.message;
|
|
177
|
+
(0, displayResult_1.displayError)(error, 'An error occurred while executing the request.');
|
|
154
178
|
}
|
|
155
179
|
return [4 /*yield*/, saveLogFile(sasjs, sasJobLocation, logFile, jobPath)];
|
|
156
180
|
case 1:
|