stanza 12.18.0 → 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.
Files changed (134) hide show
  1. package/Client.js +12 -12
  2. package/Constants.js +9 -9
  3. package/JID.js +4 -4
  4. package/Utils.js +1 -1
  5. package/helpers/DiscoManager.js +1 -1
  6. package/helpers/LegacyEntityCapabilities.js +3 -3
  7. package/helpers/NetworkDiscovery.js +8 -8
  8. package/helpers/RTT.js +2 -2
  9. package/helpers/StreamManagement.js +6 -2
  10. package/index.js +16 -16
  11. package/jingle/FileTransferSession.js +8 -8
  12. package/jingle/ICESession.js +13 -13
  13. package/jingle/MediaSession.js +7 -7
  14. package/jingle/Session.js +3 -3
  15. package/jingle/SessionManager.js +4 -4
  16. package/jingle/index.js +5 -5
  17. package/jingle/sdp/Intermediate.js +1 -1
  18. package/jingle/sdp/Protocol.js +7 -5
  19. package/jxt/Definitions.js +1 -1
  20. package/jxt/Element.js +2 -2
  21. package/jxt/Parser.js +4 -4
  22. package/jxt/Registry.js +2 -2
  23. package/jxt/StreamParser.js +3 -3
  24. package/jxt/Translator.js +1 -1
  25. package/jxt/Types.js +8 -8
  26. package/jxt/index.js +8 -8
  27. package/lib/sasl/index.js +11 -11
  28. package/lib/stringprep/index.js +1 -1
  29. package/package.json +1 -1
  30. package/platform/browser/buffer/index.d.ts +18 -0
  31. package/platform/browser/crypto/Hmac.js +4 -4
  32. package/platform/browser/crypto/MD5.js +1 -1
  33. package/platform/browser/crypto/SHA-1.js +1 -1
  34. package/platform/browser/crypto/SHA-256.js +1 -1
  35. package/platform/browser/crypto/SHA-512.js +1 -1
  36. package/platform/browser/crypto/createHash.js +5 -5
  37. package/platform/browser/index.d.ts +1 -1
  38. package/platform/browser/index.js +2 -2
  39. package/platform/index.js +1 -1
  40. package/platform/node/index.js +6 -6
  41. package/platform/react-native/index.js +1 -1
  42. package/plugins/avatar.js +1 -1
  43. package/plugins/connection.js +1 -1
  44. package/plugins/disco.js +2 -2
  45. package/plugins/entity.js +2 -2
  46. package/plugins/index.js +36 -36
  47. package/plugins/jingle.js +1 -1
  48. package/plugins/mam.js +2 -2
  49. package/plugins/messaging.js +1 -1
  50. package/plugins/muc.js +3 -3
  51. package/plugins/pep.js +5 -5
  52. package/plugins/pubsub.js +1 -1
  53. package/plugins/roster.js +1 -1
  54. package/plugins/sharing.js +1 -1
  55. package/protocol/index.js +162 -162
  56. package/protocol/rfc3921.js +1 -1
  57. package/protocol/rfc4287.js +24 -24
  58. package/protocol/rfc6120.js +41 -41
  59. package/protocol/rfc6121.js +25 -25
  60. package/protocol/rfc7395.js +6 -6
  61. package/protocol/xep0004.js +21 -21
  62. package/protocol/xep0012.js +2 -2
  63. package/protocol/xep0016.js +11 -11
  64. package/protocol/xep0030.js +16 -16
  65. package/protocol/xep0033.js +11 -11
  66. package/protocol/xep0045.js +49 -49
  67. package/protocol/xep0047.js +8 -8
  68. package/protocol/xep0048.js +6 -6
  69. package/protocol/xep0050.js +13 -13
  70. package/protocol/xep0054.js +34 -34
  71. package/protocol/xep0055.js +12 -12
  72. package/protocol/xep0059.js +8 -8
  73. package/protocol/xep0060.js +53 -53
  74. package/protocol/xep0065.js +10 -10
  75. package/protocol/xep0066.js +4 -4
  76. package/protocol/xep0071.js +2 -2
  77. package/protocol/xep0077.js +24 -24
  78. package/protocol/xep0080.js +26 -26
  79. package/protocol/xep0084.js +14 -14
  80. package/protocol/xep0085.js +2 -2
  81. package/protocol/xep0092.js +3 -3
  82. package/protocol/xep0107.js +4 -4
  83. package/protocol/xep0108.js +4 -4
  84. package/protocol/xep0114.js +1 -1
  85. package/protocol/xep0115.js +4 -4
  86. package/protocol/xep0118.js +8 -8
  87. package/protocol/xep0124.js +30 -30
  88. package/protocol/xep0131.js +6 -6
  89. package/protocol/xep0138.js +3 -3
  90. package/protocol/xep0141.js +4 -4
  91. package/protocol/xep0144.js +8 -8
  92. package/protocol/xep0153.js +6 -6
  93. package/protocol/xep0158.js +4 -4
  94. package/protocol/xep0166.js +13 -13
  95. package/protocol/xep0167.js +41 -41
  96. package/protocol/xep0172.js +6 -6
  97. package/protocol/xep0176.js +19 -19
  98. package/protocol/xep0177.js +10 -10
  99. package/protocol/xep0184.js +1 -1
  100. package/protocol/xep0186.js +1 -1
  101. package/protocol/xep0191.js +5 -5
  102. package/protocol/xep0198.js +11 -11
  103. package/protocol/xep0199.js +2 -2
  104. package/protocol/xep0202.js +2 -2
  105. package/protocol/xep0203.js +3 -3
  106. package/protocol/xep0215.js +19 -19
  107. package/protocol/xep0221.js +4 -4
  108. package/protocol/xep0224.js +2 -2
  109. package/protocol/xep0231.js +4 -4
  110. package/protocol/xep0234.js +15 -15
  111. package/protocol/xep0260.js +14 -14
  112. package/protocol/xep0261.js +4 -4
  113. package/protocol/xep0264.js +5 -5
  114. package/protocol/xep0280.js +1 -1
  115. package/protocol/xep0297.js +4 -4
  116. package/protocol/xep0300.js +8 -8
  117. package/protocol/xep0301.js +8 -8
  118. package/protocol/xep0308.js +2 -2
  119. package/protocol/xep0313.js +12 -12
  120. package/protocol/xep0317.js +4 -4
  121. package/protocol/xep0319.js +2 -2
  122. package/protocol/xep0320.js +3 -3
  123. package/protocol/xep0333.js +3 -3
  124. package/protocol/xep0334.js +5 -5
  125. package/protocol/xep0335.js +6 -6
  126. package/protocol/xep0338.js +2 -2
  127. package/protocol/xep0343.js +3 -3
  128. package/protocol/xep0357.js +6 -6
  129. package/protocol/xep0359.js +4 -4
  130. package/protocol/xep0363.js +11 -11
  131. package/protocol/xep0380.js +2 -2
  132. package/protocol/xep0384.js +16 -16
  133. package/protocol/xrd.js +4 -4
  134. package/transports/bosh.js +2 -2
package/Client.js CHANGED
@@ -3,16 +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 = tslib_1.__importDefault(require("./helpers/NetworkDiscovery"));
15
+ const NetworkDiscovery_1 = (0, tslib_1.__importDefault)(require("./helpers/NetworkDiscovery"));
16
16
  class Client extends events_1.EventEmitter {
17
17
  constructor(opts = {}) {
18
18
  super();
@@ -67,7 +67,7 @@ class Client extends events_1.EventEmitter {
67
67
  bosh: bosh_1.default,
68
68
  websocket: websocket_1.default
69
69
  };
70
- this.incomingDataQueue = async_1.priorityQueue(async (task, done) => {
70
+ this.incomingDataQueue = (0, async_1.priorityQueue)(async (task, done) => {
71
71
  const { kind, stanza } = task;
72
72
  this.emit(kind, stanza);
73
73
  if (stanza.id) {
@@ -106,7 +106,7 @@ class Client extends events_1.EventEmitter {
106
106
  }
107
107
  }
108
108
  };
109
- this.outgoingDataQueue = async_1.priorityQueue(async (task, done) => {
109
+ this.outgoingDataQueue = (0, async_1.priorityQueue)(async (task, done) => {
110
110
  var _a;
111
111
  const { kind, stanza, replay } = task;
112
112
  const ackRequest = replay || (await this.sm.track(kind, stanza));
@@ -271,7 +271,7 @@ class Client extends events_1.EventEmitter {
271
271
  pluginInit(this, this.stanzas, this.config);
272
272
  }
273
273
  nextId() {
274
- return Utils_1.uuid();
274
+ return (0, Utils_1.uuid)();
275
275
  }
276
276
  async getCredentials() {
277
277
  return this._getConfiguredCredentials();
@@ -413,7 +413,7 @@ class Client extends events_1.EventEmitter {
413
413
  });
414
414
  this.send('iq', iq);
415
415
  const timeout = this.config.timeout || 15;
416
- return Utils_1.timeoutPromise(request, timeout * 1000, () => ({
416
+ return (0, Utils_1.timeoutPromise)(request, timeout * 1000, () => ({
417
417
  ...iq,
418
418
  to: undefined,
419
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.18.0';
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/Utils.js CHANGED
@@ -64,7 +64,7 @@ function octetCompare(str1, str2) {
64
64
  }
65
65
  exports.octetCompare = octetCompare;
66
66
  function uuid() {
67
- const buf = platform_1.randomBytes(16);
67
+ const buf = (0, platform_1.randomBytes)(16);
68
68
  // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
69
69
  buf[6] = (buf[6] & 0x0f) | 0x40;
70
70
  buf[8] = (buf[8] & 0x3f) | 0x80;
@@ -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'];
@@ -64,7 +64,7 @@ function encodeFields(fields = []) {
64
64
  });
65
65
  }
66
66
  }
67
- sortedFields.sort((a, b) => Utils_1.octetCompare(a.name, b.name));
67
+ sortedFields.sort((a, b) => (0, Utils_1.octetCompare)(a.name, b.name));
68
68
  const result = [];
69
69
  for (const field of sortedFields) {
70
70
  result.push(field.name);
@@ -101,7 +101,7 @@ function encodeForms(extensions = []) {
101
101
  types.add(type.toString());
102
102
  forms.push({ type, form });
103
103
  }
104
- forms.sort((a, b) => Utils_1.octetCompare(a.type, b.type));
104
+ forms.sort((a, b) => (0, Utils_1.octetCompare)(a.type, b.type));
105
105
  const results = [];
106
106
  for (const form of forms) {
107
107
  results.push(form.type);
@@ -134,7 +134,7 @@ function generate(info, hashName) {
134
134
  for (const form of extensions) {
135
135
  append(form);
136
136
  }
137
- return platform_1.createHash(hashName).update(platform_1.Buffer.concat(S)).digest('base64');
137
+ return (0, platform_1.createHash)(hashName).update(platform_1.Buffer.concat(S)).digest('base64');
138
138
  }
139
139
  exports.generate = generate;
140
140
  function verify(info, hashName, check) {
@@ -4,12 +4,12 @@ const tslib_1 = require("tslib");
4
4
  const platform_1 = require("../platform");
5
5
  const Utils_1 = require("../Utils");
6
6
  const jxt_1 = require("../jxt");
7
- const xrd_1 = tslib_1.__importDefault(require("../protocol/xrd"));
7
+ const xrd_1 = (0, tslib_1.__importDefault)(require("../protocol/xrd"));
8
8
  class NetworkDiscovery {
9
9
  constructor() {
10
10
  this.hostMetaCache = new Map();
11
11
  this.hostMetaTTL = 30000;
12
- this.resolver = platform_1.createResolver();
12
+ this.resolver = (0, platform_1.createResolver)();
13
13
  this.registry = new jxt_1.Registry();
14
14
  this.registry.define(xrd_1.default);
15
15
  }
@@ -23,19 +23,19 @@ class NetworkDiscovery {
23
23
  this.hostMetaCache.delete(domain);
24
24
  }
25
25
  }
26
- const hostmeta = Utils_1.promiseAny([
27
- platform_1.fetch(`https://${domain}/.well-known/host-meta.json`).then(async (res) => {
26
+ const hostmeta = (0, Utils_1.promiseAny)([
27
+ (0, platform_1.fetch)(`https://${domain}/.well-known/host-meta.json`).then(async (res) => {
28
28
  if (!res.ok) {
29
29
  throw new Error('could-not-fetch-json');
30
30
  }
31
31
  return res.json();
32
32
  }),
33
- platform_1.fetch(`https://${domain}/.well-known/host-meta`).then(async (res) => {
33
+ (0, platform_1.fetch)(`https://${domain}/.well-known/host-meta`).then(async (res) => {
34
34
  if (!res.ok) {
35
35
  throw new Error('could-not-fetch-xml');
36
36
  }
37
37
  const data = await res.text();
38
- const xml = jxt_1.parse(data);
38
+ const xml = (0, jxt_1.parse)(data);
39
39
  if (xml) {
40
40
  return this.registry.import(xml);
41
41
  }
@@ -96,8 +96,8 @@ class NetworkDiscovery {
96
96
  const weightRecords = (unweightedRecords) => {
97
97
  const sorted = [];
98
98
  while (sorted.length < unweightedRecords.length) {
99
- const ordered = Utils_1.shuffle(unweightedRecords.filter(record => record.weight === 0 && !record.used));
100
- const unordered = Utils_1.shuffle(unweightedRecords.filter(record => {
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
101
  return record.weight !== 0 && !record.used;
102
102
  }));
103
103
  let weightSum = 0;
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
- if (kind === 'sm' && (stanza.type === 'enable' || stanza.type === 'resume')) {
123
- this.handled = 0;
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.js CHANGED
@@ -2,36 +2,36 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
- const Platform = tslib_1.__importStar(require("./platform"));
25
+ const Platform = (0, tslib_1.__importStar)(require("./platform"));
26
26
  exports.Platform = Platform;
27
- tslib_1.__exportStar(require("./helpers/StreamManagement"), exports);
28
- const RSM = tslib_1.__importStar(require("./helpers/RSM"));
27
+ (0, tslib_1.__exportStar)(require("./helpers/StreamManagement"), exports);
28
+ const RSM = (0, tslib_1.__importStar)(require("./helpers/RSM"));
29
29
  exports.RSM = RSM;
30
- const DataForms = tslib_1.__importStar(require("./helpers/DataForms"));
30
+ const DataForms = (0, tslib_1.__importStar)(require("./helpers/DataForms"));
31
31
  exports.DataForms = DataForms;
32
32
  exports.VERSION = Constants.VERSION;
33
- const plugins_1 = tslib_1.__importDefault(require("./plugins"));
34
- tslib_1.__exportStar(require("./plugins"), exports);
33
+ const plugins_1 = (0, tslib_1.__importDefault)(require("./plugins"));
34
+ (0, tslib_1.__exportStar)(require("./plugins"), exports);
35
35
  function createClient(opts) {
36
36
  const client = new Client_1.default(opts);
37
37
  client.use(plugins_1.default);
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Receiver = exports.Sender = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const events_1 = require("events");
6
- const Hashes = tslib_1.__importStar(require("../platform"));
6
+ const Hashes = (0, tslib_1.__importStar)(require("../platform"));
7
7
  const Constants_1 = require("../Constants");
8
8
  const Namespaces_1 = require("../Namespaces");
9
- const ICESession_1 = tslib_1.__importDefault(require("./ICESession"));
9
+ const ICESession_1 = (0, tslib_1.__importDefault)(require("./ICESession"));
10
10
  const Intermediate_1 = require("./sdp/Intermediate");
11
11
  const Protocol_1 = require("./sdp/Protocol");
12
12
  class Sender extends events_1.EventEmitter {
@@ -158,8 +158,8 @@ class FileTransferSession extends ICESession_1.default {
158
158
  offerToReceiveAudio: false,
159
159
  offerToReceiveVideo: false
160
160
  });
161
- const json = Intermediate_1.importFromSDP(offer.sdp);
162
- const jingle = Protocol_1.convertIntermediateToRequest(json, this.role, this.transportType);
161
+ const json = (0, Intermediate_1.importFromSDP)(offer.sdp);
162
+ const jingle = (0, Protocol_1.convertIntermediateToRequest)(json, this.role, this.transportType);
163
163
  this.contentName = jingle.contents[0].name;
164
164
  jingle.sid = this.sid;
165
165
  jingle.action = Constants_1.JingleAction.SessionInitiate;
@@ -194,8 +194,8 @@ class FileTransferSession extends ICESession_1.default {
194
194
  try {
195
195
  await this.processLocal(Constants_1.JingleAction.SessionAccept, async () => {
196
196
  const answer = await this.pc.createAnswer();
197
- const json = Intermediate_1.importFromSDP(answer.sdp);
198
- const jingle = Protocol_1.convertIntermediateToRequest(json, this.role, this.transportType);
197
+ const json = (0, Intermediate_1.importFromSDP)(answer.sdp);
198
+ const jingle = (0, Protocol_1.convertIntermediateToRequest)(json, this.role, this.transportType);
199
199
  jingle.sid = this.sid;
200
200
  jingle.action = 'session-accept';
201
201
  for (const content of jingle.contents) {
@@ -218,8 +218,8 @@ class FileTransferSession extends ICESession_1.default {
218
218
  this.role = 'responder';
219
219
  this.state = 'pending';
220
220
  this.transportType = changes.contents[0].transport.transportType;
221
- const json = Protocol_1.convertRequestToIntermediate(changes, this.peerRole);
222
- const sdp = Intermediate_1.exportToSDP(json);
221
+ const json = (0, Protocol_1.convertRequestToIntermediate)(changes, this.peerRole);
222
+ const sdp = (0, Intermediate_1.exportToSDP)(json);
223
223
  const desc = changes.contents[0].application;
224
224
  const hashes = desc.file.hashesUsed ? desc.file.hashesUsed : desc.file.hashes || [];
225
225
  this.receiver = new Receiver({ hash: hashes[0] && hashes[0].algorithm });
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const SDPUtils = tslib_1.__importStar(require("sdp"));
4
+ const SDPUtils = (0, tslib_1.__importStar)(require("sdp"));
5
5
  const Constants_1 = require("../Constants");
6
6
  const Namespaces_1 = require("../Namespaces");
7
7
  const Intermediate_1 = require("./sdp/Intermediate");
8
8
  const Protocol_1 = require("./sdp/Protocol");
9
- const Session_1 = tslib_1.__importDefault(require("./Session"));
9
+ const Session_1 = (0, tslib_1.__importDefault)(require("./Session"));
10
10
  class ICESession extends Session_1.default {
11
11
  constructor(opts) {
12
12
  super(opts);
@@ -51,12 +51,12 @@ class ICESession extends Session_1.default {
51
51
  await this.processLocal('restart-ice', async () => {
52
52
  const offer = await this.pc.createOffer({ iceRestart: true });
53
53
  // extract new ufrag / pwd, send transport-info with just that.
54
- const json = Intermediate_1.importFromSDP(offer.sdp);
54
+ const json = (0, Intermediate_1.importFromSDP)(offer.sdp);
55
55
  this.send(Constants_1.JingleAction.TransportInfo, {
56
56
  contents: json.media.map(media => ({
57
57
  creator: Constants_1.JingleSessionRole.Initiator,
58
58
  name: media.mid,
59
- transport: Protocol_1.convertIntermediateToTransport(media, this.transportType)
59
+ transport: (0, Protocol_1.convertIntermediateToTransport)(media, this.transportType)
60
60
  })),
61
61
  sid: this.sid
62
62
  });
@@ -126,7 +126,7 @@ class ICESession extends Session_1.default {
126
126
  // detect an ice restart.
127
127
  if (this.pc.remoteDescription) {
128
128
  const remoteDescription = this.pc.remoteDescription;
129
- const remoteJSON = Intermediate_1.importFromSDP(remoteDescription.sdp);
129
+ const remoteJSON = (0, Intermediate_1.importFromSDP)(remoteDescription.sdp);
130
130
  const remoteMedia = remoteJSON.media.find(m => m.mid === changes.contents[0].name);
131
131
  const currentUsernameFragment = remoteMedia.iceParameters.usernameFragment;
132
132
  const remoteUsernameFragment = changes.contents[0].transport
@@ -143,18 +143,18 @@ class ICESession extends Session_1.default {
143
143
  try {
144
144
  await this.pc.setRemoteDescription({
145
145
  type: remoteDescription.type,
146
- sdp: Intermediate_1.exportToSDP(remoteJSON)
146
+ sdp: (0, Intermediate_1.exportToSDP)(remoteJSON)
147
147
  });
148
148
  await this.processBufferedCandidates();
149
149
  if (remoteDescription.type === 'offer') {
150
150
  const answer = await this.pc.createAnswer();
151
151
  await this.pc.setLocalDescription(answer);
152
- const json = Intermediate_1.importFromSDP(answer.sdp);
152
+ const json = (0, Intermediate_1.importFromSDP)(answer.sdp);
153
153
  this.send(Constants_1.JingleAction.TransportInfo, {
154
154
  contents: json.media.map(media => ({
155
155
  creator: Constants_1.JingleSessionRole.Initiator,
156
156
  name: media.mid,
157
- transport: Protocol_1.convertIntermediateToTransport(media, this.transportType)
157
+ transport: (0, Protocol_1.convertIntermediateToTransport)(media, this.transportType)
158
158
  })),
159
159
  sid: this.sid
160
160
  });
@@ -174,7 +174,7 @@ class ICESession extends Session_1.default {
174
174
  const all = (changes.contents || []).map(content => {
175
175
  const sdpMid = content.name;
176
176
  const results = (content.transport.candidates || []).map(async (json) => {
177
- const candidate = SDPUtils.writeCandidate(Protocol_1.convertCandidateToIntermediate(json));
177
+ const candidate = SDPUtils.writeCandidate((0, Protocol_1.convertCandidateToIntermediate)(json));
178
178
  if (this.pc.remoteDescription && this.pc.signalingState === 'stable') {
179
179
  try {
180
180
  await this.pc.addIceCandidate({ sdpMid, candidate });
@@ -200,8 +200,8 @@ class ICESession extends Session_1.default {
200
200
  }
201
201
  async onSessionAccept(changes, cb) {
202
202
  this.state = 'active';
203
- const json = Protocol_1.convertRequestToIntermediate(changes, this.peerRole);
204
- const sdp = Intermediate_1.exportToSDP(json);
203
+ const json = (0, Protocol_1.convertRequestToIntermediate)(changes, this.peerRole);
204
+ const sdp = (0, Intermediate_1.exportToSDP)(json);
205
205
  try {
206
206
  await this.pc.setRemoteDescription({ type: 'answer', sdp });
207
207
  await this.processBufferedCandidates();
@@ -233,7 +233,7 @@ class ICESession extends Session_1.default {
233
233
  creator: Constants_1.JingleSessionRole.Initiator,
234
234
  name: e.candidate.sdpMid,
235
235
  transport: {
236
- candidates: [Protocol_1.convertIntermediateToCandidate(candidate)],
236
+ candidates: [(0, Protocol_1.convertIntermediateToCandidate)(candidate)],
237
237
  transportType: this.transportType,
238
238
  usernameFragment: candidate.usernameFragment
239
239
  }
@@ -245,7 +245,7 @@ class ICESession extends Session_1.default {
245
245
  }
246
246
  onIceEndOfCandidates() {
247
247
  this._log('info', 'ICE end of candidates');
248
- const json = Intermediate_1.importFromSDP(this.pc.localDescription.sdp);
248
+ const json = (0, Intermediate_1.importFromSDP)(this.pc.localDescription.sdp);
249
249
  const firstMedia = json.media[0];
250
250
  // signal end-of-candidates with our first media mid/ufrag
251
251
  this.send(Constants_1.JingleAction.TransportInfo, {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const Constants_1 = require("../Constants");
5
- const ICESession_1 = tslib_1.__importDefault(require("./ICESession"));
5
+ const ICESession_1 = (0, tslib_1.__importDefault)(require("./ICESession"));
6
6
  const Intermediate_1 = require("./sdp/Intermediate");
7
7
  const Protocol_1 = require("./sdp/Protocol");
8
8
  function applyStreamsCompatibility(content) {
@@ -70,8 +70,8 @@ class MediaSession extends ICESession_1.default {
70
70
  try {
71
71
  await this.processLocal(Constants_1.JingleAction.SessionInitiate, async () => {
72
72
  const offer = await this.pc.createOffer(opts);
73
- const json = Intermediate_1.importFromSDP(offer.sdp);
74
- const jingle = Protocol_1.convertIntermediateToRequest(json, this.role, this.transportType);
73
+ const json = (0, Intermediate_1.importFromSDP)(offer.sdp);
74
+ const jingle = (0, Protocol_1.convertIntermediateToRequest)(json, this.role, this.transportType);
75
75
  jingle.sid = this.sid;
76
76
  jingle.action = Constants_1.JingleAction.SessionInitiate;
77
77
  for (const content of jingle.contents || []) {
@@ -102,8 +102,8 @@ class MediaSession extends ICESession_1.default {
102
102
  try {
103
103
  await this.processLocal(Constants_1.JingleAction.SessionAccept, async () => {
104
104
  const answer = await this.pc.createAnswer(opts);
105
- const json = Intermediate_1.importFromSDP(answer.sdp);
106
- const jingle = Protocol_1.convertIntermediateToRequest(json, this.role, this.transportType);
105
+ const json = (0, Intermediate_1.importFromSDP)(answer.sdp);
106
+ const jingle = (0, Protocol_1.convertIntermediateToRequest)(json, this.role, this.transportType);
107
107
  jingle.sid = this.sid;
108
108
  jingle.action = Constants_1.JingleAction.SessionAccept;
109
109
  for (const content of jingle.contents || []) {
@@ -230,7 +230,7 @@ class MediaSession extends ICESession_1.default {
230
230
  this.state = 'pending';
231
231
  this.role = 'responder';
232
232
  this.transportType = changes.contents[0].transport.transportType;
233
- const json = Protocol_1.convertRequestToIntermediate(changes, this.peerRole);
233
+ const json = (0, Protocol_1.convertRequestToIntermediate)(changes, this.peerRole);
234
234
  for (const media of json.media) {
235
235
  if (media.kind === 'audio') {
236
236
  this.includesAudio = true;
@@ -242,7 +242,7 @@ class MediaSession extends ICESession_1.default {
242
242
  media.streams = [{ stream: 'legacy', track: media.kind }];
243
243
  }
244
244
  }
245
- const sdp = Intermediate_1.exportToSDP(json);
245
+ const sdp = (0, Intermediate_1.exportToSDP)(json);
246
246
  try {
247
247
  await this.pc.setRemoteDescription({ type: 'offer', sdp });
248
248
  await this.processBufferedCandidates();
package/jingle/Session.js CHANGED
@@ -12,7 +12,7 @@ const unsupportedInfo = {
12
12
  class JingleSession {
13
13
  constructor(opts) {
14
14
  this.parent = opts.parent;
15
- this.sid = opts.sid || Utils_1.uuid();
15
+ this.sid = opts.sid || (0, Utils_1.uuid)();
16
16
  this.peerID = opts.peerID;
17
17
  this.role = opts.initiator ? Constants_1.JingleSessionRole.Initiator : Constants_1.JingleSessionRole.Responder;
18
18
  this._sessionState = 'starting';
@@ -23,7 +23,7 @@ class JingleSession {
23
23
  this.pendingAction = undefined;
24
24
  // Here is where we'll ensure that all actions are processed
25
25
  // in order, even if a particular action requires async handling.
26
- this.processingQueue = async_1.priorityQueue(async (task, next) => {
26
+ this.processingQueue = (0, async_1.priorityQueue)(async (task, next) => {
27
27
  if (this.state === 'ended') {
28
28
  // Don't process anything once the session has been ended
29
29
  if (task.type === 'local' && task.reject) {
@@ -149,7 +149,7 @@ class JingleSession {
149
149
  this.pendingAction = undefined;
150
150
  }
151
151
  this.parent.signal(this, {
152
- id: Utils_1.uuid(),
152
+ id: (0, Utils_1.uuid)(),
153
153
  jingle: data,
154
154
  to: this.peerID,
155
155
  type: 'set'
@@ -6,9 +6,9 @@ const Constants_1 = require("../Constants");
6
6
  const Namespaces_1 = require("../Namespaces");
7
7
  const platform_1 = require("../platform");
8
8
  const Utils_1 = require("../Utils");
9
- const FileTransferSession_1 = tslib_1.__importDefault(require("./FileTransferSession"));
10
- const MediaSession_1 = tslib_1.__importDefault(require("./MediaSession"));
11
- const Session_1 = tslib_1.__importDefault(require("./Session"));
9
+ const FileTransferSession_1 = (0, tslib_1.__importDefault)(require("./FileTransferSession"));
10
+ const MediaSession_1 = (0, tslib_1.__importDefault)(require("./MediaSession"));
11
+ const Session_1 = (0, tslib_1.__importDefault)(require("./Session"));
12
12
  const MAX_RELAY_BANDWIDTH = 768 * 1024; // maximum bandwidth used via TURN.
13
13
  function isICEServer(val) {
14
14
  return !val.type && (val.urls || val.url);
@@ -285,7 +285,7 @@ class SessionManager extends events_1.EventEmitter {
285
285
  if (sess &&
286
286
  sess.state === 'pending' &&
287
287
  sid &&
288
- Utils_1.octetCompare(sess.sid, sid) > 0 &&
288
+ (0, Utils_1.octetCompare)(sess.sid, sid) > 0 &&
289
289
  this.performTieBreak(sess, req)) {
290
290
  this._log('info', 'Tie break session-initiate');
291
291
  return this._sendError(sender, rid, {
package/jingle/index.js CHANGED
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SessionManager = exports.FileSession = exports.MediaSession = exports.ICESession = exports.Session = exports.exportToSDP = exports.importFromSDP = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const FileTransferSession_1 = tslib_1.__importDefault(require("./FileTransferSession"));
5
+ const FileTransferSession_1 = (0, tslib_1.__importDefault)(require("./FileTransferSession"));
6
6
  exports.FileSession = FileTransferSession_1.default;
7
- const ICESession_1 = tslib_1.__importDefault(require("./ICESession"));
7
+ const ICESession_1 = (0, tslib_1.__importDefault)(require("./ICESession"));
8
8
  exports.ICESession = ICESession_1.default;
9
- const MediaSession_1 = tslib_1.__importDefault(require("./MediaSession"));
9
+ const MediaSession_1 = (0, tslib_1.__importDefault)(require("./MediaSession"));
10
10
  exports.MediaSession = MediaSession_1.default;
11
- const Session_1 = tslib_1.__importDefault(require("./Session"));
11
+ const Session_1 = (0, tslib_1.__importDefault)(require("./Session"));
12
12
  exports.Session = Session_1.default;
13
- const SessionManager_1 = tslib_1.__importDefault(require("./SessionManager"));
13
+ const SessionManager_1 = (0, tslib_1.__importDefault)(require("./SessionManager"));
14
14
  exports.SessionManager = SessionManager_1.default;
15
15
  var Intermediate_1 = require("./sdp/Intermediate");
16
16
  Object.defineProperty(exports, "importFromSDP", { enumerable: true, get: function () { return Intermediate_1.importFromSDP; } });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.exportToSDP = exports.importFromSDP = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const SDP = tslib_1.__importStar(require("sdp"));
5
+ const SDP = (0, tslib_1.__importStar)(require("sdp"));
6
6
  // ====================================================================
7
7
  // Import SDP to Intermediary
8
8
  // ====================================================================
@@ -29,7 +29,7 @@ function convertIntermediateToApplication(media, role) {
29
29
  uri: ext.uri
30
30
  };
31
31
  if (ext.direction && ext.direction !== 'sendrecv') {
32
- header.senders = Constants_1.directionToSenders(role, ext.direction);
32
+ header.senders = (0, Constants_1.directionToSenders)(role, ext.direction);
33
33
  }
34
34
  application.headerExtensions.push(header);
35
35
  }
@@ -171,7 +171,7 @@ function convertIntermediateToRequest(session, role, transportType) {
171
171
  },
172
172
  creator: Constants_1.JingleSessionRole.Initiator,
173
173
  name: media.mid,
174
- senders: Constants_1.directionToSenders(role, media.direction),
174
+ senders: (0, Constants_1.directionToSenders)(role, media.direction),
175
175
  transport: convertIntermediateToTransport(media, transportType)
176
176
  };
177
177
  }),
@@ -189,7 +189,7 @@ function convertContentToIntermediate(content, role) {
189
189
  const transport = content.transport;
190
190
  const isRTP = application && application.applicationType === Namespaces_1.NS_JINGLE_RTP_1;
191
191
  const media = {
192
- direction: Constants_1.sendersToDirection(role, content.senders),
192
+ direction: (0, Constants_1.sendersToDirection)(role, content.senders),
193
193
  kind: application.media || 'application',
194
194
  mid: content.name,
195
195
  protocol: isRTP ? 'UDP/TLS/RTP/SAVPF' : 'UDP/DTLS/SCTP'
@@ -267,9 +267,11 @@ function convertContentToIntermediate(content, role) {
267
267
  }
268
268
  for (const ext of application.headerExtensions || []) {
269
269
  media.rtpParameters.headerExtensions.push({
270
- direction: Constants_1.sendersToDirection(role, ext.senders || 'both'),
270
+ direction: (0, Constants_1.sendersToDirection)(role, ext.senders || 'both'),
271
271
  id: ext.id,
272
- uri: ext.uri
272
+ uri: ext.uri,
273
+ attributes: undefined
274
+ // FIXME: Waiting for typings fix in sdp module
273
275
  });
274
276
  }
275
277
  }