signal-sdk 0.0.6 → 0.0.8

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/README.md CHANGED
@@ -12,16 +12,15 @@
12
12
  providing JSON-RPC communication and a powerful bot framework.
13
13
  </p>
14
14
 
15
- [![npm version](https://badge.fury.io/js/signal-sdk.svg)](https://badge.fury.io/js/signal-sdk)
16
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
17
- [![signal-cli](https://img.shields.io/badge/signal--cli-v0.13.18-blue.svg)](https://github.com/AsamK/signal-cli)
18
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.8+-blue.svg)](https://www.typescriptlang.org/)
19
- [![Node.js](https://img.shields.io/badge/Node.js-16+-green.svg)](https://nodejs.org/)
20
- [![Donate on Liberapay](https://img.shields.io/badge/Liberapay-Donate-yellow.svg)](https://liberapay.com/devbyben/donate)
15
+ [![npm version](https://badge.fury.io/js/signal-sdk.svg)](https://badge.fury.io/js/signal-sdk)
16
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
17
+ [![signal-cli](https://img.shields.io/badge/signal--cli-v0.13.22-blue.svg)](https://github.com/AsamK/signal-cli)
18
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.8+-blue.svg)](https://www.typescriptlang.org/)
19
+ [![Node.js](https://img.shields.io/badge/Node.js-16+-green.svg)](https://nodejs.org/)
20
+ [![Donate on Liberapay](https://img.shields.io/badge/Liberapay-Donate-yellow.svg)](https://liberapay.com/devbyben/donate)
21
21
 
22
22
  </div>
23
23
 
24
-
25
24
  ## Features
26
25
 
27
26
  ### Core Capabilities
@@ -456,10 +455,9 @@ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) fi
456
455
 
457
456
  ---
458
457
 
459
-
460
458
  ## API Methods
461
459
 
462
- Compatible with signal-cli v0.13.18 - **100% Feature Coverage**
460
+ Compatible with signal-cli v0.13.22 - **100% Feature Coverage**
463
461
 
464
462
  | Category | Method | Description | Status |
465
463
  | ------------- | -------------------------- | ---------------------------------- | ------ |
@@ -499,4 +497,4 @@ Your support helps maintain and improve signal-sdk
499
497
 
500
498
  ---
501
499
 
502
- Made with ❤️ for the Signal community
500
+ Made with ❤️ for the Signal community
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signal-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "A comprehensive TypeScript SDK for Signal Messenger 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",
@@ -9,7 +9,6 @@
9
9
  },
10
10
  "files": [
11
11
  "dist/",
12
- "!dist/__tests__/",
13
12
  "scripts/",
14
13
  "README.md",
15
14
  "LICENSE"
@@ -17,7 +16,6 @@
17
16
  "scripts": {
18
17
  "build": "tsc",
19
18
  "test": "jest",
20
- "prepublishOnly": "npm run build",
21
19
  "postinstall": "node scripts/install.js",
22
20
  "connect": "node scripts/connect.js",
23
21
  "signal:connect": "node examples/sdk/00-device-linking.js",
@@ -1,9 +1,9 @@
1
1
  const axios = require('axios');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
- const { execSync } = require('child_process');
4
+ const tar = require('tar');
5
5
 
6
- const VERSION = '0.13.18';
6
+ const VERSION = '0.13.22';
7
7
  const BASE_URL = `https://github.com/AsamK/signal-cli/releases/download/v${VERSION}`;
8
8
 
9
9
  const platform = process.platform;
@@ -33,9 +33,14 @@ async function install() {
33
33
  const tempFile = path.join(binDir, 'signal-cli.tar.gz');
34
34
  fs.writeFileSync(tempFile, response.data);
35
35
 
36
- // Extract using system tar command
36
+ // Extract the archive. Using the tar npm package instead of the system tar
37
+ // command ensures the extraction works reliably on Windows where the
38
+ // built-in tar command struggles with long paths.
37
39
  try {
38
- execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'inherit' });
40
+ await tar.x({
41
+ file: tempFile,
42
+ cwd: binDir
43
+ });
39
44
  } catch (error) {
40
45
  console.error('Failed to extract archive:', error.message);
41
46
  throw error;
@@ -1,108 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- import { SignalCli } from './SignalCli';
3
- import { BotConfig, BotCommand, BotStats } from './interfaces';
4
- export declare class SignalBot extends EventEmitter {
5
- private signalCli;
6
- private config;
7
- private commands;
8
- private isRunning;
9
- private botGroupId;
10
- private stats;
11
- private userCooldowns;
12
- private actionQueue;
13
- private isProcessingQueue;
14
- private incomingMessageBuffer;
15
- constructor(config: BotConfig, signalCliPath?: string);
16
- /**
17
- * Downloads an image from URL to a temporary file
18
- * @param imageUrl URL of the image to download
19
- * @returns Path to the temporary file
20
- */
21
- private downloadImage;
22
- /**
23
- * Downloads an image from URL for commands (like NASA images)
24
- * @param imageUrl URL of the image to download
25
- * @param prefix Optional prefix for the temp file name
26
- * @returns Path to the temporary file
27
- */
28
- downloadImageFromUrl(imageUrl: string, prefix?: string): Promise<string>;
29
- /**
30
- * Sends a message with downloaded image attachment
31
- * @param recipient Recipient to send to
32
- * @param message Text message to send
33
- * @param imageUrl URL of the image to download and send
34
- * @param prefix Optional prefix for the temp file name
35
- */
36
- sendMessageWithImage(recipient: string, message: string, imageUrl: string, prefix?: string): Promise<void>;
37
- /**
38
- * Cleans up a temporary file
39
- * @param filePath Path to the file to delete
40
- */
41
- private cleanupTempFile;
42
- /**
43
- * Processes group avatar configuration
44
- * @param avatar Avatar configuration (URL, file path, or base64)
45
- * @returns Path to the avatar file or null if no avatar
46
- */
47
- private processGroupAvatar;
48
- /**
49
- * Adds a custom command to the bot
50
- */
51
- addCommand(command: BotCommand): void;
52
- /**
53
- * Removes a command from the bot
54
- */
55
- removeCommand(name: string): boolean;
56
- /**
57
- * Gets all available commands
58
- */
59
- getCommands(): BotCommand[];
60
- /**
61
- * Starts the bot
62
- */
63
- start(): Promise<void>;
64
- /**
65
- * Stops the bot
66
- */
67
- stop(): Promise<void>;
68
- gracefulShutdown(): Promise<void>;
69
- /**
70
- * Sends a message
71
- */
72
- sendMessage(recipient: string, message: string): Promise<void>;
73
- /**
74
- * Sends a reaction to a message
75
- */
76
- sendReaction(recipient: string, targetAuthor: string, targetTimestamp: number, emoji: string): Promise<void>;
77
- /**
78
- * Sends a message with file attachments
79
- */
80
- sendMessageWithAttachment(recipient: string, message: string, attachments: string[], cleanup?: string[]): Promise<void>;
81
- /**
82
- * Gets bot statistics
83
- */
84
- getStats(): BotStats;
85
- /**
86
- * Checks if a user is an admin
87
- */
88
- isAdmin(phoneNumber: string): boolean;
89
- /**
90
- * Gets the bot group ID
91
- */
92
- getBotGroupId(): string | null;
93
- /**
94
- * Gets the underlying SignalCli instance for advanced operations
95
- */
96
- getSignalCli(): SignalCli;
97
- private setupDefaultCommands;
98
- private setupBotGroup;
99
- private setupEventHandlers;
100
- private handleMessage;
101
- private handleCommand;
102
- private sendCommandResponse;
103
- private isOnCooldown;
104
- private processActionQueue;
105
- private sendWelcomeMessage;
106
- private formatUptime;
107
- private log;
108
- }