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
|
-
/* */
|
735
|
-
/* */
|
736
|
-
return false;
|
737
|
-
}
|
738
|
-
get isNode() {
|
739
|
-
/* */
|
740
|
-
/* */
|
741
|
-
return false;
|
742
|
-
}
|
743
|
-
get isElectron() {
|
744
|
-
// @ts-ignore
|
745
|
-
if (typeof window !== 'undefined' &&
|
746
|
-
typeof window.process === 'object' &&
|
747
|
-
window.process.type === 'renderer') {
|
748
|
-
return true;
|
749
|
-
}
|
750
|
-
// @ts-ignore
|
751
|
-
if (typeof process !== 'undefined' &&
|
752
|
-
typeof process.versions === 'object' &&
|
753
|
-
!!process.versions.electron) {
|
754
|
-
return true;
|
755
|
-
}
|
756
|
-
if (typeof navigator === 'object' &&
|
757
|
-
typeof navigator.userAgent === 'string' &&
|
758
|
-
navigator.userAgent.indexOf('Electron') >= 0) {
|
759
|
-
return true;
|
760
|
-
}
|
761
|
-
return false;
|
762
|
-
}
|
763
|
-
contain(arr, item) {
|
764
|
-
return (arr.filter(l => {
|
765
|
-
if (l instanceof RegExp) {
|
766
|
-
return l.test(item);
|
767
|
-
}
|
768
|
-
if (l === item) {
|
769
|
-
return true;
|
770
|
-
}
|
771
|
-
if (item.match && typeof item.match === 'function' ? item.match(l) : false) {
|
772
|
-
return true;
|
773
|
-
}
|
774
|
-
return false;
|
775
|
-
}).length > 0);
|
776
|
-
}
|
777
|
-
}
|
778
|
-
;
|
779
|
-
({}); // @--end-of-file-for-module=tnp-core lib/helpers-isomorphic.ts
|
780
|
-
|
781
|
-
/* */
|
782
|
-
/* */
|
783
|
-
/* */
|
784
|
-
const KEY = {
|
785
|
-
LAST_ERROR: Symbol(),
|
786
|
-
LAST_INFO: Symbol(),
|
787
|
-
LAST_WARN: Symbol(),
|
788
|
-
LAST_LOG: Symbol(),
|
789
|
-
LAST_SUCCESS: Symbol(),
|
790
|
-
LAST_TASK_STARTED: Symbol(),
|
791
|
-
LAST_TASK_DONE: Symbol(),
|
792
|
-
};
|
793
|
-
const KEY_COUNT = {
|
794
|
-
LAST_ERROR: Symbol(),
|
795
|
-
LAST_INFO: Symbol(),
|
796
|
-
LAST_WARN: Symbol(),
|
797
|
-
LAST_LOG: Symbol(),
|
798
|
-
LAST_SUCCESS: Symbol(),
|
799
|
-
LAST_TASK_STARTED: Symbol(),
|
800
|
-
LAST_TASK_DONE: Symbol(),
|
801
|
-
};
|
802
|
-
const KEY_IMPORTANTCE = {
|
803
|
-
LAST_ERROR: Symbol(),
|
804
|
-
LAST_INFO: Symbol(),
|
805
|
-
LAST_WARN: Symbol(),
|
806
|
-
LAST_LOG: Symbol(),
|
807
|
-
LAST_SUCCESS: Symbol(),
|
808
|
-
LAST_TASK_STARTED: Symbol(),
|
809
|
-
LAST_TASK_DONE: Symbol(),
|
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
|
-
/* */
|
855
|
-
}
|
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, '');
|
856
752
|
}
|
857
|
-
|
858
|
-
|
859
|
-
console.error(details);
|
860
|
-
return;
|
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,8 +796,246 @@ 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
|
/* */
|
@@ -909,18 +1043,28 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
909
1043
|
/* */
|
910
1044
|
/* */
|
911
1045
|
/* */
|
912
|
-
}
|
913
|
-
info(details, repeatable = false) {
|
914
1046
|
/* */
|
915
1047
|
/* */
|
916
1048
|
/* */
|
917
1049
|
/* */
|
918
1050
|
/* */
|
919
1051
|
/* */
|
920
|
-
|
921
|
-
|
922
|
-
|
1052
|
+
/* */
|
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);
|
923
1066
|
}
|
1067
|
+
binary.blobToFile = blobToFile;
|
924
1068
|
/* */
|
925
1069
|
/* */
|
926
1070
|
/* */
|
@@ -947,6 +1091,80 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
947
1091
|
/* */
|
948
1092
|
/* */
|
949
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 = () => {
|
950
1168
|
/* */
|
951
1169
|
/* */
|
952
1170
|
/* */
|
@@ -955,12 +1173,6 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
955
1173
|
/* */
|
956
1174
|
/* */
|
957
1175
|
/* */
|
958
|
-
}
|
959
|
-
success(details) {
|
960
|
-
if (Helpers.isBrowser) {
|
961
|
-
console.info(details);
|
962
|
-
return;
|
963
|
-
}
|
964
1176
|
/* */
|
965
1177
|
/* */
|
966
1178
|
/* */
|
@@ -971,6 +1183,13 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
971
1183
|
/* */
|
972
1184
|
/* */
|
973
1185
|
/* */
|
1186
|
+
return (void 0);
|
1187
|
+
};
|
1188
|
+
/**
|
1189
|
+
* TODO IMPLEMENT
|
1190
|
+
* start async node process
|
1191
|
+
*/
|
1192
|
+
UtilsProcess.startInNewTerminalWindow = (command, options) => {
|
974
1193
|
/* */
|
975
1194
|
/* */
|
976
1195
|
/* */
|
@@ -998,18 +1217,6 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
998
1217
|
/* */
|
999
1218
|
/* */
|
1000
1219
|
/* */
|
1001
|
-
}
|
1002
|
-
/**
|
1003
|
-
*
|
1004
|
-
* @param details
|
1005
|
-
* @param isLogTask is less important log task
|
1006
|
-
* @returns
|
1007
|
-
*/
|
1008
|
-
taskStarted(details, isLogTask = false) {
|
1009
|
-
if (Helpers.isBrowser) {
|
1010
|
-
console.info(details);
|
1011
|
-
return;
|
1012
|
-
}
|
1013
1220
|
/* */
|
1014
1221
|
/* */
|
1015
1222
|
/* */
|
@@ -1057,12 +1264,6 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1057
1264
|
/* */
|
1058
1265
|
/* */
|
1059
1266
|
/* */
|
1060
|
-
}
|
1061
|
-
taskDone(details, isLessImportant = false) {
|
1062
|
-
if (Helpers.isBrowser) {
|
1063
|
-
console.info(details);
|
1064
|
-
return;
|
1065
|
-
}
|
1066
1267
|
/* */
|
1067
1268
|
/* */
|
1068
1269
|
/* */
|
@@ -1090,6 +1291,11 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1090
1291
|
/* */
|
1091
1292
|
/* */
|
1092
1293
|
/* */
|
1294
|
+
return (void 0);
|
1295
|
+
};
|
1296
|
+
UtilsProcess.getBashOrShellName = () => {
|
1297
|
+
return 'browser';
|
1298
|
+
/* */
|
1093
1299
|
/* */
|
1094
1300
|
/* */
|
1095
1301
|
/* */
|
@@ -1115,26 +1321,77 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1115
1321
|
/* */
|
1116
1322
|
/* */
|
1117
1323
|
/* */
|
1118
|
-
}
|
1119
|
-
log(details, debugLevel = 0) {
|
1120
|
-
if (Helpers.isBrowser) {
|
1121
|
-
console.log(details);
|
1122
|
-
return;
|
1123
|
-
}
|
1124
1324
|
/* */
|
1125
1325
|
/* */
|
1126
1326
|
/* */
|
1127
1327
|
/* */
|
1128
1328
|
/* */
|
1129
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 = () => {
|
1130
1341
|
/* */
|
1131
1342
|
/* */
|
1343
|
+
return true;
|
1344
|
+
};
|
1345
|
+
/**
|
1346
|
+
* check if script is running in nodejs
|
1347
|
+
* (backend script or electron script)
|
1348
|
+
*/
|
1349
|
+
UtilsOs.isRunningInNode = () => {
|
1132
1350
|
/* */
|
1133
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 = () => {
|
1134
1360
|
/* */
|
1135
1361
|
/* */
|
1136
1362
|
/* */
|
1137
1363
|
/* */
|
1364
|
+
return false;
|
1365
|
+
};
|
1366
|
+
/**
|
1367
|
+
* check whether the current process is running inside
|
1368
|
+
* Electron backend or browser.
|
1369
|
+
*/
|
1370
|
+
UtilsOs.isRunningInElectron = () => {
|
1371
|
+
// @ts-ignore
|
1372
|
+
if (typeof window !== 'undefined' &&
|
1373
|
+
typeof window.process === 'object' &&
|
1374
|
+
window.process.type === 'renderer') {
|
1375
|
+
return true;
|
1376
|
+
}
|
1377
|
+
// @ts-ignore
|
1378
|
+
if (typeof process !== 'undefined' &&
|
1379
|
+
typeof process.versions === 'object' &&
|
1380
|
+
!!process.versions.electron) {
|
1381
|
+
return true;
|
1382
|
+
}
|
1383
|
+
if (typeof navigator === 'object' &&
|
1384
|
+
typeof navigator.userAgent === 'string' &&
|
1385
|
+
navigator.userAgent.indexOf('Electron') >= 0) {
|
1386
|
+
return true;
|
1387
|
+
}
|
1388
|
+
return false;
|
1389
|
+
};
|
1390
|
+
/**
|
1391
|
+
* Check wether the current process is running inside
|
1392
|
+
* windows subsystem for linux (WSL).
|
1393
|
+
*/
|
1394
|
+
UtilsOs.isRunningInWsl = () => {
|
1138
1395
|
/* */
|
1139
1396
|
/* */
|
1140
1397
|
/* */
|
@@ -1152,6 +1409,9 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1152
1409
|
/* */
|
1153
1410
|
/* */
|
1154
1411
|
/* */
|
1412
|
+
return (void 0);
|
1413
|
+
};
|
1414
|
+
UtilsOs.isRunningInDocker = () => {
|
1155
1415
|
/* */
|
1156
1416
|
/* */
|
1157
1417
|
/* */
|
@@ -1159,6 +1419,9 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1159
1419
|
/* */
|
1160
1420
|
/* */
|
1161
1421
|
/* */
|
1422
|
+
return (void 0);
|
1423
|
+
};
|
1424
|
+
UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
|
1162
1425
|
/* */
|
1163
1426
|
/* */
|
1164
1427
|
/* */
|
@@ -1166,61 +1429,192 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1166
1429
|
/* */
|
1167
1430
|
/* */
|
1168
1431
|
/* */
|
1432
|
+
return (void 0);
|
1433
|
+
};
|
1434
|
+
})(UtilsOs || (UtilsOs = {}));
|
1435
|
+
var UtilsString;
|
1436
|
+
(function (UtilsString) {
|
1437
|
+
UtilsString.kebabCaseNoSplitNumbers = (input) => {
|
1438
|
+
return (input
|
1439
|
+
.replace(/\s+/g, '-')
|
1440
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
1441
|
+
.toLowerCase());
|
1442
|
+
};
|
1443
|
+
})(UtilsString || (UtilsString = {}));
|
1444
|
+
;
|
1445
|
+
({}); // @--end-of-file-for-module=tnp-core lib/utils.ts
|
1446
|
+
|
1447
|
+
class HelpersIsomorphic {
|
1448
|
+
/**
|
1449
|
+
* @deprecated
|
1450
|
+
* use UtilsOs.isRunningInBrowser() instead
|
1451
|
+
*/
|
1452
|
+
get isBrowser() {
|
1453
|
+
return UtilsOs.isRunningInBrowser();
|
1454
|
+
}
|
1455
|
+
/**
|
1456
|
+
* @deprecated
|
1457
|
+
* use UtilsOs.isRunningInWebSQL() instead
|
1458
|
+
*/
|
1459
|
+
get isWebSQL() {
|
1460
|
+
return UtilsOs.isRunningInWebSQL();
|
1461
|
+
}
|
1462
|
+
/**
|
1463
|
+
* @deprecated
|
1464
|
+
* use UtilsOs.isRunningInNode() instead
|
1465
|
+
*/
|
1466
|
+
get isNode() {
|
1467
|
+
return UtilsOs.isRunningInNode();
|
1468
|
+
}
|
1469
|
+
/**
|
1470
|
+
* @deprecated
|
1471
|
+
* use UtilsOs.isRunningInElectron() instead
|
1472
|
+
*/
|
1473
|
+
get isElectron() {
|
1474
|
+
return UtilsOs.isRunningInElectron();
|
1475
|
+
}
|
1476
|
+
/**
|
1477
|
+
* TODO what is the purpose of this function?
|
1478
|
+
* @deprecated
|
1479
|
+
*/
|
1480
|
+
contain(arr, item) {
|
1481
|
+
return (arr.filter(l => {
|
1482
|
+
if (l instanceof RegExp) {
|
1483
|
+
return l.test(item);
|
1484
|
+
}
|
1485
|
+
if (l === item) {
|
1486
|
+
return true;
|
1487
|
+
}
|
1488
|
+
if (item.match && typeof item.match === 'function' ? item.match(l) : false) {
|
1489
|
+
return true;
|
1490
|
+
}
|
1491
|
+
return false;
|
1492
|
+
}).length > 0);
|
1493
|
+
}
|
1494
|
+
}
|
1495
|
+
;
|
1496
|
+
({}); // @--end-of-file-for-module=tnp-core lib/helpers-isomorphic.ts
|
1497
|
+
|
1498
|
+
/* */
|
1499
|
+
/* */
|
1500
|
+
/* */
|
1501
|
+
const KEY = {
|
1502
|
+
LAST_ERROR: Symbol(),
|
1503
|
+
LAST_INFO: Symbol(),
|
1504
|
+
LAST_WARN: Symbol(),
|
1505
|
+
LAST_LOG: Symbol(),
|
1506
|
+
LAST_SUCCESS: Symbol(),
|
1507
|
+
LAST_TASK_STARTED: Symbol(),
|
1508
|
+
LAST_TASK_DONE: Symbol(),
|
1509
|
+
};
|
1510
|
+
const KEY_COUNT = {
|
1511
|
+
LAST_ERROR: Symbol(),
|
1512
|
+
LAST_INFO: Symbol(),
|
1513
|
+
LAST_WARN: Symbol(),
|
1514
|
+
LAST_LOG: Symbol(),
|
1515
|
+
LAST_SUCCESS: Symbol(),
|
1516
|
+
LAST_TASK_STARTED: Symbol(),
|
1517
|
+
LAST_TASK_DONE: Symbol(),
|
1518
|
+
};
|
1519
|
+
const KEY_IMPORTANTCE = {
|
1520
|
+
LAST_ERROR: Symbol(),
|
1521
|
+
LAST_INFO: Symbol(),
|
1522
|
+
LAST_WARN: Symbol(),
|
1523
|
+
LAST_LOG: Symbol(),
|
1524
|
+
LAST_SUCCESS: Symbol(),
|
1525
|
+
LAST_TASK_STARTED: Symbol(),
|
1526
|
+
LAST_TASK_DONE: Symbol(),
|
1527
|
+
};
|
1528
|
+
/* */
|
1529
|
+
/* */
|
1530
|
+
/* */
|
1531
|
+
/* */
|
1532
|
+
/* */
|
1533
|
+
/* */
|
1534
|
+
/* */
|
1535
|
+
/* */
|
1536
|
+
/* */
|
1537
|
+
/* */
|
1538
|
+
/* */
|
1539
|
+
/* */
|
1540
|
+
/* */
|
1541
|
+
/* */
|
1542
|
+
/* */
|
1543
|
+
/* */
|
1544
|
+
/* */
|
1545
|
+
/* */
|
1546
|
+
/* */
|
1547
|
+
/* */
|
1548
|
+
/* */
|
1549
|
+
const LIMIT = 10;
|
1550
|
+
class HelpersMessages extends HelpersIsomorphic {
|
1551
|
+
msgCacheClear() {
|
1169
1552
|
/* */
|
1170
1553
|
/* */
|
1171
1554
|
/* */
|
1172
1555
|
/* */
|
1173
1556
|
/* */
|
1174
1557
|
}
|
1558
|
+
renderError(err) {
|
1559
|
+
if (this.isBrowser) {
|
1560
|
+
console.error(err);
|
1561
|
+
}
|
1562
|
+
else {
|
1563
|
+
/* */
|
1564
|
+
/* */
|
1565
|
+
/* */
|
1566
|
+
/* */
|
1567
|
+
/* */
|
1568
|
+
/* */
|
1569
|
+
/* */
|
1570
|
+
/* */
|
1571
|
+
/* */
|
1572
|
+
}
|
1573
|
+
}
|
1175
1574
|
/**
|
1176
|
-
*
|
1575
|
+
* Throw error and exit process
|
1576
|
+
* make sure browser or nodejs will not continue
|
1577
|
+
* @param details
|
1177
1578
|
*/
|
1178
|
-
|
1579
|
+
throw(details) {
|
1580
|
+
if (this.isBrowser) {
|
1581
|
+
document.body.innerHTML =
|
1582
|
+
'<h1>Application has encountered an error and stopped.</h1>';
|
1583
|
+
document.body.style.pointerEvents = 'none';
|
1584
|
+
/* */
|
1585
|
+
/* */
|
1586
|
+
/* */
|
1587
|
+
/* */
|
1588
|
+
}
|
1589
|
+
throw new Error(details);
|
1590
|
+
}
|
1591
|
+
error(details, noExit = false, noTrace = false) {
|
1592
|
+
if (Helpers.isBrowser) {
|
1593
|
+
console.error(details);
|
1594
|
+
return;
|
1595
|
+
}
|
1596
|
+
/* */
|
1597
|
+
/* */
|
1179
1598
|
/* */
|
1180
1599
|
/* */
|
1181
1600
|
/* */
|
1182
1601
|
/* */
|
1183
1602
|
/* */
|
1184
|
-
return (void 0);
|
1185
|
-
}
|
1186
|
-
/**
|
1187
|
-
* Logs not visible in normal use of taon-cli
|
1188
|
-
*/
|
1189
|
-
logInfo(details, repeatable = false) {
|
1190
1603
|
/* */
|
1191
1604
|
/* */
|
1192
1605
|
/* */
|
1193
1606
|
/* */
|
1194
1607
|
/* */
|
1195
|
-
return (void 0);
|
1196
|
-
}
|
1197
|
-
/**
|
1198
|
-
* Logs not visible in normal use of taon-cli
|
1199
|
-
*/
|
1200
|
-
logError(details, noExit = false, noTrace = false) {
|
1201
1608
|
/* */
|
1202
1609
|
/* */
|
1203
1610
|
/* */
|
1204
1611
|
/* */
|
1205
1612
|
/* */
|
1206
|
-
return (void 0);
|
1207
|
-
}
|
1208
|
-
/**
|
1209
|
-
* Logs not visible in normal use of taon-cli
|
1210
|
-
*/
|
1211
|
-
logWarn(details, trace = false) {
|
1212
1613
|
/* */
|
1213
1614
|
/* */
|
1214
1615
|
/* */
|
1215
1616
|
/* */
|
1216
1617
|
/* */
|
1217
|
-
return (void 0);
|
1218
|
-
}
|
1219
|
-
warn(details, trace = false) {
|
1220
|
-
if (Helpers.isBrowser) {
|
1221
|
-
console.warn(details);
|
1222
|
-
return;
|
1223
|
-
}
|
1224
1618
|
/* */
|
1225
1619
|
/* */
|
1226
1620
|
/* */
|
@@ -1249,6 +1643,28 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1249
1643
|
/* */
|
1250
1644
|
/* */
|
1251
1645
|
/* */
|
1646
|
+
}
|
1647
|
+
info(details, repeatable = false) {
|
1648
|
+
/* */
|
1649
|
+
/* */
|
1650
|
+
/* */
|
1651
|
+
/* */
|
1652
|
+
/* */
|
1653
|
+
/* */
|
1654
|
+
if (Helpers.isBrowser) {
|
1655
|
+
console.info(details);
|
1656
|
+
return;
|
1657
|
+
}
|
1658
|
+
/* */
|
1659
|
+
/* */
|
1660
|
+
/* */
|
1661
|
+
/* */
|
1662
|
+
/* */
|
1663
|
+
/* */
|
1664
|
+
/* */
|
1665
|
+
/* */
|
1666
|
+
/* */
|
1667
|
+
/* */
|
1252
1668
|
/* */
|
1253
1669
|
/* */
|
1254
1670
|
/* */
|
@@ -1274,59 +1690,16 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
1274
1690
|
/* */
|
1275
1691
|
/* */
|
1276
1692
|
}
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
return details.join('\n');
|
1693
|
+
success(details) {
|
1694
|
+
if (Helpers.isBrowser) {
|
1695
|
+
console.info(details);
|
1696
|
+
return;
|
1282
1697
|
}
|
1283
|
-
try {
|
1284
|
-
const json = JSON.stringify(details);
|
1285
|
-
details = json;
|
1286
|
-
}
|
1287
|
-
catch (error) {
|
1288
|
-
return details;
|
1289
|
-
}
|
1290
|
-
}
|
1291
|
-
return details;
|
1292
|
-
}
|
1293
|
-
;
|
1294
|
-
({}); // @--end-of-file-for-module=tnp-core lib/helpers-messages.ts
|
1295
|
-
|
1296
|
-
const encoding = 'utf8';
|
1297
|
-
/* */
|
1298
|
-
/* */
|
1299
|
-
/* */
|
1300
|
-
const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
|
1301
|
-
const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
|
1302
|
-
class HelpersCore extends HelpersMessages {
|
1303
|
-
static get InstanceCore() {
|
1304
|
-
if (!HelpersCore._instanceCore) {
|
1305
|
-
HelpersCore._instanceCore = new HelpersCore();
|
1306
|
-
}
|
1307
|
-
return HelpersCore._instanceCore;
|
1308
|
-
}
|
1309
|
-
/* */
|
1310
|
-
/* */
|
1311
|
-
/* */
|
1312
|
-
/* */
|
1313
|
-
/* */
|
1314
|
-
/* */
|
1315
|
-
/* */
|
1316
|
-
/* */
|
1317
|
-
/* */
|
1318
|
-
/* */
|
1319
|
-
/* */
|
1320
|
-
constructor() {
|
1321
|
-
super();
|
1322
1698
|
/* */
|
1323
1699
|
/* */
|
1324
|
-
this.bigMaxBuffer = 2024 * 500;
|
1325
1700
|
/* */
|
1326
1701
|
/* */
|
1327
1702
|
/* */
|
1328
|
-
}
|
1329
|
-
get isWsl() {
|
1330
1703
|
/* */
|
1331
1704
|
/* */
|
1332
1705
|
/* */
|
@@ -1344,9 +1717,6 @@ class HelpersCore extends HelpersMessages {
|
|
1344
1717
|
/* */
|
1345
1718
|
/* */
|
1346
1719
|
/* */
|
1347
|
-
return (void 0);
|
1348
|
-
}
|
1349
|
-
isRunningInDocker() {
|
1350
1720
|
/* */
|
1351
1721
|
/* */
|
1352
1722
|
/* */
|
@@ -1354,47 +1724,38 @@ class HelpersCore extends HelpersMessages {
|
|
1354
1724
|
/* */
|
1355
1725
|
/* */
|
1356
1726
|
/* */
|
1357
|
-
return (void 0);
|
1358
|
-
}
|
1359
|
-
clearConsole() {
|
1360
|
-
Helpers.msgCacheClear();
|
1361
|
-
console.log('\x1Bc');
|
1362
|
-
}
|
1363
|
-
/**
|
1364
|
-
* get electron browser ipc renderer
|
1365
|
-
*/
|
1366
|
-
get ipcRenderer() {
|
1367
1727
|
/* */
|
1368
1728
|
/* */
|
1369
|
-
if (!this.isElectron) {
|
1370
|
-
return;
|
1371
|
-
}
|
1372
|
-
return window.require('electron')
|
1373
|
-
.ipcRenderer;
|
1374
|
-
}
|
1375
|
-
/**
|
1376
|
-
* get electron web frame
|
1377
|
-
*/
|
1378
|
-
get webFrame() {
|
1379
1729
|
/* */
|
1380
1730
|
/* */
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1731
|
+
/* */
|
1732
|
+
/* */
|
1733
|
+
/* */
|
1734
|
+
/* */
|
1385
1735
|
}
|
1386
1736
|
/**
|
1387
|
-
*
|
1737
|
+
*
|
1738
|
+
* @param details
|
1739
|
+
* @param isLogTask is less important log task
|
1740
|
+
* @returns
|
1388
1741
|
*/
|
1389
|
-
|
1742
|
+
taskStarted(details, isLogTask = false) {
|
1743
|
+
if (Helpers.isBrowser) {
|
1744
|
+
console.info(details);
|
1745
|
+
return;
|
1746
|
+
}
|
1747
|
+
/* */
|
1748
|
+
/* */
|
1749
|
+
/* */
|
1750
|
+
/* */
|
1751
|
+
/* */
|
1752
|
+
/* */
|
1753
|
+
/* */
|
1390
1754
|
/* */
|
1391
1755
|
/* */
|
1392
1756
|
/* */
|
1393
1757
|
/* */
|
1394
1758
|
/* */
|
1395
|
-
return (void 0);
|
1396
|
-
}
|
1397
|
-
getElectronWindow({ allowRunningInsecureContent = true, } = {}) {
|
1398
1759
|
/* */
|
1399
1760
|
/* */
|
1400
1761
|
/* */
|
@@ -1410,19 +1771,8 @@ class HelpersCore extends HelpersMessages {
|
|
1410
1771
|
/* */
|
1411
1772
|
/* */
|
1412
1773
|
/* */
|
1413
|
-
return (void 0);
|
1414
|
-
}
|
1415
|
-
mediaTypeFromSrc(src) {
|
1416
|
-
const ext = path.extname(src);
|
1417
|
-
const media = CoreModels.mimeTypes[ext];
|
1418
|
-
return _.first(media?.split('/'));
|
1419
|
-
}
|
1420
|
-
sleep(seconds = 1) {
|
1421
1774
|
/* */
|
1422
1775
|
/* */
|
1423
|
-
return (void 0);
|
1424
|
-
}
|
1425
|
-
removeIfExists(absoluteFileOrFolderPath) {
|
1426
1776
|
/* */
|
1427
1777
|
/* */
|
1428
1778
|
/* */
|
@@ -1441,12 +1791,12 @@ class HelpersCore extends HelpersMessages {
|
|
1441
1791
|
/* */
|
1442
1792
|
/* */
|
1443
1793
|
/* */
|
1444
|
-
return (void 0);
|
1445
|
-
}
|
1446
|
-
relative(cwd, to) {
|
1447
|
-
return crossPlatformPath(path.relative(cwd, to));
|
1448
1794
|
}
|
1449
|
-
|
1795
|
+
taskDone(details, isLessImportant = false) {
|
1796
|
+
if (Helpers.isBrowser) {
|
1797
|
+
console.info(details);
|
1798
|
+
return;
|
1799
|
+
}
|
1450
1800
|
/* */
|
1451
1801
|
/* */
|
1452
1802
|
/* */
|
@@ -1460,9 +1810,6 @@ class HelpersCore extends HelpersMessages {
|
|
1460
1810
|
/* */
|
1461
1811
|
/* */
|
1462
1812
|
/* */
|
1463
|
-
return (void 0);
|
1464
|
-
}
|
1465
|
-
removeFolderIfExists(absoluteFolderPath) {
|
1466
1813
|
/* */
|
1467
1814
|
/* */
|
1468
1815
|
/* */
|
@@ -1477,36 +1824,6 @@ class HelpersCore extends HelpersMessages {
|
|
1477
1824
|
/* */
|
1478
1825
|
/* */
|
1479
1826
|
/* */
|
1480
|
-
return (void 0);
|
1481
|
-
}
|
1482
|
-
/**
|
1483
|
-
* leave max 1 empty line
|
1484
|
-
*/
|
1485
|
-
removeEmptyLineFromString(str) {
|
1486
|
-
const lines = (str || '').split('\n');
|
1487
|
-
let previousWasEmpty = false;
|
1488
|
-
return lines
|
1489
|
-
.filter(line => {
|
1490
|
-
if (line.trim() === '') {
|
1491
|
-
if (previousWasEmpty) {
|
1492
|
-
return false;
|
1493
|
-
}
|
1494
|
-
else {
|
1495
|
-
previousWasEmpty = true;
|
1496
|
-
return true;
|
1497
|
-
}
|
1498
|
-
}
|
1499
|
-
else {
|
1500
|
-
previousWasEmpty = false;
|
1501
|
-
return true;
|
1502
|
-
}
|
1503
|
-
})
|
1504
|
-
.join('\n');
|
1505
|
-
}
|
1506
|
-
/**
|
1507
|
-
* @deprecated
|
1508
|
-
*/
|
1509
|
-
tryRemoveDir(dirpath, contentOnly = false, omitWarningNotExisted = false) {
|
1510
1827
|
/* */
|
1511
1828
|
/* */
|
1512
1829
|
/* */
|
@@ -1532,6 +1849,33 @@ class HelpersCore extends HelpersMessages {
|
|
1532
1849
|
/* */
|
1533
1850
|
/* */
|
1534
1851
|
/* */
|
1852
|
+
}
|
1853
|
+
log(details, debugLevel = 0) {
|
1854
|
+
if (Helpers.isBrowser) {
|
1855
|
+
console.log(details);
|
1856
|
+
return;
|
1857
|
+
}
|
1858
|
+
/* */
|
1859
|
+
/* */
|
1860
|
+
/* */
|
1861
|
+
/* */
|
1862
|
+
/* */
|
1863
|
+
/* */
|
1864
|
+
/* */
|
1865
|
+
/* */
|
1866
|
+
/* */
|
1867
|
+
/* */
|
1868
|
+
/* */
|
1869
|
+
/* */
|
1870
|
+
/* */
|
1871
|
+
/* */
|
1872
|
+
/* */
|
1873
|
+
/* */
|
1874
|
+
/* */
|
1875
|
+
/* */
|
1876
|
+
/* */
|
1877
|
+
/* */
|
1878
|
+
/* */
|
1535
1879
|
/* */
|
1536
1880
|
/* */
|
1537
1881
|
/* */
|
@@ -1543,9 +1887,6 @@ class HelpersCore extends HelpersMessages {
|
|
1543
1887
|
/* */
|
1544
1888
|
/* */
|
1545
1889
|
/* */
|
1546
|
-
return (void 0);
|
1547
|
-
}
|
1548
|
-
remove(fileOrFolderPathOrPatter, exactFolder = false) {
|
1549
1890
|
/* */
|
1550
1891
|
/* */
|
1551
1892
|
/* */
|
@@ -1556,19 +1897,6 @@ class HelpersCore extends HelpersMessages {
|
|
1556
1897
|
/* */
|
1557
1898
|
/* */
|
1558
1899
|
/* */
|
1559
|
-
return (void 0);
|
1560
|
-
}
|
1561
|
-
/* */
|
1562
|
-
/* */
|
1563
|
-
/* */
|
1564
|
-
/* */
|
1565
|
-
/* */
|
1566
|
-
/* */
|
1567
|
-
/* */
|
1568
|
-
/* */
|
1569
|
-
/* */
|
1570
|
-
/* */
|
1571
|
-
get isRunningInGitBash() {
|
1572
1900
|
/* */
|
1573
1901
|
/* */
|
1574
1902
|
/* */
|
@@ -1577,73 +1905,140 @@ class HelpersCore extends HelpersMessages {
|
|
1577
1905
|
/* */
|
1578
1906
|
/* */
|
1579
1907
|
/* */
|
1580
|
-
return (void 0);
|
1581
1908
|
}
|
1582
1909
|
/**
|
1583
|
-
*
|
1910
|
+
* Logs not visible in normal use of taon-cli
|
1584
1911
|
*/
|
1585
|
-
|
1912
|
+
logSuccess(details) {
|
1913
|
+
/* */
|
1914
|
+
/* */
|
1915
|
+
/* */
|
1586
1916
|
/* */
|
1587
1917
|
/* */
|
1588
1918
|
return (void 0);
|
1589
1919
|
}
|
1590
1920
|
/**
|
1591
|
-
*
|
1921
|
+
* Logs not visible in normal use of taon-cli
|
1592
1922
|
*/
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
return isClass;
|
1923
|
+
logInfo(details, repeatable = false) {
|
1924
|
+
/* */
|
1925
|
+
/* */
|
1926
|
+
/* */
|
1927
|
+
/* */
|
1928
|
+
/* */
|
1929
|
+
return (void 0);
|
1601
1930
|
}
|
1602
1931
|
/**
|
1603
|
-
*
|
1604
|
-
*
|
1605
|
-
* @param maybeBlob
|
1606
|
-
* @returns
|
1932
|
+
* Logs not visible in normal use of taon-cli
|
1607
1933
|
*/
|
1608
|
-
|
1609
|
-
|
1934
|
+
logError(details, noExit = false, noTrace = false) {
|
1935
|
+
/* */
|
1936
|
+
/* */
|
1937
|
+
/* */
|
1938
|
+
/* */
|
1939
|
+
/* */
|
1940
|
+
return (void 0);
|
1610
1941
|
}
|
1611
1942
|
/**
|
1612
|
-
*
|
1613
|
-
*
|
1614
|
-
* @param maybeNodejsBuffer
|
1615
|
-
* @returns
|
1943
|
+
* Logs not visible in normal use of taon-cli
|
1616
1944
|
*/
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
return
|
1624
|
-
}
|
1625
|
-
removeSlashAtBegin(s) {
|
1626
|
-
s = s?.startsWith(`/`) ? s.slice(1) : s;
|
1627
|
-
return s;
|
1945
|
+
logWarn(details, trace = false) {
|
1946
|
+
/* */
|
1947
|
+
/* */
|
1948
|
+
/* */
|
1949
|
+
/* */
|
1950
|
+
/* */
|
1951
|
+
return (void 0);
|
1628
1952
|
}
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1953
|
+
warn(details, trace = false) {
|
1954
|
+
if (Helpers.isBrowser) {
|
1955
|
+
console.warn(details);
|
1956
|
+
return;
|
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
|
+
/* */
|
2009
|
+
/* */
|
1634
2010
|
}
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
2011
|
+
}
|
2012
|
+
function transformData(details) {
|
2013
|
+
if (typeof details === 'object') {
|
2014
|
+
if (Array.isArray(details)) {
|
2015
|
+
return details.join('\n');
|
1638
2016
|
}
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
2017
|
+
try {
|
2018
|
+
const json = JSON.stringify(details);
|
2019
|
+
details = json;
|
2020
|
+
}
|
2021
|
+
catch (error) {
|
2022
|
+
return details;
|
1645
2023
|
}
|
1646
|
-
|
2024
|
+
}
|
2025
|
+
return details;
|
2026
|
+
}
|
2027
|
+
;
|
2028
|
+
({}); // @--end-of-file-for-module=tnp-core lib/helpers-messages.ts
|
2029
|
+
|
2030
|
+
const encoding = 'utf8';
|
2031
|
+
/* */
|
2032
|
+
/* */
|
2033
|
+
/* */
|
2034
|
+
const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
|
2035
|
+
const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
|
2036
|
+
class HelpersCore extends HelpersMessages {
|
2037
|
+
static get InstanceCore() {
|
2038
|
+
if (!HelpersCore._instanceCore) {
|
2039
|
+
HelpersCore._instanceCore = new HelpersCore();
|
2040
|
+
}
|
2041
|
+
return HelpersCore._instanceCore;
|
1647
2042
|
}
|
1648
2043
|
/* */
|
1649
2044
|
/* */
|
@@ -1656,264 +2051,72 @@ class HelpersCore extends HelpersMessages {
|
|
1656
2051
|
/* */
|
1657
2052
|
/* */
|
1658
2053
|
/* */
|
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
|
-
/**
|
1895
|
-
* symlink may have existed or unexisted destiantion url
|
1896
|
-
* @param destUrl M
|
1897
|
-
*/
|
1898
|
-
isSymlinkThatMatchesUrl(possibleSymlink, destUrl, absoluteFileMatch = false) {
|
1899
|
-
/* */
|
1900
|
-
/* */
|
1901
|
-
/* */
|
1902
|
-
/* */
|
2054
|
+
constructor() {
|
2055
|
+
super();
|
1903
2056
|
/* */
|
1904
2057
|
/* */
|
2058
|
+
this.bigMaxBuffer = 2024 * 500;
|
1905
2059
|
/* */
|
1906
2060
|
/* */
|
1907
2061
|
/* */
|
2062
|
+
}
|
2063
|
+
/**
|
2064
|
+
* @deprecated use UtilsOs.isRunningInsideWsl()
|
2065
|
+
*/
|
2066
|
+
get isWsl() {
|
2067
|
+
return UtilsOs.isRunningInWsl();
|
2068
|
+
}
|
2069
|
+
/**
|
2070
|
+
* @deprecated use UtilsOs.isRunningInDocker
|
2071
|
+
*/
|
2072
|
+
isRunningInDocker() {
|
2073
|
+
return UtilsOs.isRunningInDocker();
|
2074
|
+
}
|
2075
|
+
/**
|
2076
|
+
* @deprecated use UtilsOs.isRunningInLinuxGraphicEnvironment
|
2077
|
+
*/
|
2078
|
+
isRunningInLinuxGraphicsCapableEnvironment() {
|
2079
|
+
return UtilsOs.isRunningInLinuxGraphicsCapableEnvironment();
|
2080
|
+
}
|
2081
|
+
clearConsole() {
|
2082
|
+
Helpers.msgCacheClear();
|
2083
|
+
console.log('\x1Bc');
|
2084
|
+
}
|
2085
|
+
/**
|
2086
|
+
* get electron browser ipc renderer
|
2087
|
+
*/
|
2088
|
+
get ipcRenderer() {
|
1908
2089
|
/* */
|
1909
2090
|
/* */
|
2091
|
+
if (!this.isElectron) {
|
2092
|
+
return;
|
2093
|
+
}
|
2094
|
+
return window.require('electron')
|
2095
|
+
.ipcRenderer;
|
2096
|
+
}
|
2097
|
+
/**
|
2098
|
+
* get electron web frame
|
2099
|
+
*/
|
2100
|
+
get webFrame() {
|
1910
2101
|
/* */
|
1911
2102
|
/* */
|
2103
|
+
if (!this.isElectron) {
|
2104
|
+
return;
|
2105
|
+
}
|
2106
|
+
return window.require('electron').webFrame;
|
2107
|
+
}
|
2108
|
+
/**
|
2109
|
+
* get electron backend ipc main proces
|
2110
|
+
*/
|
2111
|
+
get ipcMain() {
|
1912
2112
|
/* */
|
1913
2113
|
/* */
|
1914
2114
|
/* */
|
1915
2115
|
/* */
|
1916
2116
|
/* */
|
2117
|
+
return (void 0);
|
2118
|
+
}
|
2119
|
+
getElectronWindow({ allowRunningInsecureContent = true, } = {}) {
|
1917
2120
|
/* */
|
1918
2121
|
/* */
|
1919
2122
|
/* */
|
@@ -1931,25 +2134,17 @@ class HelpersCore extends HelpersMessages {
|
|
1931
2134
|
/* */
|
1932
2135
|
return (void 0);
|
1933
2136
|
}
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
/* */
|
1941
|
-
/* */
|
1942
|
-
/* */
|
2137
|
+
mediaTypeFromSrc(src) {
|
2138
|
+
const ext = path.extname(src);
|
2139
|
+
const media = CoreModels.mimeTypes[ext];
|
2140
|
+
return _.first(media?.split('/'));
|
2141
|
+
}
|
2142
|
+
sleep(seconds = 1) {
|
1943
2143
|
/* */
|
1944
2144
|
/* */
|
1945
2145
|
return (void 0);
|
1946
2146
|
}
|
1947
|
-
|
1948
|
-
* If symbolnk link that target file does not exits
|
1949
|
-
*/
|
1950
|
-
isUnexistedLink(filePath) {
|
1951
|
-
/* */
|
1952
|
-
/* */
|
2147
|
+
removeIfExists(absoluteFileOrFolderPath) {
|
1953
2148
|
/* */
|
1954
2149
|
/* */
|
1955
2150
|
/* */
|
@@ -1971,18 +2166,12 @@ class HelpersCore extends HelpersMessages {
|
|
1971
2166
|
return (void 0);
|
1972
2167
|
}
|
1973
2168
|
/**
|
1974
|
-
*
|
2169
|
+
* path.relative that return cross platform path
|
1975
2170
|
*/
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
/* */
|
1981
|
-
/* */
|
1982
|
-
/* */
|
1983
|
-
/* */
|
1984
|
-
/* */
|
1985
|
-
/* */
|
2171
|
+
relative(cwd, to) {
|
2172
|
+
return crossPlatformPath(path.relative(cwd, to));
|
2173
|
+
}
|
2174
|
+
removeFileIfExists(absoluteFilePath) {
|
1986
2175
|
/* */
|
1987
2176
|
/* */
|
1988
2177
|
/* */
|
@@ -1998,35 +2187,7 @@ class HelpersCore extends HelpersMessages {
|
|
1998
2187
|
/* */
|
1999
2188
|
return (void 0);
|
2000
2189
|
}
|
2001
|
-
|
2002
|
-
/* */
|
2003
|
-
/* */
|
2004
|
-
/* */
|
2005
|
-
/* */
|
2006
|
-
/* */
|
2007
|
-
/* */
|
2008
|
-
/* */
|
2009
|
-
/* */
|
2010
|
-
/* */
|
2011
|
-
/* */
|
2012
|
-
/* */
|
2013
|
-
/* */
|
2014
|
-
/* */
|
2015
|
-
/* */
|
2016
|
-
/* */
|
2017
|
-
/* */
|
2018
|
-
/* */
|
2019
|
-
exists(folderOrFilePath) {
|
2020
|
-
/* */
|
2021
|
-
/* */
|
2022
|
-
/* */
|
2023
|
-
/* */
|
2024
|
-
/* */
|
2025
|
-
/* */
|
2026
|
-
/* */
|
2027
|
-
/* */
|
2028
|
-
/* */
|
2029
|
-
/* */
|
2190
|
+
removeFolderIfExists(absoluteFolderPath) {
|
2030
2191
|
/* */
|
2031
2192
|
/* */
|
2032
2193
|
/* */
|
@@ -2044,30 +2205,33 @@ class HelpersCore extends HelpersMessages {
|
|
2044
2205
|
return (void 0);
|
2045
2206
|
}
|
2046
2207
|
/**
|
2047
|
-
*
|
2208
|
+
* leave max 1 empty line
|
2048
2209
|
*/
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2210
|
+
removeEmptyLineFromString(str) {
|
2211
|
+
const lines = (str || '').split('\n');
|
2212
|
+
let previousWasEmpty = false;
|
2213
|
+
return lines
|
2214
|
+
.filter(line => {
|
2215
|
+
if (line.trim() === '') {
|
2216
|
+
if (previousWasEmpty) {
|
2217
|
+
return false;
|
2218
|
+
}
|
2219
|
+
else {
|
2220
|
+
previousWasEmpty = true;
|
2221
|
+
return true;
|
2222
|
+
}
|
2223
|
+
}
|
2224
|
+
else {
|
2225
|
+
previousWasEmpty = false;
|
2226
|
+
return true;
|
2227
|
+
}
|
2228
|
+
})
|
2229
|
+
.join('\n');
|
2060
2230
|
}
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
/* */
|
2066
|
-
/* */
|
2067
|
-
/* */
|
2068
|
-
/* */
|
2069
|
-
/* */
|
2070
|
-
/* */
|
2231
|
+
/**
|
2232
|
+
* @deprecated
|
2233
|
+
*/
|
2234
|
+
tryRemoveDir(dirpath, contentOnly = false, omitWarningNotExisted = false) {
|
2071
2235
|
/* */
|
2072
2236
|
/* */
|
2073
2237
|
/* */
|
@@ -2104,6 +2268,9 @@ class HelpersCore extends HelpersMessages {
|
|
2104
2268
|
/* */
|
2105
2269
|
/* */
|
2106
2270
|
/* */
|
2271
|
+
return (void 0);
|
2272
|
+
}
|
2273
|
+
remove(fileOrFolderPathOrPatter, exactFolder = false) {
|
2107
2274
|
/* */
|
2108
2275
|
/* */
|
2109
2276
|
/* */
|
@@ -2114,14 +2281,7 @@ class HelpersCore extends HelpersMessages {
|
|
2114
2281
|
/* */
|
2115
2282
|
/* */
|
2116
2283
|
/* */
|
2117
|
-
|
2118
|
-
}
|
2119
|
-
wait(second) {
|
2120
|
-
return new Promise((resolve, reject) => {
|
2121
|
-
setTimeout(() => {
|
2122
|
-
resolve(void 0);
|
2123
|
-
}, second * 1000);
|
2124
|
-
});
|
2284
|
+
return (void 0);
|
2125
2285
|
}
|
2126
2286
|
/* */
|
2127
2287
|
/* */
|
@@ -2133,793 +2293,83 @@ class HelpersCore extends HelpersMessages {
|
|
2133
2293
|
/* */
|
2134
2294
|
/* */
|
2135
2295
|
/* */
|
2296
|
+
get isRunningInGitBash() {
|
2297
|
+
/* */
|
2298
|
+
/* */
|
2299
|
+
/* */
|
2300
|
+
/* */
|
2301
|
+
/* */
|
2302
|
+
/* */
|
2303
|
+
/* */
|
2304
|
+
/* */
|
2305
|
+
return (void 0);
|
2306
|
+
}
|
2307
|
+
/**
|
2308
|
+
* Check if the current shell is supported by Taon framework.
|
2309
|
+
*/
|
2310
|
+
get isSupportedTaonTerminal() {
|
2311
|
+
/* */
|
2312
|
+
/* */
|
2313
|
+
return (void 0);
|
2314
|
+
}
|
2315
|
+
/**
|
2316
|
+
* check if function is class
|
2317
|
+
*/
|
2318
|
+
isClass(funcOrClass) {
|
2319
|
+
let isClass = false;
|
2320
|
+
if (typeof funcOrClass === 'function') {
|
2321
|
+
isClass =
|
2322
|
+
!!funcOrClass.prototype &&
|
2323
|
+
Object.getOwnPropertyNames(funcOrClass.prototype).filter(f => f !== 'constructor').length > 0;
|
2324
|
+
}
|
2325
|
+
return isClass;
|
2326
|
+
}
|
2327
|
+
/**
|
2328
|
+
* check if data is nodejs/browser blob
|
2329
|
+
*
|
2330
|
+
* @param maybeBlob
|
2331
|
+
* @returns
|
2332
|
+
*/
|
2333
|
+
isBlob(maybeBlob) {
|
2334
|
+
return maybeBlob instanceof Blob; // || toString.call(maybeBlob) === '[object Blob]';
|
2335
|
+
}
|
2336
|
+
/**
|
2337
|
+
* Check if data is nodejs buffer
|
2338
|
+
*
|
2339
|
+
* @param maybeNodejsBuffer
|
2340
|
+
* @returns
|
2341
|
+
*/
|
2136
2342
|
/* */
|
2137
2343
|
/* */
|
2138
2344
|
/* */
|
2139
2345
|
/* */
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
/* */
|
2168
|
-
/* */
|
2169
|
-
/* */
|
2170
|
-
/* */
|
2171
|
-
/* */
|
2172
|
-
/* */
|
2173
|
-
/* */
|
2174
|
-
/* */
|
2175
|
-
/* */
|
2176
|
-
/* */
|
2177
|
-
/* */
|
2178
|
-
/* */
|
2179
|
-
/* */
|
2180
|
-
/* */
|
2181
|
-
/* */
|
2182
|
-
/* */
|
2183
|
-
/* */
|
2184
|
-
/* */
|
2185
|
-
/* */
|
2186
|
-
/* */
|
2187
|
-
/* */
|
2188
|
-
/* */
|
2189
|
-
/* */
|
2190
|
-
/* */
|
2191
|
-
/* */
|
2192
|
-
/* */
|
2193
|
-
/* */
|
2194
|
-
/* */
|
2195
|
-
/* */
|
2196
|
-
/* */
|
2197
|
-
/* */
|
2198
|
-
/* */
|
2199
|
-
/* */
|
2200
|
-
/* */
|
2201
|
-
/* */
|
2202
|
-
/* */
|
2203
|
-
/* */
|
2204
|
-
async killProcessByPort(portOrPortsToKill, options) {
|
2205
|
-
/* */
|
2206
|
-
/* */
|
2207
|
-
/* */
|
2208
|
-
/* */
|
2209
|
-
/* */
|
2210
|
-
/* */
|
2211
|
-
/* */
|
2212
|
-
/* */
|
2213
|
-
/* */
|
2214
|
-
/* */
|
2215
|
-
/* */
|
2216
|
-
/* */
|
2217
|
-
/* */
|
2218
|
-
/* */
|
2219
|
-
/* */
|
2220
|
-
/* */
|
2221
|
-
/* */
|
2222
|
-
/* */
|
2223
|
-
/* */
|
2224
|
-
/* */
|
2225
|
-
/* */
|
2226
|
-
/* */
|
2227
|
-
/* */
|
2228
|
-
/* */
|
2229
|
-
/* */
|
2230
|
-
/* */
|
2231
|
-
/* */
|
2232
|
-
/* */
|
2233
|
-
/* */
|
2234
|
-
/* */
|
2235
|
-
/* */
|
2236
|
-
/* */
|
2237
|
-
/* */
|
2238
|
-
/* */
|
2239
|
-
/* */
|
2240
|
-
/* */
|
2241
|
-
/* */
|
2242
|
-
/* */
|
2243
|
-
/* */
|
2244
|
-
/* */
|
2245
|
-
/* */
|
2246
|
-
/* */
|
2247
|
-
/* */
|
2248
|
-
/* */
|
2249
|
-
return (void 0);
|
2250
|
-
}
|
2251
|
-
async killOnPort(portOrPortsToKill, options) {
|
2252
|
-
return await Helpers.killProcessByPort(portOrPortsToKill, options);
|
2253
|
-
}
|
2254
|
-
killProcess(byPid) {
|
2255
|
-
/* */
|
2256
|
-
/* */
|
2257
|
-
/* */
|
2258
|
-
/* */
|
2259
|
-
/* */
|
2260
|
-
/* */
|
2261
|
-
/* */
|
2262
|
-
/* */
|
2263
|
-
/* */
|
2264
|
-
/* */
|
2265
|
-
/* */
|
2266
|
-
/* */
|
2267
|
-
/* */
|
2268
|
-
/* */
|
2269
|
-
/* */
|
2270
|
-
/* */
|
2271
|
-
/* */
|
2272
|
-
/* */
|
2273
|
-
/* */
|
2274
|
-
/* */
|
2275
|
-
/* */
|
2276
|
-
/* */
|
2277
|
-
/* */
|
2278
|
-
/* */
|
2279
|
-
/* */
|
2280
|
-
/* */
|
2281
|
-
/* */
|
2282
|
-
}
|
2283
|
-
run(command, options) {
|
2284
|
-
command = Helpers._fixCommand(command);
|
2285
|
-
/* */
|
2286
|
-
/* */
|
2287
|
-
/* */
|
2288
|
-
/* */
|
2289
|
-
/* */
|
2290
|
-
/* */
|
2291
|
-
/* */
|
2292
|
-
/* */
|
2293
|
-
return {
|
2294
|
-
/**
|
2295
|
-
* start command as synchronous nodej proces
|
2296
|
-
*/
|
2297
|
-
sync() {
|
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
|
-
/* */
|
2325
|
-
/* */
|
2326
|
-
/* */
|
2327
|
-
/* */
|
2328
|
-
/* */
|
2329
|
-
return (void 0);
|
2330
|
-
},
|
2331
|
-
/**
|
2332
|
-
* start command as asynchronous nodej proces
|
2333
|
-
* @param detach (default: false) - if true process will be detached
|
2334
|
-
*/
|
2335
|
-
async(detach = false, mockFun) {
|
2336
|
-
if (mockFun) {
|
2337
|
-
const subStdoutSub = new Subject();
|
2338
|
-
const subStderSub = new Subject();
|
2339
|
-
const exitSub = new Subject();
|
2340
|
-
const subscribtions = [];
|
2341
|
-
const procDummy = {
|
2342
|
-
stdout: {
|
2343
|
-
on(action, stdoutCallback) {
|
2344
|
-
if (action == 'data') {
|
2345
|
-
subscribtions.push(subStdoutSub.subscribe(d => {
|
2346
|
-
stdoutCallback(d);
|
2347
|
-
}));
|
2348
|
-
}
|
2349
|
-
},
|
2350
|
-
},
|
2351
|
-
stderr: {
|
2352
|
-
on(action, stdoutCallback) {
|
2353
|
-
if (action == 'data') {
|
2354
|
-
subscribtions.push(subStderSub.subscribe(d => {
|
2355
|
-
stdoutCallback(d);
|
2356
|
-
}));
|
2357
|
-
}
|
2358
|
-
},
|
2359
|
-
},
|
2360
|
-
on(action, exitFun) {
|
2361
|
-
if (action == 'exit') {
|
2362
|
-
subscribtions.push(exitSub.subscribe(d => {
|
2363
|
-
exitFun(d);
|
2364
|
-
}));
|
2365
|
-
}
|
2366
|
-
}, // @ts-ignore
|
2367
|
-
ppid: void 0, // @ts-ignore
|
2368
|
-
pid: void 0,
|
2369
|
-
};
|
2370
|
-
procDummy.pid = Math.round(Math.random() * (1000 - 100)) + 100;
|
2371
|
-
procDummy.ppid = procDummy.pid + 9999;
|
2372
|
-
WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid] = procDummy;
|
2373
|
-
if (!WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]) {
|
2374
|
-
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid] = {
|
2375
|
-
childProcesses: [],
|
2376
|
-
};
|
2377
|
-
}
|
2378
|
-
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid].childProcesses.push(procDummy.pid);
|
2379
|
-
const checkIfProcessShouldBeDead = () => {
|
2380
|
-
return (_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid]) ||
|
2381
|
-
_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]));
|
2382
|
-
};
|
2383
|
-
const f = Helpers.runSyncOrAsync({
|
2384
|
-
functionFn: mockFun,
|
2385
|
-
arrayOfParams: [
|
2386
|
-
d => {
|
2387
|
-
setTimeout(() => {
|
2388
|
-
subStdoutSub.next(d);
|
2389
|
-
});
|
2390
|
-
},
|
2391
|
-
d => {
|
2392
|
-
setTimeout(() => {
|
2393
|
-
subStderSub.next(d);
|
2394
|
-
});
|
2395
|
-
},
|
2396
|
-
() => {
|
2397
|
-
const shouldBeDead = checkIfProcessShouldBeDead();
|
2398
|
-
return shouldBeDead;
|
2399
|
-
},
|
2400
|
-
],
|
2401
|
-
});
|
2402
|
-
f.then(exitCode => {
|
2403
|
-
if (_.isNil(exitCode)) {
|
2404
|
-
exitCode = 0;
|
2405
|
-
}
|
2406
|
-
setTimeout(() => {
|
2407
|
-
exitSub.next(exitCode);
|
2408
|
-
subscribtions.forEach(s => s.unsubscribe());
|
2409
|
-
});
|
2410
|
-
}).catch(e => {
|
2411
|
-
console.error(e);
|
2412
|
-
console.error(`Something wrong with your mock funciton`);
|
2413
|
-
exitSub.next(1);
|
2414
|
-
subscribtions.forEach(s => s.unsubscribe());
|
2415
|
-
});
|
2416
|
-
return procDummy;
|
2417
|
-
}
|
2418
|
-
/* */
|
2419
|
-
/* */
|
2420
|
-
/* */
|
2421
|
-
/* */
|
2422
|
-
return (void 0);
|
2423
|
-
},
|
2424
|
-
/**
|
2425
|
-
* start command as asynchronous nodej proces inside promise
|
2426
|
-
*/
|
2427
|
-
asyncAsPromise() {
|
2428
|
-
/* */
|
2429
|
-
/* */
|
2430
|
-
/* */
|
2431
|
-
/* */
|
2432
|
-
/* */
|
2433
|
-
/* */
|
2434
|
-
/* */
|
2435
|
-
/* */
|
2436
|
-
/* */
|
2437
|
-
/* */
|
2438
|
-
/* */
|
2439
|
-
/* */
|
2440
|
-
/* */
|
2441
|
-
/* */
|
2442
|
-
/* */
|
2443
|
-
/* */
|
2444
|
-
/* */
|
2445
|
-
return (void 0);
|
2446
|
-
},
|
2447
|
-
unitlOutput(optionsOutput) {
|
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
|
-
/* */
|
2539
|
-
/* */
|
2540
|
-
/* */
|
2541
|
-
/* */
|
2542
|
-
/* */
|
2543
|
-
return (void 0);
|
2544
|
-
},
|
2545
|
-
/**
|
2546
|
-
* @deprecated use unitlOutput
|
2547
|
-
* start command as asynchronous nodej proces inside promise
|
2548
|
-
* and wait until output contains some string
|
2549
|
-
*/
|
2550
|
-
unitlOutputContains(stdoutMsg, stderMsg, timeout = 0, stdoutOutputContainsCallback) {
|
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
|
-
/* */
|
2627
|
-
/* */
|
2628
|
-
/* */
|
2629
|
-
/* */
|
2630
|
-
/* */
|
2631
|
-
return (void 0);
|
2632
|
-
},
|
2633
|
-
};
|
2634
|
-
}
|
2635
|
-
async questionYesNo(message, callbackTrue, callbackFalse, defaultValue = true,
|
2636
|
-
/**
|
2637
|
-
* in non interactive mode
|
2638
|
-
*/
|
2639
|
-
mustAnswerQuestion = false) {
|
2640
|
-
/* */
|
2641
|
-
/* */
|
2642
|
-
/* */
|
2643
|
-
/* */
|
2644
|
-
/* */
|
2645
|
-
/* */
|
2646
|
-
/* */
|
2647
|
-
/* */
|
2648
|
-
/* */
|
2649
|
-
/* */
|
2650
|
-
/* */
|
2651
|
-
/* */
|
2652
|
-
/* */
|
2653
|
-
/* */
|
2654
|
-
/* */
|
2655
|
-
/* */
|
2656
|
-
/* */
|
2657
|
-
/* */
|
2658
|
-
/* */
|
2659
|
-
/* */
|
2660
|
-
/* */
|
2661
|
-
/* */
|
2662
|
-
/* */
|
2663
|
-
/* */
|
2664
|
-
/* */
|
2665
|
-
/* */
|
2666
|
-
return (void 0);
|
2667
|
-
}
|
2668
|
-
/* */
|
2669
|
-
/* */
|
2670
|
-
/* */
|
2671
|
-
/* */
|
2672
|
-
/* */
|
2673
|
-
/* */
|
2674
|
-
/* */
|
2675
|
-
/* */
|
2676
|
-
/* */
|
2677
|
-
/* */
|
2678
|
-
/* */
|
2679
|
-
/* */
|
2680
|
-
/* */
|
2681
|
-
/* */
|
2682
|
-
/* */
|
2683
|
-
/* */
|
2684
|
-
/* */
|
2685
|
-
/* */
|
2686
|
-
/* */
|
2687
|
-
/* */
|
2688
|
-
/* */
|
2689
|
-
/* */
|
2690
|
-
/* */
|
2691
|
-
/* */
|
2692
|
-
/* */
|
2693
|
-
/* */
|
2694
|
-
/* */
|
2695
|
-
/* */
|
2696
|
-
/* */
|
2697
|
-
/* */
|
2698
|
-
/* */
|
2699
|
-
/* */
|
2700
|
-
/* */
|
2701
|
-
/* */
|
2702
|
-
/* */
|
2703
|
-
/* */
|
2704
|
-
/* */
|
2705
|
-
/* */
|
2706
|
-
/* */
|
2707
|
-
/* */
|
2708
|
-
/* */
|
2709
|
-
/* */
|
2710
|
-
/* */
|
2711
|
-
/* */
|
2712
|
-
/* */
|
2713
|
-
/* */
|
2714
|
-
/* */
|
2715
|
-
/* */
|
2716
|
-
/* */
|
2717
|
-
/* */
|
2718
|
-
/* */
|
2719
|
-
/* */
|
2720
|
-
/* */
|
2721
|
-
/* */
|
2722
|
-
/* */
|
2723
|
-
/* */
|
2724
|
-
/* */
|
2725
|
-
/* */
|
2726
|
-
/* */
|
2727
|
-
/* */
|
2728
|
-
/* */
|
2729
|
-
/* */
|
2730
|
-
/* */
|
2731
|
-
/* */
|
2732
|
-
/* */
|
2733
|
-
/* */
|
2734
|
-
/* */
|
2735
|
-
/* */
|
2736
|
-
/* */
|
2737
|
-
/* */
|
2738
|
-
/* */
|
2739
|
-
/* */
|
2740
|
-
/* */
|
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
|
-
/* */
|
2346
|
+
removeSlashAtEnd(s) {
|
2347
|
+
s = s?.endsWith(`/`) ? s.slice(0, s.length - 1) : s;
|
2348
|
+
return s;
|
2349
|
+
}
|
2350
|
+
removeSlashAtBegin(s) {
|
2351
|
+
s = s?.startsWith(`/`) ? s.slice(1) : s;
|
2352
|
+
return s;
|
2353
|
+
}
|
2354
|
+
/**
|
2355
|
+
* stringify to pretty json string
|
2356
|
+
*/
|
2357
|
+
stringify(inputObject) {
|
2358
|
+
return JSON.stringify(inputObject, null, 2);
|
2359
|
+
}
|
2360
|
+
async runSyncOrAsync(fnOrOptions) {
|
2361
|
+
if (_.isUndefined(fnOrOptions)) {
|
2362
|
+
return void 0;
|
2363
|
+
}
|
2364
|
+
let promisOrValue;
|
2365
|
+
const { functionFn, context, arrayOfParams } = fnOrOptions;
|
2366
|
+
promisOrValue = functionFn.apply(context, arrayOfParams);
|
2367
|
+
// // @ts-ignore
|
2368
|
+
if (promisOrValue instanceof Promise) {
|
2369
|
+
promisOrValue = Promise.resolve(promisOrValue);
|
2370
|
+
}
|
2371
|
+
return promisOrValue;
|
2372
|
+
}
|
2923
2373
|
/* */
|
2924
2374
|
/* */
|
2925
2375
|
/* */
|
@@ -3166,6 +2616,113 @@ class HelpersCore extends HelpersMessages {
|
|
3166
2616
|
/* */
|
3167
2617
|
/* */
|
3168
2618
|
/* */
|
2619
|
+
/**
|
2620
|
+
* symlink may have existed or unexisted destiantion url
|
2621
|
+
* @param destUrl M
|
2622
|
+
*/
|
2623
|
+
isSymlinkThatMatchesUrl(possibleSymlink, destUrl, absoluteFileMatch = false) {
|
2624
|
+
/* */
|
2625
|
+
/* */
|
2626
|
+
/* */
|
2627
|
+
/* */
|
2628
|
+
/* */
|
2629
|
+
/* */
|
2630
|
+
/* */
|
2631
|
+
/* */
|
2632
|
+
/* */
|
2633
|
+
/* */
|
2634
|
+
/* */
|
2635
|
+
/* */
|
2636
|
+
/* */
|
2637
|
+
/* */
|
2638
|
+
/* */
|
2639
|
+
/* */
|
2640
|
+
/* */
|
2641
|
+
/* */
|
2642
|
+
/* */
|
2643
|
+
/* */
|
2644
|
+
/* */
|
2645
|
+
/* */
|
2646
|
+
/* */
|
2647
|
+
/* */
|
2648
|
+
/* */
|
2649
|
+
/* */
|
2650
|
+
/* */
|
2651
|
+
/* */
|
2652
|
+
/* */
|
2653
|
+
/* */
|
2654
|
+
/* */
|
2655
|
+
/* */
|
2656
|
+
/* */
|
2657
|
+
return (void 0);
|
2658
|
+
}
|
2659
|
+
isSymlinkFileExitedOrUnexisted(filePath) {
|
2660
|
+
/* */
|
2661
|
+
/* */
|
2662
|
+
/* */
|
2663
|
+
/* */
|
2664
|
+
/* */
|
2665
|
+
/* */
|
2666
|
+
/* */
|
2667
|
+
/* */
|
2668
|
+
/* */
|
2669
|
+
/* */
|
2670
|
+
return (void 0);
|
2671
|
+
}
|
2672
|
+
/**
|
2673
|
+
* If symbolnk link that target file does not exits
|
2674
|
+
*/
|
2675
|
+
isUnexistedLink(filePath) {
|
2676
|
+
/* */
|
2677
|
+
/* */
|
2678
|
+
/* */
|
2679
|
+
/* */
|
2680
|
+
/* */
|
2681
|
+
/* */
|
2682
|
+
/* */
|
2683
|
+
/* */
|
2684
|
+
/* */
|
2685
|
+
/* */
|
2686
|
+
/* */
|
2687
|
+
/* */
|
2688
|
+
/* */
|
2689
|
+
/* */
|
2690
|
+
/* */
|
2691
|
+
/* */
|
2692
|
+
/* */
|
2693
|
+
/* */
|
2694
|
+
/* */
|
2695
|
+
/* */
|
2696
|
+
return (void 0);
|
2697
|
+
}
|
2698
|
+
/**
|
2699
|
+
* @param existedLink check if source of link exists
|
2700
|
+
*/
|
2701
|
+
isExistedSymlink(filePath) {
|
2702
|
+
/* */
|
2703
|
+
/* */
|
2704
|
+
/* */
|
2705
|
+
/* */
|
2706
|
+
/* */
|
2707
|
+
/* */
|
2708
|
+
/* */
|
2709
|
+
/* */
|
2710
|
+
/* */
|
2711
|
+
/* */
|
2712
|
+
/* */
|
2713
|
+
/* */
|
2714
|
+
/* */
|
2715
|
+
/* */
|
2716
|
+
/* */
|
2717
|
+
/* */
|
2718
|
+
/* */
|
2719
|
+
/* */
|
2720
|
+
/* */
|
2721
|
+
/* */
|
2722
|
+
/* */
|
2723
|
+
/* */
|
2724
|
+
return (void 0);
|
2725
|
+
}
|
3169
2726
|
/* */
|
3170
2727
|
/* */
|
3171
2728
|
/* */
|
@@ -3184,22 +2741,115 @@ class HelpersCore extends HelpersMessages {
|
|
3184
2741
|
/* */
|
3185
2742
|
/* */
|
3186
2743
|
/* */
|
2744
|
+
exists(folderOrFilePath) {
|
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
|
+
return (void 0);
|
2770
|
+
}
|
3187
2771
|
/**
|
3188
|
-
*
|
3189
|
-
* @deprecated
|
2772
|
+
* this is HACK for running procesess inside processes
|
3190
2773
|
*/
|
3191
|
-
|
3192
|
-
if (
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
// @ts-ignore
|
3197
|
-
values.push(obj[key]);
|
3198
|
-
}
|
3199
|
-
}
|
3200
|
-
return values;
|
2774
|
+
_fixCommand(command) {
|
2775
|
+
if ((command.startsWith('tnp ') || command.startsWith('taon ')) && // TODO every cli projects here that uses run and need to kill process easly!
|
2776
|
+
command.search('-spinner=false') === -1 &&
|
2777
|
+
command.search('-spinner=off') === -1) {
|
2778
|
+
command = `${command} -spinner=false`;
|
3201
2779
|
}
|
3202
|
-
|
2780
|
+
if (global.skipCoreCheck &&
|
2781
|
+
(command.startsWith('tnp ') || command.startsWith('taon '))) {
|
2782
|
+
command = `${command} --skipCoreCheck`;
|
2783
|
+
}
|
2784
|
+
return command;
|
2785
|
+
}
|
2786
|
+
command(command) {
|
2787
|
+
command = Helpers._fixCommand(command);
|
2788
|
+
return {
|
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
|
+
wait(second) {
|
2845
|
+
return new Promise((resolve, reject) => {
|
2846
|
+
setTimeout(() => {
|
2847
|
+
resolve(void 0);
|
2848
|
+
}, second * 1000);
|
2849
|
+
});
|
2850
|
+
}
|
2851
|
+
async timeout(seconds) {
|
2852
|
+
return await Helpers.wait(seconds);
|
3203
2853
|
}
|
3204
2854
|
/* */
|
3205
2855
|
/* */
|
@@ -3279,97 +2929,469 @@ class HelpersCore extends HelpersMessages {
|
|
3279
2929
|
/* */
|
3280
2930
|
/* */
|
3281
2931
|
/* */
|
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
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
2932
|
+
async killProcessByPort(portOrPortsToKill, options) {
|
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
|
+
return (void 0);
|
2978
|
+
}
|
2979
|
+
async killOnPort(portOrPortsToKill, options) {
|
2980
|
+
return await Helpers.killProcessByPort(portOrPortsToKill, options);
|
2981
|
+
}
|
2982
|
+
killProcess(byPid) {
|
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
|
+
run(command, options) {
|
3012
|
+
command = Helpers._fixCommand(command);
|
3013
|
+
/* */
|
3014
|
+
/* */
|
3015
|
+
/* */
|
3016
|
+
/* */
|
3017
|
+
/* */
|
3018
|
+
/* */
|
3019
|
+
/* */
|
3020
|
+
/* */
|
3021
|
+
return {
|
3022
|
+
/**
|
3023
|
+
* start command as synchronous nodej proces
|
3024
|
+
*/
|
3025
|
+
sync() {
|
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
|
+
return (void 0);
|
3058
|
+
},
|
3059
|
+
/**
|
3060
|
+
* start command as asynchronous nodej proces
|
3061
|
+
* @param detach (default: false) - if true process will be detached
|
3062
|
+
*/
|
3063
|
+
async(detach = false, mockFun) {
|
3064
|
+
if (mockFun) {
|
3065
|
+
const subStdoutSub = new Subject();
|
3066
|
+
const subStderSub = new Subject();
|
3067
|
+
const exitSub = new Subject();
|
3068
|
+
const subscribtions = [];
|
3069
|
+
const procDummy = {
|
3070
|
+
stdout: {
|
3071
|
+
on(action, stdoutCallback) {
|
3072
|
+
if (action == 'data') {
|
3073
|
+
subscribtions.push(subStdoutSub.subscribe(d => {
|
3074
|
+
stdoutCallback(d);
|
3075
|
+
}));
|
3076
|
+
}
|
3077
|
+
},
|
3078
|
+
},
|
3079
|
+
stderr: {
|
3080
|
+
on(action, stdoutCallback) {
|
3081
|
+
if (action == 'data') {
|
3082
|
+
subscribtions.push(subStderSub.subscribe(d => {
|
3083
|
+
stdoutCallback(d);
|
3084
|
+
}));
|
3085
|
+
}
|
3086
|
+
},
|
3087
|
+
},
|
3088
|
+
on(action, exitFun) {
|
3089
|
+
if (action == 'exit') {
|
3090
|
+
subscribtions.push(exitSub.subscribe(d => {
|
3091
|
+
exitFun(d);
|
3092
|
+
}));
|
3093
|
+
}
|
3094
|
+
}, // @ts-ignore
|
3095
|
+
ppid: void 0, // @ts-ignore
|
3096
|
+
pid: void 0,
|
3097
|
+
};
|
3098
|
+
procDummy.pid = Math.round(Math.random() * (1000 - 100)) + 100;
|
3099
|
+
procDummy.ppid = procDummy.pid + 9999;
|
3100
|
+
WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid] = procDummy;
|
3101
|
+
if (!WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]) {
|
3102
|
+
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid] = {
|
3103
|
+
childProcesses: [],
|
3104
|
+
};
|
3105
|
+
}
|
3106
|
+
WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid].childProcesses.push(procDummy.pid);
|
3107
|
+
const checkIfProcessShouldBeDead = () => {
|
3108
|
+
return (_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PID[procDummy.pid]) ||
|
3109
|
+
_.isNil(WEBSQL_PROC_MOCK_PROCESSES_PPID[procDummy.ppid]));
|
3110
|
+
};
|
3111
|
+
const f = Helpers.runSyncOrAsync({
|
3112
|
+
functionFn: mockFun,
|
3113
|
+
arrayOfParams: [
|
3114
|
+
d => {
|
3115
|
+
setTimeout(() => {
|
3116
|
+
subStdoutSub.next(d);
|
3117
|
+
});
|
3118
|
+
},
|
3119
|
+
d => {
|
3120
|
+
setTimeout(() => {
|
3121
|
+
subStderSub.next(d);
|
3122
|
+
});
|
3123
|
+
},
|
3124
|
+
() => {
|
3125
|
+
const shouldBeDead = checkIfProcessShouldBeDead();
|
3126
|
+
return shouldBeDead;
|
3127
|
+
},
|
3128
|
+
],
|
3129
|
+
});
|
3130
|
+
f.then(exitCode => {
|
3131
|
+
if (_.isNil(exitCode)) {
|
3132
|
+
exitCode = 0;
|
3133
|
+
}
|
3134
|
+
setTimeout(() => {
|
3135
|
+
exitSub.next(exitCode);
|
3136
|
+
subscribtions.forEach(s => s.unsubscribe());
|
3137
|
+
});
|
3138
|
+
}).catch(e => {
|
3139
|
+
console.error(e);
|
3140
|
+
console.error(`Something wrong with your mock funciton`);
|
3141
|
+
exitSub.next(1);
|
3142
|
+
subscribtions.forEach(s => s.unsubscribe());
|
3143
|
+
});
|
3144
|
+
return procDummy;
|
3145
|
+
}
|
3146
|
+
/* */
|
3147
|
+
/* */
|
3148
|
+
/* */
|
3149
|
+
/* */
|
3150
|
+
return (void 0);
|
3151
|
+
},
|
3152
|
+
/**
|
3153
|
+
* start command as asynchronous nodej proces inside promise
|
3154
|
+
*/
|
3155
|
+
asyncAsPromise() {
|
3156
|
+
/* */
|
3157
|
+
/* */
|
3158
|
+
/* */
|
3159
|
+
/* */
|
3160
|
+
/* */
|
3161
|
+
/* */
|
3162
|
+
/* */
|
3163
|
+
/* */
|
3164
|
+
/* */
|
3165
|
+
/* */
|
3166
|
+
/* */
|
3167
|
+
/* */
|
3168
|
+
/* */
|
3169
|
+
/* */
|
3170
|
+
/* */
|
3171
|
+
/* */
|
3172
|
+
/* */
|
3173
|
+
return (void 0);
|
3174
|
+
},
|
3175
|
+
unitlOutput(optionsOutput) {
|
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
|
+
/* */
|
3267
|
+
/* */
|
3268
|
+
/* */
|
3269
|
+
/* */
|
3270
|
+
/* */
|
3271
|
+
return (void 0);
|
3272
|
+
},
|
3273
|
+
/**
|
3274
|
+
* @deprecated use unitlOutput
|
3275
|
+
* start command as asynchronous nodej proces inside promise
|
3276
|
+
* and wait until output contains some string
|
3277
|
+
*/
|
3278
|
+
unitlOutputContains(stdoutMsg, stderMsg, timeout = 0, stdoutOutputContainsCallback) {
|
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
|
+
return (void 0);
|
3360
|
+
},
|
3361
|
+
};
|
3362
|
+
}
|
3363
|
+
async questionYesNo(message, callbackTrue, callbackFalse, defaultValue = true,
|
3364
|
+
/**
|
3365
|
+
* in non interactive mode
|
3366
|
+
*/
|
3367
|
+
mustAnswerQuestion = false) {
|
3368
|
+
/* */
|
3369
|
+
/* */
|
3370
|
+
/* */
|
3371
|
+
/* */
|
3372
|
+
/* */
|
3373
|
+
/* */
|
3374
|
+
/* */
|
3375
|
+
/* */
|
3376
|
+
/* */
|
3377
|
+
/* */
|
3378
|
+
/* */
|
3379
|
+
/* */
|
3380
|
+
/* */
|
3381
|
+
/* */
|
3382
|
+
/* */
|
3383
|
+
/* */
|
3384
|
+
/* */
|
3367
3385
|
/* */
|
3368
3386
|
/* */
|
3369
3387
|
/* */
|
3370
3388
|
/* */
|
3371
3389
|
/* */
|
3372
3390
|
/* */
|
3391
|
+
/* */
|
3392
|
+
/* */
|
3393
|
+
/* */
|
3394
|
+
return (void 0);
|
3373
3395
|
}
|
3374
3396
|
/* */
|
3375
3397
|
/* */
|
@@ -3686,381 +3708,755 @@ class HelpersCore extends HelpersMessages {
|
|
3686
3708
|
/* */
|
3687
3709
|
/* */
|
3688
3710
|
/* */
|
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
|
-
|
3902
|
-
|
3903
|
-
|
3904
|
-
/* */
|
3905
|
-
/* */
|
3906
|
-
})(DbBinaryFormatEnum = Utils.DbBinaryFormatEnum || (Utils.DbBinaryFormatEnum = {}));
|
3907
|
-
/* */
|
3908
|
-
/* */
|
3909
|
-
let binary;
|
3910
|
-
(function (binary) {
|
3911
|
-
/**
|
3912
|
-
* This is for BROWSER ONLY
|
3913
|
-
*
|
3914
|
-
* @param buffer
|
3915
|
-
* @param contentType
|
3916
|
-
* @returns
|
3917
|
-
*/
|
3918
|
-
async function arrayBufferToBlob(buffer, contentType) {
|
3919
|
-
// @ts-ignore
|
3920
|
-
return new Blob([buffer], { type: contentType });
|
3921
|
-
}
|
3922
|
-
binary.arrayBufferToBlob = arrayBufferToBlob;
|
3923
|
-
/**
|
3924
|
-
* This is for BROWSER ONLY
|
3925
|
-
* @param blob
|
3926
|
-
* @returns
|
3927
|
-
*/
|
3928
|
-
async function blobToArrayBuffer(blob) {
|
3929
|
-
return await new Promise((resolve, reject) => {
|
3930
|
-
const reader = new FileReader();
|
3931
|
-
reader.addEventListener('loadend', () => {
|
3932
|
-
resolve(reader.result);
|
3933
|
-
});
|
3934
|
-
reader.addEventListener('error', reject); // @ts-ignore
|
3935
|
-
reader.readAsArrayBuffer(blob);
|
3936
|
-
});
|
3937
|
-
}
|
3938
|
-
binary.blobToArrayBuffer = blobToArrayBuffer;
|
3939
|
-
/**
|
3940
|
-
* it is revers to base64toBlob
|
3941
|
-
* @param blob
|
3942
|
-
* @returns
|
3943
|
-
*/
|
3944
|
-
function blobToBase64(blob) {
|
3945
|
-
return new Promise((resolve, _) => {
|
3946
|
-
const reader = new FileReader();
|
3947
|
-
reader.onloadend = () => resolve(reader.result); // @ts-ignore
|
3948
|
-
reader.readAsDataURL(blob);
|
3949
|
-
});
|
3950
|
-
}
|
3951
|
-
binary.blobToBase64 = blobToBase64;
|
3952
|
-
/**
|
3953
|
-
* it is revers to blobToBase64()
|
3954
|
-
* @param base64Data
|
3955
|
-
* @returns
|
3956
|
-
*/
|
3957
|
-
async function base64toBlob(base64Data, contentTypeOverride) {
|
3958
|
-
let content_type = void 0;
|
3959
|
-
let file_base64 = void 0;
|
3960
|
-
if (!contentTypeOverride) {
|
3961
|
-
const m = /^data:(.+?);base64,(.+)$/.exec(base64Data);
|
3962
|
-
if (!m) {
|
3963
|
-
throw new Error(`[taon-framework][base64toBlob] Not a base64 blob [${base64Data}]`);
|
3964
|
-
}
|
3965
|
-
var [__, contenttype, filebase64] = m;
|
3966
|
-
content_type = contenttype;
|
3967
|
-
file_base64 = filebase64;
|
3968
|
-
}
|
3969
|
-
content_type = (contentTypeOverride ? contentTypeOverride : content_type || '');
|
3970
|
-
base64Data = contentTypeOverride ? base64Data : file_base64;
|
3971
|
-
const sliceSize = 1024;
|
3972
|
-
const byteCharacters = atob(base64Data);
|
3973
|
-
const bytesLength = byteCharacters.length;
|
3974
|
-
const slicesCount = Math.ceil(bytesLength / sliceSize);
|
3975
|
-
const byteArrays = new Array(slicesCount);
|
3976
|
-
for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
|
3977
|
-
const begin = sliceIndex * sliceSize;
|
3978
|
-
const end = Math.min(begin + sliceSize, bytesLength);
|
3979
|
-
const bytes = new Array(end - begin);
|
3980
|
-
for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
|
3981
|
-
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
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
|
+
/* */
|
3912
|
+
/* */
|
3913
|
+
/* */
|
3914
|
+
/* */
|
3915
|
+
/**
|
3916
|
+
* Quick fix for object values
|
3917
|
+
* @deprecated
|
3918
|
+
*/
|
3919
|
+
values(obj) {
|
3920
|
+
if (_.isObject(obj) && !Array.isArray(obj)) {
|
3921
|
+
const values = [];
|
3922
|
+
for (const key in obj) {
|
3923
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
3924
|
+
// @ts-ignore
|
3925
|
+
values.push(obj[key]);
|
3982
3926
|
}
|
3983
|
-
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
3984
3927
|
}
|
3985
|
-
return
|
3986
|
-
}
|
3987
|
-
binary.base64toBlob = base64toBlob;
|
3988
|
-
async function base64toDbBinaryFormat(text) {
|
3989
|
-
let result;
|
3990
|
-
result = await (async () => {
|
3991
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
3992
|
-
const blob = await base64toBlob(text);
|
3993
|
-
return blob;
|
3994
|
-
}
|
3995
|
-
return text;
|
3996
|
-
})();
|
3997
|
-
/* */
|
3998
|
-
/* */
|
3999
|
-
/* */
|
4000
|
-
/* */
|
4001
|
-
/* */
|
4002
|
-
return result;
|
4003
|
-
}
|
4004
|
-
binary.base64toDbBinaryFormat = base64toDbBinaryFormat;
|
4005
|
-
async function dbBinaryFormatToBase64(binaryFormat) {
|
4006
|
-
let result;
|
4007
|
-
result = await (async () => {
|
4008
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
4009
|
-
const text = await blobToBase64(binaryFormat);
|
4010
|
-
return text;
|
4011
|
-
}
|
4012
|
-
return binaryFormat;
|
4013
|
-
})();
|
4014
|
-
/* */
|
4015
|
-
/* */
|
4016
|
-
/* */
|
4017
|
-
/* */
|
4018
|
-
/* */
|
4019
|
-
return result;
|
4020
|
-
}
|
4021
|
-
binary.dbBinaryFormatToBase64 = dbBinaryFormatToBase64;
|
4022
|
-
async function textToDbBinaryFormat(text) {
|
4023
|
-
let result;
|
4024
|
-
result = await (async () => {
|
4025
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
4026
|
-
const blob = await textToBlob(text);
|
4027
|
-
return blob;
|
4028
|
-
}
|
4029
|
-
return text;
|
4030
|
-
})();
|
4031
|
-
/* */
|
4032
|
-
/* */
|
4033
|
-
/* */
|
4034
|
-
/* */
|
4035
|
-
/* */
|
4036
|
-
return result;
|
4037
|
-
}
|
4038
|
-
binary.textToDbBinaryFormat = textToDbBinaryFormat;
|
4039
|
-
async function dbBinaryFormatToText(binaryFormat) {
|
4040
|
-
let result;
|
4041
|
-
result = await (async () => {
|
4042
|
-
if (BLOB_SUPPORTED_IN_SQLJS) {
|
4043
|
-
const text = await blobToText(binaryFormat);
|
4044
|
-
return text;
|
4045
|
-
}
|
4046
|
-
return binaryFormat;
|
4047
|
-
})();
|
4048
|
-
/* */
|
4049
|
-
/* */
|
4050
|
-
/* */
|
4051
|
-
/* */
|
4052
|
-
/* */
|
4053
|
-
return result;
|
3928
|
+
return values;
|
4054
3929
|
}
|
4055
|
-
|
3930
|
+
return [];
|
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
|
+
/* */
|
4090
|
+
/* */
|
4091
|
+
/* */
|
4092
|
+
/* */
|
4093
|
+
/* */
|
4094
|
+
replaceLinesInFile(absoluteFilePath, lineReplaceFn) {
|
4095
|
+
/* */
|
4056
4096
|
/* */
|
4057
4097
|
/* */
|
4058
4098
|
/* */
|
4059
4099
|
/* */
|
4060
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
|
+
/* */
|
4434
|
+
/* */
|
4435
|
+
/* */
|
4436
|
+
/* */
|
4437
|
+
/* */
|
4438
|
+
hideNodeWarnings() {
|
4061
4439
|
/* */
|
4062
4440
|
/* */
|
4063
4441
|
/* */
|
4442
|
+
}
|
4443
|
+
}
|
4444
|
+
;
|
4445
|
+
({}); // @--end-of-file-for-module=tnp-core lib/helpers.ts
|
4446
|
+
|
4447
|
+
const CoreConfig = {
|
4448
|
+
message: {
|
4449
|
+
globalSystemToolMode: 'globalSystemToolMode',
|
4450
|
+
},
|
4451
|
+
};
|
4452
|
+
;
|
4453
|
+
({}); // @--end-of-file-for-module=tnp-core lib/core-config.ts
|
4454
|
+
|
4455
|
+
class PROGRESS_DATA {
|
4456
|
+
constructor() {
|
4457
|
+
this.type = 'event';
|
4458
|
+
}
|
4459
|
+
static log(log) {
|
4064
4460
|
/* */
|
4065
4461
|
/* */
|
4066
4462
|
/* */
|
@@ -4068,122 +4464,46 @@ var Utils;
|
|
4068
4464
|
/* */
|
4069
4465
|
/* */
|
4070
4466
|
/* */
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4467
|
+
}
|
4468
|
+
static resolveFrom(chunk, callbackOnFounded, checkSplit = true) {
|
4469
|
+
let progress;
|
4470
|
+
let res = [];
|
4471
|
+
if (!_.isString(chunk)) {
|
4472
|
+
return [];
|
4075
4473
|
}
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4474
|
+
chunk = chunk.trim();
|
4475
|
+
if (checkSplit) {
|
4476
|
+
const split = chunk.split(/\r\n|\n|\r/);
|
4477
|
+
if (split.length > 1) {
|
4478
|
+
split.forEach(s => {
|
4479
|
+
res = res.concat(this.resolveFrom(s, callbackOnFounded, false));
|
4480
|
+
});
|
4481
|
+
return res;
|
4080
4482
|
}
|
4081
|
-
// @ts-ignore
|
4082
|
-
return new File([blob], nameForFile);
|
4083
|
-
}
|
4084
|
-
binary.blobToFile = blobToFile;
|
4085
|
-
/* */
|
4086
|
-
/* */
|
4087
|
-
/* */
|
4088
|
-
/* */
|
4089
|
-
/* */
|
4090
|
-
/* */
|
4091
|
-
/* */
|
4092
|
-
/* */
|
4093
|
-
/* */
|
4094
|
-
/* */
|
4095
|
-
/* */
|
4096
|
-
/* */
|
4097
|
-
/* */
|
4098
|
-
/* */
|
4099
|
-
/* */
|
4100
|
-
/* */
|
4101
|
-
/* */
|
4102
|
-
/* */
|
4103
|
-
/* */
|
4104
|
-
/* */
|
4105
|
-
/* */
|
4106
|
-
/* */
|
4107
|
-
/* */
|
4108
|
-
/* */
|
4109
|
-
/* */
|
4110
|
-
/* */
|
4111
|
-
async function textToBlob(text, type = 'text/plain') {
|
4112
|
-
const blob = new Blob([text], { type });
|
4113
|
-
return blob;
|
4114
|
-
}
|
4115
|
-
binary.textToBlob = textToBlob;
|
4116
|
-
async function blobToText(blob) {
|
4117
|
-
return await blob.text();
|
4118
|
-
}
|
4119
|
-
binary.blobToText = blobToText;
|
4120
|
-
async function textToFile(text, fileRelativePathOrName) {
|
4121
|
-
const ext = path.extname(fileRelativePathOrName);
|
4122
|
-
const type = CoreModels.mimeTypes[ext];
|
4123
|
-
const blob = new Blob([text], { type });
|
4124
|
-
const file = await blobToFile(blob, fileRelativePathOrName);
|
4125
|
-
return file;
|
4126
|
-
}
|
4127
|
-
binary.textToFile = textToFile;
|
4128
|
-
async function fileToText(file) {
|
4129
|
-
return await file.text();
|
4130
|
-
}
|
4131
|
-
binary.fileToText = fileToText;
|
4132
|
-
async function jsonToBlob(jsonObj) {
|
4133
|
-
const blob = new Blob([JSON.stringify(jsonObj, null, 2)], {
|
4134
|
-
type: 'application/json',
|
4135
|
-
});
|
4136
|
-
return blob;
|
4137
4483
|
}
|
4138
|
-
|
4139
|
-
|
4140
|
-
|
4141
|
-
*/
|
4142
|
-
async function blobToJson(blob) {
|
4143
|
-
return JSON.parse(await blob.text());
|
4144
|
-
}
|
4145
|
-
binary.blobToJson = blobToJson;
|
4146
|
-
async function getBlobFrom(url) {
|
4147
|
-
const response = await axios({
|
4148
|
-
url,
|
4149
|
-
method: 'get',
|
4150
|
-
responseType: 'blob',
|
4151
|
-
});
|
4152
|
-
return response.data;
|
4484
|
+
if (/\[\[\[.*\]\]\]/g.test(chunk)) {
|
4485
|
+
chunk = chunk.replace(/^\[\[\[/g, '').replace(/\]\]\]$/g, '');
|
4486
|
+
progress = chunk;
|
4153
4487
|
}
|
4154
|
-
|
4155
|
-
|
4156
|
-
|
4157
|
-
|
4158
|
-
|
4159
|
-
|
4160
|
-
|
4161
|
-
|
4162
|
-
|
4163
|
-
|
4164
|
-
|
4488
|
+
if (!_.isUndefined(progress)) {
|
4489
|
+
try {
|
4490
|
+
const p = JSON.parse(progress);
|
4491
|
+
const single = _.merge(new PROGRESS_DATA(), p);
|
4492
|
+
res = res.concat([single]);
|
4493
|
+
if (_.isFunction(callbackOnFounded)) {
|
4494
|
+
callbackOnFounded(single);
|
4495
|
+
}
|
4496
|
+
}
|
4497
|
+
catch (err) {
|
4498
|
+
Helpers.error(err, true, true);
|
4499
|
+
Helpers.error(`ProgresssBarData: fail to parse "${progress}"`, true, true);
|
4500
|
+
}
|
4165
4501
|
}
|
4166
|
-
|
4167
|
-
}
|
4168
|
-
|
4169
|
-
(function (process) {
|
4170
|
-
async function startAsync(command, options) { }
|
4171
|
-
process.startAsync = startAsync;
|
4172
|
-
function startSync(command, options) { }
|
4173
|
-
process.startSync = startSync;
|
4174
|
-
})(process = Utils.process || (Utils.process = {}));
|
4175
|
-
})(Utils || (Utils = {}));
|
4176
|
-
var UtilsString;
|
4177
|
-
(function (UtilsString) {
|
4178
|
-
UtilsString.kebabCaseNoSplitNumbers = (input) => {
|
4179
|
-
return (input
|
4180
|
-
.replace(/\s+/g, '-')
|
4181
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
4182
|
-
.toLowerCase());
|
4183
|
-
};
|
4184
|
-
})(UtilsString || (UtilsString = {}));
|
4502
|
+
return res;
|
4503
|
+
}
|
4504
|
+
}
|
4185
4505
|
;
|
4186
|
-
({}); // @--end-of-file-for-module=tnp-core lib/
|
4506
|
+
({}); // @--end-of-file-for-module=tnp-core lib/progress-data.ts
|
4187
4507
|
|
4188
4508
|
/* */
|
4189
4509
|
/* */
|
@@ -4205,6 +4525,10 @@ class CLI {
|
|
4205
4525
|
;
|
4206
4526
|
({}); // @--end-of-file-for-module=tnp-core lib/core-cli.ts
|
4207
4527
|
|
4528
|
+
/**
|
4529
|
+
* TODO slowly refactor this.. only actually globally needed are:
|
4530
|
+
* pm2, yarn, npm-run, ts-node ???
|
4531
|
+
*/
|
4208
4532
|
const requiredForDev = {
|
4209
4533
|
npm: [
|
4210
4534
|
/* */
|
@@ -4239,6 +4563,9 @@ const requiredForDev = {
|
|
4239
4563
|
/* */
|
4240
4564
|
/* */
|
4241
4565
|
/* */
|
4566
|
+
/* */
|
4567
|
+
/* */
|
4568
|
+
/* */
|
4242
4569
|
],
|
4243
4570
|
niceTools: [
|
4244
4571
|
/* */
|
@@ -4275,7 +4602,7 @@ const requiredForDev = {
|
|
4275
4602
|
],
|
4276
4603
|
};
|
4277
4604
|
;
|
4278
|
-
({}); // @--end-of-file-for-module=tnp-core lib/required.ts
|
4605
|
+
({}); // @--end-of-file-for-module=tnp-core lib/required-global-npm-packages.ts
|
4279
4606
|
|
4280
4607
|
let Helpers = HelpersCore.InstanceCore;
|
4281
4608
|
;
|
@@ -4285,5 +4612,5 @@ let Helpers = HelpersCore.InstanceCore;
|
|
4285
4612
|
* Generated bundle index. Do not edit.
|
4286
4613
|
*/
|
4287
4614
|
|
4288
|
-
export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsString, chalk, crossPlatformPath, frameworkName, frameworkNameBe, path, requiredForDev, win32Path };
|
4615
|
+
export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsOs, UtilsProcess, UtilsString, chalk, crossPlatformPath, frameworkName, frameworkNameBe, path, requiredForDev, win32Path };
|
4289
4616
|
//# sourceMappingURL=tnp-core.mjs.map
|