attodo-sync 0.0.0-stage → 0.1.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/README.md +84 -2
- package/node/attodo_sync.d.ts +291 -0
- package/node/attodo_sync.js +1055 -0
- package/node/attodo_sync_bg.wasm +0 -0
- package/node/package.json +1 -0
- package/package.json +55 -4
- package/web/attodo_sync.d.ts +368 -0
- package/web/attodo_sync.js +1159 -0
- package/web/attodo_sync_bg.wasm +0 -0
- package/web/index.d.ts +1 -0
- package/web/index.js +5 -0
- package/web/package.json +1 -0
|
@@ -0,0 +1,1055 @@
|
|
|
1
|
+
/* @ts-self-types="./attodo_sync.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One device's replica of the user's spaces.
|
|
5
|
+
*/
|
|
6
|
+
class Device {
|
|
7
|
+
static __wrap(ptr) {
|
|
8
|
+
const obj = Object.create(Device.prototype);
|
|
9
|
+
obj.__wbg_ptr = ptr;
|
|
10
|
+
DeviceFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
__destroy_into_raw() {
|
|
14
|
+
const ptr = this.__wbg_ptr;
|
|
15
|
+
this.__wbg_ptr = 0;
|
|
16
|
+
DeviceFinalization.unregister(this);
|
|
17
|
+
return ptr;
|
|
18
|
+
}
|
|
19
|
+
free() {
|
|
20
|
+
const ptr = this.__destroy_into_raw();
|
|
21
|
+
wasm.__wbg_device_free(ptr, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Starts syncing a space; nothing if it's already synced.
|
|
25
|
+
* @param {string} space
|
|
26
|
+
* @param {SpaceKind} kind
|
|
27
|
+
*/
|
|
28
|
+
addSpace(space, kind) {
|
|
29
|
+
let ptr0, len0, ptr1, len1;
|
|
30
|
+
try {
|
|
31
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
32
|
+
len0 = WASM_VECTOR_LEN;
|
|
33
|
+
ptr1 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
34
|
+
len1 = WASM_VECTOR_LEN;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
37
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
38
|
+
throw e;
|
|
39
|
+
}
|
|
40
|
+
const ret = wasm.device_addSpace(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
41
|
+
if (ret[1]) {
|
|
42
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Adds a to-do, with a fresh id from this device's clock.
|
|
47
|
+
* @param {string} space
|
|
48
|
+
* @param {string} title
|
|
49
|
+
* @param {When} when
|
|
50
|
+
* @param {string} today
|
|
51
|
+
* @param {number} nowMicros
|
|
52
|
+
* @returns {ObjectRef}
|
|
53
|
+
*/
|
|
54
|
+
addTodo(space, title, when, today, nowMicros) {
|
|
55
|
+
const val5 = +nowMicros;
|
|
56
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
57
|
+
try {
|
|
58
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
59
|
+
len0 = WASM_VECTOR_LEN;
|
|
60
|
+
ptr1 = passStringToWasm0(title, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
61
|
+
len1 = WASM_VECTOR_LEN;
|
|
62
|
+
ptr2 = passStringToWasm0(when, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
63
|
+
len2 = WASM_VECTOR_LEN;
|
|
64
|
+
ptr3 = passStringToWasm0(today, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
65
|
+
len3 = WASM_VECTOR_LEN;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
68
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
69
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
70
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
const ret = wasm.device_addTodo(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, val5);
|
|
74
|
+
if (ret[2]) {
|
|
75
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
76
|
+
}
|
|
77
|
+
return takeFromExternrefTable0(ret[0]);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
get clockId() {
|
|
83
|
+
const ret = wasm.device_clockId(this.__wbg_ptr);
|
|
84
|
+
if (ret[2]) {
|
|
85
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
86
|
+
}
|
|
87
|
+
return ret[0];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Deletes for good: every app stops showing it.
|
|
91
|
+
* @param {ObjectRef} object
|
|
92
|
+
* @param {number} nowMicros
|
|
93
|
+
*/
|
|
94
|
+
deleteForever(object, nowMicros) {
|
|
95
|
+
const ret = wasm.device_deleteForever(this.__wbg_ptr, object, nowMicros);
|
|
96
|
+
if (ret[1]) {
|
|
97
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A device `toJson` saved. Throws on anything that doesn't read back
|
|
102
|
+
* exactly, rather than half-loading it.
|
|
103
|
+
* @param {DeviceJson} saved
|
|
104
|
+
* @returns {Device}
|
|
105
|
+
*/
|
|
106
|
+
static fromJson(saved) {
|
|
107
|
+
const ret = wasm.device_fromJson(saved);
|
|
108
|
+
if (ret[2]) {
|
|
109
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
110
|
+
}
|
|
111
|
+
return Device.__wrap(ret[0]);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The lists (SPEC §6) on `today` (`YYYY-MM-DD`, the user's local date).
|
|
115
|
+
* @param {string} today
|
|
116
|
+
* @returns {Lists}
|
|
117
|
+
*/
|
|
118
|
+
lists(today) {
|
|
119
|
+
const ptr0 = passStringToWasm0(today, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
120
|
+
const len0 = WASM_VECTOR_LEN;
|
|
121
|
+
const ret = wasm.device_lists(this.__wbg_ptr, ptr0, len0);
|
|
122
|
+
if (ret[2]) {
|
|
123
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
124
|
+
}
|
|
125
|
+
return takeFromExternrefTable0(ret[0]);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The account's DID.
|
|
129
|
+
* @returns {string}
|
|
130
|
+
*/
|
|
131
|
+
get me() {
|
|
132
|
+
let deferred2_0;
|
|
133
|
+
let deferred2_1;
|
|
134
|
+
try {
|
|
135
|
+
const ret = wasm.device_me(this.__wbg_ptr);
|
|
136
|
+
var ptr1 = ret[0];
|
|
137
|
+
var len1 = ret[1];
|
|
138
|
+
if (ret[3]) {
|
|
139
|
+
ptr1 = 0; len1 = 0;
|
|
140
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
141
|
+
}
|
|
142
|
+
deferred2_0 = ptr1;
|
|
143
|
+
deferred2_1 = len1;
|
|
144
|
+
return getStringFromWasm0(ptr1, len1);
|
|
145
|
+
} finally {
|
|
146
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A new device for the account `me`. `clockId` (0–1023) is this
|
|
151
|
+
* install's TID clock id, chosen at random once; `seed` seeds the
|
|
152
|
+
* jitter of its retries.
|
|
153
|
+
* @param {string} me
|
|
154
|
+
* @param {number} clockId
|
|
155
|
+
* @param {bigint} seed
|
|
156
|
+
*/
|
|
157
|
+
constructor(me, clockId, seed) {
|
|
158
|
+
const val2 = +clockId;
|
|
159
|
+
const val3 = BigInt.asIntN(64, seed);
|
|
160
|
+
const ptr0 = passStringToWasm0(me, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
161
|
+
const len0 = WASM_VECTOR_LEN;
|
|
162
|
+
const ret = wasm.device_new(ptr0, len0, val2, val3);
|
|
163
|
+
if (ret[2]) {
|
|
164
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
165
|
+
}
|
|
166
|
+
this.__wbg_ptr = ret[0];
|
|
167
|
+
DeviceFinalization.register(this, this.__wbg_ptr, this);
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* How many of the user's records have changes not yet on the hosts.
|
|
172
|
+
* @returns {number}
|
|
173
|
+
*/
|
|
174
|
+
pending() {
|
|
175
|
+
const ret = wasm.device_pending(this.__wbg_ptr);
|
|
176
|
+
if (ret[2]) {
|
|
177
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
178
|
+
}
|
|
179
|
+
return ret[0] >>> 0;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* @returns {string | undefined}
|
|
183
|
+
*/
|
|
184
|
+
personalSpace() {
|
|
185
|
+
const ret = wasm.device_personalSpace(this.__wbg_ptr);
|
|
186
|
+
if (ret[3]) {
|
|
187
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
188
|
+
}
|
|
189
|
+
let v1;
|
|
190
|
+
if (ret[0] !== 0) {
|
|
191
|
+
v1 = getStringFromWasm0(ret[0], ret[1]);
|
|
192
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
193
|
+
}
|
|
194
|
+
return v1;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* What a list shows for each of `listed`.
|
|
198
|
+
* @param {Listed[]} listed
|
|
199
|
+
* @param {string} today
|
|
200
|
+
* @returns {Row[]}
|
|
201
|
+
*/
|
|
202
|
+
rows(listed, today) {
|
|
203
|
+
const ptr0 = passStringToWasm0(today, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
205
|
+
const ret = wasm.device_rows(this.__wbg_ptr, listed, ptr0, len0);
|
|
206
|
+
if (ret[2]) {
|
|
207
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
208
|
+
}
|
|
209
|
+
return takeFromExternrefTable0(ret[0]);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* When to do something: its own schedule in the personal space; in a
|
|
213
|
+
* shared list, the user's plan for it, which the others don't see.
|
|
214
|
+
* @param {ObjectRef} object
|
|
215
|
+
* @param {When} when
|
|
216
|
+
* @param {string} today
|
|
217
|
+
* @param {number} nowMicros
|
|
218
|
+
*/
|
|
219
|
+
schedule(object, when, today, nowMicros) {
|
|
220
|
+
const val3 = +nowMicros;
|
|
221
|
+
let ptr0, len0, ptr1, len1;
|
|
222
|
+
try {
|
|
223
|
+
ptr0 = passStringToWasm0(when, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
224
|
+
len0 = WASM_VECTOR_LEN;
|
|
225
|
+
ptr1 = passStringToWasm0(today, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
226
|
+
len1 = WASM_VECTOR_LEN;
|
|
227
|
+
} catch (e) {
|
|
228
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
229
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
230
|
+
throw e;
|
|
231
|
+
}
|
|
232
|
+
const ret = wasm.device_schedule(this.__wbg_ptr, object, ptr0, len0, ptr1, len1, val3);
|
|
233
|
+
if (ret[1]) {
|
|
234
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Sets the notes; empty notes clear them.
|
|
239
|
+
* @param {ObjectRef} object
|
|
240
|
+
* @param {string} notes
|
|
241
|
+
* @param {number} nowMicros
|
|
242
|
+
*/
|
|
243
|
+
setNotes(object, notes, nowMicros) {
|
|
244
|
+
const val2 = +nowMicros;
|
|
245
|
+
const ptr0 = passStringToWasm0(notes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
246
|
+
const len0 = WASM_VECTOR_LEN;
|
|
247
|
+
const ret = wasm.device_setNotes(this.__wbg_ptr, object, ptr0, len0, val2);
|
|
248
|
+
if (ret[1]) {
|
|
249
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @param {ObjectRef} object
|
|
254
|
+
* @param {string} title
|
|
255
|
+
* @param {number} nowMicros
|
|
256
|
+
*/
|
|
257
|
+
setTitle(object, title, nowMicros) {
|
|
258
|
+
const val2 = +nowMicros;
|
|
259
|
+
const ptr0 = passStringToWasm0(title, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
260
|
+
const len0 = WASM_VECTOR_LEN;
|
|
261
|
+
const ret = wasm.device_setTitle(this.__wbg_ptr, object, ptr0, len0, val2);
|
|
262
|
+
if (ret[1]) {
|
|
263
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Every active to-do and project of one space, projects first, each in
|
|
268
|
+
* its order: a shared list's own list.
|
|
269
|
+
* @param {string} space
|
|
270
|
+
* @returns {Listed[]}
|
|
271
|
+
*/
|
|
272
|
+
spaceList(space) {
|
|
273
|
+
const ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
274
|
+
const len0 = WASM_VECTOR_LEN;
|
|
275
|
+
const ret = wasm.device_spaceList(this.__wbg_ptr, ptr0, len0);
|
|
276
|
+
if (ret[2]) {
|
|
277
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
278
|
+
}
|
|
279
|
+
return takeFromExternrefTable0(ret[0]);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* "Personal", a shared list's title, or else its key.
|
|
283
|
+
* @param {string} space
|
|
284
|
+
* @returns {string}
|
|
285
|
+
*/
|
|
286
|
+
spaceTitle(space) {
|
|
287
|
+
let deferred3_0;
|
|
288
|
+
let deferred3_1;
|
|
289
|
+
try {
|
|
290
|
+
const ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
291
|
+
const len0 = WASM_VECTOR_LEN;
|
|
292
|
+
const ret = wasm.device_spaceTitle(this.__wbg_ptr, ptr0, len0);
|
|
293
|
+
var ptr2 = ret[0];
|
|
294
|
+
var len2 = ret[1];
|
|
295
|
+
if (ret[3]) {
|
|
296
|
+
ptr2 = 0; len2 = 0;
|
|
297
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
298
|
+
}
|
|
299
|
+
deferred3_0 = ptr2;
|
|
300
|
+
deferred3_1 = len2;
|
|
301
|
+
return getStringFromWasm0(ptr2, len2);
|
|
302
|
+
} finally {
|
|
303
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Every space this device syncs.
|
|
308
|
+
* @returns {SpaceInfo[]}
|
|
309
|
+
*/
|
|
310
|
+
spaces() {
|
|
311
|
+
const ret = wasm.device_spaces(this.__wbg_ptr);
|
|
312
|
+
if (ret[2]) {
|
|
313
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
314
|
+
}
|
|
315
|
+
return takeFromExternrefTable0(ret[0]);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Syncs one space: pulls every writer, then sends the user's changes.
|
|
319
|
+
* Rejects with a `SyncFailure` only if the space couldn't be synced at
|
|
320
|
+
* all; problems with single repos or writes are in the report. Edits
|
|
321
|
+
* made meanwhile apply at once and are kept.
|
|
322
|
+
* @param {Transport} transport
|
|
323
|
+
* @param {string} space
|
|
324
|
+
* @param {number} nowMicros
|
|
325
|
+
* @returns {Promise<SyncReport>}
|
|
326
|
+
*/
|
|
327
|
+
syncSpace(transport, space, nowMicros) {
|
|
328
|
+
const val2 = +nowMicros;
|
|
329
|
+
const ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
330
|
+
const len0 = WASM_VECTOR_LEN;
|
|
331
|
+
const ret = wasm.device_syncSpace(this.__wbg_ptr, transport, ptr0, len0, val2);
|
|
332
|
+
return ret;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Whether a `syncSpace` is running.
|
|
336
|
+
* @returns {boolean}
|
|
337
|
+
*/
|
|
338
|
+
get syncing() {
|
|
339
|
+
const ret = wasm.device_syncing(this.__wbg_ptr);
|
|
340
|
+
return ret !== 0;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* The device's state, to keep between runs.
|
|
344
|
+
* @returns {DeviceJson}
|
|
345
|
+
*/
|
|
346
|
+
toJson() {
|
|
347
|
+
const ret = wasm.device_toJson(this.__wbg_ptr);
|
|
348
|
+
if (ret[2]) {
|
|
349
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
350
|
+
}
|
|
351
|
+
return takeFromExternrefTable0(ret[0]);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Completes an open to-do, or reopens a closed one.
|
|
355
|
+
* @param {ObjectRef} object
|
|
356
|
+
* @param {number} nowMicros
|
|
357
|
+
*/
|
|
358
|
+
toggleDone(object, nowMicros) {
|
|
359
|
+
const ret = wasm.device_toggleDone(this.__wbg_ptr, object, nowMicros);
|
|
360
|
+
if (ret[1]) {
|
|
361
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Moves to the Trash, or (`trashed: false`) puts back.
|
|
366
|
+
* @param {ObjectRef} object
|
|
367
|
+
* @param {boolean} trashed
|
|
368
|
+
* @param {number} nowMicros
|
|
369
|
+
*/
|
|
370
|
+
trash(object, trashed, nowMicros) {
|
|
371
|
+
const ret = wasm.device_trash(this.__wbg_ptr, object, trashed, nowMicros);
|
|
372
|
+
if (ret[1]) {
|
|
373
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (Symbol.dispose) Device.prototype[Symbol.dispose] = Device.prototype.free;
|
|
378
|
+
exports.Device = Device;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* An in-memory atproto network: a PDS per account and a space host,
|
|
382
|
+
* behaving as the reference implementations do. For demos and tests.
|
|
383
|
+
*/
|
|
384
|
+
class SimNetwork {
|
|
385
|
+
__destroy_into_raw() {
|
|
386
|
+
const ptr = this.__wbg_ptr;
|
|
387
|
+
this.__wbg_ptr = 0;
|
|
388
|
+
SimNetworkFinalization.unregister(this);
|
|
389
|
+
return ptr;
|
|
390
|
+
}
|
|
391
|
+
free() {
|
|
392
|
+
const ptr = this.__destroy_into_raw();
|
|
393
|
+
wasm.__wbg_simnetwork_free(ptr, 0);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Lets `did` write to the space again.
|
|
397
|
+
* @param {string} space
|
|
398
|
+
* @param {string} did
|
|
399
|
+
*/
|
|
400
|
+
allowWriter(space, did) {
|
|
401
|
+
let ptr0, len0, ptr1, len1;
|
|
402
|
+
try {
|
|
403
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
404
|
+
len0 = WASM_VECTOR_LEN;
|
|
405
|
+
ptr1 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
406
|
+
len1 = WASM_VECTOR_LEN;
|
|
407
|
+
} catch (e) {
|
|
408
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
409
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
410
|
+
throw e;
|
|
411
|
+
}
|
|
412
|
+
const ret = wasm.simnetwork_allowWriter(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
413
|
+
if (ret[1]) {
|
|
414
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* A transport for the account `did`.
|
|
419
|
+
* @param {string} did
|
|
420
|
+
* @returns {SimTransport}
|
|
421
|
+
*/
|
|
422
|
+
client(did) {
|
|
423
|
+
const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
424
|
+
const len0 = WASM_VECTOR_LEN;
|
|
425
|
+
const ret = wasm.simnetwork_client(this.__wbg_ptr, ptr0, len0);
|
|
426
|
+
return SimTransport.__wrap(ret);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* A space; `writers` and `readers` are the DIDs allowed (omitted:
|
|
430
|
+
* anyone, as for a personal space, which only its owner writes).
|
|
431
|
+
* @param {string} space
|
|
432
|
+
* @param {string[] | null} [writers]
|
|
433
|
+
* @param {string[] | null} [readers]
|
|
434
|
+
*/
|
|
435
|
+
createSpace(space, writers, readers) {
|
|
436
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
437
|
+
try {
|
|
438
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
439
|
+
len0 = WASM_VECTOR_LEN;
|
|
440
|
+
ptr1 = isLikeNone(writers) ? 0 : passArrayJsValueToWasm0(writers, wasm.__wbindgen_malloc);
|
|
441
|
+
len1 = WASM_VECTOR_LEN;
|
|
442
|
+
ptr2 = isLikeNone(readers) ? 0 : passArrayJsValueToWasm0(readers, wasm.__wbindgen_malloc);
|
|
443
|
+
len2 = WASM_VECTOR_LEN;
|
|
444
|
+
} catch (e) {
|
|
445
|
+
if (ptr2) { wasm.__externref_drop_slice(ptr2, len2); wasm.__wbindgen_free(ptr2, len2 * 4, 4); }
|
|
446
|
+
if (ptr1) { wasm.__externref_drop_slice(ptr1, len1); wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
447
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
448
|
+
throw e;
|
|
449
|
+
}
|
|
450
|
+
const ret = wasm.simnetwork_createSpace(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
451
|
+
if (ret[1]) {
|
|
452
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Fails a call `did` makes with `error`, unapplied: the next one, or
|
|
457
|
+
* the one after `skip` more have gone through.
|
|
458
|
+
* @param {string} did
|
|
459
|
+
* @param {TransportError} error
|
|
460
|
+
* @param {number | null} [skip]
|
|
461
|
+
*/
|
|
462
|
+
fail(did, error, skip) {
|
|
463
|
+
const val2 = +(isLikeNone(skip) ? 0xFFFFFF : skip);
|
|
464
|
+
const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
465
|
+
const len0 = WASM_VECTOR_LEN;
|
|
466
|
+
const ret = wasm.simnetwork_fail(this.__wbg_ptr, ptr0, len0, error, val2);
|
|
467
|
+
if (ret[1]) {
|
|
468
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Applies the next `applyWrites` by `did`, but loses its response.
|
|
473
|
+
* @param {string} did
|
|
474
|
+
*/
|
|
475
|
+
loseResponse(did) {
|
|
476
|
+
const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
477
|
+
const len0 = WASM_VECTOR_LEN;
|
|
478
|
+
wasm.simnetwork_loseResponse(this.__wbg_ptr, ptr0, len0);
|
|
479
|
+
}
|
|
480
|
+
constructor() {
|
|
481
|
+
const ret = wasm.simnetwork_new();
|
|
482
|
+
this.__wbg_ptr = ret;
|
|
483
|
+
SimNetworkFinalization.register(this, this.__wbg_ptr, this);
|
|
484
|
+
return this;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Takes `did` out of the space's writers.
|
|
488
|
+
* @param {string} space
|
|
489
|
+
* @param {string} did
|
|
490
|
+
*/
|
|
491
|
+
removeWriter(space, did) {
|
|
492
|
+
let ptr0, len0, ptr1, len1;
|
|
493
|
+
try {
|
|
494
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
495
|
+
len0 = WASM_VECTOR_LEN;
|
|
496
|
+
ptr1 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
497
|
+
len1 = WASM_VECTOR_LEN;
|
|
498
|
+
} catch (e) {
|
|
499
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
500
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
501
|
+
throw e;
|
|
502
|
+
}
|
|
503
|
+
const ret = wasm.simnetwork_removeWriter(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
504
|
+
if (ret[1]) {
|
|
505
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (Symbol.dispose) SimNetwork.prototype[Symbol.dispose] = SimNetwork.prototype.free;
|
|
510
|
+
exports.SimNetwork = SimNetwork;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* One account's view of a `SimNetwork`: a `Transport`. It answers through
|
|
514
|
+
* the same JSON boundary a real transport does.
|
|
515
|
+
*/
|
|
516
|
+
class SimTransport {
|
|
517
|
+
static __wrap(ptr) {
|
|
518
|
+
const obj = Object.create(SimTransport.prototype);
|
|
519
|
+
obj.__wbg_ptr = ptr;
|
|
520
|
+
SimTransportFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
521
|
+
return obj;
|
|
522
|
+
}
|
|
523
|
+
__destroy_into_raw() {
|
|
524
|
+
const ptr = this.__wbg_ptr;
|
|
525
|
+
this.__wbg_ptr = 0;
|
|
526
|
+
SimTransportFinalization.unregister(this);
|
|
527
|
+
return ptr;
|
|
528
|
+
}
|
|
529
|
+
free() {
|
|
530
|
+
const ptr = this.__destroy_into_raw();
|
|
531
|
+
wasm.__wbg_simtransport_free(ptr, 0);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* @param {string} space
|
|
535
|
+
* @param {Write[]} writes
|
|
536
|
+
* @returns {Promise<Result<WriteOk>>}
|
|
537
|
+
*/
|
|
538
|
+
applyWrites(space, writes) {
|
|
539
|
+
const ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
540
|
+
const len0 = WASM_VECTOR_LEN;
|
|
541
|
+
const ret = wasm.simtransport_applyWrites(this.__wbg_ptr, ptr0, len0, writes);
|
|
542
|
+
if (ret[2]) {
|
|
543
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
544
|
+
}
|
|
545
|
+
return takeFromExternrefTable0(ret[0]);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* @param {string} space
|
|
549
|
+
* @param {string} repo
|
|
550
|
+
* @param {RecordPath} path
|
|
551
|
+
* @returns {Promise<Result<{ cid: string; value: JsonValue } | undefined>>}
|
|
552
|
+
*/
|
|
553
|
+
getRecord(space, repo, path) {
|
|
554
|
+
let ptr0, len0, ptr1, len1;
|
|
555
|
+
try {
|
|
556
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
557
|
+
len0 = WASM_VECTOR_LEN;
|
|
558
|
+
ptr1 = passStringToWasm0(repo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
559
|
+
len1 = WASM_VECTOR_LEN;
|
|
560
|
+
} catch (e) {
|
|
561
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
562
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
563
|
+
throw e;
|
|
564
|
+
}
|
|
565
|
+
const ret = wasm.simtransport_getRecord(this.__wbg_ptr, ptr0, len0, ptr1, len1, path);
|
|
566
|
+
if (ret[2]) {
|
|
567
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
568
|
+
}
|
|
569
|
+
return takeFromExternrefTable0(ret[0]);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* @param {string} space
|
|
573
|
+
* @param {string} repo
|
|
574
|
+
* @returns {Promise<Result<Snapshot>>}
|
|
575
|
+
*/
|
|
576
|
+
getSnapshot(space, repo) {
|
|
577
|
+
let ptr0, len0, ptr1, len1;
|
|
578
|
+
try {
|
|
579
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
580
|
+
len0 = WASM_VECTOR_LEN;
|
|
581
|
+
ptr1 = passStringToWasm0(repo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
582
|
+
len1 = WASM_VECTOR_LEN;
|
|
583
|
+
} catch (e) {
|
|
584
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
585
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
586
|
+
throw e;
|
|
587
|
+
}
|
|
588
|
+
const ret = wasm.simtransport_getSnapshot(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
589
|
+
if (ret[2]) {
|
|
590
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
591
|
+
}
|
|
592
|
+
return takeFromExternrefTable0(ret[0]);
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* @param {string} space
|
|
596
|
+
* @param {string} repo
|
|
597
|
+
* @param {string} since
|
|
598
|
+
* @param {string | null} [cursor]
|
|
599
|
+
* @returns {Promise<Result<OpsPage>>}
|
|
600
|
+
*/
|
|
601
|
+
listRepoOps(space, repo, since, cursor) {
|
|
602
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
|
|
603
|
+
try {
|
|
604
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
605
|
+
len0 = WASM_VECTOR_LEN;
|
|
606
|
+
ptr1 = passStringToWasm0(repo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
607
|
+
len1 = WASM_VECTOR_LEN;
|
|
608
|
+
ptr2 = passStringToWasm0(since, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
609
|
+
len2 = WASM_VECTOR_LEN;
|
|
610
|
+
ptr3 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
611
|
+
len3 = WASM_VECTOR_LEN;
|
|
612
|
+
} catch (e) {
|
|
613
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
|
|
614
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
615
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
616
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
617
|
+
throw e;
|
|
618
|
+
}
|
|
619
|
+
const ret = wasm.simtransport_listRepoOps(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
620
|
+
if (ret[2]) {
|
|
621
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
622
|
+
}
|
|
623
|
+
return takeFromExternrefTable0(ret[0]);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* @param {string} space
|
|
627
|
+
* @param {string | null} [since]
|
|
628
|
+
* @param {string | null} [cursor]
|
|
629
|
+
* @returns {Promise<Result<WritersPage>>}
|
|
630
|
+
*/
|
|
631
|
+
listWriters(space, since, cursor) {
|
|
632
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
633
|
+
try {
|
|
634
|
+
ptr0 = passStringToWasm0(space, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
635
|
+
len0 = WASM_VECTOR_LEN;
|
|
636
|
+
ptr1 = isLikeNone(since) ? 0 : passStringToWasm0(since, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
637
|
+
len1 = WASM_VECTOR_LEN;
|
|
638
|
+
ptr2 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
639
|
+
len2 = WASM_VECTOR_LEN;
|
|
640
|
+
} catch (e) {
|
|
641
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
642
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
643
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
644
|
+
throw e;
|
|
645
|
+
}
|
|
646
|
+
const ret = wasm.simtransport_listWriters(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
647
|
+
if (ret[2]) {
|
|
648
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
649
|
+
}
|
|
650
|
+
return takeFromExternrefTable0(ret[0]);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (Symbol.dispose) SimTransport.prototype[Symbol.dispose] = SimTransport.prototype.free;
|
|
654
|
+
exports.SimTransport = SimTransport;
|
|
655
|
+
function __wbg_get_imports() {
|
|
656
|
+
const import0 = {
|
|
657
|
+
__proto__: null,
|
|
658
|
+
__wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
|
|
659
|
+
const ret = debugString(arg1);
|
|
660
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
661
|
+
const len1 = WASM_VECTOR_LEN;
|
|
662
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
663
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
664
|
+
},
|
|
665
|
+
__wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
|
|
666
|
+
const ret = typeof(arg0) === 'function';
|
|
667
|
+
return ret;
|
|
668
|
+
},
|
|
669
|
+
__wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
|
|
670
|
+
const ret = arg0 === undefined;
|
|
671
|
+
return ret;
|
|
672
|
+
},
|
|
673
|
+
__wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
|
|
674
|
+
const obj = arg1;
|
|
675
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
676
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
677
|
+
var len1 = WASM_VECTOR_LEN;
|
|
678
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
679
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
680
|
+
},
|
|
681
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
682
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
683
|
+
},
|
|
684
|
+
__wbg__wbg_cb_unref_09736879a3f67559: function(arg0) {
|
|
685
|
+
arg0._wbg_cb_unref();
|
|
686
|
+
},
|
|
687
|
+
__wbg_apply_bfe2b07b146427e2: function() { return handleError(function (arg0, arg1, arg2) {
|
|
688
|
+
const ret = arg0.apply(arg1, arg2);
|
|
689
|
+
return ret;
|
|
690
|
+
}, arguments); },
|
|
691
|
+
__wbg_call_a410eb4b59ed5965: function() { return handleError(function (arg0, arg1, arg2) {
|
|
692
|
+
const ret = arg0.call(arg1, arg2);
|
|
693
|
+
return ret;
|
|
694
|
+
}, arguments); },
|
|
695
|
+
__wbg_error_c1cdd737bfae12d3: function(arg0, arg1) {
|
|
696
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
697
|
+
},
|
|
698
|
+
__wbg_get_2080c49015e35254: function() { return handleError(function (arg0, arg1) {
|
|
699
|
+
const ret = Reflect.get(arg0, arg1);
|
|
700
|
+
return ret;
|
|
701
|
+
}, arguments); },
|
|
702
|
+
__wbg_instanceof_Error_74e3cca0c4a69161: function(arg0) {
|
|
703
|
+
let result;
|
|
704
|
+
try {
|
|
705
|
+
result = arg0 instanceof Error;
|
|
706
|
+
} catch (_) {
|
|
707
|
+
result = false;
|
|
708
|
+
}
|
|
709
|
+
const ret = result;
|
|
710
|
+
return ret;
|
|
711
|
+
},
|
|
712
|
+
__wbg_message_43d8c8f1d543a349: function(arg0) {
|
|
713
|
+
const ret = arg0.message;
|
|
714
|
+
return ret;
|
|
715
|
+
},
|
|
716
|
+
__wbg_new_37eb45aaf5eeb820: function() {
|
|
717
|
+
const ret = new Array();
|
|
718
|
+
return ret;
|
|
719
|
+
},
|
|
720
|
+
__wbg_new_4416a2fe2fac9c65: function(arg0, arg1) {
|
|
721
|
+
const ret = new TypeError(getStringFromWasm0(arg0, arg1));
|
|
722
|
+
return ret;
|
|
723
|
+
},
|
|
724
|
+
__wbg_new_787b9fb330d55d78: function(arg0, arg1) {
|
|
725
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
726
|
+
return ret;
|
|
727
|
+
},
|
|
728
|
+
__wbg_new_typed_e09da9dae6ee5935: function(arg0, arg1) {
|
|
729
|
+
try {
|
|
730
|
+
var state0 = {a: arg0, b: arg1};
|
|
731
|
+
var cb0 = (arg0, arg1) => {
|
|
732
|
+
const a = state0.a;
|
|
733
|
+
state0.a = 0;
|
|
734
|
+
try {
|
|
735
|
+
return wasm_bindgen__convert__closures_____invoke__h0cf8a5a2756bd9cd(a, state0.b, arg0, arg1);
|
|
736
|
+
} finally {
|
|
737
|
+
state0.a = a;
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
const ret = new Promise(cb0);
|
|
741
|
+
return ret;
|
|
742
|
+
} finally {
|
|
743
|
+
state0.a = 0;
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
__wbg_parse_c3f72b5a24f83c01: function() { return handleError(function (arg0, arg1) {
|
|
747
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
748
|
+
return ret;
|
|
749
|
+
}, arguments); },
|
|
750
|
+
__wbg_push_c9f4893fc209f768: function(arg0, arg1) {
|
|
751
|
+
const ret = arg0.push(arg1);
|
|
752
|
+
return ret;
|
|
753
|
+
},
|
|
754
|
+
__wbg_queueMicrotask_1e8503a8a690f0a3: function(arg0) {
|
|
755
|
+
const ret = arg0.queueMicrotask;
|
|
756
|
+
return ret;
|
|
757
|
+
},
|
|
758
|
+
__wbg_queueMicrotask_4a1a4d8dd332373b: function(arg0) {
|
|
759
|
+
queueMicrotask(arg0);
|
|
760
|
+
},
|
|
761
|
+
__wbg_resolve_dbf78ab4942478b0: function(arg0) {
|
|
762
|
+
const ret = Promise.resolve(arg0);
|
|
763
|
+
return ret;
|
|
764
|
+
},
|
|
765
|
+
__wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
|
|
766
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
767
|
+
return ret;
|
|
768
|
+
}, arguments); },
|
|
769
|
+
__wbg_set_name_822e3903f3184979: function(arg0, arg1, arg2) {
|
|
770
|
+
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
771
|
+
},
|
|
772
|
+
__wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc: function() {
|
|
773
|
+
const ret = typeof globalThis === 'undefined' ? undefined : globalThis;
|
|
774
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
775
|
+
},
|
|
776
|
+
__wbg_static_accessor_GLOBAL_e4293fb22cbe77da: function() {
|
|
777
|
+
const ret = typeof global === 'undefined' ? undefined : global;
|
|
778
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
779
|
+
},
|
|
780
|
+
__wbg_static_accessor_SELF_53bb20457401453d: function() {
|
|
781
|
+
const ret = typeof self === 'undefined' ? undefined : self;
|
|
782
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
783
|
+
},
|
|
784
|
+
__wbg_static_accessor_WINDOW_b5e0810bfecb7feb: function() {
|
|
785
|
+
const ret = typeof window === 'undefined' ? undefined : window;
|
|
786
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
787
|
+
},
|
|
788
|
+
__wbg_stringify_0a0fbf2ef722380a: function() { return handleError(function (arg0) {
|
|
789
|
+
const ret = JSON.stringify(arg0);
|
|
790
|
+
return ret;
|
|
791
|
+
}, arguments); },
|
|
792
|
+
__wbg_then_656f253a5dd7d8ea: function(arg0, arg1, arg2) {
|
|
793
|
+
const ret = arg0.then(arg1, arg2);
|
|
794
|
+
return ret;
|
|
795
|
+
},
|
|
796
|
+
__wbg_then_e3f7f2d365708be8: function(arg0, arg1) {
|
|
797
|
+
const ret = arg0.then(arg1);
|
|
798
|
+
return ret;
|
|
799
|
+
},
|
|
800
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
801
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 33, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
802
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd6da796ca7e1484e);
|
|
803
|
+
return ret;
|
|
804
|
+
},
|
|
805
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
806
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
807
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
808
|
+
return ret;
|
|
809
|
+
},
|
|
810
|
+
__wbindgen_init_externref_table: function() {
|
|
811
|
+
const table = wasm.__wbindgen_externrefs;
|
|
812
|
+
table.set(0, undefined);
|
|
813
|
+
table.set(1024, undefined);
|
|
814
|
+
table.set(1025, null);
|
|
815
|
+
table.set(1026, true);
|
|
816
|
+
table.set(1027, false);
|
|
817
|
+
},
|
|
818
|
+
};
|
|
819
|
+
return {
|
|
820
|
+
__proto__: null,
|
|
821
|
+
"./attodo_sync_bg.js": import0,
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
function wasm_bindgen__convert__closures_____invoke__hd6da796ca7e1484e(arg0, arg1, arg2) {
|
|
826
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hd6da796ca7e1484e(arg0, arg1, arg2);
|
|
827
|
+
if (ret[1]) {
|
|
828
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function wasm_bindgen__convert__closures_____invoke__h0cf8a5a2756bd9cd(arg0, arg1, arg2, arg3) {
|
|
833
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h0cf8a5a2756bd9cd(arg0, arg1, arg2, arg3);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
const DeviceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
837
|
+
? { register: () => {}, unregister: () => {} }
|
|
838
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_device_free(ptr, 1));
|
|
839
|
+
const SimNetworkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
840
|
+
? { register: () => {}, unregister: () => {} }
|
|
841
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_simnetwork_free(ptr, 1));
|
|
842
|
+
const SimTransportFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
843
|
+
? { register: () => {}, unregister: () => {} }
|
|
844
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_simtransport_free(ptr, 1));
|
|
845
|
+
|
|
846
|
+
function addToExternrefTable0(obj) {
|
|
847
|
+
const idx = wasm.__externref_table_alloc();
|
|
848
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
849
|
+
return idx;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
853
|
+
? { register: () => {}, unregister: () => {} }
|
|
854
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
855
|
+
|
|
856
|
+
function debugString(val) {
|
|
857
|
+
switch (typeof val) {
|
|
858
|
+
// primitive types
|
|
859
|
+
case 'number':
|
|
860
|
+
case 'boolean':
|
|
861
|
+
case 'undefined':
|
|
862
|
+
return `${val}`;
|
|
863
|
+
case 'string':
|
|
864
|
+
return JSON.stringify(val);
|
|
865
|
+
case 'bigint':
|
|
866
|
+
return `${val}n`;
|
|
867
|
+
case 'symbol':
|
|
868
|
+
return val.description !== undefined
|
|
869
|
+
? `Symbol(${val.description})`
|
|
870
|
+
: 'Symbol';
|
|
871
|
+
case 'function':
|
|
872
|
+
return typeof val.name === 'string' && val.name !== ''
|
|
873
|
+
? `Function(${val.name})`
|
|
874
|
+
: 'Function';
|
|
875
|
+
case 'object': {
|
|
876
|
+
if (val === null) {
|
|
877
|
+
return 'null';
|
|
878
|
+
}
|
|
879
|
+
// objects
|
|
880
|
+
if (Array.isArray(val)) {
|
|
881
|
+
return '[' + Array.from(val, debugString).join(', ') + ']';
|
|
882
|
+
}
|
|
883
|
+
// errors
|
|
884
|
+
if (val instanceof Error) {
|
|
885
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
const toStringOutput = toString.call(val);
|
|
889
|
+
// Test for built-in
|
|
890
|
+
const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
|
|
891
|
+
|
|
892
|
+
// Failed to match the standard '[object ClassName]'
|
|
893
|
+
if (className === undefined) {
|
|
894
|
+
return toStringOutput;
|
|
895
|
+
}
|
|
896
|
+
if (className === 'Object') {
|
|
897
|
+
// we're a user defined class or Object
|
|
898
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
899
|
+
// easier than looping through ownProperties of `val`.
|
|
900
|
+
try {
|
|
901
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
902
|
+
} catch (_) {
|
|
903
|
+
return 'Object';
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
907
|
+
return className;
|
|
908
|
+
}
|
|
909
|
+
// Per MDN: 'This list of values is exhaustive.'
|
|
910
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
let cachedDataViewMemory0 = null;
|
|
915
|
+
function getDataViewMemory0() {
|
|
916
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
917
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
918
|
+
}
|
|
919
|
+
return cachedDataViewMemory0;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
function getStringFromWasm0(ptr, len) {
|
|
923
|
+
ptr = ptr >>> 0;
|
|
924
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
let cachedUint8ArrayMemory0 = null;
|
|
928
|
+
function getUint8ArrayMemory0() {
|
|
929
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
930
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
931
|
+
}
|
|
932
|
+
return cachedUint8ArrayMemory0;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
function handleError(f, args) {
|
|
936
|
+
try {
|
|
937
|
+
return f.apply(this, args);
|
|
938
|
+
} catch (e) {
|
|
939
|
+
const idx = addToExternrefTable0(e);
|
|
940
|
+
wasm.__wbindgen_exn_store(idx);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
function isLikeNone(x) {
|
|
945
|
+
return x === undefined || x === null;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
949
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
950
|
+
const real = (...args) => {
|
|
951
|
+
|
|
952
|
+
// First up with a closure we increment the internal reference
|
|
953
|
+
// count. This ensures that the Rust closure environment won't
|
|
954
|
+
// be deallocated while we're invoking it.
|
|
955
|
+
state.cnt++;
|
|
956
|
+
const a = state.a;
|
|
957
|
+
state.a = 0;
|
|
958
|
+
try {
|
|
959
|
+
return f(a, state.b, ...args);
|
|
960
|
+
} finally {
|
|
961
|
+
state.a = a;
|
|
962
|
+
real._wbg_cb_unref();
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
real._wbg_cb_unref = () => {
|
|
966
|
+
if (--state.cnt === 0) {
|
|
967
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
968
|
+
state.a = 0;
|
|
969
|
+
CLOSURE_DTORS.unregister(state);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
973
|
+
return real;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
977
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
978
|
+
for (let i = 0; i < array.length; i++) {
|
|
979
|
+
const add = addToExternrefTable0(array[i]);
|
|
980
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
981
|
+
}
|
|
982
|
+
WASM_VECTOR_LEN = array.length;
|
|
983
|
+
return ptr;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
987
|
+
if (realloc === undefined) {
|
|
988
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
989
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
990
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
991
|
+
WASM_VECTOR_LEN = buf.length;
|
|
992
|
+
return ptr;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
let len = arg.length;
|
|
996
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
997
|
+
|
|
998
|
+
const mem = getUint8ArrayMemory0();
|
|
999
|
+
|
|
1000
|
+
let offset = 0;
|
|
1001
|
+
|
|
1002
|
+
for (; offset < len; offset++) {
|
|
1003
|
+
const code = arg.charCodeAt(offset);
|
|
1004
|
+
if (code > 0x7F) break;
|
|
1005
|
+
mem[ptr + offset] = code;
|
|
1006
|
+
}
|
|
1007
|
+
if (offset !== len) {
|
|
1008
|
+
if (offset !== 0) {
|
|
1009
|
+
arg = arg.slice(offset);
|
|
1010
|
+
}
|
|
1011
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1012
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1013
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1014
|
+
|
|
1015
|
+
offset += ret.written;
|
|
1016
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
WASM_VECTOR_LEN = offset;
|
|
1020
|
+
return ptr;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
function takeFromExternrefTable0(idx) {
|
|
1024
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1025
|
+
wasm.__externref_table_dealloc(idx);
|
|
1026
|
+
return value;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
1030
|
+
cachedTextDecoder.decode();
|
|
1031
|
+
function decodeText(bytes) {
|
|
1032
|
+
return cachedTextDecoder.decode(bytes);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1036
|
+
|
|
1037
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1038
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1039
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1040
|
+
view.set(buf);
|
|
1041
|
+
return {
|
|
1042
|
+
read: arg.length,
|
|
1043
|
+
written: buf.length
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
let WASM_VECTOR_LEN = 0;
|
|
1049
|
+
|
|
1050
|
+
const wasmPath = `${__dirname}/attodo_sync_bg.wasm`;
|
|
1051
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
1052
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
1053
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
1054
|
+
let wasm = wasmInstance.exports;
|
|
1055
|
+
wasm.__wbindgen_start();
|