jazz-tools 0.13.4 → 0.13.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.13.4 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.13.7 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -11,12 +11,12 @@
11
11
  ESM Build start
12
12
  ESM dist/index.js 1.50 KB
13
13
  ESM dist/testing.js 6.26 KB
14
- ESM dist/chunk-JNC2UVYB.js 127.31 KB
14
+ ESM dist/chunk-VQWUJIL4.js 127.66 KB
15
15
  ESM dist/index.js.map 259.00 B
16
16
  ESM dist/testing.js.map 12.37 KB
17
- ESM dist/chunk-JNC2UVYB.js.map 300.24 KB
18
- ESM ⚡️ Build success in 64ms
17
+ ESM dist/chunk-VQWUJIL4.js.map 300.87 KB
18
+ ESM ⚡️ Build success in 61ms
19
19
 
20
- > jazz-tools@0.13.4 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.13.7 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.13.7
4
+
5
+ ### Patch Changes
6
+
7
+ - bc3d7bb: Allow to assign the writeOnly role to everyone
8
+ - Updated dependencies [bc3d7bb]
9
+ - Updated dependencies [4e9aae1]
10
+ - Updated dependencies [21c935c]
11
+ - Updated dependencies [aa1c80e]
12
+ - Updated dependencies [13074be]
13
+ - cojson@0.13.7
14
+
15
+ ## 0.13.5
16
+
17
+ ### Patch Changes
18
+
19
+ - fe6f561: Gracefully handle unavailable messages error in the Inbox
20
+ - Updated dependencies [e090b39]
21
+ - cojson@0.13.5
22
+
3
23
  ## 0.13.4
4
24
 
5
25
  ### Patch Changes
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2024, Garden Computing, Inc.
1
+ Copyright 2025, 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
@@ -1152,7 +1152,7 @@ function createInboxRoot(account) {
1152
1152
  inviteLink
1153
1153
  };
1154
1154
  }
1155
- function createInboxMessage(payload, inboxOwner) {
1155
+ async function createInboxMessage(payload, inboxOwner) {
1156
1156
  const group = payload._raw.group;
1157
1157
  if (group instanceof RawAccount4) {
1158
1158
  throw new Error("Inbox messages should be owned by a group");
@@ -1164,6 +1164,8 @@ function createInboxMessage(payload, inboxOwner) {
1164
1164
  processed: false,
1165
1165
  error: void 0
1166
1166
  });
1167
+ await payload._raw.core.waitForSync();
1168
+ await message.core.waitForSync();
1167
1169
  return message;
1168
1170
  }
1169
1171
  var Inbox = class _Inbox {
@@ -1236,10 +1238,14 @@ var Inbox = class _Inbox {
1236
1238
  const errors = failed.get(txKey) ?? [];
1237
1239
  const stringifiedError = String(error);
1238
1240
  errors.push(stringifiedError);
1239
- const inboxMessage = node.expectCoValueLoaded(item.value).getCurrentContent();
1240
- inboxMessage.set("error", stringifiedError);
1241
+ let inboxMessage;
1242
+ try {
1243
+ inboxMessage = node.expectCoValueLoaded(item.value).getCurrentContent();
1244
+ inboxMessage.set("error", stringifiedError);
1245
+ } catch (error2) {
1246
+ }
1241
1247
  if (errors.length > retries) {
1242
- inboxMessage.set("processed", true);
1248
+ inboxMessage?.set("processed", true);
1243
1249
  this.processed.push(txKey);
1244
1250
  this.failed.push({ errors, value: item.value });
1245
1251
  } else {
@@ -1256,7 +1262,11 @@ var Inbox = class _Inbox {
1256
1262
  }
1257
1263
  }
1258
1264
  };
1259
- return this.messages.subscribe(handleNewMessages);
1265
+ const unsubscribe = this.messages.subscribe(handleNewMessages);
1266
+ return () => {
1267
+ unsubscribe();
1268
+ clearFailTimer();
1269
+ };
1260
1270
  }
1261
1271
  static async load(account) {
1262
1272
  const profile = account.profile;
@@ -1291,8 +1301,8 @@ var InboxSender = class _InboxSender {
1291
1301
  getOwnerAccount() {
1292
1302
  return this.owner;
1293
1303
  }
1294
- sendMessage(message) {
1295
- const inboxMessage = createInboxMessage(message, this.owner);
1304
+ async sendMessage(message) {
1305
+ const inboxMessage = await createInboxMessage(message, this.owner);
1296
1306
  this.messages.push(inboxMessage.id);
1297
1307
  return new Promise((resolve, reject) => {
1298
1308
  inboxMessage.subscribe((message2) => {
@@ -1957,11 +1967,13 @@ var _Account = class _Account extends CoValueBase {
1957
1967
  { peer1role: "server", peer2role: "client" }
1958
1968
  );
1959
1969
  as._raw.core.node.syncManager.addPeer(connectedPeers[1]);
1960
- return this.create({
1970
+ const account = await this.create({
1961
1971
  creationProps: options.creationProps,
1962
1972
  crypto: as._raw.core.node.crypto,
1963
1973
  peersToLoadFrom: [connectedPeers[0]]
1964
1974
  });
1975
+ await account.waitForAllCoValuesSync();
1976
+ return account;
1965
1977
  }
1966
1978
  static fromNode(node) {
1967
1979
  return new this({
@@ -4431,4 +4443,4 @@ export {
4431
4443
  consumeInviteLink
4432
4444
  };
4433
4445
  /* istanbul ignore file -- @preserve */
4434
- //# sourceMappingURL=chunk-JNC2UVYB.js.map
4446
+ //# sourceMappingURL=chunk-VQWUJIL4.js.map