@sasjs/utils 3.4.0 → 3.5.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/.github/workflows/publish.yml +1 -1
- 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.d.ts +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
package/sasjsCli/getPreCode.js
CHANGED
|
@@ -8,92 +8,54 @@ 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
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
13
|
};
|
|
41
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
15
|
exports.getPreCode = exports.preCodeViya = exports.preCodeEnd = exports.callWeboutMacro = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
const types_1 = require("../types");
|
|
17
|
+
const file_1 = require("../file");
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const callWeboutMacro = (macro) => `%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO,maxobs=MAX);
|
|
20
|
+
%${macro}(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt
|
|
21
|
+
,missing=&missing
|
|
22
|
+
,showmeta=&showmeta
|
|
23
|
+
,maxobs=&maxobs
|
|
24
|
+
) %mend;
|
|
25
|
+
`;
|
|
49
26
|
exports.callWeboutMacro = callWeboutMacro;
|
|
50
|
-
exports.preCodeEnd =
|
|
51
|
-
|
|
27
|
+
exports.preCodeEnd = `/* provide additional debug info */
|
|
28
|
+
%global _program;
|
|
29
|
+
%put &=syscc;
|
|
30
|
+
%put user=%mf_getuser();
|
|
31
|
+
%put pgm=&_program;
|
|
32
|
+
%put timestamp=%sysfunc(datetime(),datetime19.);\n`;
|
|
33
|
+
exports.preCodeViya = `/* if calling viya service with _job param, _program will conflict */
|
|
34
|
+
/* so we provide instead as __program */
|
|
35
|
+
%global __program _program;
|
|
36
|
+
%let _program=%sysfunc(coalescec(&__program,&_program));
|
|
37
|
+
`;
|
|
52
38
|
function getPreCode(serverType, macroCorePath) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return [4 /*yield*/, (0, file_1.readFile)(path_1.default.join(macroCorePath, 'viya', 'mv_webout.sas'))];
|
|
74
|
-
case 4:
|
|
75
|
-
content = _b + _e.sent();
|
|
76
|
-
content += exports.preCodeViya + (0, exports.callWeboutMacro)('mv_webout');
|
|
77
|
-
return [3 /*break*/, 9];
|
|
78
|
-
case 5:
|
|
79
|
-
_c = content;
|
|
80
|
-
return [4 /*yield*/, (0, file_1.readFile)(path_1.default.join(macroCorePath, 'meta', 'mm_webout.sas'))];
|
|
81
|
-
case 6:
|
|
82
|
-
content = _c + _e.sent();
|
|
83
|
-
content += (0, exports.callWeboutMacro)('mm_webout');
|
|
84
|
-
return [3 /*break*/, 9];
|
|
85
|
-
case 7:
|
|
86
|
-
_d = content;
|
|
87
|
-
return [4 /*yield*/, (0, file_1.readFile)(path_1.default.join(macroCorePath, 'server', 'ms_webout.sas'))];
|
|
88
|
-
case 8:
|
|
89
|
-
content = _d + _e.sent();
|
|
90
|
-
content += (0, exports.callWeboutMacro)('ms_webout');
|
|
91
|
-
return [3 /*break*/, 9];
|
|
92
|
-
case 9:
|
|
93
|
-
content += exports.preCodeEnd;
|
|
94
|
-
return [2 /*return*/, content];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const mf_getuser = yield (0, file_1.readFile)(path_1.default.join(macroCorePath, 'base', 'mf_getuser.sas'));
|
|
41
|
+
const mp_jsonout = yield (0, file_1.readFile)(path_1.default.join(macroCorePath, 'base', 'mp_jsonout.sas'));
|
|
42
|
+
let content = mf_getuser + mp_jsonout;
|
|
43
|
+
switch (serverType) {
|
|
44
|
+
case types_1.ServerType.SasViya:
|
|
45
|
+
content += yield (0, file_1.readFile)(path_1.default.join(macroCorePath, 'viya', 'mv_webout.sas'));
|
|
46
|
+
content += exports.preCodeViya + (0, exports.callWeboutMacro)('mv_webout');
|
|
47
|
+
break;
|
|
48
|
+
case types_1.ServerType.Sas9:
|
|
49
|
+
content += yield (0, file_1.readFile)(path_1.default.join(macroCorePath, 'meta', 'mm_webout.sas'));
|
|
50
|
+
content += (0, exports.callWeboutMacro)('mm_webout');
|
|
51
|
+
break;
|
|
52
|
+
case types_1.ServerType.Sasjs:
|
|
53
|
+
content += yield (0, file_1.readFile)(path_1.default.join(macroCorePath, 'server', 'ms_webout.sas'));
|
|
54
|
+
content += (0, exports.callWeboutMacro)('ms_webout');
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
content += exports.preCodeEnd;
|
|
58
|
+
return content;
|
|
97
59
|
});
|
|
98
60
|
}
|
|
99
61
|
exports.getPreCode = getPreCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPreCode.js","sourceRoot":"","sources":["../../src/sasjsCli/getPreCode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPreCode.js","sourceRoot":"","sources":["../../src/sasjsCli/getPreCode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oCAAqC;AACrC,kCAAkC;AAClC,gDAAuB;AAEhB,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE,CAC/C;KACG,KAAK;;;;;CAKT,CAAA;AAPY,QAAA,eAAe,mBAO3B;AACY,QAAA,UAAU,GAAG;;;;;mDAKyB,CAAA;AAEtC,QAAA,WAAW,GAAG;;;;CAI1B,CAAA;AAED,SAAsB,UAAU,CAC9B,UAAsB,EACtB,aAAqB;;QAErB,MAAM,UAAU,GAAG,MAAM,IAAA,eAAQ,EAC/B,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC,CACnD,CAAA;QACD,MAAM,UAAU,GAAG,MAAM,IAAA,eAAQ,EAC/B,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC,CACnD,CAAA;QAED,IAAI,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;QAErC,QAAQ,UAAU,EAAE;YAClB,KAAK,kBAAU,CAAC,OAAO;gBACrB,OAAO,IAAI,MAAM,IAAA,eAAQ,EACvB,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,CAAC,CAClD,CAAA;gBACD,OAAO,IAAI,mBAAW,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAA;gBAErD,MAAK;YAEP,KAAK,kBAAU,CAAC,IAAI;gBAClB,OAAO,IAAI,MAAM,IAAA,eAAQ,EACvB,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,CAAC,CAClD,CAAA;gBACD,OAAO,IAAI,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAA;gBAEvC,MAAK;YAEP,KAAK,kBAAU,CAAC,KAAK;gBACnB,OAAO,IAAI,MAAM,IAAA,eAAQ,EACvB,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,eAAe,CAAC,CACpD,CAAA;gBACD,OAAO,IAAI,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAA;gBAEvC,MAAK;SACR;QAED,OAAO,IAAI,kBAAU,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA;AA1CD,gCA0CC"}
|
|
@@ -8,171 +8,74 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 };
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getAllDependencies = exports.loadDependenciesFile = void 0;
|
|
13
|
+
const types_1 = require("../types");
|
|
14
|
+
const utils_1 = require("../utils");
|
|
15
|
+
const _1 = require("./");
|
|
16
|
+
const file_1 = require("../file");
|
|
17
|
+
const loadDependenciesFile = ({ filePath, fileContent, configuration, target, type, programFolders, macroFolders, buildSourceFolder, macroCorePath, binaryFolders, compileTree }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const { init, initPath, term, termPath, startUpVars, initLeaf, termLeaf } = yield (0, _1.getInitTerm)({
|
|
19
|
+
configuration,
|
|
20
|
+
target,
|
|
21
|
+
fileType: type,
|
|
22
|
+
buildSourceFolder,
|
|
23
|
+
compileTree
|
|
24
|
+
});
|
|
25
|
+
if (type !== types_1.SASJsFileType.file) {
|
|
26
|
+
fileContent = `\n* ${type} start;\n${fileContent}\n* ${type} end;`;
|
|
36
27
|
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
const fileDependencyPaths = yield (0, _1.getDependencyPaths)(`${fileContent}\n${init}\n${term}`, macroFolders, macroCorePath, compileTree);
|
|
29
|
+
const initDependencyPaths = yield (0, _1.getDependencyPaths)(init, macroFolders, macroCorePath, compileTree, initLeaf);
|
|
30
|
+
const termDependencyPaths = yield (0, _1.getDependencyPaths)(term, macroFolders, macroCorePath, compileTree, termLeaf);
|
|
31
|
+
const allDependencyPaths = [
|
|
32
|
+
...initDependencyPaths,
|
|
33
|
+
...fileDependencyPaths,
|
|
34
|
+
...termDependencyPaths
|
|
35
|
+
];
|
|
36
|
+
const initProgramDependencies = yield (0, _1.getDependencies)(initPath, init, programFolders, _1.DependencyType.Include, compileTree);
|
|
37
|
+
const termProgramDependencies = yield (0, _1.getDependencies)(termPath, term, programFolders, _1.DependencyType.Include, compileTree);
|
|
38
|
+
const programDependencies = yield (0, _1.getDependencies)(filePath, fileContent, programFolders, _1.DependencyType.Include, compileTree);
|
|
39
|
+
const binariesDeps = yield (0, _1.getDependencies)(filePath, fileContent, binaryFolders, _1.DependencyType.Binary, compileTree);
|
|
40
|
+
const dependenciesContent = yield (0, exports.getAllDependencies)(allDependencyPaths, compileTree);
|
|
41
|
+
// There is no need to add any wrapping comments for file content if SASJsFileType===File
|
|
42
|
+
if (type === types_1.SASJsFileType.file) {
|
|
43
|
+
fileContent = [
|
|
44
|
+
initProgramDependencies,
|
|
45
|
+
termProgramDependencies,
|
|
46
|
+
dependenciesContent,
|
|
47
|
+
programDependencies,
|
|
48
|
+
binariesDeps,
|
|
49
|
+
fileContent
|
|
50
|
+
]
|
|
51
|
+
.filter((content) => content.length)
|
|
52
|
+
.join('\n');
|
|
44
53
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
finally { if (e) throw e.error; }
|
|
54
|
+
else {
|
|
55
|
+
fileContent = `* SAS Macros start;\n${initProgramDependencies}\n${termProgramDependencies}\n${dependenciesContent}\n* SAS Macros end;\n* SAS Includes start;\n${programDependencies}\n* SAS Includes end;\n* Binary Files start;\n${binariesDeps}\n* Binary Files end;\n
|
|
56
|
+
${init}${fileContent}${term}`;
|
|
57
|
+
fileContent = `* ${type} Variables start;\n${startUpVars}\n* ${type} Variables end;\n${fileContent}`;
|
|
51
58
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
-
if (ar || !(i in from)) {
|
|
57
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
-
ar[i] = from[i];
|
|
59
|
-
}
|
|
59
|
+
if ((type === types_1.SASJsFileType.service || type === types_1.SASJsFileType.test) &&
|
|
60
|
+
target) {
|
|
61
|
+
fileContent = `${yield (0, _1.getPreCode)(target.serverType, macroCorePath)}\n${fileContent}`;
|
|
60
62
|
}
|
|
61
|
-
return
|
|
62
|
-
};
|
|
63
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
-
exports.getAllDependencies = exports.loadDependenciesFile = void 0;
|
|
65
|
-
var types_1 = require("../types");
|
|
66
|
-
var utils_1 = require("../utils");
|
|
67
|
-
var _1 = require("./");
|
|
68
|
-
var file_1 = require("../file");
|
|
69
|
-
var loadDependenciesFile = function (_a) {
|
|
70
|
-
var filePath = _a.filePath, fileContent = _a.fileContent, configuration = _a.configuration, target = _a.target, type = _a.type, programFolders = _a.programFolders, macroFolders = _a.macroFolders, buildSourceFolder = _a.buildSourceFolder, macroCorePath = _a.macroCorePath, binaryFolders = _a.binaryFolders, compileTree = _a.compileTree;
|
|
71
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
-
var _b, init, initPath, term, termPath, startUpVars, initLeaf, termLeaf, fileDependencyPaths, initDependencyPaths, termDependencyPaths, allDependencyPaths, initProgramDependencies, termProgramDependencies, programDependencies, binariesDeps, dependenciesContent, _c;
|
|
73
|
-
return __generator(this, function (_d) {
|
|
74
|
-
switch (_d.label) {
|
|
75
|
-
case 0: return [4 /*yield*/, (0, _1.getInitTerm)({
|
|
76
|
-
configuration: configuration,
|
|
77
|
-
target: target,
|
|
78
|
-
fileType: type,
|
|
79
|
-
buildSourceFolder: buildSourceFolder,
|
|
80
|
-
compileTree: compileTree
|
|
81
|
-
})];
|
|
82
|
-
case 1:
|
|
83
|
-
_b = _d.sent(), init = _b.init, initPath = _b.initPath, term = _b.term, termPath = _b.termPath, startUpVars = _b.startUpVars, initLeaf = _b.initLeaf, termLeaf = _b.termLeaf;
|
|
84
|
-
if (type !== types_1.SASJsFileType.file) {
|
|
85
|
-
fileContent = "\n* ".concat(type, " start;\n").concat(fileContent, "\n* ").concat(type, " end;");
|
|
86
|
-
}
|
|
87
|
-
return [4 /*yield*/, (0, _1.getDependencyPaths)("".concat(fileContent, "\n").concat(init, "\n").concat(term), macroFolders, macroCorePath, compileTree)];
|
|
88
|
-
case 2:
|
|
89
|
-
fileDependencyPaths = _d.sent();
|
|
90
|
-
return [4 /*yield*/, (0, _1.getDependencyPaths)(init, macroFolders, macroCorePath, compileTree, initLeaf)];
|
|
91
|
-
case 3:
|
|
92
|
-
initDependencyPaths = _d.sent();
|
|
93
|
-
return [4 /*yield*/, (0, _1.getDependencyPaths)(term, macroFolders, macroCorePath, compileTree, termLeaf)];
|
|
94
|
-
case 4:
|
|
95
|
-
termDependencyPaths = _d.sent();
|
|
96
|
-
allDependencyPaths = __spreadArray(__spreadArray(__spreadArray([], __read(initDependencyPaths), false), __read(fileDependencyPaths), false), __read(termDependencyPaths), false);
|
|
97
|
-
return [4 /*yield*/, (0, _1.getDependencies)(initPath, init, programFolders, _1.DependencyType.Include, compileTree)];
|
|
98
|
-
case 5:
|
|
99
|
-
initProgramDependencies = _d.sent();
|
|
100
|
-
return [4 /*yield*/, (0, _1.getDependencies)(termPath, term, programFolders, _1.DependencyType.Include, compileTree)];
|
|
101
|
-
case 6:
|
|
102
|
-
termProgramDependencies = _d.sent();
|
|
103
|
-
return [4 /*yield*/, (0, _1.getDependencies)(filePath, fileContent, programFolders, _1.DependencyType.Include, compileTree)];
|
|
104
|
-
case 7:
|
|
105
|
-
programDependencies = _d.sent();
|
|
106
|
-
return [4 /*yield*/, (0, _1.getDependencies)(filePath, fileContent, binaryFolders, _1.DependencyType.Binary, compileTree)];
|
|
107
|
-
case 8:
|
|
108
|
-
binariesDeps = _d.sent();
|
|
109
|
-
return [4 /*yield*/, (0, exports.getAllDependencies)(allDependencyPaths, compileTree)
|
|
110
|
-
// There is no need to add any wrapping comments for file content if SASJsFileType===File
|
|
111
|
-
];
|
|
112
|
-
case 9:
|
|
113
|
-
dependenciesContent = _d.sent();
|
|
114
|
-
// There is no need to add any wrapping comments for file content if SASJsFileType===File
|
|
115
|
-
if (type === types_1.SASJsFileType.file) {
|
|
116
|
-
fileContent = [
|
|
117
|
-
initProgramDependencies,
|
|
118
|
-
termProgramDependencies,
|
|
119
|
-
dependenciesContent,
|
|
120
|
-
programDependencies,
|
|
121
|
-
binariesDeps,
|
|
122
|
-
fileContent
|
|
123
|
-
]
|
|
124
|
-
.filter(function (content) { return content.length; })
|
|
125
|
-
.join('\n');
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
fileContent = "* SAS Macros start;\n".concat(initProgramDependencies, "\n").concat(termProgramDependencies, "\n").concat(dependenciesContent, "\n* SAS Macros end;\n* SAS Includes start;\n").concat(programDependencies, "\n* SAS Includes end;\n* Binary Files start;\n").concat(binariesDeps, "\n* Binary Files end;\n\n ").concat(init).concat(fileContent).concat(term);
|
|
129
|
-
fileContent = "* ".concat(type, " Variables start;\n").concat(startUpVars, "\n* ").concat(type, " Variables end;\n").concat(fileContent);
|
|
130
|
-
}
|
|
131
|
-
if (!((type === types_1.SASJsFileType.service || type === types_1.SASJsFileType.test) &&
|
|
132
|
-
target)) return [3 /*break*/, 11];
|
|
133
|
-
_c = "".concat;
|
|
134
|
-
return [4 /*yield*/, (0, _1.getPreCode)(target.serverType, macroCorePath)];
|
|
135
|
-
case 10:
|
|
136
|
-
fileContent = _c.apply("", [_d.sent(), "\n"]).concat(fileContent);
|
|
137
|
-
_d.label = 11;
|
|
138
|
-
case 11: return [2 /*return*/, fileContent];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
};
|
|
63
|
+
return fileContent;
|
|
64
|
+
});
|
|
143
65
|
exports.loadDependenciesFile = loadDependenciesFile;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return [4 /*yield*/, (0, utils_1.asyncForEach)(__spreadArray([], __read(new Set(filePaths)), false), function (filePath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
|
-
var depFileContent;
|
|
152
|
-
return __generator(this, function (_a) {
|
|
153
|
-
switch (_a.label) {
|
|
154
|
-
case 0:
|
|
155
|
-
depFileContent = '';
|
|
156
|
-
if (!(compileTree && Object.keys(compileTree).length)) return [3 /*break*/, 2];
|
|
157
|
-
return [4 /*yield*/, compileTree.getDepContent(filePath)];
|
|
158
|
-
case 1:
|
|
159
|
-
depFileContent = _a.sent();
|
|
160
|
-
return [3 /*break*/, 4];
|
|
161
|
-
case 2: return [4 /*yield*/, (0, file_1.readFile)(filePath)];
|
|
162
|
-
case 3:
|
|
163
|
-
depFileContent = _a.sent();
|
|
164
|
-
_a.label = 4;
|
|
165
|
-
case 4:
|
|
166
|
-
dependenciesContent.push(depFileContent);
|
|
167
|
-
return [2 /*return*/];
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}); })];
|
|
171
|
-
case 1:
|
|
172
|
-
_a.sent();
|
|
173
|
-
return [2 /*return*/, dependenciesContent.join('\n')];
|
|
66
|
+
const getAllDependencies = (filePaths, compileTree) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
let dependenciesContent = [];
|
|
68
|
+
yield (0, utils_1.asyncForEach)([...new Set(filePaths)], (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
let depFileContent = '';
|
|
70
|
+
if (compileTree && Object.keys(compileTree).length) {
|
|
71
|
+
depFileContent = yield compileTree.getDepContent(filePath);
|
|
174
72
|
}
|
|
175
|
-
|
|
176
|
-
|
|
73
|
+
else {
|
|
74
|
+
depFileContent = yield (0, file_1.readFile)(filePath);
|
|
75
|
+
}
|
|
76
|
+
dependenciesContent.push(depFileContent);
|
|
77
|
+
}));
|
|
78
|
+
return dependenciesContent.join('\n');
|
|
79
|
+
});
|
|
177
80
|
exports.getAllDependencies = getAllDependencies;
|
|
178
81
|
//# sourceMappingURL=loadDependenciesFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDependenciesFile.js","sourceRoot":"","sources":["../../src/sasjsCli/loadDependenciesFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadDependenciesFile.js","sourceRoot":"","sources":["../../src/sasjsCli/loadDependenciesFile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAA+D;AAC/D,oCAAuC;AACvC,yBAMW;AAEX,kCAAkC;AAgB3B,MAAM,oBAAoB,GAAG,CAAO,EACzC,QAAQ,EACR,WAAW,EACX,aAAa,EACb,MAAM,EACN,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACY,EAAE,EAAE;IAC3B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GACvE,MAAM,IAAA,cAAW,EAAC;QAChB,aAAa;QACb,MAAM;QACN,QAAQ,EAAE,IAAI;QACd,iBAAiB;QACjB,WAAW;KACZ,CAAC,CAAA;IAEJ,IAAI,IAAI,KAAK,qBAAa,CAAC,IAAI,EAAE;QAC/B,WAAW,GAAG,OAAO,IAAI,YAAY,WAAW,OAAO,IAAI,OAAO,CAAA;KACnE;IAED,MAAM,mBAAmB,GAAG,MAAM,IAAA,qBAAkB,EAClD,GAAG,WAAW,KAAK,IAAI,KAAK,IAAI,EAAE,EAClC,YAAY,EACZ,aAAa,EACb,WAAW,CACZ,CAAA;IAED,MAAM,mBAAmB,GAAG,MAAM,IAAA,qBAAkB,EAClD,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,QAAQ,CACT,CAAA;IAED,MAAM,mBAAmB,GAAG,MAAM,I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K,IAAI,sBAAsB,WAAW,OAAO,IAAI,oBAAoB,WAAW,EAAE,CAAA;KACrG;IAED,IACE,CAAC,IAAI,KAAK,qBAAa,CAAC,OAAO,IAAI,IAAI,KAAK,qBAAa,CAAC,IAAI,CAAC;QAC/D,MAAM,EACN;QACA,WAAW,GAAG,GAAG,MAAM,IAAA,aAAU,EAC/B,MAAM,CAAC,UAAU,EACjB,aAAa,CACd,KAAK,WAAW,EAAE,CAAA;KACpB;IAED,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA,CAAA;AA1HY,QAAA,oBAAoB,wBA0HhC;AAEM,MAAM,kBAAkB,GAAG,CAChC,SAAmB,EACnB,WAAyB,EACR,EAAE;IACnB,IAAI,mBAAmB,GAAa,EAAE,CAAA;IAEtC,MAAM,IAAA,oBAAY,EAAC,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAO,QAAQ,EAAE,EAAE;QAC7D,IAAI,cAAc,GAAG,EAAE,CAAA;QAEvB,IAAI,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE;YAClD,cAAc,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;SAC3D;aAAM;YACL,cAAc,GAAG,MAAM,IAAA,eAAQ,EAAC,QAAQ,CAAC,CAAA;SAC1C;QAED,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC1C,CAAC,CAAA,CAAC,CAAA;IAEF,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACvC,CAAC,CAAA,CAAA;AAnBY,QAAA,kBAAkB,sBAmB9B"}
|
|
@@ -1,47 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
4
|
};
|
|
30
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
6
|
exports.prioritiseDependencyOverrides = void 0;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var paths = dependencyPaths.filter(function (p) {
|
|
39
|
-
return p.includes("".concat(pathSeparator).concat(depFileName));
|
|
40
|
-
});
|
|
41
|
-
var overriddenDependencyPaths = paths.filter(function (p) { return !p.includes('node_modules'); });
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const prioritiseDependencyOverrides = (dependencyNames, dependencyPaths, macroPaths = [], pathSeparator = path_1.default.sep) => {
|
|
9
|
+
dependencyPaths = [...new Set(dependencyPaths)];
|
|
10
|
+
dependencyNames.forEach((depFileName) => {
|
|
11
|
+
const paths = dependencyPaths.filter((p) => p.includes(`${pathSeparator}${depFileName}`));
|
|
12
|
+
let overriddenDependencyPaths = paths.filter((p) => !p.includes('node_modules'));
|
|
42
13
|
if (macroPaths.length) {
|
|
43
|
-
|
|
44
|
-
|
|
14
|
+
const foundInMacroPaths = overriddenDependencyPaths.filter((p) => {
|
|
15
|
+
const pathExist = macroPaths.find((tm) => p.includes(tm));
|
|
45
16
|
return pathExist ? true : false;
|
|
46
17
|
});
|
|
47
18
|
if (foundInMacroPaths.length)
|
|
@@ -49,8 +20,8 @@ var prioritiseDependencyOverrides = function (dependencyNames, dependencyPaths,
|
|
|
49
20
|
}
|
|
50
21
|
if (overriddenDependencyPaths.length &&
|
|
51
22
|
overriddenDependencyPaths.length != paths.length) {
|
|
52
|
-
|
|
53
|
-
dependencyPaths = dependencyPaths.filter(
|
|
23
|
+
const pathsToRemove = paths.filter((el) => overriddenDependencyPaths.indexOf(el) < 0);
|
|
24
|
+
dependencyPaths = dependencyPaths.filter((el) => pathsToRemove.indexOf(el) < 0);
|
|
54
25
|
}
|
|
55
26
|
});
|
|
56
27
|
return dependencyPaths;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prioritiseDependencyOverrides.js","sourceRoot":"","sources":["../../src/sasjsCli/prioritiseDependencyOverrides.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prioritiseDependencyOverrides.js","sourceRoot":"","sources":["../../src/sasjsCli/prioritiseDependencyOverrides.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEhB,MAAM,6BAA6B,GAAG,CAC3C,eAAyB,EACzB,eAAyB,EACzB,aAAuB,EAAE,EACzB,aAAa,GAAG,cAAI,CAAC,GAAG,EACxB,EAAE;IACF,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC,CAAA;IAC/C,eAAe,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,C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;;AAAO,
|
|
1
|
+
{"version":3,"file":"validateFileRef.js","sourceRoot":"","sources":["../../src/sasjsCli/validateFileRef.ts"],"names":[],"mappings":";;;AAAO,MAAM,eAAe,GAAG,CAAC,OAAe,EAAW,EAAE;IAC1D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;KACrC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACtB,MAAM,IAAI,KAAK,CACb,qEAAqE,CACtE,CAAA;KACF;IAED,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAC5C,MAAM,IAAI,KAAK,CACb,+HAA+H,CAChI,CAAA;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAlBY,QAAA,eAAe,mBAkB3B"}
|
package/time/timestamp.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertSecondsToHms = exports.generateTimestamp = exports.timestampToYYYYMMDDHHMMSS = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var date = new Date(timestamp);
|
|
4
|
+
const formatter_1 = require("../formatter");
|
|
5
|
+
const timestampToYYYYMMDDHHMMSS = (timestamp = Date.now()) => {
|
|
6
|
+
const date = new Date(timestamp);
|
|
8
7
|
return ([
|
|
9
8
|
date.getFullYear(),
|
|
10
9
|
(0, formatter_1.padWithNumber)(date.getMonth() + 1),
|
|
@@ -18,10 +17,9 @@ var timestampToYYYYMMDDHHMMSS = function (timestamp) {
|
|
|
18
17
|
].join(':'));
|
|
19
18
|
};
|
|
20
19
|
exports.timestampToYYYYMMDDHHMMSS = timestampToYYYYMMDDHHMMSS;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var timestamp = [
|
|
20
|
+
const generateTimestamp = (sep = '', sepIndex) => {
|
|
21
|
+
const date = new Date();
|
|
22
|
+
let timestamp = [
|
|
25
23
|
date.getUTCFullYear(),
|
|
26
24
|
date.getUTCMonth() + 1,
|
|
27
25
|
date.getUTCDate(),
|
|
@@ -29,7 +27,7 @@ var generateTimestamp = function (sep, sepIndex) {
|
|
|
29
27
|
date.getUTCMinutes(),
|
|
30
28
|
date.getUTCSeconds()
|
|
31
29
|
];
|
|
32
|
-
timestamp = timestamp.map(
|
|
30
|
+
timestamp = timestamp.map((item) => (0, formatter_1.padWithNumber)(item));
|
|
33
31
|
if (sepIndex && sep && sepIndex < timestamp.length && sepIndex >= 0) {
|
|
34
32
|
timestamp.splice(sepIndex, 0, sep);
|
|
35
33
|
}
|
|
@@ -37,22 +35,22 @@ var generateTimestamp = function (sep, sepIndex) {
|
|
|
37
35
|
return timestamp;
|
|
38
36
|
};
|
|
39
37
|
exports.generateTimestamp = generateTimestamp;
|
|
40
|
-
|
|
38
|
+
const convertSecondsToHms = (totalSeconds) => {
|
|
41
39
|
if (!totalSeconds)
|
|
42
40
|
return '0 second';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
42
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
43
|
+
const minutes = totalMinutes % 60;
|
|
44
|
+
const seconds = totalSeconds % 60;
|
|
45
|
+
let result = '';
|
|
48
46
|
if (hours > 0) {
|
|
49
|
-
result = hours +
|
|
47
|
+
result = hours + ` hour${hours > 1 ? 's' : ''}`;
|
|
50
48
|
}
|
|
51
49
|
if (minutes > 0) {
|
|
52
|
-
result +=
|
|
50
|
+
result += `${result ? ', ' : ''}${minutes} minute${minutes > 1 ? 's' : ''}`;
|
|
53
51
|
}
|
|
54
52
|
if (seconds > 0) {
|
|
55
|
-
result +=
|
|
53
|
+
result += `${result ? ', ' : ''}${seconds} second${seconds > 1 ? 's' : ''}`;
|
|
56
54
|
}
|
|
57
55
|
return result;
|
|
58
56
|
};
|
package/time/timestamp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../src/time/timestamp.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../src/time/timestamp.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAErC,MAAM,yBAAyB,GAAG,CAAC,YAAoB,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE;IAC1E,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAA;IAEhC,OAAO,CACL;QACE,IAAI,CAAC,WAAW,EAAE;QAClB,IAAA,yBAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAClC,IAAA,yBAAa,EAAC,IAAI,CAAC,OAAO,EAAE,CAAC;KAC9B,CAAC,IAAI,CAAC,GAAG,CAAC;QACX,GAAG;QACH;YACE,IAAA,yBAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAA,yBAAa,EAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChC,IAAA,yBAAa,EAAC,IAAI,CAAC,UAAU,EAAE,CAAC;SACjC,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,yBAAyB,6BAgBrC;AAEM,MAAM,iBAAiB,GAAG,CAAC,GAAG,GAAG,EAAE,EAAE,QAAiB,EAAU,EAAE;IACvE,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;IAEvB,IAAI,SAAS,GAAiC;QAC5C,IAAI,CAAC,cAAc,EAAE;QACrB,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC;QACtB,IAAI,CAAC,UAAU,EAAE;QACjB,IAAI,CAAC,WAAW,EAAE;QAClB,IAAI,CAAC,aAAa,EAAE;QACpB,IAAI,CAAC,aAAa,EAAE;KACrB,CAAA;IAED,S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E;IAED,IAAI,OAAO,GAAG,CAAC,EAAE;QACf,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,UAAU,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;KAC5E;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAxBY,QAAA,mBAAmB,uBAwB/B"}
|
package/types/macro.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isMacroVars = void 0;
|
|
4
|
-
|
|
5
|
-
return arg && typeof arg.macroVars === 'object' && !Array.isArray(arg.macroVars);
|
|
6
|
-
};
|
|
4
|
+
const isMacroVars = (arg) => arg && typeof arg.macroVars === 'object' && !Array.isArray(arg.macroVars);
|
|
7
5
|
exports.isMacroVars = isMacroVars;
|
|
8
6
|
//# sourceMappingURL=macro.js.map
|
package/types/macro.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macro.js","sourceRoot":"","sources":["../../src/types/macro.ts"],"names":[],"mappings":";;;AAQO,
|
|
1
|
+
{"version":3,"file":"macro.js","sourceRoot":"","sources":["../../src/types/macro.ts"],"names":[],"mappings":";;;AAQO,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAoB,EAAE,CACxD,GAAG,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAD9D,QAAA,WAAW,eACmD"}
|