@sandvichxyz/teamtype-wasm 0.9.2-dev → 0.9.2-dev.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/package.json +4 -1
- package/teamtype_wasm.d.ts +5 -36
- package/teamtype_wasm.js +16 -7
- package/teamtype_wasm_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"HumanoidSandvichDispenser <humanoidsandvichdispenser@gmail.com>"
|
|
9
9
|
],
|
|
10
10
|
"description": "Browser/wasm peer for Teamtype, exposing the sync core over a JavaScript API.",
|
|
11
|
-
"version": "0.9.2-dev",
|
|
11
|
+
"version": "0.9.2-dev.1",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
12
15
|
"license": "AGPL-3.0-or-later",
|
|
13
16
|
"files": [
|
|
14
17
|
"teamtype_wasm_bg.wasm",
|
package/teamtype_wasm.d.ts
CHANGED
|
@@ -7,42 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export type ReadableStreamType = "bytes";
|
|
10
|
-
/**
|
|
11
|
-
* Info about our own node, surfaced to JS via `nodeInfo()`.
|
|
12
|
-
*/
|
|
13
|
-
export interface NodeInfo {
|
|
14
|
-
node_id: string;
|
|
15
|
-
passphrase: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface CursorState {
|
|
19
|
-
name: string | undefined;
|
|
20
|
-
file_path: string;
|
|
21
|
-
ranges: Range[];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface EphemeralMessage {
|
|
25
|
-
cursor_id: string;
|
|
26
|
-
sequence_number: number;
|
|
27
|
-
cursor_state: CursorState;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface Position {
|
|
31
|
-
line: number;
|
|
32
|
-
character: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface Range {
|
|
36
|
-
start: Position;
|
|
37
|
-
end: Position;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type DisconnectReason = { kind: "PeerDisconnected" } | { kind: "ReceiveError"; error: string } | { kind: "HandlerError"; error: string };
|
|
41
|
-
|
|
42
|
-
export type WireDelta = WireOp[];
|
|
43
|
-
|
|
44
|
-
export type WireOp = { Retain: number } | { Insert: string } | { Delete: number };
|
|
45
|
-
|
|
46
10
|
|
|
47
11
|
export class IntoUnderlyingByteSource {
|
|
48
12
|
private constructor();
|
|
@@ -83,6 +47,10 @@ export class TeamtypeClient {
|
|
|
83
47
|
* Apply an edit to a file.
|
|
84
48
|
*/
|
|
85
49
|
applyEdit(file_name: string, delta: any): void;
|
|
50
|
+
/**
|
|
51
|
+
* Connect to a peer using a secret address (`<node_id>#<passphrase>`).
|
|
52
|
+
*/
|
|
53
|
+
connectByAddress(address: string): void;
|
|
86
54
|
/**
|
|
87
55
|
* Connect to a peer using a wormhole join code.
|
|
88
56
|
*/
|
|
@@ -148,6 +116,7 @@ export interface InitOutput {
|
|
|
148
116
|
readonly memory: WebAssembly.Memory;
|
|
149
117
|
readonly __wbg_teamtypeclient_free: (a: number, b: number) => void;
|
|
150
118
|
readonly teamtypeclient_applyEdit: (a: number, b: number, c: number, d: any) => void;
|
|
119
|
+
readonly teamtypeclient_connectByAddress: (a: number, b: number, c: number) => void;
|
|
151
120
|
readonly teamtypeclient_connectByJoinCode: (a: number, b: number, c: number) => void;
|
|
152
121
|
readonly teamtypeclient_new: () => number;
|
|
153
122
|
readonly teamtypeclient_nodeInfo: (a: number) => any;
|
package/teamtype_wasm.js
CHANGED
|
@@ -136,6 +136,15 @@ export class TeamtypeClient {
|
|
|
136
136
|
const len0 = WASM_VECTOR_LEN;
|
|
137
137
|
wasm.teamtypeclient_applyEdit(this.__wbg_ptr, ptr0, len0, delta);
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Connect to a peer using a secret address (`<node_id>#<passphrase>`).
|
|
141
|
+
* @param {string} address
|
|
142
|
+
*/
|
|
143
|
+
connectByAddress(address) {
|
|
144
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
145
|
+
const len0 = WASM_VECTOR_LEN;
|
|
146
|
+
wasm.teamtypeclient_connectByAddress(this.__wbg_ptr, ptr0, len0);
|
|
147
|
+
}
|
|
139
148
|
/**
|
|
140
149
|
* Connect to a peer using a wormhole join code.
|
|
141
150
|
* @param {string} join_code
|
|
@@ -854,37 +863,37 @@ function __wbg_get_imports() {
|
|
|
854
863
|
return ret;
|
|
855
864
|
},
|
|
856
865
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
857
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
866
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2259, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
858
867
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___wasm_bindgen_a1427d1cfc54b76a___JsValue______true_);
|
|
859
868
|
return ret;
|
|
860
869
|
},
|
|
861
870
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
862
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
871
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 4395, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
863
872
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___wasm_bindgen_a1427d1cfc54b76a___JsValue__core_c09542a5c46f04b6___result__Result_____wasm_bindgen_a1427d1cfc54b76a___JsError___true_);
|
|
864
873
|
return ret;
|
|
865
874
|
},
|
|
866
875
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
867
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
876
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1890, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
868
877
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___web_sys_9299a82c88baa8d___features__gen_CloseEvent__CloseEvent______true_);
|
|
869
878
|
return ret;
|
|
870
879
|
},
|
|
871
880
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
872
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
881
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 3372, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
873
882
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___web_sys_9299a82c88baa8d___features__gen_MessageEvent__MessageEvent______true_);
|
|
874
883
|
return ret;
|
|
875
884
|
},
|
|
876
885
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
877
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
886
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2009, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
878
887
|
const ret = makeClosure(arg0, arg1, wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke_______true_);
|
|
879
888
|
return ret;
|
|
880
889
|
},
|
|
881
890
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
882
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
891
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2226, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
883
892
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke_______true__1_);
|
|
884
893
|
return ret;
|
|
885
894
|
},
|
|
886
895
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
887
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
896
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
888
897
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke_______true__2_);
|
|
889
898
|
return ret;
|
|
890
899
|
},
|
package/teamtype_wasm_bg.wasm
CHANGED
|
Binary file
|