tnp-core 21.0.166 → 21.0.167

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.
Files changed (120) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/browser/package.json +1 -1
  3. package/browser-prod/package.json +1 -1
  4. package/full-dts/build-info._auto-generated_.d.ts +24 -0
  5. package/full-dts/config.d.ts +171 -0
  6. package/full-dts/constants.d.ts +306 -0
  7. package/full-dts/core-cli.d.ts +8 -0
  8. package/full-dts/core-config.d.ts +5 -0
  9. package/full-dts/core-imports.d.ts +71 -0
  10. package/full-dts/core-models.d.ts +313 -0
  11. package/full-dts/core-project.d.ts +6 -0
  12. package/full-dts/cross-platform-path.d.ts +5 -0
  13. package/full-dts/env/env.angular-node-app.d.ts +67 -0
  14. package/full-dts/env/env.docs-webapp.d.ts +67 -0
  15. package/full-dts/env/env.electron-app.d.ts +67 -0
  16. package/full-dts/env/env.mobile-app.d.ts +67 -0
  17. package/full-dts/env/env.npm-lib-and-cli-tool.d.ts +67 -0
  18. package/full-dts/env/env.vscode-plugin.d.ts +67 -0
  19. package/full-dts/env/index.d.ts +6 -0
  20. package/full-dts/framework-name.d.ts +3 -0
  21. package/full-dts/global-logs.d.ts +5 -0
  22. package/full-dts/global-spinner.d.ts +27 -0
  23. package/full-dts/global-storage.d.ts +17 -0
  24. package/full-dts/global-task-manager.d.ts +20 -0
  25. package/full-dts/helpers.d.ts +325 -0
  26. package/full-dts/index.d.ts +53 -0
  27. package/full-dts/jsonc-parser.d.ts +4 -0
  28. package/full-dts/lodash.namespace.d.ts +308 -0
  29. package/full-dts/lowdb/adapters/Memory.d.ts +11 -0
  30. package/full-dts/lowdb/adapters/client/LocalStorage.d.ts +4 -0
  31. package/full-dts/lowdb/adapters/client/SessionStorage.d.ts +4 -0
  32. package/full-dts/lowdb/adapters/client/WebStorage.d.ts +8 -0
  33. package/full-dts/lowdb/adapters/node/DataFile.d.ts +25 -0
  34. package/full-dts/lowdb/adapters/node/JSONFile.d.ts +8 -0
  35. package/full-dts/lowdb/adapters/node/TextFile.d.ts +17 -0
  36. package/full-dts/lowdb/adapters/node/steno.d.ts +13 -0
  37. package/full-dts/lowdb/browser.d.ts +3 -0
  38. package/full-dts/lowdb/core/Low.d.ts +24 -0
  39. package/full-dts/lowdb/examples/server.d.ts +0 -0
  40. package/full-dts/lowdb/index.d.ts +3 -0
  41. package/full-dts/lowdb/node.d.ts +4 -0
  42. package/full-dts/lowdb/presets/browser.d.ts +3 -0
  43. package/full-dts/lowdb/presets/node.d.ts +4 -0
  44. package/full-dts/node-chalk-mock.d.ts +2 -0
  45. package/full-dts/node-path-mock.d.ts +25 -0
  46. package/full-dts/public-api.d.ts +4 -0
  47. package/full-dts/required-global-npm-packages.d.ts +44 -0
  48. package/full-dts/start-cli.d.ts +7 -0
  49. package/full-dts/taon-state-machine.d.ts +23 -0
  50. package/full-dts/utils-binary.d.ts +68 -0
  51. package/full-dts/utils-cli.d.ts +41 -0
  52. package/full-dts/utils-dot-file.d.ts +17 -0
  53. package/full-dts/utils-env.d.ts +101 -0
  54. package/full-dts/utils-etc-hosts.d.ts +28 -0
  55. package/full-dts/utils-exec-proc-vscode.d.ts +62 -0
  56. package/full-dts/utils-exec-proc.d.ts +100 -0
  57. package/full-dts/utils-files-folders.d.ts +106 -0
  58. package/full-dts/utils-http.d.ts +188 -0
  59. package/full-dts/utils-i18n.d.ts +38 -0
  60. package/full-dts/utils-imports.d.ts +0 -0
  61. package/full-dts/utils-imports.test.d.ts +0 -0
  62. package/full-dts/utils-json.d.ts +37 -0
  63. package/full-dts/utils-jwt.d.ts +12 -0
  64. package/full-dts/utils-md-docs.d.ts +21 -0
  65. package/full-dts/utils-network.d.ts +79 -0
  66. package/full-dts/utils-os.d.ts +126 -0
  67. package/full-dts/utils-passwords.d.ts +8 -0
  68. package/full-dts/utils-process-logger.d.ts +97 -0
  69. package/full-dts/utils-process.d.ts +93 -0
  70. package/full-dts/utils-progress.d.ts +26 -0
  71. package/full-dts/utils-projects.d.ts +327 -0
  72. package/full-dts/utils-projects.test.d.ts +0 -0
  73. package/full-dts/utils-secret-env.d.ts +41 -0
  74. package/full-dts/utils-start-async.d.ts +67 -0
  75. package/full-dts/utils-stdin-stdout-logger.d.ts +9 -0
  76. package/full-dts/utils-string-regex.d.ts +11 -0
  77. package/full-dts/utils-sudo.d.ts +32 -0
  78. package/full-dts/utils-temp-folder.d.ts +29 -0
  79. package/full-dts/utils-terminal.d.ts +171 -0
  80. package/full-dts/utils-time.d.ts +16 -0
  81. package/full-dts/utils-wait-notifier.d.ts +11 -0
  82. package/full-dts/utils.d.ts +100 -0
  83. package/lib/build-info._auto-generated_.d.ts +1 -1
  84. package/lib/build-info._auto-generated_.js +1 -1
  85. package/lib/config.d.ts +2 -2
  86. package/lib/core-imports.d.ts +1 -4
  87. package/lib/framework-name.d.ts +3 -3
  88. package/lib/package.json +1 -1
  89. package/lib/utils-binary.d.ts +1 -9
  90. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  91. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  92. package/lib-esm/lib/config.d.ts +2 -2
  93. package/lib-esm/lib/core-imports.d.ts +1 -4
  94. package/lib-esm/lib/framework-name.d.ts +3 -3
  95. package/lib-esm/lib/utils-binary.d.ts +1 -9
  96. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  97. package/lib-prod/build-info._auto-generated_.js +1 -1
  98. package/lib-prod/package.json +1 -1
  99. package/package.json +1 -1
  100. package/src.d.ts +1 -1
  101. package/websql/package.json +1 -1
  102. package/websql-prod/package.json +1 -1
  103. package/lib/jsonc-parse.test.d.ts +0 -1
  104. package/lib/utils-env.test.d.ts +0 -1
  105. package/lib/utils-json.test.d.ts +0 -1
  106. package/lib/utils-jwt.test.d.ts +0 -1
  107. package/lib/utils-md-docs.test.d.ts +0 -1
  108. package/lib/utils-progress.test.d.ts +0 -1
  109. /package/{lib-esm/lib/utils-imports.test.d.ts → full-dts/index._auto-generated_.d.ts} +0 -0
  110. /package/{lib-esm/lib/utils-projects.test.d.ts → full-dts/json10writer.d.ts} +0 -0
  111. /package/{lib-esm/lib → full-dts}/jsonc-parse.test.d.ts +0 -0
  112. /package/{lib-esm/lib/taon-state-machine.test.d.ts → full-dts/lowdb/examples/browser.d.ts} +0 -0
  113. /package/{lib/utils-imports.test.d.ts → full-dts/lowdb/examples/cli.d.ts} +0 -0
  114. /package/{lib/utils-projects.test.d.ts → full-dts/lowdb/examples/in-memory.d.ts} +0 -0
  115. /package/{lib → full-dts}/taon-state-machine.test.d.ts +0 -0
  116. /package/{lib-esm/lib → full-dts}/utils-env.test.d.ts +0 -0
  117. /package/{lib-esm/lib → full-dts}/utils-json.test.d.ts +0 -0
  118. /package/{lib-esm/lib → full-dts}/utils-jwt.test.d.ts +0 -0
  119. /package/{lib-esm/lib → full-dts}/utils-md-docs.test.d.ts +0 -0
  120. /package/{lib-esm/lib → full-dts}/utils-progress.test.d.ts +0 -0
@@ -0,0 +1,38 @@
1
+ export declare namespace UtilsI18n {
2
+ const defaultLangLocale: UtilsI18n.CommonLocaleCode;
3
+ enum CommonLocaleCodeEnum {
4
+ PL_PL = "pl-PL",
5
+ EN_US = "en-US",
6
+ EN_GB = "en-GB",
7
+ DE_DE = "de-DE",
8
+ FR_FR = "fr-FR",
9
+ ES_ES = "es-ES",
10
+ ZH_CN = "zh-CN"
11
+ }
12
+ const commonLocales: CommonLocaleCode[];
13
+ type CommonLocaleCode = `${CommonLocaleCodeEnum}`;
14
+ interface LangOption {
15
+ code: UtilsI18n.CommonLocaleCode;
16
+ label: string;
17
+ }
18
+ const LangOptionArr: LangOption[];
19
+ function detectLocale(): CommonLocaleCode;
20
+ interface GettextExtracted {
21
+ lineNumber: number;
22
+ gettextString: string;
23
+ context?: string;
24
+ /**
25
+ * translation for specyfic language
26
+ */
27
+ translation?: string;
28
+ }
29
+ interface GettextFile {
30
+ fileAbsPath: string;
31
+ fileRelativePath?: string;
32
+ /**
33
+ * taon thing - file can be for app or lib
34
+ */
35
+ isAppFile?: boolean;
36
+ tags: UtilsI18n.GettextExtracted[];
37
+ }
38
+ }
File without changes
File without changes
@@ -0,0 +1,37 @@
1
+ export declare namespace UtilsJson {
2
+ interface AttrJsoncProp {
3
+ name: string;
4
+ value?: any;
5
+ }
6
+ /**
7
+ * ! TODO handle packages like zone.js with dot
8
+ * Get attributes from jsonc or json5 file
9
+ * @param jsonDeepPath lodash path to property in json ex. deep.path.to.prop
10
+ * @param fileContent jsonc or json5 - json with comments
11
+ * @returns array of attributes
12
+ */
13
+ const getAtrributiesFromJsonWithComments: (jsonDeepPath: string, // lodash path to property in json ex. deep.path.to.prop
14
+ fileContent: string) => AttrJsoncProp[];
15
+ const getAttributiesFromComment: (comment: string, attributes?: AttrJsoncProp[]) => AttrJsoncProp[];
16
+ /**
17
+ * read json from absolute path
18
+ * @returns json object
19
+ */
20
+ const readJson: (absoluteFilePath: string | string[], defaultValue?: {}, useJson5?: boolean) => any;
21
+ const readJsonWithComments: (absoluteFilePath: string | string[], defaultValue?: any) => any;
22
+ const validateLodashPath: (lodashGetPath: string | string[]) => string;
23
+ const getValue: (filepath: string | string[], lodashGetPath: string | string[], options?: {
24
+ defaultValue?: any;
25
+ /**
26
+ * true by default
27
+ */
28
+ isJsonWithComments?: boolean;
29
+ }) => any;
30
+ const setValue: (filepath: string | string[], lodashGetPath: string | string[], value: any, options?: {
31
+ defaultValue?: any;
32
+ /**
33
+ * true by default
34
+ */
35
+ isJsonWithComments?: boolean;
36
+ }) => void;
37
+ }
@@ -0,0 +1,12 @@
1
+ export declare namespace UtilsJwt {
2
+ interface JwtPayload {
3
+ iat?: number;
4
+ exp?: number;
5
+ [key: string]: unknown;
6
+ }
7
+ function sign(payload: JwtPayload, secret: string, options: {
8
+ expiresIn: string | number;
9
+ }): Promise<string>;
10
+ function decode<T extends JwtPayload = JwtPayload>(token: string): T;
11
+ function verify<T extends JwtPayload = JwtPayload>(token: string, secret: string): Promise<T>;
12
+ }
@@ -0,0 +1,21 @@
1
+ export declare namespace UtilsMdDocs {
2
+ interface RenderImport {
3
+ packageName?: string;
4
+ isLocal: boolean;
5
+ relativePath: string;
6
+ context: any;
7
+ rawRenderTagString: string;
8
+ magicRenameRules: string;
9
+ }
10
+ function getRenderImports(mdContent: string): RenderImport[];
11
+ /**
12
+ * extract assets pathes from .md file
13
+ */
14
+ const getAssets: (mdfileContent: string) => string[];
15
+ const getAssetsFromFile: (absPathToFile: string) => string[];
16
+ /**
17
+ * Extract links to other Markdown files from a given Markdown content.
18
+ * @param mdfileContent
19
+ */
20
+ const getLinksToOtherMdFiles: (mdfileContent: string) => string[];
21
+ }
@@ -0,0 +1,79 @@
1
+ import 'reflect-metadata';
2
+ import { URL } from 'url';
3
+ import { Subject } from 'rxjs';
4
+ import { UtilsEtcHosts } from './utils-etc-hosts';
5
+ export declare namespace UtilsNetwork {
6
+ interface PingResult {
7
+ host: string;
8
+ success: boolean;
9
+ timeMs?: number;
10
+ output?: string;
11
+ }
12
+ function checkPing(host: string, timeoutMs?: number): Promise<PingResult>;
13
+ const checkIfServerPings: (host: string, timeoutMs?: number) => Promise<boolean>;
14
+ /**
15
+ * Check if a server is online by attempting to open a TCP connection.
16
+ */
17
+ const checkIfServerOnline: (host: string, port?: number, timeoutMs?: number) => Promise<boolean>;
18
+ const isValidIp: (ip: string) => boolean;
19
+ const isValidDomain: (url: string, options?: {
20
+ /**
21
+ * if yes - domain should start with http:// or https://
22
+ */
23
+ shouldIncludeProtocol?: boolean | "http" | "https";
24
+ }) => boolean;
25
+ const urlParse: (portOrHost: number | string | URL, options?: {
26
+ forceDomain?: boolean;
27
+ httpsIfNotProvided?: boolean;
28
+ }) => URL;
29
+ const getEtcHostsPath: () => string;
30
+ /**
31
+ * Add or update a hosts entry
32
+ */
33
+ const setEtcHost: (domain: string, ip?: string, comment?: string) => void;
34
+ /**
35
+ * @deprecated use UtilsEtcHosts.getEntriesByDomain instead
36
+ */
37
+ const getEtcHostEntriesByDomain: (domain: string) => UtilsEtcHosts.EtchostEntry[];
38
+ /**
39
+ * @deprecated use UtilsEtcHosts.getEntryByComment instead
40
+ */
41
+ const getEtcHostEntryByComment: (commentOfEntry: string) => UtilsEtcHosts.EtchostEntry[];
42
+ /**
43
+ * @deprecated use UtilsEtcHosts.getEntriesByIp instead
44
+ */
45
+ const getEtcHostEntryByIp: (ip: string) => UtilsEtcHosts.EtchostEntry[];
46
+ /**
47
+ * Remove all lines containing the given domain
48
+ * @deprecated use UtilsEtcHosts.removeEntryByDomain instead
49
+ */
50
+ const removeEtcHost: (domain: string) => void;
51
+ const etcHostHasProperLocalhostIp4Entry: () => boolean;
52
+ const etcHostHasProperLocalhostIp6Entry: () => boolean;
53
+ /**
54
+ * @deprecated use UtilsEtcHosts.simulateDomain instead
55
+ */
56
+ const simulateDomain: (domainOrDomains: string | string[], options?: {
57
+ triggerRevertChangesToEtcHosts?: Subject<void>;
58
+ }) => Promise<void>;
59
+ interface LocalIpInfo {
60
+ interfaceName: string;
61
+ address: string;
62
+ family: 'IPv4' | 'IPv6';
63
+ internal: boolean;
64
+ type: 'lan' | 'wifi' | 'other' | 'virtual';
65
+ }
66
+ /**
67
+ * Returns all local IP addresses in preferred order:
68
+ * LAN → Wi-Fi → Other → Virtual
69
+ */
70
+ const getLocalIpAddresses: () => Promise<LocalIpInfo[]>;
71
+ /**
72
+ * Returns first active local ipv4 IP (LAN preferred over Wi-Fi).
73
+ */
74
+ const getFirstIpV4LocalActiveIpAddress: () => Promise<string | null>;
75
+ /**
76
+ * Returns current public IP address (or null if undetectable).
77
+ */
78
+ const getCurrentPublicIpAddress: () => Promise<string | null>;
79
+ }
@@ -0,0 +1,126 @@
1
+ import 'reflect-metadata';
2
+ export declare namespace UtilsOs {
3
+ /**
4
+ * check if script is running in client browser
5
+ * (websql model -> is also considered as browser
6
+ * because it is running in browser)
7
+ */
8
+ const isRunningInBrowser: () => boolean;
9
+ /**
10
+ * check if script is running in nodejs
11
+ * (backend script or electron script)
12
+ */
13
+ const isRunningInNode: () => boolean;
14
+ /**
15
+ * check if script is running special
16
+ * browser mode that has sql.js backend
17
+ * and executes sql queries in browser
18
+ */
19
+ const isRunningInWebSQL: () => boolean;
20
+ const isRunningInSSRMode: () => boolean;
21
+ /**
22
+ * check whether the current process is running inside
23
+ * Cloudflare worker
24
+ */
25
+ const isRunningInCloudflareWorker: () => boolean;
26
+ /**
27
+ * check whether the current process is running inside
28
+ * Electron backend or browser.
29
+ */
30
+ const isRunningInElectron: () => boolean;
31
+ /**
32
+ * Check whether the current process is running inside
33
+ * a Visual Studio Code extension.
34
+ */
35
+ const isRunningInVscodeExtension: () => boolean;
36
+ /**
37
+ * Check wether the current process is running inside
38
+ * windows subsystem for linux (WSL).
39
+ */
40
+ const isRunningInWsl: () => boolean;
41
+ const isRunningInWindowsPowerShell: () => boolean;
42
+ const isRunningInWindowsCmd: () => boolean;
43
+ const isRunningInWindowsGitBash: () => boolean;
44
+ const isRunningInDocker: () => boolean;
45
+ /**
46
+ * check what linux you are running
47
+ */
48
+ const isRunningInLinuxDistro: (linuxType?: "arch" | "ubuntu" | "fedora") => boolean;
49
+ const isRunningInLinuxGraphicsCapableEnvironment: () => boolean;
50
+ const isRunningInOsWithGraphicsCapableEnvironment: () => boolean;
51
+ /**
52
+ * Check whether the current process is running in CLI mode.
53
+ */
54
+ const isRunningInCliMode: () => boolean;
55
+ /**
56
+ * Check whether the current process is running in mocha test.
57
+ */
58
+ const isRunningInMochaTest: () => boolean;
59
+ /**
60
+ * Checks if a given port is already in use (bound by another process).
61
+ *
62
+ * @param port - The port number to check.
63
+ * @param host - The hostname or IP address to bind to (default: '127.0.0.1').
64
+ * @returns Promise<boolean> - Resolves to `true` if the port is in use, otherwise `false`.
65
+ */
66
+ const isPortInUse: (port: number, options?: {
67
+ /**
68
+ * '127.0.0.1' etc..
69
+ */
70
+ checkForSpecificOnlyHost?: string;
71
+ }) => Promise<boolean>;
72
+ /**
73
+ * Check if docker is available on this system
74
+ * and it is running (daemon active)
75
+ */
76
+ const isDockerAvailable: () => Promise<boolean>;
77
+ const openFolderInFileExplorer: (folderPath: string) => void;
78
+ const getRealHomeDir: () => string;
79
+ type Editor = 'code' | 'codium' | 'cursor' | 'theia' | 'idea' | 'idea64';
80
+ type EditorProcess = `${Editor}` | 'code-oss';
81
+ const EditorArr: Editor[];
82
+ const EDITOR_PROCESSES: Record<EditorProcess, string[]>;
83
+ const killAllEditor: (editor: EditorProcess) => void;
84
+ const detectEditor: (options?: {
85
+ fallbackCheckCommandExists?: boolean;
86
+ }) => Editor | undefined;
87
+ const getEditorKeybindingPath: (editor: Editor) => string | undefined;
88
+ const getEditorSettingsJsonPath: (editor: Editor, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv) => string | undefined;
89
+ const isRunningNodeDebugger: () => boolean;
90
+ const isNodeVersionOk: (options?: {
91
+ required?: string;
92
+ log?: boolean;
93
+ throwErrorIfNotOk?: boolean;
94
+ }) => boolean;
95
+ const isElectron: boolean;
96
+ const isBrowser: boolean;
97
+ const isNode: boolean;
98
+ const isWebSQL: boolean;
99
+ const isVscodeExtension: boolean;
100
+ const isSSRMode: boolean;
101
+ const isRunningInWindows: boolean;
102
+ const commandExistsAsync: (commandName: string) => Promise<boolean>;
103
+ /**
104
+ * @deprecated use commandExistsAsync
105
+ */
106
+ const commandExistsSync: (commandName: string) => boolean;
107
+ const pipxPackageExists: (packageName: string) => Promise<boolean>;
108
+ const pipxNestedPackageExists: (mainPackageName: string, targetNestedFromMainPackage: string) => Promise<boolean>;
109
+ const pythonModuleExists: (moduleName: string, pythonPath?: string) => Promise<boolean>;
110
+ const drawHorizontalLine: (row?: number) => void;
111
+ const drawVerticalLine: (col?: number) => void;
112
+ function getInotifyWatchCount(): Promise<number>;
113
+ const sendNotification: (opt: {
114
+ title: string;
115
+ body: string;
116
+ subtitle?: string;
117
+ appName?: string;
118
+ iconPath?: string;
119
+ timeoutMs?: number;
120
+ doneCallback?: () => any;
121
+ }) => Promise<void>;
122
+ function safeExitProgramCleanUp(cleanFn: () => Promise<void> | void): void;
123
+ const whichOrWherePackageLocated: (packageName: string) => string | undefined;
124
+ }
125
+ export declare const taonRepoPathUserInUserDirFn: () => string;
126
+ export declare const taonBasePathToGlobalDockerTemplatesFn: () => string;
@@ -0,0 +1,8 @@
1
+ export declare namespace UtilsPasswords {
2
+ /**
3
+ * Result:
4
+ * v1:<iterations>:<salt-base64>:<hash-base64>
5
+ */
6
+ function hash(password: string): Promise<string>;
7
+ function verify(password: string, storedHash: string): Promise<boolean>;
8
+ }
@@ -0,0 +1,97 @@
1
+ import 'reflect-metadata';
2
+ import { ChildProcess } from 'child_process';
3
+ /**
4
+ * Utils for logging ChildProcess output to files.
5
+ * - logging stdout and stderr to files
6
+ * - real-time monitoring of output
7
+ * - special event callbacks on specific output strings
8
+ * - caching last N lines of output for quick access
9
+ */
10
+ export declare namespace UtilsProcessLogger {
11
+ interface ProcessFileLoggerOptions extends Record<string, string | number | boolean | undefined> {
12
+ name: string;
13
+ id?: string | number;
14
+ pid?: number;
15
+ ppid?: number;
16
+ hash?: string;
17
+ utime?: string;
18
+ }
19
+ interface SpecialEventInProcessLogger {
20
+ stdout?: {
21
+ stringInStream: string;
22
+ callback: (data: string) => void;
23
+ }[];
24
+ stderr?: {
25
+ stringInStream: string;
26
+ callback: (data: string) => void;
27
+ }[];
28
+ }
29
+ const baseDirTaonProcessLogs: () => string;
30
+ const getLogsFiles: <T extends ProcessFileLoggerOptions = ProcessFileLoggerOptions>(options: T, baseDir: string) => string[];
31
+ /**
32
+ * Logs the stdout and stderr of a ChildProcess to a file.
33
+ */
34
+ class ProcessFileLogger<T extends ProcessFileLoggerOptions = ProcessFileLoggerOptions> {
35
+ /**
36
+ * Options used to generate the log file name.
37
+ */
38
+ private dataForFilename;
39
+ private options?;
40
+ private _logFilePath;
41
+ private writeStream;
42
+ private _processLogFilename;
43
+ private lastNLinesFromStderr;
44
+ private lastNLinesFromStdout;
45
+ private lastNLinesFromOfOutput;
46
+ get processLogFilename(): string | null;
47
+ get processLogAbsFilePath(): string | null;
48
+ constructor(
49
+ /**
50
+ * Options used to generate the log file name.
51
+ */
52
+ dataForFilename: T, options?: {
53
+ baseDir?: string;
54
+ specialEvent?: SpecialEventInProcessLogger;
55
+ });
56
+ startLogging(proc: ChildProcess, cacheCallback?: {
57
+ /**
58
+ * @default 40
59
+ */
60
+ cacheLinesMax?: number;
61
+ /**
62
+ * Throttle in ms for callback update()
63
+ */
64
+ throttleMs?: number;
65
+ /**
66
+ * Special callback function for saving stuff in db/memory or elsewhere
67
+ */
68
+ update: (opt: {
69
+ outputLines: string;
70
+ stderrLines: string;
71
+ stdoutLines: string;
72
+ }) => void;
73
+ }): void;
74
+ stopLogging(): void;
75
+ /**
76
+ * Externally update the log file with additional stdout/stderr data.
77
+ */
78
+ update(stdout: string, stderr?: string): void;
79
+ }
80
+ /**
81
+ * Perfect for real-time logs with a sticky top box message.
82
+ *
83
+ * Example:
84
+ * const stickyBox = UtilsProcessLogger.createStickyTopBox('My Sticky Message');
85
+ * stickyBox.update('Initial log content...');
86
+ *
87
+ * // Later updates
88
+ * stickyBox.update('More log content...');
89
+ *
90
+ * // To clear the sticky box and logs
91
+ * stickyBox.clear();
92
+ */
93
+ const createStickyTopBox: (message: string) => {
94
+ update: (content: string) => void;
95
+ clear: () => void;
96
+ };
97
+ }
@@ -0,0 +1,93 @@
1
+ import 'reflect-metadata';
2
+ import { ChildProcess } from 'child_process';
3
+ export declare namespace UtilsProcess {
4
+ /**
5
+ * This let you start child process and resolve promise when some
6
+ * condition is met. It is useful for example when you want to start
7
+ * process and wait until some output is in stdout or stderr.
8
+ */
9
+ const startAsyncChildProcessCommandUntil: (command: string, options: {
10
+ /**
11
+ * tels when to resolve promise
12
+ */
13
+ untilOptions: {
14
+ /**
15
+ * until this string is in output of stdout
16
+ */
17
+ stdout?: string | string[];
18
+ /**
19
+ * until this string is in output of stderr
20
+ */
21
+ stderr?: string | string[];
22
+ /**
23
+ * by default only resolve when exit code is 0
24
+ */
25
+ resolveAfterAnyExitCode?: boolean;
26
+ };
27
+ displayOutputInParentProcess?: boolean;
28
+ resolveAfterAnyExitCode?: boolean;
29
+ cwd?: string;
30
+ }) => Promise<void>;
31
+ const getGitBashPath: () => string;
32
+ /**
33
+ * TODO IMPLEMENT
34
+ * start async node process
35
+ */
36
+ const startInNewTerminalWindow: (command: string, options?: {
37
+ cwd?: string;
38
+ hideOutput?: {
39
+ stdout?: boolean;
40
+ stderr?: boolean;
41
+ acceptAllExitCodeAsSuccess?: boolean;
42
+ };
43
+ }) => any;
44
+ const getBashOrShellName: () => "browser" | "cmd" | "powershell" | "gitbash" | "cygwin" | "unknown" | "bash" | "zsh" | "fish" | "sh";
45
+ /**
46
+ * Get CPU and memory usage for a single PID.
47
+ */
48
+ const getUsageForPid: (pid: number) => Promise<{
49
+ cpu: number;
50
+ memoryInGB: number;
51
+ memoryInMB: number;
52
+ }>;
53
+ /**
54
+ * Cross-platform function to list *direct* child PIDs of a given PID.
55
+ * Uses the appropriate command depending on `process.platform`.
56
+ */
57
+ function getChildPidsOnce(pid: number): Promise<number[]>;
58
+ /**
59
+ * Get CPU and memory usage for the current process (the Node.js process itself),
60
+ * plus any child processes spawned by it.
61
+ */
62
+ const getCurrentProcessAndChildUsage: () => Promise<{
63
+ current: {
64
+ cpu: number;
65
+ memoryInMB: number;
66
+ };
67
+ children: Array<{
68
+ pid: number;
69
+ cpu: number;
70
+ memoryInMB: number;
71
+ }>;
72
+ }>;
73
+ /**
74
+ * Kills all running Java processes cross‑platform.
75
+ * @returns Promise<boolean> true if processes were killed, false if none found
76
+ */
77
+ const killAllJava: () => Promise<boolean>;
78
+ const killProcess: (pidOrProcess: number | ChildProcess) => Promise<void>;
79
+ const killProcessOnPort: (port: number) => Promise<boolean>;
80
+ /**
81
+ * Kills all Node.js processes except the current process.
82
+ * Works on Windows, macOS, and Linux.
83
+ * @returns {number} Number of processes killed
84
+ */
85
+ const killAllOtherNodeProcesses: () => Promise<void>;
86
+ const isNodeVersionOk: (options?: {
87
+ required?: string;
88
+ log?: boolean;
89
+ throwErrorIfNotOk?: boolean;
90
+ }) => boolean;
91
+ function isCurrentProcessAttachedToTerminal(): boolean;
92
+ const getPathOfExecutable: (command: string) => Promise<string | null>;
93
+ }
@@ -0,0 +1,26 @@
1
+ export declare namespace UtilsProgress {
2
+ type TaonProgressType = 'info' | 'warning' | 'error' | 'event';
3
+ interface TaonProgressEvent {
4
+ /**
5
+ * Absolute progress value from 0 to 100.
6
+ */
7
+ value?: number;
8
+ message?: string;
9
+ type?: TaonProgressType;
10
+ /**
11
+ * ISO date string.
12
+ */
13
+ date?: string;
14
+ }
15
+ interface ResolveProgressOptions {
16
+ callbackOnFounded?: (event: TaonProgressEvent) => void;
17
+ /**
18
+ * When enabled, malformed progress messages are logged.
19
+ */
20
+ logParseErrors?: boolean;
21
+ }
22
+ function emitProgress(event: TaonProgressEvent, forceShow?: boolean): void;
23
+ function resolveFrom(chunk: string, options?: ResolveProgressOptions, checkSplit?: boolean): TaonProgressEvent[];
24
+ function hasProgressEvent(chunk: string): boolean;
25
+ function parseTaonProgressLine(line: string): TaonProgressEvent | undefined;
26
+ }