tnp-helpers 18.0.13 → 18.0.15
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/base/base-cli-worker-config.mjs +33 -0
- package/browser/esm2022/lib/base/base-cli-worker-controller.mjs +87 -0
- package/browser/esm2022/lib/base/base-cli-worker.mjs +303 -0
- package/browser/esm2022/lib/base/base-db.mjs +3 -2
- package/browser/esm2022/lib/base/base-git.mjs +1 -1
- package/browser/esm2022/lib/base/base-library-build.mjs +1 -1
- package/browser/esm2022/lib/base/base-linked-projects.mjs +1 -1
- package/browser/esm2022/lib/base/base-npm-helpers.mjs +1 -1
- package/browser/esm2022/lib/base/base-project-resolver.mjs +9 -6
- package/browser/esm2022/lib/base/base-project.mjs +2 -2
- package/browser/esm2022/lib/base/base-quick-fixes.mjs +1 -1
- package/browser/esm2022/lib/base/base-release-process.mjs +1 -1
- package/browser/esm2022/lib/base/base-vscode.mjs +1 -1
- package/browser/esm2022/lib/base/core-project.mjs +1 -1
- package/browser/esm2022/lib/base/ports-worker.mjs +107 -0
- package/browser/esm2022/lib/models.mjs +1 -1
- package/browser/fesm2022/tnp-helpers.mjs +524 -8
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-cli-worker-config.d.ts +24 -0
- package/browser/lib/base/base-cli-worker-controller.d.ts +14 -0
- package/browser/lib/base/base-cli-worker.d.ts +47 -0
- package/browser/lib/base/base-db.d.ts +1 -1
- package/browser/lib/base/base-git.d.ts +3 -3
- package/browser/lib/base/base-library-build.d.ts +8 -8
- package/browser/lib/base/base-linked-projects.d.ts +3 -3
- package/browser/lib/base/base-npm-helpers.d.ts +2 -2
- package/browser/lib/base/base-project-resolver.d.ts +5 -6
- package/browser/lib/base/base-project.d.ts +15 -15
- package/browser/lib/base/base-quick-fixes.d.ts +2 -2
- package/browser/lib/base/base-release-process.d.ts +4 -4
- package/browser/lib/base/base-vscode.d.ts +1 -1
- package/browser/lib/base/core-project.d.ts +2 -2
- package/browser/lib/base/ports-worker.d.ts +11 -0
- package/client/esm2022/lib/base/base-cli-worker-config.mjs +33 -0
- package/client/esm2022/lib/base/base-cli-worker-controller.mjs +87 -0
- package/client/esm2022/lib/base/base-cli-worker.mjs +303 -0
- package/client/esm2022/lib/base/base-db.mjs +3 -2
- package/client/esm2022/lib/base/base-git.mjs +1 -1
- package/client/esm2022/lib/base/base-library-build.mjs +1 -1
- package/client/esm2022/lib/base/base-linked-projects.mjs +1 -1
- package/client/esm2022/lib/base/base-npm-helpers.mjs +1 -1
- package/client/esm2022/lib/base/base-project-resolver.mjs +9 -6
- package/client/esm2022/lib/base/base-project.mjs +2 -2
- package/client/esm2022/lib/base/base-quick-fixes.mjs +1 -1
- package/client/esm2022/lib/base/base-release-process.mjs +1 -1
- package/client/esm2022/lib/base/base-vscode.mjs +1 -1
- package/client/esm2022/lib/base/core-project.mjs +1 -1
- package/client/esm2022/lib/base/ports-worker.mjs +107 -0
- package/client/esm2022/lib/models.mjs +1 -1
- package/client/fesm2022/tnp-helpers.mjs +524 -8
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-cli-worker-config.d.ts +24 -0
- package/client/lib/base/base-cli-worker-controller.d.ts +14 -0
- package/client/lib/base/base-cli-worker.d.ts +47 -0
- package/client/lib/base/base-db.d.ts +1 -1
- package/client/lib/base/base-git.d.ts +3 -3
- package/client/lib/base/base-library-build.d.ts +8 -8
- package/client/lib/base/base-linked-projects.d.ts +3 -3
- package/client/lib/base/base-npm-helpers.d.ts +2 -2
- package/client/lib/base/base-project-resolver.d.ts +5 -6
- package/client/lib/base/base-project.d.ts +15 -15
- package/client/lib/base/base-quick-fixes.d.ts +2 -2
- package/client/lib/base/base-release-process.d.ts +4 -4
- package/client/lib/base/base-vscode.d.ts +1 -1
- package/client/lib/base/core-project.d.ts +2 -2
- package/client/lib/base/ports-worker.d.ts +11 -0
- package/lib/base/base-cli-worker-config.d.ts +23 -0
- package/lib/base/base-cli-worker-config.js +45 -0
- package/lib/base/base-cli-worker-config.js.map +1 -0
- package/lib/base/base-cli-worker-controller.d.ts +13 -0
- package/lib/base/base-cli-worker-controller.js +114 -0
- package/lib/base/base-cli-worker-controller.js.map +1 -0
- package/lib/base/base-cli-worker.d.ts +46 -0
- package/lib/base/base-cli-worker.js +437 -0
- package/lib/base/base-cli-worker.js.map +1 -0
- package/lib/base/base-command-line.backend.d.ts +2 -0
- package/lib/base/base-command-line.backend.js +39 -0
- package/lib/base/base-command-line.backend.js.map +1 -1
- package/lib/base/base-db.d.ts +2 -2
- package/lib/base/base-db.js +3 -3
- package/lib/base/base-db.js.map +1 -1
- package/lib/base/base-detached-service.d.ts +6 -0
- package/lib/base/base-detached-service.js +16 -0
- package/lib/base/base-detached-service.js.map +1 -0
- package/lib/base/base-git.d.ts +3 -3
- package/lib/base/base-git.js +2 -2
- package/lib/base/base-git.js.map +1 -1
- package/lib/base/base-ignore-hide.d.ts +1 -1
- package/lib/base/base-library-build.d.ts +9 -9
- package/lib/base/base-linked-projects.d.ts +3 -3
- package/lib/base/base-linked-projects.js +1 -1
- package/lib/base/base-linked-projects.js.map +1 -1
- package/lib/base/base-npm-helpers.d.ts +2 -2
- package/lib/base/base-project-resolver.d.ts +5 -6
- package/lib/base/base-project-resolver.js +14 -5
- package/lib/base/base-project-resolver.js.map +1 -1
- package/lib/base/base-project.d.ts +16 -16
- package/lib/base/base-project.js +1 -1
- package/lib/base/base-project.js.map +1 -1
- package/lib/base/base-quick-fixes.d.ts +2 -2
- package/lib/base/base-release-process.d.ts +4 -4
- package/lib/base/base-start-config.backend.d.ts +0 -2
- package/lib/base/base-start-config.backend.js +7 -2
- package/lib/base/base-start-config.backend.js.map +1 -1
- package/lib/base/base-vscode.d.ts +1 -1
- package/lib/base/config-database.js +2 -2
- package/lib/base/config-database.js.map +1 -1
- package/lib/base/core-project.d.ts +2 -2
- package/lib/base/ports-worker.d.ts +10 -0
- package/lib/base/ports-worker.js +185 -0
- package/lib/base/ports-worker.js.map +1 -0
- package/lib/base/project-database.js +1 -1
- package/lib/base/project-database.js.map +1 -1
- package/lib/helpers/for-backend/helpers-cli-tool.backend.js +0 -1
- package/lib/helpers/for-backend/helpers-cli-tool.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.d.ts +4 -0
- package/lib/helpers/for-backend/helpers-file-folders.backend.js +7 -3
- package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-process.backend.d.ts +3 -2
- package/lib/helpers/for-backend/helpers-process.backend.js +19 -10
- package/lib/helpers/for-backend/helpers-process.backend.js.map +1 -1
- package/lib/helpers/for-browser/angular.helper.js +2 -2
- package/lib/old/base-component.js +2 -2
- package/lib/old/base-formly-component.js +2 -2
- package/lib/old/dual-component-ctrl.js +2 -2
- package/package.json +5 -5
- package/tmp-environment.json +37 -31
- package/websql/esm2022/lib/base/base-cli-worker-config.mjs +33 -0
- package/websql/esm2022/lib/base/base-cli-worker-controller.mjs +87 -0
- package/websql/esm2022/lib/base/base-cli-worker.mjs +303 -0
- package/websql/esm2022/lib/base/base-db.mjs +3 -2
- package/websql/esm2022/lib/base/base-git.mjs +1 -1
- package/websql/esm2022/lib/base/base-library-build.mjs +1 -1
- package/websql/esm2022/lib/base/base-linked-projects.mjs +1 -1
- package/websql/esm2022/lib/base/base-npm-helpers.mjs +1 -1
- package/websql/esm2022/lib/base/base-project-resolver.mjs +9 -6
- package/websql/esm2022/lib/base/base-project.mjs +2 -2
- package/websql/esm2022/lib/base/base-quick-fixes.mjs +1 -1
- package/websql/esm2022/lib/base/base-release-process.mjs +1 -1
- package/websql/esm2022/lib/base/base-vscode.mjs +1 -1
- package/websql/esm2022/lib/base/core-project.mjs +1 -1
- package/websql/esm2022/lib/base/ports-worker.mjs +114 -0
- package/websql/esm2022/lib/models.mjs +1 -1
- package/websql/fesm2022/tnp-helpers.mjs +531 -8
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-cli-worker-config.d.ts +24 -0
- package/websql/lib/base/base-cli-worker-controller.d.ts +14 -0
- package/websql/lib/base/base-cli-worker.d.ts +47 -0
- package/websql/lib/base/base-db.d.ts +1 -1
- package/websql/lib/base/base-git.d.ts +3 -3
- package/websql/lib/base/base-library-build.d.ts +8 -8
- package/websql/lib/base/base-linked-projects.d.ts +3 -3
- package/websql/lib/base/base-npm-helpers.d.ts +2 -2
- package/websql/lib/base/base-project-resolver.d.ts +5 -6
- package/websql/lib/base/base-project.d.ts +15 -15
- package/websql/lib/base/base-quick-fixes.d.ts +2 -2
- package/websql/lib/base/base-release-process.d.ts +4 -4
- package/websql/lib/base/base-vscode.d.ts +1 -1
- package/websql/lib/base/core-project.d.ts +2 -2
- package/websql/lib/base/ports-worker.d.ts +11 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as core from 'tnp-core/browser';
|
|
2
|
-
import { _, CoreModels, Utils, CoreHelpers, crossPlatformPath, path
|
|
2
|
+
import { _, CoreModels, Utils, CoreHelpers, chalk, crossPlatformPath, path } from 'tnp-core/browser';
|
|
3
3
|
import { Subject } from 'rxjs';
|
|
4
4
|
import * as fuzzy from 'fuzzy';
|
|
5
5
|
import { CLASS } from 'typescript-class-helpers/browser';
|
|
6
|
+
import { __decorate, __param, __metadata } from 'tslib';
|
|
7
|
+
import { Taon, BaseContext } from 'taon/browser';
|
|
6
8
|
import { config } from 'tnp-config/browser';
|
|
7
9
|
import { IncCompiler, ChangeOfFile } from 'incremental-compiler/browser';
|
|
8
10
|
|
|
@@ -1621,6 +1623,7 @@ applyMixins(HelpersTaon, [
|
|
|
1621
1623
|
/* */
|
|
1622
1624
|
/* */
|
|
1623
1625
|
/* */
|
|
1626
|
+
/* */
|
|
1624
1627
|
class BaseDb {
|
|
1625
1628
|
constructor(ins, dbName, defaultDb) {
|
|
1626
1629
|
this.ins = ins;
|
|
@@ -1629,7 +1632,7 @@ class BaseDb {
|
|
|
1629
1632
|
}
|
|
1630
1633
|
/* */
|
|
1631
1634
|
/* */
|
|
1632
|
-
get
|
|
1635
|
+
get isUsingDB() {
|
|
1633
1636
|
/* */
|
|
1634
1637
|
/* */
|
|
1635
1638
|
return (void 0);
|
|
@@ -1706,6 +1709,517 @@ class ProjectDatabase extends BaseDb {
|
|
|
1706
1709
|
;
|
|
1707
1710
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/project-database.ts
|
|
1708
1711
|
|
|
1712
|
+
const WORKER_INIT_START_TIME_LIMIT = 15; // 15 seconds max to start worker
|
|
1713
|
+
const START_PORT_FOR_SERVICES = 3600;
|
|
1714
|
+
class BaseCliWorker {
|
|
1715
|
+
constructor(
|
|
1716
|
+
/**
|
|
1717
|
+
* unique id for service
|
|
1718
|
+
*/
|
|
1719
|
+
serviceID,
|
|
1720
|
+
/**
|
|
1721
|
+
* external command that will start service
|
|
1722
|
+
*/
|
|
1723
|
+
startCommand) {
|
|
1724
|
+
this.serviceID = serviceID;
|
|
1725
|
+
this.startCommand = startCommand;
|
|
1726
|
+
}
|
|
1727
|
+
get pathToProcessLocalInfoJson() {
|
|
1728
|
+
/* */
|
|
1729
|
+
/* */
|
|
1730
|
+
/* */
|
|
1731
|
+
/* */
|
|
1732
|
+
/* */
|
|
1733
|
+
/* */
|
|
1734
|
+
/* */
|
|
1735
|
+
/* */
|
|
1736
|
+
return (void 0);
|
|
1737
|
+
}
|
|
1738
|
+
get processLocalInfoObj() {
|
|
1739
|
+
/* */
|
|
1740
|
+
/* */
|
|
1741
|
+
/* */
|
|
1742
|
+
/* */
|
|
1743
|
+
/* */
|
|
1744
|
+
/* */
|
|
1745
|
+
return (void 0);
|
|
1746
|
+
}
|
|
1747
|
+
async startDetachedIfNeedsToBeStarted() {
|
|
1748
|
+
/* */
|
|
1749
|
+
/* */
|
|
1750
|
+
/* */
|
|
1751
|
+
/* */
|
|
1752
|
+
/* */
|
|
1753
|
+
/* */
|
|
1754
|
+
/* */
|
|
1755
|
+
/* */
|
|
1756
|
+
/* */
|
|
1757
|
+
/* */
|
|
1758
|
+
/* */
|
|
1759
|
+
/* */
|
|
1760
|
+
/* */
|
|
1761
|
+
/* */
|
|
1762
|
+
return (void 0);
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* stop if started
|
|
1766
|
+
*/
|
|
1767
|
+
async kill() {
|
|
1768
|
+
Helpers.log(`Killing service "${this.serviceID}"...`);
|
|
1769
|
+
if (this.processLocalInfoObj.isEmpty) {
|
|
1770
|
+
Helpers.log(`Service "${this.serviceID}" not started - nothing to kill...`);
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
const ctrl = await this.getControllerForRemoteConnection();
|
|
1774
|
+
try {
|
|
1775
|
+
Helpers.removeFileIfExists(this.pathToProcessLocalInfoJson);
|
|
1776
|
+
await ctrl.baseCLiWorkerCommand_kill().received;
|
|
1777
|
+
Helpers.log(`Service "${this.serviceID}" killed...`);
|
|
1778
|
+
}
|
|
1779
|
+
catch (error) {
|
|
1780
|
+
Helpers.log(error);
|
|
1781
|
+
Helpers.log(`Service "${this.serviceID}" not killed... `);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* kill detached process and start again
|
|
1786
|
+
*/
|
|
1787
|
+
async restart() {
|
|
1788
|
+
await this.kill();
|
|
1789
|
+
await this.startDetached();
|
|
1790
|
+
}
|
|
1791
|
+
async isServiceHealthy(options) {
|
|
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
|
+
return (void 0);
|
|
1855
|
+
}
|
|
1856
|
+
/**
|
|
1857
|
+
* start if not started detached process
|
|
1858
|
+
*/
|
|
1859
|
+
async startDetached() {
|
|
1860
|
+
/* */
|
|
1861
|
+
/* */
|
|
1862
|
+
/* */
|
|
1863
|
+
/* */
|
|
1864
|
+
/* */
|
|
1865
|
+
/* */
|
|
1866
|
+
/* */
|
|
1867
|
+
/* */
|
|
1868
|
+
/* */
|
|
1869
|
+
/* */
|
|
1870
|
+
/* */
|
|
1871
|
+
/* */
|
|
1872
|
+
/* */
|
|
1873
|
+
/* */
|
|
1874
|
+
/* */
|
|
1875
|
+
/* */
|
|
1876
|
+
/* */
|
|
1877
|
+
/* */
|
|
1878
|
+
return (void 0);
|
|
1879
|
+
}
|
|
1880
|
+
async _infoScreen() {
|
|
1881
|
+
while (true) {
|
|
1882
|
+
Helpers.clearConsole();
|
|
1883
|
+
const cfonts = require('cfonts');
|
|
1884
|
+
const output = cfonts.render(`TAON.DEV`, {
|
|
1885
|
+
font: 'block',
|
|
1886
|
+
align: 'left',
|
|
1887
|
+
colors: ['system'],
|
|
1888
|
+
background: 'transparent',
|
|
1889
|
+
letterSpacing: 1,
|
|
1890
|
+
lineHeight: 1,
|
|
1891
|
+
space: true,
|
|
1892
|
+
maxLength: '0',
|
|
1893
|
+
gradient: false,
|
|
1894
|
+
independentGradient: false,
|
|
1895
|
+
transitionGradient: false,
|
|
1896
|
+
env: 'node',
|
|
1897
|
+
});
|
|
1898
|
+
console.log(output.string);
|
|
1899
|
+
Helpers.info(`
|
|
1900
|
+
|
|
1901
|
+
Service ${chalk.bold.red(this.serviceID)} started..
|
|
1902
|
+
Check info here http://localhost:${chalk.bold(this.processLocalInfoObj?.port?.toString())}/${'info'}
|
|
1903
|
+
|
|
1904
|
+
`);
|
|
1905
|
+
const choices = {
|
|
1906
|
+
openBrowser: {
|
|
1907
|
+
name: 'Open browser with service info',
|
|
1908
|
+
},
|
|
1909
|
+
exit: {
|
|
1910
|
+
name: `Shut down service`,
|
|
1911
|
+
},
|
|
1912
|
+
};
|
|
1913
|
+
const choice = await UtilsTerminal.select({
|
|
1914
|
+
choices,
|
|
1915
|
+
question: 'Choose action',
|
|
1916
|
+
});
|
|
1917
|
+
if (choice === 'openBrowser') {
|
|
1918
|
+
const openInBrowser = require('open');
|
|
1919
|
+
openInBrowser(`http://localhost:${this.processLocalInfoObj.port}/info`);
|
|
1920
|
+
}
|
|
1921
|
+
if (choice === 'exit') {
|
|
1922
|
+
process.exit(0);
|
|
1923
|
+
}
|
|
1924
|
+
switch (choice) {
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
saveProcessInfo(processConfig) {
|
|
1929
|
+
/* */
|
|
1930
|
+
/* */
|
|
1931
|
+
/* */
|
|
1932
|
+
/* */
|
|
1933
|
+
/* */
|
|
1934
|
+
/* */
|
|
1935
|
+
/* */
|
|
1936
|
+
/* */
|
|
1937
|
+
/* */
|
|
1938
|
+
/* */
|
|
1939
|
+
/* */
|
|
1940
|
+
/* */
|
|
1941
|
+
/* */
|
|
1942
|
+
/* */
|
|
1943
|
+
/* */
|
|
1944
|
+
return (void 0);
|
|
1945
|
+
}
|
|
1946
|
+
async initializeWorkerMetadata() {
|
|
1947
|
+
/* */
|
|
1948
|
+
/* */
|
|
1949
|
+
/* */
|
|
1950
|
+
/* */
|
|
1951
|
+
/* */
|
|
1952
|
+
/* */
|
|
1953
|
+
/* */
|
|
1954
|
+
/* */
|
|
1955
|
+
/* */
|
|
1956
|
+
/* */
|
|
1957
|
+
/* */
|
|
1958
|
+
/* */
|
|
1959
|
+
/* */
|
|
1960
|
+
/* */
|
|
1961
|
+
/* */
|
|
1962
|
+
/* */
|
|
1963
|
+
/* */
|
|
1964
|
+
/* */
|
|
1965
|
+
/* */
|
|
1966
|
+
/* */
|
|
1967
|
+
return (void 0);
|
|
1968
|
+
}
|
|
1969
|
+
async waitForProcessPortSavedToDisk() {
|
|
1970
|
+
/* */
|
|
1971
|
+
/* */
|
|
1972
|
+
/* */
|
|
1973
|
+
/* */
|
|
1974
|
+
/* */
|
|
1975
|
+
/* */
|
|
1976
|
+
/* */
|
|
1977
|
+
/* */
|
|
1978
|
+
/* */
|
|
1979
|
+
/* */
|
|
1980
|
+
/* */
|
|
1981
|
+
/* */
|
|
1982
|
+
/* */
|
|
1983
|
+
/* */
|
|
1984
|
+
/* */
|
|
1985
|
+
/* */
|
|
1986
|
+
/* */
|
|
1987
|
+
/* */
|
|
1988
|
+
/* */
|
|
1989
|
+
/* */
|
|
1990
|
+
/* */
|
|
1991
|
+
/* */
|
|
1992
|
+
return (void 0);
|
|
1993
|
+
}
|
|
1994
|
+
async getServicePort() {
|
|
1995
|
+
/* */
|
|
1996
|
+
/* */
|
|
1997
|
+
/* */
|
|
1998
|
+
/* */
|
|
1999
|
+
/* */
|
|
2000
|
+
/* */
|
|
2001
|
+
/* */
|
|
2002
|
+
/* */
|
|
2003
|
+
/* */
|
|
2004
|
+
/* */
|
|
2005
|
+
/* */
|
|
2006
|
+
/* */
|
|
2007
|
+
return (void 0);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
;
|
|
2011
|
+
({}); // @--end-of-file-for-module=tnp-helpers lib/base/base-cli-worker.ts
|
|
2012
|
+
|
|
2013
|
+
/* */
|
|
2014
|
+
/* */
|
|
2015
|
+
class BaseCliWorkerConfig {
|
|
2016
|
+
static from(opt) {
|
|
2017
|
+
return _.merge(new BaseCliWorkerConfig(), opt);
|
|
2018
|
+
}
|
|
2019
|
+
isEquals(other) {
|
|
2020
|
+
other = BaseCliWorkerConfig.from(other);
|
|
2021
|
+
return (!!this.serviceID &&
|
|
2022
|
+
!!this.port &&
|
|
2023
|
+
!!this.pid &&
|
|
2024
|
+
this.serviceID === other.serviceID &&
|
|
2025
|
+
this.port === other.port &&
|
|
2026
|
+
this.pid === other.pid);
|
|
2027
|
+
}
|
|
2028
|
+
get isEmpty() {
|
|
2029
|
+
return !this.serviceID && !this.port && !this.pid;
|
|
2030
|
+
}
|
|
2031
|
+
toString() {
|
|
2032
|
+
/* */
|
|
2033
|
+
/* */
|
|
2034
|
+
/* */
|
|
2035
|
+
/* */
|
|
2036
|
+
/* */
|
|
2037
|
+
/* */
|
|
2038
|
+
/* */
|
|
2039
|
+
return (void 0);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
;
|
|
2043
|
+
({}); // @--end-of-file-for-module=tnp-helpers lib/base/base-cli-worker-config.ts
|
|
2044
|
+
|
|
2045
|
+
let BaseCliWorkerController = class BaseCliWorkerController extends Taon.Base
|
|
2046
|
+
.CrudController {
|
|
2047
|
+
constructor() {
|
|
2048
|
+
super(...arguments);
|
|
2049
|
+
/**
|
|
2050
|
+
* service id
|
|
2051
|
+
*/
|
|
2052
|
+
this.cliWorkerServiceId = null;
|
|
2053
|
+
}
|
|
2054
|
+
baseCLiWorkerCommand_initializeMetadata(serviceId) {
|
|
2055
|
+
/* */
|
|
2056
|
+
/* */
|
|
2057
|
+
/* */
|
|
2058
|
+
/* */
|
|
2059
|
+
return (void 0);
|
|
2060
|
+
}
|
|
2061
|
+
baseCLiWorkerCommand_kill() {
|
|
2062
|
+
/* */
|
|
2063
|
+
/* */
|
|
2064
|
+
/* */
|
|
2065
|
+
/* */
|
|
2066
|
+
/* */
|
|
2067
|
+
/* */
|
|
2068
|
+
/* */
|
|
2069
|
+
return (void 0);
|
|
2070
|
+
}
|
|
2071
|
+
info() {
|
|
2072
|
+
/* */
|
|
2073
|
+
/* */
|
|
2074
|
+
/* */
|
|
2075
|
+
/* */
|
|
2076
|
+
return (void 0);
|
|
2077
|
+
}
|
|
2078
|
+
baseCLiWorkerCommand_isHealthy(configWorker) {
|
|
2079
|
+
/* */
|
|
2080
|
+
/* */
|
|
2081
|
+
/* */
|
|
2082
|
+
/* */
|
|
2083
|
+
/* */
|
|
2084
|
+
/* */
|
|
2085
|
+
/* */
|
|
2086
|
+
/* */
|
|
2087
|
+
/* */
|
|
2088
|
+
/* */
|
|
2089
|
+
return (void 0);
|
|
2090
|
+
}
|
|
2091
|
+
};
|
|
2092
|
+
__decorate([
|
|
2093
|
+
Taon.Http.PUT(),
|
|
2094
|
+
__param(0, Taon.Http.Param.Body('serviceId')),
|
|
2095
|
+
__metadata("design:type", Function),
|
|
2096
|
+
__metadata("design:paramtypes", [String]),
|
|
2097
|
+
__metadata("design:returntype", Object)
|
|
2098
|
+
], BaseCliWorkerController.prototype, "baseCLiWorkerCommand_initializeMetadata", null);
|
|
2099
|
+
__decorate([
|
|
2100
|
+
Taon.Http.GET(),
|
|
2101
|
+
__metadata("design:type", Function),
|
|
2102
|
+
__metadata("design:paramtypes", []),
|
|
2103
|
+
__metadata("design:returntype", Object)
|
|
2104
|
+
], BaseCliWorkerController.prototype, "baseCLiWorkerCommand_kill", null);
|
|
2105
|
+
__decorate([
|
|
2106
|
+
Taon.Http.GET({
|
|
2107
|
+
pathIsGlobal: true,
|
|
2108
|
+
}),
|
|
2109
|
+
__metadata("design:type", Function),
|
|
2110
|
+
__metadata("design:paramtypes", []),
|
|
2111
|
+
__metadata("design:returntype", Object)
|
|
2112
|
+
], BaseCliWorkerController.prototype, "info", null);
|
|
2113
|
+
__decorate([
|
|
2114
|
+
Taon.Http.POST(),
|
|
2115
|
+
__param(0, Taon.Http.Param.Body()),
|
|
2116
|
+
__metadata("design:type", Function),
|
|
2117
|
+
__metadata("design:paramtypes", [BaseCliWorkerConfig]),
|
|
2118
|
+
__metadata("design:returntype", Object)
|
|
2119
|
+
], BaseCliWorkerController.prototype, "baseCLiWorkerCommand_isHealthy", null);
|
|
2120
|
+
BaseCliWorkerController = __decorate([
|
|
2121
|
+
Taon.Controller({
|
|
2122
|
+
className: 'BaseCliWorkerController',
|
|
2123
|
+
})
|
|
2124
|
+
], BaseCliWorkerController);
|
|
2125
|
+
;
|
|
2126
|
+
({}); // @--end-of-file-for-module=tnp-helpers lib/base/base-cli-worker-controller.ts
|
|
2127
|
+
|
|
2128
|
+
var Port_1;
|
|
2129
|
+
let Port = Port_1 = class Port extends Taon.Base.AbstractEntity {
|
|
2130
|
+
static from(opt) {
|
|
2131
|
+
return _.merge(new Port_1(), opt);
|
|
2132
|
+
}
|
|
2133
|
+
};
|
|
2134
|
+
Port = Port_1 = __decorate([
|
|
2135
|
+
Taon.Entity({
|
|
2136
|
+
className: 'Port',
|
|
2137
|
+
})
|
|
2138
|
+
], Port);
|
|
2139
|
+
let PortsController = class PortsController extends BaseCliWorkerController {
|
|
2140
|
+
constructor() {
|
|
2141
|
+
super(...arguments);
|
|
2142
|
+
this.entityClassResolveFn = () => Port;
|
|
2143
|
+
}
|
|
2144
|
+
async initExampleDbData() {
|
|
2145
|
+
/* */
|
|
2146
|
+
/* */
|
|
2147
|
+
/* */
|
|
2148
|
+
/* */
|
|
2149
|
+
/* */
|
|
2150
|
+
/* */
|
|
2151
|
+
/* */
|
|
2152
|
+
/* */
|
|
2153
|
+
/* */
|
|
2154
|
+
/* */
|
|
2155
|
+
/* */
|
|
2156
|
+
/* */
|
|
2157
|
+
/* */
|
|
2158
|
+
/* */
|
|
2159
|
+
/* */
|
|
2160
|
+
/* */
|
|
2161
|
+
/* */
|
|
2162
|
+
/* */
|
|
2163
|
+
/* */
|
|
2164
|
+
/* */
|
|
2165
|
+
/* */
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
PortsController = __decorate([
|
|
2169
|
+
Taon.Controller({
|
|
2170
|
+
className: 'PortsController',
|
|
2171
|
+
})
|
|
2172
|
+
], PortsController);
|
|
2173
|
+
/* */
|
|
2174
|
+
/* */
|
|
2175
|
+
/* */
|
|
2176
|
+
/* */
|
|
2177
|
+
/* */
|
|
2178
|
+
/* */
|
|
2179
|
+
/* */
|
|
2180
|
+
/* */
|
|
2181
|
+
/* */
|
|
2182
|
+
var PortsContext = Taon.createContext(() => ({
|
|
2183
|
+
contextName: 'PortsContext',
|
|
2184
|
+
contexts: { BaseContext },
|
|
2185
|
+
controllers: { PortsController },
|
|
2186
|
+
entities: { Port },
|
|
2187
|
+
/* */
|
|
2188
|
+
/* */
|
|
2189
|
+
/* */
|
|
2190
|
+
/* */
|
|
2191
|
+
logs: {},
|
|
2192
|
+
}));
|
|
2193
|
+
class PortsWorker extends BaseCliWorker {
|
|
2194
|
+
async getControllerForRemoteConnection() {
|
|
2195
|
+
await this.waitForProcessPortSavedToDisk();
|
|
2196
|
+
const refRemote = await PortsContext.initialize({
|
|
2197
|
+
overrideRemoteHost: `http://localhost:${this.processLocalInfoObj.port}`,
|
|
2198
|
+
});
|
|
2199
|
+
return refRemote.getInstanceBy(PortsController);
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* start normally process
|
|
2203
|
+
* this will crash if process already started
|
|
2204
|
+
*/
|
|
2205
|
+
async startNormallyInCurrentProcess() {
|
|
2206
|
+
/* */
|
|
2207
|
+
/* */
|
|
2208
|
+
/* */
|
|
2209
|
+
/* */
|
|
2210
|
+
/* */
|
|
2211
|
+
/* */
|
|
2212
|
+
/* */
|
|
2213
|
+
/* */
|
|
2214
|
+
/* */
|
|
2215
|
+
/* */
|
|
2216
|
+
/* */
|
|
2217
|
+
return (void 0);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
;
|
|
2221
|
+
({}); // @--end-of-file-for-module=tnp-helpers lib/base/ports-worker.ts
|
|
2222
|
+
|
|
1709
2223
|
/* */
|
|
1710
2224
|
/* */
|
|
1711
2225
|
/* */
|
|
@@ -1716,12 +2230,9 @@ class ProjectDatabase extends BaseDb {
|
|
|
1716
2230
|
/* */
|
|
1717
2231
|
/* */
|
|
1718
2232
|
class BaseProjectResolver {
|
|
1719
|
-
constructor(classFn) {
|
|
2233
|
+
constructor(classFn, cliToolName) {
|
|
1720
2234
|
this.classFn = classFn;
|
|
1721
|
-
|
|
1722
|
-
* general name for project company
|
|
1723
|
-
*/
|
|
1724
|
-
this.orgName = 'taon';
|
|
2235
|
+
this.cliToolName = cliToolName;
|
|
1725
2236
|
this.configDb = new ConfigDatabase(this);
|
|
1726
2237
|
this.projectsDb = new ProjectDatabase(this);
|
|
1727
2238
|
this.NPM_PROJECT_KEY = 'npm';
|
|
@@ -1731,6 +2242,11 @@ class BaseProjectResolver {
|
|
|
1731
2242
|
* This may break things that are creating new projects
|
|
1732
2243
|
*/
|
|
1733
2244
|
this.emptyLocations = [];
|
|
2245
|
+
this.cliToolName = cliToolName;
|
|
2246
|
+
if (!this.cliToolName) {
|
|
2247
|
+
Helpers.throw(`cliToolName is not provided`);
|
|
2248
|
+
}
|
|
2249
|
+
this.portsWorker = new PortsWorker('ports-worker', `${this.cliToolName} startCliServicePortsWorker --skipCoreCheck`);
|
|
1734
2250
|
}
|
|
1735
2251
|
get allowedTypes() {
|
|
1736
2252
|
/* */
|
|
@@ -1999,7 +2515,7 @@ class BaseProjectResolver {
|
|
|
1999
2515
|
/* */
|
|
2000
2516
|
const takenPorts = [];
|
|
2001
2517
|
class BaseProject {
|
|
2002
|
-
static { this.ins = new BaseProjectResolver(BaseProject); }
|
|
2518
|
+
static { this.ins = new BaseProjectResolver(BaseProject, 'taon'); }
|
|
2003
2519
|
static { this.cache = {}; }
|
|
2004
2520
|
get globalCache() {
|
|
2005
2521
|
return BaseProject.cache;
|