signal-sdk 0.1.2 → 0.1.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.
Files changed (53) hide show
  1. package/README.md +18 -8
  2. package/dist/MultiAccountManager.js +11 -19
  3. package/dist/SignalBot.js +40 -36
  4. package/dist/SignalCli.d.ts +23 -319
  5. package/dist/SignalCli.js +224 -998
  6. package/dist/__tests__/DeviceManager.test.d.ts +1 -0
  7. package/dist/__tests__/DeviceManager.test.js +135 -0
  8. package/dist/__tests__/MultiAccountManager.coverage.test.d.ts +1 -0
  9. package/dist/__tests__/MultiAccountManager.coverage.test.js +33 -0
  10. package/dist/__tests__/MultiAccountManager.test.js +3 -3
  11. package/dist/__tests__/SignalBot.additional.test.js +40 -37
  12. package/dist/__tests__/SignalBot.coverage.test.d.ts +1 -0
  13. package/dist/__tests__/SignalBot.coverage.test.js +385 -0
  14. package/dist/__tests__/SignalBot.test.js +8 -8
  15. package/dist/__tests__/SignalCli.advanced.test.js +47 -58
  16. package/dist/__tests__/SignalCli.connections.test.d.ts +1 -0
  17. package/dist/__tests__/SignalCli.connections.test.js +110 -0
  18. package/dist/__tests__/SignalCli.e2e.test.js +28 -32
  19. package/dist/__tests__/SignalCli.events.test.d.ts +1 -0
  20. package/dist/__tests__/SignalCli.events.test.js +113 -0
  21. package/dist/__tests__/SignalCli.integration.test.js +6 -5
  22. package/dist/__tests__/SignalCli.methods.test.js +77 -77
  23. package/dist/__tests__/SignalCli.parsing.test.js +4 -13
  24. package/dist/__tests__/SignalCli.simple.test.d.ts +1 -0
  25. package/dist/__tests__/SignalCli.simple.test.js +77 -0
  26. package/dist/__tests__/SignalCli.test.js +96 -82
  27. package/dist/__tests__/config.test.js +19 -29
  28. package/dist/__tests__/errors.test.js +2 -2
  29. package/dist/__tests__/retry.test.js +10 -8
  30. package/dist/__tests__/robustness.test.d.ts +1 -0
  31. package/dist/__tests__/robustness.test.js +59 -0
  32. package/dist/__tests__/security.test.d.ts +1 -0
  33. package/dist/__tests__/security.test.js +50 -0
  34. package/dist/config.js +3 -3
  35. package/dist/interfaces.d.ts +18 -0
  36. package/dist/managers/AccountManager.d.ts +27 -0
  37. package/dist/managers/AccountManager.js +147 -0
  38. package/dist/managers/BaseManager.d.ts +9 -0
  39. package/dist/managers/BaseManager.js +17 -0
  40. package/dist/managers/ContactManager.d.ts +15 -0
  41. package/dist/managers/ContactManager.js +123 -0
  42. package/dist/managers/DeviceManager.d.ts +11 -0
  43. package/dist/managers/DeviceManager.js +139 -0
  44. package/dist/managers/GroupManager.d.ts +12 -0
  45. package/dist/managers/GroupManager.js +78 -0
  46. package/dist/managers/MessageManager.d.ts +18 -0
  47. package/dist/managers/MessageManager.js +301 -0
  48. package/dist/managers/StickerManager.d.ts +8 -0
  49. package/dist/managers/StickerManager.js +39 -0
  50. package/dist/retry.js +3 -3
  51. package/dist/validators.d.ts +9 -0
  52. package/dist/validators.js +20 -0
  53. package/package.json +11 -4
@@ -46,32 +46,32 @@ describe('SignalCli Methods Tests', () => {
46
46
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('send', expect.objectContaining({
47
47
  message: 'Hello',
48
48
  recipients: ['+1234567890'],
49
- account: '+1234567890'
49
+ account: '+1234567890',
50
50
  }));
51
51
  });
52
52
  it('should send message to group', async () => {
53
53
  await signalCli.sendMessage('group123==', 'Hello group');
54
54
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('send', expect.objectContaining({
55
55
  message: 'Hello group',
56
- groupId: 'group123=='
56
+ groupId: 'group123==',
57
57
  }));
58
58
  });
59
59
  it('should send message with attachments', async () => {
60
60
  await signalCli.sendMessage('+1234567890', 'Check this', { attachments: ['/path/to/file.jpg'] });
61
61
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('send', expect.objectContaining({
62
- attachments: ['/path/to/file.jpg']
62
+ attachments: ['/path/to/file.jpg'],
63
63
  }));
64
64
  });
65
65
  it('should send message with expiration', async () => {
66
66
  await signalCli.sendMessage('+1234567890', 'Secret', { expiresInSeconds: 3600 });
67
67
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('send', expect.objectContaining({
68
- expiresInSeconds: 3600
68
+ expiresInSeconds: 3600,
69
69
  }));
70
70
  });
71
71
  it('should send view-once message', async () => {
72
72
  await signalCli.sendMessage('+1234567890', 'View once', { isViewOnce: true });
73
73
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('send', expect.objectContaining({
74
- viewOnce: true
74
+ viewOnce: true,
75
75
  }));
76
76
  });
77
77
  it('should send reaction', async () => {
@@ -81,39 +81,39 @@ describe('SignalCli Methods Tests', () => {
81
81
  targetAuthor: '+0987654321',
82
82
  targetTimestamp: 123456,
83
83
  remove: false,
84
- account: '+1234567890'
84
+ account: '+1234567890',
85
85
  }));
86
86
  });
87
87
  it('should send reaction with remove flag', async () => {
88
88
  await signalCli.sendReaction('+1234567890', '+0987654321', 123456, '👍', true);
89
89
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendReaction', expect.objectContaining({
90
- remove: true
90
+ remove: true,
91
91
  }));
92
92
  });
93
93
  it('should send reaction to group', async () => {
94
94
  await signalCli.sendReaction('group123==', '+0987654321', 123456, '👍');
95
95
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendReaction', expect.objectContaining({
96
- groupId: 'group123=='
96
+ groupId: 'group123==',
97
97
  }));
98
98
  });
99
99
  it('should send typing indicator', async () => {
100
100
  await signalCli.sendTyping('+1234567890');
101
101
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendTyping', expect.objectContaining({
102
102
  when: true,
103
- recipients: ['+1234567890']
103
+ recipients: ['+1234567890'],
104
104
  }));
105
105
  });
106
106
  it('should stop typing indicator', async () => {
107
107
  await signalCli.sendTyping('+1234567890', true);
108
108
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendTyping', expect.objectContaining({
109
- when: false
109
+ when: false,
110
110
  }));
111
111
  });
112
112
  it('should remote delete message', async () => {
113
113
  await signalCli.remoteDeleteMessage('+1234567890', 123456);
114
114
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('remoteDelete', expect.objectContaining({
115
115
  targetTimestamp: 123456,
116
- recipients: ['+1234567890']
116
+ recipients: ['+1234567890'],
117
117
  }));
118
118
  });
119
119
  });
@@ -122,7 +122,7 @@ describe('SignalCli Methods Tests', () => {
122
122
  await signalCli.updateContact('+1234567890', 'John Doe');
123
123
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateContact', expect.objectContaining({
124
124
  recipient: '+1234567890',
125
- name: 'John Doe'
125
+ name: 'John Doe',
126
126
  }));
127
127
  });
128
128
  it('should update contact with options', async () => {
@@ -130,25 +130,25 @@ describe('SignalCli Methods Tests', () => {
130
130
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateContact', expect.objectContaining({
131
131
  name: 'John Doe',
132
132
  color: 'blue',
133
- muted: true
133
+ muted: true,
134
134
  }));
135
135
  });
136
136
  it('should block recipients', async () => {
137
137
  await signalCli.block(['+1111111111', '+2222222222']);
138
138
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('block', expect.objectContaining({
139
- recipient: ['+1111111111', '+2222222222']
139
+ recipient: ['+1111111111', '+2222222222'],
140
140
  }));
141
141
  });
142
142
  it('should block group', async () => {
143
143
  await signalCli.block([], 'group123==');
144
144
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('block', expect.objectContaining({
145
- groupId: 'group123=='
145
+ groupId: 'group123==',
146
146
  }));
147
147
  });
148
148
  it('should unblock recipients', async () => {
149
149
  await signalCli.unblock(['+1111111111']);
150
150
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('unblock', expect.objectContaining({
151
- recipient: ['+1111111111']
151
+ recipient: ['+1111111111'],
152
152
  }));
153
153
  });
154
154
  });
@@ -156,13 +156,13 @@ describe('SignalCli Methods Tests', () => {
156
156
  it('should quit group', async () => {
157
157
  await signalCli.quitGroup('group123==');
158
158
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('quitGroup', expect.objectContaining({
159
- groupId: 'group123=='
159
+ groupId: 'group123==',
160
160
  }));
161
161
  });
162
162
  it('should join group', async () => {
163
163
  await signalCli.joinGroup('https://signal.group/...');
164
164
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('joinGroup', expect.objectContaining({
165
- uri: 'https://signal.group/...'
165
+ uri: 'https://signal.group/...',
166
166
  }));
167
167
  });
168
168
  });
@@ -170,7 +170,7 @@ describe('SignalCli Methods Tests', () => {
170
170
  it('should update profile with name only', async () => {
171
171
  await signalCli.updateProfile('John Doe');
172
172
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateProfile', expect.objectContaining({
173
- name: 'John Doe'
173
+ name: 'John Doe',
174
174
  }));
175
175
  });
176
176
  it('should update profile with all fields', async () => {
@@ -179,7 +179,7 @@ describe('SignalCli Methods Tests', () => {
179
179
  name: 'John Doe',
180
180
  about: 'Hello!',
181
181
  aboutEmoji: '👋',
182
- avatar: '/path/to/avatar.jpg'
182
+ avatar: '/path/to/avatar.jpg',
183
183
  }));
184
184
  });
185
185
  });
@@ -189,13 +189,13 @@ describe('SignalCli Methods Tests', () => {
189
189
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendReceipt', expect.objectContaining({
190
190
  recipient: '+1234567890',
191
191
  targetTimestamp: 123456,
192
- type: 'read'
192
+ type: 'read',
193
193
  }));
194
194
  });
195
195
  it('should send viewed receipt', async () => {
196
196
  await signalCli.sendReceipt('+1234567890', 123456, 'viewed');
197
197
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendReceipt', expect.objectContaining({
198
- type: 'viewed'
198
+ type: 'viewed',
199
199
  }));
200
200
  });
201
201
  });
@@ -205,14 +205,14 @@ describe('SignalCli Methods Tests', () => {
205
205
  const packs = await signalCli.listStickerPacks();
206
206
  expect(packs).toHaveLength(1);
207
207
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('listStickerPacks', expect.objectContaining({
208
- account: '+1234567890'
208
+ account: '+1234567890',
209
209
  }));
210
210
  });
211
211
  it('should add sticker pack', async () => {
212
212
  await signalCli.addStickerPack('packId123', 'packKey456');
213
213
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('addStickerPack', expect.objectContaining({
214
214
  packId: 'packId123',
215
- packKey: 'packKey456'
215
+ packKey: 'packKey456',
216
216
  }));
217
217
  });
218
218
  });
@@ -220,7 +220,7 @@ describe('SignalCli Methods Tests', () => {
220
220
  it('should register account', async () => {
221
221
  await signalCli.register('+1234567890');
222
222
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('register', expect.objectContaining({
223
- account: '+1234567890'
223
+ account: '+1234567890',
224
224
  }));
225
225
  });
226
226
  it('should register with voice and captcha', async () => {
@@ -228,32 +228,32 @@ describe('SignalCli Methods Tests', () => {
228
228
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('register', expect.objectContaining({
229
229
  account: '+1234567890',
230
230
  voice: true,
231
- captcha: 'captcha123'
231
+ captcha: 'captcha123',
232
232
  }));
233
233
  });
234
234
  it('should verify account', async () => {
235
235
  await signalCli.verify('+1234567890', 'token123');
236
236
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('verify', expect.objectContaining({
237
237
  account: '+1234567890',
238
- token: 'token123'
238
+ token: 'token123',
239
239
  }));
240
240
  });
241
241
  it('should verify with PIN', async () => {
242
242
  await signalCli.verify('+1234567890', 'token123', '1234');
243
243
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('verify', expect.objectContaining({
244
- pin: '1234'
244
+ pin: '1234',
245
245
  }));
246
246
  });
247
247
  it('should unregister account', async () => {
248
248
  await signalCli.unregister();
249
249
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('unregister', expect.objectContaining({
250
- account: '+1234567890'
250
+ account: '+1234567890',
251
251
  }));
252
252
  });
253
253
  it('should delete local account data', async () => {
254
254
  await signalCli.deleteLocalAccountData();
255
255
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('deleteLocalAccountData', expect.objectContaining({
256
- account: '+1234567890'
256
+ account: '+1234567890',
257
257
  }));
258
258
  });
259
259
  it('should update account configuration', async () => {
@@ -261,7 +261,7 @@ describe('SignalCli Methods Tests', () => {
261
261
  await signalCli.updateAccountConfiguration(config);
262
262
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateConfiguration', expect.objectContaining({
263
263
  readReceipts: true,
264
- typingIndicators: true
264
+ typingIndicators: true,
265
265
  }));
266
266
  });
267
267
  });
@@ -269,7 +269,7 @@ describe('SignalCli Methods Tests', () => {
269
269
  it('should remove device', async () => {
270
270
  await signalCli.removeDevice(2);
271
271
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('removeDevice', expect.objectContaining({
272
- deviceId: 2
272
+ deviceId: 2,
273
273
  }));
274
274
  });
275
275
  });
@@ -277,13 +277,13 @@ describe('SignalCli Methods Tests', () => {
277
277
  it('should set PIN', async () => {
278
278
  await signalCli.setPin('1234');
279
279
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('setPin', expect.objectContaining({
280
- pin: '1234'
280
+ pin: '1234',
281
281
  }));
282
282
  });
283
283
  it('should remove PIN', async () => {
284
284
  await signalCli.removePin();
285
285
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('removePin', expect.objectContaining({
286
- account: '+1234567890'
286
+ account: '+1234567890',
287
287
  }));
288
288
  });
289
289
  });
@@ -293,14 +293,14 @@ describe('SignalCli Methods Tests', () => {
293
293
  const identities = await signalCli.listIdentities();
294
294
  expect(identities).toHaveLength(1);
295
295
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('listIdentities', expect.objectContaining({
296
- account: '+1234567890'
296
+ account: '+1234567890',
297
297
  }));
298
298
  });
299
299
  it('should list identities for specific number', async () => {
300
300
  sendJsonRpcRequestSpy.mockResolvedValue([{ number: '+1111111111' }]);
301
301
  await signalCli.listIdentities('+1111111111');
302
302
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('listIdentities', expect.objectContaining({
303
- number: '+1111111111'
303
+ number: '+1111111111',
304
304
  }));
305
305
  });
306
306
  it('should trust identity', async () => {
@@ -308,13 +308,13 @@ describe('SignalCli Methods Tests', () => {
308
308
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('trust', expect.objectContaining({
309
309
  recipient: '+1111111111',
310
310
  safetyNumber: 'fingerprint123',
311
- verified: true
311
+ verified: true,
312
312
  }));
313
313
  });
314
314
  it('should trust identity with verified flag', async () => {
315
315
  await signalCli.trustIdentity('+1111111111', 'fingerprint123', false);
316
316
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('trust', expect.objectContaining({
317
- verified: false
317
+ verified: false,
318
318
  }));
319
319
  });
320
320
  });
@@ -324,14 +324,14 @@ describe('SignalCli Methods Tests', () => {
324
324
  const uri = await signalCli.link('MyDevice');
325
325
  expect(uri).toBe('sgnl://link?...');
326
326
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('link', {
327
- deviceName: 'MyDevice'
327
+ deviceName: 'MyDevice',
328
328
  });
329
329
  });
330
330
  it('should link without device name', async () => {
331
331
  sendJsonRpcRequestSpy.mockResolvedValue({ uri: 'sgnl://link?...' });
332
332
  await signalCli.link();
333
333
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('link', {
334
- deviceName: undefined
334
+ deviceName: undefined,
335
335
  });
336
336
  });
337
337
  });
@@ -340,22 +340,22 @@ describe('SignalCli Methods Tests', () => {
340
340
  await signalCli.sendPollCreate({
341
341
  question: 'What is your favorite color?',
342
342
  options: ['Red', 'Blue', 'Green'],
343
- groupId: 'group123=='
343
+ groupId: 'group123==',
344
344
  });
345
345
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendPollCreate', expect.objectContaining({
346
346
  question: 'What is your favorite color?',
347
347
  options: ['Red', 'Blue', 'Green'],
348
- groupId: 'group123=='
348
+ groupId: 'group123==',
349
349
  }));
350
350
  });
351
351
  it('should send poll create to recipients', async () => {
352
352
  await signalCli.sendPollCreate({
353
353
  question: 'What is your favorite color?',
354
354
  options: ['Red', 'Blue'],
355
- recipients: ['+1111111111', '+2222222222']
355
+ recipients: ['+1111111111', '+2222222222'],
356
356
  });
357
357
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendPollCreate', expect.objectContaining({
358
- recipients: ['+1111111111', '+2222222222']
358
+ recipients: ['+1111111111', '+2222222222'],
359
359
  }));
360
360
  });
361
361
  it('should send poll create with multiSelect', async () => {
@@ -363,41 +363,41 @@ describe('SignalCli Methods Tests', () => {
363
363
  question: 'Select options',
364
364
  options: ['A', 'B', 'C'],
365
365
  groupId: 'group123==',
366
- multiSelect: true
366
+ multiSelect: true,
367
367
  });
368
368
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendPollCreate', expect.objectContaining({
369
- multiSelect: true
369
+ multiSelect: true,
370
370
  }));
371
371
  });
372
372
  it('should send poll vote to individual', async () => {
373
373
  await signalCli.sendPollVote('+1234567890', {
374
374
  pollAuthor: '+9876543210',
375
375
  pollTimestamp: 123456,
376
- optionIndexes: [0, 2]
376
+ optionIndexes: [0, 2],
377
377
  });
378
378
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendPollVote', expect.objectContaining({
379
379
  pollAuthor: '+9876543210',
380
380
  pollTimestamp: 123456,
381
381
  options: [0, 2],
382
- recipient: '+1234567890'
382
+ recipient: '+1234567890',
383
383
  }));
384
384
  });
385
385
  it('should send poll vote to group', async () => {
386
386
  await signalCli.sendPollVote('group123==', {
387
387
  pollAuthor: '+9876543210',
388
388
  pollTimestamp: 123456,
389
- optionIndexes: [1]
389
+ optionIndexes: [1],
390
390
  });
391
391
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendPollVote', expect.objectContaining({
392
- groupId: 'group123=='
392
+ groupId: 'group123==',
393
393
  }));
394
394
  });
395
395
  it('should send poll terminate', async () => {
396
396
  await signalCli.sendPollTerminate('+1234567890', {
397
- pollTimestamp: 123456
397
+ pollTimestamp: 123456,
398
398
  });
399
399
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendPollTerminate', expect.objectContaining({
400
- pollTimestamp: 123456
400
+ pollTimestamp: 123456,
401
401
  }));
402
402
  });
403
403
  });
@@ -407,7 +407,7 @@ describe('SignalCli Methods Tests', () => {
407
407
  const result = await signalCli.updateAccount({ deviceName: 'New Device' });
408
408
  expect(result.success).toBe(true);
409
409
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateAccount', expect.objectContaining({
410
- deviceName: 'New Device'
410
+ deviceName: 'New Device',
411
411
  }));
412
412
  });
413
413
  it('should update account with username', async () => {
@@ -420,7 +420,7 @@ describe('SignalCli Methods Tests', () => {
420
420
  sendJsonRpcRequestSpy.mockResolvedValue({});
421
421
  await signalCli.updateAccount({ deleteUsername: true });
422
422
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateAccount', expect.objectContaining({
423
- deleteUsername: true
423
+ deleteUsername: true,
424
424
  }));
425
425
  });
426
426
  it('should update privacy settings', async () => {
@@ -428,12 +428,12 @@ describe('SignalCli Methods Tests', () => {
428
428
  await signalCli.updateAccount({
429
429
  unrestrictedUnidentifiedSender: true,
430
430
  discoverableByNumber: false,
431
- numberSharing: false
431
+ numberSharing: false,
432
432
  });
433
433
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateAccount', expect.objectContaining({
434
434
  unrestrictedUnidentifiedSender: true,
435
435
  discoverableByNumber: false,
436
- numberSharing: false
436
+ numberSharing: false,
437
437
  }));
438
438
  });
439
439
  it('should handle update account error', async () => {
@@ -446,12 +446,12 @@ describe('SignalCli Methods Tests', () => {
446
446
  it('should list devices', async () => {
447
447
  const mockDevices = [
448
448
  { id: 1, name: 'Primary', lastSeen: Date.now() },
449
- { id: 2, name: 'Tablet', lastSeen: Date.now() }
449
+ { id: 2, name: 'Tablet', lastSeen: Date.now() },
450
450
  ];
451
451
  sendJsonRpcRequestSpy.mockResolvedValue(mockDevices);
452
452
  const result = await signalCli.listDevices();
453
453
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('listDevices', {
454
- account: '+1234567890'
454
+ account: '+1234567890',
455
455
  });
456
456
  expect(result).toEqual(mockDevices);
457
457
  });
@@ -459,29 +459,29 @@ describe('SignalCli Methods Tests', () => {
459
459
  sendJsonRpcRequestSpy.mockResolvedValue(undefined);
460
460
  await signalCli.updateDevice({
461
461
  deviceId: 3,
462
- deviceName: 'My Laptop'
462
+ deviceName: 'My Laptop',
463
463
  });
464
464
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateDevice', {
465
465
  account: '+1234567890',
466
466
  deviceId: 3,
467
- deviceName: 'My Laptop'
467
+ deviceName: 'My Laptop',
468
468
  });
469
469
  });
470
470
  it('should validate device ID', async () => {
471
471
  await expect(signalCli.updateDevice({
472
472
  deviceId: 0,
473
- deviceName: 'Invalid'
473
+ deviceName: 'Invalid',
474
474
  })).rejects.toThrow();
475
475
  await expect(signalCli.updateDevice({
476
476
  deviceId: -5,
477
- deviceName: 'Invalid'
477
+ deviceName: 'Invalid',
478
478
  })).rejects.toThrow();
479
479
  });
480
480
  it('should validate device name is not too long', async () => {
481
481
  const longName = 'x'.repeat(300);
482
482
  await expect(signalCli.updateDevice({
483
483
  deviceId: 2,
484
- deviceName: longName
484
+ deviceName: longName,
485
485
  })).rejects.toThrow();
486
486
  });
487
487
  });
@@ -491,7 +491,7 @@ describe('SignalCli Methods Tests', () => {
491
491
  const result = await signalCli.updateAccount({ deviceName: 'New Device' });
492
492
  expect(result.success).toBe(true);
493
493
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateAccount', expect.objectContaining({
494
- deviceName: 'New Device'
494
+ deviceName: 'New Device',
495
495
  }));
496
496
  });
497
497
  it('should update account with username', async () => {
@@ -504,7 +504,7 @@ describe('SignalCli Methods Tests', () => {
504
504
  sendJsonRpcRequestSpy.mockResolvedValue({});
505
505
  await signalCli.updateAccount({ deleteUsername: true });
506
506
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateAccount', expect.objectContaining({
507
- deleteUsername: true
507
+ deleteUsername: true,
508
508
  }));
509
509
  });
510
510
  it('should update privacy settings', async () => {
@@ -512,12 +512,12 @@ describe('SignalCli Methods Tests', () => {
512
512
  await signalCli.updateAccount({
513
513
  unrestrictedUnidentifiedSender: true,
514
514
  discoverableByNumber: false,
515
- numberSharing: false
515
+ numberSharing: false,
516
516
  });
517
517
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('updateAccount', expect.objectContaining({
518
518
  unrestrictedUnidentifiedSender: true,
519
519
  discoverableByNumber: false,
520
- numberSharing: false
520
+ numberSharing: false,
521
521
  }));
522
522
  });
523
523
  it('should handle update account error', async () => {
@@ -533,21 +533,21 @@ describe('SignalCli Methods Tests', () => {
533
533
  const data = await signalCli.getAttachment({ id: 'attachment123' });
534
534
  expect(data).toBe('base64data...');
535
535
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('getAttachment', expect.objectContaining({
536
- id: 'attachment123'
536
+ id: 'attachment123',
537
537
  }));
538
538
  });
539
539
  it('should get attachment with groupId', async () => {
540
540
  sendJsonRpcRequestSpy.mockResolvedValue('base64data');
541
541
  await signalCli.getAttachment({ id: 'att1', groupId: 'group123==' });
542
542
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('getAttachment', expect.objectContaining({
543
- groupId: 'group123=='
543
+ groupId: 'group123==',
544
544
  }));
545
545
  });
546
546
  it('should get attachment with recipient', async () => {
547
547
  sendJsonRpcRequestSpy.mockResolvedValue('base64data');
548
548
  await signalCli.getAttachment({ id: 'att1', recipient: '+1111111111' });
549
549
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('getAttachment', expect.objectContaining({
550
- recipient: '+1111111111'
550
+ recipient: '+1111111111',
551
551
  }));
552
552
  });
553
553
  });
@@ -557,7 +557,7 @@ describe('SignalCli Methods Tests', () => {
557
557
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('startChangeNumber', {
558
558
  account: '+1234567890',
559
559
  number: '+33612345678',
560
- voice: false
560
+ voice: false,
561
561
  });
562
562
  });
563
563
  it('should start change number with voice verification', async () => {
@@ -565,7 +565,7 @@ describe('SignalCli Methods Tests', () => {
565
565
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('startChangeNumber', {
566
566
  account: '+1234567890',
567
567
  number: '+33612345678',
568
- voice: true
568
+ voice: true,
569
569
  });
570
570
  });
571
571
  it('should start change number with captcha', async () => {
@@ -575,7 +575,7 @@ describe('SignalCli Methods Tests', () => {
575
575
  account: '+1234567890',
576
576
  number: '+33612345678',
577
577
  voice: false,
578
- captcha
578
+ captcha,
579
579
  });
580
580
  });
581
581
  it('should validate phone number in startChangeNumber', async () => {
@@ -586,7 +586,7 @@ describe('SignalCli Methods Tests', () => {
586
586
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('finishChangeNumber', {
587
587
  account: '+1234567890',
588
588
  number: '+33612345678',
589
- verificationCode: '123456'
589
+ verificationCode: '123456',
590
590
  });
591
591
  });
592
592
  it('should finish change number with PIN', async () => {
@@ -595,7 +595,7 @@ describe('SignalCli Methods Tests', () => {
595
595
  account: '+1234567890',
596
596
  number: '+33612345678',
597
597
  verificationCode: '123456',
598
- pin: '1234'
598
+ pin: '1234',
599
599
  });
600
600
  });
601
601
  it('should validate phone number in finishChangeNumber', async () => {
@@ -617,7 +617,7 @@ describe('SignalCli Methods Tests', () => {
617
617
  account: '+1234567890',
618
618
  recipient,
619
619
  receipt,
620
- note
620
+ note,
621
621
  });
622
622
  });
623
623
  it('should send payment notification without note', async () => {
@@ -627,7 +627,7 @@ describe('SignalCli Methods Tests', () => {
627
627
  expect(sendJsonRpcRequestSpy).toHaveBeenCalledWith('sendPaymentNotification', {
628
628
  account: '+1234567890',
629
629
  recipient,
630
- receipt
630
+ receipt,
631
631
  });
632
632
  });
633
633
  it('should validate recipient in sendPaymentNotification', async () => {
@@ -95,20 +95,11 @@ describe('SignalCli - Enhanced Parsing (Phase 5)', () => {
95
95
  isMember: true,
96
96
  isBlocked: false,
97
97
  messageExpirationTime: 0,
98
- members: [
99
- { number: '+33111111111' },
100
- { number: '+33222222222' },
101
- ],
102
- pendingMembers: [
103
- { number: '+33333333333' },
104
- ],
98
+ members: [{ number: '+33111111111' }, { number: '+33222222222' }],
99
+ pendingMembers: [{ number: '+33333333333' }],
105
100
  requestingMembers: [],
106
- admins: [
107
- { number: '+33111111111' },
108
- ],
109
- banned: [
110
- { number: '+33444444444' },
111
- ],
101
+ admins: [{ number: '+33111111111' }],
102
+ banned: [{ number: '+33444444444' }],
112
103
  permissionAddMember: 'ONLY_ADMINS',
113
104
  permissionEditDetails: 'ONLY_ADMINS',
114
105
  permissionSendMessage: 'EVERY_MEMBER',
@@ -0,0 +1 @@
1
+ export {};