Skip to content

Commit 43d55d2

Browse files
authored
Merge branch 'master' into CLEN-2951
2 parents 458f305 + 91eb7f8 commit 43d55d2

File tree

9 files changed

+198
-22
lines changed

9 files changed

+198
-22
lines changed

.github/workflows/dispatch-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Dispatched product release
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
issue-number:
7+
description: "Number of the PR/issue that triggered release"
8+
required: true
9+
type: string
10+
511

612
permissions:
713
actions: write
@@ -41,3 +47,4 @@ jobs:
4147
uses: ./.github/.release/actions/actions/services/pub
4248
with:
4349
token: ${{ secrets.GH_TOKEN }}
50+
issue-number: ${{ inputs['issue-number'] }}

.pubnub.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
22
changelog:
3+
- date: 2025-10-20
4+
version: v6.0.2
5+
changes:
6+
- type: bug
7+
text: "Fixes issue of delete message with `from` and `to` parameters. To delete range of message(s)."
38
- date: 2025-08-19
49
version: v6.0.1
510
changes:
@@ -501,7 +506,7 @@ supported-platforms:
501506
platforms:
502507
- "Dart SDK >=2.6.0 <3.0.0"
503508
version: "PubNub Dart SDK"
504-
version: "6.0.1"
509+
version: "6.0.2"
505510
sdks:
506511
-
507512
full-name: PubNub Dart SDK

pubnub/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v6.0.2
2+
October 20 2025
3+
4+
#### Fixed
5+
- Fixes issue of delete message with `from` and `to` parameters. To delete range of message(s).
6+
17
## v6.0.1
28
August 19 2025
39

pubnub/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To add the package to your Dart or Flutter project, add `pubnub` as a dependency
1414

1515
```yaml
1616
dependencies:
17-
pubnub: ^6.0.1
17+
pubnub: ^6.0.2
1818
```
1919
2020
After adding the dependency to `pubspec.yaml`, run the `dart pub get` command in the root directory of your project (the same that the `pubspec.yaml` is in).

pubnub/lib/src/core/core.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Core {
2121
/// Internal module responsible for supervising.
2222
SupervisorModule supervisor = SupervisorModule();
2323

24-
static String version = '6.0.1';
24+
static String version = '6.0.2';
2525

2626
static String instanceId =
2727
'${(DateTime.now().millisecondsSinceEpoch % 100000)}'.padLeft(5);

pubnub/lib/src/dx/channel/channel_history.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ChannelHistory {
7575
keyset: _keyset,
7676
core: _core,
7777
params:
78-
DeleteMessagesParams(_keyset, _channel.name, end: from, start: to),
78+
DeleteMessagesParams(_keyset, _channel.name, end: to, start: from),
7979
serialize: (object, [_]) => DeleteMessagesResult.fromJson(object),
8080
);
8181
}

pubnub/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: pubnub
22
description: PubNub SDK v6 for Dart lang (with Flutter support) that allows you to create real-time applications
3-
version: 6.0.1
3+
version: 6.0.2
44
homepage: https://www.pubnub.com/docs/sdks/dart
55

66
environment:

pubnub/test/unit/dx/batch_history_test.dart

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,4 +334,162 @@ void main() {
334334
throwsA(isA<InvariantException>()));
335335
});
336336
});
337+
338+
group('delete()', () {
339+
late PubNub pubnub;
340+
341+
setUp(() {
342+
pubnub = PubNub(
343+
defaultKeyset:
344+
Keyset(subscribeKey: 'sub', publishKey: 'pub', userId: UserId('u')),
345+
networking: FakeNetworkingModule(),
346+
);
347+
});
348+
test('delete with no from/to parameters', () async {
349+
var channel = pubnub.channel('test-channel');
350+
var history = channel.messages();
351+
352+
when(
353+
method: 'DELETE',
354+
path:
355+
'v3/history/sub-key/sub/channel/test-channel?uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
356+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
357+
358+
await history.delete();
359+
});
360+
361+
test('delete with from parameter only', () async {
362+
var channel = pubnub.channel('test-channel');
363+
var fromTimetoken = Timetoken(BigInt.from(15610547826970050));
364+
var history = channel.messages(from: fromTimetoken);
365+
366+
when(
367+
method: 'DELETE',
368+
path:
369+
'v3/history/sub-key/sub/channel/test-channel?start=15610547826970050&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
370+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
371+
372+
await history.delete();
373+
});
374+
375+
test('delete with to parameter only', () async {
376+
var channel = pubnub.channel('test-channel');
377+
var toTimetoken = Timetoken(BigInt.from(15645905639093361));
378+
var history = channel.messages(to: toTimetoken);
379+
380+
when(
381+
method: 'DELETE',
382+
path:
383+
'v3/history/sub-key/sub/channel/test-channel?end=15645905639093361&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
384+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
385+
386+
await history.delete();
387+
});
388+
389+
test('delete with both from and to parameters', () async {
390+
var channel = pubnub.channel('test-channel');
391+
var fromTimetoken = Timetoken(BigInt.from(15610547826970050));
392+
var toTimetoken = Timetoken(BigInt.from(15645905639093361));
393+
var history = channel.messages(from: fromTimetoken, to: toTimetoken);
394+
395+
when(
396+
method: 'DELETE',
397+
path:
398+
'v3/history/sub-key/sub/channel/test-channel?start=15610547826970050&end=15645905639093361&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
399+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
400+
401+
await history.delete();
402+
});
403+
404+
test('delete with different channel name', () async {
405+
var channel = pubnub.channel('another-channel');
406+
var fromTimetoken = Timetoken(BigInt.from(12345));
407+
var toTimetoken = Timetoken(BigInt.from(67890));
408+
var history = channel.messages(from: fromTimetoken, to: toTimetoken);
409+
410+
when(
411+
method: 'DELETE',
412+
path:
413+
'v3/history/sub-key/sub/channel/another-channel?start=12345&end=67890&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
414+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
415+
416+
await history.delete();
417+
});
418+
419+
test('delete with authKey in keyset', () async {
420+
pubnub = PubNub(
421+
defaultKeyset: Keyset(
422+
subscribeKey: 'sub',
423+
publishKey: 'pub',
424+
authKey: 'myAuthKey',
425+
userId: UserId('u'),
426+
),
427+
networking: FakeNetworkingModule(),
428+
);
429+
430+
var channel = pubnub.channel('test-channel');
431+
var fromTimetoken = Timetoken(BigInt.from(1000));
432+
var toTimetoken = Timetoken(BigInt.from(2000));
433+
var history = channel.messages(from: fromTimetoken, to: toTimetoken);
434+
435+
when(
436+
method: 'DELETE',
437+
path:
438+
'v3/history/sub-key/sub/channel/test-channel?start=1000&end=2000&auth=myAuthKey&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
439+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
440+
441+
await history.delete();
442+
});
443+
444+
test('delete with named keyset', () async {
445+
pubnub.keysets.add(
446+
'alt',
447+
Keyset(
448+
subscribeKey: 'alt-sub',
449+
publishKey: 'alt-pub',
450+
userId: UserId('u')));
451+
452+
var channel = pubnub.channel('test-channel', using: 'alt');
453+
var fromTimetoken = Timetoken(BigInt.from(100));
454+
var toTimetoken = Timetoken(BigInt.from(200));
455+
var history = channel.messages(from: fromTimetoken, to: toTimetoken);
456+
457+
when(
458+
method: 'DELETE',
459+
path:
460+
'v3/history/sub-key/alt-sub/channel/test-channel?start=100&end=200&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
461+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
462+
463+
await history.delete();
464+
});
465+
466+
test('delete with very large timetoken values', () async {
467+
var channel = pubnub.channel('test-channel');
468+
var fromTimetoken = Timetoken(BigInt.parse('99999999999999999'));
469+
var toTimetoken = Timetoken(BigInt.parse('99999999999999999999'));
470+
var history = channel.messages(from: fromTimetoken, to: toTimetoken);
471+
472+
when(
473+
method: 'DELETE',
474+
path:
475+
'v3/history/sub-key/sub/channel/test-channel?start=99999999999999999&end=99999999999999999999&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
476+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
477+
478+
await history.delete();
479+
});
480+
481+
test('delete with special characters in channel name', () async {
482+
var channel = pubnub.channel('test-channel-with-special_chars.123');
483+
var fromTimetoken = Timetoken(BigInt.from(100));
484+
var history = channel.messages(from: fromTimetoken);
485+
486+
when(
487+
method: 'DELETE',
488+
path:
489+
'v3/history/sub-key/sub/channel/test-channel-with-special_chars.123?start=100&uuid=u&pnsdk=PubNub-Dart%2F${PubNub.version}',
490+
).then(status: 200, body: '{"status":200,"error":false,"message":""}');
491+
492+
await history.delete();
493+
});
494+
});
337495
}

pubnub/test/unit/dx/channel_group_test.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void main() {
2222
when(
2323
method: 'GET',
2424
path:
25-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
25+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
2626
).then(status: 200, body: _listChannelsSuccessResponse);
2727

2828
final result = await pubnub!.channelGroups.listChannels('cg1');
@@ -38,7 +38,7 @@ void main() {
3838
when(
3939
method: 'GET',
4040
path:
41-
'/v1/channel-registration/sub-key/test/channel-group/empty_group?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
41+
'/v1/channel-registration/sub-key/test/channel-group/empty_group?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
4242
).then(status: 200, body: _listChannelsEmptyResponse);
4343

4444
final result = await pubnub!.channelGroups.listChannels('empty_group');
@@ -60,7 +60,7 @@ void main() {
6060
when(
6161
method: 'GET',
6262
path:
63-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
63+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
6464
).then(status: 403, body: _forbiddenErrorResponse);
6565

6666
expect(pubnub!.channelGroups.listChannels('cg1'),
@@ -72,7 +72,7 @@ void main() {
7272
when(
7373
method: 'GET',
7474
path:
75-
'/v1/channel-registration/sub-key/test/channel-group/invalid_group?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
75+
'/v1/channel-registration/sub-key/test/channel-group/invalid_group?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
7676
).then(status: 400, body: _invalidArgumentsErrorResponse);
7777

7878
expect(pubnub!.channelGroups.listChannels('invalid_group'),
@@ -88,7 +88,7 @@ void main() {
8888
when(
8989
method: 'GET',
9090
path:
91-
'/v1/channel-registration/sub-key/custom/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=custom',
91+
'/v1/channel-registration/sub-key/custom/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=custom',
9292
).then(status: 200, body: _listChannelsSuccessResponse);
9393

9494
final result = await pubnub!.channelGroups
@@ -108,7 +108,7 @@ void main() {
108108
when(
109109
method: 'GET',
110110
path:
111-
'/v1/channel-registration/sub-key/named/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=named',
111+
'/v1/channel-registration/sub-key/named/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=named',
112112
).then(status: 200, body: _listChannelsSuccessResponse);
113113

114114
final result =
@@ -126,7 +126,7 @@ void main() {
126126
when(
127127
method: 'GET',
128128
path:
129-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test&add=ch1%2Cch2&remove',
129+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test&add=ch1%2Cch2&remove',
130130
).then(status: 200, body: _addChannelsSuccessResponse);
131131

132132
final result = await pubnub!.channelGroups.addChannels('cg1', channels);
@@ -138,7 +138,7 @@ void main() {
138138
when(
139139
method: 'GET',
140140
path:
141-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test&add&remove',
141+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test&add&remove',
142142
).then(status: 200, body: _addChannelsSuccessResponse);
143143

144144
final result =
@@ -155,7 +155,7 @@ void main() {
155155
when(
156156
method: 'GET',
157157
path:
158-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test&add=$expectedChannelsParam&remove',
158+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test&add=$expectedChannelsParam&remove',
159159
).then(status: 200, body: _addChannelsSuccessResponse);
160160

161161
final result = await pubnub!.channelGroups.addChannels('cg1', channels);
@@ -174,7 +174,7 @@ void main() {
174174
when(
175175
method: 'GET',
176176
path:
177-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test&add=ch1&remove',
177+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test&add=ch1&remove',
178178
).then(status: 403, body: _forbiddenErrorResponse);
179179

180180
expect(pubnub!.channelGroups.addChannels('cg1', {'ch1'}),
@@ -190,7 +190,7 @@ void main() {
190190
when(
191191
method: 'GET',
192192
path:
193-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test&add&remove=ch1%2Cch2',
193+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test&add&remove=ch1%2Cch2',
194194
).then(status: 200, body: _removeChannelsSuccessResponse);
195195

196196
final result =
@@ -204,7 +204,7 @@ void main() {
204204
when(
205205
method: 'GET',
206206
path:
207-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test&add&remove=nonexistent',
207+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test&add&remove=nonexistent',
208208
).then(status: 200, body: _removeChannelsSuccessResponse);
209209

210210
final result =
@@ -217,7 +217,7 @@ void main() {
217217
when(
218218
method: 'GET',
219219
path:
220-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test&add&remove',
220+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test&add&remove',
221221
).then(status: 200, body: _removeChannelsSuccessResponse);
222222

223223
final result =
@@ -240,7 +240,7 @@ void main() {
240240
when(
241241
method: 'GET',
242242
path:
243-
'/v1/channel-registration/sub-key/test/channel-group/cg1/remove?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
243+
'/v1/channel-registration/sub-key/test/channel-group/cg1/remove?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
244244
).then(status: 200, body: _deleteChannelGroupSuccessResponse);
245245

246246
final result = await pubnub!.channelGroups.delete('cg1');
@@ -252,7 +252,7 @@ void main() {
252252
when(
253253
method: 'GET',
254254
path:
255-
'/v1/channel-registration/sub-key/test/channel-group/nonexistent_group/remove?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
255+
'/v1/channel-registration/sub-key/test/channel-group/nonexistent_group/remove?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
256256
).then(status: 200, body: _deleteChannelGroupSuccessResponse);
257257

258258
final result = await pubnub!.channelGroups.delete('nonexistent_group');
@@ -271,7 +271,7 @@ void main() {
271271
when(
272272
method: 'GET',
273273
path:
274-
'/v1/channel-registration/sub-key/test/channel-group/cg1/remove?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
274+
'/v1/channel-registration/sub-key/test/channel-group/cg1/remove?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
275275
).then(status: 403, body: _forbiddenErrorResponse);
276276

277277
expect(pubnub!.channelGroups.delete('cg1'),
@@ -292,7 +292,7 @@ void main() {
292292
when(
293293
method: 'GET',
294294
path:
295-
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F6.0.1&uuid=test',
295+
'/v1/channel-registration/sub-key/test/channel-group/cg1?pnsdk=PubNub-Dart%2F${PubNub.version}&uuid=test',
296296
).then(status: 200, body: _malformedJsonResponse);
297297

298298
expect(pubnub!.channelGroups.listChannels('cg1'),

0 commit comments

Comments
 (0)