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.
Files changed (37) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +33 -33
  4. package/CHANGELOG.md +177 -165
  5. package/LICENSE.txt +1 -1
  6. package/dist/coValues/account.js +41 -4
  7. package/dist/coValues/account.js.map +1 -1
  8. package/dist/coValues/coList.js +179 -8
  9. package/dist/coValues/coList.js.map +1 -1
  10. package/dist/coValues/coMap.js +141 -5
  11. package/dist/coValues/coMap.js.map +1 -1
  12. package/dist/coValues/coStream.js +49 -1
  13. package/dist/coValues/coStream.js.map +1 -1
  14. package/dist/coValues/group.js +26 -2
  15. package/dist/coValues/group.js.map +1 -1
  16. package/dist/coValues/interfaces.js +32 -48
  17. package/dist/coValues/interfaces.js.map +1 -1
  18. package/dist/implementation/schema.js.map +1 -1
  19. package/dist/implementation/subscriptionScope.js.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/tests/deepLoading.test.js +2 -2
  23. package/dist/tests/deepLoading.test.js.map +1 -1
  24. package/dist/tests/groupsAndAccounts.test.js +3 -3
  25. package/dist/tests/groupsAndAccounts.test.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/coValues/account.ts +106 -13
  28. package/src/coValues/coList.ts +236 -23
  29. package/src/coValues/coMap.ts +194 -11
  30. package/src/coValues/coStream.ts +128 -11
  31. package/src/coValues/group.ts +78 -5
  32. package/src/coValues/interfaces.ts +141 -211
  33. package/src/implementation/schema.ts +7 -4
  34. package/src/implementation/subscriptionScope.ts +3 -3
  35. package/src/index.ts +7 -0
  36. package/src/tests/deepLoading.test.ts +6 -3
  37. 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
- - Add runtime option for optional refs
19
+ - Add runtime option for optional refs
8
20
 
9
21
  ## 0.7.0
10
22
 
11
23
  ### Minor Changes
12
24
 
13
- - e299c3e: New simplified API
14
-
15
- ### Patch Changes
16
-
17
- - 8636319: Fix infinite recursion in subscriptionScope
18
- - 8636319: Fix type of init param for CoMap.create
19
- - 1a35307: Implement first devtools formatters
20
- - 96c494f: Implement profile visibility based on groups & new migration signature
21
- - 59c18c3: CoMap fix
22
- - 19f52b7: Fixed bug with newRandomSessionID being called before crypto was ready
23
- - 8636319: Implement deep loading, simplify API
24
- - 19004b4: Add .all to CoStreamEntry
25
- - a78f168: Make Account -> Profile a lazy ref schema
26
- - 52675c9: Fix CoList.splice / RawCoList.append
27
- - 129e2c1: More precise imports from @effect/schema
28
- - 1cfa279: More superclass-compatible CoMaps
29
- - 704af7d: Add maxWidth option for loading images
30
- - 460478f: Use effect 3.0
31
- - 6b0418f: Fix image resolution loading
32
- - ed5643a: Fix CoMap \_refs for co.items
33
- - bde684f: CoValue casting & auto-subbing \_owner
34
- - c4151fc: Support stricter TS lint rules
35
- - 63374cc: Relax types of CoMap.\_schema
36
- - 01ac646: Make CoMaps even more subclassable
37
- - a5e68a4: Make refs type more precise
38
- - 952982e: Consistent proxy based API
39
- - 1a35307: Add ability to declare minimum required data in subscribe & Improve property access tracing
40
- - 5fa277c: Fix CoMap.Record.toJSON()
41
- - 60d5ca2: Introduce jazz-tools CLI
42
- - 21771c4: Reintroduce changes from main
43
- - 77c2b56: Get rid of self generics, new create syntax
44
- - 63374cc: Fix schema of Account & Group
45
- - d2e03ff: Fix variance of ID.\_\_type
46
- - 354bdcd: Even friendlier for subclassing CoMap
47
- - 60d5ca2: Clean up exports
48
- - 69ac514: Use effect schema much less
49
- - f8a5c46: Fix CoStream types
50
- - f0f6f1b: Clean up API more & re-add jazz-nodejs
51
- - e5eed5b: Make refs on list more precise
52
- - 1a44f87: Refactoring
53
- - 627d895: Get rid of Co namespace
54
- - 1200aae: Cache CoValue proxies
55
- - 63374cc: Make sure delete on CoMaps deletes keys
56
- - ece35b3: Make fast-check a direct dependency to help dev time resolution
57
- - 38d4410: CoMap fixes and improvements
58
- - 85d2b62: More subclass-friendly types in CoMap
59
- - fd86c11: Extract jazz cli into jazz-run package
60
- - 52675c9: Fix Costream[...].all
61
- - Updated dependencies [1a35307]
62
- - Updated dependencies [96c494f]
63
- - Updated dependencies [19f52b7]
64
- - Updated dependencies [d8fe2b1]
65
- - Updated dependencies [1200aae]
66
- - Updated dependencies [52675c9]
67
- - Updated dependencies [1a35307]
68
- - Updated dependencies [e299c3e]
69
- - Updated dependencies [bf0f8ec]
70
- - Updated dependencies [c4151fc]
71
- - Updated dependencies [8636319]
72
- - Updated dependencies [952982e]
73
- - Updated dependencies [21771c4]
74
- - Updated dependencies [69ac514]
75
- - Updated dependencies [f0f6f1b]
76
- - Updated dependencies [1a44f87]
77
- - Updated dependencies [627d895]
78
- - Updated dependencies [63374cc]
79
- - Updated dependencies [a423eee]
80
- - cojson@0.7.0
81
- - cojson-transport-nodejs-ws@0.7.0
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
- - Fixed bug with newRandomSessionID being called before crypto was ready
88
- - Updated dependencies
89
- - cojson@0.7.0-alpha.42
90
- - cojson-transport-nodejs-ws@0.7.0-alpha.42
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
- - Updated dependencies
97
- - cojson-transport-nodejs-ws@0.7.0-alpha.41
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
- - Updated dependencies
104
- - cojson@0.7.0-alpha.39
105
- - cojson-transport-nodejs-ws@0.7.0-alpha.39
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
- - Fix infinite recursion in subscriptionScope
112
- - Fix type of init param for CoMap.create
113
- - Implement deep loading, simplify API
114
- - Updated dependencies
115
- - cojson@0.7.0-alpha.38
116
- - cojson-transport-nodejs-ws@0.7.0-alpha.38
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
- - Updated dependencies
123
- - cojson@0.7.0-alpha.37
124
- - cojson-transport-nodejs-ws@0.7.0-alpha.37
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
- - 1a35307: Implement first devtools formatters
131
- - 6b0418f: Fix image resolution loading
132
- - 1a35307: Add ability to declare minimum required data in subscribe & Improve property access tracing
133
- - Updated dependencies [1a35307]
134
- - Updated dependencies [1a35307]
135
- - cojson@0.7.0-alpha.36
136
- - cojson-transport-nodejs-ws@0.7.0-alpha.36
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
- - Cache CoValue proxies
143
- - Updated dependencies
144
- - cojson@0.7.0-alpha.35
145
- - cojson-transport-nodejs-ws@0.7.0-alpha.35
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
- - Extract jazz cli into jazz-run package
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
- - Introduce jazz-tools CLI
158
- - Clean up exports
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
- - Get rid of self generics, new create syntax
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
- - CoValue casting & auto-subbing \_owner
182
+ - CoValue casting & auto-subbing \_owner
171
183
 
172
184
  ## 0.7.0-alpha.29
173
185
 
174
186
  ### Patch Changes
175
187
 
176
- - Reintroduce changes from main
177
- - Updated dependencies
178
- - cojson@0.7.0-alpha.29
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
- - Implement profile visibility based on groups & new migration signature
185
- - Updated dependencies
186
- - cojson@0.7.0-alpha.28
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
- - Fix CoList.splice / RawCoList.append
193
- - Fix Costream[...].all
194
- - Updated dependencies
195
- - cojson@0.7.0-alpha.27
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
- - Fix CoMap.Record.toJSON()
213
+ - Fix CoMap.Record.toJSON()
202
214
 
203
215
  ## 0.7.0-alpha.25
204
216
 
205
217
  ### Patch Changes
206
218
 
207
- - Make Account -> Profile a lazy ref schema
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
- - Relax types of CoMap.\_schema
214
- - Fix schema of Account & Group
215
- - Make sure delete on CoMaps deletes keys
216
- - Updated dependencies
217
- - cojson@0.7.0-alpha.24
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
- - CoMap fixes and improvements
235
+ - CoMap fixes and improvements
224
236
 
225
237
  ## 0.7.0-alpha.22
226
238
 
227
239
  ### Patch Changes
228
240
 
229
- - Fix CoMap \_refs for co.items
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
- - Add maxWidth option for loading images
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
- - Make fast-check a direct dependency to help dev time resolution
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
- - More precise imports from @effect/schema
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
- - Use effect 3.0
265
+ - Use effect 3.0
254
266
 
255
267
  ## 0.7.0-alpha.16
256
268
 
257
269
  ### Patch Changes
258
270
 
259
- - Make CoMaps even more subclassable
271
+ - Make CoMaps even more subclassable
260
272
 
261
273
  ## 0.7.0-alpha.15
262
274
 
263
275
  ### Patch Changes
264
276
 
265
- - More superclass-compatible CoMaps
277
+ - More superclass-compatible CoMaps
266
278
 
267
279
  ## 0.7.0-alpha.14
268
280
 
269
281
  ### Patch Changes
270
282
 
271
- - Fix CoStream types
283
+ - Fix CoStream types
272
284
 
273
285
  ## 0.7.0-alpha.13
274
286
 
275
287
  ### Patch Changes
276
288
 
277
- - Add .all to CoStreamEntry
289
+ - Add .all to CoStreamEntry
278
290
 
279
291
  ## 0.7.0-alpha.12
280
292
 
281
293
  ### Patch Changes
282
294
 
283
- - Fix variance of ID.\_\_type
295
+ - Fix variance of ID.\_\_type
284
296
 
285
297
  ## 0.7.0-alpha.11
286
298
 
287
299
  ### Patch Changes
288
300
 
289
- - Support stricter TS lint rules
290
- - Updated dependencies
291
- - cojson@0.7.0-alpha.11
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
- - Clean up API more & re-add jazz-nodejs
298
- - Updated dependencies
299
- - cojson@0.7.0-alpha.10
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
- - Even friendlier for subclassing CoMap
317
+ - Even friendlier for subclassing CoMap
306
318
 
307
319
  ## 0.7.0-alpha.8
308
320
 
309
321
  ### Patch Changes
310
322
 
311
- - More subclass-friendly types in CoMap
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
- - Consistent proxy based API
318
- - Updated dependencies
319
- - cojson@0.7.0-alpha.7
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
- - CoMap fix
337
+ - CoMap fix
326
338
 
327
339
  ## 0.7.0-alpha.5
328
340
 
329
341
  ### Patch Changes
330
342
 
331
- - Refactoring
332
- - Updated dependencies
333
- - cojson@0.7.0-alpha.5
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
- - Make refs on list more precise
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
- - Make refs type more precise
357
+ - Make refs type more precise
346
358
 
347
359
  ## 0.7.0-alpha.2
348
360
 
349
361
  ### Patch Changes
350
362
 
351
- - Get rid of Co namespace
363
+ - Get rid of Co namespace
352
364
 
353
365
  ## 0.7.0-alpha.1
354
366
 
355
367
  ### Patch Changes
356
368
 
357
- - Use effect schema much less
358
- - Updated dependencies
359
- - cojson@0.7.0-alpha.1
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
- - New simplified API
377
+ - New simplified API
366
378
 
367
379
  ### Patch Changes
368
380
 
369
- - Updated dependencies
370
- - cojson@0.7.0-alpha.0
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
- - Fix loading of accounts
377
- - Updated dependencies
378
- - cojson@0.6.5
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
- - Make addMember and removeMember take loaded Accounts instead of just IDs
396
+ - Make addMember and removeMember take loaded Accounts instead of just IDs
385
397
 
386
398
  ### Patch Changes
387
399
 
388
- - Updated dependencies
389
- - cojson@0.6.0
400
+ - Updated dependencies
401
+ - cojson@0.6.0
390
402
 
391
403
  ## 0.5.0
392
404
 
393
405
  ### Minor Changes
394
406
 
395
- - 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.
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
- - Updated dependencies
400
- - cojson@0.5.0
411
+ - Updated dependencies
412
+ - cojson@0.5.0
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023, Garden Computing, Inc.
1
+ Copyright 2024, Garden Computing, Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -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.load(valueID, this, []);
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: { ref: () => Profile, optional: false },
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
  };