@open-wa/utils 5.0.0-alpha.8 → 5.0.0
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/LICENSE.md +2 -2
- package/README.md +1 -1
- package/dist/index.cjs +19 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
package/LICENSE.md
CHANGED
|
@@ -55,9 +55,9 @@ Licensor hereby grants permission by this license ("License"), free of charge,
|
|
|
55
55
|
4. Compliance with Human Rights Laws and Human Rights Principles:
|
|
56
56
|
|
|
57
57
|
a. **Human Rights Laws**. The Software shall not be used by any person or entity for any systems, activities, or other uses that violate any applicable laws, regulations, or rules that protect human, civil, labor, privacy, political, environmental, security, economic, due process, or similar rights (the "Human Rights Laws"). Where the Human Rights Laws of more than one jurisdiction are applicable to the use of the Software, the Human Rights Laws that are most protective of the individuals or groups harmed shall apply.
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
b. **Human Rights Principles**. Licensee is advised to consult the articles of the United Nations Universal Declaration of Human Rights (https://www.un.org/en/universal-declaration-human-rights/) and the United Nations Global Compact (https://www.unglobalcompact.org/ what-is-gc/mission/principles) that define recognized principles of international human rights (the "Human Rights Principles"). It is Licensor's express intent that all use of the Software be consistent with Human Rights Principles. If Licensor receives notification or otherwise learns of an alleged violation of any Human Rights Principles relating to Licensee's use of the Software, Licensor may in its discretion and without obligation (i) (a) notify Licensee of such allegation and (b) allow Licensee 90 days from notification under (i)(a) to investigate and respond to Licensor regarding the allegation and (ii) (a) after the earlier of 90 days from notification under (i)(a), or Licensee's response under (i)(b), notify Licensee of License termination and (b) allow Licensee an additional 90 days from notification under (ii)(a) to cease use of the Software.
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
c. **Indemnity**. Licensee shall hold harmless and indemnify Licensor against all losses, damages, liabilities, deficiencies, claims, actions, judgments, settlements, interest, awards, penalties, fines, costs, or expenses of whatever kind, including Licensor's reasonable attorneys' fees, arising out of or relating to Licensee's non-compliance with this License or use of the Software in violation of Human Rights Laws or Human Rights Principles.
|
|
62
62
|
|
|
63
63
|
5. Enforceability: If any portion or provision of this License is determined to be invalid, illegal, or unenforceable by a court of competent jurisdiction, then such invalidity, illegality, or unenforceability shall not affect any other term or provision of this License or invalidate or render unenforceable such term or provision in any other jurisdiction. Upon a determination that any term or provision is invalid, illegal, or unenforceable, to the extent permitted by applicable law, the court may modify this License to affect the original intent of the parties as closely as possible. The section headings are for convenience only and are not intended to affect the construction or interpretation of this License. Any rule of construction to the effect that ambiguities are to be resolved against the drafting party shall not apply in interpreting this License. The language in this License shall be interpreted as to its fair meaning and not strictly for or against any party.
|
package/README.md
CHANGED
|
@@ -16,4 +16,4 @@ See the [docs site](https://openwa.dev).
|
|
|
16
16
|
|
|
17
17
|
## License
|
|
18
18
|
|
|
19
|
-
[H-DNH
|
|
19
|
+
[H-DNH 1.1](https://github.com/open-wa/wa-automate-nodejs/blob/master/LICENSE.md) — Hippocratic + Do Not Harm
|
package/dist/index.cjs
CHANGED
|
@@ -16,25 +16,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
24
|
let fs = require("fs");
|
|
25
|
-
fs = __toESM(fs);
|
|
25
|
+
fs = __toESM(fs, 1);
|
|
26
26
|
let path = require("path");
|
|
27
|
-
path = __toESM(path);
|
|
27
|
+
path = __toESM(path, 1);
|
|
28
28
|
let crypto = require("crypto");
|
|
29
|
-
crypto = __toESM(crypto);
|
|
29
|
+
crypto = __toESM(crypto, 1);
|
|
30
30
|
let os = require("os");
|
|
31
31
|
let stream = require("stream");
|
|
32
32
|
let pidtree = require("pidtree");
|
|
33
|
-
pidtree = __toESM(pidtree);
|
|
33
|
+
pidtree = __toESM(pidtree, 1);
|
|
34
34
|
let pidusage = require("pidusage");
|
|
35
|
-
pidusage = __toESM(pidusage);
|
|
35
|
+
pidusage = __toESM(pidusage, 1);
|
|
36
36
|
let json5 = require("json5");
|
|
37
|
-
json5 = __toESM(json5);
|
|
37
|
+
json5 = __toESM(json5, 1);
|
|
38
38
|
//#region src/file.ts
|
|
39
39
|
const isUrl = (s) => {
|
|
40
40
|
try {
|
|
@@ -62,15 +62,16 @@ const getDUrl = async (url) => {
|
|
|
62
62
|
const assertFile = async (input, outputType) => {
|
|
63
63
|
let dUrl;
|
|
64
64
|
if (Buffer.isBuffer(input)) dUrl = `data:application/octet-stream;base64,${input.toString("base64")}`;
|
|
65
|
-
else if (typeof input === "string")
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
else if (typeof input === "string") {
|
|
66
|
+
if (isDataUrl(input)) dUrl = input;
|
|
67
|
+
else if (isBase64(input)) dUrl = `data:application/octet-stream;base64,${input}`;
|
|
68
|
+
else if (isUrl(input)) dUrl = await getDUrl(input);
|
|
69
|
+
else {
|
|
70
|
+
const resolvedPath = path.resolve(process.cwd(), input);
|
|
71
|
+
if (fs.existsSync(resolvedPath)) dUrl = `data:application/octet-stream;base64,${(await fs.promises.readFile(resolvedPath)).toString("base64")}`;
|
|
72
|
+
else throw new Error(`Cannot find file or process input: ${input.slice(0, 25)}`);
|
|
73
|
+
}
|
|
74
|
+
} else throw new Error("Invalid file input");
|
|
74
75
|
if (dUrl.includes("data:") && dUrl.includes("undefined")) dUrl = dUrl.replace("undefined", "application/octet-stream");
|
|
75
76
|
const base64 = dUrl.split(",")[1] || dUrl;
|
|
76
77
|
switch (outputType) {
|
|
@@ -91,7 +92,8 @@ const pidTreeUsage = async (pid) => {
|
|
|
91
92
|
let pidArray = Array.isArray(pid) ? pid : [pid];
|
|
92
93
|
try {
|
|
93
94
|
const pids = (await Promise.all(pidArray.map((p) => (0, pidtree.default)(p)))).flat();
|
|
94
|
-
|
|
95
|
+
const allPids = Array.from(/* @__PURE__ */ new Set([...pidArray, ...pids]));
|
|
96
|
+
return await (0, pidusage.default)(allPids);
|
|
95
97
|
} catch (error) {
|
|
96
98
|
console.error("Error fetching PID tree usage:", error);
|
|
97
99
|
return {};
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Readable","JSON5"],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as crypto from 'crypto';\nimport { tmpdir } from 'os';\nimport { Readable } from 'stream';\n\nexport const isUrl = (s: string) => {\n try {\n new URL(s);\n return true;\n } catch {\n return false;\n }\n};\n\nexport const isDataUrl = (s: string) => typeof s === 'string' && !!s.match(/^data:((?:\\w+\\/(?:(?!;).)+)?)((?:;[\\w\\W]*?[^;])*),(.+)$/g);\n\nexport const isBase64 = (s: string) => {\n if (typeof s !== 'string') return false;\n const len = s.length;\n if (!len || len % 4 !== 0 || /[^A-Z0-9+/=]/i.test(s)) return false;\n const firstPaddingChar = s.indexOf('=');\n return firstPaddingChar === -1 || firstPaddingChar === len - 1 || (firstPaddingChar === len - 2 && s[len - 1] === '=');\n};\n\nexport const getDUrl = async (url: string): Promise<string> => {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.statusText}`);\n const mime = res.headers.get('content-type') || 'application/octet-stream';\n const arrayBuffer = await res.arrayBuffer();\n const base64 = Buffer.from(arrayBuffer).toString('base64');\n return `data:${mime};base64,${base64}`;\n}\n\nexport const assertFile = async (input: any, outputType: string): Promise<any> => {\n let dUrl: string;\n\n if (Buffer.isBuffer(input)) {\n dUrl = `data:application/octet-stream;base64,${input.toString('base64')}`;\n } else if (typeof input === 'string') {\n if (isDataUrl(input)) dUrl = input;\n else if (isBase64(input)) dUrl = `data:application/octet-stream;base64,${input}`;\n else if (isUrl(input)) dUrl = await getDUrl(input);\n else {\n const resolvedPath = path.resolve(process.cwd(), input);\n if (fs.existsSync(resolvedPath)) {\n const buffer = await fs.promises.readFile(resolvedPath);\n dUrl = `data:application/octet-stream;base64,${buffer.toString('base64')}`;\n } else {\n throw new Error(`Cannot find file or process input: ${input.slice(0, 25)}`);\n }\n }\n } else {\n throw new Error('Invalid file input');\n }\n\n if (dUrl.includes('data:') && dUrl.includes('undefined')) {\n dUrl = dUrl.replace('undefined', 'application/octet-stream');\n }\n\n const base64 = dUrl.split(',')[1] || dUrl;\n\n switch (outputType) {\n case 'DATA_URL':\n return dUrl;\n case 'BASE_64':\n return base64;\n case 'BUFFER':\n return Buffer.from(base64, 'base64');\n case 'TEMP_FILE_PATH':\n const tempFilePath = path.join(tmpdir(), `${crypto.randomBytes(6).toString('hex')}.tmp`);\n await fs.promises.writeFile(tempFilePath, Buffer.from(base64, 'base64'));\n return tempFilePath;\n case 'READ_STREAM':\n return Readable.from(Buffer.from(base64, 'base64'));\n default:\n return input;\n }\n};\n","import pidtree from 'pidtree';\nimport pidusage from 'pidusage';\n\ntype PidStat = { cpu: number; memory: number; ppid: number; pid: number; ctime: number; elapsed: number; timestamp: number };\n\nexport const pidTreeUsage = async (pid: number | number[]): Promise<{ [key: string]: PidStat } | Record<string, never>> => {\n let pidArray = Array.isArray(pid) ? pid : [pid];\n try {\n const pids: number[] = (await Promise.all(pidArray.map(p => pidtree(p)))).flat() as number[];\n // Include the original pids in the list for measurement\n const allPids = Array.from(new Set([...pidArray, ...pids]));\n const stats = await pidusage(allPids);\n return stats;\n } catch (error) {\n console.error('Error fetching PID tree usage:', error);\n return {};\n }\n};\n","import * as path from 'path';\nimport * as fs from 'fs';\nimport JSON5 from 'json5';\n\nexport const tryOpenFileAsObject = async (fileLocation: string, needArray = false): Promise<any> => {\n let res: any = undefined;\n const relativePath = path.join(path.resolve(process.cwd(), fileLocation || ''));\n const isJs = fileLocation.endsWith('.js') || fileLocation.endsWith('.cjs') || fileLocation.endsWith('.mjs');\n\n if (fs.existsSync(fileLocation) || fs.existsSync(relativePath)) {\n const fp: string = isJs\n ? (fs.existsSync(relativePath) ? relativePath : fileLocation)\n : (fs.existsSync(fileLocation) ? fileLocation : relativePath);\n\n try {\n let data;\n if (isJs) {\n // We use dynamic import for JS files in ESM context\n const imported = await import(path.resolve(fp));\n data = imported.default || imported;\n } else {\n data = JSON5.parse(fs.readFileSync(fp, 'utf8'));\n }\n\n if (data && (Array.isArray(data) === needArray)) res = data;\n if (data && typeof data === 'function') {\n res = await data(process.env.CURRENT_SESSION_ID || 'session');\n }\n } catch (error) {\n throw new Error(`Unable to parse config file. Please make sure ${fp} is valid. Error: ${error}`);\n }\n\n return res ? {\n ...res,\n confPath: fp\n } : undefined;\n }\n\n return undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAa,SAAS,MAAc;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["tmpdir","Readable","JSON5"],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as crypto from 'crypto';\nimport { tmpdir } from 'os';\nimport { Readable } from 'stream';\n\nexport const isUrl = (s: string) => {\n try {\n new URL(s);\n return true;\n } catch {\n return false;\n }\n};\n\nexport const isDataUrl = (s: string) => typeof s === 'string' && !!s.match(/^data:((?:\\w+\\/(?:(?!;).)+)?)((?:;[\\w\\W]*?[^;])*),(.+)$/g);\n\nexport const isBase64 = (s: string) => {\n if (typeof s !== 'string') return false;\n const len = s.length;\n if (!len || len % 4 !== 0 || /[^A-Z0-9+/=]/i.test(s)) return false;\n const firstPaddingChar = s.indexOf('=');\n return firstPaddingChar === -1 || firstPaddingChar === len - 1 || (firstPaddingChar === len - 2 && s[len - 1] === '=');\n};\n\nexport const getDUrl = async (url: string): Promise<string> => {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.statusText}`);\n const mime = res.headers.get('content-type') || 'application/octet-stream';\n const arrayBuffer = await res.arrayBuffer();\n const base64 = Buffer.from(arrayBuffer).toString('base64');\n return `data:${mime};base64,${base64}`;\n}\n\nexport const assertFile = async (input: any, outputType: string): Promise<any> => {\n let dUrl: string;\n\n if (Buffer.isBuffer(input)) {\n dUrl = `data:application/octet-stream;base64,${input.toString('base64')}`;\n } else if (typeof input === 'string') {\n if (isDataUrl(input)) dUrl = input;\n else if (isBase64(input)) dUrl = `data:application/octet-stream;base64,${input}`;\n else if (isUrl(input)) dUrl = await getDUrl(input);\n else {\n const resolvedPath = path.resolve(process.cwd(), input);\n if (fs.existsSync(resolvedPath)) {\n const buffer = await fs.promises.readFile(resolvedPath);\n dUrl = `data:application/octet-stream;base64,${buffer.toString('base64')}`;\n } else {\n throw new Error(`Cannot find file or process input: ${input.slice(0, 25)}`);\n }\n }\n } else {\n throw new Error('Invalid file input');\n }\n\n if (dUrl.includes('data:') && dUrl.includes('undefined')) {\n dUrl = dUrl.replace('undefined', 'application/octet-stream');\n }\n\n const base64 = dUrl.split(',')[1] || dUrl;\n\n switch (outputType) {\n case 'DATA_URL':\n return dUrl;\n case 'BASE_64':\n return base64;\n case 'BUFFER':\n return Buffer.from(base64, 'base64');\n case 'TEMP_FILE_PATH':\n const tempFilePath = path.join(tmpdir(), `${crypto.randomBytes(6).toString('hex')}.tmp`);\n await fs.promises.writeFile(tempFilePath, Buffer.from(base64, 'base64'));\n return tempFilePath;\n case 'READ_STREAM':\n return Readable.from(Buffer.from(base64, 'base64'));\n default:\n return input;\n }\n};\n","import pidtree from 'pidtree';\nimport pidusage from 'pidusage';\n\ntype PidStat = { cpu: number; memory: number; ppid: number; pid: number; ctime: number; elapsed: number; timestamp: number };\n\nexport const pidTreeUsage = async (pid: number | number[]): Promise<{ [key: string]: PidStat } | Record<string, never>> => {\n let pidArray = Array.isArray(pid) ? pid : [pid];\n try {\n const pids: number[] = (await Promise.all(pidArray.map(p => pidtree(p)))).flat() as number[];\n // Include the original pids in the list for measurement\n const allPids = Array.from(new Set([...pidArray, ...pids]));\n const stats = await pidusage(allPids);\n return stats;\n } catch (error) {\n console.error('Error fetching PID tree usage:', error);\n return {};\n }\n};\n","import * as path from 'path';\nimport * as fs from 'fs';\nimport JSON5 from 'json5';\n\nexport const tryOpenFileAsObject = async (fileLocation: string, needArray = false): Promise<any> => {\n let res: any = undefined;\n const relativePath = path.join(path.resolve(process.cwd(), fileLocation || ''));\n const isJs = fileLocation.endsWith('.js') || fileLocation.endsWith('.cjs') || fileLocation.endsWith('.mjs');\n\n if (fs.existsSync(fileLocation) || fs.existsSync(relativePath)) {\n const fp: string = isJs\n ? (fs.existsSync(relativePath) ? relativePath : fileLocation)\n : (fs.existsSync(fileLocation) ? fileLocation : relativePath);\n\n try {\n let data;\n if (isJs) {\n // We use dynamic import for JS files in ESM context\n const imported = await import(path.resolve(fp));\n data = imported.default || imported;\n } else {\n data = JSON5.parse(fs.readFileSync(fp, 'utf8'));\n }\n\n if (data && (Array.isArray(data) === needArray)) res = data;\n if (data && typeof data === 'function') {\n res = await data(process.env.CURRENT_SESSION_ID || 'session');\n }\n } catch (error) {\n throw new Error(`Unable to parse config file. Please make sure ${fp} is valid. Error: ${error}`);\n }\n\n return res ? {\n ...res,\n confPath: fp\n } : undefined;\n }\n\n return undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MA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AAK,QAAQ,QAAQ,IAAI,GAAG,gBAAgB,EAAE,CAAC;CAC9E,MAAM,OAAO,aAAa,SAAS,KAAK,KAAK,aAAa,SAAS,MAAM,KAAK,aAAa,SAAS,MAAM;CAE1G,IAAI,GAAG,WAAW,YAAY,KAAK,GAAG,WAAW,YAAY,GAAG;EAC5D,MAAM,KAAa,OACZ,GAAG,WAAW,YAAY,IAAI,eAAe,eAC7C,GAAG,WAAW,YAAY,IAAI,eAAe;EAEpD,IAAI;GACA,IAAI;GACJ,IAAI,MAAM;IAEN,MAAM,WAAW,MAAM,OAAO,KAAK,QAAQ,EAAE;IAC7C,OAAO,SAAS,WAAW;GAC/B,OACI,OAAOC,MAAAA,QAAM,MAAM,GAAG,aAAa,IAAI,MAAM,CAAC;GAGlD,IAAI,QAAS,MAAM,QAAQ,IAAI,MAAM,WAAY,MAAM;GACvD,IAAI,QAAQ,OAAO,SAAS,YACxB,MAAM,MAAM,KAAK,QAAQ,IAAI,sBAAsB,SAAS;EAEpE,SAAS,OAAO;GACZ,MAAM,IAAI,MAAM,iDAAiD,GAAG,oBAAoB,OAAO;EACnG;EAEA,OAAO,MAAM;GACT,GAAG;GACH,UAAU;EACd,IAAI,KAAA;CACR;AAGJ"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/file.d.ts
|
|
2
|
-
declare const isUrl: (s: string) => boolean;
|
|
3
|
-
declare const isDataUrl: (s: string) => boolean;
|
|
4
|
-
declare const isBase64: (s: string) => boolean;
|
|
5
|
-
declare const getDUrl: (url: string) => Promise<string>;
|
|
6
|
-
declare const assertFile: (input: any, outputType: string) => Promise<any>;
|
|
2
|
+
export declare const isUrl: (s: string) => boolean;
|
|
3
|
+
export declare const isDataUrl: (s: string) => boolean;
|
|
4
|
+
export declare const isBase64: (s: string) => boolean;
|
|
5
|
+
export declare const getDUrl: (url: string) => Promise<string>;
|
|
6
|
+
export declare const assertFile: (input: any, outputType: string) => Promise<any>;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/system.d.ts
|
|
9
9
|
type PidStat = {
|
|
@@ -15,12 +15,11 @@ type PidStat = {
|
|
|
15
15
|
elapsed: number;
|
|
16
16
|
timestamp: number;
|
|
17
17
|
};
|
|
18
|
-
declare const pidTreeUsage: (pid: number | number[]) => Promise<{
|
|
18
|
+
export declare const pidTreeUsage: (pid: number | number[]) => Promise<{
|
|
19
19
|
[key: string]: PidStat;
|
|
20
20
|
} | Record<string, never>>;
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/configLoader.d.ts
|
|
23
|
-
declare const tryOpenFileAsObject: (fileLocation: string, needArray?: boolean) => Promise<any>;
|
|
23
|
+
export declare const tryOpenFileAsObject: (fileLocation: string, needArray?: boolean) => Promise<any>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { assertFile, getDUrl, isBase64, isDataUrl, isUrl, pidTreeUsage, tryOpenFileAsObject };
|
|
26
25
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"mappings":";qBAMa,QAAK;qBASL,YAAS;qBAET,WAAQ;qBAQR,UAAO,gBAAwB;qBAS/B,aAAU,YAAoB,uBAAuB;;;KC/B7D;EAAY;EAAa;EAAgB;EAAc;EAAa;EAAe;EAAiB;;qBAE5F,eAAY,2BAAmC;GAAW,cAAc;IAAY;;;qBCDpF,sBAAmB,sBAA8B,wBAAsB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/file.d.ts
|
|
2
|
-
declare const isUrl: (s: string) => boolean;
|
|
3
|
-
declare const isDataUrl: (s: string) => boolean;
|
|
4
|
-
declare const isBase64: (s: string) => boolean;
|
|
5
|
-
declare const getDUrl: (url: string) => Promise<string>;
|
|
6
|
-
declare const assertFile: (input: any, outputType: string) => Promise<any>;
|
|
2
|
+
export declare const isUrl: (s: string) => boolean;
|
|
3
|
+
export declare const isDataUrl: (s: string) => boolean;
|
|
4
|
+
export declare const isBase64: (s: string) => boolean;
|
|
5
|
+
export declare const getDUrl: (url: string) => Promise<string>;
|
|
6
|
+
export declare const assertFile: (input: any, outputType: string) => Promise<any>;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/system.d.ts
|
|
9
9
|
type PidStat = {
|
|
@@ -15,12 +15,11 @@ type PidStat = {
|
|
|
15
15
|
elapsed: number;
|
|
16
16
|
timestamp: number;
|
|
17
17
|
};
|
|
18
|
-
declare const pidTreeUsage: (pid: number | number[]) => Promise<{
|
|
18
|
+
export declare const pidTreeUsage: (pid: number | number[]) => Promise<{
|
|
19
19
|
[key: string]: PidStat;
|
|
20
20
|
} | Record<string, never>>;
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/configLoader.d.ts
|
|
23
|
-
declare const tryOpenFileAsObject: (fileLocation: string, needArray?: boolean) => Promise<any>;
|
|
23
|
+
export declare const tryOpenFileAsObject: (fileLocation: string, needArray?: boolean) => Promise<any>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { assertFile, getDUrl, isBase64, isDataUrl, isUrl, pidTreeUsage, tryOpenFileAsObject };
|
|
26
25
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"mappings":";qBAMa,QAAK;qBASL,YAAS;qBAET,WAAQ;qBAQR,UAAO,gBAAwB;qBAS/B,aAAU,YAAoB,uBAAuB;;;KC/B7D;EAAY;EAAa;EAAgB;EAAc;EAAa;EAAe;EAAiB;;qBAE5F,eAAY,2BAAmC;GAAW,cAAc;IAAY;;;qBCDpF,sBAAmB,sBAA8B,wBAAsB"}
|
package/dist/index.mjs
CHANGED
|
@@ -33,15 +33,16 @@ const getDUrl = async (url) => {
|
|
|
33
33
|
const assertFile = async (input, outputType) => {
|
|
34
34
|
let dUrl;
|
|
35
35
|
if (Buffer.isBuffer(input)) dUrl = `data:application/octet-stream;base64,${input.toString("base64")}`;
|
|
36
|
-
else if (typeof input === "string")
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
else if (typeof input === "string") {
|
|
37
|
+
if (isDataUrl(input)) dUrl = input;
|
|
38
|
+
else if (isBase64(input)) dUrl = `data:application/octet-stream;base64,${input}`;
|
|
39
|
+
else if (isUrl(input)) dUrl = await getDUrl(input);
|
|
40
|
+
else {
|
|
41
|
+
const resolvedPath = path.resolve(process.cwd(), input);
|
|
42
|
+
if (fs.existsSync(resolvedPath)) dUrl = `data:application/octet-stream;base64,${(await fs.promises.readFile(resolvedPath)).toString("base64")}`;
|
|
43
|
+
else throw new Error(`Cannot find file or process input: ${input.slice(0, 25)}`);
|
|
44
|
+
}
|
|
45
|
+
} else throw new Error("Invalid file input");
|
|
45
46
|
if (dUrl.includes("data:") && dUrl.includes("undefined")) dUrl = dUrl.replace("undefined", "application/octet-stream");
|
|
46
47
|
const base64 = dUrl.split(",")[1] || dUrl;
|
|
47
48
|
switch (outputType) {
|
|
@@ -62,7 +63,8 @@ const pidTreeUsage = async (pid) => {
|
|
|
62
63
|
let pidArray = Array.isArray(pid) ? pid : [pid];
|
|
63
64
|
try {
|
|
64
65
|
const pids = (await Promise.all(pidArray.map((p) => pidtree(p)))).flat();
|
|
65
|
-
|
|
66
|
+
const allPids = Array.from(/* @__PURE__ */ new Set([...pidArray, ...pids]));
|
|
67
|
+
return await pidusage(allPids);
|
|
66
68
|
} catch (error) {
|
|
67
69
|
console.error("Error fetching PID tree usage:", error);
|
|
68
70
|
return {};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as crypto from 'crypto';\nimport { tmpdir } from 'os';\nimport { Readable } from 'stream';\n\nexport const isUrl = (s: string) => {\n try {\n new URL(s);\n return true;\n } catch {\n return false;\n }\n};\n\nexport const isDataUrl = (s: string) => typeof s === 'string' && !!s.match(/^data:((?:\\w+\\/(?:(?!;).)+)?)((?:;[\\w\\W]*?[^;])*),(.+)$/g);\n\nexport const isBase64 = (s: string) => {\n if (typeof s !== 'string') return false;\n const len = s.length;\n if (!len || len % 4 !== 0 || /[^A-Z0-9+/=]/i.test(s)) return false;\n const firstPaddingChar = s.indexOf('=');\n return firstPaddingChar === -1 || firstPaddingChar === len - 1 || (firstPaddingChar === len - 2 && s[len - 1] === '=');\n};\n\nexport const getDUrl = async (url: string): Promise<string> => {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.statusText}`);\n const mime = res.headers.get('content-type') || 'application/octet-stream';\n const arrayBuffer = await res.arrayBuffer();\n const base64 = Buffer.from(arrayBuffer).toString('base64');\n return `data:${mime};base64,${base64}`;\n}\n\nexport const assertFile = async (input: any, outputType: string): Promise<any> => {\n let dUrl: string;\n\n if (Buffer.isBuffer(input)) {\n dUrl = `data:application/octet-stream;base64,${input.toString('base64')}`;\n } else if (typeof input === 'string') {\n if (isDataUrl(input)) dUrl = input;\n else if (isBase64(input)) dUrl = `data:application/octet-stream;base64,${input}`;\n else if (isUrl(input)) dUrl = await getDUrl(input);\n else {\n const resolvedPath = path.resolve(process.cwd(), input);\n if (fs.existsSync(resolvedPath)) {\n const buffer = await fs.promises.readFile(resolvedPath);\n dUrl = `data:application/octet-stream;base64,${buffer.toString('base64')}`;\n } else {\n throw new Error(`Cannot find file or process input: ${input.slice(0, 25)}`);\n }\n }\n } else {\n throw new Error('Invalid file input');\n }\n\n if (dUrl.includes('data:') && dUrl.includes('undefined')) {\n dUrl = dUrl.replace('undefined', 'application/octet-stream');\n }\n\n const base64 = dUrl.split(',')[1] || dUrl;\n\n switch (outputType) {\n case 'DATA_URL':\n return dUrl;\n case 'BASE_64':\n return base64;\n case 'BUFFER':\n return Buffer.from(base64, 'base64');\n case 'TEMP_FILE_PATH':\n const tempFilePath = path.join(tmpdir(), `${crypto.randomBytes(6).toString('hex')}.tmp`);\n await fs.promises.writeFile(tempFilePath, Buffer.from(base64, 'base64'));\n return tempFilePath;\n case 'READ_STREAM':\n return Readable.from(Buffer.from(base64, 'base64'));\n default:\n return input;\n }\n};\n","import pidtree from 'pidtree';\nimport pidusage from 'pidusage';\n\ntype PidStat = { cpu: number; memory: number; ppid: number; pid: number; ctime: number; elapsed: number; timestamp: number };\n\nexport const pidTreeUsage = async (pid: number | number[]): Promise<{ [key: string]: PidStat } | Record<string, never>> => {\n let pidArray = Array.isArray(pid) ? pid : [pid];\n try {\n const pids: number[] = (await Promise.all(pidArray.map(p => pidtree(p)))).flat() as number[];\n // Include the original pids in the list for measurement\n const allPids = Array.from(new Set([...pidArray, ...pids]));\n const stats = await pidusage(allPids);\n return stats;\n } catch (error) {\n console.error('Error fetching PID tree usage:', error);\n return {};\n }\n};\n","import * as path from 'path';\nimport * as fs from 'fs';\nimport JSON5 from 'json5';\n\nexport const tryOpenFileAsObject = async (fileLocation: string, needArray = false): Promise<any> => {\n let res: any = undefined;\n const relativePath = path.join(path.resolve(process.cwd(), fileLocation || ''));\n const isJs = fileLocation.endsWith('.js') || fileLocation.endsWith('.cjs') || fileLocation.endsWith('.mjs');\n\n if (fs.existsSync(fileLocation) || fs.existsSync(relativePath)) {\n const fp: string = isJs\n ? (fs.existsSync(relativePath) ? relativePath : fileLocation)\n : (fs.existsSync(fileLocation) ? fileLocation : relativePath);\n\n try {\n let data;\n if (isJs) {\n // We use dynamic import for JS files in ESM context\n const imported = await import(path.resolve(fp));\n data = imported.default || imported;\n } else {\n data = JSON5.parse(fs.readFileSync(fp, 'utf8'));\n }\n\n if (data && (Array.isArray(data) === needArray)) res = data;\n if (data && typeof data === 'function') {\n res = await data(process.env.CURRENT_SESSION_ID || 'session');\n }\n } catch (error) {\n throw new Error(`Unable to parse config file. Please make sure ${fp} is valid. Error: ${error}`);\n }\n\n return res ? {\n ...res,\n confPath: fp\n } : undefined;\n }\n\n return undefined;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,SAAS,MAAc;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/file.ts","../src/system.ts","../src/configLoader.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as crypto from 'crypto';\nimport { tmpdir } from 'os';\nimport { Readable } from 'stream';\n\nexport const isUrl = (s: string) => {\n try {\n new URL(s);\n return true;\n } catch {\n return false;\n }\n};\n\nexport const isDataUrl = (s: string) => typeof s === 'string' && !!s.match(/^data:((?:\\w+\\/(?:(?!;).)+)?)((?:;[\\w\\W]*?[^;])*),(.+)$/g);\n\nexport const isBase64 = (s: string) => {\n if (typeof s !== 'string') return false;\n const len = s.length;\n if (!len || len % 4 !== 0 || /[^A-Z0-9+/=]/i.test(s)) return false;\n const firstPaddingChar = s.indexOf('=');\n return firstPaddingChar === -1 || firstPaddingChar === len - 1 || (firstPaddingChar === len - 2 && s[len - 1] === '=');\n};\n\nexport const getDUrl = async (url: string): Promise<string> => {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.statusText}`);\n const mime = res.headers.get('content-type') || 'application/octet-stream';\n const arrayBuffer = await res.arrayBuffer();\n const base64 = Buffer.from(arrayBuffer).toString('base64');\n return `data:${mime};base64,${base64}`;\n}\n\nexport const assertFile = async (input: any, outputType: string): Promise<any> => {\n let dUrl: string;\n\n if (Buffer.isBuffer(input)) {\n dUrl = `data:application/octet-stream;base64,${input.toString('base64')}`;\n } else if (typeof input === 'string') {\n if (isDataUrl(input)) dUrl = input;\n else if (isBase64(input)) dUrl = `data:application/octet-stream;base64,${input}`;\n else if (isUrl(input)) dUrl = await getDUrl(input);\n else {\n const resolvedPath = path.resolve(process.cwd(), input);\n if (fs.existsSync(resolvedPath)) {\n const buffer = await fs.promises.readFile(resolvedPath);\n dUrl = `data:application/octet-stream;base64,${buffer.toString('base64')}`;\n } else {\n throw new Error(`Cannot find file or process input: ${input.slice(0, 25)}`);\n }\n }\n } else {\n throw new Error('Invalid file input');\n }\n\n if (dUrl.includes('data:') && dUrl.includes('undefined')) {\n dUrl = dUrl.replace('undefined', 'application/octet-stream');\n }\n\n const base64 = dUrl.split(',')[1] || dUrl;\n\n switch (outputType) {\n case 'DATA_URL':\n return dUrl;\n case 'BASE_64':\n return base64;\n case 'BUFFER':\n return Buffer.from(base64, 'base64');\n case 'TEMP_FILE_PATH':\n const tempFilePath = path.join(tmpdir(), `${crypto.randomBytes(6).toString('hex')}.tmp`);\n await fs.promises.writeFile(tempFilePath, Buffer.from(base64, 'base64'));\n return tempFilePath;\n case 'READ_STREAM':\n return Readable.from(Buffer.from(base64, 'base64'));\n default:\n return input;\n }\n};\n","import pidtree from 'pidtree';\nimport pidusage from 'pidusage';\n\ntype PidStat = { cpu: number; memory: number; ppid: number; pid: number; ctime: number; elapsed: number; timestamp: number };\n\nexport const pidTreeUsage = async (pid: number | number[]): Promise<{ [key: string]: PidStat } | Record<string, never>> => {\n let pidArray = Array.isArray(pid) ? pid : [pid];\n try {\n const pids: number[] = (await Promise.all(pidArray.map(p => pidtree(p)))).flat() as number[];\n // Include the original pids in the list for measurement\n const allPids = Array.from(new Set([...pidArray, ...pids]));\n const stats = await pidusage(allPids);\n return stats;\n } catch (error) {\n console.error('Error fetching PID tree usage:', error);\n return {};\n }\n};\n","import * as path from 'path';\nimport * as fs from 'fs';\nimport JSON5 from 'json5';\n\nexport const tryOpenFileAsObject = async (fileLocation: string, needArray = false): Promise<any> => {\n let res: any = undefined;\n const relativePath = path.join(path.resolve(process.cwd(), fileLocation || ''));\n const isJs = fileLocation.endsWith('.js') || fileLocation.endsWith('.cjs') || fileLocation.endsWith('.mjs');\n\n if (fs.existsSync(fileLocation) || fs.existsSync(relativePath)) {\n const fp: string = isJs\n ? (fs.existsSync(relativePath) ? relativePath : fileLocation)\n : (fs.existsSync(fileLocation) ? fileLocation : relativePath);\n\n try {\n let data;\n if (isJs) {\n // We use dynamic import for JS files in ESM context\n const imported = await import(path.resolve(fp));\n data = imported.default || imported;\n } else {\n data = JSON5.parse(fs.readFileSync(fp, 'utf8'));\n }\n\n if (data && (Array.isArray(data) === needArray)) res = data;\n if (data && typeof data === 'function') {\n res = await data(process.env.CURRENT_SESSION_ID || 'session');\n }\n } catch (error) {\n throw new Error(`Unable to parse config file. Please make sure ${fp} is valid. Error: ${error}`);\n }\n\n return res ? {\n ...res,\n confPath: fp\n } : undefined;\n }\n\n return undefined;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,SAAS,MAAc;CAChC,IAAI;EACA,IAAI,IAAI,CAAC;EACT,OAAO;CACX,QAAQ;EACJ,OAAO;CACX;AACJ;AAEA,MAAa,aAAa,MAAc,OAAO,MAAM,YAAY,CAAC,CAAC,EAAE,MAAM,0DAA0D;AAErI,MAAa,YAAY,MAAc;CACnC,IAAI,OAAO,MAAM,UAAU,OAAO;CAClC,MAAM,MAAM,EAAE;CACd,IAAI,CAAC,OAAO,MAAM,MAAM,KAAK,gBAAgB,KAAK,CAAC,GAAG,OAAO;CAC7D,MAAM,mBAAmB,EAAE,QAAQ,GAAG;CACtC,OAAO,qBAAqB,MAAM,qBAAqB,MAAM,KAAM,qBAAqB,MAAM,KAAK,EAAE,MAAM,OAAO;AACtH;AAEA,MAAa,UAAU,OAAO,QAAiC;CAC3D,MAAM,MAAM,MAAM,MAAM,GAAG;CAC3B,IAAI,CAAC,IAAI,IAAI,MAAM,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MAAM,IAAI,MAAM,iDAAiD,GAAG,oBAAoB,OAAO;EACnG;EAEA,OAAO,MAAM;GACT,GAAG;GACH,UAAU;EACd,IAAI,KAAA;CACR;AAGJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-wa/utils",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Shared utility functions for open-wa",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"json5": "^2.2.3",
|
|
21
|
-
"pidtree": "^0.
|
|
22
|
-
"pidusage": "^
|
|
21
|
+
"pidtree": "^1.0.0",
|
|
22
|
+
"pidusage": "^4.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^
|
|
25
|
+
"@types/node": "^26.6.3",
|
|
26
26
|
"@types/pidusage": "^2.0.5",
|
|
27
|
-
"typescript": "^
|
|
27
|
+
"typescript": "^7.0.2"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"type": "git",
|
|
39
39
|
"url": "https://github.com/open-wa/wa-automate-nodejs.git"
|
|
40
40
|
},
|
|
41
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
41
42
|
"scripts": {
|
|
42
43
|
"build": "tsdown",
|
|
43
44
|
"dev": "tsdown --watch",
|