tnp-core 18.0.37 → 18.0.40
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/esm2022/lib/helpers-isomorphic.mjs +26 -30
- package/browser/esm2022/lib/helpers-messages.mjs +18 -1
- package/browser/esm2022/lib/helpers.mjs +22 -28
- package/browser/esm2022/lib/index.mjs +2 -2
- package/browser/esm2022/lib/required-global-npm-packages.mjs +79 -0
- package/browser/esm2022/lib/utils.mjs +323 -9
- package/browser/fesm2022/tnp-core.mjs +2404 -2077
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/lib/helpers-isomorphic.d.ts +20 -0
- package/browser/lib/helpers-messages.d.ts +6 -0
- package/browser/lib/helpers.d.ts +16 -2
- package/browser/lib/index.d.ts +1 -1
- package/{websql/lib/required.d.ts → browser/lib/required-global-npm-packages.d.ts} +4 -0
- package/browser/lib/utils.d.ts +94 -43
- package/cli.backend.js +2 -2
- package/client/esm2022/lib/helpers-isomorphic.mjs +26 -30
- package/client/esm2022/lib/helpers-messages.mjs +18 -1
- package/client/esm2022/lib/helpers.mjs +22 -28
- package/client/esm2022/lib/index.mjs +2 -2
- package/client/esm2022/lib/required-global-npm-packages.mjs +79 -0
- package/client/esm2022/lib/utils.mjs +323 -9
- package/client/fesm2022/tnp-core.mjs +2404 -2077
- package/client/fesm2022/tnp-core.mjs.map +1 -1
- package/client/lib/helpers-isomorphic.d.ts +20 -0
- package/client/lib/helpers-messages.d.ts +6 -0
- package/client/lib/helpers.d.ts +16 -2
- package/client/lib/index.d.ts +1 -1
- package/{browser/lib/required.d.ts → client/lib/required-global-npm-packages.d.ts} +4 -0
- package/client/lib/utils.d.ts +94 -43
- package/lib/core-cli.js +3 -3
- package/lib/core-cli.js.map +1 -1
- package/lib/helpers-isomorphic.d.ts +20 -0
- package/lib/helpers-isomorphic.js +25 -35
- package/lib/helpers-isomorphic.js.map +1 -1
- package/lib/helpers-messages.d.ts +6 -0
- package/lib/helpers-messages.js +19 -0
- package/lib/helpers-messages.js.map +1 -1
- package/lib/helpers.d.ts +14 -0
- package/lib/helpers.js +33 -28
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/node-chalk-mock.js +2 -2
- package/lib/node-path-mock.js +2 -2
- package/lib/{required.d.ts → required-global-npm-packages.d.ts} +6 -2
- package/lib/{required.js → required-global-npm-packages.js} +8 -1
- package/lib/required-global-npm-packages.js.map +1 -0
- package/lib/utils.d.ts +94 -43
- package/lib/utils.js +383 -14
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/tmp-environment.json +37 -31
- package/websql/esm2022/lib/helpers-isomorphic.mjs +26 -29
- package/websql/esm2022/lib/helpers-messages.mjs +18 -1
- package/websql/esm2022/lib/helpers.mjs +22 -28
- package/websql/esm2022/lib/index.mjs +2 -2
- package/websql/esm2022/lib/required-global-npm-packages.mjs +79 -0
- package/websql/esm2022/lib/utils.mjs +322 -9
- package/websql/fesm2022/tnp-core.mjs +2506 -2179
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/lib/helpers-isomorphic.d.ts +20 -0
- package/websql/lib/helpers-messages.d.ts +6 -0
- package/websql/lib/helpers.d.ts +16 -2
- package/websql/lib/index.d.ts +1 -1
- package/{client/lib/required.d.ts → websql/lib/required-global-npm-packages.d.ts} +4 -0
- package/websql/lib/utils.d.ts +94 -43
- package/browser/esm2022/lib/required.mjs +0 -72
- package/client/esm2022/lib/required.mjs +0 -72
- package/lib/required.js.map +0 -1
- package/websql/esm2022/lib/required.mjs +0 -72
@@ -9,8 +9,8 @@ import * as dateformat from 'dateformat';
|
|
9
9
|
export { dateformat };
|
10
10
|
import * as json5 from 'json5';
|
11
11
|
export { json5 };
|
12
|
-
import { Subject } from 'rxjs';
|
13
12
|
import axios from 'axios';
|
13
|
+
import { Subject } from 'rxjs';
|
14
14
|
|
15
15
|
let isBrowser = false;
|
16
16
|
isBrowser = true;
|
@@ -722,151 +722,47 @@ var CoreModels;
|
|
722
722
|
;
|
723
723
|
({}); // @--end-of-file-for-module=tnp-core lib/core-models.ts
|
724
724
|
|
725
|
-
class HelpersIsomorphic {
|
726
|
-
get isBrowser() {
|
727
|
-
/* */
|
728
|
-
/* */
|
729
|
-
return true;
|
730
|
-
}
|
731
|
-
get isWebSQL() {
|
732
|
-
/* */
|
733
|
-
/* */
|
734
|
-
return true;
|
735
|
-
return false;
|
736
|
-
}
|
737
|
-
get isNode() {
|
738
|
-
/* */
|
739
|
-
/* */
|
740
|
-
return false;
|
741
|
-
}
|
742
|
-
get isElectron() {
|
743
|
-
// @ts-ignore
|
744
|
-
if (typeof window !== 'undefined' &&
|
745
|
-
typeof window.process === 'object' &&
|
746
|
-
window.process.type === 'renderer') {
|
747
|
-
return true;
|
748
|
-
}
|
749
|
-
// @ts-ignore
|
750
|
-
if (typeof process !== 'undefined' &&
|
751
|
-
typeof process.versions === 'object' &&
|
752
|
-
!!process.versions.electron) {
|
753
|
-
return true;
|
754
|
-
}
|
755
|
-
if (typeof navigator === 'object' &&
|
756
|
-
typeof navigator.userAgent === 'string' &&
|
757
|
-
navigator.userAgent.indexOf('Electron') >= 0) {
|
758
|
-
return true;
|
759
|
-
}
|
760
|
-
return false;
|
761
|
-
}
|
762
|
-
contain(arr, item) {
|
763
|
-
return (arr.filter(l => {
|
764
|
-
if (l instanceof RegExp) {
|
765
|
-
return l.test(item);
|
766
|
-
}
|
767
|
-
if (l === item) {
|
768
|
-
return true;
|
769
|
-
}
|
770
|
-
if (item.match && typeof item.match === 'function' ? item.match(l) : false) {
|
771
|
-
return true;
|
772
|
-
}
|
773
|
-
return false;
|
774
|
-
}).length > 0);
|
775
|
-
}
|
776
|
-
}
|
777
|
-
;
|
778
|
-
({}); // @--end-of-file-for-module=tnp-core lib/helpers-isomorphic.ts
|
779
|
-
|
780
|
-
/* */
|
781
|
-
/* */
|
782
|
-
/* */
|
783
|
-
const KEY = {
|
784
|
-
LAST_ERROR: Symbol(),
|
785
|
-
LAST_INFO: Symbol(),
|
786
|
-
LAST_WARN: Symbol(),
|
787
|
-
LAST_LOG: Symbol(),
|
788
|
-
LAST_SUCCESS: Symbol(),
|
789
|
-
LAST_TASK_STARTED: Symbol(),
|
790
|
-
LAST_TASK_DONE: Symbol(),
|
791
|
-
};
|
792
|
-
const KEY_COUNT = {
|
793
|
-
LAST_ERROR: Symbol(),
|
794
|
-
LAST_INFO: Symbol(),
|
795
|
-
LAST_WARN: Symbol(),
|
796
|
-
LAST_LOG: Symbol(),
|
797
|
-
LAST_SUCCESS: Symbol(),
|
798
|
-
LAST_TASK_STARTED: Symbol(),
|
799
|
-
LAST_TASK_DONE: Symbol(),
|
800
|
-
};
|
801
|
-
const KEY_IMPORTANTCE = {
|
802
|
-
LAST_ERROR: Symbol(),
|
803
|
-
LAST_INFO: Symbol(),
|
804
|
-
LAST_WARN: Symbol(),
|
805
|
-
LAST_LOG: Symbol(),
|
806
|
-
LAST_SUCCESS: Symbol(),
|
807
|
-
LAST_TASK_STARTED: Symbol(),
|
808
|
-
LAST_TASK_DONE: Symbol(),
|
809
|
-
};
|
810
|
-
/* */
|
811
|
-
/* */
|
812
|
-
/* */
|
813
|
-
/* */
|
814
|
-
/* */
|
815
|
-
/* */
|
816
|
-
/* */
|
817
|
-
/* */
|
818
|
-
/* */
|
819
725
|
/* */
|
820
726
|
/* */
|
821
727
|
/* */
|
822
728
|
/* */
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
/* */
|
847
|
-
/* */
|
848
|
-
/* */
|
849
|
-
/* */
|
850
|
-
/* */
|
851
|
-
/* */
|
852
|
-
/* */
|
853
|
-
/* */
|
854
|
-
}
|
729
|
+
const BLOB_SUPPORTED_IN_SQLJS = false;
|
730
|
+
var Utils;
|
731
|
+
(function (Utils) {
|
732
|
+
Utils.uniqArray = (array, uniqueProperty) => {
|
733
|
+
var seen = {};
|
734
|
+
return array
|
735
|
+
.filter(f => !!f)
|
736
|
+
.filter(function (item) {
|
737
|
+
return seen.hasOwnProperty(uniqueProperty ? item[uniqueProperty] : item)
|
738
|
+
? false
|
739
|
+
: (seen[uniqueProperty ? item[uniqueProperty] : item] = true);
|
740
|
+
});
|
741
|
+
};
|
742
|
+
/**
|
743
|
+
* Example:
|
744
|
+
* new RegExp(escapeStringForRegEx('a.b.c'),'g') => /a\.b\.c/g
|
745
|
+
*/
|
746
|
+
Utils.escapeStringForRegEx = (stringForRegExp) => {
|
747
|
+
return stringForRegExp.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
748
|
+
};
|
749
|
+
function removeChalkSpecialChars(str) {
|
750
|
+
const ansiRegex = /\u001b\[[0-9;]*m/g;
|
751
|
+
return str.replace(ansiRegex, '');
|
855
752
|
}
|
856
|
-
|
857
|
-
|
858
|
-
console.error(details);
|
859
|
-
return;
|
860
|
-
}
|
861
|
-
/* */
|
862
|
-
/* */
|
863
|
-
/* */
|
864
|
-
/* */
|
865
|
-
/* */
|
753
|
+
Utils.removeChalkSpecialChars = removeChalkSpecialChars;
|
754
|
+
Utils.fullDateTime = () => {
|
866
755
|
/* */
|
867
756
|
/* */
|
757
|
+
return (void 0);
|
758
|
+
};
|
759
|
+
Utils.fullDate = () => {
|
868
760
|
/* */
|
869
761
|
/* */
|
762
|
+
return (void 0);
|
763
|
+
};
|
764
|
+
const takenPorts = [];
|
765
|
+
Utils.getFreePort = async (options) => {
|
870
766
|
/* */
|
871
767
|
/* */
|
872
768
|
/* */
|
@@ -900,29 +796,275 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
900
796
|
/* */
|
901
797
|
/* */
|
902
798
|
/* */
|
799
|
+
return (void 0);
|
800
|
+
};
|
801
|
+
let json;
|
802
|
+
(function (json) {
|
803
|
+
json.getAtrributies = (jsonDeepPath, // lodash path to property in json ex. deep.path.to.prop
|
804
|
+
fileContent) => {
|
805
|
+
const lines = fileContent.split('\n');
|
806
|
+
const pathParts = jsonDeepPath.split('.').reduce((a, b) => {
|
807
|
+
if (a.length === 0) {
|
808
|
+
return [b];
|
809
|
+
}
|
810
|
+
const last = a[a.length - 1];
|
811
|
+
if ((last.startsWith(`['`) && b.endsWith(`']`)) ||
|
812
|
+
(last.startsWith(`["`) && b.endsWith(`"]`))) {
|
813
|
+
a[a.length - 1] = [last, b].join('.');
|
814
|
+
}
|
815
|
+
else {
|
816
|
+
a.push(b);
|
817
|
+
}
|
818
|
+
return a;
|
819
|
+
}, []);
|
820
|
+
const keyName = pathParts.pop().replace(/^\["(.+)"\]$/, '$1');
|
821
|
+
let currentPath = '';
|
822
|
+
let attributes = [];
|
823
|
+
let collectedComments = [];
|
824
|
+
for (const line of lines) {
|
825
|
+
const trimmedLine = line.trim();
|
826
|
+
if (trimmedLine.startsWith('//')) {
|
827
|
+
collectedComments.push(trimmedLine);
|
828
|
+
}
|
829
|
+
else if (trimmedLine.startsWith('"') || trimmedLine.startsWith("'")) {
|
830
|
+
const match = trimmedLine.match(/["']([^"']+)["']\s*:/);
|
831
|
+
if (match) {
|
832
|
+
const key = match[1];
|
833
|
+
currentPath = currentPath
|
834
|
+
? `${currentPath}.${key.includes('.') ? `['${key}']` : key}`
|
835
|
+
: key;
|
836
|
+
if ((currentPath.endsWith(keyName) &&
|
837
|
+
!currentPath.endsWith('/' + keyName)) ||
|
838
|
+
currentPath.endsWith(`['${keyName}']`)) {
|
839
|
+
attributes = extractAttributesFromComments(collectedComments);
|
840
|
+
break;
|
841
|
+
}
|
842
|
+
collectedComments = [];
|
843
|
+
}
|
844
|
+
}
|
845
|
+
}
|
846
|
+
return attributes;
|
847
|
+
};
|
848
|
+
const extractAttributesFromComments = (comments) => {
|
849
|
+
const attributes = [];
|
850
|
+
const attrRegex = /@(\w+)(?:\s*=\s*([^\s@]+))?/g;
|
851
|
+
for (const comment of comments) {
|
852
|
+
let match;
|
853
|
+
while ((match = attrRegex.exec(comment)) !== null) {
|
854
|
+
const [, name, value] = match;
|
855
|
+
const existingAttribute = attributes.find(attr => attr.name === `@${name}`);
|
856
|
+
if (existingAttribute) {
|
857
|
+
if (value) {
|
858
|
+
if (Array.isArray(existingAttribute.value)) {
|
859
|
+
existingAttribute.value.push(value);
|
860
|
+
}
|
861
|
+
else {
|
862
|
+
existingAttribute.value = [existingAttribute.value, value];
|
863
|
+
}
|
864
|
+
}
|
865
|
+
}
|
866
|
+
else {
|
867
|
+
attributes.push({
|
868
|
+
name: `@${name}`,
|
869
|
+
value: value ? value : true,
|
870
|
+
});
|
871
|
+
}
|
872
|
+
}
|
873
|
+
}
|
874
|
+
attributes.forEach(attr => {
|
875
|
+
if (Array.isArray(attr.value) && attr.value.length === 1) {
|
876
|
+
attr.value = attr.value[0];
|
877
|
+
}
|
878
|
+
});
|
879
|
+
return attributes;
|
880
|
+
};
|
881
|
+
})(json = Utils.json || (Utils.json = {}));
|
882
|
+
let DbBinaryFormatEnum;
|
883
|
+
(function (DbBinaryFormatEnum) {
|
884
|
+
DbBinaryFormatEnum["Blob"] = "Blob";
|
885
|
+
DbBinaryFormatEnum["File"] = "File";
|
886
|
+
DbBinaryFormatEnum["string"] = "string";
|
903
887
|
/* */
|
904
888
|
/* */
|
889
|
+
})(DbBinaryFormatEnum = Utils.DbBinaryFormatEnum || (Utils.DbBinaryFormatEnum = {}));
|
890
|
+
/* */
|
891
|
+
/* */
|
892
|
+
let binary;
|
893
|
+
(function (binary) {
|
894
|
+
/**
|
895
|
+
* This is for BROWSER ONLY
|
896
|
+
*
|
897
|
+
* @param buffer
|
898
|
+
* @param contentType
|
899
|
+
* @returns
|
900
|
+
*/
|
901
|
+
async function arrayBufferToBlob(buffer, contentType) {
|
902
|
+
// @ts-ignore
|
903
|
+
return new Blob([buffer], { type: contentType });
|
904
|
+
}
|
905
|
+
binary.arrayBufferToBlob = arrayBufferToBlob;
|
906
|
+
/**
|
907
|
+
* This is for BROWSER ONLY
|
908
|
+
* @param blob
|
909
|
+
* @returns
|
910
|
+
*/
|
911
|
+
async function blobToArrayBuffer(blob) {
|
912
|
+
return await new Promise((resolve, reject) => {
|
913
|
+
const reader = new FileReader();
|
914
|
+
reader.addEventListener('loadend', () => {
|
915
|
+
resolve(reader.result);
|
916
|
+
});
|
917
|
+
reader.addEventListener('error', reject); // @ts-ignore
|
918
|
+
reader.readAsArrayBuffer(blob);
|
919
|
+
});
|
920
|
+
}
|
921
|
+
binary.blobToArrayBuffer = blobToArrayBuffer;
|
922
|
+
/**
|
923
|
+
* it is revers to base64toBlob
|
924
|
+
* @param blob
|
925
|
+
* @returns
|
926
|
+
*/
|
927
|
+
function blobToBase64(blob) {
|
928
|
+
return new Promise((resolve, _) => {
|
929
|
+
const reader = new FileReader();
|
930
|
+
reader.onloadend = () => resolve(reader.result); // @ts-ignore
|
931
|
+
reader.readAsDataURL(blob);
|
932
|
+
});
|
933
|
+
}
|
934
|
+
binary.blobToBase64 = blobToBase64;
|
935
|
+
/**
|
936
|
+
* it is revers to blobToBase64()
|
937
|
+
* @param base64Data
|
938
|
+
* @returns
|
939
|
+
*/
|
940
|
+
async function base64toBlob(base64Data, contentTypeOverride) {
|
941
|
+
let content_type = void 0;
|
942
|
+
let file_base64 = void 0;
|
943
|
+
if (!contentTypeOverride) {
|
944
|
+
const m = /^data:(.+?);base64,(.+)$/.exec(base64Data);
|
945
|
+
if (!m) {
|
946
|
+
throw new Error(`[taon-framework][base64toBlob] Not a base64 blob [${base64Data}]`);
|
947
|
+
}
|
948
|
+
var [__, contenttype, filebase64] = m;
|
949
|
+
content_type = contenttype;
|
950
|
+
file_base64 = filebase64;
|
951
|
+
}
|
952
|
+
content_type = (contentTypeOverride ? contentTypeOverride : content_type || '');
|
953
|
+
base64Data = contentTypeOverride ? base64Data : file_base64;
|
954
|
+
const sliceSize = 1024;
|
955
|
+
const byteCharacters = atob(base64Data);
|
956
|
+
const bytesLength = byteCharacters.length;
|
957
|
+
const slicesCount = Math.ceil(bytesLength / sliceSize);
|
958
|
+
const byteArrays = new Array(slicesCount);
|
959
|
+
for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
|
960
|
+
const begin = sliceIndex * sliceSize;
|
961
|
+
const end = Math.min(begin + sliceSize, bytesLength);
|
962
|
+
const bytes = new Array(end - begin);
|
963
|
+
for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
|
964
|
+
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
965
|
+
}
|
966
|
+
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
967
|
+
}
|
968
|
+
return new Blob(byteArrays, { type: content_type });
|
969
|
+
}
|
970
|
+
binary.base64toBlob = base64toBlob;
|
971
|
+
async function base64toDbBinaryFormat(text) {
|
972
|
+
let result;
|
973
|
+
result = await (async () => {
|
974
|
+
if (BLOB_SUPPORTED_IN_SQLJS) {
|
975
|
+
const blob = await base64toBlob(text);
|
976
|
+
return blob;
|
977
|
+
}
|
978
|
+
return text;
|
979
|
+
})();
|
980
|
+
/* */
|
981
|
+
/* */
|
982
|
+
/* */
|
983
|
+
/* */
|
984
|
+
/* */
|
985
|
+
return result;
|
986
|
+
}
|
987
|
+
binary.base64toDbBinaryFormat = base64toDbBinaryFormat;
|
988
|
+
async function dbBinaryFormatToBase64(binaryFormat) {
|
989
|
+
let result;
|
990
|
+
result = await (async () => {
|
991
|
+
if (BLOB_SUPPORTED_IN_SQLJS) {
|
992
|
+
const text = await blobToBase64(binaryFormat);
|
993
|
+
return text;
|
994
|
+
}
|
995
|
+
return binaryFormat;
|
996
|
+
})();
|
997
|
+
/* */
|
998
|
+
/* */
|
999
|
+
/* */
|
1000
|
+
/* */
|
1001
|
+
/* */
|
1002
|
+
return result;
|
1003
|
+
}
|
1004
|
+
binary.dbBinaryFormatToBase64 = dbBinaryFormatToBase64;
|
1005
|
+
async function textToDbBinaryFormat(text) {
|
1006
|
+
let result;
|
1007
|
+
result = await (async () => {
|
1008
|
+
if (BLOB_SUPPORTED_IN_SQLJS) {
|
1009
|
+
const blob = await textToBlob(text);
|
1010
|
+
return blob;
|
1011
|
+
}
|
1012
|
+
return text;
|
1013
|
+
})();
|
1014
|
+
/* */
|
1015
|
+
/* */
|
1016
|
+
/* */
|
1017
|
+
/* */
|
1018
|
+
/* */
|
1019
|
+
return result;
|
1020
|
+
}
|
1021
|
+
binary.textToDbBinaryFormat = textToDbBinaryFormat;
|
1022
|
+
async function dbBinaryFormatToText(binaryFormat) {
|
1023
|
+
let result;
|
1024
|
+
result = await (async () => {
|
1025
|
+
if (BLOB_SUPPORTED_IN_SQLJS) {
|
1026
|
+
const text = await blobToText(binaryFormat);
|
1027
|
+
return text;
|
1028
|
+
}
|
1029
|
+
return binaryFormat;
|
1030
|
+
})();
|
1031
|
+
/* */
|
1032
|
+
/* */
|
1033
|
+
/* */
|
1034
|
+
/* */
|
1035
|
+
/* */
|
1036
|
+
return result;
|
1037
|
+
}
|
1038
|
+
binary.dbBinaryFormatToText = dbBinaryFormatToText;
|
905
1039
|
/* */
|
906
1040
|
/* */
|
907
1041
|
/* */
|
908
1042
|
/* */
|
909
1043
|
/* */
|
910
1044
|
/* */
|
911
|
-
}
|
912
|
-
info(details, repeatable = false) {
|
913
1045
|
/* */
|
914
1046
|
/* */
|
915
1047
|
/* */
|
916
1048
|
/* */
|
917
1049
|
/* */
|
918
1050
|
/* */
|
919
|
-
if (Helpers.isBrowser) {
|
920
|
-
console.info(details);
|
921
|
-
return;
|
922
|
-
}
|
923
1051
|
/* */
|
924
1052
|
/* */
|
925
1053
|
/* */
|
1054
|
+
async function fileToBlob(file) {
|
1055
|
+
return new Blob([new Uint8Array(await file.arrayBuffer())], {
|
1056
|
+
type: file.type,
|
1057
|
+
});
|
1058
|
+
}
|
1059
|
+
binary.fileToBlob = fileToBlob;
|
1060
|
+
async function blobToFile(blob, nameForFile = 'my-file-name') {
|
1061
|
+
if (!nameForFile) {
|
1062
|
+
nameForFile = 'nonamefile' + new Date().getTime();
|
1063
|
+
}
|
1064
|
+
// @ts-ignore
|
1065
|
+
return new File([blob], nameForFile);
|
1066
|
+
}
|
1067
|
+
binary.blobToFile = blobToFile;
|
926
1068
|
/* */
|
927
1069
|
/* */
|
928
1070
|
/* */
|
@@ -949,17 +1091,85 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
949
1091
|
/* */
|
950
1092
|
/* */
|
951
1093
|
/* */
|
1094
|
+
async function textToBlob(text, type = 'text/plain') {
|
1095
|
+
const blob = new Blob([text], { type });
|
1096
|
+
return blob;
|
1097
|
+
}
|
1098
|
+
binary.textToBlob = textToBlob;
|
1099
|
+
async function blobToText(blob) {
|
1100
|
+
return await blob.text();
|
1101
|
+
}
|
1102
|
+
binary.blobToText = blobToText;
|
1103
|
+
async function textToFile(text, fileRelativePathOrName) {
|
1104
|
+
const ext = path.extname(fileRelativePathOrName);
|
1105
|
+
const type = CoreModels.mimeTypes[ext];
|
1106
|
+
const blob = new Blob([text], { type });
|
1107
|
+
const file = await blobToFile(blob, fileRelativePathOrName);
|
1108
|
+
return file;
|
1109
|
+
}
|
1110
|
+
binary.textToFile = textToFile;
|
1111
|
+
async function fileToText(file) {
|
1112
|
+
return await file.text();
|
1113
|
+
}
|
1114
|
+
binary.fileToText = fileToText;
|
1115
|
+
async function jsonToBlob(jsonObj) {
|
1116
|
+
const blob = new Blob([JSON.stringify(jsonObj, null, 2)], {
|
1117
|
+
type: 'application/json',
|
1118
|
+
});
|
1119
|
+
return blob;
|
1120
|
+
}
|
1121
|
+
binary.jsonToBlob = jsonToBlob;
|
1122
|
+
/**
|
1123
|
+
* TODO NOT TESTED
|
1124
|
+
*/
|
1125
|
+
async function blobToJson(blob) {
|
1126
|
+
return JSON.parse(await blob.text());
|
1127
|
+
}
|
1128
|
+
binary.blobToJson = blobToJson;
|
1129
|
+
async function getBlobFrom(url) {
|
1130
|
+
const response = await axios({
|
1131
|
+
url,
|
1132
|
+
method: 'get',
|
1133
|
+
responseType: 'blob',
|
1134
|
+
});
|
1135
|
+
return response.data;
|
1136
|
+
}
|
1137
|
+
binary.getBlobFrom = getBlobFrom;
|
1138
|
+
})(binary = Utils.binary || (Utils.binary = {}));
|
1139
|
+
let css;
|
1140
|
+
(function (css) {
|
1141
|
+
/**
|
1142
|
+
*
|
1143
|
+
* @param pixelsCss pixels ex. 100px
|
1144
|
+
* @returns
|
1145
|
+
*/
|
1146
|
+
function numValue(pixelsCss) {
|
1147
|
+
return parseInt(pixelsCss?.toString()?.replace('px', ''));
|
1148
|
+
}
|
1149
|
+
css.numValue = numValue;
|
1150
|
+
})(css = Utils.css || (Utils.css = {}));
|
1151
|
+
})(Utils || (Utils = {}));
|
1152
|
+
var UtilsProcess;
|
1153
|
+
(function (UtilsProcess) {
|
1154
|
+
/**
|
1155
|
+
* TODO IMPLEMENT
|
1156
|
+
* start async node process
|
1157
|
+
*/
|
1158
|
+
async function startAsync(command, options) {
|
1159
|
+
}
|
1160
|
+
UtilsProcess.startAsync = startAsync;
|
1161
|
+
/**
|
1162
|
+
* TODO IMPLEMENT
|
1163
|
+
*/
|
1164
|
+
function startSync(command, options) {
|
1165
|
+
}
|
1166
|
+
UtilsProcess.startSync = startSync;
|
1167
|
+
UtilsProcess.getGitBashPath = () => {
|
952
1168
|
/* */
|
953
1169
|
/* */
|
954
1170
|
/* */
|
955
1171
|
/* */
|
956
1172
|
/* */
|
957
|
-
}
|
958
|
-
success(details) {
|
959
|
-
if (Helpers.isBrowser) {
|
960
|
-
console.info(details);
|
961
|
-
return;
|
962
|
-
}
|
963
1173
|
/* */
|
964
1174
|
/* */
|
965
1175
|
/* */
|
@@ -973,6 +1183,13 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
973
1183
|
/* */
|
974
1184
|
/* */
|
975
1185
|
/* */
|
1186
|
+
return (void 0);
|
1187
|
+
};
|
1188
|
+
/**
|
1189
|
+
* TODO IMPLEMENT
|
1190
|
+
* start async node process
|
1191
|
+
*/
|
1192
|
+
UtilsProcess.startInNewTerminalWindow = (command, options) => {
|
976
1193
|
/* */
|
977
1194
|
/* */
|
978
1195
|
/* */
|
@@ -997,18 +1214,6 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
997
1214
|
/* */
|
998
1215
|
/* */
|
999
1216
|
/* */
|
1000
|
-
}
|
1001
|
-
/**
|
1002
|
-
*
|
1003
|
-
* @param details
|
1004
|
-
* @param isLogTask is less important log task
|
1005
|
-
* @returns
|
1006
|
-
*/
|
1007
|
-
taskStarted(details, isLogTask = false) {
|
1008
|
-
if (Helpers.isBrowser) {
|
1009
|
-
console.info(details);
|
1010
|
-
return;
|
1011
|
-
}
|
1012
1217
|
/* */
|
1013
1218
|
/* */
|
1014
1219
|
/* */
|
@@ -1056,15 +1261,6 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1056
1261
|
/* */
|
1057
1262
|
/* */
|
1058
1263
|
/* */
|
1059
|
-
}
|
1060
|
-
taskDone(details, isLessImportant = false) {
|
1061
|
-
if (Helpers.isBrowser) {
|
1062
|
-
console.info(details);
|
1063
|
-
return;
|
1064
|
-
}
|
1065
|
-
/* */
|
1066
|
-
/* */
|
1067
|
-
/* */
|
1068
1264
|
/* */
|
1069
1265
|
/* */
|
1070
1266
|
/* */
|
@@ -1095,6 +1291,10 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1095
1291
|
/* */
|
1096
1292
|
/* */
|
1097
1293
|
/* */
|
1294
|
+
return (void 0);
|
1295
|
+
};
|
1296
|
+
UtilsProcess.getBashOrShellName = () => {
|
1297
|
+
return 'browser';
|
1098
1298
|
/* */
|
1099
1299
|
/* */
|
1100
1300
|
/* */
|
@@ -1114,12 +1314,6 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1114
1314
|
/* */
|
1115
1315
|
/* */
|
1116
1316
|
/* */
|
1117
|
-
}
|
1118
|
-
log(details, debugLevel = 0) {
|
1119
|
-
if (Helpers.isBrowser) {
|
1120
|
-
console.log(details);
|
1121
|
-
return;
|
1122
|
-
}
|
1123
1317
|
/* */
|
1124
1318
|
/* */
|
1125
1319
|
/* */
|
@@ -1133,12 +1327,70 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1133
1327
|
/* */
|
1134
1328
|
/* */
|
1135
1329
|
/* */
|
1330
|
+
return (void 0);
|
1331
|
+
};
|
1332
|
+
})(UtilsProcess || (UtilsProcess = {}));
|
1333
|
+
var UtilsOs;
|
1334
|
+
(function (UtilsOs) {
|
1335
|
+
/**
|
1336
|
+
* check if script is running in client browser
|
1337
|
+
* (websql model -> is also considered as browser
|
1338
|
+
* because it is running in browser)
|
1339
|
+
*/
|
1340
|
+
UtilsOs.isRunningInBrowser = () => {
|
1136
1341
|
/* */
|
1137
1342
|
/* */
|
1343
|
+
return true;
|
1344
|
+
};
|
1345
|
+
/**
|
1346
|
+
* check if script is running in nodejs
|
1347
|
+
* (backend script or electron script)
|
1348
|
+
*/
|
1349
|
+
UtilsOs.isRunningInNode = () => {
|
1138
1350
|
/* */
|
1139
1351
|
/* */
|
1352
|
+
return false;
|
1353
|
+
};
|
1354
|
+
/**
|
1355
|
+
* check if script is running special
|
1356
|
+
* browser mode that has sql.js backend
|
1357
|
+
* and executes sql queries in browser
|
1358
|
+
*/
|
1359
|
+
UtilsOs.isRunningInWebSQL = () => {
|
1140
1360
|
/* */
|
1141
1361
|
/* */
|
1362
|
+
return true;
|
1363
|
+
return false;
|
1364
|
+
};
|
1365
|
+
/**
|
1366
|
+
* check whether the current process is running inside
|
1367
|
+
* Electron backend or browser.
|
1368
|
+
*/
|
1369
|
+
UtilsOs.isRunningInElectron = () => {
|
1370
|
+
// @ts-ignore
|
1371
|
+
if (typeof window !== 'undefined' &&
|
1372
|
+
typeof window.process === 'object' &&
|
1373
|
+
window.process.type === 'renderer') {
|
1374
|
+
return true;
|
1375
|
+
}
|
1376
|
+
// @ts-ignore
|
1377
|
+
if (typeof process !== 'undefined' &&
|
1378
|
+
typeof process.versions === 'object' &&
|
1379
|
+
!!process.versions.electron) {
|
1380
|
+
return true;
|
1381
|
+
}
|
1382
|
+
if (typeof navigator === 'object' &&
|
1383
|
+
typeof navigator.userAgent === 'string' &&
|
1384
|
+
navigator.userAgent.indexOf('Electron') >= 0) {
|
1385
|
+
return true;
|
1386
|
+
}
|
1387
|
+
return false;
|
1388
|
+
};
|
1389
|
+
/**
|
1390
|
+
* Check wether the current process is running inside
|
1391
|
+
* windows subsystem for linux (WSL).
|
1392
|
+
*/
|
1393
|
+
UtilsOs.isRunningInWsl = () => {
|
1142
1394
|
/* */
|
1143
1395
|
/* */
|
1144
1396
|
/* */
|
@@ -1156,6 +1408,9 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1156
1408
|
/* */
|
1157
1409
|
/* */
|
1158
1410
|
/* */
|
1411
|
+
return (void 0);
|
1412
|
+
};
|
1413
|
+
UtilsOs.isRunningInDocker = () => {
|
1159
1414
|
/* */
|
1160
1415
|
/* */
|
1161
1416
|
/* */
|
@@ -1163,6 +1418,9 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1163
1418
|
/* */
|
1164
1419
|
/* */
|
1165
1420
|
/* */
|
1421
|
+
return (void 0);
|
1422
|
+
};
|
1423
|
+
UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
|
1166
1424
|
/* */
|
1167
1425
|
/* */
|
1168
1426
|
/* */
|
@@ -1170,56 +1428,190 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1170
1428
|
/* */
|
1171
1429
|
/* */
|
1172
1430
|
/* */
|
1431
|
+
return (void 0);
|
1432
|
+
};
|
1433
|
+
})(UtilsOs || (UtilsOs = {}));
|
1434
|
+
var UtilsString;
|
1435
|
+
(function (UtilsString) {
|
1436
|
+
UtilsString.kebabCaseNoSplitNumbers = (input) => {
|
1437
|
+
return (input
|
1438
|
+
.replace(/\s+/g, '-')
|
1439
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
1440
|
+
.toLowerCase());
|
1441
|
+
};
|
1442
|
+
})(UtilsString || (UtilsString = {}));
|
1443
|
+
;
|
1444
|
+
({}); // @--end-of-file-for-module=tnp-core lib/utils.ts
|
1445
|
+
|
1446
|
+
class HelpersIsomorphic {
|
1447
|
+
/**
|
1448
|
+
* @deprecated
|
1449
|
+
* use UtilsOs.isRunningInBrowser() instead
|
1450
|
+
*/
|
1451
|
+
get isBrowser() {
|
1452
|
+
return UtilsOs.isRunningInBrowser();
|
1173
1453
|
}
|
1174
1454
|
/**
|
1175
|
-
*
|
1455
|
+
* @deprecated
|
1456
|
+
* use UtilsOs.isRunningInWebSQL() instead
|
1176
1457
|
*/
|
1177
|
-
|
1458
|
+
get isWebSQL() {
|
1459
|
+
return UtilsOs.isRunningInWebSQL();
|
1460
|
+
}
|
1461
|
+
/**
|
1462
|
+
* @deprecated
|
1463
|
+
* use UtilsOs.isRunningInNode() instead
|
1464
|
+
*/
|
1465
|
+
get isNode() {
|
1466
|
+
return UtilsOs.isRunningInNode();
|
1467
|
+
}
|
1468
|
+
/**
|
1469
|
+
* @deprecated
|
1470
|
+
* use UtilsOs.isRunningInElectron() instead
|
1471
|
+
*/
|
1472
|
+
get isElectron() {
|
1473
|
+
return UtilsOs.isRunningInElectron();
|
1474
|
+
}
|
1475
|
+
/**
|
1476
|
+
* TODO what is the purpose of this function?
|
1477
|
+
* @deprecated
|
1478
|
+
*/
|
1479
|
+
contain(arr, item) {
|
1480
|
+
return (arr.filter(l => {
|
1481
|
+
if (l instanceof RegExp) {
|
1482
|
+
return l.test(item);
|
1483
|
+
}
|
1484
|
+
if (l === item) {
|
1485
|
+
return true;
|
1486
|
+
}
|
1487
|
+
if (item.match && typeof item.match === 'function' ? item.match(l) : false) {
|
1488
|
+
return true;
|
1489
|
+
}
|
1490
|
+
return false;
|
1491
|
+
}).length > 0);
|
1492
|
+
}
|
1493
|
+
}
|
1494
|
+
;
|
1495
|
+
({}); // @--end-of-file-for-module=tnp-core lib/helpers-isomorphic.ts
|
1496
|
+
|
1497
|
+
/* */
|
1498
|
+
/* */
|
1499
|
+
/* */
|
1500
|
+
const KEY = {
|
1501
|
+
LAST_ERROR: Symbol(),
|
1502
|
+
LAST_INFO: Symbol(),
|
1503
|
+
LAST_WARN: Symbol(),
|
1504
|
+
LAST_LOG: Symbol(),
|
1505
|
+
LAST_SUCCESS: Symbol(),
|
1506
|
+
LAST_TASK_STARTED: Symbol(),
|
1507
|
+
LAST_TASK_DONE: Symbol(),
|
1508
|
+
};
|
1509
|
+
const KEY_COUNT = {
|
1510
|
+
LAST_ERROR: Symbol(),
|
1511
|
+
LAST_INFO: Symbol(),
|
1512
|
+
LAST_WARN: Symbol(),
|
1513
|
+
LAST_LOG: Symbol(),
|
1514
|
+
LAST_SUCCESS: Symbol(),
|
1515
|
+
LAST_TASK_STARTED: Symbol(),
|
1516
|
+
LAST_TASK_DONE: Symbol(),
|
1517
|
+
};
|
1518
|
+
const KEY_IMPORTANTCE = {
|
1519
|
+
LAST_ERROR: Symbol(),
|
1520
|
+
LAST_INFO: Symbol(),
|
1521
|
+
LAST_WARN: Symbol(),
|
1522
|
+
LAST_LOG: Symbol(),
|
1523
|
+
LAST_SUCCESS: Symbol(),
|
1524
|
+
LAST_TASK_STARTED: Symbol(),
|
1525
|
+
LAST_TASK_DONE: Symbol(),
|
1526
|
+
};
|
1527
|
+
/* */
|
1528
|
+
/* */
|
1529
|
+
/* */
|
1530
|
+
/* */
|
1531
|
+
/* */
|
1532
|
+
/* */
|
1533
|
+
/* */
|
1534
|
+
/* */
|
1535
|
+
/* */
|
1536
|
+
/* */
|
1537
|
+
/* */
|
1538
|
+
/* */
|
1539
|
+
/* */
|
1540
|
+
/* */
|
1541
|
+
/* */
|
1542
|
+
/* */
|
1543
|
+
/* */
|
1544
|
+
/* */
|
1545
|
+
/* */
|
1546
|
+
/* */
|
1547
|
+
/* */
|
1548
|
+
const LIMIT = 10;
|
1549
|
+
class HelpersMessages extends HelpersIsomorphic {
|
1550
|
+
msgCacheClear() {
|
1178
1551
|
/* */
|
1179
1552
|
/* */
|
1180
1553
|
/* */
|
1181
1554
|
/* */
|
1182
1555
|
/* */
|
1183
|
-
|
1556
|
+
}
|
1557
|
+
renderError(err) {
|
1558
|
+
if (this.isBrowser) {
|
1559
|
+
console.error(err);
|
1560
|
+
}
|
1561
|
+
else {
|
1562
|
+
/* */
|
1563
|
+
/* */
|
1564
|
+
/* */
|
1565
|
+
/* */
|
1566
|
+
/* */
|
1567
|
+
/* */
|
1568
|
+
/* */
|
1569
|
+
/* */
|
1570
|
+
/* */
|
1571
|
+
}
|
1184
1572
|
}
|
1185
1573
|
/**
|
1186
|
-
*
|
1574
|
+
* Throw error and exit process
|
1575
|
+
* make sure browser or nodejs will not continue
|
1576
|
+
* @param details
|
1187
1577
|
*/
|
1188
|
-
|
1578
|
+
throw(details) {
|
1579
|
+
if (this.isBrowser) {
|
1580
|
+
document.body.innerHTML =
|
1581
|
+
'<h1>Application has encountered an error and stopped.</h1>';
|
1582
|
+
document.body.style.pointerEvents = 'none';
|
1583
|
+
/* */
|
1584
|
+
/* */
|
1585
|
+
/* */
|
1586
|
+
/* */
|
1587
|
+
}
|
1588
|
+
throw new Error(details);
|
1589
|
+
}
|
1590
|
+
error(details, noExit = false, noTrace = false) {
|
1591
|
+
if (Helpers.isBrowser) {
|
1592
|
+
console.error(details);
|
1593
|
+
return;
|
1594
|
+
}
|
1595
|
+
/* */
|
1596
|
+
/* */
|
1597
|
+
/* */
|
1598
|
+
/* */
|
1599
|
+
/* */
|
1189
1600
|
/* */
|
1190
1601
|
/* */
|
1191
1602
|
/* */
|
1192
1603
|
/* */
|
1193
1604
|
/* */
|
1194
|
-
return (void 0);
|
1195
|
-
}
|
1196
|
-
/**
|
1197
|
-
* Logs not visible in normal use of taon-cli
|
1198
|
-
*/
|
1199
|
-
logError(details, noExit = false, noTrace = false) {
|
1200
1605
|
/* */
|
1201
1606
|
/* */
|
1202
1607
|
/* */
|
1203
1608
|
/* */
|
1204
1609
|
/* */
|
1205
|
-
return (void 0);
|
1206
|
-
}
|
1207
|
-
/**
|
1208
|
-
* Logs not visible in normal use of taon-cli
|
1209
|
-
*/
|
1210
|
-
logWarn(details, trace = false) {
|
1211
1610
|
/* */
|
1212
1611
|
/* */
|
1213
1612
|
/* */
|
1214
1613
|
/* */
|
1215
1614
|
/* */
|
1216
|
-
return (void 0);
|
1217
|
-
}
|
1218
|
-
warn(details, trace = false) {
|
1219
|
-
if (Helpers.isBrowser) {
|
1220
|
-
console.warn(details);
|
1221
|
-
return;
|
1222
|
-
}
|
1223
1615
|
/* */
|
1224
1616
|
/* */
|
1225
1617
|
/* */
|
@@ -1250,6 +1642,30 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1250
1642
|
/* */
|
1251
1643
|
/* */
|
1252
1644
|
/* */
|
1645
|
+
}
|
1646
|
+
info(details, repeatable = false) {
|
1647
|
+
/* */
|
1648
|
+
/* */
|
1649
|
+
/* */
|
1650
|
+
/* */
|
1651
|
+
/* */
|
1652
|
+
/* */
|
1653
|
+
if (Helpers.isBrowser) {
|
1654
|
+
console.info(details);
|
1655
|
+
return;
|
1656
|
+
}
|
1657
|
+
/* */
|
1658
|
+
/* */
|
1659
|
+
/* */
|
1660
|
+
/* */
|
1661
|
+
/* */
|
1662
|
+
/* */
|
1663
|
+
/* */
|
1664
|
+
/* */
|
1665
|
+
/* */
|
1666
|
+
/* */
|
1667
|
+
/* */
|
1668
|
+
/* */
|
1253
1669
|
/* */
|
1254
1670
|
/* */
|
1255
1671
|
/* */
|
@@ -1273,59 +1689,16 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1273
1689
|
/* */
|
1274
1690
|
/* */
|
1275
1691
|
}
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
return details.join('\n');
|
1281
|
-
}
|
1282
|
-
try {
|
1283
|
-
const json = JSON.stringify(details);
|
1284
|
-
details = json;
|
1285
|
-
}
|
1286
|
-
catch (error) {
|
1287
|
-
return details;
|
1288
|
-
}
|
1289
|
-
}
|
1290
|
-
return details;
|
1291
|
-
}
|
1292
|
-
;
|
1293
|
-
({}); // @--end-of-file-for-module=tnp-core lib/helpers-messages.ts
|
1294
|
-
|
1295
|
-
const encoding = 'utf8';
|
1296
|
-
/* */
|
1297
|
-
/* */
|
1298
|
-
/* */
|
1299
|
-
const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
|
1300
|
-
const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
|
1301
|
-
class HelpersCore extends HelpersMessages {
|
1302
|
-
static get InstanceCore() {
|
1303
|
-
if (!HelpersCore._instanceCore) {
|
1304
|
-
HelpersCore._instanceCore = new HelpersCore();
|
1692
|
+
success(details) {
|
1693
|
+
if (Helpers.isBrowser) {
|
1694
|
+
console.info(details);
|
1695
|
+
return;
|
1305
1696
|
}
|
1306
|
-
return HelpersCore._instanceCore;
|
1307
|
-
}
|
1308
|
-
/* */
|
1309
|
-
/* */
|
1310
|
-
/* */
|
1311
|
-
/* */
|
1312
|
-
/* */
|
1313
|
-
/* */
|
1314
|
-
/* */
|
1315
|
-
/* */
|
1316
|
-
/* */
|
1317
|
-
/* */
|
1318
|
-
/* */
|
1319
|
-
constructor() {
|
1320
|
-
super();
|
1321
1697
|
/* */
|
1322
1698
|
/* */
|
1323
|
-
this.bigMaxBuffer = 2024 * 500;
|
1324
1699
|
/* */
|
1325
1700
|
/* */
|
1326
1701
|
/* */
|
1327
|
-
}
|
1328
|
-
get isWsl() {
|
1329
1702
|
/* */
|
1330
1703
|
/* */
|
1331
1704
|
/* */
|
@@ -1343,9 +1716,6 @@ class HelpersCore extends HelpersMessages {
|
|
1343
1716
|
/* */
|
1344
1717
|
/* */
|
1345
1718
|
/* */
|
1346
|
-
return (void 0);
|
1347
|
-
}
|
1348
|
-
isRunningInDocker() {
|
1349
1719
|
/* */
|
1350
1720
|
/* */
|
1351
1721
|
/* */
|
@@ -1353,47 +1723,38 @@ class HelpersCore extends HelpersMessages {
|
|
1353
1723
|
/* */
|
1354
1724
|
/* */
|
1355
1725
|
/* */
|
1356
|
-
return (void 0);
|
1357
|
-
}
|
1358
|
-
clearConsole() {
|
1359
|
-
Helpers.msgCacheClear();
|
1360
|
-
console.log('\x1Bc');
|
1361
|
-
}
|
1362
|
-
/**
|
1363
|
-
* get electron browser ipc renderer
|
1364
|
-
*/
|
1365
|
-
get ipcRenderer() {
|
1366
1726
|
/* */
|
1367
1727
|
/* */
|
1368
|
-
if (!this.isElectron) {
|
1369
|
-
return;
|
1370
|
-
}
|
1371
|
-
return window.require('electron')
|
1372
|
-
.ipcRenderer;
|
1373
|
-
}
|
1374
|
-
/**
|
1375
|
-
* get electron web frame
|
1376
|
-
*/
|
1377
|
-
get webFrame() {
|
1378
1728
|
/* */
|
1379
1729
|
/* */
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1730
|
+
/* */
|
1731
|
+
/* */
|
1732
|
+
/* */
|
1733
|
+
/* */
|
1384
1734
|
}
|
1385
1735
|
/**
|
1386
|
-
*
|
1736
|
+
*
|
1737
|
+
* @param details
|
1738
|
+
* @param isLogTask is less important log task
|
1739
|
+
* @returns
|
1387
1740
|
*/
|
1388
|
-
|
1741
|
+
taskStarted(details, isLogTask = false) {
|
1742
|
+
if (Helpers.isBrowser) {
|
1743
|
+
console.info(details);
|
1744
|
+
return;
|
1745
|
+
}
|
1746
|
+
/* */
|
1747
|
+
/* */
|
1748
|
+
/* */
|
1749
|
+
/* */
|
1750
|
+
/* */
|
1751
|
+
/* */
|
1752
|
+
/* */
|
1389
1753
|
/* */
|
1390
1754
|
/* */
|
1391
1755
|
/* */
|
1392
1756
|
/* */
|
1393
1757
|
/* */
|
1394
|
-
return (void 0);
|
1395
|
-
}
|
1396
|
-
getElectronWindow({ allowRunningInsecureContent = true, } = {}) {
|
1397
1758
|
/* */
|
1398
1759
|
/* */
|
1399
1760
|
/* */
|
@@ -1409,19 +1770,8 @@ class HelpersCore extends HelpersMessages {
|
|
1409
1770
|
/* */
|
1410
1771
|
/* */
|
1411
1772
|
/* */
|
1412
|
-
return (void 0);
|
1413
|
-
}
|
1414
|
-
mediaTypeFromSrc(src) {
|
1415
|
-
const ext = path.extname(src);
|
1416
|
-
const media = CoreModels.mimeTypes[ext];
|
1417
|
-
return _.first(media?.split('/'));
|
1418
|
-
}
|
1419
|
-
sleep(seconds = 1) {
|
1420
1773
|
/* */
|
1421
1774
|
/* */
|
1422
|
-
return (void 0);
|
1423
|
-
}
|
1424
|
-
removeIfExists(absoluteFileOrFolderPath) {
|
1425
1775
|
/* */
|
1426
1776
|
/* */
|
1427
1777
|
/* */
|
@@ -1440,12 +1790,12 @@ class HelpersCore extends HelpersMessages {
|
|
1440
1790
|
/* */
|
1441
1791
|
/* */
|
1442
1792
|
/* */
|
1443
|
-
return (void 0);
|
1444
|
-
}
|
1445
|
-
relative(cwd, to) {
|
1446
|
-
return crossPlatformPath(path.relative(cwd, to));
|
1447
1793
|
}
|
1448
|
-
|
1794
|
+
taskDone(details, isLessImportant = false) {
|
1795
|
+
if (Helpers.isBrowser) {
|
1796
|
+
console.info(details);
|
1797
|
+
return;
|
1798
|
+
}
|
1449
1799
|
/* */
|
1450
1800
|
/* */
|
1451
1801
|
/* */
|
@@ -1459,9 +1809,6 @@ class HelpersCore extends HelpersMessages {
|
|
1459
1809
|
/* */
|
1460
1810
|
/* */
|
1461
1811
|
/* */
|
1462
|
-
return (void 0);
|
1463
|
-
}
|
1464
|
-
removeFolderIfExists(absoluteFolderPath) {
|
1465
1812
|
/* */
|
1466
1813
|
/* */
|
1467
1814
|
/* */
|
@@ -1476,36 +1823,6 @@ class HelpersCore extends HelpersMessages {
|
|
1476
1823
|
/* */
|
1477
1824
|
/* */
|
1478
1825
|
/* */
|
1479
|
-
return (void 0);
|
1480
|
-
}
|
1481
|
-
/**
|
1482
|
-
* leave max 1 empty line
|
1483
|
-
*/
|
1484
|
-
removeEmptyLineFromString(str) {
|
1485
|
-
const lines = (str || '').split('\n');
|
1486
|
-
let previousWasEmpty = false;
|
1487
|
-
return lines
|
1488
|
-
.filter(line => {
|
1489
|
-
if (line.trim() === '') {
|
1490
|
-
if (previousWasEmpty) {
|
1491
|
-
return false;
|
1492
|
-
}
|
1493
|
-
else {
|
1494
|
-
previousWasEmpty = true;
|
1495
|
-
return true;
|
1496
|
-
}
|
1497
|
-
}
|
1498
|
-
else {
|
1499
|
-
previousWasEmpty = false;
|
1500
|
-
return true;
|
1501
|
-
}
|
1502
|
-
})
|
1503
|
-
.join('\n');
|
1504
|
-
}
|
1505
|
-
/**
|
1506
|
-
* @deprecated
|
1507
|
-
*/
|
1508
|
-
tryRemoveDir(dirpath, contentOnly = false, omitWarningNotExisted = false) {
|
1509
1826
|
/* */
|
1510
1827
|
/* */
|
1511
1828
|
/* */
|
@@ -1531,6 +1848,33 @@ class HelpersCore extends HelpersMessages {
|
|
1531
1848
|
/* */
|
1532
1849
|
/* */
|
1533
1850
|
/* */
|
1851
|
+
}
|
1852
|
+
log(details, debugLevel = 0) {
|
1853
|
+
if (Helpers.isBrowser) {
|
1854
|
+
console.log(details);
|
1855
|
+
return;
|
1856
|
+
}
|
1857
|
+
/* */
|
1858
|
+
/* */
|
1859
|
+
/* */
|
1860
|
+
/* */
|
1861
|
+
/* */
|
1862
|
+
/* */
|
1863
|
+
/* */
|
1864
|
+
/* */
|
1865
|
+
/* */
|
1866
|
+
/* */
|
1867
|
+
/* */
|
1868
|
+
/* */
|
1869
|
+
/* */
|
1870
|
+
/* */
|
1871
|
+
/* */
|
1872
|
+
/* */
|
1873
|
+
/* */
|
1874
|
+
/* */
|
1875
|
+
/* */
|
1876
|
+
/* */
|
1877
|
+
/* */
|
1534
1878
|
/* */
|
1535
1879
|
/* */
|
1536
1880
|
/* */
|
@@ -1542,9 +1886,6 @@ class HelpersCore extends HelpersMessages {
|
|
1542
1886
|
/* */
|
1543
1887
|
/* */
|
1544
1888
|
/* */
|
1545
|
-
return (void 0);
|
1546
|
-
}
|
1547
|
-
remove(fileOrFolderPathOrPatter, exactFolder = false) {
|
1548
1889
|
/* */
|
1549
1890
|
/* */
|
1550
1891
|
/* */
|
@@ -1555,19 +1896,6 @@ class HelpersCore extends HelpersMessages {
|
|
1555
1896
|
/* */
|
1556
1897
|
/* */
|
1557
1898
|
/* */
|
1558
|
-
return (void 0);
|
1559
|
-
}
|
1560
|
-
/* */
|
1561
|
-
/* */
|
1562
|
-
/* */
|
1563
|
-
/* */
|
1564
|
-
/* */
|
1565
|
-
/* */
|
1566
|
-
/* */
|
1567
|
-
/* */
|
1568
|
-
/* */
|
1569
|
-
/* */
|
1570
|
-
get isRunningInGitBash() {
|
1571
1899
|
/* */
|
1572
1900
|
/* */
|
1573
1901
|
/* */
|
@@ -1576,73 +1904,140 @@ class HelpersCore extends HelpersMessages {
|
|
1576
1904
|
/* */
|
1577
1905
|
/* */
|
1578
1906
|
/* */
|
1579
|
-
return (void 0);
|
1580
1907
|
}
|
1581
1908
|
/**
|
1582
|
-
*
|
1909
|
+
* Logs not visible in normal use of taon-cli
|
1583
1910
|
*/
|
1584
|
-
|
1911
|
+
logSuccess(details) {
|
1912
|
+
/* */
|
1913
|
+
/* */
|
1914
|
+
/* */
|
1585
1915
|
/* */
|
1586
1916
|
/* */
|
1587
1917
|
return (void 0);
|
1588
1918
|
}
|
1589
1919
|
/**
|
1590
|
-
*
|
1920
|
+
* Logs not visible in normal use of taon-cli
|
1591
1921
|
*/
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
return isClass;
|
1922
|
+
logInfo(details, repeatable = false) {
|
1923
|
+
/* */
|
1924
|
+
/* */
|
1925
|
+
/* */
|
1926
|
+
/* */
|
1927
|
+
/* */
|
1928
|
+
return (void 0);
|
1600
1929
|
}
|
1601
1930
|
/**
|
1602
|
-
*
|
1603
|
-
*
|
1604
|
-
* @param maybeBlob
|
1605
|
-
* @returns
|
1931
|
+
* Logs not visible in normal use of taon-cli
|
1606
1932
|
*/
|
1607
|
-
|
1608
|
-
|
1933
|
+
logError(details, noExit = false, noTrace = false) {
|
1934
|
+
/* */
|
1935
|
+
/* */
|
1936
|
+
/* */
|
1937
|
+
/* */
|
1938
|
+
/* */
|
1939
|
+
return (void 0);
|
1609
1940
|
}
|
1610
1941
|
/**
|
1611
|
-
*
|
1612
|
-
*
|
1613
|
-
* @param maybeNodejsBuffer
|
1614
|
-
* @returns
|
1942
|
+
* Logs not visible in normal use of taon-cli
|
1615
1943
|
*/
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
return
|
1623
|
-
}
|
1624
|
-
removeSlashAtBegin(s) {
|
1625
|
-
s = s?.startsWith(`/`) ? s.slice(1) : s;
|
1626
|
-
return s;
|
1944
|
+
logWarn(details, trace = false) {
|
1945
|
+
/* */
|
1946
|
+
/* */
|
1947
|
+
/* */
|
1948
|
+
/* */
|
1949
|
+
/* */
|
1950
|
+
return (void 0);
|
1627
1951
|
}
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1952
|
+
warn(details, trace = false) {
|
1953
|
+
if (Helpers.isBrowser) {
|
1954
|
+
console.warn(details);
|
1955
|
+
return;
|
1956
|
+
}
|
1957
|
+
/* */
|
1958
|
+
/* */
|
1959
|
+
/* */
|
1960
|
+
/* */
|
1961
|
+
/* */
|
1962
|
+
/* */
|
1963
|
+
/* */
|
1964
|
+
/* */
|
1965
|
+
/* */
|
1966
|
+
/* */
|
1967
|
+
/* */
|
1968
|
+
/* */
|
1969
|
+
/* */
|
1970
|
+
/* */
|
1971
|
+
/* */
|
1972
|
+
/* */
|
1973
|
+
/* */
|
1974
|
+
/* */
|
1975
|
+
/* */
|
1976
|
+
/* */
|
1977
|
+
/* */
|
1978
|
+
/* */
|
1979
|
+
/* */
|
1980
|
+
/* */
|
1981
|
+
/* */
|
1982
|
+
/* */
|
1983
|
+
/* */
|
1984
|
+
/* */
|
1985
|
+
/* */
|
1986
|
+
/* */
|
1987
|
+
/* */
|
1988
|
+
/* */
|
1989
|
+
/* */
|
1990
|
+
/* */
|
1991
|
+
/* */
|
1992
|
+
/* */
|
1993
|
+
/* */
|
1994
|
+
/* */
|
1995
|
+
/* */
|
1996
|
+
/* */
|
1997
|
+
/* */
|
1998
|
+
/* */
|
1999
|
+
/* */
|
2000
|
+
/* */
|
2001
|
+
/* */
|
2002
|
+
/* */
|
2003
|
+
/* */
|
2004
|
+
/* */
|
2005
|
+
/* */
|
2006
|
+
/* */
|
2007
|
+
/* */
|
2008
|
+
/* */
|
1633
2009
|
}
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
2010
|
+
}
|
2011
|
+
function transformData(details) {
|
2012
|
+
if (typeof details === 'object') {
|
2013
|
+
if (Array.isArray(details)) {
|
2014
|
+
return details.join('\n');
|
1637
2015
|
}
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
2016
|
+
try {
|
2017
|
+
const json = JSON.stringify(details);
|
2018
|
+
details = json;
|
2019
|
+
}
|
2020
|
+
catch (error) {
|
2021
|
+
return details;
|
1644
2022
|
}
|
1645
|
-
|
2023
|
+
}
|
2024
|
+
return details;
|
2025
|
+
}
|
2026
|
+
;
|
2027
|
+
({}); // @--end-of-file-for-module=tnp-core lib/helpers-messages.ts
|
2028
|
+
|
2029
|
+
const encoding = 'utf8';
|
2030
|
+
/* */
|
2031
|
+
/* */
|
2032
|
+
/* */
|
2033
|
+
const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
|
2034
|
+
const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
|
2035
|
+
class HelpersCore extends HelpersMessages {
|
2036
|
+
static get InstanceCore() {
|
2037
|
+
if (!HelpersCore._instanceCore) {
|
2038
|
+
HelpersCore._instanceCore = new HelpersCore();
|
2039
|
+
}
|
2040
|
+
return HelpersCore._instanceCore;
|
1646
2041
|
}
|
1647
2042
|
/* */
|
1648
2043
|
/* */
|
@@ -1655,264 +2050,72 @@ class HelpersCore extends HelpersMessages {
|
|
1655
2050
|
/* */
|
1656
2051
|
/* */
|
1657
2052
|
/* */
|
1658
|
-
|
1659
|
-
|
1660
|
-
/* */
|
1661
|
-
/* */
|
1662
|
-
/* */
|
1663
|
-
/* */
|
1664
|
-
/* */
|
1665
|
-
/* */
|
1666
|
-
/* */
|
1667
|
-
/* */
|
1668
|
-
/* */
|
1669
|
-
/* */
|
1670
|
-
/* */
|
1671
|
-
/* */
|
1672
|
-
/* */
|
1673
|
-
/* */
|
1674
|
-
/* */
|
1675
|
-
/* */
|
1676
|
-
/* */
|
1677
|
-
/* */
|
1678
|
-
/* */
|
1679
|
-
/* */
|
1680
|
-
/* */
|
1681
|
-
/* */
|
1682
|
-
/* */
|
1683
|
-
/* */
|
1684
|
-
/* */
|
1685
|
-
/* */
|
1686
|
-
/* */
|
1687
|
-
/* */
|
1688
|
-
/* */
|
1689
|
-
/* */
|
1690
|
-
/* */
|
1691
|
-
/* */
|
1692
|
-
/* */
|
1693
|
-
/* */
|
1694
|
-
/* */
|
1695
|
-
/* */
|
1696
|
-
/* */
|
1697
|
-
/* */
|
1698
|
-
/* */
|
1699
|
-
/* */
|
1700
|
-
/* */
|
1701
|
-
/* */
|
1702
|
-
/* */
|
1703
|
-
/* */
|
1704
|
-
/* */
|
1705
|
-
/* */
|
1706
|
-
/* */
|
1707
|
-
/* */
|
1708
|
-
/* */
|
1709
|
-
/* */
|
1710
|
-
/* */
|
1711
|
-
/* */
|
1712
|
-
/* */
|
1713
|
-
/* */
|
1714
|
-
/* */
|
1715
|
-
/* */
|
1716
|
-
/* */
|
1717
|
-
/* */
|
1718
|
-
/* */
|
1719
|
-
/* */
|
1720
|
-
/* */
|
1721
|
-
/* */
|
1722
|
-
/* */
|
1723
|
-
/* */
|
1724
|
-
/* */
|
1725
|
-
/* */
|
1726
|
-
/* */
|
1727
|
-
/* */
|
1728
|
-
/* */
|
1729
|
-
/* */
|
1730
|
-
/* */
|
1731
|
-
/* */
|
1732
|
-
/* */
|
1733
|
-
/* */
|
1734
|
-
/* */
|
1735
|
-
/* */
|
1736
|
-
/* */
|
1737
|
-
/* */
|
1738
|
-
/* */
|
1739
|
-
/* */
|
1740
|
-
/* */
|
1741
|
-
/* */
|
1742
|
-
/* */
|
1743
|
-
/* */
|
1744
|
-
/* */
|
1745
|
-
/* */
|
1746
|
-
/* */
|
1747
|
-
/* */
|
1748
|
-
/* */
|
1749
|
-
/* */
|
1750
|
-
/* */
|
1751
|
-
/* */
|
1752
|
-
/* */
|
1753
|
-
/* */
|
1754
|
-
/* */
|
1755
|
-
/* */
|
1756
|
-
/* */
|
1757
|
-
/* */
|
1758
|
-
/* */
|
1759
|
-
/* */
|
1760
|
-
/* */
|
1761
|
-
/* */
|
1762
|
-
/* */
|
1763
|
-
/* */
|
1764
|
-
/* */
|
1765
|
-
/* */
|
1766
|
-
/* */
|
1767
|
-
/* */
|
1768
|
-
/* */
|
1769
|
-
/* */
|
1770
|
-
/* */
|
1771
|
-
/* */
|
1772
|
-
/* */
|
1773
|
-
/* */
|
1774
|
-
/* */
|
1775
|
-
/* */
|
1776
|
-
/* */
|
1777
|
-
/* */
|
1778
|
-
/* */
|
1779
|
-
/* */
|
1780
|
-
/* */
|
1781
|
-
/* */
|
1782
|
-
/* */
|
1783
|
-
/* */
|
1784
|
-
/* */
|
1785
|
-
/* */
|
1786
|
-
/* */
|
1787
|
-
/* */
|
1788
|
-
/* */
|
1789
|
-
/* */
|
1790
|
-
/* */
|
1791
|
-
/* */
|
1792
|
-
/* */
|
1793
|
-
/* */
|
1794
|
-
/* */
|
1795
|
-
/* */
|
1796
|
-
/* */
|
1797
|
-
/* */
|
1798
|
-
/* */
|
1799
|
-
/* */
|
1800
|
-
/* */
|
1801
|
-
/* */
|
1802
|
-
/* */
|
1803
|
-
/* */
|
1804
|
-
/* */
|
1805
|
-
/* */
|
1806
|
-
/* */
|
1807
|
-
/* */
|
1808
|
-
/* */
|
1809
|
-
/* */
|
1810
|
-
/* */
|
1811
|
-
/* */
|
1812
|
-
/* */
|
1813
|
-
/* */
|
1814
|
-
/* */
|
1815
|
-
/* */
|
1816
|
-
/* */
|
1817
|
-
/* */
|
1818
|
-
/* */
|
1819
|
-
/* */
|
1820
|
-
/* */
|
1821
|
-
/* */
|
1822
|
-
/* */
|
1823
|
-
/* */
|
1824
|
-
/* */
|
1825
|
-
/* */
|
1826
|
-
/* */
|
1827
|
-
/* */
|
1828
|
-
/* */
|
1829
|
-
/* */
|
1830
|
-
/* */
|
1831
|
-
/* */
|
1832
|
-
/* */
|
1833
|
-
/* */
|
1834
|
-
/* */
|
1835
|
-
/* */
|
1836
|
-
/* */
|
1837
|
-
/* */
|
1838
|
-
/* */
|
1839
|
-
/* */
|
1840
|
-
/* */
|
1841
|
-
/* */
|
1842
|
-
/* */
|
1843
|
-
/* */
|
1844
|
-
/* */
|
1845
|
-
/* */
|
1846
|
-
/* */
|
1847
|
-
/* */
|
1848
|
-
/* */
|
1849
|
-
/* */
|
1850
|
-
/* */
|
1851
|
-
/* */
|
1852
|
-
/* */
|
1853
|
-
/* */
|
1854
|
-
/* */
|
1855
|
-
/* */
|
1856
|
-
/* */
|
1857
|
-
/* */
|
1858
|
-
/* */
|
1859
|
-
/* */
|
1860
|
-
/* */
|
1861
|
-
/* */
|
1862
|
-
/* */
|
1863
|
-
/* */
|
1864
|
-
/* */
|
1865
|
-
/* */
|
1866
|
-
/* */
|
1867
|
-
/* */
|
1868
|
-
/* */
|
1869
|
-
/* */
|
1870
|
-
/* */
|
1871
|
-
/* */
|
1872
|
-
/* */
|
1873
|
-
/* */
|
1874
|
-
/* */
|
1875
|
-
/* */
|
1876
|
-
/* */
|
1877
|
-
/* */
|
1878
|
-
/* */
|
1879
|
-
/* */
|
1880
|
-
/* */
|
1881
|
-
/* */
|
1882
|
-
/* */
|
1883
|
-
/* */
|
1884
|
-
/* */
|
1885
|
-
/* */
|
1886
|
-
/* */
|
1887
|
-
/* */
|
1888
|
-
/* */
|
1889
|
-
/* */
|
1890
|
-
/* */
|
1891
|
-
/* */
|
1892
|
-
/* */
|
1893
|
-
/**
|
1894
|
-
* symlink may have existed or unexisted destiantion url
|
1895
|
-
* @param destUrl M
|
1896
|
-
*/
|
1897
|
-
isSymlinkThatMatchesUrl(possibleSymlink, destUrl, absoluteFileMatch = false) {
|
1898
|
-
/* */
|
1899
|
-
/* */
|
1900
|
-
/* */
|
1901
|
-
/* */
|
2053
|
+
constructor() {
|
2054
|
+
super();
|
1902
2055
|
/* */
|
1903
2056
|
/* */
|
2057
|
+
this.bigMaxBuffer = 2024 * 500;
|
1904
2058
|
/* */
|
1905
2059
|
/* */
|
1906
2060
|
/* */
|
2061
|
+
}
|
2062
|
+
/**
|
2063
|
+
* @deprecated use UtilsOs.isRunningInsideWsl()
|
2064
|
+
*/
|
2065
|
+
get isWsl() {
|
2066
|
+
return UtilsOs.isRunningInWsl();
|
2067
|
+
}
|
2068
|
+
/**
|
2069
|
+
* @deprecated use UtilsOs.isRunningInDocker
|
2070
|
+
*/
|
2071
|
+
isRunningInDocker() {
|
2072
|
+
return UtilsOs.isRunningInDocker();
|
2073
|
+
}
|
2074
|
+
/**
|
2075
|
+
* @deprecated use UtilsOs.isRunningInLinuxGraphicEnvironment
|
2076
|
+
*/
|
2077
|
+
isRunningInLinuxGraphicsCapableEnvironment() {
|
2078
|
+
return UtilsOs.isRunningInLinuxGraphicsCapableEnvironment();
|
2079
|
+
}
|
2080
|
+
clearConsole() {
|
2081
|
+
Helpers.msgCacheClear();
|
2082
|
+
console.log('\x1Bc');
|
2083
|
+
}
|
2084
|
+
/**
|
2085
|
+
* get electron browser ipc renderer
|
2086
|
+
*/
|
2087
|
+
get ipcRenderer() {
|
1907
2088
|
/* */
|
1908
2089
|
/* */
|
2090
|
+
if (!this.isElectron) {
|
2091
|
+
return;
|
2092
|
+
}
|
2093
|
+
return window.require('electron')
|
2094
|
+
.ipcRenderer;
|
2095
|
+
}
|
2096
|
+
/**
|
2097
|
+
* get electron web frame
|
2098
|
+
*/
|
2099
|
+
get webFrame() {
|
1909
2100
|
/* */
|
1910
2101
|
/* */
|
2102
|
+
if (!this.isElectron) {
|
2103
|
+
return;
|
2104
|
+
}
|
2105
|
+
return window.require('electron').webFrame;
|
2106
|
+
}
|
2107
|
+
/**
|
2108
|
+
* get electron backend ipc main proces
|
2109
|
+
*/
|
2110
|
+
get ipcMain() {
|
1911
2111
|
/* */
|
1912
2112
|
/* */
|
1913
2113
|
/* */
|
1914
2114
|
/* */
|
1915
2115
|
/* */
|
2116
|
+
return (void 0);
|
2117
|
+
}
|
2118
|
+
getElectronWindow({ allowRunningInsecureContent = true, } = {}) {
|
1916
2119
|
/* */
|
1917
2120
|
/* */
|
1918
2121
|
/* */
|
@@ -1930,25 +2133,17 @@ class HelpersCore extends HelpersMessages {
|
|
1930
2133
|
/* */
|
1931
2134
|
return (void 0);
|
1932
2135
|
}
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
/* */
|
1940
|
-
/* */
|
1941
|
-
/* */
|
2136
|
+
mediaTypeFromSrc(src) {
|
2137
|
+
const ext = path.extname(src);
|
2138
|
+
const media = CoreModels.mimeTypes[ext];
|
2139
|
+
return _.first(media?.split('/'));
|
2140
|
+
}
|
2141
|
+
sleep(seconds = 1) {
|
1942
2142
|
/* */
|
1943
2143
|
/* */
|
1944
2144
|
return (void 0);
|
1945
2145
|
}
|
1946
|
-
|
1947
|
-
* If symbolnk link that target file does not exits
|
1948
|
-
*/
|
1949
|
-
isUnexistedLink(filePath) {
|
1950
|
-
/* */
|
1951
|
-
/* */
|
2146
|
+
removeIfExists(absoluteFileOrFolderPath) {
|
1952
2147
|
/* */
|
1953
2148
|
/* */
|
1954
2149
|
/* */
|
@@ -1970,18 +2165,12 @@ class HelpersCore extends HelpersMessages {
|
|
1970
2165
|
return (void 0);
|
1971
2166
|
}
|
1972
2167
|
/**
|
1973
|
-
*
|
2168
|
+
* path.relative that return cross platform path
|
1974
2169
|
*/
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
/* */
|
1980
|
-
/* */
|
1981
|
-
/* */
|
1982
|
-
/* */
|
1983
|
-
/* */
|
1984
|
-
/* */
|
2170
|
+
relative(cwd, to) {
|
2171
|
+
return crossPlatformPath(path.relative(cwd, to));
|
2172
|
+
}
|
2173
|
+
removeFileIfExists(absoluteFilePath) {
|
1985
2174
|
/* */
|
1986
2175
|
/* */
|
1987
2176
|
/* */
|
@@ -1997,35 +2186,7 @@ class HelpersCore extends HelpersMessages {
|
|
1997
2186
|
/* */
|
1998
2187
|
return (void 0);
|
1999
2188
|
}
|
2000
|
-
|
2001
|
-
/* */
|
2002
|
-
/* */
|
2003
|
-
/* */
|
2004
|
-
/* */
|
2005
|
-
/* */
|
2006
|
-
/* */
|
2007
|
-
/* */
|
2008
|
-
/* */
|
2009
|
-
/* */
|
2010
|
-
/* */
|
2011
|
-
/* */
|
2012
|
-
/* */
|
2013
|
-
/* */
|
2014
|
-
/* */
|
2015
|
-
/* */
|
2016
|
-
/* */
|
2017
|
-
/* */
|
2018
|
-
exists(folderOrFilePath) {
|
2019
|
-
/* */
|
2020
|
-
/* */
|
2021
|
-
/* */
|
2022
|
-
/* */
|
2023
|
-
/* */
|
2024
|
-
/* */
|
2025
|
-
/* */
|
2026
|
-
/* */
|
2027
|
-
/* */
|
2028
|
-
/* */
|
2189
|
+
removeFolderIfExists(absoluteFolderPath) {
|
2029
2190
|
/* */
|
2030
2191
|
/* */
|
2031
2192
|
/* */
|
@@ -2043,23 +2204,33 @@ class HelpersCore extends HelpersMessages {
|
|
2043
2204
|
return (void 0);
|
2044
2205
|
}
|
2045
2206
|
/**
|
2046
|
-
*
|
2207
|
+
* leave max 1 empty line
|
2047
2208
|
*/
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2209
|
+
removeEmptyLineFromString(str) {
|
2210
|
+
const lines = (str || '').split('\n');
|
2211
|
+
let previousWasEmpty = false;
|
2212
|
+
return lines
|
2213
|
+
.filter(line => {
|
2214
|
+
if (line.trim() === '') {
|
2215
|
+
if (previousWasEmpty) {
|
2216
|
+
return false;
|
2217
|
+
}
|
2218
|
+
else {
|
2219
|
+
previousWasEmpty = true;
|
2220
|
+
return true;
|
2221
|
+
}
|
2222
|
+
}
|
2223
|
+
else {
|
2224
|
+
previousWasEmpty = false;
|
2225
|
+
return true;
|
2226
|
+
}
|
2227
|
+
})
|
2228
|
+
.join('\n');
|
2059
2229
|
}
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2230
|
+
/**
|
2231
|
+
* @deprecated
|
2232
|
+
*/
|
2233
|
+
tryRemoveDir(dirpath, contentOnly = false, omitWarningNotExisted = false) {
|
2063
2234
|
/* */
|
2064
2235
|
/* */
|
2065
2236
|
/* */
|
@@ -2096,6 +2267,9 @@ class HelpersCore extends HelpersMessages {
|
|
2096
2267
|
/* */
|
2097
2268
|
/* */
|
2098
2269
|
/* */
|
2270
|
+
return (void 0);
|
2271
|
+
}
|
2272
|
+
remove(fileOrFolderPathOrPatter, exactFolder = false) {
|
2099
2273
|
/* */
|
2100
2274
|
/* */
|
2101
2275
|
/* */
|
@@ -2106,6 +2280,19 @@ class HelpersCore extends HelpersMessages {
|
|
2106
2280
|
/* */
|
2107
2281
|
/* */
|
2108
2282
|
/* */
|
2283
|
+
return (void 0);
|
2284
|
+
}
|
2285
|
+
/* */
|
2286
|
+
/* */
|
2287
|
+
/* */
|
2288
|
+
/* */
|
2289
|
+
/* */
|
2290
|
+
/* */
|
2291
|
+
/* */
|
2292
|
+
/* */
|
2293
|
+
/* */
|
2294
|
+
/* */
|
2295
|
+
get isRunningInGitBash() {
|
2109
2296
|
/* */
|
2110
2297
|
/* */
|
2111
2298
|
/* */
|
@@ -2113,14 +2300,74 @@ class HelpersCore extends HelpersMessages {
|
|
2113
2300
|
/* */
|
2114
2301
|
/* */
|
2115
2302
|
/* */
|
2116
|
-
|
2303
|
+
/* */
|
2304
|
+
return (void 0);
|
2117
2305
|
}
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2306
|
+
/**
|
2307
|
+
* Check if the current shell is supported by Taon framework.
|
2308
|
+
*/
|
2309
|
+
get isSupportedTaonTerminal() {
|
2310
|
+
/* */
|
2311
|
+
/* */
|
2312
|
+
return (void 0);
|
2313
|
+
}
|
2314
|
+
/**
|
2315
|
+
* check if function is class
|
2316
|
+
*/
|
2317
|
+
isClass(funcOrClass) {
|
2318
|
+
let isClass = false;
|
2319
|
+
if (typeof funcOrClass === 'function') {
|
2320
|
+
isClass =
|
2321
|
+
!!funcOrClass.prototype &&
|
2322
|
+
Object.getOwnPropertyNames(funcOrClass.prototype).filter(f => f !== 'constructor').length > 0;
|
2323
|
+
}
|
2324
|
+
return isClass;
|
2325
|
+
}
|
2326
|
+
/**
|
2327
|
+
* check if data is nodejs/browser blob
|
2328
|
+
*
|
2329
|
+
* @param maybeBlob
|
2330
|
+
* @returns
|
2331
|
+
*/
|
2332
|
+
isBlob(maybeBlob) {
|
2333
|
+
return maybeBlob instanceof Blob; // || toString.call(maybeBlob) === '[object Blob]';
|
2334
|
+
}
|
2335
|
+
/**
|
2336
|
+
* Check if data is nodejs buffer
|
2337
|
+
*
|
2338
|
+
* @param maybeNodejsBuffer
|
2339
|
+
* @returns
|
2340
|
+
*/
|
2341
|
+
/* */
|
2342
|
+
/* */
|
2343
|
+
/* */
|
2344
|
+
/* */
|
2345
|
+
removeSlashAtEnd(s) {
|
2346
|
+
s = s?.endsWith(`/`) ? s.slice(0, s.length - 1) : s;
|
2347
|
+
return s;
|
2348
|
+
}
|
2349
|
+
removeSlashAtBegin(s) {
|
2350
|
+
s = s?.startsWith(`/`) ? s.slice(1) : s;
|
2351
|
+
return s;
|
2352
|
+
}
|
2353
|
+
/**
|
2354
|
+
* stringify to pretty json string
|
2355
|
+
*/
|
2356
|
+
stringify(inputObject) {
|
2357
|
+
return JSON.stringify(inputObject, null, 2);
|
2358
|
+
}
|
2359
|
+
async runSyncOrAsync(fnOrOptions) {
|
2360
|
+
if (_.isUndefined(fnOrOptions)) {
|
2361
|
+
return void 0;
|
2362
|
+
}
|
2363
|
+
let promisOrValue;
|
2364
|
+
const { functionFn, context, arrayOfParams } = fnOrOptions;
|
2365
|
+
promisOrValue = functionFn.apply(context, arrayOfParams);
|
2366
|
+
// // @ts-ignore
|
2367
|
+
if (promisOrValue instanceof Promise) {
|
2368
|
+
promisOrValue = Promise.resolve(promisOrValue);
|
2369
|
+
}
|
2370
|
+
return promisOrValue;
|
2124
2371
|
}
|
2125
2372
|
/* */
|
2126
2373
|
/* */
|
@@ -2200,8 +2447,179 @@ class HelpersCore extends HelpersMessages {
|
|
2200
2447
|
/* */
|
2201
2448
|
/* */
|
2202
2449
|
/* */
|
2203
|
-
|
2204
|
-
|
2450
|
+
/* */
|
2451
|
+
/* */
|
2452
|
+
/* */
|
2453
|
+
/* */
|
2454
|
+
/* */
|
2455
|
+
/* */
|
2456
|
+
/* */
|
2457
|
+
/* */
|
2458
|
+
/* */
|
2459
|
+
/* */
|
2460
|
+
/* */
|
2461
|
+
/* */
|
2462
|
+
/* */
|
2463
|
+
/* */
|
2464
|
+
/* */
|
2465
|
+
/* */
|
2466
|
+
/* */
|
2467
|
+
/* */
|
2468
|
+
/* */
|
2469
|
+
/* */
|
2470
|
+
/* */
|
2471
|
+
/* */
|
2472
|
+
/* */
|
2473
|
+
/* */
|
2474
|
+
/* */
|
2475
|
+
/* */
|
2476
|
+
/* */
|
2477
|
+
/* */
|
2478
|
+
/* */
|
2479
|
+
/* */
|
2480
|
+
/* */
|
2481
|
+
/* */
|
2482
|
+
/* */
|
2483
|
+
/* */
|
2484
|
+
/* */
|
2485
|
+
/* */
|
2486
|
+
/* */
|
2487
|
+
/* */
|
2488
|
+
/* */
|
2489
|
+
/* */
|
2490
|
+
/* */
|
2491
|
+
/* */
|
2492
|
+
/* */
|
2493
|
+
/* */
|
2494
|
+
/* */
|
2495
|
+
/* */
|
2496
|
+
/* */
|
2497
|
+
/* */
|
2498
|
+
/* */
|
2499
|
+
/* */
|
2500
|
+
/* */
|
2501
|
+
/* */
|
2502
|
+
/* */
|
2503
|
+
/* */
|
2504
|
+
/* */
|
2505
|
+
/* */
|
2506
|
+
/* */
|
2507
|
+
/* */
|
2508
|
+
/* */
|
2509
|
+
/* */
|
2510
|
+
/* */
|
2511
|
+
/* */
|
2512
|
+
/* */
|
2513
|
+
/* */
|
2514
|
+
/* */
|
2515
|
+
/* */
|
2516
|
+
/* */
|
2517
|
+
/* */
|
2518
|
+
/* */
|
2519
|
+
/* */
|
2520
|
+
/* */
|
2521
|
+
/* */
|
2522
|
+
/* */
|
2523
|
+
/* */
|
2524
|
+
/* */
|
2525
|
+
/* */
|
2526
|
+
/* */
|
2527
|
+
/* */
|
2528
|
+
/* */
|
2529
|
+
/* */
|
2530
|
+
/* */
|
2531
|
+
/* */
|
2532
|
+
/* */
|
2533
|
+
/* */
|
2534
|
+
/* */
|
2535
|
+
/* */
|
2536
|
+
/* */
|
2537
|
+
/* */
|
2538
|
+
/* */
|
2539
|
+
/* */
|
2540
|
+
/* */
|
2541
|
+
/* */
|
2542
|
+
/* */
|
2543
|
+
/* */
|
2544
|
+
/* */
|
2545
|
+
/* */
|
2546
|
+
/* */
|
2547
|
+
/* */
|
2548
|
+
/* */
|
2549
|
+
/* */
|
2550
|
+
/* */
|
2551
|
+
/* */
|
2552
|
+
/* */
|
2553
|
+
/* */
|
2554
|
+
/* */
|
2555
|
+
/* */
|
2556
|
+
/* */
|
2557
|
+
/* */
|
2558
|
+
/* */
|
2559
|
+
/* */
|
2560
|
+
/* */
|
2561
|
+
/* */
|
2562
|
+
/* */
|
2563
|
+
/* */
|
2564
|
+
/* */
|
2565
|
+
/* */
|
2566
|
+
/* */
|
2567
|
+
/* */
|
2568
|
+
/* */
|
2569
|
+
/* */
|
2570
|
+
/* */
|
2571
|
+
/* */
|
2572
|
+
/* */
|
2573
|
+
/* */
|
2574
|
+
/* */
|
2575
|
+
/* */
|
2576
|
+
/* */
|
2577
|
+
/* */
|
2578
|
+
/* */
|
2579
|
+
/* */
|
2580
|
+
/* */
|
2581
|
+
/* */
|
2582
|
+
/* */
|
2583
|
+
/* */
|
2584
|
+
/* */
|
2585
|
+
/* */
|
2586
|
+
/* */
|
2587
|
+
/* */
|
2588
|
+
/* */
|
2589
|
+
/* */
|
2590
|
+
/* */
|
2591
|
+
/* */
|
2592
|
+
/* */
|
2593
|
+
/* */
|
2594
|
+
/* */
|
2595
|
+
/* */
|
2596
|
+
/* */
|
2597
|
+
/* */
|
2598
|
+
/* */
|
2599
|
+
/* */
|
2600
|
+
/* */
|
2601
|
+
/* */
|
2602
|
+
/* */
|
2603
|
+
/* */
|
2604
|
+
/* */
|
2605
|
+
/* */
|
2606
|
+
/* */
|
2607
|
+
/* */
|
2608
|
+
/* */
|
2609
|
+
/* */
|
2610
|
+
/* */
|
2611
|
+
/* */
|
2612
|
+
/* */
|
2613
|
+
/* */
|
2614
|
+
/* */
|
2615
|
+
/* */
|
2616
|
+
/* */
|
2617
|
+
/* */
|
2618
|
+
/**
|
2619
|
+
* symlink may have existed or unexisted destiantion url
|
2620
|
+
* @param destUrl M
|
2621
|
+
*/
|
2622
|
+
isSymlinkThatMatchesUrl(possibleSymlink, destUrl, absoluteFileMatch = false) {
|
2205
2623
|
/* */
|
2206
2624
|
/* */
|
2207
2625
|
/* */
|
@@ -2235,6 +2653,9 @@ class HelpersCore extends HelpersMessages {
|
|
2235
2653
|
/* */
|
2236
2654
|
/* */
|
2237
2655
|
/* */
|
2656
|
+
return (void 0);
|
2657
|
+
}
|
2658
|
+
isSymlinkFileExitedOrUnexisted(filePath) {
|
2238
2659
|
/* */
|
2239
2660
|
/* */
|
2240
2661
|
/* */
|
@@ -2247,36 +2668,123 @@ class HelpersCore extends HelpersMessages {
|
|
2247
2668
|
/* */
|
2248
2669
|
return (void 0);
|
2249
2670
|
}
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
/* */
|
2671
|
+
/**
|
2672
|
+
* If symbolnk link that target file does not exits
|
2673
|
+
*/
|
2674
|
+
isUnexistedLink(filePath) {
|
2255
2675
|
/* */
|
2256
2676
|
/* */
|
2257
2677
|
/* */
|
2258
2678
|
/* */
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2679
|
+
/* */
|
2680
|
+
/* */
|
2681
|
+
/* */
|
2682
|
+
/* */
|
2683
|
+
/* */
|
2684
|
+
/* */
|
2685
|
+
/* */
|
2686
|
+
/* */
|
2687
|
+
/* */
|
2688
|
+
/* */
|
2689
|
+
/* */
|
2690
|
+
/* */
|
2691
|
+
/* */
|
2692
|
+
/* */
|
2693
|
+
/* */
|
2694
|
+
/* */
|
2695
|
+
return (void 0);
|
2696
|
+
}
|
2697
|
+
/**
|
2698
|
+
* @param existedLink check if source of link exists
|
2699
|
+
*/
|
2700
|
+
isExistedSymlink(filePath) {
|
2701
|
+
/* */
|
2702
|
+
/* */
|
2703
|
+
/* */
|
2704
|
+
/* */
|
2705
|
+
/* */
|
2706
|
+
/* */
|
2707
|
+
/* */
|
2708
|
+
/* */
|
2709
|
+
/* */
|
2710
|
+
/* */
|
2711
|
+
/* */
|
2712
|
+
/* */
|
2713
|
+
/* */
|
2714
|
+
/* */
|
2715
|
+
/* */
|
2716
|
+
/* */
|
2717
|
+
/* */
|
2718
|
+
/* */
|
2719
|
+
/* */
|
2720
|
+
/* */
|
2721
|
+
/* */
|
2722
|
+
/* */
|
2723
|
+
return (void 0);
|
2724
|
+
}
|
2725
|
+
/* */
|
2726
|
+
/* */
|
2727
|
+
/* */
|
2728
|
+
/* */
|
2729
|
+
/* */
|
2730
|
+
/* */
|
2731
|
+
/* */
|
2732
|
+
/* */
|
2733
|
+
/* */
|
2734
|
+
/* */
|
2735
|
+
/* */
|
2736
|
+
/* */
|
2737
|
+
/* */
|
2738
|
+
/* */
|
2739
|
+
/* */
|
2740
|
+
/* */
|
2741
|
+
/* */
|
2742
|
+
/* */
|
2743
|
+
exists(folderOrFilePath) {
|
2744
|
+
/* */
|
2745
|
+
/* */
|
2746
|
+
/* */
|
2747
|
+
/* */
|
2748
|
+
/* */
|
2749
|
+
/* */
|
2750
|
+
/* */
|
2751
|
+
/* */
|
2752
|
+
/* */
|
2753
|
+
/* */
|
2754
|
+
/* */
|
2755
|
+
/* */
|
2756
|
+
/* */
|
2757
|
+
/* */
|
2758
|
+
/* */
|
2759
|
+
/* */
|
2760
|
+
/* */
|
2761
|
+
/* */
|
2762
|
+
/* */
|
2763
|
+
/* */
|
2764
|
+
/* */
|
2765
|
+
/* */
|
2766
|
+
/* */
|
2767
|
+
/* */
|
2768
|
+
return (void 0);
|
2769
|
+
}
|
2770
|
+
/**
|
2771
|
+
* this is HACK for running procesess inside processes
|
2772
|
+
*/
|
2773
|
+
_fixCommand(command) {
|
2774
|
+
if ((command.startsWith('tnp ') || command.startsWith('taon ')) && // TODO every cli projects here that uses run and need to kill process easly!
|
2775
|
+
command.search('-spinner=false') === -1 &&
|
2776
|
+
command.search('-spinner=off') === -1) {
|
2777
|
+
command = `${command} -spinner=false`;
|
2267
2778
|
}
|
2268
|
-
if (
|
2269
|
-
|
2270
|
-
|
2271
|
-
for (let index = 0; index < childs.length; index++) {
|
2272
|
-
const childPid = childs[index];
|
2273
|
-
delete WEBSQL_PROC_MOCK_PROCESSES_PID[childPid];
|
2274
|
-
}
|
2275
|
-
delete WEBSQL_PROC_MOCK_PROCESSES_PPID[byPid];
|
2779
|
+
if (global.skipCoreCheck &&
|
2780
|
+
(command.startsWith('tnp ') || command.startsWith('taon '))) {
|
2781
|
+
command = `${command} --skipCoreCheck`;
|
2276
2782
|
}
|
2783
|
+
return command;
|
2277
2784
|
}
|
2278
|
-
|
2785
|
+
command(command) {
|
2279
2786
|
command = Helpers._fixCommand(command);
|
2787
|
+
return {
|
2280
2788
|
/* */
|
2281
2789
|
/* */
|
2282
2790
|
/* */
|
@@ -2285,353 +2793,6 @@ class HelpersCore extends HelpersMessages {
|
|
2285
2793
|
/* */
|
2286
2794
|
/* */
|
2287
2795
|
/* */
|
2288
|
-
return {
|
2289
|
-
/**
|
2290
|
-
* start command as synchronous nodej proces
|
2291
|
-
*/
|
2292
|
-
sync() {
|
2293
|
-
/* */
|
2294
|
-
/* */
|
2295
|
-
/* */
|
2296
|
-
/* */
|
2297
|
-
/* */
|
2298
|
-
/* */
|
2299
|
-
/* */
|
2300
|
-
/* */
|
2301
|
-
/* */
|
2302
|
-
/* */
|
2303
|
-
/* */
|
2304
|
-
/* */
|
2305
|
-
/* */
|
2306
|
-
/* */
|
2307
|
-
/* */
|
2308
|
-
/* */
|
2309
|
-
/* */
|
2310
|
-
/* */
|
2311
|
-
/* */
|
2312
|
-
/* */
|
2313
|
-
/* */
|
2314
|
-
/* */
|
2315
|
-
/* */
|
2316
|
-
/* */
|
2317
|
-
/* */
|
2318
|
-
/* */
|
2319
|
-
/* */
|
2320
|
-
/* */
|
2321
|
-
/* */
|
2322
|
-
/* */
|
2323
|
-
/* */
|
2324
|
-
return (void 0);
|
2325
|
-
},
|
2326
|
-
/**
|
2327
|
-
* start command as asynchronous nodej proces
|
2328
|
-
* @param detach (default: false) - if true process will be detached
|
2329
|
-
*/
|
2330
|
-
async(detach = false, mockFun) {
|
2331
|
-
if (mockFun) {
|
2332
|
-
const subStdoutSub = new Subject();
|
2333
|
-
const subStderSub = new Subject();
|
2334
|
-
const exitSub = new Subject();
|
2335
|
-
const subscribtions = [];
|
2336
|
-
const procDummy = {
|
2337
|
-
stdout: {
|
2338
|
-
on(action, stdoutCallback) {
|
2339
|
-
if (action == 'data') {
|
2340
|
-
subscribtions.push(subStdoutSub.subscribe(d => {
|
2341
|
-
stdoutCallback(d);
|
2342
|
-
}));
|
2343
|
-
}
|
2344
|
-
},
|
2345
|
-
},
|
2346
|
-
stderr: {
|
2347
|
-
on(action, stdoutCallback) {
|
2348
|
-
if (action == 'data') {
|
2349
|
-
subscribtions.push(subStderSub.subscribe(d => {
|
2350
|
-
stdoutCallback(d);
|
2351
|
-
}));
|
2352
|
-
}
|
2353
|
-
},
|
2354
|
-
},
|
2355
|
-
on(action, exitFun) {
|
2356
|
-
if (action == 'exit') {
|
2357
|
-
subscribtions.push(exitSub.subscribe(d => {
|
2358
|
-
exitFun(d);
|
2359
|
-
}));
|
2360
|
-
}
|
2361
|
-
}, // @ts-ignore
|
2362
|
-
ppid: void 0, // @ts-ignore
|
2363
|
-
pid: void 0,
|
2364
|
-
};
|
2365
|
-
procDummy.pid = Math.round(Math.random() * (1000 - 100)) + 100;
|
2366
|
-
procDummy.ppid = procDummy.pid + 9999;
|
2367
|
-
WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid] = procDummy;
|
2368
|
-
if (!WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]) {
|
2369
|
-
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid] = {
|
2370
|
-
childProcesses: [],
|
2371
|
-
};
|
2372
|
-
}
|
2373
|
-
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid].childProcesses.push(procDummy.pid);
|
2374
|
-
const checkIfProcessShouldBeDead = () => {
|
2375
|
-
return (_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid]) ||
|
2376
|
-
_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]));
|
2377
|
-
};
|
2378
|
-
const f = Helpers.runSyncOrAsync({
|
2379
|
-
functionFn: mockFun,
|
2380
|
-
arrayOfParams: [
|
2381
|
-
d => {
|
2382
|
-
setTimeout(() => {
|
2383
|
-
subStdoutSub.next(d);
|
2384
|
-
});
|
2385
|
-
},
|
2386
|
-
d => {
|
2387
|
-
setTimeout(() => {
|
2388
|
-
subStderSub.next(d);
|
2389
|
-
});
|
2390
|
-
},
|
2391
|
-
() => {
|
2392
|
-
const shouldBeDead = checkIfProcessShouldBeDead();
|
2393
|
-
return shouldBeDead;
|
2394
|
-
},
|
2395
|
-
],
|
2396
|
-
});
|
2397
|
-
f.then(exitCode => {
|
2398
|
-
if (_.isNil(exitCode)) {
|
2399
|
-
exitCode = 0;
|
2400
|
-
}
|
2401
|
-
setTimeout(() => {
|
2402
|
-
exitSub.next(exitCode);
|
2403
|
-
subscribtions.forEach(s => s.unsubscribe());
|
2404
|
-
});
|
2405
|
-
}).catch(e => {
|
2406
|
-
console.error(e);
|
2407
|
-
console.error(`Something wrong with your mock funciton`);
|
2408
|
-
exitSub.next(1);
|
2409
|
-
subscribtions.forEach(s => s.unsubscribe());
|
2410
|
-
});
|
2411
|
-
return procDummy;
|
2412
|
-
}
|
2413
|
-
/* */
|
2414
|
-
/* */
|
2415
|
-
/* */
|
2416
|
-
/* */
|
2417
|
-
return (void 0);
|
2418
|
-
},
|
2419
|
-
/**
|
2420
|
-
* start command as asynchronous nodej proces inside promise
|
2421
|
-
*/
|
2422
|
-
asyncAsPromise() {
|
2423
|
-
/* */
|
2424
|
-
/* */
|
2425
|
-
/* */
|
2426
|
-
/* */
|
2427
|
-
/* */
|
2428
|
-
/* */
|
2429
|
-
/* */
|
2430
|
-
/* */
|
2431
|
-
/* */
|
2432
|
-
/* */
|
2433
|
-
/* */
|
2434
|
-
/* */
|
2435
|
-
/* */
|
2436
|
-
/* */
|
2437
|
-
/* */
|
2438
|
-
/* */
|
2439
|
-
/* */
|
2440
|
-
return (void 0);
|
2441
|
-
},
|
2442
|
-
unitlOutput(optionsOutput) {
|
2443
|
-
/* */
|
2444
|
-
/* */
|
2445
|
-
/* */
|
2446
|
-
/* */
|
2447
|
-
/* */
|
2448
|
-
/* */
|
2449
|
-
/* */
|
2450
|
-
/* */
|
2451
|
-
/* */
|
2452
|
-
/* */
|
2453
|
-
/* */
|
2454
|
-
/* */
|
2455
|
-
/* */
|
2456
|
-
/* */
|
2457
|
-
/* */
|
2458
|
-
/* */
|
2459
|
-
/* */
|
2460
|
-
/* */
|
2461
|
-
/* */
|
2462
|
-
/* */
|
2463
|
-
/* */
|
2464
|
-
/* */
|
2465
|
-
/* */
|
2466
|
-
/* */
|
2467
|
-
/* */
|
2468
|
-
/* */
|
2469
|
-
/* */
|
2470
|
-
/* */
|
2471
|
-
/* */
|
2472
|
-
/* */
|
2473
|
-
/* */
|
2474
|
-
/* */
|
2475
|
-
/* */
|
2476
|
-
/* */
|
2477
|
-
/* */
|
2478
|
-
/* */
|
2479
|
-
/* */
|
2480
|
-
/* */
|
2481
|
-
/* */
|
2482
|
-
/* */
|
2483
|
-
/* */
|
2484
|
-
/* */
|
2485
|
-
/* */
|
2486
|
-
/* */
|
2487
|
-
/* */
|
2488
|
-
/* */
|
2489
|
-
/* */
|
2490
|
-
/* */
|
2491
|
-
/* */
|
2492
|
-
/* */
|
2493
|
-
/* */
|
2494
|
-
/* */
|
2495
|
-
/* */
|
2496
|
-
/* */
|
2497
|
-
/* */
|
2498
|
-
/* */
|
2499
|
-
/* */
|
2500
|
-
/* */
|
2501
|
-
/* */
|
2502
|
-
/* */
|
2503
|
-
/* */
|
2504
|
-
/* */
|
2505
|
-
/* */
|
2506
|
-
/* */
|
2507
|
-
/* */
|
2508
|
-
/* */
|
2509
|
-
/* */
|
2510
|
-
/* */
|
2511
|
-
/* */
|
2512
|
-
/* */
|
2513
|
-
/* */
|
2514
|
-
/* */
|
2515
|
-
/* */
|
2516
|
-
/* */
|
2517
|
-
/* */
|
2518
|
-
/* */
|
2519
|
-
/* */
|
2520
|
-
/* */
|
2521
|
-
/* */
|
2522
|
-
/* */
|
2523
|
-
/* */
|
2524
|
-
/* */
|
2525
|
-
/* */
|
2526
|
-
/* */
|
2527
|
-
/* */
|
2528
|
-
/* */
|
2529
|
-
/* */
|
2530
|
-
/* */
|
2531
|
-
/* */
|
2532
|
-
/* */
|
2533
|
-
/* */
|
2534
|
-
/* */
|
2535
|
-
/* */
|
2536
|
-
/* */
|
2537
|
-
/* */
|
2538
|
-
return (void 0);
|
2539
|
-
},
|
2540
|
-
/**
|
2541
|
-
* @deprecated use unitlOutput
|
2542
|
-
* start command as asynchronous nodej proces inside promise
|
2543
|
-
* and wait until output contains some string
|
2544
|
-
*/
|
2545
|
-
unitlOutputContains(stdoutMsg, stderMsg, timeout = 0, stdoutOutputContainsCallback) {
|
2546
|
-
/* */
|
2547
|
-
/* */
|
2548
|
-
/* */
|
2549
|
-
/* */
|
2550
|
-
/* */
|
2551
|
-
/* */
|
2552
|
-
/* */
|
2553
|
-
/* */
|
2554
|
-
/* */
|
2555
|
-
/* */
|
2556
|
-
/* */
|
2557
|
-
/* */
|
2558
|
-
/* */
|
2559
|
-
/* */
|
2560
|
-
/* */
|
2561
|
-
/* */
|
2562
|
-
/* */
|
2563
|
-
/* */
|
2564
|
-
/* */
|
2565
|
-
/* */
|
2566
|
-
/* */
|
2567
|
-
/* */
|
2568
|
-
/* */
|
2569
|
-
/* */
|
2570
|
-
/* */
|
2571
|
-
/* */
|
2572
|
-
/* */
|
2573
|
-
/* */
|
2574
|
-
/* */
|
2575
|
-
/* */
|
2576
|
-
/* */
|
2577
|
-
/* */
|
2578
|
-
/* */
|
2579
|
-
/* */
|
2580
|
-
/* */
|
2581
|
-
/* */
|
2582
|
-
/* */
|
2583
|
-
/* */
|
2584
|
-
/* */
|
2585
|
-
/* */
|
2586
|
-
/* */
|
2587
|
-
/* */
|
2588
|
-
/* */
|
2589
|
-
/* */
|
2590
|
-
/* */
|
2591
|
-
/* */
|
2592
|
-
/* */
|
2593
|
-
/* */
|
2594
|
-
/* */
|
2595
|
-
/* */
|
2596
|
-
/* */
|
2597
|
-
/* */
|
2598
|
-
/* */
|
2599
|
-
/* */
|
2600
|
-
/* */
|
2601
|
-
/* */
|
2602
|
-
/* */
|
2603
|
-
/* */
|
2604
|
-
/* */
|
2605
|
-
/* */
|
2606
|
-
/* */
|
2607
|
-
/* */
|
2608
|
-
/* */
|
2609
|
-
/* */
|
2610
|
-
/* */
|
2611
|
-
/* */
|
2612
|
-
/* */
|
2613
|
-
/* */
|
2614
|
-
/* */
|
2615
|
-
/* */
|
2616
|
-
/* */
|
2617
|
-
/* */
|
2618
|
-
/* */
|
2619
|
-
/* */
|
2620
|
-
/* */
|
2621
|
-
/* */
|
2622
|
-
/* */
|
2623
|
-
/* */
|
2624
|
-
/* */
|
2625
|
-
/* */
|
2626
|
-
return (void 0);
|
2627
|
-
},
|
2628
|
-
};
|
2629
|
-
}
|
2630
|
-
async questionYesNo(message, callbackTrue, callbackFalse, defaultValue = true,
|
2631
|
-
/**
|
2632
|
-
* in non interactive mode
|
2633
|
-
*/
|
2634
|
-
mustAnswerQuestion = false) {
|
2635
2796
|
/* */
|
2636
2797
|
/* */
|
2637
2798
|
/* */
|
@@ -2658,7 +2819,36 @@ class HelpersCore extends HelpersMessages {
|
|
2658
2819
|
/* */
|
2659
2820
|
/* */
|
2660
2821
|
/* */
|
2661
|
-
|
2822
|
+
/* */
|
2823
|
+
/* */
|
2824
|
+
/* */
|
2825
|
+
/* */
|
2826
|
+
/* */
|
2827
|
+
/* */
|
2828
|
+
/* */
|
2829
|
+
/* */
|
2830
|
+
/* */
|
2831
|
+
/* */
|
2832
|
+
/* */
|
2833
|
+
/* */
|
2834
|
+
/* */
|
2835
|
+
/* */
|
2836
|
+
/* */
|
2837
|
+
/* */
|
2838
|
+
/* */
|
2839
|
+
/* */
|
2840
|
+
/* */
|
2841
|
+
};
|
2842
|
+
}
|
2843
|
+
wait(second) {
|
2844
|
+
return new Promise((resolve, reject) => {
|
2845
|
+
setTimeout(() => {
|
2846
|
+
resolve(void 0);
|
2847
|
+
}, second * 1000);
|
2848
|
+
});
|
2849
|
+
}
|
2850
|
+
async timeout(seconds) {
|
2851
|
+
return await Helpers.wait(seconds);
|
2662
2852
|
}
|
2663
2853
|
/* */
|
2664
2854
|
/* */
|
@@ -2738,633 +2928,465 @@ class HelpersCore extends HelpersMessages {
|
|
2738
2928
|
/* */
|
2739
2929
|
/* */
|
2740
2930
|
/* */
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
/* */
|
2813
|
-
/* */
|
2814
|
-
/* */
|
2815
|
-
/* */
|
2816
|
-
/* */
|
2817
|
-
/* */
|
2818
|
-
/* */
|
2819
|
-
/* */
|
2820
|
-
/* */
|
2821
|
-
/* */
|
2822
|
-
/* */
|
2823
|
-
/* */
|
2824
|
-
/* */
|
2825
|
-
/* */
|
2826
|
-
/* */
|
2827
|
-
/* */
|
2828
|
-
/* */
|
2829
|
-
/* */
|
2830
|
-
/* */
|
2831
|
-
/* */
|
2832
|
-
/* */
|
2833
|
-
/* */
|
2834
|
-
/* */
|
2835
|
-
/* */
|
2836
|
-
/* */
|
2837
|
-
/* */
|
2838
|
-
/* */
|
2839
|
-
/* */
|
2840
|
-
/* */
|
2841
|
-
/* */
|
2842
|
-
/* */
|
2843
|
-
/* */
|
2844
|
-
/* */
|
2845
|
-
/* */
|
2846
|
-
/* */
|
2847
|
-
/* */
|
2848
|
-
/* */
|
2849
|
-
/* */
|
2850
|
-
/* */
|
2851
|
-
/* */
|
2852
|
-
/* */
|
2853
|
-
/* */
|
2854
|
-
/* */
|
2855
|
-
/* */
|
2856
|
-
/* */
|
2857
|
-
/* */
|
2858
|
-
/* */
|
2859
|
-
/* */
|
2860
|
-
/* */
|
2861
|
-
/* */
|
2862
|
-
/* */
|
2863
|
-
/* */
|
2864
|
-
/* */
|
2865
|
-
/* */
|
2866
|
-
/* */
|
2867
|
-
/* */
|
2868
|
-
/* */
|
2869
|
-
/* */
|
2870
|
-
/* */
|
2871
|
-
/* */
|
2872
|
-
/* */
|
2873
|
-
/* */
|
2874
|
-
/* */
|
2875
|
-
/* */
|
2876
|
-
/* */
|
2877
|
-
/* */
|
2878
|
-
/* */
|
2879
|
-
/* */
|
2880
|
-
/* */
|
2881
|
-
/* */
|
2882
|
-
/* */
|
2883
|
-
/* */
|
2884
|
-
/* */
|
2885
|
-
/* */
|
2886
|
-
/* */
|
2887
|
-
/* */
|
2888
|
-
/* */
|
2889
|
-
/* */
|
2890
|
-
/* */
|
2891
|
-
/* */
|
2892
|
-
/* */
|
2893
|
-
/* */
|
2894
|
-
/* */
|
2895
|
-
/* */
|
2896
|
-
/* */
|
2897
|
-
/* */
|
2898
|
-
/* */
|
2899
|
-
/* */
|
2900
|
-
/* */
|
2901
|
-
/* */
|
2902
|
-
/* */
|
2903
|
-
/* */
|
2904
|
-
/* */
|
2905
|
-
/* */
|
2906
|
-
/* */
|
2907
|
-
/* */
|
2908
|
-
/* */
|
2909
|
-
/* */
|
2910
|
-
/* */
|
2911
|
-
/* */
|
2912
|
-
/* */
|
2913
|
-
/* */
|
2914
|
-
/* */
|
2915
|
-
/* */
|
2916
|
-
/* */
|
2917
|
-
/* */
|
2918
|
-
/* */
|
2919
|
-
/* */
|
2920
|
-
/* */
|
2921
|
-
/* */
|
2922
|
-
/* */
|
2923
|
-
/* */
|
2924
|
-
/* */
|
2925
|
-
/* */
|
2926
|
-
/* */
|
2927
|
-
/* */
|
2928
|
-
/* */
|
2929
|
-
/* */
|
2930
|
-
/* */
|
2931
|
-
/* */
|
2932
|
-
/* */
|
2933
|
-
/* */
|
2934
|
-
/* */
|
2935
|
-
/* */
|
2936
|
-
/* */
|
2937
|
-
/* */
|
2938
|
-
/* */
|
2939
|
-
/* */
|
2940
|
-
/* */
|
2941
|
-
/* */
|
2942
|
-
/* */
|
2943
|
-
/* */
|
2944
|
-
/* */
|
2945
|
-
/* */
|
2946
|
-
/* */
|
2947
|
-
/* */
|
2948
|
-
/* */
|
2949
|
-
/* */
|
2950
|
-
/* */
|
2951
|
-
/* */
|
2952
|
-
/* */
|
2953
|
-
/* */
|
2954
|
-
/* */
|
2955
|
-
/* */
|
2956
|
-
/* */
|
2957
|
-
/* */
|
2958
|
-
/* */
|
2959
|
-
/* */
|
2960
|
-
/* */
|
2961
|
-
/* */
|
2962
|
-
/* */
|
2963
|
-
/* */
|
2964
|
-
/* */
|
2965
|
-
/* */
|
2966
|
-
/* */
|
2967
|
-
/* */
|
2968
|
-
/* */
|
2969
|
-
/* */
|
2970
|
-
/* */
|
2971
|
-
/* */
|
2972
|
-
/* */
|
2973
|
-
/* */
|
2974
|
-
/* */
|
2975
|
-
/* */
|
2976
|
-
/* */
|
2977
|
-
/* */
|
2978
|
-
/* */
|
2979
|
-
/* */
|
2980
|
-
/* */
|
2981
|
-
/* */
|
2982
|
-
/* */
|
2983
|
-
/* */
|
2984
|
-
/* */
|
2985
|
-
/* */
|
2986
|
-
/* */
|
2987
|
-
/* */
|
2988
|
-
/* */
|
2989
|
-
/* */
|
2990
|
-
/* */
|
2991
|
-
/* */
|
2992
|
-
/* */
|
2993
|
-
/* */
|
2994
|
-
/* */
|
2995
|
-
/* */
|
2996
|
-
/* */
|
2997
|
-
/* */
|
2998
|
-
/* */
|
2999
|
-
/* */
|
3000
|
-
/* */
|
3001
|
-
/* */
|
3002
|
-
/* */
|
3003
|
-
/* */
|
3004
|
-
/* */
|
3005
|
-
/* */
|
3006
|
-
/* */
|
3007
|
-
/* */
|
3008
|
-
/* */
|
3009
|
-
/* */
|
3010
|
-
/* */
|
3011
|
-
/* */
|
3012
|
-
/* */
|
3013
|
-
/* */
|
3014
|
-
/* */
|
3015
|
-
/* */
|
3016
|
-
/* */
|
3017
|
-
/* */
|
3018
|
-
/* */
|
3019
|
-
/* */
|
3020
|
-
/* */
|
3021
|
-
/* */
|
3022
|
-
/* */
|
3023
|
-
/* */
|
3024
|
-
/* */
|
3025
|
-
/* */
|
3026
|
-
/* */
|
3027
|
-
/* */
|
3028
|
-
/* */
|
3029
|
-
/* */
|
3030
|
-
/* */
|
3031
|
-
/* */
|
3032
|
-
/* */
|
3033
|
-
/* */
|
3034
|
-
/* */
|
3035
|
-
/* */
|
3036
|
-
/* */
|
3037
|
-
/* */
|
3038
|
-
/* */
|
3039
|
-
/* */
|
3040
|
-
/* */
|
3041
|
-
/* */
|
3042
|
-
/* */
|
3043
|
-
/* */
|
3044
|
-
/* */
|
3045
|
-
/* */
|
3046
|
-
/* */
|
3047
|
-
/* */
|
3048
|
-
/* */
|
3049
|
-
/* */
|
3050
|
-
/* */
|
3051
|
-
/* */
|
3052
|
-
/* */
|
3053
|
-
/* */
|
3054
|
-
/* */
|
3055
|
-
/* */
|
3056
|
-
/* */
|
3057
|
-
/* */
|
3058
|
-
/* */
|
3059
|
-
/* */
|
3060
|
-
/* */
|
3061
|
-
/* */
|
3062
|
-
/* */
|
3063
|
-
/* */
|
3064
|
-
/* */
|
3065
|
-
/* */
|
3066
|
-
/* */
|
3067
|
-
/* */
|
3068
|
-
/* */
|
3069
|
-
/* */
|
3070
|
-
/* */
|
3071
|
-
/* */
|
3072
|
-
/* */
|
3073
|
-
/* */
|
3074
|
-
/* */
|
3075
|
-
/* */
|
3076
|
-
/* */
|
3077
|
-
/* */
|
3078
|
-
/* */
|
3079
|
-
/* */
|
3080
|
-
/* */
|
3081
|
-
/* */
|
3082
|
-
/* */
|
3083
|
-
/* */
|
3084
|
-
/* */
|
3085
|
-
/* */
|
3086
|
-
/* */
|
3087
|
-
/* */
|
3088
|
-
/* */
|
3089
|
-
/* */
|
3090
|
-
/* */
|
3091
|
-
/* */
|
3092
|
-
/* */
|
3093
|
-
/* */
|
3094
|
-
/* */
|
3095
|
-
/* */
|
3096
|
-
/* */
|
3097
|
-
/* */
|
3098
|
-
/* */
|
3099
|
-
/* */
|
3100
|
-
/* */
|
3101
|
-
/* */
|
3102
|
-
/* */
|
3103
|
-
/* */
|
3104
|
-
/* */
|
3105
|
-
/* */
|
3106
|
-
/* */
|
3107
|
-
/* */
|
3108
|
-
/* */
|
3109
|
-
/* */
|
3110
|
-
/* */
|
3111
|
-
/* */
|
3112
|
-
/* */
|
3113
|
-
/* */
|
3114
|
-
/* */
|
3115
|
-
/* */
|
3116
|
-
/* */
|
3117
|
-
/* */
|
3118
|
-
/* */
|
3119
|
-
/* */
|
3120
|
-
/* */
|
3121
|
-
/* */
|
3122
|
-
/* */
|
3123
|
-
/* */
|
3124
|
-
/* */
|
3125
|
-
/* */
|
3126
|
-
/* */
|
3127
|
-
/* */
|
3128
|
-
/* */
|
3129
|
-
/* */
|
3130
|
-
/* */
|
3131
|
-
/* */
|
3132
|
-
/* */
|
3133
|
-
/* */
|
3134
|
-
/* */
|
3135
|
-
/* */
|
3136
|
-
/* */
|
3137
|
-
/* */
|
3138
|
-
/* */
|
3139
|
-
/* */
|
3140
|
-
/* */
|
3141
|
-
/* */
|
3142
|
-
/* */
|
3143
|
-
/* */
|
3144
|
-
/* */
|
3145
|
-
/* */
|
3146
|
-
/* */
|
3147
|
-
/* */
|
3148
|
-
/* */
|
3149
|
-
/* */
|
3150
|
-
/* */
|
3151
|
-
/* */
|
3152
|
-
/* */
|
3153
|
-
/* */
|
3154
|
-
/* */
|
3155
|
-
/* */
|
3156
|
-
/* */
|
3157
|
-
/* */
|
3158
|
-
/* */
|
3159
|
-
/* */
|
3160
|
-
/* */
|
3161
|
-
/* */
|
3162
|
-
/* */
|
3163
|
-
/* */
|
3164
|
-
/* */
|
3165
|
-
/* */
|
3166
|
-
/* */
|
3167
|
-
/* */
|
3168
|
-
/* */
|
3169
|
-
/* */
|
3170
|
-
/* */
|
3171
|
-
/* */
|
3172
|
-
/* */
|
3173
|
-
/* */
|
3174
|
-
/* */
|
3175
|
-
/* */
|
3176
|
-
/* */
|
3177
|
-
/* */
|
3178
|
-
/* */
|
3179
|
-
/* */
|
3180
|
-
/* */
|
3181
|
-
/* */
|
3182
|
-
/**
|
3183
|
-
* Quick fix for object values
|
3184
|
-
* @deprecated
|
3185
|
-
*/
|
3186
|
-
values(obj) {
|
3187
|
-
if (_.isObject(obj) && !Array.isArray(obj)) {
|
3188
|
-
const values = [];
|
3189
|
-
for (const key in obj) {
|
3190
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
3191
|
-
// @ts-ignore
|
3192
|
-
values.push(obj[key]);
|
3193
|
-
}
|
2931
|
+
async killProcessByPort(portOrPortsToKill, options) {
|
2932
|
+
/* */
|
2933
|
+
/* */
|
2934
|
+
/* */
|
2935
|
+
/* */
|
2936
|
+
/* */
|
2937
|
+
/* */
|
2938
|
+
/* */
|
2939
|
+
/* */
|
2940
|
+
/* */
|
2941
|
+
/* */
|
2942
|
+
/* */
|
2943
|
+
/* */
|
2944
|
+
/* */
|
2945
|
+
/* */
|
2946
|
+
/* */
|
2947
|
+
/* */
|
2948
|
+
/* */
|
2949
|
+
/* */
|
2950
|
+
/* */
|
2951
|
+
/* */
|
2952
|
+
/* */
|
2953
|
+
/* */
|
2954
|
+
/* */
|
2955
|
+
/* */
|
2956
|
+
/* */
|
2957
|
+
/* */
|
2958
|
+
/* */
|
2959
|
+
/* */
|
2960
|
+
/* */
|
2961
|
+
/* */
|
2962
|
+
/* */
|
2963
|
+
/* */
|
2964
|
+
/* */
|
2965
|
+
/* */
|
2966
|
+
/* */
|
2967
|
+
/* */
|
2968
|
+
/* */
|
2969
|
+
/* */
|
2970
|
+
/* */
|
2971
|
+
/* */
|
2972
|
+
/* */
|
2973
|
+
/* */
|
2974
|
+
/* */
|
2975
|
+
/* */
|
2976
|
+
return (void 0);
|
2977
|
+
}
|
2978
|
+
async killOnPort(portOrPortsToKill, options) {
|
2979
|
+
return await Helpers.killProcessByPort(portOrPortsToKill, options);
|
2980
|
+
}
|
2981
|
+
killProcess(byPid) {
|
2982
|
+
/* */
|
2983
|
+
/* */
|
2984
|
+
/* */
|
2985
|
+
/* */
|
2986
|
+
/* */
|
2987
|
+
if (WEBSQL_PROC_MOCK_PROCESSES_PID[byPid]) {
|
2988
|
+
const ppid = WEBSQL_PROC_MOCK_PROCESSES_PID[byPid].ppid;
|
2989
|
+
if (WEBSQL_PROC_MOCK_PROCESSES_PPID[ppid]) {
|
2990
|
+
const allChilds = WEBSQL_PROC_MOCK_PROCESSES_PPID[ppid]
|
2991
|
+
.childProcesses;
|
2992
|
+
WEBSQL_PROC_MOCK_PROCESSES_PPID[ppid].childProcesses = allChilds.filter(p => p !== byPid);
|
2993
|
+
}
|
2994
|
+
delete WEBSQL_PROC_MOCK_PROCESSES_PID[byPid];
|
2995
|
+
}
|
2996
|
+
if (WEBSQL_PROC_MOCK_PROCESSES_PPID[byPid]) {
|
2997
|
+
const childs = WEBSQL_PROC_MOCK_PROCESSES_PPID[byPid]
|
2998
|
+
.childProcesses;
|
2999
|
+
for (let index = 0; index < childs.length; index++) {
|
3000
|
+
const childPid = childs[index];
|
3001
|
+
delete WEBSQL_PROC_MOCK_PROCESSES_PID[childPid];
|
3194
3002
|
}
|
3195
|
-
|
3003
|
+
delete WEBSQL_PROC_MOCK_PROCESSES_PPID[byPid];
|
3196
3004
|
}
|
3197
|
-
return [];
|
3198
3005
|
}
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3308
|
-
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
|
3318
|
-
|
3319
|
-
|
3320
|
-
|
3321
|
-
|
3322
|
-
|
3323
|
-
|
3324
|
-
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3341
|
-
|
3342
|
-
|
3343
|
-
|
3344
|
-
|
3345
|
-
|
3346
|
-
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3353
|
-
|
3354
|
-
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
3359
|
-
|
3360
|
-
|
3361
|
-
|
3006
|
+
run(command, options) {
|
3007
|
+
command = Helpers._fixCommand(command);
|
3008
|
+
/* */
|
3009
|
+
/* */
|
3010
|
+
/* */
|
3011
|
+
/* */
|
3012
|
+
/* */
|
3013
|
+
/* */
|
3014
|
+
/* */
|
3015
|
+
/* */
|
3016
|
+
return {
|
3017
|
+
/**
|
3018
|
+
* start command as synchronous nodej proces
|
3019
|
+
*/
|
3020
|
+
sync() {
|
3021
|
+
/* */
|
3022
|
+
/* */
|
3023
|
+
/* */
|
3024
|
+
/* */
|
3025
|
+
/* */
|
3026
|
+
/* */
|
3027
|
+
/* */
|
3028
|
+
/* */
|
3029
|
+
/* */
|
3030
|
+
/* */
|
3031
|
+
/* */
|
3032
|
+
/* */
|
3033
|
+
/* */
|
3034
|
+
/* */
|
3035
|
+
/* */
|
3036
|
+
/* */
|
3037
|
+
/* */
|
3038
|
+
/* */
|
3039
|
+
/* */
|
3040
|
+
/* */
|
3041
|
+
/* */
|
3042
|
+
/* */
|
3043
|
+
/* */
|
3044
|
+
/* */
|
3045
|
+
/* */
|
3046
|
+
/* */
|
3047
|
+
/* */
|
3048
|
+
/* */
|
3049
|
+
/* */
|
3050
|
+
/* */
|
3051
|
+
/* */
|
3052
|
+
return (void 0);
|
3053
|
+
},
|
3054
|
+
/**
|
3055
|
+
* start command as asynchronous nodej proces
|
3056
|
+
* @param detach (default: false) - if true process will be detached
|
3057
|
+
*/
|
3058
|
+
async(detach = false, mockFun) {
|
3059
|
+
if (mockFun) {
|
3060
|
+
const subStdoutSub = new Subject();
|
3061
|
+
const subStderSub = new Subject();
|
3062
|
+
const exitSub = new Subject();
|
3063
|
+
const subscribtions = [];
|
3064
|
+
const procDummy = {
|
3065
|
+
stdout: {
|
3066
|
+
on(action, stdoutCallback) {
|
3067
|
+
if (action == 'data') {
|
3068
|
+
subscribtions.push(subStdoutSub.subscribe(d => {
|
3069
|
+
stdoutCallback(d);
|
3070
|
+
}));
|
3071
|
+
}
|
3072
|
+
},
|
3073
|
+
},
|
3074
|
+
stderr: {
|
3075
|
+
on(action, stdoutCallback) {
|
3076
|
+
if (action == 'data') {
|
3077
|
+
subscribtions.push(subStderSub.subscribe(d => {
|
3078
|
+
stdoutCallback(d);
|
3079
|
+
}));
|
3080
|
+
}
|
3081
|
+
},
|
3082
|
+
},
|
3083
|
+
on(action, exitFun) {
|
3084
|
+
if (action == 'exit') {
|
3085
|
+
subscribtions.push(exitSub.subscribe(d => {
|
3086
|
+
exitFun(d);
|
3087
|
+
}));
|
3088
|
+
}
|
3089
|
+
}, // @ts-ignore
|
3090
|
+
ppid: void 0, // @ts-ignore
|
3091
|
+
pid: void 0,
|
3092
|
+
};
|
3093
|
+
procDummy.pid = Math.round(Math.random() * (1000 - 100)) + 100;
|
3094
|
+
procDummy.ppid = procDummy.pid + 9999;
|
3095
|
+
WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid] = procDummy;
|
3096
|
+
if (!WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]) {
|
3097
|
+
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid] = {
|
3098
|
+
childProcesses: [],
|
3099
|
+
};
|
3100
|
+
}
|
3101
|
+
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid].childProcesses.push(procDummy.pid);
|
3102
|
+
const checkIfProcessShouldBeDead = () => {
|
3103
|
+
return (_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid]) ||
|
3104
|
+
_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]));
|
3105
|
+
};
|
3106
|
+
const f = Helpers.runSyncOrAsync({
|
3107
|
+
functionFn: mockFun,
|
3108
|
+
arrayOfParams: [
|
3109
|
+
d => {
|
3110
|
+
setTimeout(() => {
|
3111
|
+
subStdoutSub.next(d);
|
3112
|
+
});
|
3113
|
+
},
|
3114
|
+
d => {
|
3115
|
+
setTimeout(() => {
|
3116
|
+
subStderSub.next(d);
|
3117
|
+
});
|
3118
|
+
},
|
3119
|
+
() => {
|
3120
|
+
const shouldBeDead = checkIfProcessShouldBeDead();
|
3121
|
+
return shouldBeDead;
|
3122
|
+
},
|
3123
|
+
],
|
3124
|
+
});
|
3125
|
+
f.then(exitCode => {
|
3126
|
+
if (_.isNil(exitCode)) {
|
3127
|
+
exitCode = 0;
|
3128
|
+
}
|
3129
|
+
setTimeout(() => {
|
3130
|
+
exitSub.next(exitCode);
|
3131
|
+
subscribtions.forEach(s => s.unsubscribe());
|
3132
|
+
});
|
3133
|
+
}).catch(e => {
|
3134
|
+
console.error(e);
|
3135
|
+
console.error(`Something wrong with your mock funciton`);
|
3136
|
+
exitSub.next(1);
|
3137
|
+
subscribtions.forEach(s => s.unsubscribe());
|
3138
|
+
});
|
3139
|
+
return procDummy;
|
3140
|
+
}
|
3141
|
+
/* */
|
3142
|
+
/* */
|
3143
|
+
/* */
|
3144
|
+
/* */
|
3145
|
+
return (void 0);
|
3146
|
+
},
|
3147
|
+
/**
|
3148
|
+
* start command as asynchronous nodej proces inside promise
|
3149
|
+
*/
|
3150
|
+
asyncAsPromise() {
|
3151
|
+
/* */
|
3152
|
+
/* */
|
3153
|
+
/* */
|
3154
|
+
/* */
|
3155
|
+
/* */
|
3156
|
+
/* */
|
3157
|
+
/* */
|
3158
|
+
/* */
|
3159
|
+
/* */
|
3160
|
+
/* */
|
3161
|
+
/* */
|
3162
|
+
/* */
|
3163
|
+
/* */
|
3164
|
+
/* */
|
3165
|
+
/* */
|
3166
|
+
/* */
|
3167
|
+
/* */
|
3168
|
+
return (void 0);
|
3169
|
+
},
|
3170
|
+
unitlOutput(optionsOutput) {
|
3171
|
+
/* */
|
3172
|
+
/* */
|
3173
|
+
/* */
|
3174
|
+
/* */
|
3175
|
+
/* */
|
3176
|
+
/* */
|
3177
|
+
/* */
|
3178
|
+
/* */
|
3179
|
+
/* */
|
3180
|
+
/* */
|
3181
|
+
/* */
|
3182
|
+
/* */
|
3183
|
+
/* */
|
3184
|
+
/* */
|
3185
|
+
/* */
|
3186
|
+
/* */
|
3187
|
+
/* */
|
3188
|
+
/* */
|
3189
|
+
/* */
|
3190
|
+
/* */
|
3191
|
+
/* */
|
3192
|
+
/* */
|
3193
|
+
/* */
|
3194
|
+
/* */
|
3195
|
+
/* */
|
3196
|
+
/* */
|
3197
|
+
/* */
|
3198
|
+
/* */
|
3199
|
+
/* */
|
3200
|
+
/* */
|
3201
|
+
/* */
|
3202
|
+
/* */
|
3203
|
+
/* */
|
3204
|
+
/* */
|
3205
|
+
/* */
|
3206
|
+
/* */
|
3207
|
+
/* */
|
3208
|
+
/* */
|
3209
|
+
/* */
|
3210
|
+
/* */
|
3211
|
+
/* */
|
3212
|
+
/* */
|
3213
|
+
/* */
|
3214
|
+
/* */
|
3215
|
+
/* */
|
3216
|
+
/* */
|
3217
|
+
/* */
|
3218
|
+
/* */
|
3219
|
+
/* */
|
3220
|
+
/* */
|
3221
|
+
/* */
|
3222
|
+
/* */
|
3223
|
+
/* */
|
3224
|
+
/* */
|
3225
|
+
/* */
|
3226
|
+
/* */
|
3227
|
+
/* */
|
3228
|
+
/* */
|
3229
|
+
/* */
|
3230
|
+
/* */
|
3231
|
+
/* */
|
3232
|
+
/* */
|
3233
|
+
/* */
|
3234
|
+
/* */
|
3235
|
+
/* */
|
3236
|
+
/* */
|
3237
|
+
/* */
|
3238
|
+
/* */
|
3239
|
+
/* */
|
3240
|
+
/* */
|
3241
|
+
/* */
|
3242
|
+
/* */
|
3243
|
+
/* */
|
3244
|
+
/* */
|
3245
|
+
/* */
|
3246
|
+
/* */
|
3247
|
+
/* */
|
3248
|
+
/* */
|
3249
|
+
/* */
|
3250
|
+
/* */
|
3251
|
+
/* */
|
3252
|
+
/* */
|
3253
|
+
/* */
|
3254
|
+
/* */
|
3255
|
+
/* */
|
3256
|
+
/* */
|
3257
|
+
/* */
|
3258
|
+
/* */
|
3259
|
+
/* */
|
3260
|
+
/* */
|
3261
|
+
/* */
|
3262
|
+
/* */
|
3263
|
+
/* */
|
3264
|
+
/* */
|
3265
|
+
/* */
|
3266
|
+
return (void 0);
|
3267
|
+
},
|
3268
|
+
/**
|
3269
|
+
* @deprecated use unitlOutput
|
3270
|
+
* start command as asynchronous nodej proces inside promise
|
3271
|
+
* and wait until output contains some string
|
3272
|
+
*/
|
3273
|
+
unitlOutputContains(stdoutMsg, stderMsg, timeout = 0, stdoutOutputContainsCallback) {
|
3274
|
+
/* */
|
3275
|
+
/* */
|
3276
|
+
/* */
|
3277
|
+
/* */
|
3278
|
+
/* */
|
3279
|
+
/* */
|
3280
|
+
/* */
|
3281
|
+
/* */
|
3282
|
+
/* */
|
3283
|
+
/* */
|
3284
|
+
/* */
|
3285
|
+
/* */
|
3286
|
+
/* */
|
3287
|
+
/* */
|
3288
|
+
/* */
|
3289
|
+
/* */
|
3290
|
+
/* */
|
3291
|
+
/* */
|
3292
|
+
/* */
|
3293
|
+
/* */
|
3294
|
+
/* */
|
3295
|
+
/* */
|
3296
|
+
/* */
|
3297
|
+
/* */
|
3298
|
+
/* */
|
3299
|
+
/* */
|
3300
|
+
/* */
|
3301
|
+
/* */
|
3302
|
+
/* */
|
3303
|
+
/* */
|
3304
|
+
/* */
|
3305
|
+
/* */
|
3306
|
+
/* */
|
3307
|
+
/* */
|
3308
|
+
/* */
|
3309
|
+
/* */
|
3310
|
+
/* */
|
3311
|
+
/* */
|
3312
|
+
/* */
|
3313
|
+
/* */
|
3314
|
+
/* */
|
3315
|
+
/* */
|
3316
|
+
/* */
|
3317
|
+
/* */
|
3318
|
+
/* */
|
3319
|
+
/* */
|
3320
|
+
/* */
|
3321
|
+
/* */
|
3322
|
+
/* */
|
3323
|
+
/* */
|
3324
|
+
/* */
|
3325
|
+
/* */
|
3326
|
+
/* */
|
3327
|
+
/* */
|
3328
|
+
/* */
|
3329
|
+
/* */
|
3330
|
+
/* */
|
3331
|
+
/* */
|
3332
|
+
/* */
|
3333
|
+
/* */
|
3334
|
+
/* */
|
3335
|
+
/* */
|
3336
|
+
/* */
|
3337
|
+
/* */
|
3338
|
+
/* */
|
3339
|
+
/* */
|
3340
|
+
/* */
|
3341
|
+
/* */
|
3342
|
+
/* */
|
3343
|
+
/* */
|
3344
|
+
/* */
|
3345
|
+
/* */
|
3346
|
+
/* */
|
3347
|
+
/* */
|
3348
|
+
/* */
|
3349
|
+
/* */
|
3350
|
+
/* */
|
3351
|
+
/* */
|
3352
|
+
/* */
|
3353
|
+
/* */
|
3354
|
+
return (void 0);
|
3355
|
+
},
|
3356
|
+
};
|
3357
|
+
}
|
3358
|
+
async questionYesNo(message, callbackTrue, callbackFalse, defaultValue = true,
|
3359
|
+
/**
|
3360
|
+
* in non interactive mode
|
3361
|
+
*/
|
3362
|
+
mustAnswerQuestion = false) {
|
3363
|
+
/* */
|
3364
|
+
/* */
|
3365
|
+
/* */
|
3366
|
+
/* */
|
3367
|
+
/* */
|
3368
|
+
/* */
|
3369
|
+
/* */
|
3370
|
+
/* */
|
3371
|
+
/* */
|
3372
|
+
/* */
|
3373
|
+
/* */
|
3374
|
+
/* */
|
3375
|
+
/* */
|
3376
|
+
/* */
|
3377
|
+
/* */
|
3378
|
+
/* */
|
3379
|
+
/* */
|
3362
3380
|
/* */
|
3363
3381
|
/* */
|
3364
3382
|
/* */
|
3365
3383
|
/* */
|
3366
3384
|
/* */
|
3367
3385
|
/* */
|
3386
|
+
/* */
|
3387
|
+
/* */
|
3388
|
+
/* */
|
3389
|
+
return (void 0);
|
3368
3390
|
}
|
3369
3391
|
/* */
|
3370
3392
|
/* */
|
@@ -3681,381 +3703,755 @@ class HelpersCore extends HelpersMessages {
|
|
3681
3703
|
/* */
|
3682
3704
|
/* */
|
3683
3705
|
/* */
|
3684
|
-
/* */
|
3685
|
-
/* */
|
3686
|
-
/* */
|
3687
|
-
/* */
|
3688
|
-
/* */
|
3689
|
-
/* */
|
3690
|
-
/* */
|
3691
|
-
/* */
|
3692
|
-
/* */
|
3693
|
-
/* */
|
3694
|
-
/* */
|
3695
|
-
/* */
|
3696
|
-
/* */
|
3697
|
-
/* */
|
3698
|
-
/* */
|
3699
|
-
/* */
|
3700
|
-
/* */
|
3701
|
-
/* */
|
3702
|
-
/* */
|
3703
|
-
/* */
|
3704
|
-
/* */
|
3705
|
-
|
3706
|
-
|
3707
|
-
|
3708
|
-
|
3709
|
-
|
3710
|
-
|
3711
|
-
|
3712
|
-
|
3713
|
-
|
3714
|
-
|
3715
|
-
|
3716
|
-
|
3717
|
-
|
3718
|
-
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
|
3726
|
-
|
3727
|
-
|
3728
|
-
|
3729
|
-
|
3730
|
-
|
3731
|
-
|
3732
|
-
|
3733
|
-
|
3734
|
-
|
3735
|
-
|
3736
|
-
|
3737
|
-
|
3738
|
-
|
3739
|
-
|
3740
|
-
|
3741
|
-
|
3742
|
-
|
3743
|
-
|
3744
|
-
|
3745
|
-
|
3746
|
-
|
3747
|
-
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
3751
|
-
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
|
3756
|
-
|
3757
|
-
|
3758
|
-
|
3759
|
-
|
3760
|
-
|
3761
|
-
|
3762
|
-
|
3763
|
-
|
3764
|
-
|
3765
|
-
|
3766
|
-
|
3767
|
-
|
3768
|
-
|
3769
|
-
|
3770
|
-
|
3771
|
-
|
3772
|
-
|
3773
|
-
|
3774
|
-
|
3775
|
-
/* */
|
3776
|
-
/* */
|
3777
|
-
/* */
|
3778
|
-
|
3779
|
-
|
3780
|
-
|
3781
|
-
|
3782
|
-
|
3783
|
-
|
3784
|
-
|
3785
|
-
|
3786
|
-
|
3787
|
-
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3794
|
-
|
3795
|
-
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
3799
|
-
|
3800
|
-
|
3801
|
-
|
3802
|
-
|
3803
|
-
|
3804
|
-
|
3805
|
-
|
3806
|
-
|
3807
|
-
|
3808
|
-
|
3809
|
-
|
3810
|
-
|
3811
|
-
|
3812
|
-
|
3813
|
-
|
3814
|
-
|
3815
|
-
|
3816
|
-
|
3817
|
-
|
3818
|
-
|
3819
|
-
|
3820
|
-
|
3821
|
-
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3828
|
-
|
3829
|
-
|
3830
|
-
|
3831
|
-
|
3832
|
-
|
3833
|
-
|
3834
|
-
|
3835
|
-
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
3840
|
-
|
3841
|
-
|
3842
|
-
|
3843
|
-
|
3844
|
-
|
3845
|
-
|
3846
|
-
|
3847
|
-
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3857
|
-
|
3858
|
-
|
3859
|
-
|
3860
|
-
|
3861
|
-
|
3862
|
-
|
3863
|
-
|
3864
|
-
|
3865
|
-
|
3866
|
-
|
3867
|
-
|
3868
|
-
|
3869
|
-
|
3870
|
-
|
3871
|
-
|
3872
|
-
|
3873
|
-
|
3874
|
-
|
3875
|
-
|
3876
|
-
|
3877
|
-
|
3878
|
-
|
3879
|
-
|
3880
|
-
|
3881
|
-
|
3882
|
-
|
3883
|
-
|
3884
|
-
|
3885
|
-
|
3886
|
-
|
3887
|
-
|
3888
|
-
|
3889
|
-
|
3890
|
-
|
3891
|
-
|
3892
|
-
|
3893
|
-
|
3894
|
-
|
3895
|
-
|
3896
|
-
|
3897
|
-
|
3898
|
-
|
3899
|
-
/* */
|
3900
|
-
/* */
|
3901
|
-
})(DbBinaryFormatEnum = Utils.DbBinaryFormatEnum || (Utils.DbBinaryFormatEnum = {}));
|
3902
|
-
/* */
|
3903
|
-
/* */
|
3904
|
-
let binary;
|
3905
|
-
(function (binary) {
|
3906
|
-
/**
|
3907
|
-
* This is for BROWSER ONLY
|
3908
|
-
*
|
3909
|
-
* @param buffer
|
3910
|
-
* @param contentType
|
3911
|
-
* @returns
|
3912
|
-
*/
|
3913
|
-
async function arrayBufferToBlob(buffer, contentType) {
|
3914
|
-
// @ts-ignore
|
3915
|
-
return new Blob([buffer], { type: contentType });
|
3916
|
-
}
|
3917
|
-
binary.arrayBufferToBlob = arrayBufferToBlob;
|
3918
|
-
/**
|
3919
|
-
* This is for BROWSER ONLY
|
3920
|
-
* @param blob
|
3921
|
-
* @returns
|
3922
|
-
*/
|
3923
|
-
async function blobToArrayBuffer(blob) {
|
3924
|
-
return await new Promise((resolve, reject) => {
|
3925
|
-
const reader = new FileReader();
|
3926
|
-
reader.addEventListener('loadend', () => {
|
3927
|
-
resolve(reader.result);
|
3928
|
-
});
|
3929
|
-
reader.addEventListener('error', reject); // @ts-ignore
|
3930
|
-
reader.readAsArrayBuffer(blob);
|
3931
|
-
});
|
3932
|
-
}
|
3933
|
-
binary.blobToArrayBuffer = blobToArrayBuffer;
|
3934
|
-
/**
|
3935
|
-
* it is revers to base64toBlob
|
3936
|
-
* @param blob
|
3937
|
-
* @returns
|
3938
|
-
*/
|
3939
|
-
function blobToBase64(blob) {
|
3940
|
-
return new Promise((resolve, _) => {
|
3941
|
-
const reader = new FileReader();
|
3942
|
-
reader.onloadend = () => resolve(reader.result); // @ts-ignore
|
3943
|
-
reader.readAsDataURL(blob);
|
3944
|
-
});
|
3945
|
-
}
|
3946
|
-
binary.blobToBase64 = blobToBase64;
|
3947
|
-
/**
|
3948
|
-
* it is revers to blobToBase64()
|
3949
|
-
* @param base64Data
|
3950
|
-
* @returns
|
3951
|
-
*/
|
3952
|
-
async function base64toBlob(base64Data, contentTypeOverride) {
|
3953
|
-
let content_type = void 0;
|
3954
|
-
let file_base64 = void 0;
|
3955
|
-
if (!contentTypeOverride) {
|
3956
|
-
const m = /^data:(.+?);base64,(.+)$/.exec(base64Data);
|
3957
|
-
if (!m) {
|
3958
|
-
throw new Error(`[taon-framework][base64toBlob] Not a base64 blob [${base64Data}]`);
|
3959
|
-
}
|
3960
|
-
var [__, contenttype, filebase64] = m;
|
3961
|
-
content_type = contenttype;
|
3962
|
-
file_base64 = filebase64;
|
3963
|
-
}
|
3964
|
-
content_type = (contentTypeOverride ? contentTypeOverride : content_type || '');
|
3965
|
-
base64Data = contentTypeOverride ? base64Data : file_base64;
|
3966
|
-
const sliceSize = 1024;
|
3967
|
-
const byteCharacters = atob(base64Data);
|
3968
|
-
const bytesLength = byteCharacters.length;
|
3969
|
-
const slicesCount = Math.ceil(bytesLength / sliceSize);
|
3970
|
-
const byteArrays = new Array(slicesCount);
|
3971
|
-
for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
|
3972
|
-
const begin = sliceIndex * sliceSize;
|
3973
|
-
const end = Math.min(begin + sliceSize, bytesLength);
|
3974
|
-
const bytes = new Array(end - begin);
|
3975
|
-
for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
|
3976
|
-
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
3706
|
+
/* */
|
3707
|
+
/* */
|
3708
|
+
/* */
|
3709
|
+
/* */
|
3710
|
+
/* */
|
3711
|
+
/* */
|
3712
|
+
/* */
|
3713
|
+
/* */
|
3714
|
+
/* */
|
3715
|
+
/* */
|
3716
|
+
/* */
|
3717
|
+
/* */
|
3718
|
+
/* */
|
3719
|
+
/* */
|
3720
|
+
/* */
|
3721
|
+
/* */
|
3722
|
+
/* */
|
3723
|
+
/* */
|
3724
|
+
/* */
|
3725
|
+
/* */
|
3726
|
+
/* */
|
3727
|
+
/* */
|
3728
|
+
/* */
|
3729
|
+
/* */
|
3730
|
+
/* */
|
3731
|
+
/* */
|
3732
|
+
/* */
|
3733
|
+
/* */
|
3734
|
+
/* */
|
3735
|
+
/* */
|
3736
|
+
/* */
|
3737
|
+
/* */
|
3738
|
+
/* */
|
3739
|
+
/* */
|
3740
|
+
/* */
|
3741
|
+
/* */
|
3742
|
+
/* */
|
3743
|
+
/* */
|
3744
|
+
/* */
|
3745
|
+
/* */
|
3746
|
+
/* */
|
3747
|
+
/* */
|
3748
|
+
/* */
|
3749
|
+
/* */
|
3750
|
+
/* */
|
3751
|
+
/* */
|
3752
|
+
/* */
|
3753
|
+
/* */
|
3754
|
+
/* */
|
3755
|
+
/* */
|
3756
|
+
/* */
|
3757
|
+
/* */
|
3758
|
+
/* */
|
3759
|
+
/* */
|
3760
|
+
/* */
|
3761
|
+
/* */
|
3762
|
+
/* */
|
3763
|
+
/* */
|
3764
|
+
/* */
|
3765
|
+
/* */
|
3766
|
+
/* */
|
3767
|
+
/* */
|
3768
|
+
/* */
|
3769
|
+
/* */
|
3770
|
+
/* */
|
3771
|
+
/* */
|
3772
|
+
/* */
|
3773
|
+
/* */
|
3774
|
+
/* */
|
3775
|
+
/* */
|
3776
|
+
/* */
|
3777
|
+
/* */
|
3778
|
+
/* */
|
3779
|
+
/* */
|
3780
|
+
/* */
|
3781
|
+
/* */
|
3782
|
+
/* */
|
3783
|
+
/* */
|
3784
|
+
/* */
|
3785
|
+
/* */
|
3786
|
+
/* */
|
3787
|
+
/* */
|
3788
|
+
/* */
|
3789
|
+
/* */
|
3790
|
+
/* */
|
3791
|
+
/* */
|
3792
|
+
/* */
|
3793
|
+
/* */
|
3794
|
+
/* */
|
3795
|
+
/* */
|
3796
|
+
/* */
|
3797
|
+
/* */
|
3798
|
+
/* */
|
3799
|
+
/* */
|
3800
|
+
/* */
|
3801
|
+
/* */
|
3802
|
+
/* */
|
3803
|
+
/* */
|
3804
|
+
/* */
|
3805
|
+
/* */
|
3806
|
+
/* */
|
3807
|
+
/* */
|
3808
|
+
/* */
|
3809
|
+
/* */
|
3810
|
+
/* */
|
3811
|
+
/* */
|
3812
|
+
/* */
|
3813
|
+
/* */
|
3814
|
+
/* */
|
3815
|
+
/* */
|
3816
|
+
/* */
|
3817
|
+
/* */
|
3818
|
+
/* */
|
3819
|
+
/* */
|
3820
|
+
/* */
|
3821
|
+
/* */
|
3822
|
+
/* */
|
3823
|
+
/* */
|
3824
|
+
/* */
|
3825
|
+
/* */
|
3826
|
+
/* */
|
3827
|
+
/* */
|
3828
|
+
/* */
|
3829
|
+
/* */
|
3830
|
+
/* */
|
3831
|
+
/* */
|
3832
|
+
/* */
|
3833
|
+
/* */
|
3834
|
+
/* */
|
3835
|
+
/* */
|
3836
|
+
/* */
|
3837
|
+
/* */
|
3838
|
+
/* */
|
3839
|
+
/* */
|
3840
|
+
/* */
|
3841
|
+
/* */
|
3842
|
+
/* */
|
3843
|
+
/* */
|
3844
|
+
/* */
|
3845
|
+
/* */
|
3846
|
+
/* */
|
3847
|
+
/* */
|
3848
|
+
/* */
|
3849
|
+
/* */
|
3850
|
+
/* */
|
3851
|
+
/* */
|
3852
|
+
/* */
|
3853
|
+
/* */
|
3854
|
+
/* */
|
3855
|
+
/* */
|
3856
|
+
/* */
|
3857
|
+
/* */
|
3858
|
+
/* */
|
3859
|
+
/* */
|
3860
|
+
/* */
|
3861
|
+
/* */
|
3862
|
+
/* */
|
3863
|
+
/* */
|
3864
|
+
/* */
|
3865
|
+
/* */
|
3866
|
+
/* */
|
3867
|
+
/* */
|
3868
|
+
/* */
|
3869
|
+
/* */
|
3870
|
+
/* */
|
3871
|
+
/* */
|
3872
|
+
/* */
|
3873
|
+
/* */
|
3874
|
+
/* */
|
3875
|
+
/* */
|
3876
|
+
/* */
|
3877
|
+
/* */
|
3878
|
+
/* */
|
3879
|
+
/* */
|
3880
|
+
/* */
|
3881
|
+
/* */
|
3882
|
+
/* */
|
3883
|
+
/* */
|
3884
|
+
/* */
|
3885
|
+
/* */
|
3886
|
+
/* */
|
3887
|
+
/* */
|
3888
|
+
/* */
|
3889
|
+
/* */
|
3890
|
+
/* */
|
3891
|
+
/* */
|
3892
|
+
/* */
|
3893
|
+
/* */
|
3894
|
+
/* */
|
3895
|
+
/* */
|
3896
|
+
/* */
|
3897
|
+
/* */
|
3898
|
+
/* */
|
3899
|
+
/* */
|
3900
|
+
/* */
|
3901
|
+
/* */
|
3902
|
+
/* */
|
3903
|
+
/* */
|
3904
|
+
/* */
|
3905
|
+
/* */
|
3906
|
+
/* */
|
3907
|
+
/* */
|
3908
|
+
/* */
|
3909
|
+
/* */
|
3910
|
+
/**
|
3911
|
+
* Quick fix for object values
|
3912
|
+
* @deprecated
|
3913
|
+
*/
|
3914
|
+
values(obj) {
|
3915
|
+
if (_.isObject(obj) && !Array.isArray(obj)) {
|
3916
|
+
const values = [];
|
3917
|
+
for (const key in obj) {
|
3918
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
3919
|
+
// @ts-ignore
|
3920
|
+
values.push(obj[key]);
|
3977
3921
|
}
|
3978
|
-
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
3979
3922
|
}
|
3980
|
-
return
|
3981
|
-
}
|
3982
|
-
binary.base64toBlob = base64toBlob;
|
3983
|
-
async function base64toDbBinaryFormat(text) {
|
3984
|
-
let result;
|
3985
|
-
result = await (async () => {
|
3986
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
3987
|
-
const blob = await base64toBlob(text);
|
3988
|
-
return blob;
|
3989
|
-
}
|
3990
|
-
return text;
|
3991
|
-
})();
|
3992
|
-
/* */
|
3993
|
-
/* */
|
3994
|
-
/* */
|
3995
|
-
/* */
|
3996
|
-
/* */
|
3997
|
-
return result;
|
3998
|
-
}
|
3999
|
-
binary.base64toDbBinaryFormat = base64toDbBinaryFormat;
|
4000
|
-
async function dbBinaryFormatToBase64(binaryFormat) {
|
4001
|
-
let result;
|
4002
|
-
result = await (async () => {
|
4003
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
4004
|
-
const text = await blobToBase64(binaryFormat);
|
4005
|
-
return text;
|
4006
|
-
}
|
4007
|
-
return binaryFormat;
|
4008
|
-
})();
|
4009
|
-
/* */
|
4010
|
-
/* */
|
4011
|
-
/* */
|
4012
|
-
/* */
|
4013
|
-
/* */
|
4014
|
-
return result;
|
4015
|
-
}
|
4016
|
-
binary.dbBinaryFormatToBase64 = dbBinaryFormatToBase64;
|
4017
|
-
async function textToDbBinaryFormat(text) {
|
4018
|
-
let result;
|
4019
|
-
result = await (async () => {
|
4020
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
4021
|
-
const blob = await textToBlob(text);
|
4022
|
-
return blob;
|
4023
|
-
}
|
4024
|
-
return text;
|
4025
|
-
})();
|
4026
|
-
/* */
|
4027
|
-
/* */
|
4028
|
-
/* */
|
4029
|
-
/* */
|
4030
|
-
/* */
|
4031
|
-
return result;
|
4032
|
-
}
|
4033
|
-
binary.textToDbBinaryFormat = textToDbBinaryFormat;
|
4034
|
-
async function dbBinaryFormatToText(binaryFormat) {
|
4035
|
-
let result;
|
4036
|
-
result = await (async () => {
|
4037
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
4038
|
-
const text = await blobToText(binaryFormat);
|
4039
|
-
return text;
|
4040
|
-
}
|
4041
|
-
return binaryFormat;
|
4042
|
-
})();
|
4043
|
-
/* */
|
4044
|
-
/* */
|
4045
|
-
/* */
|
4046
|
-
/* */
|
4047
|
-
/* */
|
4048
|
-
return result;
|
3923
|
+
return values;
|
4049
3924
|
}
|
4050
|
-
|
3925
|
+
return [];
|
3926
|
+
}
|
3927
|
+
/* */
|
3928
|
+
/* */
|
3929
|
+
/* */
|
3930
|
+
/* */
|
3931
|
+
/* */
|
3932
|
+
/* */
|
3933
|
+
/* */
|
3934
|
+
/* */
|
3935
|
+
/* */
|
3936
|
+
/* */
|
3937
|
+
/* */
|
3938
|
+
/* */
|
3939
|
+
/* */
|
3940
|
+
/* */
|
3941
|
+
/* */
|
3942
|
+
/* */
|
3943
|
+
/* */
|
3944
|
+
/* */
|
3945
|
+
/* */
|
3946
|
+
/* */
|
3947
|
+
/* */
|
3948
|
+
/* */
|
3949
|
+
/* */
|
3950
|
+
/* */
|
3951
|
+
/* */
|
3952
|
+
/* */
|
3953
|
+
/* */
|
3954
|
+
/* */
|
3955
|
+
/* */
|
3956
|
+
/* */
|
3957
|
+
/* */
|
3958
|
+
/* */
|
3959
|
+
/* */
|
3960
|
+
/* */
|
3961
|
+
/* */
|
3962
|
+
/* */
|
3963
|
+
/* */
|
3964
|
+
/* */
|
3965
|
+
/* */
|
3966
|
+
/* */
|
3967
|
+
/* */
|
3968
|
+
/* */
|
3969
|
+
/* */
|
3970
|
+
/* */
|
3971
|
+
/* */
|
3972
|
+
/* */
|
3973
|
+
/* */
|
3974
|
+
/* */
|
3975
|
+
/* */
|
3976
|
+
/* */
|
3977
|
+
/* */
|
3978
|
+
/* */
|
3979
|
+
/* */
|
3980
|
+
/* */
|
3981
|
+
/* */
|
3982
|
+
/* */
|
3983
|
+
/* */
|
3984
|
+
/* */
|
3985
|
+
/* */
|
3986
|
+
/* */
|
3987
|
+
/* */
|
3988
|
+
/* */
|
3989
|
+
/* */
|
3990
|
+
/* */
|
3991
|
+
/* */
|
3992
|
+
/* */
|
3993
|
+
/* */
|
3994
|
+
/* */
|
3995
|
+
/* */
|
3996
|
+
/* */
|
3997
|
+
/* */
|
3998
|
+
/* */
|
3999
|
+
/* */
|
4000
|
+
/* */
|
4001
|
+
/* */
|
4002
|
+
/* */
|
4003
|
+
/* */
|
4004
|
+
/* */
|
4005
|
+
/* */
|
4006
|
+
/* */
|
4007
|
+
/* */
|
4008
|
+
/* */
|
4009
|
+
/* */
|
4010
|
+
/* */
|
4011
|
+
/* */
|
4012
|
+
/* */
|
4013
|
+
/* */
|
4014
|
+
/* */
|
4015
|
+
/* */
|
4016
|
+
/* */
|
4017
|
+
/* */
|
4018
|
+
/* */
|
4019
|
+
/* */
|
4020
|
+
/* */
|
4021
|
+
/* */
|
4022
|
+
/* */
|
4023
|
+
/* */
|
4024
|
+
/* */
|
4025
|
+
/* */
|
4026
|
+
/* */
|
4027
|
+
/* */
|
4028
|
+
/* */
|
4029
|
+
/* */
|
4030
|
+
/* */
|
4031
|
+
/* */
|
4032
|
+
/* */
|
4033
|
+
/* */
|
4034
|
+
/* */
|
4035
|
+
/* */
|
4036
|
+
/* */
|
4037
|
+
/* */
|
4038
|
+
/* */
|
4039
|
+
/* */
|
4040
|
+
/* */
|
4041
|
+
/* */
|
4042
|
+
/* */
|
4043
|
+
/* */
|
4044
|
+
/* */
|
4045
|
+
/* */
|
4046
|
+
/* */
|
4047
|
+
/* */
|
4048
|
+
/* */
|
4049
|
+
/* */
|
4050
|
+
/* */
|
4051
|
+
/* */
|
4052
|
+
/* */
|
4053
|
+
/* */
|
4054
|
+
/* */
|
4055
|
+
/* */
|
4056
|
+
/* */
|
4057
|
+
/* */
|
4058
|
+
/* */
|
4059
|
+
/* */
|
4060
|
+
/* */
|
4061
|
+
/* */
|
4062
|
+
/* */
|
4063
|
+
/* */
|
4064
|
+
/* */
|
4065
|
+
/* */
|
4066
|
+
/* */
|
4067
|
+
/* */
|
4068
|
+
/* */
|
4069
|
+
/* */
|
4070
|
+
/* */
|
4071
|
+
/* */
|
4072
|
+
/* */
|
4073
|
+
/* */
|
4074
|
+
/* */
|
4075
|
+
/* */
|
4076
|
+
/* */
|
4077
|
+
/* */
|
4078
|
+
/* */
|
4079
|
+
/* */
|
4080
|
+
/* */
|
4081
|
+
/* */
|
4082
|
+
/* */
|
4083
|
+
/* */
|
4084
|
+
/* */
|
4085
|
+
/* */
|
4086
|
+
/* */
|
4087
|
+
/* */
|
4088
|
+
/* */
|
4089
|
+
replaceLinesInFile(absoluteFilePath, lineReplaceFn) {
|
4090
|
+
/* */
|
4051
4091
|
/* */
|
4052
4092
|
/* */
|
4053
4093
|
/* */
|
4054
4094
|
/* */
|
4055
4095
|
/* */
|
4096
|
+
}
|
4097
|
+
/* */
|
4098
|
+
/* */
|
4099
|
+
/* */
|
4100
|
+
/* */
|
4101
|
+
/* */
|
4102
|
+
/* */
|
4103
|
+
/* */
|
4104
|
+
/* */
|
4105
|
+
/* */
|
4106
|
+
/* */
|
4107
|
+
/* */
|
4108
|
+
/* */
|
4109
|
+
/* */
|
4110
|
+
/* */
|
4111
|
+
/* */
|
4112
|
+
/* */
|
4113
|
+
/* */
|
4114
|
+
/* */
|
4115
|
+
/* */
|
4116
|
+
/* */
|
4117
|
+
/* */
|
4118
|
+
/* */
|
4119
|
+
/* */
|
4120
|
+
/* */
|
4121
|
+
/* */
|
4122
|
+
/* */
|
4123
|
+
/* */
|
4124
|
+
/* */
|
4125
|
+
/* */
|
4126
|
+
/* */
|
4127
|
+
/* */
|
4128
|
+
/* */
|
4129
|
+
/* */
|
4130
|
+
/* */
|
4131
|
+
/* */
|
4132
|
+
/* */
|
4133
|
+
/* */
|
4134
|
+
/* */
|
4135
|
+
/* */
|
4136
|
+
/* */
|
4137
|
+
/* */
|
4138
|
+
/* */
|
4139
|
+
/* */
|
4140
|
+
/* */
|
4141
|
+
/* */
|
4142
|
+
/* */
|
4143
|
+
/* */
|
4144
|
+
/* */
|
4145
|
+
/* */
|
4146
|
+
/* */
|
4147
|
+
/* */
|
4148
|
+
/* */
|
4149
|
+
/* */
|
4150
|
+
/* */
|
4151
|
+
/* */
|
4152
|
+
/* */
|
4153
|
+
/* */
|
4154
|
+
/* */
|
4155
|
+
/* */
|
4156
|
+
/* */
|
4157
|
+
/* */
|
4158
|
+
/* */
|
4159
|
+
/* */
|
4160
|
+
/* */
|
4161
|
+
/* */
|
4162
|
+
/* */
|
4163
|
+
/* */
|
4164
|
+
/* */
|
4165
|
+
/* */
|
4166
|
+
/* */
|
4167
|
+
/* */
|
4168
|
+
/* */
|
4169
|
+
/* */
|
4170
|
+
/* */
|
4171
|
+
/* */
|
4172
|
+
/* */
|
4173
|
+
/* */
|
4174
|
+
/* */
|
4175
|
+
/* */
|
4176
|
+
/* */
|
4177
|
+
/* */
|
4178
|
+
/* */
|
4179
|
+
/* */
|
4180
|
+
/* */
|
4181
|
+
/* */
|
4182
|
+
/* */
|
4183
|
+
/* */
|
4184
|
+
/* */
|
4185
|
+
/* */
|
4186
|
+
/* */
|
4187
|
+
/* */
|
4188
|
+
/* */
|
4189
|
+
/* */
|
4190
|
+
/* */
|
4191
|
+
/* */
|
4192
|
+
/* */
|
4193
|
+
/* */
|
4194
|
+
/* */
|
4195
|
+
/* */
|
4196
|
+
/* */
|
4197
|
+
/* */
|
4198
|
+
/* */
|
4199
|
+
/* */
|
4200
|
+
/* */
|
4201
|
+
/* */
|
4202
|
+
/* */
|
4203
|
+
/* */
|
4204
|
+
/* */
|
4205
|
+
/* */
|
4206
|
+
/* */
|
4207
|
+
/* */
|
4208
|
+
/* */
|
4209
|
+
/* */
|
4210
|
+
/* */
|
4211
|
+
/* */
|
4212
|
+
/* */
|
4213
|
+
/* */
|
4214
|
+
/* */
|
4215
|
+
/* */
|
4216
|
+
/* */
|
4217
|
+
/* */
|
4218
|
+
/* */
|
4219
|
+
/* */
|
4220
|
+
/* */
|
4221
|
+
/* */
|
4222
|
+
/* */
|
4223
|
+
/* */
|
4224
|
+
/* */
|
4225
|
+
/* */
|
4226
|
+
/* */
|
4227
|
+
/* */
|
4228
|
+
/* */
|
4229
|
+
/* */
|
4230
|
+
/* */
|
4231
|
+
/* */
|
4232
|
+
/* */
|
4233
|
+
/* */
|
4234
|
+
/* */
|
4235
|
+
/* */
|
4236
|
+
/* */
|
4237
|
+
/* */
|
4238
|
+
/* */
|
4239
|
+
/* */
|
4240
|
+
/* */
|
4241
|
+
/* */
|
4242
|
+
/* */
|
4243
|
+
/* */
|
4244
|
+
/* */
|
4245
|
+
/* */
|
4246
|
+
/* */
|
4247
|
+
/* */
|
4248
|
+
/* */
|
4249
|
+
/* */
|
4250
|
+
/* */
|
4251
|
+
/* */
|
4252
|
+
/* */
|
4253
|
+
/* */
|
4254
|
+
/* */
|
4255
|
+
/* */
|
4256
|
+
/* */
|
4257
|
+
/* */
|
4258
|
+
/* */
|
4259
|
+
/* */
|
4260
|
+
/* */
|
4261
|
+
/* */
|
4262
|
+
/* */
|
4263
|
+
/* */
|
4264
|
+
/* */
|
4265
|
+
/* */
|
4266
|
+
/* */
|
4267
|
+
/* */
|
4268
|
+
/* */
|
4269
|
+
/* */
|
4270
|
+
/* */
|
4271
|
+
/* */
|
4272
|
+
/* */
|
4273
|
+
/* */
|
4274
|
+
/* */
|
4275
|
+
/* */
|
4276
|
+
/* */
|
4277
|
+
/* */
|
4278
|
+
/* */
|
4279
|
+
/* */
|
4280
|
+
/* */
|
4281
|
+
/* */
|
4282
|
+
/* */
|
4283
|
+
/* */
|
4284
|
+
/* */
|
4285
|
+
/* */
|
4286
|
+
/* */
|
4287
|
+
/* */
|
4288
|
+
/* */
|
4289
|
+
/* */
|
4290
|
+
/* */
|
4291
|
+
/* */
|
4292
|
+
/* */
|
4293
|
+
/* */
|
4294
|
+
/* */
|
4295
|
+
/* */
|
4296
|
+
/* */
|
4297
|
+
/* */
|
4298
|
+
/* */
|
4299
|
+
/* */
|
4300
|
+
/* */
|
4301
|
+
/* */
|
4302
|
+
/* */
|
4303
|
+
/* */
|
4304
|
+
/* */
|
4305
|
+
/* */
|
4306
|
+
/* */
|
4307
|
+
/* */
|
4308
|
+
/* */
|
4309
|
+
/* */
|
4310
|
+
/* */
|
4311
|
+
/* */
|
4312
|
+
/* */
|
4313
|
+
/* */
|
4314
|
+
/* */
|
4315
|
+
/* */
|
4316
|
+
/* */
|
4317
|
+
/* */
|
4318
|
+
/* */
|
4319
|
+
/* */
|
4320
|
+
/* */
|
4321
|
+
/* */
|
4322
|
+
/* */
|
4323
|
+
/* */
|
4324
|
+
/* */
|
4325
|
+
/* */
|
4326
|
+
/* */
|
4327
|
+
/* */
|
4328
|
+
/* */
|
4329
|
+
/* */
|
4330
|
+
/* */
|
4331
|
+
/* */
|
4332
|
+
/* */
|
4333
|
+
/* */
|
4334
|
+
/* */
|
4335
|
+
/* */
|
4336
|
+
/* */
|
4337
|
+
/* */
|
4338
|
+
/* */
|
4339
|
+
/* */
|
4340
|
+
/* */
|
4341
|
+
/* */
|
4342
|
+
/* */
|
4343
|
+
/* */
|
4344
|
+
/* */
|
4345
|
+
/* */
|
4346
|
+
/* */
|
4347
|
+
/* */
|
4348
|
+
/* */
|
4349
|
+
/* */
|
4350
|
+
/* */
|
4351
|
+
/* */
|
4352
|
+
/* */
|
4353
|
+
/* */
|
4354
|
+
/* */
|
4355
|
+
/* */
|
4356
|
+
/* */
|
4357
|
+
/* */
|
4358
|
+
/* */
|
4359
|
+
/* */
|
4360
|
+
/* */
|
4361
|
+
/* */
|
4362
|
+
/* */
|
4363
|
+
/* */
|
4364
|
+
/* */
|
4365
|
+
/* */
|
4366
|
+
/* */
|
4367
|
+
/* */
|
4368
|
+
/* */
|
4369
|
+
/* */
|
4370
|
+
/* */
|
4371
|
+
/* */
|
4372
|
+
/* */
|
4373
|
+
/* */
|
4374
|
+
/* */
|
4375
|
+
/* */
|
4376
|
+
/* */
|
4377
|
+
/* */
|
4378
|
+
/* */
|
4379
|
+
/* */
|
4380
|
+
/* */
|
4381
|
+
/* */
|
4382
|
+
/* */
|
4383
|
+
/* */
|
4384
|
+
/* */
|
4385
|
+
/* */
|
4386
|
+
/* */
|
4387
|
+
/* */
|
4388
|
+
/* */
|
4389
|
+
/* */
|
4390
|
+
/* */
|
4391
|
+
/* */
|
4392
|
+
/* */
|
4393
|
+
/* */
|
4394
|
+
/* */
|
4395
|
+
/* */
|
4396
|
+
/* */
|
4397
|
+
/* */
|
4398
|
+
/* */
|
4399
|
+
/* */
|
4400
|
+
/* */
|
4401
|
+
/* */
|
4402
|
+
/* */
|
4403
|
+
/* */
|
4404
|
+
/* */
|
4405
|
+
/* */
|
4406
|
+
/* */
|
4407
|
+
/* */
|
4408
|
+
/* */
|
4409
|
+
/* */
|
4410
|
+
/* */
|
4411
|
+
/* */
|
4412
|
+
/* */
|
4413
|
+
/* */
|
4414
|
+
/* */
|
4415
|
+
/* */
|
4416
|
+
/* */
|
4417
|
+
/* */
|
4418
|
+
/* */
|
4419
|
+
/* */
|
4420
|
+
/* */
|
4421
|
+
/* */
|
4422
|
+
/* */
|
4423
|
+
/* */
|
4424
|
+
/* */
|
4425
|
+
/* */
|
4426
|
+
/* */
|
4427
|
+
/* */
|
4428
|
+
/* */
|
4429
|
+
/* */
|
4430
|
+
/* */
|
4431
|
+
/* */
|
4432
|
+
/* */
|
4433
|
+
hideNodeWarnings() {
|
4056
4434
|
/* */
|
4057
4435
|
/* */
|
4058
4436
|
/* */
|
4437
|
+
}
|
4438
|
+
}
|
4439
|
+
;
|
4440
|
+
({}); // @--end-of-file-for-module=tnp-core lib/helpers.ts
|
4441
|
+
|
4442
|
+
const CoreConfig = {
|
4443
|
+
message: {
|
4444
|
+
globalSystemToolMode: 'globalSystemToolMode',
|
4445
|
+
},
|
4446
|
+
};
|
4447
|
+
;
|
4448
|
+
({}); // @--end-of-file-for-module=tnp-core lib/core-config.ts
|
4449
|
+
|
4450
|
+
class PROGRESS_DATA {
|
4451
|
+
constructor() {
|
4452
|
+
this.type = 'event';
|
4453
|
+
}
|
4454
|
+
static log(log) {
|
4059
4455
|
/* */
|
4060
4456
|
/* */
|
4061
4457
|
/* */
|
@@ -4063,122 +4459,46 @@ var Utils;
|
|
4063
4459
|
/* */
|
4064
4460
|
/* */
|
4065
4461
|
/* */
|
4066
|
-
|
4067
|
-
|
4068
|
-
|
4069
|
-
|
4462
|
+
}
|
4463
|
+
static resolveFrom(chunk, callbackOnFounded, checkSplit = true) {
|
4464
|
+
let progress;
|
4465
|
+
let res = [];
|
4466
|
+
if (!_.isString(chunk)) {
|
4467
|
+
return [];
|
4070
4468
|
}
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4469
|
+
chunk = chunk.trim();
|
4470
|
+
if (checkSplit) {
|
4471
|
+
const split = chunk.split(/\r\n|\n|\r/);
|
4472
|
+
if (split.length > 1) {
|
4473
|
+
split.forEach(s => {
|
4474
|
+
res = res.concat(this.resolveFrom(s, callbackOnFounded, false));
|
4475
|
+
});
|
4476
|
+
return res;
|
4075
4477
|
}
|
4076
|
-
// @ts-ignore
|
4077
|
-
return new File([blob], nameForFile);
|
4078
|
-
}
|
4079
|
-
binary.blobToFile = blobToFile;
|
4080
|
-
/* */
|
4081
|
-
/* */
|
4082
|
-
/* */
|
4083
|
-
/* */
|
4084
|
-
/* */
|
4085
|
-
/* */
|
4086
|
-
/* */
|
4087
|
-
/* */
|
4088
|
-
/* */
|
4089
|
-
/* */
|
4090
|
-
/* */
|
4091
|
-
/* */
|
4092
|
-
/* */
|
4093
|
-
/* */
|
4094
|
-
/* */
|
4095
|
-
/* */
|
4096
|
-
/* */
|
4097
|
-
/* */
|
4098
|
-
/* */
|
4099
|
-
/* */
|
4100
|
-
/* */
|
4101
|
-
/* */
|
4102
|
-
/* */
|
4103
|
-
/* */
|
4104
|
-
/* */
|
4105
|
-
/* */
|
4106
|
-
async function textToBlob(text, type = 'text/plain') {
|
4107
|
-
const blob = new Blob([text], { type });
|
4108
|
-
return blob;
|
4109
|
-
}
|
4110
|
-
binary.textToBlob = textToBlob;
|
4111
|
-
async function blobToText(blob) {
|
4112
|
-
return await blob.text();
|
4113
|
-
}
|
4114
|
-
binary.blobToText = blobToText;
|
4115
|
-
async function textToFile(text, fileRelativePathOrName) {
|
4116
|
-
const ext = path.extname(fileRelativePathOrName);
|
4117
|
-
const type = CoreModels.mimeTypes[ext];
|
4118
|
-
const blob = new Blob([text], { type });
|
4119
|
-
const file = await blobToFile(blob, fileRelativePathOrName);
|
4120
|
-
return file;
|
4121
|
-
}
|
4122
|
-
binary.textToFile = textToFile;
|
4123
|
-
async function fileToText(file) {
|
4124
|
-
return await file.text();
|
4125
|
-
}
|
4126
|
-
binary.fileToText = fileToText;
|
4127
|
-
async function jsonToBlob(jsonObj) {
|
4128
|
-
const blob = new Blob([JSON.stringify(jsonObj, null, 2)], {
|
4129
|
-
type: 'application/json',
|
4130
|
-
});
|
4131
|
-
return blob;
|
4132
4478
|
}
|
4133
|
-
|
4134
|
-
|
4135
|
-
|
4136
|
-
*/
|
4137
|
-
async function blobToJson(blob) {
|
4138
|
-
return JSON.parse(await blob.text());
|
4139
|
-
}
|
4140
|
-
binary.blobToJson = blobToJson;
|
4141
|
-
async function getBlobFrom(url) {
|
4142
|
-
const response = await axios({
|
4143
|
-
url,
|
4144
|
-
method: 'get',
|
4145
|
-
responseType: 'blob',
|
4146
|
-
});
|
4147
|
-
return response.data;
|
4479
|
+
if (/\[\[\[.*\]\]\]/g.test(chunk)) {
|
4480
|
+
chunk = chunk.replace(/^\[\[\[/g, '').replace(/\]\]\]$/g, '');
|
4481
|
+
progress = chunk;
|
4148
4482
|
}
|
4149
|
-
|
4150
|
-
|
4151
|
-
|
4152
|
-
|
4153
|
-
|
4154
|
-
|
4155
|
-
|
4156
|
-
|
4157
|
-
|
4158
|
-
|
4159
|
-
|
4483
|
+
if (!_.isUndefined(progress)) {
|
4484
|
+
try {
|
4485
|
+
const p = JSON.parse(progress);
|
4486
|
+
const single = _.merge(new PROGRESS_DATA(), p);
|
4487
|
+
res = res.concat([single]);
|
4488
|
+
if (_.isFunction(callbackOnFounded)) {
|
4489
|
+
callbackOnFounded(single);
|
4490
|
+
}
|
4491
|
+
}
|
4492
|
+
catch (err) {
|
4493
|
+
Helpers.error(err, true, true);
|
4494
|
+
Helpers.error(`ProgresssBarData: fail to parse "${progress}"`, true, true);
|
4495
|
+
}
|
4160
4496
|
}
|
4161
|
-
|
4162
|
-
}
|
4163
|
-
|
4164
|
-
(function (process) {
|
4165
|
-
async function startAsync(command, options) { }
|
4166
|
-
process.startAsync = startAsync;
|
4167
|
-
function startSync(command, options) { }
|
4168
|
-
process.startSync = startSync;
|
4169
|
-
})(process = Utils.process || (Utils.process = {}));
|
4170
|
-
})(Utils || (Utils = {}));
|
4171
|
-
var UtilsString;
|
4172
|
-
(function (UtilsString) {
|
4173
|
-
UtilsString.kebabCaseNoSplitNumbers = (input) => {
|
4174
|
-
return (input
|
4175
|
-
.replace(/\s+/g, '-')
|
4176
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
4177
|
-
.toLowerCase());
|
4178
|
-
};
|
4179
|
-
})(UtilsString || (UtilsString = {}));
|
4497
|
+
return res;
|
4498
|
+
}
|
4499
|
+
}
|
4180
4500
|
;
|
4181
|
-
({}); // @--end-of-file-for-module=tnp-core lib/
|
4501
|
+
({}); // @--end-of-file-for-module=tnp-core lib/progress-data.ts
|
4182
4502
|
|
4183
4503
|
/* */
|
4184
4504
|
/* */
|
@@ -4200,6 +4520,10 @@ class CLI {
|
|
4200
4520
|
;
|
4201
4521
|
({}); // @--end-of-file-for-module=tnp-core lib/core-cli.ts
|
4202
4522
|
|
4523
|
+
/**
|
4524
|
+
* TODO slowly refactor this.. only actually globally needed are:
|
4525
|
+
* pm2, yarn, npm-run, ts-node ???
|
4526
|
+
*/
|
4203
4527
|
const requiredForDev = {
|
4204
4528
|
npm: [
|
4205
4529
|
/* */
|
@@ -4234,6 +4558,9 @@ const requiredForDev = {
|
|
4234
4558
|
/* */
|
4235
4559
|
/* */
|
4236
4560
|
/* */
|
4561
|
+
/* */
|
4562
|
+
/* */
|
4563
|
+
/* */
|
4237
4564
|
],
|
4238
4565
|
niceTools: [
|
4239
4566
|
/* */
|
@@ -4270,7 +4597,7 @@ const requiredForDev = {
|
|
4270
4597
|
],
|
4271
4598
|
};
|
4272
4599
|
;
|
4273
|
-
({}); // @--end-of-file-for-module=tnp-core lib/required.ts
|
4600
|
+
({}); // @--end-of-file-for-module=tnp-core lib/required-global-npm-packages.ts
|
4274
4601
|
|
4275
4602
|
let Helpers = HelpersCore.InstanceCore;
|
4276
4603
|
;
|
@@ -4280,5 +4607,5 @@ let Helpers = HelpersCore.InstanceCore;
|
|
4280
4607
|
* Generated bundle index. Do not edit.
|
4281
4608
|
*/
|
4282
4609
|
|
4283
|
-
export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsString, chalk, crossPlatformPath, frameworkName, frameworkNameBe, path, requiredForDev, win32Path };
|
4610
|
+
export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsOs, UtilsProcess, UtilsString, chalk, crossPlatformPath, frameworkName, frameworkNameBe, path, requiredForDev, win32Path };
|
4284
4611
|
//# sourceMappingURL=tnp-core.mjs.map
|