epicenter-libs 3.33.0 → 3.34.1
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.
- package/CHANGELOG.md +17 -0
- package/dist/browser/epicenter.js +105 -2
- package/dist/browser/epicenter.js.map +1 -1
- package/dist/cjs/epicenter.js +105 -2
- package/dist/cjs/epicenter.js.map +1 -1
- package/dist/epicenter.js +105 -2
- package/dist/epicenter.js.map +1 -1
- package/dist/epicenter.min.js +1 -1
- package/dist/epicenter.min.js.map +1 -1
- package/dist/module/epicenter.js +105 -2
- package/dist/module/epicenter.js.map +1 -1
- package/dist/types/adapters/chat.d.ts +63 -0
- package/package.json +1 -1
- package/src/adapters/chat.ts +95 -0
- package/src/utils/identification.ts +4 -0
- package/dist/test/_virtual/runtime.js +0 -3
- package/dist/test/_virtual/runtime2.js +0 -3
- package/dist/test/adapters/account.js +0 -169
- package/dist/test/adapters/admin.js +0 -53
- package/dist/test/adapters/asset.js +0 -425
- package/dist/test/adapters/authentication.js +0 -349
- package/dist/test/adapters/channel.js +0 -201
- package/dist/test/adapters/chat.js +0 -199
- package/dist/test/adapters/cometd.js +0 -514
- package/dist/test/adapters/consensus.js +0 -484
- package/dist/test/adapters/daily.js +0 -244
- package/dist/test/adapters/email.js +0 -179
- package/dist/test/adapters/episode.js +0 -175
- package/dist/test/adapters/group.js +0 -655
- package/dist/test/adapters/leaderboard.js +0 -162
- package/dist/test/adapters/matchmaker.js +0 -159
- package/dist/test/adapters/presence.js +0 -85
- package/dist/test/adapters/project.js +0 -94
- package/dist/test/adapters/recaptcha.js +0 -24
- package/dist/test/adapters/run.js +0 -1008
- package/dist/test/adapters/somebody.js +0 -154
- package/dist/test/adapters/task.js +0 -192
- package/dist/test/adapters/time.js +0 -28
- package/dist/test/adapters/user.js +0 -105
- package/dist/test/adapters/vault.js +0 -403
- package/dist/test/adapters/video.js +0 -249
- package/dist/test/adapters/vonage.js +0 -130
- package/dist/test/adapters/wallet.js +0 -130
- package/dist/test/adapters/world.js +0 -507
- package/dist/test/apis/video.js +0 -294
- package/dist/test/apis/vonage.js +0 -121
- package/dist/test/epicenter.js +0 -121
- package/dist/test/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -12
- package/dist/test/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -14
- package/dist/test/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -9
- package/dist/test/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -11
- package/dist/test/node_modules/cometd/AckExtension.js +0 -91
- package/dist/test/node_modules/cometd/CallbackPollingTransport.js +0 -148
- package/dist/test/node_modules/cometd/Client.js +0 -2160
- package/dist/test/node_modules/cometd/Extension.js +0 -47
- package/dist/test/node_modules/cometd/LongPollingTransport.js +0 -135
- package/dist/test/node_modules/cometd/ReloadExtension.js +0 -214
- package/dist/test/node_modules/cometd/RequestTransport.js +0 -252
- package/dist/test/node_modules/cometd/Transport.js +0 -167
- package/dist/test/node_modules/cometd/TransportRegistry.js +0 -107
- package/dist/test/node_modules/cometd/WebSocketTransport.js +0 -384
- package/dist/test/node_modules/cometd/cometd.js +0 -9
- package/dist/test/node_modules/regenerator-runtime/runtime.js +0 -773
- package/dist/test/utilities.js +0 -17
- package/dist/test/utils/config.js +0 -189
- package/dist/test/utils/constants.js +0 -293
- package/dist/test/utils/cookies.js +0 -75
- package/dist/test/utils/error-manager.js +0 -57
- package/dist/test/utils/error.js +0 -12
- package/dist/test/utils/fault.js +0 -34
- package/dist/test/utils/filter-parser.js +0 -68
- package/dist/test/utils/helpers.js +0 -9
- package/dist/test/utils/identification.js +0 -161
- package/dist/test/utils/result.js +0 -20
- package/dist/test/utils/router.js +0 -551
- package/dist/test/utils/store.js +0 -79
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { RequestTransport } from './RequestTransport.js';
|
|
2
|
-
|
|
3
|
-
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
4
|
-
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
5
|
-
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
6
|
-
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
7
|
-
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
8
|
-
var _jsonp = /*#__PURE__*/new WeakMap();
|
|
9
|
-
class CallbackPollingTransport extends RequestTransport {
|
|
10
|
-
constructor(...args) {
|
|
11
|
-
super(...args);
|
|
12
|
-
_classPrivateFieldInitSpec(this, _jsonp, 0);
|
|
13
|
-
}
|
|
14
|
-
accept(version, crossDomain, url) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
jsonpSend(packet) {
|
|
18
|
-
var _this$jsonp, _this$jsonp2;
|
|
19
|
-
const head = window.document.getElementsByTagName("head")[0];
|
|
20
|
-
const script = window.document.createElement("script");
|
|
21
|
-
const callbackName = "_cometd_jsonp_" + (_classPrivateFieldSet(_jsonp, this, (_this$jsonp = _classPrivateFieldGet(_jsonp, this), _this$jsonp2 = _this$jsonp++, _this$jsonp)), _this$jsonp2);
|
|
22
|
-
window[callbackName] = responseText => {
|
|
23
|
-
head.removeChild(script);
|
|
24
|
-
delete window[callbackName];
|
|
25
|
-
packet.onSuccess(responseText);
|
|
26
|
-
};
|
|
27
|
-
let url = packet.url;
|
|
28
|
-
url += url.indexOf("?") < 0 ? "?" : "&";
|
|
29
|
-
url += "jsonp=" + callbackName;
|
|
30
|
-
url += "&message=" + encodeURIComponent(packet.body);
|
|
31
|
-
script.src = url;
|
|
32
|
-
script.async = packet.sync !== true;
|
|
33
|
-
script.type = "text/javascript";
|
|
34
|
-
script.onerror = e => {
|
|
35
|
-
packet.onError("jsonp " + e.type);
|
|
36
|
-
};
|
|
37
|
-
head.appendChild(script);
|
|
38
|
-
}
|
|
39
|
-
transportSend(envelope, request) {
|
|
40
|
-
// Microsoft Internet Explorer has a 2083 URL max length
|
|
41
|
-
// We must ensure that we stay within that length.
|
|
42
|
-
let start = 0;
|
|
43
|
-
let length = envelope.messages.length;
|
|
44
|
-
const lengths = [];
|
|
45
|
-
while (length > 0) {
|
|
46
|
-
// Encode the messages because all brackets, quotes, commas, colons, etc.
|
|
47
|
-
// present in the JSON will be URL encoded, taking many more characters.
|
|
48
|
-
const json = JSON.stringify(envelope.messages.slice(start, start + length));
|
|
49
|
-
const urlLength = envelope.url.length + encodeURI(json).length;
|
|
50
|
-
const maxLength = this.configuration.maxURILength;
|
|
51
|
-
if (urlLength > maxLength) {
|
|
52
|
-
if (length === 1) {
|
|
53
|
-
const x = "Bayeux message too big (" + urlLength + " bytes, max is " + maxLength + ") " + "for transport " + this;
|
|
54
|
-
// Keep the semantic of calling callbacks asynchronously.
|
|
55
|
-
this.setTimeout(() => this.transportFailure(envelope, request, {
|
|
56
|
-
exception: x
|
|
57
|
-
}), 0);
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
--length;
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
lengths.push(length);
|
|
64
|
-
start += length;
|
|
65
|
-
length = envelope.messages.length - start;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Here we are sure that the messages can be sent within the URL limit
|
|
69
|
-
|
|
70
|
-
let envelopeToSend = envelope;
|
|
71
|
-
if (lengths.length > 1) {
|
|
72
|
-
let begin = 0;
|
|
73
|
-
let end = lengths[0];
|
|
74
|
-
this.debug("Transport", this.type, "split", envelope.messages.length, "messages into", lengths.join(" + "));
|
|
75
|
-
envelopeToSend = this.cometd._mixin(false, {}, envelope);
|
|
76
|
-
envelopeToSend.messages = envelope.messages.slice(begin, end);
|
|
77
|
-
envelopeToSend.onSuccess = envelope.onSuccess;
|
|
78
|
-
envelopeToSend.onFailure = envelope.onFailure;
|
|
79
|
-
for (let i = 1; i < lengths.length; ++i) {
|
|
80
|
-
const nextEnvelope = this.cometd._mixin(false, {}, envelope);
|
|
81
|
-
begin = end;
|
|
82
|
-
end += lengths[i];
|
|
83
|
-
nextEnvelope.messages = envelope.messages.slice(begin, end);
|
|
84
|
-
nextEnvelope.onSuccess = envelope.onSuccess;
|
|
85
|
-
nextEnvelope.onFailure = envelope.onFailure;
|
|
86
|
-
this.send(nextEnvelope, request.metaConnect);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
this.debug("Transport", this.type, "sending request", request.id, "envelope", envelopeToSend);
|
|
90
|
-
try {
|
|
91
|
-
let sameStack = true;
|
|
92
|
-
this.jsonpSend({
|
|
93
|
-
transport: this,
|
|
94
|
-
url: envelopeToSend.url,
|
|
95
|
-
sync: envelopeToSend.sync,
|
|
96
|
-
headers: this.configuration.requestHeaders,
|
|
97
|
-
body: JSON.stringify(envelopeToSend.messages),
|
|
98
|
-
onSuccess: responses => {
|
|
99
|
-
let success = false;
|
|
100
|
-
try {
|
|
101
|
-
const received = this.convertToMessages(responses);
|
|
102
|
-
if (received.length === 0) {
|
|
103
|
-
this.transportFailure(envelopeToSend, request, {
|
|
104
|
-
httpCode: 204
|
|
105
|
-
});
|
|
106
|
-
} else {
|
|
107
|
-
success = true;
|
|
108
|
-
this.transportSuccess(envelopeToSend, request, received);
|
|
109
|
-
}
|
|
110
|
-
} catch (x) {
|
|
111
|
-
this.debug(x);
|
|
112
|
-
if (!success) {
|
|
113
|
-
this.transportFailure(envelopeToSend, request, {
|
|
114
|
-
exception: x
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
onError: (reason, exception) => {
|
|
120
|
-
const failure = {
|
|
121
|
-
reason: reason,
|
|
122
|
-
exception: exception
|
|
123
|
-
};
|
|
124
|
-
if (sameStack) {
|
|
125
|
-
// Keep the semantic of calling callbacks asynchronously.
|
|
126
|
-
this.setTimeout(() => {
|
|
127
|
-
this.transportFailure(envelopeToSend, request, failure);
|
|
128
|
-
}, 0);
|
|
129
|
-
} else {
|
|
130
|
-
this.transportFailure(envelopeToSend, request, failure);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
sameStack = false;
|
|
135
|
-
return true;
|
|
136
|
-
} catch (xx) {
|
|
137
|
-
// Keep the semantic of calling callbacks asynchronously.
|
|
138
|
-
this.setTimeout(() => {
|
|
139
|
-
this.transportFailure(envelopeToSend, request, {
|
|
140
|
-
exception: xx
|
|
141
|
-
});
|
|
142
|
-
}, 0);
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export { CallbackPollingTransport };
|