tnp-core 18.0.43 → 18.0.45
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.mjs +23 -28
- package/browser/esm2022/lib/utils.mjs +498 -1
- package/browser/fesm2022/tnp-core.mjs +638 -134
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/lib/helpers.d.ts +5 -3
- package/browser/lib/utils.d.ts +117 -0
- package/cli.backend.js +2 -2
- package/client/esm2022/lib/helpers.mjs +23 -28
- package/client/esm2022/lib/utils.mjs +498 -1
- package/client/fesm2022/tnp-core.mjs +638 -134
- package/client/fesm2022/tnp-core.mjs.map +1 -1
- package/client/lib/helpers.d.ts +5 -3
- package/client/lib/utils.d.ts +117 -0
- package/lib/helpers.d.ts +15 -4
- package/lib/helpers.js +156 -172
- package/lib/helpers.js.map +1 -1
- package/lib/node-chalk-mock.js +2 -2
- package/lib/node-path-mock.js +2 -2
- package/lib/utils.d.ts +120 -0
- package/lib/utils.js +580 -1
- package/lib/utils.js.map +1 -1
- package/package.json +2 -2
- package/tmp-environment.json +30 -29
- package/websql/esm2022/lib/helpers.mjs +23 -28
- package/websql/esm2022/lib/utils.mjs +498 -1
- package/websql/fesm2022/tnp-core.mjs +726 -222
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/lib/helpers.d.ts +5 -3
- package/websql/lib/utils.d.ts +117 -0
@@ -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 axios from 'axios';
|
13
12
|
import { Subject } from 'rxjs';
|
13
|
+
import axios from 'axios';
|
14
14
|
|
15
15
|
let isBrowser = false;
|
16
16
|
isBrowser = true;
|
@@ -729,6 +729,7 @@ var CoreModels;
|
|
729
729
|
/* */
|
730
730
|
/* */
|
731
731
|
/* */
|
732
|
+
/* */
|
732
733
|
const BLOB_SUPPORTED_IN_SQLJS = false;
|
733
734
|
var Utils;
|
734
735
|
(function (Utils) {
|
@@ -1094,80 +1095,675 @@ var Utils;
|
|
1094
1095
|
/* */
|
1095
1096
|
/* */
|
1096
1097
|
/* */
|
1097
|
-
async function textToBlob(text, type = 'text/plain') {
|
1098
|
-
const blob = new Blob([text], { type });
|
1099
|
-
return blob;
|
1100
|
-
}
|
1101
|
-
binary.textToBlob = textToBlob;
|
1102
|
-
async function blobToText(blob) {
|
1103
|
-
return await blob.text();
|
1104
|
-
}
|
1105
|
-
binary.blobToText = blobToText;
|
1106
|
-
async function textToFile(text, fileRelativePathOrName) {
|
1107
|
-
const ext = path.extname(fileRelativePathOrName);
|
1108
|
-
const type = CoreModels.mimeTypes[ext];
|
1109
|
-
const blob = new Blob([text], { type });
|
1110
|
-
const file = await blobToFile(blob, fileRelativePathOrName);
|
1111
|
-
return file;
|
1112
|
-
}
|
1113
|
-
binary.textToFile = textToFile;
|
1114
|
-
async function fileToText(file) {
|
1115
|
-
return await file.text();
|
1116
|
-
}
|
1117
|
-
binary.fileToText = fileToText;
|
1118
|
-
async function jsonToBlob(jsonObj) {
|
1119
|
-
const blob = new Blob([JSON.stringify(jsonObj, null, 2)], {
|
1120
|
-
type: 'application/json',
|
1121
|
-
});
|
1122
|
-
return blob;
|
1123
|
-
}
|
1124
|
-
binary.jsonToBlob = jsonToBlob;
|
1125
|
-
/**
|
1126
|
-
* TODO NOT TESTED
|
1127
|
-
*/
|
1128
|
-
async function blobToJson(blob) {
|
1129
|
-
return JSON.parse(await blob.text());
|
1130
|
-
}
|
1131
|
-
binary.blobToJson = blobToJson;
|
1132
|
-
async function getBlobFrom(url) {
|
1133
|
-
const response = await axios({
|
1134
|
-
url,
|
1135
|
-
method: 'get',
|
1136
|
-
responseType: 'blob',
|
1137
|
-
});
|
1138
|
-
return response.data;
|
1139
|
-
}
|
1140
|
-
binary.getBlobFrom = getBlobFrom;
|
1141
|
-
})(binary = Utils.binary || (Utils.binary = {}));
|
1142
|
-
let css;
|
1143
|
-
(function (css) {
|
1144
|
-
/**
|
1145
|
-
*
|
1146
|
-
* @param pixelsCss pixels ex. 100px
|
1147
|
-
* @returns
|
1148
|
-
*/
|
1149
|
-
function numValue(pixelsCss) {
|
1150
|
-
return parseInt(pixelsCss?.toString()?.replace('px', ''));
|
1151
|
-
}
|
1152
|
-
css.numValue = numValue;
|
1153
|
-
})(css = Utils.css || (Utils.css = {}));
|
1154
|
-
})(Utils || (Utils = {}));
|
1155
|
-
var UtilsProcess;
|
1156
|
-
(function (UtilsProcess) {
|
1157
|
-
/**
|
1158
|
-
* TODO IMPLEMENT
|
1159
|
-
* start async node process
|
1160
|
-
*/
|
1161
|
-
async function startAsync(command, options) {
|
1162
|
-
}
|
1163
|
-
UtilsProcess.startAsync = startAsync;
|
1164
|
-
/**
|
1165
|
-
* TODO IMPLEMENT
|
1166
|
-
*/
|
1167
|
-
function startSync(command, options) {
|
1168
|
-
}
|
1169
|
-
UtilsProcess.startSync = startSync;
|
1170
|
-
UtilsProcess.getGitBashPath = () => {
|
1098
|
+
async function textToBlob(text, type = 'text/plain') {
|
1099
|
+
const blob = new Blob([text], { type });
|
1100
|
+
return blob;
|
1101
|
+
}
|
1102
|
+
binary.textToBlob = textToBlob;
|
1103
|
+
async function blobToText(blob) {
|
1104
|
+
return await blob.text();
|
1105
|
+
}
|
1106
|
+
binary.blobToText = blobToText;
|
1107
|
+
async function textToFile(text, fileRelativePathOrName) {
|
1108
|
+
const ext = path.extname(fileRelativePathOrName);
|
1109
|
+
const type = CoreModels.mimeTypes[ext];
|
1110
|
+
const blob = new Blob([text], { type });
|
1111
|
+
const file = await blobToFile(blob, fileRelativePathOrName);
|
1112
|
+
return file;
|
1113
|
+
}
|
1114
|
+
binary.textToFile = textToFile;
|
1115
|
+
async function fileToText(file) {
|
1116
|
+
return await file.text();
|
1117
|
+
}
|
1118
|
+
binary.fileToText = fileToText;
|
1119
|
+
async function jsonToBlob(jsonObj) {
|
1120
|
+
const blob = new Blob([JSON.stringify(jsonObj, null, 2)], {
|
1121
|
+
type: 'application/json',
|
1122
|
+
});
|
1123
|
+
return blob;
|
1124
|
+
}
|
1125
|
+
binary.jsonToBlob = jsonToBlob;
|
1126
|
+
/**
|
1127
|
+
* TODO NOT TESTED
|
1128
|
+
*/
|
1129
|
+
async function blobToJson(blob) {
|
1130
|
+
return JSON.parse(await blob.text());
|
1131
|
+
}
|
1132
|
+
binary.blobToJson = blobToJson;
|
1133
|
+
async function getBlobFrom(url) {
|
1134
|
+
const response = await axios({
|
1135
|
+
url,
|
1136
|
+
method: 'get',
|
1137
|
+
responseType: 'blob',
|
1138
|
+
});
|
1139
|
+
return response.data;
|
1140
|
+
}
|
1141
|
+
binary.getBlobFrom = getBlobFrom;
|
1142
|
+
})(binary = Utils.binary || (Utils.binary = {}));
|
1143
|
+
let css;
|
1144
|
+
(function (css) {
|
1145
|
+
/**
|
1146
|
+
*
|
1147
|
+
* @param pixelsCss pixels ex. 100px
|
1148
|
+
* @returns
|
1149
|
+
*/
|
1150
|
+
function numValue(pixelsCss) {
|
1151
|
+
return parseInt(pixelsCss?.toString()?.replace('px', ''));
|
1152
|
+
}
|
1153
|
+
css.numValue = numValue;
|
1154
|
+
})(css = Utils.css || (Utils.css = {}));
|
1155
|
+
})(Utils || (Utils = {}));
|
1156
|
+
var UtilsProcess;
|
1157
|
+
(function (UtilsProcess) {
|
1158
|
+
/**
|
1159
|
+
* TODO IMPLEMENT
|
1160
|
+
* start async node process
|
1161
|
+
*/
|
1162
|
+
async function startAsync(command, options) {
|
1163
|
+
}
|
1164
|
+
UtilsProcess.startAsync = startAsync;
|
1165
|
+
/**
|
1166
|
+
* TODO IMPLEMENT
|
1167
|
+
*/
|
1168
|
+
function startSync(command, options) {
|
1169
|
+
}
|
1170
|
+
UtilsProcess.startSync = startSync;
|
1171
|
+
UtilsProcess.getGitBashPath = () => {
|
1172
|
+
/* */
|
1173
|
+
/* */
|
1174
|
+
/* */
|
1175
|
+
/* */
|
1176
|
+
/* */
|
1177
|
+
/* */
|
1178
|
+
/* */
|
1179
|
+
/* */
|
1180
|
+
/* */
|
1181
|
+
/* */
|
1182
|
+
/* */
|
1183
|
+
/* */
|
1184
|
+
/* */
|
1185
|
+
/* */
|
1186
|
+
/* */
|
1187
|
+
/* */
|
1188
|
+
/* */
|
1189
|
+
/* */
|
1190
|
+
return (void 0);
|
1191
|
+
};
|
1192
|
+
/**
|
1193
|
+
* TODO IMPLEMENT
|
1194
|
+
* start async node process
|
1195
|
+
*/
|
1196
|
+
UtilsProcess.startInNewTerminalWindow = (command, options) => {
|
1197
|
+
/* */
|
1198
|
+
/* */
|
1199
|
+
/* */
|
1200
|
+
/* */
|
1201
|
+
/* */
|
1202
|
+
/* */
|
1203
|
+
/* */
|
1204
|
+
/* */
|
1205
|
+
/* */
|
1206
|
+
/* */
|
1207
|
+
/* */
|
1208
|
+
/* */
|
1209
|
+
/* */
|
1210
|
+
/* */
|
1211
|
+
/* */
|
1212
|
+
/* */
|
1213
|
+
/* */
|
1214
|
+
/* */
|
1215
|
+
/* */
|
1216
|
+
/* */
|
1217
|
+
/* */
|
1218
|
+
/* */
|
1219
|
+
/* */
|
1220
|
+
/* */
|
1221
|
+
/* */
|
1222
|
+
/* */
|
1223
|
+
/* */
|
1224
|
+
/* */
|
1225
|
+
/* */
|
1226
|
+
/* */
|
1227
|
+
/* */
|
1228
|
+
/* */
|
1229
|
+
/* */
|
1230
|
+
/* */
|
1231
|
+
/* */
|
1232
|
+
/* */
|
1233
|
+
/* */
|
1234
|
+
/* */
|
1235
|
+
/* */
|
1236
|
+
/* */
|
1237
|
+
/* */
|
1238
|
+
/* */
|
1239
|
+
/* */
|
1240
|
+
/* */
|
1241
|
+
/* */
|
1242
|
+
/* */
|
1243
|
+
/* */
|
1244
|
+
/* */
|
1245
|
+
/* */
|
1246
|
+
/* */
|
1247
|
+
/* */
|
1248
|
+
/* */
|
1249
|
+
/* */
|
1250
|
+
/* */
|
1251
|
+
/* */
|
1252
|
+
/* */
|
1253
|
+
/* */
|
1254
|
+
/* */
|
1255
|
+
/* */
|
1256
|
+
/* */
|
1257
|
+
/* */
|
1258
|
+
/* */
|
1259
|
+
/* */
|
1260
|
+
/* */
|
1261
|
+
/* */
|
1262
|
+
/* */
|
1263
|
+
/* */
|
1264
|
+
/* */
|
1265
|
+
/* */
|
1266
|
+
/* */
|
1267
|
+
/* */
|
1268
|
+
/* */
|
1269
|
+
/* */
|
1270
|
+
/* */
|
1271
|
+
/* */
|
1272
|
+
/* */
|
1273
|
+
/* */
|
1274
|
+
/* */
|
1275
|
+
/* */
|
1276
|
+
/* */
|
1277
|
+
/* */
|
1278
|
+
/* */
|
1279
|
+
/* */
|
1280
|
+
/* */
|
1281
|
+
/* */
|
1282
|
+
/* */
|
1283
|
+
/* */
|
1284
|
+
/* */
|
1285
|
+
/* */
|
1286
|
+
/* */
|
1287
|
+
/* */
|
1288
|
+
/* */
|
1289
|
+
/* */
|
1290
|
+
/* */
|
1291
|
+
/* */
|
1292
|
+
/* */
|
1293
|
+
/* */
|
1294
|
+
/* */
|
1295
|
+
/* */
|
1296
|
+
/* */
|
1297
|
+
/* */
|
1298
|
+
return (void 0);
|
1299
|
+
};
|
1300
|
+
UtilsProcess.getBashOrShellName = () => {
|
1301
|
+
return 'browser';
|
1302
|
+
/* */
|
1303
|
+
/* */
|
1304
|
+
/* */
|
1305
|
+
/* */
|
1306
|
+
/* */
|
1307
|
+
/* */
|
1308
|
+
/* */
|
1309
|
+
/* */
|
1310
|
+
/* */
|
1311
|
+
/* */
|
1312
|
+
/* */
|
1313
|
+
/* */
|
1314
|
+
/* */
|
1315
|
+
/* */
|
1316
|
+
/* */
|
1317
|
+
/* */
|
1318
|
+
/* */
|
1319
|
+
/* */
|
1320
|
+
/* */
|
1321
|
+
/* */
|
1322
|
+
/* */
|
1323
|
+
/* */
|
1324
|
+
/* */
|
1325
|
+
/* */
|
1326
|
+
/* */
|
1327
|
+
/* */
|
1328
|
+
/* */
|
1329
|
+
/* */
|
1330
|
+
/* */
|
1331
|
+
/* */
|
1332
|
+
/* */
|
1333
|
+
/* */
|
1334
|
+
return (void 0);
|
1335
|
+
};
|
1336
|
+
})(UtilsProcess || (UtilsProcess = {}));
|
1337
|
+
var UtilsOs;
|
1338
|
+
(function (UtilsOs) {
|
1339
|
+
/**
|
1340
|
+
* check if script is running in client browser
|
1341
|
+
* (websql model -> is also considered as browser
|
1342
|
+
* because it is running in browser)
|
1343
|
+
*/
|
1344
|
+
UtilsOs.isRunningInBrowser = () => {
|
1345
|
+
/* */
|
1346
|
+
/* */
|
1347
|
+
return true;
|
1348
|
+
};
|
1349
|
+
/**
|
1350
|
+
* check if script is running in nodejs
|
1351
|
+
* (backend script or electron script)
|
1352
|
+
*/
|
1353
|
+
UtilsOs.isRunningInNode = () => {
|
1354
|
+
/* */
|
1355
|
+
/* */
|
1356
|
+
return false;
|
1357
|
+
};
|
1358
|
+
/**
|
1359
|
+
* check if script is running special
|
1360
|
+
* browser mode that has sql.js backend
|
1361
|
+
* and executes sql queries in browser
|
1362
|
+
*/
|
1363
|
+
UtilsOs.isRunningInWebSQL = () => {
|
1364
|
+
/* */
|
1365
|
+
/* */
|
1366
|
+
return true;
|
1367
|
+
return false;
|
1368
|
+
};
|
1369
|
+
/**
|
1370
|
+
* check whether the current process is running inside
|
1371
|
+
* Electron backend or browser.
|
1372
|
+
*/
|
1373
|
+
UtilsOs.isRunningInElectron = () => {
|
1374
|
+
// @ts-ignore
|
1375
|
+
if (typeof window !== 'undefined' &&
|
1376
|
+
typeof window.process === 'object' &&
|
1377
|
+
window.process.type === 'renderer') {
|
1378
|
+
return true;
|
1379
|
+
}
|
1380
|
+
// @ts-ignore
|
1381
|
+
if (typeof process !== 'undefined' &&
|
1382
|
+
typeof process.versions === 'object' &&
|
1383
|
+
!!process.versions.electron) {
|
1384
|
+
return true;
|
1385
|
+
}
|
1386
|
+
if (typeof navigator === 'object' &&
|
1387
|
+
typeof navigator.userAgent === 'string' &&
|
1388
|
+
navigator.userAgent.indexOf('Electron') >= 0) {
|
1389
|
+
return true;
|
1390
|
+
}
|
1391
|
+
return false;
|
1392
|
+
};
|
1393
|
+
/**
|
1394
|
+
* Check wether the current process is running inside
|
1395
|
+
* windows subsystem for linux (WSL).
|
1396
|
+
*/
|
1397
|
+
UtilsOs.isRunningInWsl = () => {
|
1398
|
+
return false;
|
1399
|
+
/* */
|
1400
|
+
/* */
|
1401
|
+
/* */
|
1402
|
+
/* */
|
1403
|
+
/* */
|
1404
|
+
/* */
|
1405
|
+
/* */
|
1406
|
+
/* */
|
1407
|
+
/* */
|
1408
|
+
/* */
|
1409
|
+
/* */
|
1410
|
+
/* */
|
1411
|
+
/* */
|
1412
|
+
/* */
|
1413
|
+
/* */
|
1414
|
+
/* */
|
1415
|
+
/* */
|
1416
|
+
return (void 0);
|
1417
|
+
};
|
1418
|
+
UtilsOs.isRunningInDocker = () => {
|
1419
|
+
return false;
|
1420
|
+
/* */
|
1421
|
+
/* */
|
1422
|
+
/* */
|
1423
|
+
/* */
|
1424
|
+
/* */
|
1425
|
+
/* */
|
1426
|
+
/* */
|
1427
|
+
return (void 0);
|
1428
|
+
};
|
1429
|
+
UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
|
1430
|
+
/* */
|
1431
|
+
/* */
|
1432
|
+
/* */
|
1433
|
+
/* */
|
1434
|
+
/* */
|
1435
|
+
/* */
|
1436
|
+
/* */
|
1437
|
+
return (void 0);
|
1438
|
+
};
|
1439
|
+
/**
|
1440
|
+
* Check whether the current process is running in CLI mode.
|
1441
|
+
*/
|
1442
|
+
UtilsOs.isRunningInCliMode = () => {
|
1443
|
+
return false;
|
1444
|
+
/* */
|
1445
|
+
/* */
|
1446
|
+
return (void 0);
|
1447
|
+
};
|
1448
|
+
/**
|
1449
|
+
* Check whether the current process is running in mocha test.
|
1450
|
+
*/
|
1451
|
+
UtilsOs.isRunningInMochaTest = () => {
|
1452
|
+
return false;
|
1453
|
+
/* */
|
1454
|
+
/* */
|
1455
|
+
return (void 0);
|
1456
|
+
};
|
1457
|
+
const isPortInUseOnHost = (port, host) => {
|
1458
|
+
/* */
|
1459
|
+
/* */
|
1460
|
+
/* */
|
1461
|
+
/* */
|
1462
|
+
/* */
|
1463
|
+
/* */
|
1464
|
+
/* */
|
1465
|
+
/* */
|
1466
|
+
/* */
|
1467
|
+
/* */
|
1468
|
+
/* */
|
1469
|
+
/* */
|
1470
|
+
/* */
|
1471
|
+
/* */
|
1472
|
+
/* */
|
1473
|
+
/* */
|
1474
|
+
/* */
|
1475
|
+
/* */
|
1476
|
+
/* */
|
1477
|
+
/* */
|
1478
|
+
/* */
|
1479
|
+
/* */
|
1480
|
+
/* */
|
1481
|
+
/* */
|
1482
|
+
return (void 0);
|
1483
|
+
};
|
1484
|
+
/**
|
1485
|
+
* Checks if a given port is already in use (bound by another process).
|
1486
|
+
*
|
1487
|
+
* @param port - The port number to check.
|
1488
|
+
* @param host - The hostname or IP address to bind to (default: '127.0.0.1').
|
1489
|
+
* @returns Promise<boolean> - Resolves to `true` if the port is in use, otherwise `false`.
|
1490
|
+
*/
|
1491
|
+
UtilsOs.isPortInUse = async (port, options) => {
|
1492
|
+
/* */
|
1493
|
+
/* */
|
1494
|
+
/* */
|
1495
|
+
/* */
|
1496
|
+
/* */
|
1497
|
+
/* */
|
1498
|
+
/* */
|
1499
|
+
/* */
|
1500
|
+
/* */
|
1501
|
+
/* */
|
1502
|
+
/* */
|
1503
|
+
/* */
|
1504
|
+
/* */
|
1505
|
+
return (void 0);
|
1506
|
+
};
|
1507
|
+
})(UtilsOs || (UtilsOs = {}));
|
1508
|
+
var UtilsString;
|
1509
|
+
(function (UtilsString) {
|
1510
|
+
UtilsString.kebabCaseNoSplitNumbers = (input) => {
|
1511
|
+
return (input
|
1512
|
+
.replace(/\s+/g, '-')
|
1513
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
1514
|
+
.toLowerCase());
|
1515
|
+
};
|
1516
|
+
})(UtilsString || (UtilsString = {}));
|
1517
|
+
/**
|
1518
|
+
* Taon migration utilities
|
1519
|
+
*/
|
1520
|
+
var UtilsMigrations;
|
1521
|
+
(function (UtilsMigrations) {
|
1522
|
+
UtilsMigrations.getTimestampFromClassName = (className) => {
|
1523
|
+
const [maybeTimestamp1, maybeTimestamp2] = className.split('_') || [];
|
1524
|
+
const timestamp1 = parseInt(maybeTimestamp1);
|
1525
|
+
const timestamp2 = parseInt(maybeTimestamp2);
|
1526
|
+
const timestamp = !_.isNaN(timestamp1) ? timestamp1 : timestamp2;
|
1527
|
+
return UtilsMigrations.isValidTimestamp(timestamp) ? timestamp : void 0;
|
1528
|
+
};
|
1529
|
+
UtilsMigrations.getFormattedTimestampFromClassName = (className) => {
|
1530
|
+
const timestamp = UtilsMigrations.getTimestampFromClassName(className);
|
1531
|
+
if (!timestamp) {
|
1532
|
+
return void 0;
|
1533
|
+
}
|
1534
|
+
return UtilsMigrations.formatTimestamp(timestamp);
|
1535
|
+
};
|
1536
|
+
UtilsMigrations.formatTimestamp = (timestamp) => {
|
1537
|
+
const dateFromTimestamp = new Date(timestamp);
|
1538
|
+
return `${dateformat(dateFromTimestamp, 'dd-mm-yyyy HH:MM:ss')}`;
|
1539
|
+
};
|
1540
|
+
UtilsMigrations.isValidTimestamp = (value) => {
|
1541
|
+
if (typeof value !== 'number') {
|
1542
|
+
return false; // Must be a number
|
1543
|
+
}
|
1544
|
+
const minTimestamp = 0; // Minimum possible timestamp (Unix epoch)
|
1545
|
+
const maxTimestamp = 8640000000000000; // Max safe timestamp in JS (represents year ~275760)
|
1546
|
+
return value >= minTimestamp && value <= maxTimestamp;
|
1547
|
+
};
|
1548
|
+
})(UtilsMigrations || (UtilsMigrations = {}));
|
1549
|
+
var UtilsTerminal;
|
1550
|
+
(function (UtilsTerminal) {
|
1551
|
+
UtilsTerminal.clearConsole = () => {
|
1552
|
+
/* */
|
1553
|
+
/* */
|
1554
|
+
/* */
|
1555
|
+
/* */
|
1556
|
+
/* */
|
1557
|
+
/* */
|
1558
|
+
/* */
|
1559
|
+
/* */
|
1560
|
+
/* */
|
1561
|
+
return (void 0);
|
1562
|
+
};
|
1563
|
+
const transformChoices = (choices) => {
|
1564
|
+
/* */
|
1565
|
+
/* */
|
1566
|
+
/* */
|
1567
|
+
/* */
|
1568
|
+
/* */
|
1569
|
+
/* */
|
1570
|
+
/* */
|
1571
|
+
/* */
|
1572
|
+
/* */
|
1573
|
+
/* */
|
1574
|
+
/* */
|
1575
|
+
/* */
|
1576
|
+
return (void 0);
|
1577
|
+
};
|
1578
|
+
UtilsTerminal.multiselect = async (options) => {
|
1579
|
+
/* */
|
1580
|
+
/* */
|
1581
|
+
/* */
|
1582
|
+
/* */
|
1583
|
+
/* */
|
1584
|
+
/* */
|
1585
|
+
/* */
|
1586
|
+
/* */
|
1587
|
+
/* */
|
1588
|
+
/* */
|
1589
|
+
/* */
|
1590
|
+
/* */
|
1591
|
+
/* */
|
1592
|
+
/* */
|
1593
|
+
/* */
|
1594
|
+
/* */
|
1595
|
+
/* */
|
1596
|
+
/* */
|
1597
|
+
/* */
|
1598
|
+
/* */
|
1599
|
+
/* */
|
1600
|
+
/* */
|
1601
|
+
/* */
|
1602
|
+
/* */
|
1603
|
+
/* */
|
1604
|
+
/* */
|
1605
|
+
/* */
|
1606
|
+
/* */
|
1607
|
+
/* */
|
1608
|
+
/* */
|
1609
|
+
/* */
|
1610
|
+
/* */
|
1611
|
+
/* */
|
1612
|
+
/* */
|
1613
|
+
/* */
|
1614
|
+
/* */
|
1615
|
+
/* */
|
1616
|
+
/* */
|
1617
|
+
/* */
|
1618
|
+
/* */
|
1619
|
+
/* */
|
1620
|
+
/* */
|
1621
|
+
/* */
|
1622
|
+
/* */
|
1623
|
+
/* */
|
1624
|
+
/* */
|
1625
|
+
/* */
|
1626
|
+
/* */
|
1627
|
+
/* */
|
1628
|
+
/* */
|
1629
|
+
/* */
|
1630
|
+
/* */
|
1631
|
+
/* */
|
1632
|
+
/* */
|
1633
|
+
/* */
|
1634
|
+
/* */
|
1635
|
+
/* */
|
1636
|
+
/* */
|
1637
|
+
/* */
|
1638
|
+
/* */
|
1639
|
+
/* */
|
1640
|
+
/* */
|
1641
|
+
/* */
|
1642
|
+
/* */
|
1643
|
+
/* */
|
1644
|
+
/* */
|
1645
|
+
/* */
|
1646
|
+
/* */
|
1647
|
+
/* */
|
1648
|
+
/* */
|
1649
|
+
/* */
|
1650
|
+
/* */
|
1651
|
+
/* */
|
1652
|
+
/* */
|
1653
|
+
/* */
|
1654
|
+
return (void 0);
|
1655
|
+
};
|
1656
|
+
/**
|
1657
|
+
* Similar to select but executes action if provided
|
1658
|
+
* @returns selected and executed value
|
1659
|
+
*/
|
1660
|
+
UtilsTerminal.selectActionAndExecute = async (choices, options) => {
|
1661
|
+
/* */
|
1662
|
+
/* */
|
1663
|
+
/* */
|
1664
|
+
/* */
|
1665
|
+
/* */
|
1666
|
+
/* */
|
1667
|
+
/* */
|
1668
|
+
/* */
|
1669
|
+
/* */
|
1670
|
+
/* */
|
1671
|
+
/* */
|
1672
|
+
/* */
|
1673
|
+
/* */
|
1674
|
+
/* */
|
1675
|
+
/* */
|
1676
|
+
/* */
|
1677
|
+
/* */
|
1678
|
+
/* */
|
1679
|
+
/* */
|
1680
|
+
/* */
|
1681
|
+
/* */
|
1682
|
+
/* */
|
1683
|
+
return (void 0);
|
1684
|
+
};
|
1685
|
+
UtilsTerminal.select = async (options) => {
|
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
|
+
return (void 0);
|
1747
|
+
};
|
1748
|
+
UtilsTerminal.pipeEnterToStdin = () => {
|
1749
|
+
/* */
|
1750
|
+
/* */
|
1751
|
+
return (void 0);
|
1752
|
+
};
|
1753
|
+
UtilsTerminal.input = async ({ defaultValue, question, required, // TODO something is werid with required
|
1754
|
+
}) => {
|
1755
|
+
/* */
|
1756
|
+
/* */
|
1757
|
+
/* */
|
1758
|
+
/* */
|
1759
|
+
/* */
|
1760
|
+
/* */
|
1761
|
+
/* */
|
1762
|
+
/* */
|
1763
|
+
/* */
|
1764
|
+
/* */
|
1765
|
+
/* */
|
1766
|
+
/* */
|
1171
1767
|
/* */
|
1172
1768
|
/* */
|
1173
1769
|
/* */
|
@@ -1188,16 +1784,7 @@ var UtilsProcess;
|
|
1188
1784
|
/* */
|
1189
1785
|
return (void 0);
|
1190
1786
|
};
|
1191
|
-
|
1192
|
-
* TODO IMPLEMENT
|
1193
|
-
* start async node process
|
1194
|
-
*/
|
1195
|
-
UtilsProcess.startInNewTerminalWindow = (command, options) => {
|
1196
|
-
/* */
|
1197
|
-
/* */
|
1198
|
-
/* */
|
1199
|
-
/* */
|
1200
|
-
/* */
|
1787
|
+
UtilsTerminal.confirm = async (options) => {
|
1201
1788
|
/* */
|
1202
1789
|
/* */
|
1203
1790
|
/* */
|
@@ -1276,6 +1863,9 @@ var UtilsProcess;
|
|
1276
1863
|
/* */
|
1277
1864
|
/* */
|
1278
1865
|
/* */
|
1866
|
+
return (void 0);
|
1867
|
+
};
|
1868
|
+
UtilsTerminal.pressAnyKeyToContinueAsync = (options) => {
|
1279
1869
|
/* */
|
1280
1870
|
/* */
|
1281
1871
|
/* */
|
@@ -1296,9 +1886,10 @@ var UtilsProcess;
|
|
1296
1886
|
/* */
|
1297
1887
|
return (void 0);
|
1298
1888
|
};
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1889
|
+
/**
|
1890
|
+
* @deprecated use UtilsTerminal.pressAnyKeyToContinueAsync()
|
1891
|
+
*/
|
1892
|
+
UtilsTerminal.pressAnyKey = (options) => {
|
1302
1893
|
/* */
|
1303
1894
|
/* */
|
1304
1895
|
/* */
|
@@ -1326,75 +1917,19 @@ var UtilsProcess;
|
|
1326
1917
|
/* */
|
1327
1918
|
/* */
|
1328
1919
|
/* */
|
1920
|
+
return (void 0);
|
1921
|
+
};
|
1922
|
+
UtilsTerminal.previewLongList = async (list, listName = 'List') => {
|
1329
1923
|
/* */
|
1330
1924
|
/* */
|
1331
1925
|
/* */
|
1332
1926
|
/* */
|
1333
|
-
return (void 0);
|
1334
|
-
};
|
1335
|
-
})(UtilsProcess || (UtilsProcess = {}));
|
1336
|
-
var UtilsOs;
|
1337
|
-
(function (UtilsOs) {
|
1338
|
-
/**
|
1339
|
-
* check if script is running in client browser
|
1340
|
-
* (websql model -> is also considered as browser
|
1341
|
-
* because it is running in browser)
|
1342
|
-
*/
|
1343
|
-
UtilsOs.isRunningInBrowser = () => {
|
1344
1927
|
/* */
|
1345
1928
|
/* */
|
1346
|
-
return true;
|
1347
|
-
};
|
1348
|
-
/**
|
1349
|
-
* check if script is running in nodejs
|
1350
|
-
* (backend script or electron script)
|
1351
|
-
*/
|
1352
|
-
UtilsOs.isRunningInNode = () => {
|
1353
1929
|
/* */
|
1354
1930
|
/* */
|
1355
|
-
return false;
|
1356
|
-
};
|
1357
|
-
/**
|
1358
|
-
* check if script is running special
|
1359
|
-
* browser mode that has sql.js backend
|
1360
|
-
* and executes sql queries in browser
|
1361
|
-
*/
|
1362
|
-
UtilsOs.isRunningInWebSQL = () => {
|
1363
1931
|
/* */
|
1364
1932
|
/* */
|
1365
|
-
return true;
|
1366
|
-
return false;
|
1367
|
-
};
|
1368
|
-
/**
|
1369
|
-
* check whether the current process is running inside
|
1370
|
-
* Electron backend or browser.
|
1371
|
-
*/
|
1372
|
-
UtilsOs.isRunningInElectron = () => {
|
1373
|
-
// @ts-ignore
|
1374
|
-
if (typeof window !== 'undefined' &&
|
1375
|
-
typeof window.process === 'object' &&
|
1376
|
-
window.process.type === 'renderer') {
|
1377
|
-
return true;
|
1378
|
-
}
|
1379
|
-
// @ts-ignore
|
1380
|
-
if (typeof process !== 'undefined' &&
|
1381
|
-
typeof process.versions === 'object' &&
|
1382
|
-
!!process.versions.electron) {
|
1383
|
-
return true;
|
1384
|
-
}
|
1385
|
-
if (typeof navigator === 'object' &&
|
1386
|
-
typeof navigator.userAgent === 'string' &&
|
1387
|
-
navigator.userAgent.indexOf('Electron') >= 0) {
|
1388
|
-
return true;
|
1389
|
-
}
|
1390
|
-
return false;
|
1391
|
-
};
|
1392
|
-
/**
|
1393
|
-
* Check wether the current process is running inside
|
1394
|
-
* windows subsystem for linux (WSL).
|
1395
|
-
*/
|
1396
|
-
UtilsOs.isRunningInWsl = () => {
|
1397
|
-
return false;
|
1398
1933
|
/* */
|
1399
1934
|
/* */
|
1400
1935
|
/* */
|
@@ -1402,6 +1937,16 @@ var UtilsOs;
|
|
1402
1937
|
/* */
|
1403
1938
|
/* */
|
1404
1939
|
/* */
|
1940
|
+
return (void 0);
|
1941
|
+
};
|
1942
|
+
/**
|
1943
|
+
* Displays a long list in the console using a pager like `less`.
|
1944
|
+
* Returns a Promise that resolves when the user exits the pager.
|
1945
|
+
*
|
1946
|
+
* @param {string} list - The long string content to display.
|
1947
|
+
* @returns {Promise<void>} A Promise that resolves when the pager exits.
|
1948
|
+
*/
|
1949
|
+
UtilsTerminal.previewLongListGitLogLike = (list) => {
|
1405
1950
|
/* */
|
1406
1951
|
/* */
|
1407
1952
|
/* */
|
@@ -1412,10 +1957,6 @@ var UtilsOs;
|
|
1412
1957
|
/* */
|
1413
1958
|
/* */
|
1414
1959
|
/* */
|
1415
|
-
return (void 0);
|
1416
|
-
};
|
1417
|
-
UtilsOs.isRunningInDocker = () => {
|
1418
|
-
return false;
|
1419
1960
|
/* */
|
1420
1961
|
/* */
|
1421
1962
|
/* */
|
@@ -1423,9 +1964,6 @@ var UtilsOs;
|
|
1423
1964
|
/* */
|
1424
1965
|
/* */
|
1425
1966
|
/* */
|
1426
|
-
return (void 0);
|
1427
|
-
};
|
1428
|
-
UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
|
1429
1967
|
/* */
|
1430
1968
|
/* */
|
1431
1969
|
/* */
|
@@ -1435,48 +1973,7 @@ var UtilsOs;
|
|
1435
1973
|
/* */
|
1436
1974
|
return (void 0);
|
1437
1975
|
};
|
1438
|
-
})(
|
1439
|
-
var UtilsString;
|
1440
|
-
(function (UtilsString) {
|
1441
|
-
UtilsString.kebabCaseNoSplitNumbers = (input) => {
|
1442
|
-
return (input
|
1443
|
-
.replace(/\s+/g, '-')
|
1444
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
1445
|
-
.toLowerCase());
|
1446
|
-
};
|
1447
|
-
})(UtilsString || (UtilsString = {}));
|
1448
|
-
/**
|
1449
|
-
* Taon migration utilities
|
1450
|
-
*/
|
1451
|
-
var UtilsMigrations;
|
1452
|
-
(function (UtilsMigrations) {
|
1453
|
-
UtilsMigrations.getTimestampFromClassName = (className) => {
|
1454
|
-
const [maybeTimestamp1, maybeTimestamp2] = className.split('_') || [];
|
1455
|
-
const timestamp1 = parseInt(maybeTimestamp1);
|
1456
|
-
const timestamp2 = parseInt(maybeTimestamp2);
|
1457
|
-
const timestamp = !_.isNaN(timestamp1) ? timestamp1 : timestamp2;
|
1458
|
-
return UtilsMigrations.isValidTimestamp(timestamp) ? timestamp : void 0;
|
1459
|
-
};
|
1460
|
-
UtilsMigrations.getFormattedTimestampFromClassName = (className) => {
|
1461
|
-
const timestamp = UtilsMigrations.getTimestampFromClassName(className);
|
1462
|
-
if (!timestamp) {
|
1463
|
-
return void 0;
|
1464
|
-
}
|
1465
|
-
return UtilsMigrations.formatTimestamp(timestamp);
|
1466
|
-
};
|
1467
|
-
UtilsMigrations.formatTimestamp = (timestamp) => {
|
1468
|
-
const dateFromTimestamp = new Date(timestamp);
|
1469
|
-
return `${dateformat(dateFromTimestamp, 'dd-mm-yyyy HH:MM:ss')}`;
|
1470
|
-
};
|
1471
|
-
UtilsMigrations.isValidTimestamp = (value) => {
|
1472
|
-
if (typeof value !== 'number') {
|
1473
|
-
return false; // Must be a number
|
1474
|
-
}
|
1475
|
-
const minTimestamp = 0; // Minimum possible timestamp (Unix epoch)
|
1476
|
-
const maxTimestamp = 8640000000000000; // Max safe timestamp in JS (represents year ~275760)
|
1477
|
-
return value >= minTimestamp && value <= maxTimestamp;
|
1478
|
-
};
|
1479
|
-
})(UtilsMigrations || (UtilsMigrations = {}));
|
1976
|
+
})(UtilsTerminal || (UtilsTerminal = {}));
|
1480
1977
|
;
|
1481
1978
|
({}); // @--end-of-file-for-module=tnp-core lib/utils.ts
|
1482
1979
|
|
@@ -2075,10 +2572,26 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
2075
2572
|
;
|
2076
2573
|
({}); // @--end-of-file-for-module=tnp-core lib/helpers-messages.ts
|
2077
2574
|
|
2078
|
-
const encoding = 'utf8';
|
2079
2575
|
/* */
|
2080
2576
|
/* */
|
2081
2577
|
/* */
|
2578
|
+
/* */
|
2579
|
+
/* */
|
2580
|
+
/* */
|
2581
|
+
/* */
|
2582
|
+
/* */
|
2583
|
+
/* */
|
2584
|
+
/* */
|
2585
|
+
/* */
|
2586
|
+
/* */
|
2587
|
+
/* */
|
2588
|
+
/* */
|
2589
|
+
/* */
|
2590
|
+
/* */
|
2591
|
+
/* */
|
2592
|
+
const encoding = 'utf8';
|
2593
|
+
/* */
|
2594
|
+
/* */
|
2082
2595
|
const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
|
2083
2596
|
const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
|
2084
2597
|
class HelpersCore extends HelpersMessages {
|
@@ -2099,6 +2612,15 @@ class HelpersCore extends HelpersMessages {
|
|
2099
2612
|
/* */
|
2100
2613
|
/* */
|
2101
2614
|
/* */
|
2615
|
+
/* */
|
2616
|
+
/* */
|
2617
|
+
/* */
|
2618
|
+
/* */
|
2619
|
+
/* */
|
2620
|
+
/* */
|
2621
|
+
/* */
|
2622
|
+
/* */
|
2623
|
+
/* */
|
2102
2624
|
constructor() {
|
2103
2625
|
super();
|
2104
2626
|
/* */
|
@@ -2126,9 +2648,11 @@ class HelpersCore extends HelpersMessages {
|
|
2126
2648
|
isRunningInLinuxGraphicsCapableEnvironment() {
|
2127
2649
|
return UtilsOs.isRunningInLinuxGraphicsCapableEnvironment();
|
2128
2650
|
}
|
2651
|
+
/**
|
2652
|
+
* @deprecated use UtilsTerminal.clearConsole
|
2653
|
+
*/
|
2129
2654
|
clearConsole() {
|
2130
|
-
|
2131
|
-
console.log('\x1Bc');
|
2655
|
+
return UtilsTerminal.clearConsole();
|
2132
2656
|
}
|
2133
2657
|
/**
|
2134
2658
|
* get electron browser ipc renderer
|
@@ -3404,30 +3928,10 @@ class HelpersCore extends HelpersMessages {
|
|
3404
3928
|
},
|
3405
3929
|
};
|
3406
3930
|
}
|
3407
|
-
async questionYesNo(message, callbackTrue, callbackFalse, defaultValue = true,
|
3408
3931
|
/**
|
3409
|
-
*
|
3932
|
+
* @deprecated use UtilsTerminal.confirm
|
3410
3933
|
*/
|
3411
|
-
|
3412
|
-
/* */
|
3413
|
-
/* */
|
3414
|
-
/* */
|
3415
|
-
/* */
|
3416
|
-
/* */
|
3417
|
-
/* */
|
3418
|
-
/* */
|
3419
|
-
/* */
|
3420
|
-
/* */
|
3421
|
-
/* */
|
3422
|
-
/* */
|
3423
|
-
/* */
|
3424
|
-
/* */
|
3425
|
-
/* */
|
3426
|
-
/* */
|
3427
|
-
/* */
|
3428
|
-
/* */
|
3429
|
-
/* */
|
3430
|
-
/* */
|
3934
|
+
async questionYesNo(message, callbackTrue, callbackFalse, defaultValue = true) {
|
3431
3935
|
/* */
|
3432
3936
|
/* */
|
3433
3937
|
/* */
|
@@ -4656,5 +5160,5 @@ let Helpers = HelpersCore.InstanceCore;
|
|
4656
5160
|
* Generated bundle index. Do not edit.
|
4657
5161
|
*/
|
4658
5162
|
|
4659
|
-
export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsMigrations, UtilsOs, UtilsProcess, UtilsString, chalk, crossPlatformPath, frameworkName, frameworkNameBe, path, requiredForDev, win32Path };
|
5163
|
+
export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsMigrations, UtilsOs, UtilsProcess, UtilsString, UtilsTerminal, chalk, crossPlatformPath, frameworkName, frameworkNameBe, path, requiredForDev, win32Path };
|
4660
5164
|
//# sourceMappingURL=tnp-core.mjs.map
|