signal-sdk 0.0.2 → 0.0.3
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/dist/SignalCli.d.ts +1 -1
- package/dist/SignalCli.js +17 -2
- package/package.json +1 -1
package/dist/SignalCli.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class SignalCli extends EventEmitter {
|
|
|
5
5
|
private account?;
|
|
6
6
|
private cliProcess;
|
|
7
7
|
private requestPromises;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(accountOrPath?: string, account?: string);
|
|
9
9
|
connect(): Promise<void>;
|
|
10
10
|
disconnect(): void;
|
|
11
11
|
gracefulShutdown(): Promise<void>;
|
package/dist/SignalCli.js
CHANGED
|
@@ -40,10 +40,25 @@ const qrcodeTerminal = __importStar(require("qrcode-terminal"));
|
|
|
40
40
|
const events_1 = require("events");
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
class SignalCli extends events_1.EventEmitter {
|
|
43
|
-
constructor(
|
|
43
|
+
constructor(accountOrPath, account) {
|
|
44
44
|
super();
|
|
45
45
|
this.cliProcess = null;
|
|
46
46
|
this.requestPromises = new Map();
|
|
47
|
+
let signalCliPath;
|
|
48
|
+
let phoneNumber;
|
|
49
|
+
// Smart parameter detection
|
|
50
|
+
if (typeof accountOrPath === 'string') {
|
|
51
|
+
if (accountOrPath.startsWith('+')) {
|
|
52
|
+
// First parameter is a phone number
|
|
53
|
+
phoneNumber = accountOrPath;
|
|
54
|
+
signalCliPath = undefined;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// First parameter is a path, second is phone number
|
|
58
|
+
signalCliPath = accountOrPath;
|
|
59
|
+
phoneNumber = account;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
47
62
|
// Determine the correct signal-cli path based on platform
|
|
48
63
|
let defaultPath;
|
|
49
64
|
if (process.platform === 'win32') {
|
|
@@ -54,7 +69,7 @@ class SignalCli extends events_1.EventEmitter {
|
|
|
54
69
|
defaultPath = path.join(__dirname, '..', 'bin', 'bin', 'signal-cli');
|
|
55
70
|
}
|
|
56
71
|
this.signalCliPath = signalCliPath || defaultPath;
|
|
57
|
-
this.account =
|
|
72
|
+
this.account = phoneNumber;
|
|
58
73
|
}
|
|
59
74
|
async connect() {
|
|
60
75
|
const args = this.account ? ['-a', this.account, 'jsonRpc'] : ['jsonRpc'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signal-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A comprehensive TypeScript SDK for Signal CLI with native JSON-RPC support, providing high-performance messaging, bot framework, and full signal-cli integration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|