jazz-tools 0.19.5 → 0.19.7

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.
Files changed (54) hide show
  1. package/.turbo/turbo-build.log +56 -56
  2. package/CHANGELOG.md +24 -0
  3. package/dist/{chunk-DFFRRRRF.js → chunk-CUS6O5NE.js} +73 -19
  4. package/dist/chunk-CUS6O5NE.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/inspector/index.d.ts +1 -1
  7. package/dist/inspector/index.d.ts.map +1 -1
  8. package/dist/inspector/index.js +8 -1
  9. package/dist/inspector/index.js.map +1 -1
  10. package/dist/react-core/hooks.d.ts +2 -1
  11. package/dist/react-core/hooks.d.ts.map +1 -1
  12. package/dist/react-core/index.js +39 -15
  13. package/dist/react-core/index.js.map +1 -1
  14. package/dist/react-native-core/crypto/RNQuickCrypto.d.ts +3 -1
  15. package/dist/react-native-core/crypto/RNQuickCrypto.d.ts.map +1 -1
  16. package/dist/react-native-core/crypto.js +23 -1
  17. package/dist/react-native-core/crypto.js.map +1 -1
  18. package/dist/testing.js +1 -1
  19. package/dist/tools/coValues/CoValueBase.d.ts +2 -1
  20. package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
  21. package/dist/tools/coValues/account.d.ts +3 -2
  22. package/dist/tools/coValues/account.d.ts.map +1 -1
  23. package/dist/tools/coValues/interfaces.d.ts +8 -0
  24. package/dist/tools/coValues/interfaces.d.ts.map +1 -1
  25. package/dist/tools/exports.d.ts +1 -1
  26. package/dist/tools/exports.d.ts.map +1 -1
  27. package/dist/tools/implementation/anonymousJazzAgent.d.ts +5 -0
  28. package/dist/tools/implementation/anonymousJazzAgent.d.ts.map +1 -1
  29. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +3 -3
  30. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
  31. package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
  32. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  33. package/dist/tools/testing.d.ts.map +1 -1
  34. package/dist/tools/tests/utils.d.ts +6 -1
  35. package/dist/tools/tests/utils.d.ts.map +1 -1
  36. package/package.json +5 -5
  37. package/src/inspector/index.tsx +10 -1
  38. package/src/react-core/hooks.ts +65 -21
  39. package/src/react-core/tests/useCoState.test.ts +102 -2
  40. package/src/react-native-core/crypto/RNQuickCrypto.ts +32 -2
  41. package/src/tools/coValues/CoValueBase.ts +11 -1
  42. package/src/tools/coValues/account.ts +30 -6
  43. package/src/tools/coValues/interfaces.ts +25 -1
  44. package/src/tools/exports.ts +1 -0
  45. package/src/tools/implementation/anonymousJazzAgent.ts +21 -1
  46. package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +9 -4
  47. package/src/tools/subscribe/SubscriptionScope.ts +16 -9
  48. package/src/tools/tests/account.test.ts +65 -0
  49. package/src/tools/tests/coDiscriminatedUnion.test.ts +69 -2
  50. package/src/tools/tests/exportImport.test.ts +78 -0
  51. package/src/tools/tests/groupsAndAccounts.test.ts +21 -20
  52. package/src/tools/tests/schema.resolved.test.ts +26 -19
  53. package/src/tools/tests/utils.ts +27 -0
  54. package/dist/chunk-DFFRRRRF.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.19.5 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.19.7 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types && pnpm build:svelte
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts","tools/ssr":"src/tools/ssr/index.ts"}
@@ -107,105 +107,105 @@
107
107
  ESM Build start
108
108
  CLI Cleaning output folder
109
109
  ESM Build start
110
- ESM dist/tiptap/index.js 564.00 B
111
- ESM dist/tiptap/index.js.map 1.21 KB
112
- ESM ⚡️ Build success in 74ms
113
110
  ESM dist/worker/index.js 3.19 KB
114
- ESM dist/worker/edge-wasm.js 215.00 B
115
111
  ESM dist/worker/napi-crypto.js 110.00 B
112
+ ESM dist/worker/edge-wasm.js 215.00 B
116
113
  ESM dist/worker/index.js.map 6.24 KB
117
- ESM dist/worker/edge-wasm.js.map 434.00 B
118
114
  ESM dist/worker/napi-crypto.js.map 162.00 B
119
- ESM ⚡️ Build success in 73ms
115
+ ESM dist/worker/edge-wasm.js.map 434.00 B
116
+ ESM ⚡️ Build success in 39ms
117
+ ESM dist/tiptap/index.js 564.00 B
118
+ ESM dist/tiptap/index.js.map 1.21 KB
119
+ ESM ⚡️ Build success in 54ms
120
120
  ESM dist/better-auth/auth/client.js 4.50 KB
121
121
  ESM dist/better-auth/auth/server.js 8.36 KB
122
122
  ESM dist/better-auth/auth/react.js 799.00 B
123
123
  ESM dist/better-auth/auth/client.js.map 8.32 KB
124
124
  ESM dist/better-auth/auth/server.js.map 15.31 KB
125
125
  ESM dist/better-auth/auth/react.js.map 2.04 KB
126
- ESM ⚡️ Build success in 64ms
126
+ ESM ⚡️ Build success in 43ms
127
+ ESM dist/react-native/index.js 2.53 KB
128
+ ESM dist/react-native/testing.js 120.00 B
129
+ ESM dist/react-native/crypto.js 161.00 B
130
+ ESM dist/react-native/testing.js.map 176.00 B
131
+ ESM dist/react-native/index.js.map 5.68 KB
132
+ ESM dist/react-native/crypto.js.map 197.00 B
133
+ ESM ⚡️ Build success in 45ms
127
134
  ESM dist/media/index.js 236.00 B
135
+ ESM dist/media/index.server.js 2.95 KB
128
136
  ESM dist/media/index.browser.js 2.79 KB
129
137
  ESM dist/media/index.native.js 4.01 KB
130
- ESM dist/media/index.server.js 2.95 KB
131
138
  ESM dist/media/chunk-3LKBM3G3.js 6.69 KB
132
139
  ESM dist/media/index.js.map 71.00 B
133
140
  ESM dist/media/index.browser.js.map 6.15 KB
134
141
  ESM dist/media/index.server.js.map 6.37 KB
135
142
  ESM dist/media/index.native.js.map 8.10 KB
136
143
  ESM dist/media/chunk-3LKBM3G3.js.map 16.99 KB
137
- ESM ⚡️ Build success in 74ms
144
+ ESM ⚡️ Build success in 50ms
145
+ ESM dist/expo/index.js 4.68 KB
146
+ ESM dist/expo/testing.js 112.00 B
147
+ ESM dist/expo/crypto.js 153.00 B
148
+ ESM dist/expo/testing.js.map 168.00 B
149
+ ESM dist/expo/index.js.map 10.23 KB
150
+ ESM dist/expo/crypto.js.map 189.00 B
151
+ ESM ⚡️ Build success in 42ms
152
+ ESM dist/browser/index.js 14.06 KB
153
+ ESM dist/browser/index.js.map 29.94 KB
154
+ ESM ⚡️ Build success in 52ms
138
155
  ESM dist/react-core/testing.js 1.22 KB
139
- ESM dist/react-core/index.js 13.77 KB
140
156
  ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
157
+ ESM dist/react-core/index.js 14.41 KB
141
158
  ESM dist/react-core/testing.js.map 1.86 KB
142
159
  ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
143
- ESM dist/react-core/index.js.map 39.33 KB
144
- ESM ⚡️ Build success in 71ms
145
- ESM dist/react-native/index.js 2.53 KB
146
- ESM dist/react-native/testing.js 120.00 B
147
- ESM dist/react-native/crypto.js 161.00 B
148
- ESM dist/react-native/index.js.map 5.68 KB
149
- ESM dist/react-native/testing.js.map 176.00 B
150
- ESM dist/react-native/crypto.js.map 197.00 B
151
- ESM ⚡️ Build success in 70ms
152
- ESM dist/browser/index.js 14.06 KB
153
- ESM dist/browser/index.js.map 29.94 KB
154
- ESM ⚡️ Build success in 94ms
155
- ESM dist/react-native-core/index.js 18.97 KB
160
+ ESM dist/react-core/index.js.map 40.79 KB
161
+ ESM ⚡️ Build success in 48ms
156
162
  ESM dist/react-native-core/testing.js 119.00 B
157
- ESM dist/react-native-core/crypto.js 2.10 KB
158
- ESM dist/react-native-core/index.js.map 38.60 KB
163
+ ESM dist/react-native-core/index.js 18.97 KB
164
+ ESM dist/react-native-core/crypto.js 2.58 KB
159
165
  ESM dist/react-native-core/testing.js.map 175.00 B
160
- ESM dist/react-native-core/crypto.js.map 4.25 KB
161
- ESM ⚡️ Build success in 91ms
162
- ESM dist/react/testing.js 122.00 B
166
+ ESM dist/react-native-core/index.js.map 38.60 KB
167
+ ESM dist/react-native-core/crypto.js.map 5.25 KB
168
+ ESM ⚡️ Build success in 62ms
169
+ ESM dist/prosemirror/index.js 77.76 KB
170
+ ESM dist/prosemirror/index.js.map 307.20 KB
171
+ ESM ⚡️ Build success in 69ms
172
+ ESM dist/better-auth/database-adapter/index.js 26.65 KB
173
+ ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
174
+ ESM ⚡️ Build success in 56ms
163
175
  ESM dist/react/index.js 25.74 KB
176
+ ESM dist/react/testing.js 122.00 B
164
177
  ESM dist/react/ssr.js 697.00 B
165
178
  ESM dist/react/testing.js.map 165.00 B
166
179
  ESM dist/react/ssr.js.map 1.11 KB
167
180
  ESM dist/react/index.js.map 55.43 KB
168
- ESM ⚡️ Build success in 84ms
169
- ESM dist/expo/index.js 4.68 KB
170
- ESM dist/expo/testing.js 112.00 B
171
- ESM dist/expo/crypto.js 153.00 B
172
- ESM dist/expo/index.js.map 10.23 KB
173
- ESM dist/expo/testing.js.map 168.00 B
174
- ESM dist/expo/crypto.js.map 189.00 B
175
- ESM ⚡️ Build success in 110ms
176
- ESM dist/better-auth/database-adapter/index.js 26.65 KB
177
- ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
178
- ESM ⚡️ Build success in 101ms
179
- ESM dist/prosemirror/index.js 77.76 KB
180
- ESM dist/prosemirror/index.js.map 307.20 KB
181
- ESM ⚡️ Build success in 124ms
182
- ESM dist/inspector/index.js 125.62 KB
183
- ESM dist/inspector/index.js.map 215.96 KB
184
- ESM ⚡️ Build success in 154ms
185
- ESM dist/tools/ssr.js 156.00 B
186
- ESM dist/chunk-M2HGBOXS.js 694.00 B
181
+ ESM ⚡️ Build success in 60ms
182
+ ESM dist/inspector/index.js 125.80 KB
183
+ ESM dist/inspector/index.js.map 216.33 KB
184
+ ESM ⚡️ Build success in 86ms
187
185
  ESM dist/testing.js 8.51 KB
188
186
  ESM dist/chunk-PZ5AY32C.js 233.00 B
187
+ ESM dist/chunk-M2HGBOXS.js 694.00 B
189
188
  ESM dist/index.js 29.30 KB
190
- ESM dist/chunk-DFFRRRRF.js 202.73 KB
191
- ESM dist/chunk-M2HGBOXS.js.map 1.10 KB
189
+ ESM dist/tools/ssr.js 156.00 B
190
+ ESM dist/chunk-CUS6O5NE.js 204.35 KB
192
191
  ESM dist/testing.js.map 16.17 KB
192
+ ESM dist/chunk-M2HGBOXS.js.map 1.10 KB
193
193
  ESM dist/chunk-PZ5AY32C.js.map 71.00 B
194
194
  ESM dist/tools/ssr.js.map 71.00 B
195
- ESM dist/chunk-DFFRRRRF.js.map 477.64 KB
196
195
  ESM dist/index.js.map 60.30 KB
197
- ESM ⚡️ Build success in 208ms
196
+ ESM dist/chunk-CUS6O5NE.js.map 481.42 KB
197
+ ESM ⚡️ Build success in 97ms
198
198
  ESM dist/inspector/register-custom-element.js 218.00 B
199
- ESM dist/inspector/custom-element-P76EIWEV.js 1.60 MB
200
199
  ESM dist/inspector/register-custom-element.js.map 314.00 B
200
+ ESM dist/inspector/custom-element-P76EIWEV.js 1.60 MB
201
201
  ESM dist/inspector/custom-element-P76EIWEV.js.map 2.45 MB
202
- ESM ⚡️ Build success in 229ms
202
+ ESM ⚡️ Build success in 157ms
203
203
 
204
- > jazz-tools@0.19.5 types /home/runner/_work/jazz/jazz/packages/jazz-tools
204
+ > jazz-tools@0.19.7 types /home/runner/_work/jazz/jazz/packages/jazz-tools
205
205
  > tsc --outDir dist
206
206
 
207
207
 
208
- > jazz-tools@0.19.5 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
208
+ > jazz-tools@0.19.7 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
209
209
  > rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
210
210
 
211
211
  src/svelte -> dist/svelte
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.19.7
4
+
5
+ ### Patch Changes
6
+
7
+ - e113a79: Avoid migrating unauthorized CoValues
8
+ - cojson@0.19.7
9
+ - cojson-storage-indexeddb@0.19.7
10
+ - cojson-transport-ws@0.19.7
11
+
12
+ ## 0.19.6
13
+
14
+ ### Patch Changes
15
+
16
+ - 23782f0: Upgraded `react-native-quick-crypto` to version 1.0.0-beta.21 and switch to using the native blake3 in RNQuickCrypto
17
+
18
+ Breaking: any app that uses RNQuickCrypto will have to upgrade to `react-native-quick-crypto@1.0.0-beta.21`
19
+
20
+ - 56d74e4: Make createAs a public API that can be used to create controlled accounts from workers
21
+ - bc9120b: - Added value.$jazz.export() API and preloaded option in React hooks, to make it possible to pass raw covalue data from React server components to client components
22
+ - Prevent the inspector from rendering during SSR
23
+ - cojson@0.19.6
24
+ - cojson-storage-indexeddb@0.19.6
25
+ - cojson-transport-ws@0.19.6
26
+
3
27
  ## 0.19.5
4
28
 
5
29
  ### Patch Changes
@@ -240,6 +240,12 @@ var CoValueJazzApi = class {
240
240
  }
241
241
  unstable_mergeBranch(subscriptionScope);
242
242
  }
243
+ export() {
244
+ const subscriptionScope = getSubscriptionScope(this.coValue);
245
+ return exportCoValueFromSubscription(
246
+ subscriptionScope
247
+ );
248
+ }
243
249
  };
244
250
 
245
251
  // src/tools/implementation/inspect.ts
@@ -2160,7 +2166,7 @@ import {
2160
2166
  cojsonInternals as cojsonInternals2,
2161
2167
  isAccountRole
2162
2168
  } from "cojson";
2163
- var Account = class extends CoValueBase {
2169
+ var _Account = class _Account extends CoValueBase {
2164
2170
  constructor(options) {
2165
2171
  super();
2166
2172
  if (!("fromRaw" in options)) {
@@ -2288,20 +2294,34 @@ var Account = class extends CoValueBase {
2288
2294
  /**
2289
2295
  * @deprecated Use `co.account(...).createAs` instead.
2290
2296
  */
2291
- static async createAs(as, options) {
2297
+ static async createAs(worker, options) {
2298
+ const crypto = worker.$jazz.localNode.crypto;
2292
2299
  const connectedPeers = cojsonInternals2.connectedPeers(
2293
2300
  "creatingAccount",
2294
- "createdAccount",
2301
+ crypto.uniquenessForHeader(),
2302
+ // Use a unique id for the client peer, so we don't have clashes in the worker node
2295
2303
  { peer1role: "server", peer2role: "client" }
2296
2304
  );
2297
- as.$jazz.localNode.syncManager.addPeer(connectedPeers[1]);
2305
+ worker.$jazz.localNode.syncManager.addPeer(connectedPeers[1]);
2298
2306
  const account = await this.create({
2299
2307
  creationProps: options.creationProps,
2300
- crypto: as.$jazz.localNode.crypto,
2308
+ crypto,
2301
2309
  peers: [connectedPeers[0]]
2302
2310
  });
2311
+ const loadedWorker = await _Account.load(worker.$jazz.id, {
2312
+ loadAs: account
2313
+ });
2314
+ if (!loadedWorker.$isLoaded)
2315
+ throw new Error("Unable to load the worker account");
2316
+ if (options.onCreate) await options.onCreate(account, loadedWorker);
2303
2317
  await account.$jazz.waitForAllCoValuesSync();
2304
- return account;
2318
+ const createdAccount = await this.load(account.$jazz.id, {
2319
+ loadAs: worker
2320
+ });
2321
+ if (!createdAccount.$isLoaded)
2322
+ throw new Error("Unable to load the created account");
2323
+ account.$jazz.localNode.gracefulShutdown();
2324
+ return createdAccount;
2305
2325
  }
2306
2326
  static fromNode(node) {
2307
2327
  return new this({
@@ -2352,7 +2372,7 @@ var Account = class extends CoValueBase {
2352
2372
  }
2353
2373
  };
2354
2374
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2355
- Account._schema = {
2375
+ _Account._schema = {
2356
2376
  profile: {
2357
2377
  ref: () => Profile,
2358
2378
  optional: false
@@ -2362,6 +2382,7 @@ Account._schema = {
2362
2382
  optional: true
2363
2383
  }
2364
2384
  };
2385
+ var Account = _Account;
2365
2386
  var AccountJazzApi = class extends CoValueJazzApi {
2366
2387
  constructor(account, raw) {
2367
2388
  super(account);
@@ -3636,6 +3657,7 @@ var VectorCalculation = {
3636
3657
  };
3637
3658
 
3638
3659
  // src/tools/implementation/anonymousJazzAgent.ts
3660
+ import { isAccountRole as isAccountRole3 } from "cojson";
3639
3661
  var _a;
3640
3662
  _a = TypeSym;
3641
3663
  var AnonymousJazzAgent = class {
@@ -3643,6 +3665,23 @@ var AnonymousJazzAgent = class {
3643
3665
  this.node = node;
3644
3666
  this[_a] = "Anonymous";
3645
3667
  }
3668
+ canWrite(_) {
3669
+ return false;
3670
+ }
3671
+ canRead(value) {
3672
+ const valueOwner = value.$jazz.owner;
3673
+ if (!valueOwner) {
3674
+ return true;
3675
+ }
3676
+ const role = valueOwner.getRoleOf("everyone");
3677
+ return isAccountRole3(role);
3678
+ }
3679
+ canManage(_) {
3680
+ return false;
3681
+ }
3682
+ canAdmin(_) {
3683
+ return false;
3684
+ }
3646
3685
  };
3647
3686
 
3648
3687
  // src/tools/implementation/activeAccountContext.ts
@@ -4217,7 +4256,7 @@ var SubscriptionScope = class _SubscriptionScope {
4217
4256
  this.handleUpdate(value);
4218
4257
  return;
4219
4258
  }
4220
- if (!this.migrated && value !== CoValueLoadingState.UNAVAILABLE) {
4259
+ if (!this.migrated && value !== CoValueLoadingState.UNAVAILABLE && hasAccessToCoValue(value)) {
4221
4260
  if (this.migrating) {
4222
4261
  return;
4223
4262
  }
@@ -4258,9 +4297,7 @@ var SubscriptionScope = class _SubscriptionScope {
4258
4297
  this.triggerUpdate();
4259
4298
  return;
4260
4299
  }
4261
- const ruleset = update.core.verified.header.ruleset;
4262
- const hasAccess = ruleset.type !== "ownedByGroup" || myRoleForRawValue(update) !== void 0;
4263
- if (!hasAccess) {
4300
+ if (!hasAccessToCoValue(update)) {
4264
4301
  if (this.value.type !== CoValueLoadingState.UNAUTHORIZED) {
4265
4302
  this.updateValue(
4266
4303
  new JazzError(this.id, CoValueLoadingState.UNAUTHORIZED, [
@@ -4661,6 +4698,10 @@ var SubscriptionScope = class _SubscriptionScope {
4661
4698
  this.childNodes.forEach((child) => child.destroy());
4662
4699
  }
4663
4700
  };
4701
+ function hasAccessToCoValue(rawCoValue) {
4702
+ const ruleset = rawCoValue.core.verified.header.ruleset;
4703
+ return ruleset.type !== "ownedByGroup" || myRoleForRawValue(rawCoValue) !== void 0;
4704
+ }
4664
4705
 
4665
4706
  // src/tools/subscribe/index.ts
4666
4707
  function getSubscriptionScope(value) {
@@ -4720,7 +4761,7 @@ function accessChildById(parent, childId, schema) {
4720
4761
 
4721
4762
  // src/tools/implementation/createContext.ts
4722
4763
  import {
4723
- LocalNode as LocalNode4
4764
+ LocalNode as LocalNode5
4724
4765
  } from "cojson";
4725
4766
  async function randomSessionProvider(accountID, crypto) {
4726
4767
  return {
@@ -4745,7 +4786,7 @@ async function createJazzContextFromExistingCredentials({
4745
4786
  );
4746
4787
  const CurrentAccountSchema = PropsAccountSchema ?? RegisteredSchemas["Account"];
4747
4788
  const AccountClass = coValueClassFromCoValueClassOrSchema(CurrentAccountSchema);
4748
- const node = await LocalNode4.withLoadedAccount({
4789
+ const node = await LocalNode5.withLoadedAccount({
4749
4790
  accountID: credentials.accountID,
4750
4791
  accountSecret: credentials.secret,
4751
4792
  sessionID,
@@ -4789,7 +4830,7 @@ async function createJazzContextForNewAccount({
4789
4830
  }) {
4790
4831
  const CurrentAccountSchema = PropsAccountSchema ?? RegisteredSchemas["Account"];
4791
4832
  const AccountClass = coValueClassFromCoValueClassOrSchema(CurrentAccountSchema);
4792
- const { node } = await LocalNode4.withNewlyCreatedAccount({
4833
+ const { node } = await LocalNode5.withNewlyCreatedAccount({
4793
4834
  creationProps,
4794
4835
  peers,
4795
4836
  crypto,
@@ -4874,7 +4915,7 @@ function createAnonymousJazzContext({
4874
4915
  storage
4875
4916
  }) {
4876
4917
  const agentSecret = crypto.newRandomAgentSecret();
4877
- const node = new LocalNode4(
4918
+ const node = new LocalNode5(
4878
4919
  agentSecret,
4879
4920
  crypto.newRandomSessionID(crypto.getAgentID(agentSecret)),
4880
4921
  crypto
@@ -5675,9 +5716,9 @@ var AccountSchema = class _AccountSchema {
5675
5716
  withSchemaResolveQuery(options, this.resolveQuery)
5676
5717
  );
5677
5718
  }
5678
- /** @internal */
5679
- createAs(as, options) {
5680
- return this.coValueClass.createAs(as, options);
5719
+ // Create an account via worker, useful to generate controlled accounts from the server
5720
+ createAs(worker, options) {
5721
+ return this.coValueClass.createAs(worker, options);
5681
5722
  }
5682
5723
  unstable_merge(id, options) {
5683
5724
  return unstable_mergeBranchWithResolve(
@@ -6878,6 +6919,19 @@ async function exportCoValue(cls, id, options) {
6878
6919
  loadContentPiecesFromSubscription(rootNode, valuesExported, contentPieces);
6879
6920
  return contentPieces;
6880
6921
  }
6922
+ function exportCoValueFromSubscription(subscription) {
6923
+ const valuesExported = /* @__PURE__ */ new Set();
6924
+ const contentPieces = [];
6925
+ loadContentPiecesFromSubscription(
6926
+ subscription,
6927
+ valuesExported,
6928
+ contentPieces
6929
+ );
6930
+ return {
6931
+ id: subscription.id,
6932
+ contentPieces
6933
+ };
6934
+ }
6881
6935
  function loadContentPiecesFromSubscription(subscription, valuesExported, contentPieces) {
6882
6936
  if (valuesExported.has(subscription.id)) {
6883
6937
  return;
@@ -7008,4 +7062,4 @@ export {
7008
7062
  JazzContextManager
7009
7063
  };
7010
7064
  /* istanbul ignore file -- @preserve */
7011
- //# sourceMappingURL=chunk-DFFRRRRF.js.map
7065
+ //# sourceMappingURL=chunk-CUS6O5NE.js.map