-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: cucumber refactor * feat: add more steps * feat: current progress * refactor event-engine(from draft PR) * event-engine: update to latest description, added some missing transitions * prettier! * take: fix hanging tests due to retry intro * update as per latest event engine specs * * cucumber tsflow * prettier! * fix: test and version mismatch from branch merge * fix: version * add: reconnection configuration * lint/prettier * fix: test. destroy() not required * fix: naming convention and removed unnecessary effect dispatch * WIP: presence event engine * organised files and directories for presence * fix: paths * fix: lint * presence and subscribe event engine states * event engine effects and events * retry policy configuration * event engines tests * updated stateless utilities * updated PubNub with configurations * lib and dist * take-1 fix lint * fix: elint config * sync: package-lock * fix: package-lock * WIP take-1(non-status events): Listener compatibility with eventEngine * take-2: (presence) listener structs backward compatibility. * lib and dist * lint * event engine: naming, missing transitions, handling `reconnect` and `restore` all applicable states, removed old definitions for events * event engine: receiving state as per specifications * refined naming for event engine events and effects * retryConfiguration behaviour updates * presence eventengine: removed unnecessary emitStatus events as per specifications * config naming convention, eventengine initialisation updates as per new updated naming conventions * updated tests * dist, lib and lint fixes * package-lock dependabot suggestion, fix test * removed duplicate file * fix: prevent duplicate listener to be added. * dist/lib files * retry delay can be override by retry after value * handled cursor across the states * manage cursor from event struct * dist and lib * refactor: reconnect event handling * getSubscribedChannels and channelGroups binding when eventEngine is enabled * refactor: retry policy delay calculation * handshake* states: handling cursor value across state and defaulting to 0 for region when context/event has undefined * receiv* states: handling cursor across states * lib/dist * addressed review comments : handling cursor value from context from handshake and receiveFailed * revert test file changes * fix: lint * sync package-lock * removed flow_interfaces reference * PubNub SDK v7.5.0 release. --------- Co-authored-by: Artur Wojciechowski <me@iama.re> Co-authored-by: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com>
- Loading branch information
1 parent
76bc504
commit f0bd4e5
Showing
194 changed files
with
6,349 additions
and
8,834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
default: [ | ||
'test/specs/features/**/*.feature', | ||
'--require test/contract/setup.js', | ||
'--require test/contract/definitions/**/*.ts', | ||
'--require test/contract/shared/**/*.ts', | ||
'--format summary', | ||
'--format progress-bar', | ||
// '--format @cucumber/pretty-formatter', | ||
'--publish-quiet', | ||
].join(' '), | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var EventEmitter = /** @class */ (function () { | ||
function EventEmitter(_a) { | ||
var modules = _a.modules, listenerManager = _a.listenerManager, getFileUrl = _a.getFileUrl; | ||
this.modules = modules; | ||
this.listenerManager = listenerManager; | ||
this.getFileUrl = getFileUrl; | ||
if (modules.cryptoModule) | ||
this._decoder = new TextDecoder(); | ||
} | ||
EventEmitter.prototype.emitEvent = function (e) { | ||
var channel = e.channel, publishMetaData = e.publishMetaData; | ||
var subscriptionMatch = e.subscriptionMatch; | ||
if (channel === subscriptionMatch) { | ||
subscriptionMatch = null; | ||
} | ||
if (e.channel.endsWith('-pnpres')) { | ||
var announce = {}; | ||
announce.channel = null; | ||
announce.subscription = null; | ||
if (channel) { | ||
announce.channel = channel.substring(0, channel.lastIndexOf('-pnpres')); | ||
} | ||
if (subscriptionMatch) { | ||
announce.subscription = subscriptionMatch.substring(0, subscriptionMatch.lastIndexOf('-pnpres')); | ||
} | ||
announce.action = e.payload.action; | ||
announce.state = e.payload.data; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
announce.occupancy = e.payload.occupancy; | ||
announce.uuid = e.payload.uuid; | ||
announce.timestamp = e.payload.timestamp; | ||
if (e.payload.join) { | ||
announce.join = e.payload.join; | ||
} | ||
if (e.payload.leave) { | ||
announce.leave = e.payload.leave; | ||
} | ||
if (e.payload.timeout) { | ||
announce.timeout = e.payload.timeout; | ||
} | ||
this.listenerManager.announcePresence(announce); | ||
} | ||
else if (e.messageType === 1) { | ||
var announce = {}; | ||
announce.channel = null; | ||
announce.subscription = null; | ||
announce.channel = channel; | ||
announce.subscription = subscriptionMatch; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
announce.publisher = e.issuingClientId; | ||
if (e.userMetadata) { | ||
announce.userMetadata = e.userMetadata; | ||
} | ||
announce.message = e.payload; | ||
this.listenerManager.announceSignal(announce); | ||
} | ||
else if (e.messageType === 2) { | ||
var announce = {}; | ||
announce.channel = null; | ||
announce.subscription = null; | ||
announce.channel = channel; | ||
announce.subscription = subscriptionMatch; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
announce.publisher = e.issuingClientId; | ||
if (e.userMetadata) { | ||
announce.userMetadata = e.userMetadata; | ||
} | ||
announce.message = { | ||
event: e.payload.event, | ||
type: e.payload.type, | ||
data: e.payload.data, | ||
}; | ||
this.listenerManager.announceObjects(announce); | ||
if (e.payload.type === 'uuid') { | ||
var eventData = this._renameChannelField(announce); | ||
this.listenerManager.announceUser(__assign(__assign({}, eventData), { message: __assign(__assign({}, eventData.message), { event: this._renameEvent(eventData.message.event), type: 'user' }) })); | ||
} | ||
else if (message.payload.type === 'channel') { | ||
var eventData = this._renameChannelField(announce); | ||
this.listenerManager.announceSpace(__assign(__assign({}, eventData), { message: __assign(__assign({}, eventData.message), { event: this._renameEvent(eventData.message.event), type: 'space' }) })); | ||
} | ||
else if (message.payload.type === 'membership') { | ||
var eventData = this._renameChannelField(announce); | ||
var _a = eventData.message.data, user = _a.uuid, space = _a.channel, membershipData = __rest(_a, ["uuid", "channel"]); | ||
membershipData.user = user; | ||
membershipData.space = space; | ||
this.listenerManager.announceMembership(__assign(__assign({}, eventData), { message: __assign(__assign({}, eventData.message), { event: this._renameEvent(eventData.message.event), data: membershipData }) })); | ||
} | ||
} | ||
else if (e.messageType === 3) { | ||
var announce = {}; | ||
announce.channel = channel; | ||
announce.subscription = subscriptionMatch; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
announce.publisher = e.issuingClientId; | ||
announce.data = { | ||
messageTimetoken: e.payload.data.messageTimetoken, | ||
actionTimetoken: e.payload.data.actionTimetoken, | ||
type: e.payload.data.type, | ||
uuid: e.issuingClientId, | ||
value: e.payload.data.value, | ||
}; | ||
announce.event = e.payload.event; | ||
this.listenerManager.announceMessageAction(announce); | ||
} | ||
else if (e.messageType === 4) { | ||
var announce = {}; | ||
announce.channel = channel; | ||
announce.subscription = subscriptionMatch; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
announce.publisher = e.issuingClientId; | ||
var msgPayload = e.payload; | ||
if (this.modules.cryptoModule) { | ||
var decryptedPayload = void 0; | ||
try { | ||
var decryptedData = this.modules.cryptoModule.decrypt(e.payload); | ||
decryptedPayload = | ||
decryptedData instanceof ArrayBuffer ? JSON.parse(this._decoder.decode(decryptedData)) : decryptedData; | ||
} | ||
catch (e) { | ||
decryptedPayload = null; | ||
announce.error = "Error while decrypting message content: ".concat(e.message); | ||
} | ||
if (decryptedPayload !== null) { | ||
msgPayload = decryptedPayload; | ||
} | ||
} | ||
if (e.userMetadata) { | ||
announce.userMetadata = e.userMetadata; | ||
} | ||
announce.message = msgPayload.message; | ||
announce.file = { | ||
id: msgPayload.file.id, | ||
name: msgPayload.file.name, | ||
url: this.getFileUrl({ | ||
id: msgPayload.file.id, | ||
name: msgPayload.file.name, | ||
channel: channel, | ||
}), | ||
}; | ||
this.listenerManager.announceFile(announce); | ||
} | ||
else { | ||
var announce = {}; | ||
announce.channel = null; | ||
announce.subscription = null; | ||
announce.channel = channel; | ||
announce.subscription = subscriptionMatch; | ||
announce.timetoken = publishMetaData.publishTimetoken; | ||
announce.publisher = e.issuingClientId; | ||
if (e.userMetadata) { | ||
announce.userMetadata = e.userMetadata; | ||
} | ||
if (this.modules.cryptoModule) { | ||
var decryptedPayload = void 0; | ||
try { | ||
var decryptedData = this.modules.cryptoModule.decrypt(e.payload); | ||
decryptedPayload = | ||
decryptedData instanceof ArrayBuffer ? JSON.parse(this._decoder.decode(decryptedData)) : decryptedData; | ||
} | ||
catch (e) { | ||
decryptedPayload = null; | ||
announce.error = "Error while decrypting message content: ".concat(e.message); | ||
} | ||
if (decryptedPayload != null) { | ||
announce.message = decryptedPayload; | ||
} | ||
else { | ||
announce.message = e.payload; | ||
} | ||
} | ||
else { | ||
announce.message = e.payload; | ||
} | ||
this.listenerManager.announceMessage(announce); | ||
} | ||
}; | ||
EventEmitter.prototype._renameEvent = function (e) { | ||
return e === 'set' ? 'updated' : 'removed'; | ||
}; | ||
EventEmitter.prototype._renameChannelField = function (announce) { | ||
var channel = announce.channel, eventData = __rest(announce, ["channel"]); | ||
eventData.spaceId = channel; | ||
return eventData; | ||
}; | ||
return EventEmitter; | ||
}()); | ||
exports.default = EventEmitter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.