Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add membership type field #426

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
---
changelog:
- date: 2024-12-17
version: v8.4.0
changes:
- type: feature
text: "Add `type` field for members and membership objects and subscribe response."
- type: bug
text: "Fixed type which limited number of options which can be included into response / used in sorting for members / membership setting API."
- type: bug
text: "Fix missing `hereNowRefresh` flag from the presence object received from subscribe."
- type: bug
text: "Fix issue because of which `logVerbosity` set to `true` still didn't print logs for Node.js."
- type: improvement
text: "Change format and add proper request body output."
- date: 2024-12-12
version: v8.3.2
changes:
Expand Down Expand Up @@ -1081,7 +1094,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '8.3.2'
version: '8.4.0'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1097,7 +1110,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.3.2.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.4.0.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -1768,7 +1781,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v8.3.2/pubnub.8.3.2.js
location: https://github.com/pubnub/javascript/releases/download/v8.4.0/pubnub.8.4.0.js
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## v8.4.0
December 17 2024

#### Added
- Add `type` field for members and membership objects and subscribe response.

#### Fixed
- Fixed type which limited number of options which can be included into response / used in sorting for members / membership setting API.
- Fix missing `hereNowRefresh` flag from the presence object received from subscribe.
- Fix issue because of which `logVerbosity` set to `true` still didn't print logs for Node.js.

#### Modified
- Change format and add proper request body output.

## v8.3.2
December 12 2024

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
npm install pubnub
```
* or download one of our builds from our CDN:
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.3.2.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.3.2.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.4.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.4.0.min.js

2. Configure your keys:

Expand Down
199 changes: 143 additions & 56 deletions dist/web/pubnub.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pubnub.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/core/components/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
return base.PubNubFile;
},
get version() {
return '8.3.2';
return '8.4.0';
},
getVersion() {
return this.version;
Expand Down
29 changes: 18 additions & 11 deletions lib/core/endpoints/objects/member/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ const utils_1 = require("../../../utils");
*/
const INCLUDE_CUSTOM_FIELDS = false;
/**
* Whether member's status field should be included in response or not.
* Whether member's `status` field should be included in response or not.
*/
const INCLUDE_STATUS = false;
/**
* Whether member's `type` field should be included in response or not.
*/
const INCLUDE_TYPE = false;
/**
* Whether total number of members should be included in response or not.
*/
Expand Down Expand Up @@ -67,20 +71,21 @@ const LIMIT = 100;
*/
class GetChannelMembersRequest extends request_1.AbstractRequest {
constructor(parameters) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
var _k, _l, _m, _o, _p, _q, _r;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
var _l, _m, _o, _p, _q, _r, _s, _t;
super();
this.parameters = parameters;
// Apply default request parameters.
(_a = parameters.include) !== null && _a !== void 0 ? _a : (parameters.include = {});
(_b = (_k = parameters.include).customFields) !== null && _b !== void 0 ? _b : (_k.customFields = INCLUDE_CUSTOM_FIELDS);
(_c = (_l = parameters.include).totalCount) !== null && _c !== void 0 ? _c : (_l.totalCount = INCLUDE_TOTAL_COUNT);
(_d = (_m = parameters.include).statusField) !== null && _d !== void 0 ? _d : (_m.statusField = INCLUDE_STATUS);
(_e = (_o = parameters.include).UUIDFields) !== null && _e !== void 0 ? _e : (_o.UUIDFields = INCLUDE_UUID_FIELDS);
(_f = (_p = parameters.include).customUUIDFields) !== null && _f !== void 0 ? _f : (_p.customUUIDFields = INCLUDE_UUID_CUSTOM_FIELDS);
(_g = (_q = parameters.include).UUIDStatusField) !== null && _g !== void 0 ? _g : (_q.UUIDStatusField = INCLUDE_UUID_STATUS_FIELD);
(_h = (_r = parameters.include).UUIDTypeField) !== null && _h !== void 0 ? _h : (_r.UUIDTypeField = INCLUDE_UUID_TYPE_FIELD);
(_j = parameters.limit) !== null && _j !== void 0 ? _j : (parameters.limit = LIMIT);
(_b = (_l = parameters.include).customFields) !== null && _b !== void 0 ? _b : (_l.customFields = INCLUDE_CUSTOM_FIELDS);
(_c = (_m = parameters.include).totalCount) !== null && _c !== void 0 ? _c : (_m.totalCount = INCLUDE_TOTAL_COUNT);
(_d = (_o = parameters.include).statusField) !== null && _d !== void 0 ? _d : (_o.statusField = INCLUDE_STATUS);
(_e = (_p = parameters.include).typeField) !== null && _e !== void 0 ? _e : (_p.typeField = INCLUDE_TYPE);
(_f = (_q = parameters.include).UUIDFields) !== null && _f !== void 0 ? _f : (_q.UUIDFields = INCLUDE_UUID_FIELDS);
(_g = (_r = parameters.include).customUUIDFields) !== null && _g !== void 0 ? _g : (_r.customUUIDFields = INCLUDE_UUID_CUSTOM_FIELDS);
(_h = (_s = parameters.include).UUIDStatusField) !== null && _h !== void 0 ? _h : (_s.UUIDStatusField = INCLUDE_UUID_STATUS_FIELD);
(_j = (_t = parameters.include).UUIDTypeField) !== null && _j !== void 0 ? _j : (_t.UUIDTypeField = INCLUDE_UUID_TYPE_FIELD);
(_k = parameters.limit) !== null && _k !== void 0 ? _k : (parameters.limit = LIMIT);
}
operation() {
return operations_1.default.PNSetMembersOperation;
Expand Down Expand Up @@ -114,6 +119,8 @@ class GetChannelMembersRequest extends request_1.AbstractRequest {
const includeFlags = [];
if (include.statusField)
includeFlags.push('status');
if (include.typeField)
includeFlags.push('type');
if (include.customFields)
includeFlags.push('custom');
if (include.UUIDFields)
Expand Down
44 changes: 36 additions & 8 deletions lib/core/endpoints/objects/member/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ const utils_1 = require("../../../utils");
* Whether `Member` custom field should be included in response or not.
*/
const INCLUDE_CUSTOM_FIELDS = false;
/**
* Whether member's `status` field should be included in response or not.
*/
const INCLUDE_STATUS = false;
/**
* Whether member's `type` field should be included in response or not.
*/
const INCLUDE_TYPE = false;
/**
* Whether total number of members should be included in response or not.
*/
Expand All @@ -40,6 +48,14 @@ const INCLUDE_TOTAL_COUNT = false;
* Whether `UUID` fields should be included in response or not.
*/
const INCLUDE_UUID_FIELDS = false;
/**
* Whether `UUID` status field should be included in response or not.
*/
const INCLUDE_UUID_STATUS_FIELD = false;
/**
* Whether `UUID` type field should be included in response or not.
*/
const INCLUDE_UUID_TYPE_FIELD = false;
/**
* Whether `UUID` custom field should be included in response or not.
*/
Expand All @@ -56,17 +72,21 @@ const LIMIT = 100;
*/
class SetChannelMembersRequest extends request_1.AbstractRequest {
constructor(parameters) {
var _a, _b, _c, _d, _e, _f;
var _g, _h, _j, _k;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
var _l, _m, _o, _p, _q, _r, _s, _t;
super({ method: transport_request_1.TransportMethod.PATCH });
this.parameters = parameters;
// Apply default request parameters.
(_a = parameters.include) !== null && _a !== void 0 ? _a : (parameters.include = {});
(_b = (_g = parameters.include).customFields) !== null && _b !== void 0 ? _b : (_g.customFields = INCLUDE_CUSTOM_FIELDS);
(_c = (_h = parameters.include).totalCount) !== null && _c !== void 0 ? _c : (_h.totalCount = INCLUDE_TOTAL_COUNT);
(_d = (_j = parameters.include).UUIDFields) !== null && _d !== void 0 ? _d : (_j.UUIDFields = INCLUDE_UUID_FIELDS);
(_e = (_k = parameters.include).customUUIDFields) !== null && _e !== void 0 ? _e : (_k.customUUIDFields = INCLUDE_UUID_CUSTOM_FIELDS);
(_f = parameters.limit) !== null && _f !== void 0 ? _f : (parameters.limit = LIMIT);
(_b = (_l = parameters.include).customFields) !== null && _b !== void 0 ? _b : (_l.customFields = INCLUDE_CUSTOM_FIELDS);
(_c = (_m = parameters.include).totalCount) !== null && _c !== void 0 ? _c : (_m.totalCount = INCLUDE_TOTAL_COUNT);
(_d = (_o = parameters.include).statusField) !== null && _d !== void 0 ? _d : (_o.statusField = INCLUDE_STATUS);
(_e = (_p = parameters.include).typeField) !== null && _e !== void 0 ? _e : (_p.typeField = INCLUDE_TYPE);
(_f = (_q = parameters.include).UUIDFields) !== null && _f !== void 0 ? _f : (_q.UUIDFields = INCLUDE_UUID_FIELDS);
(_g = (_r = parameters.include).customUUIDFields) !== null && _g !== void 0 ? _g : (_r.customUUIDFields = INCLUDE_UUID_CUSTOM_FIELDS);
(_h = (_s = parameters.include).UUIDStatusField) !== null && _h !== void 0 ? _h : (_s.UUIDStatusField = INCLUDE_UUID_STATUS_FIELD);
(_j = (_t = parameters.include).UUIDTypeField) !== null && _j !== void 0 ? _j : (_t.UUIDTypeField = INCLUDE_UUID_TYPE_FIELD);
(_k = parameters.limit) !== null && _k !== void 0 ? _k : (parameters.limit = LIMIT);
}
operation() {
return operations_1.default.PNSetMembersOperation;
Expand Down Expand Up @@ -101,10 +121,18 @@ class SetChannelMembersRequest extends request_1.AbstractRequest {
else
sorting = Object.entries(sort !== null && sort !== void 0 ? sort : {}).map(([option, order]) => (order !== null ? `${option}:${order}` : option));
const includeFlags = ['uuid.status', 'uuid.type', 'type'];
if (include.statusField)
includeFlags.push('status');
if (include.typeField)
includeFlags.push('type');
if (include.customFields)
includeFlags.push('custom');
if (include.UUIDFields)
includeFlags.push('uuid');
if (include.UUIDStatusField)
includeFlags.push('uuid.status');
if (include.UUIDTypeField)
includeFlags.push('uuid.type');
if (include.customUUIDFields)
includeFlags.push('uuid.custom');
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ count: `${include.totalCount}` }, (includeFlags.length > 0 ? { include: includeFlags.join(',') } : {})), (filter ? { filter } : {})), ((page === null || page === void 0 ? void 0 : page.next) ? { start: page.next } : {})), ((page === null || page === void 0 ? void 0 : page.prev) ? { end: page.prev } : {})), (limit ? { limit } : {})), (sorting.length ? { sort: sorting } : {}));
Expand All @@ -117,7 +145,7 @@ class SetChannelMembersRequest extends request_1.AbstractRequest {
return { uuid: { id: uuid } };
}
else {
return { uuid: { id: uuid.id }, status: uuid.status, custom: uuid.custom };
return { uuid: { id: uuid.id }, status: uuid.status, type: uuid.type, custom: uuid.custom };
}
}),
});
Expand Down
29 changes: 18 additions & 11 deletions lib/core/endpoints/objects/membership/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ const utils_1 = require("../../../utils");
*/
const INCLUDE_CUSTOM_FIELDS = false;
/**
* Whether membership's status field should be included in response or not.
* Whether membership's `status` field should be included in response or not.
*/
const INCLUDE_STATUS = false;
/**
* Whether membership's `type` field should be included in response or not.
*/
const INCLUDE_TYPE = false;
/**
* Whether total number of memberships should be included in response or not.
*/
Expand Down Expand Up @@ -67,20 +71,21 @@ const LIMIT = 100;
*/
class GetUUIDMembershipsRequest extends request_1.AbstractRequest {
constructor(parameters) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
var _k, _l, _m, _o, _p, _q, _r;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
var _l, _m, _o, _p, _q, _r, _s, _t;
super();
this.parameters = parameters;
// Apply default request parameters.
(_a = parameters.include) !== null && _a !== void 0 ? _a : (parameters.include = {});
(_b = (_k = parameters.include).customFields) !== null && _b !== void 0 ? _b : (_k.customFields = INCLUDE_CUSTOM_FIELDS);
(_c = (_l = parameters.include).totalCount) !== null && _c !== void 0 ? _c : (_l.totalCount = INCLUDE_TOTAL_COUNT);
(_d = (_m = parameters.include).statusField) !== null && _d !== void 0 ? _d : (_m.statusField = INCLUDE_STATUS);
(_e = (_o = parameters.include).channelFields) !== null && _e !== void 0 ? _e : (_o.channelFields = INCLUDE_CHANNEL_FIELDS);
(_f = (_p = parameters.include).customChannelFields) !== null && _f !== void 0 ? _f : (_p.customChannelFields = INCLUDE_CHANNEL_CUSTOM_FIELDS);
(_g = (_q = parameters.include).channelStatusField) !== null && _g !== void 0 ? _g : (_q.channelStatusField = INCLUDE_CHANNEL_STATUS_FIELD);
(_h = (_r = parameters.include).channelTypeField) !== null && _h !== void 0 ? _h : (_r.channelTypeField = INCLUDE_CHANNEL_TYPE_FIELD);
(_j = parameters.limit) !== null && _j !== void 0 ? _j : (parameters.limit = LIMIT);
(_b = (_l = parameters.include).customFields) !== null && _b !== void 0 ? _b : (_l.customFields = INCLUDE_CUSTOM_FIELDS);
(_c = (_m = parameters.include).totalCount) !== null && _c !== void 0 ? _c : (_m.totalCount = INCLUDE_TOTAL_COUNT);
(_d = (_o = parameters.include).statusField) !== null && _d !== void 0 ? _d : (_o.statusField = INCLUDE_STATUS);
(_e = (_p = parameters.include).typeField) !== null && _e !== void 0 ? _e : (_p.typeField = INCLUDE_TYPE);
(_f = (_q = parameters.include).channelFields) !== null && _f !== void 0 ? _f : (_q.channelFields = INCLUDE_CHANNEL_FIELDS);
(_g = (_r = parameters.include).customChannelFields) !== null && _g !== void 0 ? _g : (_r.customChannelFields = INCLUDE_CHANNEL_CUSTOM_FIELDS);
(_h = (_s = parameters.include).channelStatusField) !== null && _h !== void 0 ? _h : (_s.channelStatusField = INCLUDE_CHANNEL_STATUS_FIELD);
(_j = (_t = parameters.include).channelTypeField) !== null && _j !== void 0 ? _j : (_t.channelTypeField = INCLUDE_CHANNEL_TYPE_FIELD);
(_k = parameters.limit) !== null && _k !== void 0 ? _k : (parameters.limit = LIMIT);
// Remap for backward compatibility.
if (this.parameters.userId)
this.parameters.uuid = this.parameters.userId;
Expand Down Expand Up @@ -117,6 +122,8 @@ class GetUUIDMembershipsRequest extends request_1.AbstractRequest {
const includeFlags = [];
if (include.statusField)
includeFlags.push('status');
if (include.typeField)
includeFlags.push('type');
if (include.customFields)
includeFlags.push('custom');
if (include.channelFields)
Expand Down
Loading
Loading