@sockethub/platform-xmpp 5.0.0-alpha.12 → 5.0.0-alpha.13
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/README.md +242 -48
- package/dist/incoming-handlers.d.ts +25 -0
- package/dist/index.d.ts +168 -0
- package/dist/index.js +26692 -26563
- package/dist/index.js.map +130 -131
- package/dist/schema.d.ts +2 -0
- package/dist/types.d.ts +33 -0
- package/dist/utils.d.ts +19 -0
- package/package.json +14 -11
- package/src/incoming-handlers.js +0 -355
- package/src/incoming-handlers.test.data.js +0 -312
- package/src/incoming-handlers.test.js +0 -115
- package/src/index.js +0 -774
- package/src/index.test.js +0 -635
- package/src/schema.js +0 -64
- package/src/utils.js +0 -21
- package/src/utils.test.js +0 -58
package/src/utils.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const utils = {
|
|
2
|
-
buildXmppCredentials: (credentials) => {
|
|
3
|
-
const [username, server] = credentials.object.userAddress.split("@");
|
|
4
|
-
const xmpp_creds = {
|
|
5
|
-
service: credentials.object.server
|
|
6
|
-
? credentials.object.server
|
|
7
|
-
: server
|
|
8
|
-
? server
|
|
9
|
-
: undefined,
|
|
10
|
-
username: username,
|
|
11
|
-
password: credentials.object.password,
|
|
12
|
-
};
|
|
13
|
-
if (credentials.object.port) {
|
|
14
|
-
xmpp_creds.service = `${xmpp_creds.service}:${credentials.object.port}`;
|
|
15
|
-
}
|
|
16
|
-
if (credentials.object.resource) {
|
|
17
|
-
xmpp_creds.resource = credentials.object.resource;
|
|
18
|
-
}
|
|
19
|
-
return xmpp_creds;
|
|
20
|
-
},
|
|
21
|
-
};
|
package/src/utils.test.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "bun:test";
|
|
2
|
-
|
|
3
|
-
import { utils } from "./utils.js";
|
|
4
|
-
|
|
5
|
-
describe("Utils", () => {
|
|
6
|
-
describe("buildXmppCredentials", () => {
|
|
7
|
-
it("returns correct credential object used for xmpp.js connect", () => {
|
|
8
|
-
expect(
|
|
9
|
-
utils.buildXmppCredentials({
|
|
10
|
-
object: {
|
|
11
|
-
userAddress: "barney@dinosaur.com.au",
|
|
12
|
-
password: "bar",
|
|
13
|
-
resource: "Home",
|
|
14
|
-
},
|
|
15
|
-
}),
|
|
16
|
-
).toEqual({
|
|
17
|
-
password: "bar",
|
|
18
|
-
service: "dinosaur.com.au",
|
|
19
|
-
username: "barney",
|
|
20
|
-
resource: "Home",
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
it("allows overriding server value", () => {
|
|
25
|
-
expect(
|
|
26
|
-
utils.buildXmppCredentials({
|
|
27
|
-
object: {
|
|
28
|
-
userAddress: "barney@dinosaur.com.au",
|
|
29
|
-
server: "foo",
|
|
30
|
-
password: "bar",
|
|
31
|
-
resource: "Home",
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
).toEqual({
|
|
35
|
-
password: "bar",
|
|
36
|
-
service: "foo",
|
|
37
|
-
username: "barney",
|
|
38
|
-
resource: "Home",
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it("allows a custom port", () => {
|
|
42
|
-
expect(
|
|
43
|
-
utils.buildXmppCredentials({
|
|
44
|
-
object: {
|
|
45
|
-
userAddress: "barney@dinosaur.com.au",
|
|
46
|
-
port: 123,
|
|
47
|
-
password: "bar",
|
|
48
|
-
resource: "Home",
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
|
-
).toEqual({
|
|
52
|
-
password: "bar",
|
|
53
|
-
service: "dinosaur.com.au:123",
|
|
54
|
-
username: "barney",
|
|
55
|
-
resource: "Home",
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|