@sasjs/utils 3.4.1 → 3.5.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.
- package/.all-contributorsrc +12 -1
- package/.github/workflows/run-tests-windows.yml +1 -1
- package/.github/workflows/run-tests.yml +1 -1
- package/README.md +15 -12
- package/auth/auth.js +6 -8
- package/auth/auth.js.map +1 -1
- package/compileTree/compileTree.js +37 -89
- package/compileTree/compileTree.js.map +1 -1
- package/conversion/convertJsDateToSasDate.js +6 -6
- package/conversion/convertJsDateToSasDate.js.map +1 -1
- package/conversion/convertSasDateToJsDate.js +8 -8
- package/conversion/convertSasDateToJsDate.js.map +1 -1
- package/error/errorModifier.js +3 -14
- package/error/errorModifier.js.map +1 -1
- package/error/serverTypeError.js +9 -54
- package/error/serverTypeError.js.map +1 -1
- package/file/csvFile.js +72 -159
- package/file/csvFile.js.map +1 -1
- package/file/file.js +121 -264
- package/file/file.js.map +1 -1
- package/file/getAbsolutePath.js +5 -7
- package/file/getAbsolutePath.js.map +1 -1
- package/formatter/number.js +2 -3
- package/formatter/number.js.map +1 -1
- package/formatter/regexp.js +1 -1
- package/formatter/regexp.js.map +1 -1
- package/formatter/string.js +2 -6
- package/formatter/string.js.map +1 -1
- package/fs/generateCompileProgram.js +36 -145
- package/fs/generateCompileProgram.js.map +1 -1
- package/fs/hash.js +83 -186
- package/fs/hash.js.map +1 -1
- package/fs/internal/helper.js +60 -99
- package/fs/internal/helper.js.map +1 -1
- package/fs/sync.js +86 -192
- package/fs/sync.js.map +1 -1
- package/input/readAndValidateInput.js +80 -163
- package/input/readAndValidateInput.js.map +1 -1
- package/input/validators.js +9 -13
- package/input/validators.js.map +1 -1
- package/logger/isLowerThanOrEqualTo.js +2 -2
- package/logger/isLowerThanOrEqualTo.js.map +1 -1
- package/logger/isNullOrUndefined.js +1 -1
- package/logger/isNullOrUndefined.js.map +1 -1
- package/logger/logger.js +45 -104
- package/logger/logger.js.map +1 -1
- package/package.json +2 -3
- package/sasjsCli/getDependencies.js +122 -198
- package/sasjsCli/getDependencies.js.map +1 -1
- package/sasjsCli/getDependencyPaths.js +40 -131
- package/sasjsCli/getDependencyPaths.js.map +1 -1
- package/sasjsCli/getInitTerm.js +90 -192
- package/sasjsCli/getInitTerm.js.map +1 -1
- package/sasjsCli/getList.js +13 -13
- package/sasjsCli/getList.js.map +1 -1
- package/sasjsCli/getPreCode.js +41 -79
- package/sasjsCli/getPreCode.js.map +1 -1
- package/sasjsCli/loadDependenciesFile.js +63 -160
- package/sasjsCli/loadDependenciesFile.js.map +1 -1
- package/sasjsCli/prioritiseDependencyOverrides.js +10 -39
- package/sasjsCli/prioritiseDependencyOverrides.js.map +1 -1
- package/sasjsCli/validateFileRef.js +1 -1
- package/sasjsCli/validateFileRef.js.map +1 -1
- package/time/timestamp.js +16 -18
- package/time/timestamp.js.map +1 -1
- package/types/macro.js +1 -3
- package/types/macro.js.map +1 -1
- package/types/target.js +86 -197
- package/types/target.js.map +1 -1
- package/types/targetValidators.js +32 -32
- package/types/targetValidators.js.map +1 -1
- package/utils/base64.js +7 -7
- package/utils/base64.js.map +1 -1
- package/utils/bytesToSize.js +6 -8
- package/utils/bytesToSize.js.map +1 -1
- package/utils/chunk.js +2 -3
- package/utils/chunk.js.map +1 -1
- package/utils/diff.js +7 -36
- package/utils/diff.js.map +1 -1
- package/utils/executor.js +2 -2
- package/utils/executor.js.map +1 -1
- package/utils/fileTree.js +25 -37
- package/utils/fileTree.js.map +1 -1
- package/utils/url.js +2 -2
- package/utils/url.js.map +1 -1
- package/utils/utils.js +15 -63
- package/utils/utils.js.map +1 -1
|
@@ -8,60 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
-
if (!m) return o;
|
|
41
|
-
var i = m.call(o), r, ar = [], e;
|
|
42
|
-
try {
|
|
43
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
-
}
|
|
45
|
-
catch (error) { e = { error: error }; }
|
|
46
|
-
finally {
|
|
47
|
-
try {
|
|
48
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
-
}
|
|
50
|
-
finally { if (e) throw e.error; }
|
|
51
|
-
}
|
|
52
|
-
return ar;
|
|
53
|
-
};
|
|
54
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
55
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
56
13
|
};
|
|
57
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
15
|
exports.getDeprecatedHeader = exports.getDependencies = exports.getDepInfo = exports.DependencyHeader = exports.DependencyType = void 0;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
const _1 = require("./");
|
|
18
|
+
const utils_2 = require("../utils");
|
|
19
|
+
const find_1 = __importDefault(require("find"));
|
|
20
|
+
const file_1 = require("../file");
|
|
21
|
+
const formatter_1 = require("../formatter");
|
|
65
22
|
// REFACTOR: move logic supporting SAS Macros dependencies to this file
|
|
66
23
|
var DependencyType;
|
|
67
24
|
(function (DependencyType) {
|
|
@@ -79,210 +36,177 @@ var DependencyHeader;
|
|
|
79
36
|
DependencyHeader["DeprecatedMacro"] = "<h4> Dependencies </h4>";
|
|
80
37
|
DependencyHeader["DeprecatedInclude"] = "<h4> SAS Programs </h4>";
|
|
81
38
|
})(DependencyHeader = exports.DependencyHeader || (exports.DependencyHeader = {}));
|
|
82
|
-
|
|
83
|
-
|
|
39
|
+
const getDepInfo = (depType, fileContent) => {
|
|
40
|
+
const header = depType === DependencyType.Include
|
|
84
41
|
? fileContent.includes(DependencyHeader.Include)
|
|
85
42
|
? DependencyHeader.Include
|
|
86
43
|
: DependencyHeader.DeprecatedInclude
|
|
87
44
|
: DependencyHeader[depType];
|
|
88
|
-
|
|
45
|
+
const depInfo = {
|
|
89
46
|
name: getHeaderName(header),
|
|
90
47
|
header: depType === DependencyType.Include
|
|
91
48
|
? fileContent.includes(DependencyHeader.Include)
|
|
92
49
|
? DependencyHeader.Include
|
|
93
50
|
: DependencyHeader.DeprecatedInclude
|
|
94
51
|
: DependencyHeader[depType],
|
|
95
|
-
config:
|
|
52
|
+
config: `${(depType === DependencyType.Include
|
|
96
53
|
? 'Program'
|
|
97
|
-
: depType).toLowerCase()
|
|
54
|
+
: depType).toLowerCase()}Folders`,
|
|
98
55
|
type: depType
|
|
99
56
|
};
|
|
100
57
|
return depInfo;
|
|
101
58
|
};
|
|
102
59
|
exports.getDepInfo = getDepInfo;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
encodedFileContent = '';
|
|
129
|
-
if (!(compileTree &&
|
|
130
|
-
Object.keys(compileTree).length &&
|
|
131
|
-
depType !== DependencyType.Binary)) return [3 /*break*/, 2];
|
|
132
|
-
return [4 /*yield*/, compileTree.getDepContent(filePaths[0], depType)];
|
|
133
|
-
case 1:
|
|
134
|
-
encodedFileContent = _a.sent();
|
|
135
|
-
return [3 /*break*/, 4];
|
|
136
|
-
case 2: return [4 /*yield*/, (0, file_1.readFile)(filePaths[0], depType === DependencyType.Binary ? 'base64' : undefined)];
|
|
137
|
-
case 3:
|
|
138
|
-
encodedFileContent = _a.sent();
|
|
139
|
-
_a.label = 4;
|
|
140
|
-
case 4:
|
|
141
|
-
depContent = compileDep(depType, encodedFileContent, dep.fileRef);
|
|
142
|
-
foundDeps_1.push(depContent);
|
|
143
|
-
foundDepsNames_1.push(dep.fileName);
|
|
144
|
-
_a.label = 5;
|
|
145
|
-
case 5: return [2 /*return*/];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}); })];
|
|
149
|
-
case 1:
|
|
150
|
-
_a.sent();
|
|
151
|
-
return [2 /*return*/];
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}); })];
|
|
155
|
-
case 1:
|
|
156
|
-
_a.sent();
|
|
157
|
-
notFoundDeps = deps
|
|
158
|
-
.filter(function (dep) { return !foundDepsNames_1.includes(dep.fileName); })
|
|
159
|
-
.map(function (dep, i) { return "".concat(i + 1, ". '").concat(dep.fileName, "' with fileRef '").concat(dep.fileRef, "'"); })
|
|
160
|
-
.join('\n');
|
|
161
|
-
if (notFoundDeps.length) {
|
|
162
|
-
depFolder = depInfo.config.replace(/([A-Z]+)/g, ' $1');
|
|
163
|
-
depFolder = (0, formatter_1.capitalizeFirstChar)(depFolder);
|
|
164
|
-
throw new Error("Unable to load dependencies for: ".concat(fileName || '', "\n") +
|
|
165
|
-
"The following files were listed under ".concat(depInfo.name, " but could not be found:\n") +
|
|
166
|
-
"".concat(notFoundDeps, "\n") +
|
|
167
|
-
"Please check that they exist in the folder(s) listed in the `".concat(depInfo.config, "` array in your sasjsconfig.json file.\n") +
|
|
168
|
-
"".concat(depFolder, ":\n") +
|
|
169
|
-
folders.map(function (folder) { return "- ".concat(folder); }).join('\n'));
|
|
60
|
+
const getDependencies = (fileName, fileContent, folders, depType, compileTree) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
folders = (0, utils_1.uniqArray)(folders);
|
|
62
|
+
const depInfo = (0, exports.getDepInfo)(depType, fileContent);
|
|
63
|
+
const deps = deconstructDependency((0, _1.getList)(depInfo.header, fileContent), depInfo);
|
|
64
|
+
const uniqDeps = [];
|
|
65
|
+
deps.forEach((dep) => uniqDeps.find((d) => dep.fileName === d.fileName) || uniqDeps.push(dep));
|
|
66
|
+
if (uniqDeps.length) {
|
|
67
|
+
const foundDeps = [];
|
|
68
|
+
const foundDepsNames = [];
|
|
69
|
+
yield (0, utils_2.asyncForEach)(folders, (folder) => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
yield (0, utils_2.asyncForEach)(uniqDeps, (dep) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
const filePaths = find_1.default.fileSync(dep.fileName, folder);
|
|
72
|
+
if (filePaths.length) {
|
|
73
|
+
let encodedFileContent = '';
|
|
74
|
+
if (compileTree &&
|
|
75
|
+
Object.keys(compileTree).length &&
|
|
76
|
+
depType !== DependencyType.Binary) {
|
|
77
|
+
encodedFileContent = yield compileTree.getDepContent(filePaths[0], depType);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
encodedFileContent = yield (0, file_1.readFile)(filePaths[0], depType === DependencyType.Binary ? 'base64' : undefined);
|
|
81
|
+
}
|
|
82
|
+
const depContent = compileDep(depType, encodedFileContent, dep.fileRef);
|
|
83
|
+
foundDeps.push(depContent);
|
|
84
|
+
foundDepsNames.push(dep.fileName);
|
|
170
85
|
}
|
|
171
|
-
|
|
172
|
-
|
|
86
|
+
}));
|
|
87
|
+
}));
|
|
88
|
+
const notFoundDeps = deps
|
|
89
|
+
.filter((dep) => !foundDepsNames.includes(dep.fileName))
|
|
90
|
+
.map((dep, i) => `${i + 1}. '${dep.fileName}' with fileRef '${dep.fileRef}'`)
|
|
91
|
+
.join('\n');
|
|
92
|
+
if (notFoundDeps.length) {
|
|
93
|
+
let depFolder = depInfo.config.replace(/([A-Z]+)/g, ' $1');
|
|
94
|
+
depFolder = (0, formatter_1.capitalizeFirstChar)(depFolder);
|
|
95
|
+
throw new Error(`Unable to load dependencies for: ${fileName || ''}\n` +
|
|
96
|
+
`The following files were listed under ${depInfo.name} but could not be found:\n` +
|
|
97
|
+
`${notFoundDeps}\n` +
|
|
98
|
+
`Please check that they exist in the folder(s) listed in the \`${depInfo.config}\` array in your sasjsconfig.json file.\n` +
|
|
99
|
+
`${depFolder}:\n` +
|
|
100
|
+
folders.map((folder) => `- ${folder}`).join('\n'));
|
|
173
101
|
}
|
|
174
|
-
|
|
175
|
-
}
|
|
102
|
+
return foundDeps.join('\n');
|
|
103
|
+
}
|
|
104
|
+
return '';
|
|
105
|
+
});
|
|
176
106
|
exports.getDependencies = getDependencies;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
: DependencyHeader.DeprecatedInclude;
|
|
183
|
-
};
|
|
107
|
+
const getDeprecatedHeader = (fileContent, header) => fileContent.includes(header)
|
|
108
|
+
? header
|
|
109
|
+
: header === DependencyHeader.Macro
|
|
110
|
+
? DependencyHeader.DeprecatedMacro
|
|
111
|
+
: DependencyHeader.DeprecatedInclude;
|
|
184
112
|
exports.getDeprecatedHeader = getDeprecatedHeader;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
var compileDep = function (depType, fileContent, fileRef) {
|
|
200
|
-
var output = '';
|
|
113
|
+
const deconstructDependency = (deps, depInfo) => deps.map((dep) => {
|
|
114
|
+
const [fileName, fileRef] = dep.split(' ').filter((f) => !!f);
|
|
115
|
+
if (!fileName) {
|
|
116
|
+
throw new Error(`${depInfo.name} entry is empty. Please specify ${depInfo.name} dependencies in the format: @li <filename> <fileref>`);
|
|
117
|
+
}
|
|
118
|
+
if (!fileRef && depInfo.type !== DependencyType.Macro) {
|
|
119
|
+
throw new Error(`${depInfo.name} ${fileName} is missing fileref. Please specify ${depInfo.name} dependencies in the format: @li <filename> <fileref>`);
|
|
120
|
+
}
|
|
121
|
+
if (depInfo.type !== DependencyType.Macro)
|
|
122
|
+
(0, _1.validateFileRef)(fileRef);
|
|
123
|
+
return { fileName, fileRef };
|
|
124
|
+
});
|
|
125
|
+
const compileDep = (depType, fileContent, fileRef) => {
|
|
126
|
+
let output = '';
|
|
201
127
|
if (depType === DependencyType.Binary) {
|
|
202
128
|
output = [
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
].join(
|
|
207
|
-
|
|
129
|
+
`filename _sjstmp "%sysfunc(pathname(work))/base64_${fileRef}" recfm=n;`,
|
|
130
|
+
`data _null_;`,
|
|
131
|
+
`file _sjstmp;\n`
|
|
132
|
+
].join(`\n`);
|
|
133
|
+
const sourceLines = fileContent
|
|
208
134
|
.replace(/\r\n/g, '\n')
|
|
209
135
|
.split('\n')
|
|
210
|
-
.filter(
|
|
211
|
-
sourceLines.forEach(
|
|
212
|
-
|
|
136
|
+
.filter((l) => !!l);
|
|
137
|
+
sourceLines.forEach((line) => {
|
|
138
|
+
const chunkedLines = (0, utils_2.chunk)(line);
|
|
213
139
|
if (chunkedLines.length === 1) {
|
|
214
|
-
output +=
|
|
140
|
+
output += `put '${chunkedLines[0].split("'").join("''")}';\n`;
|
|
215
141
|
}
|
|
216
142
|
else {
|
|
217
|
-
|
|
218
|
-
chunkedLines.forEach(
|
|
219
|
-
|
|
143
|
+
let combinedLines = '';
|
|
144
|
+
chunkedLines.forEach((chunkedLine, index) => {
|
|
145
|
+
let text = `put '${chunkedLine.split("'").join("''")}'`;
|
|
220
146
|
if (index !== chunkedLines.length - 1) {
|
|
221
147
|
text += '@;\n';
|
|
222
148
|
}
|
|
223
149
|
else {
|
|
224
150
|
text += ';\n';
|
|
225
151
|
}
|
|
226
|
-
|
|
152
|
+
combinedLines += text;
|
|
227
153
|
});
|
|
228
|
-
output +=
|
|
154
|
+
output += combinedLines;
|
|
229
155
|
}
|
|
230
156
|
});
|
|
231
|
-
output +=
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
157
|
+
output += `run;\n`;
|
|
158
|
+
const sasCodeToDecodeBase64 = [
|
|
159
|
+
`filename ${fileRef} "%sysfunc(pathname(work))/sasjs_${fileRef}";`,
|
|
160
|
+
`data _null_;`,
|
|
161
|
+
`length filein 8 fileout 8;`,
|
|
162
|
+
`filein = fopen("_sjstmp",'I',4,'B');`,
|
|
163
|
+
`fileout = fopen("${fileRef}",'O',3,'B');`,
|
|
164
|
+
`char= '20'x;`,
|
|
165
|
+
`do while(fread(filein)=0);`,
|
|
166
|
+
`length raw $4;`,
|
|
167
|
+
`do i=1 to 4;`,
|
|
168
|
+
`rc=fget(filein,char,1);`,
|
|
169
|
+
`substr(raw,i,1)=char;`,
|
|
170
|
+
`end;`,
|
|
171
|
+
`rc = fput(fileout,input(raw,$base64X4.));`,
|
|
172
|
+
`rc = fwrite(fileout);`,
|
|
173
|
+
`end;`,
|
|
174
|
+
`rc = fclose(filein);`,
|
|
175
|
+
`rc = fclose(fileout);`,
|
|
176
|
+
`run;`,
|
|
177
|
+
`filename _sjstmp clear;`
|
|
252
178
|
];
|
|
253
|
-
output += sasCodeToDecodeBase64.join(
|
|
179
|
+
output += sasCodeToDecodeBase64.join(`\n`);
|
|
254
180
|
}
|
|
255
181
|
else if (depType === DependencyType.Include) {
|
|
256
|
-
output =
|
|
257
|
-
|
|
182
|
+
output = `filename ${fileRef} temp;\ndata _null_;\nfile ${fileRef} lrecl=32767;\n`;
|
|
183
|
+
const sourceLines = fileContent
|
|
258
184
|
.replace(/\r\n/g, '\n')
|
|
259
185
|
.split('\n')
|
|
260
|
-
.filter(
|
|
261
|
-
sourceLines.forEach(
|
|
262
|
-
|
|
186
|
+
.filter((l) => !!l);
|
|
187
|
+
sourceLines.forEach((line) => {
|
|
188
|
+
const chunkedLines = (0, utils_2.chunk)(line);
|
|
263
189
|
if (chunkedLines.length === 1) {
|
|
264
|
-
output +=
|
|
190
|
+
output += `put '${chunkedLines[0].split("'").join("''")}';\n`;
|
|
265
191
|
}
|
|
266
192
|
else {
|
|
267
|
-
|
|
268
|
-
chunkedLines.forEach(
|
|
269
|
-
|
|
193
|
+
let combinedLines = '';
|
|
194
|
+
chunkedLines.forEach((chunkedLine, index) => {
|
|
195
|
+
let text = `put '${chunkedLine.split("'").join("''")}'`;
|
|
270
196
|
if (index !== chunkedLines.length - 1) {
|
|
271
197
|
text += '@;\n';
|
|
272
198
|
}
|
|
273
199
|
else {
|
|
274
200
|
text += ';\n';
|
|
275
201
|
}
|
|
276
|
-
|
|
202
|
+
combinedLines += text;
|
|
277
203
|
});
|
|
278
|
-
output +=
|
|
204
|
+
output += combinedLines;
|
|
279
205
|
}
|
|
280
206
|
});
|
|
281
207
|
output += 'run;';
|
|
282
208
|
}
|
|
283
209
|
return output;
|
|
284
210
|
};
|
|
285
|
-
|
|
286
|
-
return header.replace(/^<h4>\s/, '').replace(/\s<\/h4>$/, '');
|
|
287
|
-
};
|
|
211
|
+
const getHeaderName = (header) => header.replace(/^<h4>\s/, '').replace(/\s<\/h4>$/, '');
|
|
288
212
|
//# sourceMappingURL=getDependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDependencies.js","sourceRoot":"","sources":["../../src/sasjsCli/getDependencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDependencies.js","sourceRoot":"","sources":["../../src/sasjsCli/getDependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oCAAoC;AACpC,yBAA6C;AAC7C,oCAA8C;AAC9C,gDAAuB;AACvB,kCAAkC;AAClC,4CAAkD;AAGlD,uEAAuE;AAEvE,IAAY,cAIX;AAJD,WAAY,cAA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