jazz-tools 0.7.1 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +33 -33
- package/CHANGELOG.md +177 -165
- package/LICENSE.txt +1 -1
- package/dist/coValues/account.js +41 -4
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +179 -8
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +141 -5
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +49 -1
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/group.js +26 -2
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +32 -48
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/schema.js.map +1 -1
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tests/deepLoading.test.js +2 -2
- package/dist/tests/deepLoading.test.js.map +1 -1
- package/dist/tests/groupsAndAccounts.test.js +3 -3
- package/dist/tests/groupsAndAccounts.test.js.map +1 -1
- package/package.json +1 -1
- package/src/coValues/account.ts +106 -13
- package/src/coValues/coList.ts +236 -23
- package/src/coValues/coMap.ts +194 -11
- package/src/coValues/coStream.ts +128 -11
- package/src/coValues/group.ts +78 -5
- package/src/coValues/interfaces.ts +141 -211
- package/src/implementation/schema.ts +7 -4
- package/src/implementation/subscriptionScope.ts +3 -3
- package/src/index.ts +7 -0
- package/src/tests/deepLoading.test.ts +6 -3
- package/src/tests/groupsAndAccounts.test.ts +4 -4
package/CHANGELOG.md
CHANGED
@@ -1,400 +1,412 @@
|
|
1
1
|
# jazz-autosub
|
2
2
|
|
3
|
+
## 0.7.6
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Provide way to create accounts as another account
|
8
|
+
|
9
|
+
## 0.7.3
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- Clean up loading & subscription API
|
14
|
+
|
3
15
|
## 0.7.1
|
4
16
|
|
5
17
|
### Patch Changes
|
6
18
|
|
7
|
-
-
|
19
|
+
- Add runtime option for optional refs
|
8
20
|
|
9
21
|
## 0.7.0
|
10
22
|
|
11
23
|
### Minor Changes
|
12
24
|
|
13
|
-
-
|
14
|
-
|
15
|
-
### Patch Changes
|
16
|
-
|
17
|
-
-
|
18
|
-
-
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
-
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
|
81
|
-
|
25
|
+
- e299c3e: New simplified API
|
26
|
+
|
27
|
+
### Patch Changes
|
28
|
+
|
29
|
+
- 8636319: Fix infinite recursion in subscriptionScope
|
30
|
+
- 8636319: Fix type of init param for CoMap.create
|
31
|
+
- 1a35307: Implement first devtools formatters
|
32
|
+
- 96c494f: Implement profile visibility based on groups & new migration signature
|
33
|
+
- 59c18c3: CoMap fix
|
34
|
+
- 19f52b7: Fixed bug with newRandomSessionID being called before crypto was ready
|
35
|
+
- 8636319: Implement deep loading, simplify API
|
36
|
+
- 19004b4: Add .all to CoStreamEntry
|
37
|
+
- a78f168: Make Account -> Profile a lazy ref schema
|
38
|
+
- 52675c9: Fix CoList.splice / RawCoList.append
|
39
|
+
- 129e2c1: More precise imports from @effect/schema
|
40
|
+
- 1cfa279: More superclass-compatible CoMaps
|
41
|
+
- 704af7d: Add maxWidth option for loading images
|
42
|
+
- 460478f: Use effect 3.0
|
43
|
+
- 6b0418f: Fix image resolution loading
|
44
|
+
- ed5643a: Fix CoMap \_refs for co.items
|
45
|
+
- bde684f: CoValue casting & auto-subbing \_owner
|
46
|
+
- c4151fc: Support stricter TS lint rules
|
47
|
+
- 63374cc: Relax types of CoMap.\_schema
|
48
|
+
- 01ac646: Make CoMaps even more subclassable
|
49
|
+
- a5e68a4: Make refs type more precise
|
50
|
+
- 952982e: Consistent proxy based API
|
51
|
+
- 1a35307: Add ability to declare minimum required data in subscribe & Improve property access tracing
|
52
|
+
- 5fa277c: Fix CoMap.Record.toJSON()
|
53
|
+
- 60d5ca2: Introduce jazz-tools CLI
|
54
|
+
- 21771c4: Reintroduce changes from main
|
55
|
+
- 77c2b56: Get rid of self generics, new create syntax
|
56
|
+
- 63374cc: Fix schema of Account & Group
|
57
|
+
- d2e03ff: Fix variance of ID.\_\_type
|
58
|
+
- 354bdcd: Even friendlier for subclassing CoMap
|
59
|
+
- 60d5ca2: Clean up exports
|
60
|
+
- 69ac514: Use effect schema much less
|
61
|
+
- f8a5c46: Fix CoStream types
|
62
|
+
- f0f6f1b: Clean up API more & re-add jazz-nodejs
|
63
|
+
- e5eed5b: Make refs on list more precise
|
64
|
+
- 1a44f87: Refactoring
|
65
|
+
- 627d895: Get rid of Co namespace
|
66
|
+
- 1200aae: Cache CoValue proxies
|
67
|
+
- 63374cc: Make sure delete on CoMaps deletes keys
|
68
|
+
- ece35b3: Make fast-check a direct dependency to help dev time resolution
|
69
|
+
- 38d4410: CoMap fixes and improvements
|
70
|
+
- 85d2b62: More subclass-friendly types in CoMap
|
71
|
+
- fd86c11: Extract jazz cli into jazz-run package
|
72
|
+
- 52675c9: Fix Costream[...].all
|
73
|
+
- Updated dependencies [1a35307]
|
74
|
+
- Updated dependencies [96c494f]
|
75
|
+
- Updated dependencies [19f52b7]
|
76
|
+
- Updated dependencies [d8fe2b1]
|
77
|
+
- Updated dependencies [1200aae]
|
78
|
+
- Updated dependencies [52675c9]
|
79
|
+
- Updated dependencies [1a35307]
|
80
|
+
- Updated dependencies [e299c3e]
|
81
|
+
- Updated dependencies [bf0f8ec]
|
82
|
+
- Updated dependencies [c4151fc]
|
83
|
+
- Updated dependencies [8636319]
|
84
|
+
- Updated dependencies [952982e]
|
85
|
+
- Updated dependencies [21771c4]
|
86
|
+
- Updated dependencies [69ac514]
|
87
|
+
- Updated dependencies [f0f6f1b]
|
88
|
+
- Updated dependencies [1a44f87]
|
89
|
+
- Updated dependencies [627d895]
|
90
|
+
- Updated dependencies [63374cc]
|
91
|
+
- Updated dependencies [a423eee]
|
92
|
+
- cojson@0.7.0
|
93
|
+
- cojson-transport-nodejs-ws@0.7.0
|
82
94
|
|
83
95
|
## 0.7.0-alpha.42
|
84
96
|
|
85
97
|
### Patch Changes
|
86
98
|
|
87
|
-
-
|
88
|
-
-
|
89
|
-
|
90
|
-
|
99
|
+
- Fixed bug with newRandomSessionID being called before crypto was ready
|
100
|
+
- Updated dependencies
|
101
|
+
- cojson@0.7.0-alpha.42
|
102
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.42
|
91
103
|
|
92
104
|
## 0.7.0-alpha.41
|
93
105
|
|
94
106
|
### Patch Changes
|
95
107
|
|
96
|
-
-
|
97
|
-
|
108
|
+
- Updated dependencies
|
109
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.41
|
98
110
|
|
99
111
|
## 0.7.0-alpha.39
|
100
112
|
|
101
113
|
### Patch Changes
|
102
114
|
|
103
|
-
-
|
104
|
-
|
105
|
-
|
115
|
+
- Updated dependencies
|
116
|
+
- cojson@0.7.0-alpha.39
|
117
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.39
|
106
118
|
|
107
119
|
## 0.7.0-alpha.38
|
108
120
|
|
109
121
|
### Patch Changes
|
110
122
|
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
|
116
|
-
|
123
|
+
- Fix infinite recursion in subscriptionScope
|
124
|
+
- Fix type of init param for CoMap.create
|
125
|
+
- Implement deep loading, simplify API
|
126
|
+
- Updated dependencies
|
127
|
+
- cojson@0.7.0-alpha.38
|
128
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.38
|
117
129
|
|
118
130
|
## 0.7.0-alpha.37
|
119
131
|
|
120
132
|
### Patch Changes
|
121
133
|
|
122
|
-
-
|
123
|
-
|
124
|
-
|
134
|
+
- Updated dependencies
|
135
|
+
- cojson@0.7.0-alpha.37
|
136
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.37
|
125
137
|
|
126
138
|
## 0.7.0-alpha.36
|
127
139
|
|
128
140
|
### Patch Changes
|
129
141
|
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
|
136
|
-
|
142
|
+
- 1a35307: Implement first devtools formatters
|
143
|
+
- 6b0418f: Fix image resolution loading
|
144
|
+
- 1a35307: Add ability to declare minimum required data in subscribe & Improve property access tracing
|
145
|
+
- Updated dependencies [1a35307]
|
146
|
+
- Updated dependencies [1a35307]
|
147
|
+
- cojson@0.7.0-alpha.36
|
148
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.36
|
137
149
|
|
138
150
|
## 0.7.0-alpha.35
|
139
151
|
|
140
152
|
### Patch Changes
|
141
153
|
|
142
|
-
-
|
143
|
-
-
|
144
|
-
|
145
|
-
|
154
|
+
- Cache CoValue proxies
|
155
|
+
- Updated dependencies
|
156
|
+
- cojson@0.7.0-alpha.35
|
157
|
+
- cojson-transport-nodejs-ws@0.7.0-alpha.35
|
146
158
|
|
147
159
|
## 0.7.0-alpha.34
|
148
160
|
|
149
161
|
### Patch Changes
|
150
162
|
|
151
|
-
-
|
163
|
+
- Extract jazz cli into jazz-run package
|
152
164
|
|
153
165
|
## 0.7.0-alpha.32
|
154
166
|
|
155
167
|
### Patch Changes
|
156
168
|
|
157
|
-
-
|
158
|
-
-
|
169
|
+
- Introduce jazz-tools CLI
|
170
|
+
- Clean up exports
|
159
171
|
|
160
172
|
## 0.7.0-alpha.31
|
161
173
|
|
162
174
|
### Patch Changes
|
163
175
|
|
164
|
-
-
|
176
|
+
- Get rid of self generics, new create syntax
|
165
177
|
|
166
178
|
## 0.7.0-alpha.30
|
167
179
|
|
168
180
|
### Patch Changes
|
169
181
|
|
170
|
-
-
|
182
|
+
- CoValue casting & auto-subbing \_owner
|
171
183
|
|
172
184
|
## 0.7.0-alpha.29
|
173
185
|
|
174
186
|
### Patch Changes
|
175
187
|
|
176
|
-
-
|
177
|
-
-
|
178
|
-
|
188
|
+
- Reintroduce changes from main
|
189
|
+
- Updated dependencies
|
190
|
+
- cojson@0.7.0-alpha.29
|
179
191
|
|
180
192
|
## 0.7.0-alpha.28
|
181
193
|
|
182
194
|
### Patch Changes
|
183
195
|
|
184
|
-
-
|
185
|
-
-
|
186
|
-
|
196
|
+
- Implement profile visibility based on groups & new migration signature
|
197
|
+
- Updated dependencies
|
198
|
+
- cojson@0.7.0-alpha.28
|
187
199
|
|
188
200
|
## 0.7.0-alpha.27
|
189
201
|
|
190
202
|
### Patch Changes
|
191
203
|
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
195
|
-
|
204
|
+
- Fix CoList.splice / RawCoList.append
|
205
|
+
- Fix Costream[...].all
|
206
|
+
- Updated dependencies
|
207
|
+
- cojson@0.7.0-alpha.27
|
196
208
|
|
197
209
|
## 0.7.0-alpha.26
|
198
210
|
|
199
211
|
### Patch Changes
|
200
212
|
|
201
|
-
-
|
213
|
+
- Fix CoMap.Record.toJSON()
|
202
214
|
|
203
215
|
## 0.7.0-alpha.25
|
204
216
|
|
205
217
|
### Patch Changes
|
206
218
|
|
207
|
-
-
|
219
|
+
- Make Account -> Profile a lazy ref schema
|
208
220
|
|
209
221
|
## 0.7.0-alpha.24
|
210
222
|
|
211
223
|
### Patch Changes
|
212
224
|
|
213
|
-
-
|
214
|
-
-
|
215
|
-
-
|
216
|
-
-
|
217
|
-
|
225
|
+
- Relax types of CoMap.\_schema
|
226
|
+
- Fix schema of Account & Group
|
227
|
+
- Make sure delete on CoMaps deletes keys
|
228
|
+
- Updated dependencies
|
229
|
+
- cojson@0.7.0-alpha.24
|
218
230
|
|
219
231
|
## 0.7.0-alpha.23
|
220
232
|
|
221
233
|
### Patch Changes
|
222
234
|
|
223
|
-
-
|
235
|
+
- CoMap fixes and improvements
|
224
236
|
|
225
237
|
## 0.7.0-alpha.22
|
226
238
|
|
227
239
|
### Patch Changes
|
228
240
|
|
229
|
-
-
|
241
|
+
- Fix CoMap \_refs for co.items
|
230
242
|
|
231
243
|
## 0.7.0-alpha.21
|
232
244
|
|
233
245
|
### Patch Changes
|
234
246
|
|
235
|
-
-
|
247
|
+
- Add maxWidth option for loading images
|
236
248
|
|
237
249
|
## 0.7.0-alpha.20
|
238
250
|
|
239
251
|
### Patch Changes
|
240
252
|
|
241
|
-
-
|
253
|
+
- Make fast-check a direct dependency to help dev time resolution
|
242
254
|
|
243
255
|
## 0.7.0-alpha.19
|
244
256
|
|
245
257
|
### Patch Changes
|
246
258
|
|
247
|
-
-
|
259
|
+
- More precise imports from @effect/schema
|
248
260
|
|
249
261
|
## 0.7.0-alpha.17
|
250
262
|
|
251
263
|
### Patch Changes
|
252
264
|
|
253
|
-
-
|
265
|
+
- Use effect 3.0
|
254
266
|
|
255
267
|
## 0.7.0-alpha.16
|
256
268
|
|
257
269
|
### Patch Changes
|
258
270
|
|
259
|
-
-
|
271
|
+
- Make CoMaps even more subclassable
|
260
272
|
|
261
273
|
## 0.7.0-alpha.15
|
262
274
|
|
263
275
|
### Patch Changes
|
264
276
|
|
265
|
-
-
|
277
|
+
- More superclass-compatible CoMaps
|
266
278
|
|
267
279
|
## 0.7.0-alpha.14
|
268
280
|
|
269
281
|
### Patch Changes
|
270
282
|
|
271
|
-
-
|
283
|
+
- Fix CoStream types
|
272
284
|
|
273
285
|
## 0.7.0-alpha.13
|
274
286
|
|
275
287
|
### Patch Changes
|
276
288
|
|
277
|
-
-
|
289
|
+
- Add .all to CoStreamEntry
|
278
290
|
|
279
291
|
## 0.7.0-alpha.12
|
280
292
|
|
281
293
|
### Patch Changes
|
282
294
|
|
283
|
-
-
|
295
|
+
- Fix variance of ID.\_\_type
|
284
296
|
|
285
297
|
## 0.7.0-alpha.11
|
286
298
|
|
287
299
|
### Patch Changes
|
288
300
|
|
289
|
-
-
|
290
|
-
-
|
291
|
-
|
301
|
+
- Support stricter TS lint rules
|
302
|
+
- Updated dependencies
|
303
|
+
- cojson@0.7.0-alpha.11
|
292
304
|
|
293
305
|
## 0.7.0-alpha.10
|
294
306
|
|
295
307
|
### Patch Changes
|
296
308
|
|
297
|
-
-
|
298
|
-
-
|
299
|
-
|
309
|
+
- Clean up API more & re-add jazz-nodejs
|
310
|
+
- Updated dependencies
|
311
|
+
- cojson@0.7.0-alpha.10
|
300
312
|
|
301
313
|
## 0.7.0-alpha.9
|
302
314
|
|
303
315
|
### Patch Changes
|
304
316
|
|
305
|
-
-
|
317
|
+
- Even friendlier for subclassing CoMap
|
306
318
|
|
307
319
|
## 0.7.0-alpha.8
|
308
320
|
|
309
321
|
### Patch Changes
|
310
322
|
|
311
|
-
-
|
323
|
+
- More subclass-friendly types in CoMap
|
312
324
|
|
313
325
|
## 0.7.0-alpha.7
|
314
326
|
|
315
327
|
### Patch Changes
|
316
328
|
|
317
|
-
-
|
318
|
-
-
|
319
|
-
|
329
|
+
- Consistent proxy based API
|
330
|
+
- Updated dependencies
|
331
|
+
- cojson@0.7.0-alpha.7
|
320
332
|
|
321
333
|
## 0.7.0-alpha.6
|
322
334
|
|
323
335
|
### Patch Changes
|
324
336
|
|
325
|
-
-
|
337
|
+
- CoMap fix
|
326
338
|
|
327
339
|
## 0.7.0-alpha.5
|
328
340
|
|
329
341
|
### Patch Changes
|
330
342
|
|
331
|
-
-
|
332
|
-
-
|
333
|
-
|
343
|
+
- Refactoring
|
344
|
+
- Updated dependencies
|
345
|
+
- cojson@0.7.0-alpha.5
|
334
346
|
|
335
347
|
## 0.7.0-alpha.4
|
336
348
|
|
337
349
|
### Patch Changes
|
338
350
|
|
339
|
-
-
|
351
|
+
- Make refs on list more precise
|
340
352
|
|
341
353
|
## 0.7.0-alpha.3
|
342
354
|
|
343
355
|
### Patch Changes
|
344
356
|
|
345
|
-
-
|
357
|
+
- Make refs type more precise
|
346
358
|
|
347
359
|
## 0.7.0-alpha.2
|
348
360
|
|
349
361
|
### Patch Changes
|
350
362
|
|
351
|
-
-
|
363
|
+
- Get rid of Co namespace
|
352
364
|
|
353
365
|
## 0.7.0-alpha.1
|
354
366
|
|
355
367
|
### Patch Changes
|
356
368
|
|
357
|
-
-
|
358
|
-
-
|
359
|
-
|
369
|
+
- Use effect schema much less
|
370
|
+
- Updated dependencies
|
371
|
+
- cojson@0.7.0-alpha.1
|
360
372
|
|
361
373
|
## 0.7.0-alpha.0
|
362
374
|
|
363
375
|
### Minor Changes
|
364
376
|
|
365
|
-
-
|
377
|
+
- New simplified API
|
366
378
|
|
367
379
|
### Patch Changes
|
368
380
|
|
369
|
-
-
|
370
|
-
|
381
|
+
- Updated dependencies
|
382
|
+
- cojson@0.7.0-alpha.0
|
371
383
|
|
372
384
|
## 0.6.1
|
373
385
|
|
374
386
|
### Patch Changes
|
375
387
|
|
376
|
-
-
|
377
|
-
-
|
378
|
-
|
388
|
+
- Fix loading of accounts
|
389
|
+
- Updated dependencies
|
390
|
+
- cojson@0.6.5
|
379
391
|
|
380
392
|
## 0.6.0
|
381
393
|
|
382
394
|
### Minor Changes
|
383
395
|
|
384
|
-
-
|
396
|
+
- Make addMember and removeMember take loaded Accounts instead of just IDs
|
385
397
|
|
386
398
|
### Patch Changes
|
387
399
|
|
388
|
-
-
|
389
|
-
|
400
|
+
- Updated dependencies
|
401
|
+
- cojson@0.6.0
|
390
402
|
|
391
403
|
## 0.5.0
|
392
404
|
|
393
405
|
### Minor Changes
|
394
406
|
|
395
|
-
-
|
407
|
+
- Adding a lot of performance improvements to cojson, add a stresstest for the twit example and make that run smoother in a lot of ways.
|
396
408
|
|
397
409
|
### Patch Changes
|
398
410
|
|
399
|
-
-
|
400
|
-
|
411
|
+
- Updated dependencies
|
412
|
+
- cojson@0.5.0
|
package/LICENSE.txt
CHANGED
package/dist/coValues/account.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
var _a;
|
2
|
-
import { LocalNode } from "cojson";
|
2
|
+
import { LocalNode, cojsonInternals } from "cojson";
|
3
3
|
import { Context } from "effect";
|
4
|
-
import { Group, CoValueBase, MembersSym, Profile, Ref, SchemaInit, inspect, subscriptionsScopes, } from "../internal.js";
|
4
|
+
import { Group, CoValueBase, MembersSym, Profile, Ref, SchemaInit, inspect, subscriptionsScopes, loadCoValue, loadCoValueEf, subscribeToCoValue, subscribeToCoValueEf, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
|
5
5
|
/** @category Identity & Permissions */
|
6
6
|
export class Account extends CoValueBase {
|
7
7
|
get _schema() {
|
@@ -52,7 +52,7 @@ export class Account extends CoValueBase {
|
|
52
52
|
throw new Error("Only a controlled account can accept invites");
|
53
53
|
}
|
54
54
|
await this._raw.acceptInvite(valueID, inviteSecret);
|
55
|
-
return coValueClass
|
55
|
+
return loadCoValue(coValueClass, valueID, this, []);
|
56
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
57
57
|
}
|
58
58
|
static async create(options) {
|
@@ -83,6 +83,16 @@ export class Account extends CoValueBase {
|
|
83
83
|
});
|
84
84
|
return this.fromNode(node);
|
85
85
|
}
|
86
|
+
static createAs(as, options) {
|
87
|
+
// TODO: is there a cleaner way to do this?
|
88
|
+
const connectedPeers = cojsonInternals.connectedPeers("creatingAccount", "createdAccount", { peer1role: "server", peer2role: "client" });
|
89
|
+
as._raw.core.node.syncManager.addPeer(connectedPeers[1]);
|
90
|
+
return this.create({
|
91
|
+
creationProps: options.creationProps,
|
92
|
+
crypto: as._raw.core.node.crypto,
|
93
|
+
peersToLoadFrom: [connectedPeers[0]],
|
94
|
+
});
|
95
|
+
}
|
86
96
|
static fromNode(node) {
|
87
97
|
return new this({
|
88
98
|
fromRaw: node.account,
|
@@ -105,11 +115,38 @@ export class Account extends CoValueBase {
|
|
105
115
|
this.profile = Profile.create({ name: creationProps.name }, { owner: profileGroup });
|
106
116
|
}
|
107
117
|
}
|
118
|
+
/** @category Subscription & Loading */
|
119
|
+
static load(id, as, depth) {
|
120
|
+
return loadCoValue(this, id, as, depth);
|
121
|
+
}
|
122
|
+
/** @category Subscription & Loading */
|
123
|
+
static loadEf(id, depth) {
|
124
|
+
return loadCoValueEf(this, id, depth);
|
125
|
+
}
|
126
|
+
/** @category Subscription & Loading */
|
127
|
+
static subscribe(id, as, depth, listener) {
|
128
|
+
return subscribeToCoValue(this, id, as, depth, listener);
|
129
|
+
}
|
130
|
+
/** @category Subscription & Loading */
|
131
|
+
static subscribeEf(id, depth) {
|
132
|
+
return subscribeToCoValueEf(this, id, depth);
|
133
|
+
}
|
134
|
+
/** @category Subscription & Loading */
|
135
|
+
ensureLoaded(depth) {
|
136
|
+
return ensureCoValueLoaded(this, depth);
|
137
|
+
}
|
138
|
+
/** @category Subscription & Loading */
|
139
|
+
subscribe(depth, listener) {
|
140
|
+
return subscribeToExistingCoValue(this, depth, listener);
|
141
|
+
}
|
108
142
|
}
|
109
143
|
_a = Account;
|
110
144
|
(() => {
|
111
145
|
_a._schema = {
|
112
|
-
profile: {
|
146
|
+
profile: {
|
147
|
+
ref: () => Profile,
|
148
|
+
optional: false,
|
149
|
+
},
|
113
150
|
root: "json",
|
114
151
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
115
152
|
};
|