@open-wa/node-red 2.8.0-alpha.1
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 +21 -0
- package/README.md +73 -0
- package/dist/nodes/cmd/cmd.html +79 -0
- package/dist/nodes/cmd/cmd.js +109 -0
- package/dist/nodes/cmd/cmd.js.map +1 -0
- package/dist/nodes/cmd/modules/types.js +3 -0
- package/dist/nodes/cmd/modules/types.js.map +1 -0
- package/dist/nodes/cmd/shared/types.js +3 -0
- package/dist/nodes/cmd/shared/types.js.map +1 -0
- package/dist/nodes/listen/listen.html +60 -0
- package/dist/nodes/listen/listen.js +102 -0
- package/dist/nodes/listen/listen.js.map +1 -0
- package/dist/nodes/listen/modules/types.js +3 -0
- package/dist/nodes/listen/modules/types.js.map +1 -0
- package/dist/nodes/listen/shared/types.js +3 -0
- package/dist/nodes/listen/shared/types.js.map +1 -0
- package/dist/nodes/owa-server/modules/types.js +3 -0
- package/dist/nodes/owa-server/modules/types.js.map +1 -0
- package/dist/nodes/owa-server/owa-server.html +36 -0
- package/dist/nodes/owa-server/owa-server.js +83 -0
- package/dist/nodes/owa-server/owa-server.js.map +1 -0
- package/dist/nodes/owa-server/shared/types.js +3 -0
- package/dist/nodes/owa-server/shared/types.js.map +1 -0
- package/dist/nodes/shared/common.js +9 -0
- package/dist/nodes/shared/common.js.map +1 -0
- package/dist/nodes/shared/http.js +40 -0
- package/dist/nodes/shared/http.js.map +1 -0
- package/dist/nodes/shared/types.js +7 -0
- package/dist/nodes/shared/types.js.map +1 -0
- package/package.json +74 -0
- package/yarn.lock +5870 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared types that don't require external dependencies.
|
|
4
|
+
* Used by both the editor (browser) and runtime (Node.js) builds.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CLIENT_STORE = void 0;
|
|
8
|
+
exports.CLIENT_STORE = "waClients";
|
|
9
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/nodes/shared/common.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,YAAY,GAAG,WAAW,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getJson = getJson;
|
|
4
|
+
const node_http_1 = require("node:http");
|
|
5
|
+
const node_https_1 = require("node:https");
|
|
6
|
+
async function getJson(url, headers) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const requestImpl = url.protocol === 'https:' ? node_https_1.request : node_http_1.request;
|
|
9
|
+
const req = requestImpl(url, {
|
|
10
|
+
method: 'GET',
|
|
11
|
+
headers: {
|
|
12
|
+
Accept: 'application/json',
|
|
13
|
+
...(headers || {}),
|
|
14
|
+
},
|
|
15
|
+
}, (res) => {
|
|
16
|
+
const chunks = [];
|
|
17
|
+
res.on('data', (chunk) => {
|
|
18
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
19
|
+
});
|
|
20
|
+
res.on('end', () => {
|
|
21
|
+
var _a;
|
|
22
|
+
const body = Buffer.concat(chunks).toString('utf8');
|
|
23
|
+
const statusCode = (_a = res.statusCode) !== null && _a !== void 0 ? _a : 500;
|
|
24
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
25
|
+
reject(new Error(`Unable to load JSON: HTTP ${statusCode}${body ? ` - ${body}` : ''}`));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
resolve(JSON.parse(body));
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
req.on('error', reject);
|
|
37
|
+
req.end();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/nodes/shared/http.ts"],"names":[],"mappings":";;AAGA,0BAyCC;AA5CD,yCAAmD;AACnD,2CAAqD;AAE9C,KAAK,UAAU,OAAO,CAAI,GAAQ,EAAE,OAAgC;IACzE,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxC,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAY,CAAC,CAAC,CAAC,mBAAW,CAAC;QAE3E,MAAM,GAAG,GAAG,WAAW,CACrB,GAAG,EACH;YACE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;aACnB;SACF,EACD,CAAC,GAAG,EAAE,EAAE;YACN,MAAM,MAAM,GAAa,EAAE,CAAC;YAE5B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;;gBACjB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACpD,MAAM,UAAU,GAAG,MAAA,GAAG,CAAC,UAAU,mCAAI,GAAG,CAAC;gBAEzC,IAAI,UAAU,GAAG,GAAG,IAAI,UAAU,IAAI,GAAG,EAAE,CAAC;oBAC1C,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;oBACxF,OAAO;gBACT,CAAC;gBAED,IAAI,CAAC;oBACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC,CAAC;gBACjC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACpE,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;QAEF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxB,GAAG,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLIENT_STORE = void 0;
|
|
4
|
+
// Re-export everything from common for backward compat
|
|
5
|
+
var common_1 = require("./common");
|
|
6
|
+
Object.defineProperty(exports, "CLIENT_STORE", { enumerable: true, get: function () { return common_1.CLIENT_STORE; } });
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/nodes/shared/types.ts"],"names":[],"mappings":";;;AAUA,uDAAuD;AACvD,mCAAmF;AAA1E,sGAAA,YAAY,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@open-wa/node-red",
|
|
3
|
+
"version": "2.8.0-alpha.1",
|
|
4
|
+
"description": "Official @open-wa node-red integration.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": "https://github.com/open-wa/node-red-contrib-wa-automate",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"node-red",
|
|
11
|
+
"whatsapp",
|
|
12
|
+
"javascript",
|
|
13
|
+
"bot",
|
|
14
|
+
"automation"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"add-node": "node ./utils/add-node.js",
|
|
18
|
+
"copy": "copyfiles -u 1 src/**/*.{png,svg} dist/",
|
|
19
|
+
"build:editor": "pnpm run clean:editor && copyfiles -u 2 src/editor/**/*.{css,html} dist/ && rollup -c rollup.config.editor.js",
|
|
20
|
+
"build:editor:watch": "rollup -c rollup.config.editor.js -w",
|
|
21
|
+
"build:runtime": "pnpm run clean:runtime && tsc -p tsconfig.runtime.json",
|
|
22
|
+
"build:runtime:watch": "tsc -p tsconfig.runtime.watch.json --watch --preserveWatchOutput",
|
|
23
|
+
"build": "rimraf dist && pnpm run copy && pnpm run build:editor && pnpm run build:runtime",
|
|
24
|
+
"clean:editor": "rimraf dist/*.html && rimraf dist/*.js",
|
|
25
|
+
"clean:runtime": "rimraf dist/*.js",
|
|
26
|
+
"test": "vitest run --passWithNoTests",
|
|
27
|
+
"test:watch": "vitest --passWithNoTests",
|
|
28
|
+
"dev": "rimraf dist && pnpm run copy && concurrently --names \"COPY,EDITOR,RUNTIME,TEST\" --prefix \"({name})\" --prefix-colors \"yellow.bold,cyan.bold,greenBright.bold,magenta.bold\" \"onchange -v \\\"src/**/*.png\\\" \\\"src/**/*.svg\\\" -- pnpm run copy\" \"pnpm run build:editor:watch\" \"pnpm run build:runtime:watch\" \"node -e \\\"setTimeout(() => process.exit(0), 10000)\\\" && pnpm run test:watch\"",
|
|
29
|
+
"lint": "oxlint src utils rollup.config.editor.js",
|
|
30
|
+
"lint:fix": "oxlint src utils rollup.config.editor.js --fix"
|
|
31
|
+
},
|
|
32
|
+
"author": "Mohammed Shah <@smashah>",
|
|
33
|
+
"license": "H-DNH V1.0",
|
|
34
|
+
"node-red": {
|
|
35
|
+
"nodes": {
|
|
36
|
+
"listen": "./dist/nodes/listen/listen.js",
|
|
37
|
+
"cmd": "./dist/nodes/cmd/cmd.js",
|
|
38
|
+
"owa-server": "./dist/nodes/owa-server/owa-server.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"dependenciesMeta": {
|
|
42
|
+
"puppeteer": {
|
|
43
|
+
"built": false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@rollup/plugin-typescript": "^8.2.3",
|
|
48
|
+
"@types/express": "catalog:",
|
|
49
|
+
"@types/node": "catalog:",
|
|
50
|
+
"@types/node-red": "^1.1.1",
|
|
51
|
+
"@types/node-red-node-test-helper": "^0.2.2",
|
|
52
|
+
"@types/sinon": "^10.0.2",
|
|
53
|
+
"@types/supertest": "^2.0.11",
|
|
54
|
+
"colorette": "^1.2.2",
|
|
55
|
+
"concurrently": "^7.6.0",
|
|
56
|
+
"copyfiles": "^2.4.1",
|
|
57
|
+
"glob": "^7.1.7",
|
|
58
|
+
"vitest": "catalog:",
|
|
59
|
+
"mustache": "^4.2.0",
|
|
60
|
+
"node-red": "^1.3.5",
|
|
61
|
+
"node-red-node-test-helper": "^0.2.7",
|
|
62
|
+
"onchange": "^7.1.0",
|
|
63
|
+
"prettier": "catalog:",
|
|
64
|
+
"rollup": "^2.53.2",
|
|
65
|
+
"type-fest": "^2.1.0",
|
|
66
|
+
"typescript": "catalog:",
|
|
67
|
+
"yarpm": "^1.1.1"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@open-wa/socket-client": "workspace:*",
|
|
71
|
+
"@open-wa/schema": "workspace:*",
|
|
72
|
+
"@open-wa/wa-automate-types-only": "workspace:*"
|
|
73
|
+
}
|
|
74
|
+
}
|