stanza 12.17.3 → 12.19.0
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/Client.d.ts +2 -0
- package/Client.js +13 -11
- package/Constants.js +9 -9
- package/JID.js +4 -4
- package/README.md +0 -8
- package/Utils.d.ts +2 -0
- package/Utils.js +30 -6
- package/helpers/DiscoManager.js +1 -1
- package/helpers/LegacyEntityCapabilities.js +6 -7
- package/helpers/NetworkDiscovery.d.ts +36 -0
- package/helpers/NetworkDiscovery.js +152 -0
- package/helpers/RSM.js +2 -1
- package/helpers/RTT.js +2 -2
- package/helpers/StreamManagement.js +6 -2
- package/index.d.ts +4 -1
- package/index.js +18 -16
- package/index.module.js +23 -0
- package/jingle/FileTransferSession.d.ts +1 -1
- package/jingle/FileTransferSession.js +8 -8
- package/jingle/ICESession.js +13 -13
- package/jingle/MediaSession.js +7 -7
- package/jingle/Session.js +3 -3
- package/jingle/SessionManager.js +8 -8
- package/jingle/index.js +5 -5
- package/jingle/sdp/Intermediate.js +1 -1
- package/jingle/sdp/Protocol.js +7 -5
- package/jxt/Definitions.js +1 -1
- package/jxt/Element.js +2 -2
- package/jxt/Parser.js +6 -6
- package/jxt/Registry.js +2 -2
- package/jxt/StreamParser.d.ts +1 -1
- package/jxt/StreamParser.js +5 -5
- package/jxt/Translator.js +1 -1
- package/jxt/Types.d.ts +1 -0
- package/jxt/Types.js +11 -10
- package/jxt/index.js +8 -8
- package/lib/sasl/index.js +37 -38
- package/lib/stringprep/index.js +1 -1
- package/package.json +9 -17
- package/platform/browser/buffer/base64-js/index.d.ts +3 -0
- package/platform/browser/buffer/base64-js/index.js +110 -0
- package/platform/browser/buffer/ieee754/index.d.ts +2 -0
- package/platform/browser/buffer/ieee754/index.js +81 -0
- package/platform/browser/buffer/index.d.ts +138 -0
- package/platform/browser/buffer/index.js +1877 -0
- package/platform/browser/crypto/Hash.d.ts +28 -0
- package/platform/browser/crypto/Hash.js +114 -0
- package/platform/browser/crypto/Hmac.d.ts +27 -0
- package/platform/browser/crypto/Hmac.js +82 -0
- package/platform/browser/crypto/MD5.d.ts +22 -0
- package/platform/browser/crypto/MD5.js +129 -0
- package/platform/browser/crypto/SHA-1.d.ts +23 -0
- package/platform/browser/crypto/SHA-1.js +94 -0
- package/platform/browser/crypto/SHA-256.d.ts +33 -0
- package/platform/browser/crypto/SHA-256.js +173 -0
- package/platform/browser/crypto/SHA-512.d.ts +34 -0
- package/platform/browser/crypto/SHA-512.js +352 -0
- package/platform/browser/crypto/createHash.d.ts +3 -0
- package/platform/browser/crypto/createHash.js +31 -0
- package/platform/browser/index.d.ts +21 -0
- package/platform/browser/index.js +46 -0
- package/platform/browser/process.d.ts +1 -0
- package/platform/browser/process.js +62 -0
- package/platform/browser/stream/index.d.ts +5 -0
- package/platform/browser/stream/index.js +6 -0
- package/platform/browser/stream/lib/_stream_duplex.d.ts +12 -0
- package/platform/browser/stream/lib/_stream_duplex.js +114 -0
- package/platform/browser/stream/lib/_stream_passthrough.d.ts +6 -0
- package/platform/browser/stream/lib/_stream_passthrough.js +38 -0
- package/platform/browser/stream/lib/_stream_readable.d.ts +60 -0
- package/platform/browser/stream/lib/_stream_readable.js +980 -0
- package/platform/browser/stream/lib/_stream_transform.d.ts +20 -0
- package/platform/browser/stream/lib/_stream_transform.js +189 -0
- package/platform/browser/stream/lib/_stream_writable.d.ts +62 -0
- package/platform/browser/stream/lib/_stream_writable.js +632 -0
- package/platform/browser/stream/lib/internal/streams/BufferList.d.ts +11 -0
- package/platform/browser/stream/lib/internal/streams/BufferList.js +68 -0
- package/platform/browser/stream/lib/internal/streams/destroy.d.ts +2 -0
- package/platform/browser/stream/lib/internal/streams/destroy.js +62 -0
- package/platform/browser/stream/string_decoder.d.ts +24 -0
- package/platform/browser/stream/string_decoder.js +312 -0
- package/platform/browser/stream/util.d.ts +1 -0
- package/platform/browser/stream/util.js +34 -0
- package/platform/index.d.ts +1 -0
- package/platform/index.js +4 -0
- package/platform/node/index.d.ts +16 -0
- package/platform/node/index.js +53 -0
- package/platform/react-native/index.d.ts +2 -0
- package/platform/react-native/index.js +7 -0
- package/plugins/avatar.js +1 -1
- package/plugins/connection.js +1 -1
- package/plugins/disco.js +2 -2
- package/plugins/entity.js +2 -2
- package/plugins/hostmeta.d.ts +17 -10
- package/plugins/hostmeta.js +40 -62
- package/plugins/index.js +36 -36
- package/plugins/jingle.js +3 -3
- package/plugins/mam.js +2 -2
- package/plugins/messaging.js +1 -1
- package/plugins/muc.js +3 -3
- package/plugins/pep.js +5 -5
- package/plugins/pubsub.js +1 -1
- package/plugins/roster.js +1 -1
- package/plugins/sharing.js +1 -1
- package/protocol/index.js +162 -162
- package/protocol/rfc3921.js +1 -1
- package/protocol/rfc4287.js +24 -24
- package/protocol/rfc6120.js +41 -41
- package/protocol/rfc6121.js +25 -25
- package/protocol/rfc7395.js +6 -6
- package/protocol/xep0004.js +21 -21
- package/protocol/xep0012.js +2 -2
- package/protocol/xep0016.js +11 -11
- package/protocol/xep0030.js +16 -16
- package/protocol/xep0033.js +11 -11
- package/protocol/xep0045.js +49 -49
- package/protocol/xep0047.js +8 -8
- package/protocol/xep0048.js +6 -6
- package/protocol/xep0050.js +13 -13
- package/protocol/xep0054.js +34 -34
- package/protocol/xep0055.js +12 -12
- package/protocol/xep0059.js +8 -8
- package/protocol/xep0060.js +53 -53
- package/protocol/xep0065.js +10 -10
- package/protocol/xep0066.js +4 -4
- package/protocol/xep0071.js +2 -2
- package/protocol/xep0077.js +24 -24
- package/protocol/xep0080.js +26 -26
- package/protocol/xep0084.js +14 -14
- package/protocol/xep0085.js +2 -2
- package/protocol/xep0092.js +3 -3
- package/protocol/xep0107.js +4 -4
- package/protocol/xep0108.js +4 -4
- package/protocol/xep0114.js +1 -1
- package/protocol/xep0115.js +4 -4
- package/protocol/xep0118.js +8 -8
- package/protocol/xep0124.js +30 -30
- package/protocol/xep0131.js +6 -6
- package/protocol/xep0138.js +3 -3
- package/protocol/xep0141.js +4 -4
- package/protocol/xep0144.js +8 -8
- package/protocol/xep0153.js +6 -6
- package/protocol/xep0158.js +4 -4
- package/protocol/xep0166.js +13 -13
- package/protocol/xep0167.js +41 -41
- package/protocol/xep0172.js +6 -6
- package/protocol/xep0176.js +19 -19
- package/protocol/xep0177.js +10 -10
- package/protocol/xep0184.js +1 -1
- package/protocol/xep0186.js +1 -1
- package/protocol/xep0191.js +5 -5
- package/protocol/xep0198.js +11 -11
- package/protocol/xep0199.js +2 -2
- package/protocol/xep0202.js +2 -2
- package/protocol/xep0203.js +3 -3
- package/protocol/xep0215.js +19 -19
- package/protocol/xep0221.js +4 -4
- package/protocol/xep0224.js +2 -2
- package/protocol/xep0231.js +4 -4
- package/protocol/xep0234.js +15 -15
- package/protocol/xep0260.js +14 -14
- package/protocol/xep0261.js +4 -4
- package/protocol/xep0264.js +5 -5
- package/protocol/xep0280.js +1 -1
- package/protocol/xep0297.js +4 -4
- package/protocol/xep0300.js +8 -8
- package/protocol/xep0301.js +8 -8
- package/protocol/xep0308.js +2 -2
- package/protocol/xep0313.js +12 -12
- package/protocol/xep0317.js +4 -4
- package/protocol/xep0319.js +2 -2
- package/protocol/xep0320.js +3 -3
- package/protocol/xep0333.js +3 -3
- package/protocol/xep0334.js +5 -5
- package/protocol/xep0335.js +6 -6
- package/protocol/xep0338.js +2 -2
- package/protocol/xep0343.js +3 -3
- package/protocol/xep0357.js +6 -6
- package/protocol/xep0359.js +4 -4
- package/protocol/xep0363.js +11 -11
- package/protocol/xep0380.js +2 -2
- package/protocol/xep0384.js +16 -16
- package/protocol/xrd.js +4 -4
- package/transports/bosh.d.ts +2 -1
- package/transports/bosh.js +4 -5
- package/transports/websocket.d.ts +2 -1
- package/transports/websocket.js +6 -7
- package/module.js +0 -15376
package/Client.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import * as JXT from './jxt';
|
|
|
7
7
|
import { JSONData } from './jxt';
|
|
8
8
|
import * as SASL from './lib/sasl';
|
|
9
9
|
import { IQ, Message, Presence, StreamError, Stream } from './protocol';
|
|
10
|
+
import NetworkDiscovery from './helpers/NetworkDiscovery';
|
|
10
11
|
interface StreamData {
|
|
11
12
|
kind: string;
|
|
12
13
|
stanza: any;
|
|
@@ -18,6 +19,7 @@ export default class Client extends EventEmitter {
|
|
|
18
19
|
sm: StreamManagement;
|
|
19
20
|
transport?: Transport;
|
|
20
21
|
stanzas: JXT.Registry;
|
|
22
|
+
resolver: NetworkDiscovery;
|
|
21
23
|
sessionStarting?: boolean;
|
|
22
24
|
sessionStarted?: boolean;
|
|
23
25
|
sessionTerminating?: boolean;
|
package/Client.js
CHANGED
|
@@ -3,15 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const async_1 = require("async");
|
|
5
5
|
const events_1 = require("events");
|
|
6
|
-
const StreamManagement_1 = tslib_1.__importDefault(require("./helpers/StreamManagement"));
|
|
7
|
-
const JID = tslib_1.__importStar(require("./JID"));
|
|
8
|
-
const JXT = tslib_1.__importStar(require("./jxt"));
|
|
9
|
-
const SASL = tslib_1.__importStar(require("./lib/sasl"));
|
|
6
|
+
const StreamManagement_1 = (0, tslib_1.__importDefault)(require("./helpers/StreamManagement"));
|
|
7
|
+
const JID = (0, tslib_1.__importStar)(require("./JID"));
|
|
8
|
+
const JXT = (0, tslib_1.__importStar)(require("./jxt"));
|
|
9
|
+
const SASL = (0, tslib_1.__importStar)(require("./lib/sasl"));
|
|
10
10
|
const plugins_1 = require("./plugins");
|
|
11
|
-
const protocol_1 = tslib_1.__importDefault(require("./protocol"));
|
|
12
|
-
const bosh_1 = tslib_1.__importDefault(require("./transports/bosh"));
|
|
13
|
-
const websocket_1 = tslib_1.__importDefault(require("./transports/websocket"));
|
|
11
|
+
const protocol_1 = (0, tslib_1.__importDefault)(require("./protocol"));
|
|
12
|
+
const bosh_1 = (0, tslib_1.__importDefault)(require("./transports/bosh"));
|
|
13
|
+
const websocket_1 = (0, tslib_1.__importDefault)(require("./transports/websocket"));
|
|
14
14
|
const Utils_1 = require("./Utils");
|
|
15
|
+
const NetworkDiscovery_1 = (0, tslib_1.__importDefault)(require("./helpers/NetworkDiscovery"));
|
|
15
16
|
class Client extends events_1.EventEmitter {
|
|
16
17
|
constructor(opts = {}) {
|
|
17
18
|
super();
|
|
@@ -34,6 +35,7 @@ class Client extends events_1.EventEmitter {
|
|
|
34
35
|
this.sasl.register('ANONYMOUS', SASL.ANONYMOUS, 0);
|
|
35
36
|
this.stanzas = new JXT.Registry();
|
|
36
37
|
this.stanzas.define(protocol_1.default);
|
|
38
|
+
this.resolver = new NetworkDiscovery_1.default();
|
|
37
39
|
this.use(plugins_1.core);
|
|
38
40
|
this.sm = new StreamManagement_1.default();
|
|
39
41
|
if (this.config.allowResumption !== undefined) {
|
|
@@ -65,7 +67,7 @@ class Client extends events_1.EventEmitter {
|
|
|
65
67
|
bosh: bosh_1.default,
|
|
66
68
|
websocket: websocket_1.default
|
|
67
69
|
};
|
|
68
|
-
this.incomingDataQueue = async_1.priorityQueue(async (task, done) => {
|
|
70
|
+
this.incomingDataQueue = (0, async_1.priorityQueue)(async (task, done) => {
|
|
69
71
|
const { kind, stanza } = task;
|
|
70
72
|
this.emit(kind, stanza);
|
|
71
73
|
if (stanza.id) {
|
|
@@ -104,7 +106,7 @@ class Client extends events_1.EventEmitter {
|
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
};
|
|
107
|
-
this.outgoingDataQueue = async_1.priorityQueue(async (task, done) => {
|
|
109
|
+
this.outgoingDataQueue = (0, async_1.priorityQueue)(async (task, done) => {
|
|
108
110
|
var _a;
|
|
109
111
|
const { kind, stanza, replay } = task;
|
|
110
112
|
const ackRequest = replay || (await this.sm.track(kind, stanza));
|
|
@@ -269,7 +271,7 @@ class Client extends events_1.EventEmitter {
|
|
|
269
271
|
pluginInit(this, this.stanzas, this.config);
|
|
270
272
|
}
|
|
271
273
|
nextId() {
|
|
272
|
-
return Utils_1.uuid();
|
|
274
|
+
return (0, Utils_1.uuid)();
|
|
273
275
|
}
|
|
274
276
|
async getCredentials() {
|
|
275
277
|
return this._getConfiguredCredentials();
|
|
@@ -411,7 +413,7 @@ class Client extends events_1.EventEmitter {
|
|
|
411
413
|
});
|
|
412
414
|
this.send('iq', iq);
|
|
413
415
|
const timeout = this.config.timeout || 15;
|
|
414
|
-
return Utils_1.timeoutPromise(request, timeout * 1000, () => ({
|
|
416
|
+
return (0, Utils_1.timeoutPromise)(request, timeout * 1000, () => ({
|
|
415
417
|
...iq,
|
|
416
418
|
to: undefined,
|
|
417
419
|
from: undefined,
|
package/Constants.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.directionToSenders = exports.sendersToDirection = exports.JINGLE_INFO_RECEIVED_5 = exports.JINGLE_INFO_CHECKSUM_5 = exports.JINGLE_INFO_RINGING = exports.JINGLE_INFO_ACTIVE = exports.JINGLE_INFO_UNHOLD = exports.JINGLE_INFO_HOLD = exports.JINGLE_INFO_UNMUTE = exports.JINGLE_INFO_MUTE = exports.JINGLE_INFO = exports.USER_ACTIVITY_SPECIFIC = exports.USER_ACTIVITY_GENERAL = exports.USER_MOODS = exports.JingleReasonCondition = exports.JingleErrorCondition = exports.JingleAction = exports.JingleContentSenders = exports.JingleApplicationDirection = exports.JingleSessionRole = exports.ChatState = exports.PubsubErrorCondition = exports.MUCStatusCode = exports.MUCRole = exports.MUCAffiliation = exports.DataFormFieldType = exports.DataFormType = exports.RosterSubscription = exports.PresenceShow = exports.IQType = exports.PresenceType = exports.MessageType = exports.StanzaErrorCondition = exports.StreamErrorCondition = exports.SASLFailureCondition = exports.StreamType = exports.VERSION = void 0;
|
|
4
4
|
const Namespaces_1 = require("./Namespaces");
|
|
5
|
-
exports.VERSION = '12.
|
|
5
|
+
exports.VERSION = '12.19.0';
|
|
6
6
|
// ====================================================================
|
|
7
7
|
// Frequently Used Values
|
|
8
8
|
// ====================================================================
|
|
@@ -437,14 +437,14 @@ exports.USER_ACTIVITY_SPECIFIC = [
|
|
|
437
437
|
];
|
|
438
438
|
const JINGLE_INFO = (namespace, name) => `{${namespace}}${name}`;
|
|
439
439
|
exports.JINGLE_INFO = JINGLE_INFO;
|
|
440
|
-
exports.JINGLE_INFO_MUTE = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'mute');
|
|
441
|
-
exports.JINGLE_INFO_UNMUTE = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'unmute');
|
|
442
|
-
exports.JINGLE_INFO_HOLD = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'hold');
|
|
443
|
-
exports.JINGLE_INFO_UNHOLD = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'unhold');
|
|
444
|
-
exports.JINGLE_INFO_ACTIVE = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'active');
|
|
445
|
-
exports.JINGLE_INFO_RINGING = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'ringing');
|
|
446
|
-
exports.JINGLE_INFO_CHECKSUM_5 = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_FILE_TRANSFER_5, 'checksum');
|
|
447
|
-
exports.JINGLE_INFO_RECEIVED_5 = exports.JINGLE_INFO(Namespaces_1.NS_JINGLE_FILE_TRANSFER_5, 'received');
|
|
440
|
+
exports.JINGLE_INFO_MUTE = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'mute');
|
|
441
|
+
exports.JINGLE_INFO_UNMUTE = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'unmute');
|
|
442
|
+
exports.JINGLE_INFO_HOLD = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'hold');
|
|
443
|
+
exports.JINGLE_INFO_UNHOLD = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'unhold');
|
|
444
|
+
exports.JINGLE_INFO_ACTIVE = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'active');
|
|
445
|
+
exports.JINGLE_INFO_RINGING = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_RTP_INFO_1, 'ringing');
|
|
446
|
+
exports.JINGLE_INFO_CHECKSUM_5 = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_FILE_TRANSFER_5, 'checksum');
|
|
447
|
+
exports.JINGLE_INFO_RECEIVED_5 = (0, exports.JINGLE_INFO)(Namespaces_1.NS_JINGLE_FILE_TRANSFER_5, 'received');
|
|
448
448
|
// ====================================================================
|
|
449
449
|
// Helper Functions
|
|
450
450
|
// ====================================================================
|
package/JID.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toURI = exports.parseURI = exports.toBare = exports.getResource = exports.getDomain = exports.getLocal = exports.isBare = exports.isFull = exports.equalBare = exports.equal = exports.allowedResponders = exports.parse = exports.createFull = exports.create = exports.prepare = exports.unescapeLocal = exports.escapeLocal = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const punycode_1 = tslib_1.__importDefault(require("punycode"));
|
|
5
|
+
const punycode_1 = (0, tslib_1.__importDefault)(require("punycode"));
|
|
6
6
|
const stringprep_1 = require("./lib/stringprep");
|
|
7
7
|
function escapeLocal(val = '') {
|
|
8
8
|
return val
|
|
@@ -47,15 +47,15 @@ function prepare(data) {
|
|
|
47
47
|
let domain = data.domain;
|
|
48
48
|
let resource = data.resource || '';
|
|
49
49
|
if (local) {
|
|
50
|
-
local = stringprep_1.nodeprep(local);
|
|
50
|
+
local = (0, stringprep_1.nodeprep)(local);
|
|
51
51
|
}
|
|
52
52
|
if (resource) {
|
|
53
|
-
resource = stringprep_1.resourceprep(resource);
|
|
53
|
+
resource = (0, stringprep_1.resourceprep)(resource);
|
|
54
54
|
}
|
|
55
55
|
if (domain[domain.length - 1] === '.') {
|
|
56
56
|
domain = domain.slice(0, domain.length - 1);
|
|
57
57
|
}
|
|
58
|
-
domain = stringprep_1.nameprep(domain.split('.').map(punycode_1.default.toUnicode).join('.'));
|
|
58
|
+
domain = (0, stringprep_1.nameprep)(domain.split('.').map(punycode_1.default.toUnicode).join('.'));
|
|
59
59
|
return {
|
|
60
60
|
domain,
|
|
61
61
|
local,
|
package/README.md
CHANGED
|
@@ -69,14 +69,6 @@ client.connect();
|
|
|
69
69
|
|
|
70
70
|
MUC Room: [discuss@stanzajs.org](https://stanzajs.org/discuss/logs) / [Logs](https://stanzajs.org/discuss/logs)
|
|
71
71
|
|
|
72
|
-
## Related Modules
|
|
73
|
-
|
|
74
|
-
These are related modules that form part of StanzaJS:
|
|
75
|
-
|
|
76
|
-
| Name | Description | Source |
|
|
77
|
-
| ------------------------------------------------------ | -------------------------------------------------------------------- | --------------------------------------------------- |
|
|
78
|
-
| [stanza-shims](https://npmjs.org/package/stanza-shims) | Runtime shims used by StanzaJS for node, browsers, and React Native. | [Source](https://github.com/legastero/stanza-shims) |
|
|
79
|
-
|
|
80
72
|
## Recommended Modules
|
|
81
73
|
|
|
82
74
|
These are some additional modules that are highly recommended for use with StanzaJS:
|
package/Utils.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/// <reference types="node" />
|
|
10
10
|
export declare function timeoutPromise<T>(target: Promise<T>, delay: number, rejectValue?: () => any): Promise<T>;
|
|
11
|
+
export declare function promiseAny<T>(promises: Array<Promise<T>>): Promise<T>;
|
|
12
|
+
export declare function shuffle<T>(array: T[]): T[];
|
|
11
13
|
export declare function sleep(time: number): Promise<void>;
|
|
12
14
|
export declare function octetCompare(str1: string | Buffer, str2: string | Buffer): number;
|
|
13
15
|
export declare function uuid(): string;
|
package/Utils.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* - uuid, Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.reviveData = exports.uuid = exports.octetCompare = exports.sleep = exports.timeoutPromise = void 0;
|
|
11
|
+
exports.reviveData = exports.uuid = exports.octetCompare = exports.sleep = exports.shuffle = exports.promiseAny = exports.timeoutPromise = void 0;
|
|
12
12
|
// tslint:disable no-bitwise
|
|
13
|
-
const
|
|
13
|
+
const platform_1 = require("./platform");
|
|
14
14
|
const bth = [];
|
|
15
15
|
for (let i = 0; i < 256; ++i) {
|
|
16
16
|
bth[i] = (i + 0x100).toString(16).substr(1);
|
|
@@ -27,6 +27,30 @@ async function timeoutPromise(target, delay, rejectValue = () => undefined) {
|
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
29
|
exports.timeoutPromise = timeoutPromise;
|
|
30
|
+
async function promiseAny(promises) {
|
|
31
|
+
try {
|
|
32
|
+
const errors = await Promise.all(promises.map(p => {
|
|
33
|
+
return p.then(val => Promise.reject(val), err => Promise.resolve(err));
|
|
34
|
+
}));
|
|
35
|
+
return Promise.reject(errors);
|
|
36
|
+
}
|
|
37
|
+
catch (val) {
|
|
38
|
+
return Promise.resolve(val);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.promiseAny = promiseAny;
|
|
42
|
+
function shuffle(array) {
|
|
43
|
+
let end = array.length;
|
|
44
|
+
while (end > 0) {
|
|
45
|
+
const selected = Math.floor(Math.random() * end);
|
|
46
|
+
end -= 1;
|
|
47
|
+
const tmp = array[end];
|
|
48
|
+
array[end] = array[selected];
|
|
49
|
+
array[selected] = tmp;
|
|
50
|
+
}
|
|
51
|
+
return array;
|
|
52
|
+
}
|
|
53
|
+
exports.shuffle = shuffle;
|
|
30
54
|
async function sleep(time) {
|
|
31
55
|
return new Promise(resolve => {
|
|
32
56
|
setTimeout(() => resolve(), time);
|
|
@@ -34,13 +58,13 @@ async function sleep(time) {
|
|
|
34
58
|
}
|
|
35
59
|
exports.sleep = sleep;
|
|
36
60
|
function octetCompare(str1, str2) {
|
|
37
|
-
const b1 = typeof str1 === 'string' ? Buffer.from(str1, 'utf8') : str1;
|
|
38
|
-
const b2 = typeof str2 === 'string' ? Buffer.from(str2, 'utf8') : str2;
|
|
61
|
+
const b1 = typeof str1 === 'string' ? platform_1.Buffer.from(str1, 'utf8') : str1;
|
|
62
|
+
const b2 = typeof str2 === 'string' ? platform_1.Buffer.from(str2, 'utf8') : str2;
|
|
39
63
|
return b1.compare(b2);
|
|
40
64
|
}
|
|
41
65
|
exports.octetCompare = octetCompare;
|
|
42
66
|
function uuid() {
|
|
43
|
-
const buf =
|
|
67
|
+
const buf = (0, platform_1.randomBytes)(16);
|
|
44
68
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
45
69
|
buf[6] = (buf[6] & 0x0f) | 0x40;
|
|
46
70
|
buf[8] = (buf[8] & 0x3f) | 0x80;
|
|
@@ -90,7 +114,7 @@ function reviveData(key, value) {
|
|
|
90
114
|
typeof value === 'object' &&
|
|
91
115
|
value.type === 'Buffer' &&
|
|
92
116
|
Array.isArray(value.data)) {
|
|
93
|
-
return Buffer.from(value);
|
|
117
|
+
return platform_1.Buffer.from(value);
|
|
94
118
|
}
|
|
95
119
|
return value;
|
|
96
120
|
}
|
package/helpers/DiscoManager.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const EntityCaps = tslib_1.__importStar(require("./LegacyEntityCapabilities"));
|
|
4
|
+
const EntityCaps = (0, tslib_1.__importStar)(require("./LegacyEntityCapabilities"));
|
|
5
5
|
class Disco {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.capsAlgorithms = ['sha-1'];
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verify = exports.generate = void 0;
|
|
4
|
-
const
|
|
5
|
-
const Hashes = tslib_1.__importStar(require("stanza-shims"));
|
|
4
|
+
const platform_1 = require("../platform");
|
|
6
5
|
const Utils_1 = require("../Utils");
|
|
7
6
|
function escape(value) {
|
|
8
|
-
return Buffer.from(value.replace(/</g, '<'), 'utf-8');
|
|
7
|
+
return platform_1.Buffer.from(value.replace(/</g, '<'), 'utf-8');
|
|
9
8
|
}
|
|
10
9
|
function encodeIdentities(identities = []) {
|
|
11
10
|
const result = [];
|
|
@@ -65,7 +64,7 @@ function encodeFields(fields = []) {
|
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
|
-
sortedFields.sort((a, b) => Utils_1.octetCompare(a.name, b.name));
|
|
67
|
+
sortedFields.sort((a, b) => (0, Utils_1.octetCompare)(a.name, b.name));
|
|
69
68
|
const result = [];
|
|
70
69
|
for (const field of sortedFields) {
|
|
71
70
|
result.push(field.name);
|
|
@@ -102,7 +101,7 @@ function encodeForms(extensions = []) {
|
|
|
102
101
|
types.add(type.toString());
|
|
103
102
|
forms.push({ type, form });
|
|
104
103
|
}
|
|
105
|
-
forms.sort((a, b) => Utils_1.octetCompare(a.type, b.type));
|
|
104
|
+
forms.sort((a, b) => (0, Utils_1.octetCompare)(a.type, b.type));
|
|
106
105
|
const results = [];
|
|
107
106
|
for (const form of forms) {
|
|
108
107
|
results.push(form.type);
|
|
@@ -115,7 +114,7 @@ function encodeForms(extensions = []) {
|
|
|
115
114
|
}
|
|
116
115
|
function generate(info, hashName) {
|
|
117
116
|
const S = [];
|
|
118
|
-
const separator = Buffer.from('<', 'utf8');
|
|
117
|
+
const separator = platform_1.Buffer.from('<', 'utf8');
|
|
119
118
|
const append = (b1) => {
|
|
120
119
|
S.push(b1);
|
|
121
120
|
S.push(separator);
|
|
@@ -135,7 +134,7 @@ function generate(info, hashName) {
|
|
|
135
134
|
for (const form of extensions) {
|
|
136
135
|
append(form);
|
|
137
136
|
}
|
|
138
|
-
return
|
|
137
|
+
return (0, platform_1.createHash)(hashName).update(platform_1.Buffer.concat(S)).digest('base64');
|
|
139
138
|
}
|
|
140
139
|
exports.generate = generate;
|
|
141
140
|
function verify(info, hashName, check) {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { XRD } from '../protocol/xrd';
|
|
2
|
+
export interface Candidate {
|
|
3
|
+
host: string;
|
|
4
|
+
port: number;
|
|
5
|
+
secure?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DNSOptions {
|
|
8
|
+
srvType?: string;
|
|
9
|
+
srvTypeSecure?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SRVRecord {
|
|
12
|
+
name: string;
|
|
13
|
+
port: number;
|
|
14
|
+
priority: number;
|
|
15
|
+
weight: number;
|
|
16
|
+
secure?: boolean;
|
|
17
|
+
used?: boolean;
|
|
18
|
+
runningSum?: number;
|
|
19
|
+
id?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface SRVResult {
|
|
22
|
+
records: SRVRecord[];
|
|
23
|
+
allowFallback: boolean;
|
|
24
|
+
}
|
|
25
|
+
export default class NetworkDiscovery {
|
|
26
|
+
private resolver?;
|
|
27
|
+
private registry;
|
|
28
|
+
private hostMetaCache;
|
|
29
|
+
private hostMetaTTL;
|
|
30
|
+
constructor();
|
|
31
|
+
getHostMeta(domain: string): Promise<XRD>;
|
|
32
|
+
resolveTXT(domain: string): Promise<string[][]>;
|
|
33
|
+
resolve(domain: string, defaultPort: number, opts?: DNSOptions): Promise<Candidate[]>;
|
|
34
|
+
resolveWeightedSRV(domain: string, srvType: string, srvTypeSecure?: string): Promise<SRVResult>;
|
|
35
|
+
resolveSRV(domain: string, srvType: string, secure?: boolean): Promise<SRVResult>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const platform_1 = require("../platform");
|
|
5
|
+
const Utils_1 = require("../Utils");
|
|
6
|
+
const jxt_1 = require("../jxt");
|
|
7
|
+
const xrd_1 = (0, tslib_1.__importDefault)(require("../protocol/xrd"));
|
|
8
|
+
class NetworkDiscovery {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.hostMetaCache = new Map();
|
|
11
|
+
this.hostMetaTTL = 30000;
|
|
12
|
+
this.resolver = (0, platform_1.createResolver)();
|
|
13
|
+
this.registry = new jxt_1.Registry();
|
|
14
|
+
this.registry.define(xrd_1.default);
|
|
15
|
+
}
|
|
16
|
+
async getHostMeta(domain) {
|
|
17
|
+
const cached = this.hostMetaCache.get(domain);
|
|
18
|
+
if (cached) {
|
|
19
|
+
if (cached.created + this.hostMetaTTL < Date.now()) {
|
|
20
|
+
return cached.hostmeta;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
this.hostMetaCache.delete(domain);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const hostmeta = (0, Utils_1.promiseAny)([
|
|
27
|
+
(0, platform_1.fetch)(`https://${domain}/.well-known/host-meta.json`).then(async (res) => {
|
|
28
|
+
if (!res.ok) {
|
|
29
|
+
throw new Error('could-not-fetch-json');
|
|
30
|
+
}
|
|
31
|
+
return res.json();
|
|
32
|
+
}),
|
|
33
|
+
(0, platform_1.fetch)(`https://${domain}/.well-known/host-meta`).then(async (res) => {
|
|
34
|
+
if (!res.ok) {
|
|
35
|
+
throw new Error('could-not-fetch-xml');
|
|
36
|
+
}
|
|
37
|
+
const data = await res.text();
|
|
38
|
+
const xml = (0, jxt_1.parse)(data);
|
|
39
|
+
if (xml) {
|
|
40
|
+
return this.registry.import(xml);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new Error('could-not-import-xml');
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
this.hostMetaCache.set(domain, { created: Date.now(), hostmeta });
|
|
48
|
+
hostmeta.catch(() => {
|
|
49
|
+
this.hostMetaCache.delete(domain);
|
|
50
|
+
});
|
|
51
|
+
return hostmeta;
|
|
52
|
+
}
|
|
53
|
+
async resolveTXT(domain) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
return (_b = (_a = this.resolver) === null || _a === void 0 ? void 0 : _a.resolveTxt(domain)) !== null && _b !== void 0 ? _b : [];
|
|
56
|
+
}
|
|
57
|
+
async resolve(domain, defaultPort, opts = {}) {
|
|
58
|
+
if (!this.resolver) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
let candidates = [];
|
|
62
|
+
let allowFallback = true;
|
|
63
|
+
if (opts.srvType) {
|
|
64
|
+
const srvResults = await this.resolveWeightedSRV(domain, opts.srvType, opts.srvTypeSecure);
|
|
65
|
+
allowFallback = srvResults.allowFallback;
|
|
66
|
+
candidates = srvResults.records.map(record => ({
|
|
67
|
+
host: record.name,
|
|
68
|
+
port: record.port,
|
|
69
|
+
secure: record.secure
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
if (allowFallback) {
|
|
73
|
+
candidates.push({ host: domain, port: defaultPort });
|
|
74
|
+
}
|
|
75
|
+
return candidates;
|
|
76
|
+
}
|
|
77
|
+
async resolveWeightedSRV(domain, srvType, srvTypeSecure) {
|
|
78
|
+
const [records, secureRecords] = await Promise.all([
|
|
79
|
+
this.resolveSRV(domain, srvType),
|
|
80
|
+
srvTypeSecure
|
|
81
|
+
? this.resolveSRV(domain, srvTypeSecure, true)
|
|
82
|
+
: Promise.resolve({ records: [], allowFallback: false })
|
|
83
|
+
]);
|
|
84
|
+
const allRecords = [...records.records, ...secureRecords.records];
|
|
85
|
+
const priorities = new Map();
|
|
86
|
+
let id = 0;
|
|
87
|
+
for (const record of allRecords) {
|
|
88
|
+
record.id = id++;
|
|
89
|
+
record.runningSum = 0;
|
|
90
|
+
if (!priorities.has(record.priority)) {
|
|
91
|
+
priorities.set(record.priority, []);
|
|
92
|
+
}
|
|
93
|
+
const priorityGroup = priorities.get(record.priority);
|
|
94
|
+
priorityGroup.push(record);
|
|
95
|
+
}
|
|
96
|
+
const weightRecords = (unweightedRecords) => {
|
|
97
|
+
const sorted = [];
|
|
98
|
+
while (sorted.length < unweightedRecords.length) {
|
|
99
|
+
const ordered = (0, Utils_1.shuffle)(unweightedRecords.filter(record => record.weight === 0 && !record.used));
|
|
100
|
+
const unordered = (0, Utils_1.shuffle)(unweightedRecords.filter(record => {
|
|
101
|
+
return record.weight !== 0 && !record.used;
|
|
102
|
+
}));
|
|
103
|
+
let weightSum = 0;
|
|
104
|
+
for (const record of unordered) {
|
|
105
|
+
weightSum += record.weight;
|
|
106
|
+
record.runningSum = weightSum;
|
|
107
|
+
ordered.push(record);
|
|
108
|
+
}
|
|
109
|
+
const selector = Math.floor(Math.random() * (weightSum + 1));
|
|
110
|
+
for (const record of ordered) {
|
|
111
|
+
if (record.runningSum >= selector) {
|
|
112
|
+
record.used = true;
|
|
113
|
+
sorted.push(record);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return sorted;
|
|
119
|
+
};
|
|
120
|
+
let sortedRecords = [];
|
|
121
|
+
for (const priority of Array.from(priorities.keys()).sort((a, b) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
122
|
+
const priorityGroup = priorities.get(priority);
|
|
123
|
+
sortedRecords = sortedRecords.concat(weightRecords(priorityGroup));
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
records: sortedRecords,
|
|
127
|
+
allowFallback: records.allowFallback
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
async resolveSRV(domain, srvType, secure) {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
try {
|
|
133
|
+
const records = (_b = (await ((_a = this.resolver) === null || _a === void 0 ? void 0 : _a.resolveSrv(`${srvType}.${domain}`)))) !== null && _b !== void 0 ? _b : [];
|
|
134
|
+
if (records.length === 1 && (records[0].name === '.' || records[0].name === '')) {
|
|
135
|
+
return { records: [], allowFallback: false };
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
records: records
|
|
139
|
+
.map(record => ({ secure, ...record }))
|
|
140
|
+
.filter(record => record.name !== '' && record.name !== '.'),
|
|
141
|
+
allowFallback: false
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (_c) {
|
|
145
|
+
return {
|
|
146
|
+
records: [],
|
|
147
|
+
allowFallback: true
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.default = NetworkDiscovery;
|
package/helpers/RSM.js
CHANGED
|
@@ -47,7 +47,8 @@ class ResultSetPager {
|
|
|
47
47
|
this.cursor = paging;
|
|
48
48
|
this.resultCount = paging.count;
|
|
49
49
|
this.fetchedCount += results.length;
|
|
50
|
-
if ((this.pageSize && results.length < this.pageSize) ||
|
|
50
|
+
if ((this.pageSize && results.length < this.pageSize) ||
|
|
51
|
+
(this.resultCount && this.fetchedCount === this.resultCount)) {
|
|
51
52
|
this.resultComplete = true;
|
|
52
53
|
}
|
|
53
54
|
if (this.reverse) {
|
package/helpers/RTT.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InputBuffer = exports.DisplayBuffer = exports.diff = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const async_1 = require("async");
|
|
6
|
-
const punycode_1 = tslib_1.__importDefault(require("punycode"));
|
|
6
|
+
const punycode_1 = (0, tslib_1.__importDefault)(require("punycode"));
|
|
7
7
|
/**
|
|
8
8
|
* Calculate the erase and insert actions needed to describe the user's edit operation.
|
|
9
9
|
*
|
|
@@ -170,7 +170,7 @@ class DisplayBuffer {
|
|
|
170
170
|
this.synced = true;
|
|
171
171
|
this.buffer = [];
|
|
172
172
|
this.timeDeficit = 0;
|
|
173
|
-
this.actionQueue = async_1.priorityQueue((action, done) => {
|
|
173
|
+
this.actionQueue = (0, async_1.priorityQueue)((action, done) => {
|
|
174
174
|
const currentTime = Date.now();
|
|
175
175
|
if (action.type === 'insert') {
|
|
176
176
|
this.insert(action.text, action.position);
|
|
@@ -62,6 +62,7 @@ class StreamManagement extends events_1.EventEmitter {
|
|
|
62
62
|
}
|
|
63
63
|
async enabled(resp) {
|
|
64
64
|
this.id = resp.id;
|
|
65
|
+
this.allowResume = resp.resume || false;
|
|
65
66
|
this.handled = 0;
|
|
66
67
|
this.inboundStarted = true;
|
|
67
68
|
await this._cache();
|
|
@@ -119,8 +120,11 @@ class StreamManagement extends events_1.EventEmitter {
|
|
|
119
120
|
await this._cache();
|
|
120
121
|
}
|
|
121
122
|
async track(kind, stanza) {
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
const isStanzaEnable = stanza.type === 'enable';
|
|
124
|
+
if (kind === 'sm' && (isStanzaEnable || stanza.type === 'resume')) {
|
|
125
|
+
if (isStanzaEnable) {
|
|
126
|
+
this.handled = 0;
|
|
127
|
+
}
|
|
124
128
|
this.outboundStarted = true;
|
|
125
129
|
await this._cache();
|
|
126
130
|
return false;
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import Client from './Client';
|
|
4
4
|
import * as Constants from './Constants';
|
|
5
5
|
import * as RTT from './helpers/RTT';
|
|
6
|
+
import NetworkDiscovery from './helpers/NetworkDiscovery';
|
|
6
7
|
import SM from './helpers/StreamManagement';
|
|
7
8
|
import * as JID from './JID';
|
|
8
9
|
import * as Jingle from './jingle';
|
|
@@ -13,6 +14,7 @@ import * as Namespaces from './Namespaces';
|
|
|
13
14
|
import * as Stanzas from './protocol';
|
|
14
15
|
import { CSI, IQ, Message, Presence, SASL, Stream, StreamError, StreamFeatures, StreamManagement } from './protocol';
|
|
15
16
|
import * as Utils from './Utils';
|
|
17
|
+
import * as Platform from './platform';
|
|
16
18
|
export * from './helpers/StreamManagement';
|
|
17
19
|
export interface TopLevelElements {
|
|
18
20
|
message: Message;
|
|
@@ -102,6 +104,7 @@ export interface Agent extends StrictEventEmitter<EventEmitter, AgentEvents> {
|
|
|
102
104
|
sm: SM;
|
|
103
105
|
sasl: LibSASL.Factory;
|
|
104
106
|
stanzas: JXT.Registry;
|
|
107
|
+
resolver: NetworkDiscovery;
|
|
105
108
|
sessionStarting: boolean;
|
|
106
109
|
sessionStarted: boolean;
|
|
107
110
|
sessionTerminating: boolean;
|
|
@@ -238,7 +241,7 @@ export interface TransportConfig {
|
|
|
238
241
|
}
|
|
239
242
|
import * as RSM from './helpers/RSM';
|
|
240
243
|
import * as DataForms from './helpers/DataForms';
|
|
241
|
-
export { Client, Constants, DataForms, JXT, JID, Namespaces, Stanzas, Jingle, Utils, RSM, RTT, LibSASL as SASL };
|
|
244
|
+
export { Client, Constants, DataForms, JXT, JID, Namespaces, Stanzas, Jingle, Utils, RSM, RTT, LibSASL as SASL, Platform };
|
|
242
245
|
export declare const VERSION = "__STANZAJS_VERSION__";
|
|
243
246
|
export * from './plugins';
|
|
244
247
|
export declare function createClient(opts: AgentConfig): Agent;
|
package/index.js
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createClient = exports.VERSION = exports.SASL = exports.RTT = exports.RSM = exports.Utils = exports.Jingle = exports.Stanzas = exports.Namespaces = exports.JID = exports.JXT = exports.DataForms = exports.Constants = exports.Client = void 0;
|
|
3
|
+
exports.createClient = exports.VERSION = exports.Platform = exports.SASL = exports.RTT = exports.RSM = exports.Utils = exports.Jingle = exports.Stanzas = exports.Namespaces = exports.JID = exports.JXT = exports.DataForms = exports.Constants = exports.Client = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const Client_1 = tslib_1.__importDefault(require("./Client"));
|
|
5
|
+
const Client_1 = (0, tslib_1.__importDefault)(require("./Client"));
|
|
6
6
|
exports.Client = Client_1.default;
|
|
7
|
-
const Constants = tslib_1.__importStar(require("./Constants"));
|
|
7
|
+
const Constants = (0, tslib_1.__importStar)(require("./Constants"));
|
|
8
8
|
exports.Constants = Constants;
|
|
9
|
-
const RTT = tslib_1.__importStar(require("./helpers/RTT"));
|
|
9
|
+
const RTT = (0, tslib_1.__importStar)(require("./helpers/RTT"));
|
|
10
10
|
exports.RTT = RTT;
|
|
11
|
-
const JID = tslib_1.__importStar(require("./JID"));
|
|
11
|
+
const JID = (0, tslib_1.__importStar)(require("./JID"));
|
|
12
12
|
exports.JID = JID;
|
|
13
|
-
const Jingle = tslib_1.__importStar(require("./jingle"));
|
|
13
|
+
const Jingle = (0, tslib_1.__importStar)(require("./jingle"));
|
|
14
14
|
exports.Jingle = Jingle;
|
|
15
|
-
const JXT = tslib_1.__importStar(require("./jxt"));
|
|
15
|
+
const JXT = (0, tslib_1.__importStar)(require("./jxt"));
|
|
16
16
|
exports.JXT = JXT;
|
|
17
|
-
const LibSASL = tslib_1.__importStar(require("./lib/sasl"));
|
|
17
|
+
const LibSASL = (0, tslib_1.__importStar)(require("./lib/sasl"));
|
|
18
18
|
exports.SASL = LibSASL;
|
|
19
|
-
const Namespaces = tslib_1.__importStar(require("./Namespaces"));
|
|
19
|
+
const Namespaces = (0, tslib_1.__importStar)(require("./Namespaces"));
|
|
20
20
|
exports.Namespaces = Namespaces;
|
|
21
|
-
const Stanzas = tslib_1.__importStar(require("./protocol"));
|
|
21
|
+
const Stanzas = (0, tslib_1.__importStar)(require("./protocol"));
|
|
22
22
|
exports.Stanzas = Stanzas;
|
|
23
|
-
const Utils = tslib_1.__importStar(require("./Utils"));
|
|
23
|
+
const Utils = (0, tslib_1.__importStar)(require("./Utils"));
|
|
24
24
|
exports.Utils = Utils;
|
|
25
|
-
tslib_1.
|
|
26
|
-
|
|
25
|
+
const Platform = (0, tslib_1.__importStar)(require("./platform"));
|
|
26
|
+
exports.Platform = Platform;
|
|
27
|
+
(0, tslib_1.__exportStar)(require("./helpers/StreamManagement"), exports);
|
|
28
|
+
const RSM = (0, tslib_1.__importStar)(require("./helpers/RSM"));
|
|
27
29
|
exports.RSM = RSM;
|
|
28
|
-
const DataForms = tslib_1.__importStar(require("./helpers/DataForms"));
|
|
30
|
+
const DataForms = (0, tslib_1.__importStar)(require("./helpers/DataForms"));
|
|
29
31
|
exports.DataForms = DataForms;
|
|
30
32
|
exports.VERSION = Constants.VERSION;
|
|
31
|
-
const plugins_1 = tslib_1.__importDefault(require("./plugins"));
|
|
32
|
-
tslib_1.__exportStar(require("./plugins"), exports);
|
|
33
|
+
const plugins_1 = (0, tslib_1.__importDefault)(require("./plugins"));
|
|
34
|
+
(0, tslib_1.__exportStar)(require("./plugins"), exports);
|
|
33
35
|
function createClient(opts) {
|
|
34
36
|
const client = new Client_1.default(opts);
|
|
35
37
|
client.use(plugins_1.default);
|
package/index.module.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Client from './Client';
|
|
2
|
+
import * as Constants from './Constants';
|
|
3
|
+
import * as RTT from './helpers/RTT';
|
|
4
|
+
import * as JID from './JID';
|
|
5
|
+
import * as Jingle from './jingle';
|
|
6
|
+
import * as JXT from './jxt';
|
|
7
|
+
import * as LibSASL from './lib/sasl';
|
|
8
|
+
import * as Namespaces from './Namespaces';
|
|
9
|
+
import * as Stanzas from './protocol';
|
|
10
|
+
import * as Utils from './Utils';
|
|
11
|
+
import * as Platform from './platform';
|
|
12
|
+
export * from './helpers/StreamManagement';
|
|
13
|
+
import * as RSM from './helpers/RSM';
|
|
14
|
+
import * as DataForms from './helpers/DataForms';
|
|
15
|
+
export { Client, Constants, DataForms, JXT, JID, Namespaces, Stanzas, Jingle, Utils, RSM, RTT, LibSASL as SASL, Platform };
|
|
16
|
+
export const VERSION = Constants.VERSION;
|
|
17
|
+
import Plugins from './plugins';
|
|
18
|
+
export * from './plugins';
|
|
19
|
+
export function createClient(opts) {
|
|
20
|
+
const client = new Client(opts);
|
|
21
|
+
client.use(Plugins);
|
|
22
|
+
return client;
|
|
23
|
+
}
|