@automerge/automerge-repo-network-messagechannel 0.2.1 → 1.0.0-alpha.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/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -8
- package/package.json +6 -3
- package/src/index.ts +7 -10
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export declare class MessageChannelNetworkAdapter extends NetworkAdapter {
|
|
|
6
6
|
constructor(messagePort: MessagePort, config?: MessageChannelNetworkAdapterConfig);
|
|
7
7
|
connect(peerId: PeerId): void;
|
|
8
8
|
sendMessage(peerId: PeerId, channelId: ChannelId, uint8message: Uint8Array, broadcast: boolean): void;
|
|
9
|
-
announceConnection(
|
|
10
|
-
join(
|
|
11
|
-
leave(
|
|
9
|
+
announceConnection(peerId: PeerId): void;
|
|
10
|
+
join(): void;
|
|
11
|
+
leave(): void;
|
|
12
12
|
}
|
|
13
13
|
interface MessageChannelNetworkAdapterConfig {
|
|
14
14
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAOpD,qBAAa,4BAA6B,SAAQ,cAAc;IAC9D,QAAQ,KAAK;IACb,cAAc,EAAE,cAAc,CAAA;gBAG5B,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,kCAAuC;IAWjD,OAAO,CAAC,MAAM,EAAE,MAAM;IA4CtB,WAAW,CACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,UAAU,EACxB,SAAS,EAAE,OAAO;IAmBpB,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAOpD,qBAAa,4BAA6B,SAAQ,cAAc;IAC9D,QAAQ,KAAK;IACb,cAAc,EAAE,cAAc,CAAA;gBAG5B,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,kCAAuC;IAWjD,OAAO,CAAC,MAAM,EAAE,MAAM;IA4CtB,WAAW,CACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,UAAU,EACxB,SAAS,EAAE,OAAO;IAmBpB,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAIjC,IAAI;IAOJ,KAAK;CAIN;AAED,UAAU,kCAAkC;IAC1C;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB"}
|
package/dist/index.js
CHANGED
|
@@ -30,10 +30,10 @@ export class MessageChannelNetworkAdapter extends NetworkAdapter {
|
|
|
30
30
|
destination: origin,
|
|
31
31
|
type: "welcome",
|
|
32
32
|
});
|
|
33
|
-
this.announceConnection(
|
|
33
|
+
this.announceConnection(origin);
|
|
34
34
|
break;
|
|
35
35
|
case "welcome":
|
|
36
|
-
this.announceConnection(
|
|
36
|
+
this.announceConnection(origin);
|
|
37
37
|
break;
|
|
38
38
|
case "message":
|
|
39
39
|
this.emit("message", {
|
|
@@ -63,18 +63,17 @@ export class MessageChannelNetworkAdapter extends NetworkAdapter {
|
|
|
63
63
|
broadcast,
|
|
64
64
|
}, [message]);
|
|
65
65
|
}
|
|
66
|
-
announceConnection(
|
|
67
|
-
this.emit("peer-candidate", { peerId
|
|
66
|
+
announceConnection(peerId) {
|
|
67
|
+
this.emit("peer-candidate", { peerId });
|
|
68
68
|
}
|
|
69
|
-
join(
|
|
69
|
+
join() {
|
|
70
70
|
this.messagePortRef.postMessage({
|
|
71
71
|
origin: this.peerId,
|
|
72
|
-
channelId,
|
|
73
72
|
type: "arrive",
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
leave(
|
|
75
|
+
leave() {
|
|
77
76
|
// TODO
|
|
78
|
-
throw new Error("Unimplemented: leave on MessagePortNetworkAdapter
|
|
77
|
+
throw new Error("Unimplemented: leave on MessagePortNetworkAdapter");
|
|
79
78
|
}
|
|
80
79
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automerge/automerge-repo-network-messagechannel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "MessageChannel network adapter for Automerge Repo",
|
|
5
5
|
"repository": "https://github.com/automerge/automerge-repo",
|
|
6
6
|
"author": "Peter van Hardenberg <pvh@pvh.ca>",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"test": "mocha --no-warnings --experimental-specifier-resolution=node --exit"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@automerge/automerge-repo": "^0.
|
|
17
|
+
"@automerge/automerge-repo": "^1.0.0-alpha.0"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@automerge/automerge": "^2.1.0-alpha.9"
|
|
18
21
|
},
|
|
19
22
|
"watch": {
|
|
20
23
|
"build": {
|
|
@@ -27,5 +30,5 @@
|
|
|
27
30
|
"publishConfig": {
|
|
28
31
|
"access": "public"
|
|
29
32
|
},
|
|
30
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "38c0c32796ddca5f86a2e55ab0f1202a2ce107c8"
|
|
31
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -43,10 +43,10 @@ export class MessageChannelNetworkAdapter extends NetworkAdapter {
|
|
|
43
43
|
destination: origin,
|
|
44
44
|
type: "welcome",
|
|
45
45
|
})
|
|
46
|
-
this.announceConnection(
|
|
46
|
+
this.announceConnection(origin)
|
|
47
47
|
break
|
|
48
48
|
case "welcome":
|
|
49
|
-
this.announceConnection(
|
|
49
|
+
this.announceConnection(origin)
|
|
50
50
|
break
|
|
51
51
|
case "message":
|
|
52
52
|
this.emit("message", {
|
|
@@ -90,23 +90,20 @@ export class MessageChannelNetworkAdapter extends NetworkAdapter {
|
|
|
90
90
|
)
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
announceConnection(
|
|
94
|
-
this.emit("peer-candidate", { peerId
|
|
93
|
+
announceConnection(peerId: PeerId) {
|
|
94
|
+
this.emit("peer-candidate", { peerId })
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
join(
|
|
97
|
+
join() {
|
|
98
98
|
this.messagePortRef.postMessage({
|
|
99
99
|
origin: this.peerId,
|
|
100
|
-
channelId,
|
|
101
100
|
type: "arrive",
|
|
102
101
|
})
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
leave(
|
|
104
|
+
leave() {
|
|
106
105
|
// TODO
|
|
107
|
-
throw new Error(
|
|
108
|
-
"Unimplemented: leave on MessagePortNetworkAdapter: " + docId
|
|
109
|
-
)
|
|
106
|
+
throw new Error("Unimplemented: leave on MessagePortNetworkAdapter")
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
|