Skip to content

Commit fc389df

Browse files
authored
Add missing new retry policy as static field of PubNub (#452)
fix(interface): add missing new retry policy as static field of PubNub Add missing `NoneRetryPolicy` static field for `PubNub` class.
1 parent b283e9e commit fc389df

File tree

13 files changed

+293
-23
lines changed

13 files changed

+293
-23
lines changed

.pubnub.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
---
22
changelog:
3+
- date: 2025-04-15
4+
version: v9.5.1
5+
changes:
6+
- type: bug
7+
text: "Add missing `NoneRetryPolicy` static field for `PubNub` class."
8+
- type: improvement
9+
text: "`RetryPolicy.None` exported as a function to not affect tree-shaking and modules exclusion possibilities."
310
- date: 2025-04-15
411
version: v9.5.0
512
changes:
@@ -1222,7 +1229,7 @@ supported-platforms:
12221229
- 'Ubuntu 14.04 and up'
12231230
- 'Windows 7 and up'
12241231
version: 'Pubnub Javascript for Node'
1225-
version: '9.5.0'
1232+
version: '9.5.1'
12261233
sdks:
12271234
- full-name: PubNub Javascript SDK
12281235
short-name: Javascript
@@ -1238,7 +1245,7 @@ sdks:
12381245
- distribution-type: source
12391246
distribution-repository: GitHub release
12401247
package-name: pubnub.js
1241-
location: https://github.com/pubnub/javascript/archive/refs/tags/v9.5.0.zip
1248+
location: https://github.com/pubnub/javascript/archive/refs/tags/v9.5.1.zip
12421249
requires:
12431250
- name: 'agentkeepalive'
12441251
min-version: '3.5.2'
@@ -1909,7 +1916,7 @@ sdks:
19091916
- distribution-type: library
19101917
distribution-repository: GitHub release
19111918
package-name: pubnub.js
1912-
location: https://github.com/pubnub/javascript/releases/download/v9.5.0/pubnub.9.5.0.js
1919+
location: https://github.com/pubnub/javascript/releases/download/v9.5.1/pubnub.9.5.1.js
19131920
requires:
19141921
- name: 'agentkeepalive'
19151922
min-version: '3.5.2'

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## v9.5.1
2+
April 15 2025
3+
4+
#### Fixed
5+
- Add missing `NoneRetryPolicy` static field for `PubNub` class.
6+
7+
#### Modified
8+
- `RetryPolicy.None` exported as a function to not affect tree-shaking and modules exclusion possibilities.
9+
110
## v9.5.0
211
April 15 2025
312

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
2727
npm install pubnub
2828
```
2929
* or download one of our builds from our CDN:
30-
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.5.0.js
31-
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.5.0.min.js
30+
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.5.1.js
31+
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.5.1.min.js
3232
3333
2. Configure your keys:
3434

dist/web/pubnub.js

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3777,38 +3777,96 @@
37773777
Endpoint["Unknown"] = "UnknownEndpoint";
37783778
/**
37793779
* The endpoints to send messages.
3780+
*
3781+
* This is related to the following functionality:
3782+
* - `publish`
3783+
* - `signal`
3784+
* - `publish file`
3785+
* - `fire`
37803786
*/
37813787
Endpoint["MessageSend"] = "MessageSendEndpoint";
37823788
/**
37833789
* The endpoint for real-time update retrieval.
3790+
*
3791+
* This is related to the following functionality:
3792+
* - `subscribe`
37843793
*/
37853794
Endpoint["Subscribe"] = "SubscribeEndpoint";
37863795
/**
37873796
* The endpoint to access and manage `user_id` presence and fetch channel presence information.
3797+
*
3798+
* This is related to the following functionality:
3799+
* - `get presence state`
3800+
* - `set presence state`
3801+
* - `here now`
3802+
* - `where now`
3803+
* - `heartbeat`
37883804
*/
37893805
Endpoint["Presence"] = "PresenceEndpoint";
37903806
/**
37913807
* The endpoint to access and manage files in channel-specific storage.
3808+
*
3809+
* This is related to the following functionality:
3810+
* - `send file`
3811+
* - `download file`
3812+
* - `list files`
3813+
* - `delete file`
37923814
*/
37933815
Endpoint["Files"] = "FilesEndpoint";
37943816
/**
37953817
* The endpoint to access and manage messages for a specific channel(s) in the persistent storage.
3818+
*
3819+
* This is related to the following functionality:
3820+
* - `fetch messages / message actions`
3821+
* - `delete messages`
3822+
* - `messages count`
37963823
*/
37973824
Endpoint["MessageStorage"] = "MessageStorageEndpoint";
37983825
/**
37993826
* The endpoint to access and manage channel groups.
3827+
*
3828+
* This is related to the following functionality:
3829+
* - `add channels to group`
3830+
* - `list channels in group`
3831+
* - `remove channels from group`
3832+
* - `list channel groups`
38003833
*/
38013834
Endpoint["ChannelGroups"] = "ChannelGroupsEndpoint";
38023835
/**
38033836
* The endpoint to access and manage device registration for channel push notifications.
3837+
*
3838+
* This is related to the following functionality:
3839+
* - `enable channels for push notifications`
3840+
* - `list push notification enabled channels`
3841+
* - `disable push notifications for channels`
3842+
* - `disable push notifications for all channels`
38043843
*/
38053844
Endpoint["DevicePushNotifications"] = "DevicePushNotificationsEndpoint";
38063845
/**
38073846
* The endpoint to access and manage App Context objects.
3847+
*
3848+
* This is related to the following functionality:
3849+
* - `set UUID metadata`
3850+
* - `get UUID metadata`
3851+
* - `remove UUID metadata`
3852+
* - `get all UUID metadata`
3853+
* - `set Channel metadata`
3854+
* - `get Channel metadata`
3855+
* - `remove Channel metadata`
3856+
* - `get all Channel metadata`
3857+
* - `manage members`
3858+
* - `list members`
3859+
* - `manage memberships`
3860+
* - `list memberships`
38083861
*/
38093862
Endpoint["AppContext"] = "AppContextEndpoint";
38103863
/**
38113864
* The endpoint to access and manage reactions for a specific message.
3865+
*
3866+
* This is related to the following functionality:
3867+
* - `add message action`
3868+
* - `get message actions`
3869+
* - `remove message action`
38123870
*/
38133871
Endpoint["MessageReactions"] = "MessageReactionsEndpoint";
38143872
})(Endpoint || (Endpoint = {}));
@@ -3817,6 +3875,19 @@
38173875
* Failed request retry policy.
38183876
*/
38193877
class RetryPolicy {
3878+
static None() {
3879+
return {
3880+
shouldRetry(_request, _response, _errorCategory, _attempt) {
3881+
return false;
3882+
},
3883+
getDelay(_attempt, _response) {
3884+
return -1;
3885+
},
3886+
validate() {
3887+
return true;
3888+
},
3889+
};
3890+
}
38203891
static LinearRetryPolicy(configuration) {
38213892
var _a;
38223893
return {
@@ -4138,7 +4209,7 @@
41384209
return base.PubNubFile;
41394210
},
41404211
get version() {
4141-
return '9.5.0';
4212+
return '9.5.1';
41424213
},
41434214
getVersion() {
41444215
return this.version;
@@ -14648,6 +14719,11 @@
1464814719
* API call status category.
1464914720
*/
1465014721
PubNubCore.CATEGORIES = StatusCategory$1;
14722+
/**
14723+
* Enum with API endpoint groups which can be used with retry policy to set up exclusions (which shouldn't be
14724+
* retried).
14725+
*/
14726+
PubNubCore.Endpoint = Endpoint;
1465114727
/**
1465214728
* Exponential retry policy constructor.
1465314729
*/
@@ -14656,6 +14732,13 @@
1465614732
* Linear retry policy constructor.
1465714733
*/
1465814734
PubNubCore.LinearRetryPolicy = RetryPolicy.LinearRetryPolicy;
14735+
/**
14736+
* Disabled / inactive retry policy.
14737+
*
14738+
* **Note:** By default `ExponentialRetryPolicy` is set for subscribe requests and this one can be used to disable
14739+
* retry policy for all requests (setting `undefined` for retry configuration will set default policy).
14740+
*/
14741+
PubNubCore.NoneRetryPolicy = RetryPolicy.None;
1465914742

1466014743
/**
1466114744
* Cbor decoder module.

dist/web/pubnub.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/components/configuration.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
3535
var _a, _b, _c;
3636
// Set default retry policy for subscribe (if new subscribe logic not used).
3737
if (!base.retryConfiguration && base.enableEventEngine) {
38+
const s = retryPolicy_1.RetryPolicy.None;
3839
base.retryConfiguration = retryPolicy_1.RetryPolicy.ExponentialRetryPolicy({
3940
minimumDelay: 2,
4041
maximumDelay: 150,
@@ -143,7 +144,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
143144
return base.PubNubFile;
144145
},
145146
get version() {
146-
return '9.5.0';
147+
return '9.5.1';
147148
},
148149
getVersion() {
149150
return this.version;

lib/core/components/retryPolicy.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,96 @@ var Endpoint;
2222
Endpoint["Unknown"] = "UnknownEndpoint";
2323
/**
2424
* The endpoints to send messages.
25+
*
26+
* This is related to the following functionality:
27+
* - `publish`
28+
* - `signal`
29+
* - `publish file`
30+
* - `fire`
2531
*/
2632
Endpoint["MessageSend"] = "MessageSendEndpoint";
2733
/**
2834
* The endpoint for real-time update retrieval.
35+
*
36+
* This is related to the following functionality:
37+
* - `subscribe`
2938
*/
3039
Endpoint["Subscribe"] = "SubscribeEndpoint";
3140
/**
3241
* The endpoint to access and manage `user_id` presence and fetch channel presence information.
42+
*
43+
* This is related to the following functionality:
44+
* - `get presence state`
45+
* - `set presence state`
46+
* - `here now`
47+
* - `where now`
48+
* - `heartbeat`
3349
*/
3450
Endpoint["Presence"] = "PresenceEndpoint";
3551
/**
3652
* The endpoint to access and manage files in channel-specific storage.
53+
*
54+
* This is related to the following functionality:
55+
* - `send file`
56+
* - `download file`
57+
* - `list files`
58+
* - `delete file`
3759
*/
3860
Endpoint["Files"] = "FilesEndpoint";
3961
/**
4062
* The endpoint to access and manage messages for a specific channel(s) in the persistent storage.
63+
*
64+
* This is related to the following functionality:
65+
* - `fetch messages / message actions`
66+
* - `delete messages`
67+
* - `messages count`
4168
*/
4269
Endpoint["MessageStorage"] = "MessageStorageEndpoint";
4370
/**
4471
* The endpoint to access and manage channel groups.
72+
*
73+
* This is related to the following functionality:
74+
* - `add channels to group`
75+
* - `list channels in group`
76+
* - `remove channels from group`
77+
* - `list channel groups`
4578
*/
4679
Endpoint["ChannelGroups"] = "ChannelGroupsEndpoint";
4780
/**
4881
* The endpoint to access and manage device registration for channel push notifications.
82+
*
83+
* This is related to the following functionality:
84+
* - `enable channels for push notifications`
85+
* - `list push notification enabled channels`
86+
* - `disable push notifications for channels`
87+
* - `disable push notifications for all channels`
4988
*/
5089
Endpoint["DevicePushNotifications"] = "DevicePushNotificationsEndpoint";
5190
/**
5291
* The endpoint to access and manage App Context objects.
92+
*
93+
* This is related to the following functionality:
94+
* - `set UUID metadata`
95+
* - `get UUID metadata`
96+
* - `remove UUID metadata`
97+
* - `get all UUID metadata`
98+
* - `set Channel metadata`
99+
* - `get Channel metadata`
100+
* - `remove Channel metadata`
101+
* - `get all Channel metadata`
102+
* - `manage members`
103+
* - `list members`
104+
* - `manage memberships`
105+
* - `list memberships`
53106
*/
54107
Endpoint["AppContext"] = "AppContextEndpoint";
55108
/**
56109
* The endpoint to access and manage reactions for a specific message.
110+
*
111+
* This is related to the following functionality:
112+
* - `add message action`
113+
* - `get message actions`
114+
* - `remove message action`
57115
*/
58116
Endpoint["MessageReactions"] = "MessageReactionsEndpoint";
59117
})(Endpoint || (exports.Endpoint = Endpoint = {}));
@@ -62,6 +120,19 @@ var Endpoint;
62120
* Failed request retry policy.
63121
*/
64122
class RetryPolicy {
123+
static None() {
124+
return {
125+
shouldRetry(_request, _response, _errorCategory, _attempt) {
126+
return false;
127+
},
128+
getDelay(_attempt, _response) {
129+
return -1;
130+
},
131+
validate() {
132+
return true;
133+
},
134+
};
135+
}
65136
static LinearRetryPolicy(configuration) {
66137
var _a;
67138
return {

lib/core/pubnub-common.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,11 @@ PubNubCore.OPERATIONS = operations_1.default;
22162216
* API call status category.
22172217
*/
22182218
PubNubCore.CATEGORIES = categories_1.default;
2219+
/**
2220+
* Enum with API endpoint groups which can be used with retry policy to set up exclusions (which shouldn't be
2221+
* retried).
2222+
*/
2223+
PubNubCore.Endpoint = retryPolicy_1.Endpoint;
22192224
/**
22202225
* Exponential retry policy constructor.
22212226
*/
@@ -2224,3 +2229,10 @@ PubNubCore.ExponentialRetryPolicy = retryPolicy_1.RetryPolicy.ExponentialRetryPo
22242229
* Linear retry policy constructor.
22252230
*/
22262231
PubNubCore.LinearRetryPolicy = retryPolicy_1.RetryPolicy.LinearRetryPolicy;
2232+
/**
2233+
* Disabled / inactive retry policy.
2234+
*
2235+
* **Note:** By default `ExponentialRetryPolicy` is set for subscribe requests and this one can be used to disable
2236+
* retry policy for all requests (setting `undefined` for retry configuration will set default policy).
2237+
*/
2238+
PubNubCore.NoneRetryPolicy = retryPolicy_1.RetryPolicy.None;

0 commit comments

Comments
 (0)