stanza 12.20.0 → 12.21.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/CLAUDE.md +1 -0
- package/Client.d.ts +1 -2
- package/Client.js +67 -21
- package/Constants.d.ts +22 -22
- package/Constants.js +4 -4
- package/JID.d.ts +1 -1
- package/JID.js +21 -20
- package/Utils.d.ts +1 -1
- package/Utils.js +7 -8
- package/helpers/DataForms.js +1 -2
- package/helpers/DiscoManager.js +40 -3
- package/helpers/LegacyEntityCapabilities.js +2 -3
- package/helpers/NetworkDiscovery.js +11 -9
- package/helpers/RSM.d.ts +1 -1
- package/helpers/RSM.js +15 -11
- package/helpers/RTT.d.ts +1 -1
- package/helpers/RTT.js +27 -16
- package/helpers/StreamManagement.d.ts +1 -2
- package/helpers/StreamManagement.js +10 -8
- package/index.d.ts +0 -1
- package/index.js +57 -19
- package/jingle/FileTransferSession.d.ts +0 -1
- package/jingle/FileTransferSession.js +54 -3
- package/jingle/ICESession.js +48 -8
- package/jingle/MediaSession.js +8 -5
- package/jingle/Session.d.ts +2 -2
- package/jingle/Session.js +11 -2
- package/jingle/SessionManager.d.ts +0 -1
- package/jingle/SessionManager.js +14 -4
- package/jingle/index.js +8 -6
- package/jingle/sdp/Intermediate.d.ts +1 -1
- package/jingle/sdp/Intermediate.js +36 -5
- package/jingle/sdp/Protocol.js +7 -8
- package/jxt/Definitions.d.ts +10 -10
- package/jxt/Definitions.js +8 -7
- package/jxt/Element.d.ts +1 -1
- package/jxt/Element.js +5 -0
- package/jxt/Error.js +9 -7
- package/jxt/Helpers.d.ts +1 -1
- package/jxt/Helpers.js +8 -8
- package/jxt/Parser.d.ts +0 -1
- package/jxt/Parser.js +146 -144
- package/jxt/Registry.js +8 -3
- package/jxt/StreamParser.d.ts +0 -1
- package/jxt/StreamParser.js +15 -6
- package/jxt/Translator.js +16 -2
- package/jxt/Types.d.ts +5 -6
- package/jxt/Types.js +31 -30
- package/jxt/index.js +27 -11
- package/lib/AsyncPriorityQueue.d.ts +10 -0
- package/lib/AsyncPriorityQueue.js +157 -0
- package/lib/StrictEventEmitter.d.ts +13 -13
- package/lib/sasl/index.d.ts +2 -2
- package/lib/sasl/index.js +34 -12
- package/lib/stringprep/index.js +14 -11
- package/package.json +4 -31
- package/platform/browser/buffer/base64-js/index.d.ts +1 -1
- package/platform/browser/buffer/index.d.ts +14 -14
- package/platform/browser/crypto/Hash.d.ts +0 -1
- package/platform/browser/crypto/Hash.js +5 -0
- package/platform/browser/crypto/Hmac.d.ts +0 -1
- package/platform/browser/crypto/Hmac.js +8 -2
- package/platform/browser/crypto/MD5.js +9 -7
- package/platform/browser/crypto/SHA-1.js +10 -8
- package/platform/browser/crypto/SHA-256.js +13 -11
- package/platform/browser/crypto/SHA-512.js +21 -19
- package/platform/browser/crypto/createHash.js +9 -7
- package/platform/browser/index.d.ts +6 -6
- package/platform/browser/index.js +43 -8
- package/platform/browser/process.js +1 -2
- package/platform/browser/stream/index.d.ts +5 -5
- package/platform/browser/stream/lib/_stream_duplex.d.ts +1 -1
- package/platform/browser/stream/lib/_stream_readable.d.ts +8 -8
- package/platform/browser/stream/lib/_stream_writable.d.ts +2 -2
- package/platform/browser/stream/string_decoder.d.ts +10 -2
- package/platform/index.js +15 -2
- package/platform/node/index.d.ts +3 -4
- package/platform/node/index.js +46 -11
- package/platform/react-native/index.js +15 -2
- package/plugins/account.js +1 -1
- package/plugins/avatar.d.ts +0 -1
- package/plugins/avatar.js +2 -2
- package/plugins/bind.js +1 -1
- package/plugins/command.js +1 -1
- package/plugins/connection.js +1 -1
- package/plugins/disco.js +39 -4
- package/plugins/entity.js +35 -3
- package/plugins/features.d.ts +1 -1
- package/plugins/features.js +1 -1
- package/plugins/hostmeta.js +2 -3
- package/plugins/index.js +55 -40
- package/plugins/jingle.js +35 -3
- package/plugins/mam.js +35 -3
- package/plugins/messaging.d.ts +8 -8
- package/plugins/messaging.js +39 -10
- package/plugins/muc.js +35 -3
- package/plugins/pep.js +1 -1
- package/plugins/pubsub.d.ts +5 -5
- package/plugins/pubsub.js +35 -3
- package/plugins/roster.js +35 -3
- package/plugins/sasl.js +1 -1
- package/plugins/sharing.js +35 -3
- package/protocol/index.js +179 -163
- package/protocol/rfc6120.d.ts +2 -2
- package/protocol/xep0004.d.ts +2 -2
- package/protocol/xep0030.d.ts +1 -1
- package/protocol/xep0047.d.ts +2 -2
- package/protocol/xep0050.d.ts +1 -1
- package/protocol/xep0054.d.ts +7 -7
- package/protocol/xep0060.d.ts +1 -1
- package/protocol/xep0080.js +1 -1
- package/protocol/xep0084.d.ts +1 -1
- package/protocol/xep0124.d.ts +1 -1
- package/protocol/xep0138.d.ts +1 -1
- package/protocol/xep0141.d.ts +1 -1
- package/protocol/xep0167.d.ts +1 -1
- package/protocol/xep0198.d.ts +1 -1
- package/protocol/xep0231.d.ts +0 -1
- package/protocol/xep0300.d.ts +1 -1
- package/protocol/xep0301.d.ts +1 -1
- package/protocol/xep0384.d.ts +1 -1
- package/transports/bosh.d.ts +0 -1
- package/transports/bosh.js +24 -13
- package/transports/websocket.d.ts +1 -1
- package/transports/websocket.js +17 -2
package/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Never commit CLAUDE.md file. Never commit anything in .ai-agent/. Make sure to check git status and unstage these if they get added before commits
|
package/Client.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { AsyncPriorityQueue } from 'async';
|
|
1
|
+
import { AsyncPriorityQueue } from './lib/AsyncPriorityQueue';
|
|
3
2
|
import { EventEmitter } from 'events';
|
|
4
3
|
import { Agent, AgentConfig, Transport } from './';
|
|
5
4
|
import StreamManagement from './helpers/StreamManagement';
|
package/Client.js
CHANGED
|
@@ -1,22 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const async_1 = require("async");
|
|
39
|
+
const AsyncPriorityQueue_1 = require("./lib/AsyncPriorityQueue");
|
|
5
40
|
const events_1 = require("events");
|
|
6
|
-
const StreamManagement_1 =
|
|
7
|
-
const JID =
|
|
8
|
-
const JXT =
|
|
9
|
-
const SASL =
|
|
41
|
+
const StreamManagement_1 = __importDefault(require("./helpers/StreamManagement"));
|
|
42
|
+
const JID = __importStar(require("./JID"));
|
|
43
|
+
const JXT = __importStar(require("./jxt"));
|
|
44
|
+
const SASL = __importStar(require("./lib/sasl"));
|
|
10
45
|
const plugins_1 = require("./plugins");
|
|
11
|
-
const protocol_1 =
|
|
12
|
-
const bosh_1 =
|
|
13
|
-
const websocket_1 =
|
|
46
|
+
const protocol_1 = __importDefault(require("./protocol"));
|
|
47
|
+
const bosh_1 = __importDefault(require("./transports/bosh"));
|
|
48
|
+
const websocket_1 = __importDefault(require("./transports/websocket"));
|
|
14
49
|
const Utils_1 = require("./Utils");
|
|
15
|
-
const NetworkDiscovery_1 =
|
|
50
|
+
const NetworkDiscovery_1 = __importDefault(require("./helpers/NetworkDiscovery"));
|
|
16
51
|
class Client extends events_1.EventEmitter {
|
|
52
|
+
jid;
|
|
53
|
+
config;
|
|
54
|
+
sm;
|
|
55
|
+
transport;
|
|
56
|
+
stanzas;
|
|
57
|
+
resolver;
|
|
58
|
+
sessionStarting;
|
|
59
|
+
sessionStarted;
|
|
60
|
+
sessionTerminating;
|
|
61
|
+
reconnectAttempts = 0;
|
|
62
|
+
transports;
|
|
63
|
+
sasl;
|
|
64
|
+
incomingDataQueue;
|
|
65
|
+
outgoingDataQueue;
|
|
66
|
+
reconnectTimer;
|
|
17
67
|
constructor(opts = {}) {
|
|
18
68
|
super();
|
|
19
|
-
this.reconnectAttempts = 0;
|
|
20
69
|
this.setMaxListeners(100);
|
|
21
70
|
// Some EventEmitter shims don't include off()
|
|
22
71
|
this.off = this.removeListener;
|
|
@@ -67,7 +116,7 @@ class Client extends events_1.EventEmitter {
|
|
|
67
116
|
bosh: bosh_1.default,
|
|
68
117
|
websocket: websocket_1.default
|
|
69
118
|
};
|
|
70
|
-
this.incomingDataQueue = (0,
|
|
119
|
+
this.incomingDataQueue = (0, AsyncPriorityQueue_1.priorityQueue)(async (task, done) => {
|
|
71
120
|
const { kind, stanza } = task;
|
|
72
121
|
this.emit(kind, stanza);
|
|
73
122
|
if (stanza.id) {
|
|
@@ -106,8 +155,7 @@ class Client extends events_1.EventEmitter {
|
|
|
106
155
|
}
|
|
107
156
|
}
|
|
108
157
|
};
|
|
109
|
-
this.outgoingDataQueue = (0,
|
|
110
|
-
var _a;
|
|
158
|
+
this.outgoingDataQueue = (0, AsyncPriorityQueue_1.priorityQueue)(async (task, done) => {
|
|
111
159
|
const { kind, stanza, replay } = task;
|
|
112
160
|
const ackRequest = replay || (await this.sm.track(kind, stanza));
|
|
113
161
|
if (kind === 'message') {
|
|
@@ -122,7 +170,7 @@ class Client extends events_1.EventEmitter {
|
|
|
122
170
|
try {
|
|
123
171
|
await this.transport.send(kind, stanza);
|
|
124
172
|
if (ackRequest) {
|
|
125
|
-
|
|
173
|
+
this.transport?.send('sm', { type: 'request' });
|
|
126
174
|
}
|
|
127
175
|
}
|
|
128
176
|
catch (err) {
|
|
@@ -222,7 +270,6 @@ class Client extends events_1.EventEmitter {
|
|
|
222
270
|
});
|
|
223
271
|
}
|
|
224
272
|
updateConfig(opts = {}) {
|
|
225
|
-
var _a;
|
|
226
273
|
const currConfig = this.config || {};
|
|
227
274
|
this.config = {
|
|
228
275
|
allowResumption: true,
|
|
@@ -245,7 +292,7 @@ class Client extends events_1.EventEmitter {
|
|
|
245
292
|
delete this.config.password;
|
|
246
293
|
}
|
|
247
294
|
if (!this.config.transportPreferenceOrder) {
|
|
248
|
-
this.config.transportPreferenceOrder = Object.keys(
|
|
295
|
+
this.config.transportPreferenceOrder = Object.keys(this.config.transports ?? {});
|
|
249
296
|
}
|
|
250
297
|
}
|
|
251
298
|
get stream() {
|
|
@@ -277,14 +324,13 @@ class Client extends events_1.EventEmitter {
|
|
|
277
324
|
return this._getConfiguredCredentials();
|
|
278
325
|
}
|
|
279
326
|
async connect() {
|
|
280
|
-
var _a, _b, _c;
|
|
281
327
|
this.sessionTerminating = false;
|
|
282
328
|
this.sessionStarting = true;
|
|
283
329
|
this.emit('--reset-stream-features');
|
|
284
330
|
if (this.transport) {
|
|
285
331
|
this.transport.disconnect(false);
|
|
286
332
|
}
|
|
287
|
-
const transportPref =
|
|
333
|
+
const transportPref = this.config.transportPreferenceOrder ?? [];
|
|
288
334
|
let endpoints;
|
|
289
335
|
for (const name of transportPref) {
|
|
290
336
|
const settings = this.config.transports[name];
|
|
@@ -292,9 +338,9 @@ class Client extends events_1.EventEmitter {
|
|
|
292
338
|
continue;
|
|
293
339
|
}
|
|
294
340
|
let config = {
|
|
295
|
-
acceptLanguages: this.config.acceptLanguages || [
|
|
341
|
+
acceptLanguages: this.config.acceptLanguages || [this.config.lang ?? 'en'],
|
|
296
342
|
jid: this.config.jid,
|
|
297
|
-
lang:
|
|
343
|
+
lang: this.config.lang ?? 'en',
|
|
298
344
|
server: this.config.server
|
|
299
345
|
};
|
|
300
346
|
const transport = new this.transports[name](this, this.sm, this.stanzas);
|
package/Constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const StreamType: {
|
|
|
5
5
|
readonly Component: "jabber:component:accept";
|
|
6
6
|
readonly Server: "jabber:server";
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type StreamType = typeof StreamType[keyof typeof StreamType];
|
|
9
9
|
export declare const SASLFailureCondition: {
|
|
10
10
|
readonly AccountDisabled: "account-disabled";
|
|
11
11
|
readonly CredentialsExpired: "credentials-expired";
|
|
@@ -18,7 +18,7 @@ export declare const SASLFailureCondition: {
|
|
|
18
18
|
readonly NotAuthorized: "not-authorized";
|
|
19
19
|
readonly TemporaryAuthFailure: "temporary-auth-failure";
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type SASLFailureCondition = typeof SASLFailureCondition[keyof typeof SASLFailureCondition];
|
|
22
22
|
export declare const StreamErrorCondition: {
|
|
23
23
|
readonly BadFormat: "bad-format";
|
|
24
24
|
readonly BadNamespacePrefix: "bad-namespace-prefix";
|
|
@@ -46,7 +46,7 @@ export declare const StreamErrorCondition: {
|
|
|
46
46
|
readonly UnsupportedStanzaType: "unsupported-stanza-type";
|
|
47
47
|
readonly UnsupportedVersion: "unsupported-version";
|
|
48
48
|
};
|
|
49
|
-
export
|
|
49
|
+
export type StreamErrorCondition = typeof StreamErrorCondition[keyof typeof StreamErrorCondition];
|
|
50
50
|
export declare const StanzaErrorCondition: {
|
|
51
51
|
readonly BadRequest: "bad-request";
|
|
52
52
|
readonly Conflict: "conflict";
|
|
@@ -71,7 +71,7 @@ export declare const StanzaErrorCondition: {
|
|
|
71
71
|
readonly UndefinedCondition: "undefined-condition";
|
|
72
72
|
readonly UnexpectedRequest: "unexpected-request";
|
|
73
73
|
};
|
|
74
|
-
export
|
|
74
|
+
export type StanzaErrorCondition = typeof StanzaErrorCondition[keyof typeof StanzaErrorCondition];
|
|
75
75
|
export declare const MessageType: {
|
|
76
76
|
readonly Chat: "chat";
|
|
77
77
|
readonly Error: "error";
|
|
@@ -79,7 +79,7 @@ export declare const MessageType: {
|
|
|
79
79
|
readonly Headline: "headline";
|
|
80
80
|
readonly Normal: "normal";
|
|
81
81
|
};
|
|
82
|
-
export
|
|
82
|
+
export type MessageType = typeof MessageType[keyof typeof MessageType];
|
|
83
83
|
export declare const PresenceType: {
|
|
84
84
|
readonly Available: undefined;
|
|
85
85
|
readonly Error: "error";
|
|
@@ -90,21 +90,21 @@ export declare const PresenceType: {
|
|
|
90
90
|
readonly Unsubscribe: "unsubscribe";
|
|
91
91
|
readonly Unsubscribed: "unsubscribed";
|
|
92
92
|
};
|
|
93
|
-
export
|
|
93
|
+
export type PresenceType = typeof PresenceType[keyof typeof PresenceType];
|
|
94
94
|
export declare const IQType: {
|
|
95
95
|
readonly Error: "error";
|
|
96
96
|
readonly Get: "get";
|
|
97
97
|
readonly Result: "result";
|
|
98
98
|
readonly Set: "set";
|
|
99
99
|
};
|
|
100
|
-
export
|
|
100
|
+
export type IQType = typeof IQType[keyof typeof IQType];
|
|
101
101
|
export declare const PresenceShow: {
|
|
102
102
|
readonly Away: "away";
|
|
103
103
|
readonly Chat: "chat";
|
|
104
104
|
readonly DoNotDisturb: "dnd";
|
|
105
105
|
readonly ExtendedAway: "xa";
|
|
106
106
|
};
|
|
107
|
-
export
|
|
107
|
+
export type PresenceShow = typeof PresenceShow[keyof typeof PresenceShow];
|
|
108
108
|
export declare const RosterSubscription: {
|
|
109
109
|
readonly Both: "both";
|
|
110
110
|
readonly From: "from";
|
|
@@ -115,14 +115,14 @@ export declare const RosterSubscription: {
|
|
|
115
115
|
readonly SendPresenceOnly: "from";
|
|
116
116
|
readonly To: "to";
|
|
117
117
|
};
|
|
118
|
-
export
|
|
118
|
+
export type RosterSubscription = typeof RosterSubscription[keyof typeof RosterSubscription];
|
|
119
119
|
export declare const DataFormType: {
|
|
120
120
|
readonly Cancel: "cancel";
|
|
121
121
|
readonly Form: "form";
|
|
122
122
|
readonly Result: "result";
|
|
123
123
|
readonly Submit: "submit";
|
|
124
124
|
};
|
|
125
|
-
export
|
|
125
|
+
export type DataFormType = typeof DataFormType[keyof typeof DataFormType];
|
|
126
126
|
export declare const DataFormFieldType: {
|
|
127
127
|
readonly Boolean: "boolean";
|
|
128
128
|
readonly Fixed: "fixed";
|
|
@@ -136,7 +136,7 @@ export declare const DataFormFieldType: {
|
|
|
136
136
|
readonly TextMultiple: "text-multi";
|
|
137
137
|
readonly TextPrivate: "text-private";
|
|
138
138
|
};
|
|
139
|
-
export
|
|
139
|
+
export type DataFormFieldType = typeof DataFormFieldType[keyof typeof DataFormFieldType];
|
|
140
140
|
export declare const MUCAffiliation: {
|
|
141
141
|
readonly Admin: "admin";
|
|
142
142
|
readonly Banned: "outcast";
|
|
@@ -145,14 +145,14 @@ export declare const MUCAffiliation: {
|
|
|
145
145
|
readonly Outcast: "outcast";
|
|
146
146
|
readonly Owner: "owner";
|
|
147
147
|
};
|
|
148
|
-
export
|
|
148
|
+
export type MUCAffiliation = typeof MUCAffiliation[keyof typeof MUCAffiliation];
|
|
149
149
|
export declare const MUCRole: {
|
|
150
150
|
readonly Moderator: "moderator";
|
|
151
151
|
readonly None: "none";
|
|
152
152
|
readonly Participant: "participant";
|
|
153
153
|
readonly Visitor: "visitor";
|
|
154
154
|
};
|
|
155
|
-
export
|
|
155
|
+
export type MUCRole = typeof MUCRole[keyof typeof MUCRole];
|
|
156
156
|
export declare const MUCStatusCode: {
|
|
157
157
|
readonly AffiliationChanged: "101";
|
|
158
158
|
readonly AffiliationLost: "321";
|
|
@@ -174,7 +174,7 @@ export declare const MUCStatusCode: {
|
|
|
174
174
|
readonly UnavailableMembersListed: "102";
|
|
175
175
|
readonly UnavailableMembersNotListed: "103";
|
|
176
176
|
};
|
|
177
|
-
export
|
|
177
|
+
export type MUCStatusCode = typeof MUCStatusCode[keyof typeof MUCStatusCode];
|
|
178
178
|
export declare const PubsubErrorCondition: {
|
|
179
179
|
readonly ClosedNode: "closed-node";
|
|
180
180
|
readonly ConfigurationRequired: "configuration-required";
|
|
@@ -199,7 +199,7 @@ export declare const PubsubErrorCondition: {
|
|
|
199
199
|
readonly Unsupported: "unsupported";
|
|
200
200
|
readonly UnsupportedAccessModel: "unsupported-access-model";
|
|
201
201
|
};
|
|
202
|
-
export
|
|
202
|
+
export type PubsubErrorCondition = typeof PubsubErrorCondition[keyof typeof PubsubErrorCondition];
|
|
203
203
|
export declare const ChatState: {
|
|
204
204
|
readonly Active: "active";
|
|
205
205
|
readonly Composing: "composing";
|
|
@@ -207,26 +207,26 @@ export declare const ChatState: {
|
|
|
207
207
|
readonly Inactive: "inactive";
|
|
208
208
|
readonly Paused: "paused";
|
|
209
209
|
};
|
|
210
|
-
export
|
|
210
|
+
export type ChatState = typeof ChatState[keyof typeof ChatState];
|
|
211
211
|
export declare const JingleSessionRole: {
|
|
212
212
|
readonly Initiator: "initiator";
|
|
213
213
|
readonly Responder: "responder";
|
|
214
214
|
};
|
|
215
|
-
export
|
|
215
|
+
export type JingleSessionRole = typeof JingleSessionRole[keyof typeof JingleSessionRole];
|
|
216
216
|
export declare const JingleApplicationDirection: {
|
|
217
217
|
readonly Inactive: "inactive";
|
|
218
218
|
readonly Receive: "recvonly";
|
|
219
219
|
readonly Send: "sendonly";
|
|
220
220
|
readonly SendReceive: "sendrecv";
|
|
221
221
|
};
|
|
222
|
-
export
|
|
222
|
+
export type JingleApplicationDirection = typeof JingleApplicationDirection[keyof typeof JingleApplicationDirection];
|
|
223
223
|
export declare const JingleContentSenders: {
|
|
224
224
|
readonly Both: "both";
|
|
225
225
|
readonly Initiator: "initiator";
|
|
226
226
|
readonly None: "none";
|
|
227
227
|
readonly Responder: "responder";
|
|
228
228
|
};
|
|
229
|
-
export
|
|
229
|
+
export type JingleContentSenders = typeof JingleContentSenders[keyof typeof JingleContentSenders];
|
|
230
230
|
export declare const JingleAction: {
|
|
231
231
|
readonly ContentAccept: "content-accept";
|
|
232
232
|
readonly ContentAdd: "content-add";
|
|
@@ -244,7 +244,7 @@ export declare const JingleAction: {
|
|
|
244
244
|
readonly TransportReject: "transport-reject";
|
|
245
245
|
readonly TransportReplace: "transport-replace";
|
|
246
246
|
};
|
|
247
|
-
export
|
|
247
|
+
export type JingleAction = typeof JingleAction[keyof typeof JingleAction];
|
|
248
248
|
export declare const JingleErrorCondition: {
|
|
249
249
|
readonly OutOfOrder: "out-of-order";
|
|
250
250
|
readonly TieBreak: "tie-break";
|
|
@@ -252,7 +252,7 @@ export declare const JingleErrorCondition: {
|
|
|
252
252
|
readonly UnknownSession: "unknown-session";
|
|
253
253
|
readonly UnsupportedInfo: "unsupported-info";
|
|
254
254
|
};
|
|
255
|
-
export
|
|
255
|
+
export type JingleErrorCondition = typeof JingleErrorCondition[keyof typeof JingleErrorCondition];
|
|
256
256
|
export declare const JingleReasonCondition: {
|
|
257
257
|
readonly AlternativeSession: "alternative-session";
|
|
258
258
|
readonly Busy: "busy";
|
|
@@ -272,7 +272,7 @@ export declare const JingleReasonCondition: {
|
|
|
272
272
|
readonly UnsupportedApplications: "unsupported-applications";
|
|
273
273
|
readonly UnsupportedTransports: "unsupported-transports";
|
|
274
274
|
};
|
|
275
|
-
export
|
|
275
|
+
export type JingleReasonCondition = typeof JingleReasonCondition[keyof typeof JingleReasonCondition];
|
|
276
276
|
export declare const USER_MOODS: string[];
|
|
277
277
|
export declare const USER_ACTIVITY_GENERAL: string[];
|
|
278
278
|
export declare const USER_ACTIVITY_SPECIFIC: string[];
|
package/Constants.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
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
|
+
exports.sendersToDirection = sendersToDirection;
|
|
5
|
+
exports.directionToSenders = directionToSenders;
|
|
4
6
|
const Namespaces_1 = require("./Namespaces");
|
|
5
|
-
exports.VERSION = '12.
|
|
7
|
+
exports.VERSION = '12.21.1';
|
|
6
8
|
// ====================================================================
|
|
7
9
|
// Frequently Used Values
|
|
8
10
|
// ====================================================================
|
|
@@ -464,7 +466,6 @@ function sendersToDirection(role, senders = exports.JingleContentSenders.Both) {
|
|
|
464
466
|
}
|
|
465
467
|
return exports.JingleApplicationDirection.Inactive;
|
|
466
468
|
}
|
|
467
|
-
exports.sendersToDirection = sendersToDirection;
|
|
468
469
|
function directionToSenders(role, direction = exports.JingleApplicationDirection.SendReceive) {
|
|
469
470
|
const isInitiator = role === exports.JingleSessionRole.Initiator;
|
|
470
471
|
switch (direction) {
|
|
@@ -477,4 +478,3 @@ function directionToSenders(role, direction = exports.JingleApplicationDirection
|
|
|
477
478
|
}
|
|
478
479
|
return exports.JingleContentSenders.None;
|
|
479
480
|
}
|
|
480
|
-
exports.directionToSenders = directionToSenders;
|
package/JID.d.ts
CHANGED
package/JID.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
exports.escapeLocal = escapeLocal;
|
|
7
|
+
exports.unescapeLocal = unescapeLocal;
|
|
8
|
+
exports.prepare = prepare;
|
|
9
|
+
exports.create = create;
|
|
10
|
+
exports.createFull = createFull;
|
|
11
|
+
exports.parse = parse;
|
|
12
|
+
exports.allowedResponders = allowedResponders;
|
|
13
|
+
exports.equal = equal;
|
|
14
|
+
exports.equalBare = equalBare;
|
|
15
|
+
exports.isFull = isFull;
|
|
16
|
+
exports.isBare = isBare;
|
|
17
|
+
exports.getLocal = getLocal;
|
|
18
|
+
exports.getDomain = getDomain;
|
|
19
|
+
exports.getResource = getResource;
|
|
20
|
+
exports.toBare = toBare;
|
|
21
|
+
exports.parseURI = parseURI;
|
|
22
|
+
exports.toURI = toURI;
|
|
23
|
+
const punycode_1 = __importDefault(require("punycode"));
|
|
6
24
|
const stringprep_1 = require("./lib/stringprep");
|
|
7
25
|
function escapeLocal(val = '') {
|
|
8
26
|
return val
|
|
@@ -27,7 +45,6 @@ function escapeLocal(val = '') {
|
|
|
27
45
|
.replace(/>/g, '\\3e')
|
|
28
46
|
.replace(/@/g, '\\40');
|
|
29
47
|
}
|
|
30
|
-
exports.escapeLocal = escapeLocal;
|
|
31
48
|
function unescapeLocal(val) {
|
|
32
49
|
return val
|
|
33
50
|
.replace(/\\20/g, ' ')
|
|
@@ -41,7 +58,6 @@ function unescapeLocal(val) {
|
|
|
41
58
|
.replace(/\\40/g, '@')
|
|
42
59
|
.replace(/\\5c/g, '\\');
|
|
43
60
|
}
|
|
44
|
-
exports.unescapeLocal = unescapeLocal;
|
|
45
61
|
function prepare(data) {
|
|
46
62
|
let local = data.local || '';
|
|
47
63
|
let domain = data.domain;
|
|
@@ -62,7 +78,6 @@ function prepare(data) {
|
|
|
62
78
|
resource
|
|
63
79
|
};
|
|
64
80
|
}
|
|
65
|
-
exports.prepare = prepare;
|
|
66
81
|
function create(data, opts = {}) {
|
|
67
82
|
let localPart = data.local;
|
|
68
83
|
if (!opts.escaped) {
|
|
@@ -77,7 +92,6 @@ function create(data, opts = {}) {
|
|
|
77
92
|
}
|
|
78
93
|
return bareJID;
|
|
79
94
|
}
|
|
80
|
-
exports.create = create;
|
|
81
95
|
function createFull(bare, resource) {
|
|
82
96
|
if (resource) {
|
|
83
97
|
return `${toBare(bare)}/${resource}`;
|
|
@@ -86,7 +100,6 @@ function createFull(bare, resource) {
|
|
|
86
100
|
return toBare(bare);
|
|
87
101
|
}
|
|
88
102
|
}
|
|
89
|
-
exports.createFull = createFull;
|
|
90
103
|
function parse(jid = '') {
|
|
91
104
|
let local = '';
|
|
92
105
|
let domain = '';
|
|
@@ -121,7 +134,6 @@ function parse(jid = '') {
|
|
|
121
134
|
resource: prepped.resource
|
|
122
135
|
};
|
|
123
136
|
}
|
|
124
|
-
exports.parse = parse;
|
|
125
137
|
function allowedResponders(jid1, jid2) {
|
|
126
138
|
const allowed = new Set();
|
|
127
139
|
allowed.add(undefined);
|
|
@@ -140,7 +152,6 @@ function allowedResponders(jid1, jid2) {
|
|
|
140
152
|
}
|
|
141
153
|
return allowed;
|
|
142
154
|
}
|
|
143
|
-
exports.allowedResponders = allowedResponders;
|
|
144
155
|
function equal(jid1, jid2) {
|
|
145
156
|
if (!jid1 || !jid2) {
|
|
146
157
|
return false;
|
|
@@ -151,7 +162,6 @@ function equal(jid1, jid2) {
|
|
|
151
162
|
parsed1.domain === parsed2.domain &&
|
|
152
163
|
parsed1.resource === parsed2.resource);
|
|
153
164
|
}
|
|
154
|
-
exports.equal = equal;
|
|
155
165
|
function equalBare(jid1, jid2) {
|
|
156
166
|
if (!jid1 || !jid2) {
|
|
157
167
|
return false;
|
|
@@ -160,32 +170,25 @@ function equalBare(jid1, jid2) {
|
|
|
160
170
|
const parsed2 = parse(jid2);
|
|
161
171
|
return parsed1.local === parsed2.local && parsed1.domain === parsed2.domain;
|
|
162
172
|
}
|
|
163
|
-
exports.equalBare = equalBare;
|
|
164
173
|
function isFull(jid) {
|
|
165
174
|
const parsed = parse(jid);
|
|
166
175
|
return !!parsed.resource;
|
|
167
176
|
}
|
|
168
|
-
exports.isFull = isFull;
|
|
169
177
|
function isBare(jid) {
|
|
170
178
|
return !isFull(jid);
|
|
171
179
|
}
|
|
172
|
-
exports.isBare = isBare;
|
|
173
180
|
function getLocal(jid = '') {
|
|
174
181
|
return parse(jid).local;
|
|
175
182
|
}
|
|
176
|
-
exports.getLocal = getLocal;
|
|
177
183
|
function getDomain(jid = '') {
|
|
178
184
|
return parse(jid).domain;
|
|
179
185
|
}
|
|
180
|
-
exports.getDomain = getDomain;
|
|
181
186
|
function getResource(jid = '') {
|
|
182
187
|
return parse(jid).resource;
|
|
183
188
|
}
|
|
184
|
-
exports.getResource = getResource;
|
|
185
189
|
function toBare(jid = '') {
|
|
186
190
|
return parse(jid).bare;
|
|
187
191
|
}
|
|
188
|
-
exports.toBare = toBare;
|
|
189
192
|
function parseURI(val) {
|
|
190
193
|
const parsed = new URL(val);
|
|
191
194
|
if (parsed.protocol !== 'xmpp:') {
|
|
@@ -233,7 +236,6 @@ function parseURI(val) {
|
|
|
233
236
|
parameters: params
|
|
234
237
|
};
|
|
235
238
|
}
|
|
236
|
-
exports.parseURI = parseURI;
|
|
237
239
|
function toURI(data) {
|
|
238
240
|
const parts = ['xmpp:'];
|
|
239
241
|
const pushJID = (jid, allowResource) => {
|
|
@@ -274,4 +276,3 @@ function toURI(data) {
|
|
|
274
276
|
}
|
|
275
277
|
return parts.join('');
|
|
276
278
|
}
|
|
277
|
-
exports.toURI = toURI;
|
package/Utils.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Derived from:
|
|
7
7
|
* - uuid, Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
import { Buffer } from './platform';
|
|
10
10
|
export declare function timeoutPromise<T>(target: Promise<T>, delay: number, rejectValue?: () => any): Promise<T>;
|
|
11
11
|
export declare function promiseAny<T>(promises: Array<Promise<T>>): Promise<T>;
|
|
12
12
|
export declare function shuffle<T>(array: T[]): T[];
|
package/Utils.js
CHANGED
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
* - uuid, Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.
|
|
11
|
+
exports.timeoutPromise = timeoutPromise;
|
|
12
|
+
exports.promiseAny = promiseAny;
|
|
13
|
+
exports.shuffle = shuffle;
|
|
14
|
+
exports.sleep = sleep;
|
|
15
|
+
exports.octetCompare = octetCompare;
|
|
16
|
+
exports.uuid = uuid;
|
|
17
|
+
exports.reviveData = reviveData;
|
|
12
18
|
// tslint:disable no-bitwise
|
|
13
19
|
const platform_1 = require("./platform");
|
|
14
20
|
const bth = [];
|
|
@@ -26,7 +32,6 @@ async function timeoutPromise(target, delay, rejectValue = () => undefined) {
|
|
|
26
32
|
clearTimeout(timeoutRef);
|
|
27
33
|
return result;
|
|
28
34
|
}
|
|
29
|
-
exports.timeoutPromise = timeoutPromise;
|
|
30
35
|
async function promiseAny(promises) {
|
|
31
36
|
try {
|
|
32
37
|
const errors = await Promise.all(promises.map(p => {
|
|
@@ -38,7 +43,6 @@ async function promiseAny(promises) {
|
|
|
38
43
|
return Promise.resolve(val);
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
|
-
exports.promiseAny = promiseAny;
|
|
42
46
|
function shuffle(array) {
|
|
43
47
|
let end = array.length;
|
|
44
48
|
while (end > 0) {
|
|
@@ -50,19 +54,16 @@ function shuffle(array) {
|
|
|
50
54
|
}
|
|
51
55
|
return array;
|
|
52
56
|
}
|
|
53
|
-
exports.shuffle = shuffle;
|
|
54
57
|
async function sleep(time) {
|
|
55
58
|
return new Promise(resolve => {
|
|
56
59
|
setTimeout(() => resolve(), time);
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
|
-
exports.sleep = sleep;
|
|
60
62
|
function octetCompare(str1, str2) {
|
|
61
63
|
const b1 = typeof str1 === 'string' ? platform_1.Buffer.from(str1, 'utf8') : str1;
|
|
62
64
|
const b2 = typeof str2 === 'string' ? platform_1.Buffer.from(str2, 'utf8') : str2;
|
|
63
65
|
return b1.compare(b2);
|
|
64
66
|
}
|
|
65
|
-
exports.octetCompare = octetCompare;
|
|
66
67
|
function uuid() {
|
|
67
68
|
const buf = (0, platform_1.randomBytes)(16);
|
|
68
69
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
@@ -92,7 +93,6 @@ function uuid() {
|
|
|
92
93
|
bth[buf[i]]
|
|
93
94
|
].join('');
|
|
94
95
|
}
|
|
95
|
-
exports.uuid = uuid;
|
|
96
96
|
const DATE_FIELDS = new Set([
|
|
97
97
|
'date',
|
|
98
98
|
'expires',
|
|
@@ -118,4 +118,3 @@ function reviveData(key, value) {
|
|
|
118
118
|
}
|
|
119
119
|
return value;
|
|
120
120
|
}
|
|
121
|
-
exports.reviveData = reviveData;
|
package/helpers/DataForms.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeFields =
|
|
3
|
+
exports.mergeFields = mergeFields;
|
|
4
4
|
function mergeFields(original, updated) {
|
|
5
5
|
const merged = [];
|
|
6
6
|
const mappedUpdates = new Map();
|
|
@@ -31,4 +31,3 @@ function mergeFields(original, updated) {
|
|
|
31
31
|
}
|
|
32
32
|
return merged;
|
|
33
33
|
}
|
|
34
|
-
exports.mergeFields = mergeFields;
|
package/helpers/DiscoManager.js
CHANGED
|
@@ -1,10 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const EntityCaps = (0, tslib_1.__importStar)(require("./LegacyEntityCapabilities"));
|
|
36
|
+
const EntityCaps = __importStar(require("./LegacyEntityCapabilities"));
|
|
5
37
|
class Disco {
|
|
38
|
+
features;
|
|
39
|
+
identities;
|
|
40
|
+
extensions;
|
|
41
|
+
items;
|
|
42
|
+
caps;
|
|
43
|
+
capsAlgorithms = ['sha-1'];
|
|
6
44
|
constructor() {
|
|
7
|
-
this.capsAlgorithms = ['sha-1'];
|
|
8
45
|
this.features = new Map();
|
|
9
46
|
this.identities = new Map();
|
|
10
47
|
this.extensions = new Map();
|