jazz-tools 0.13.3 → 0.13.5

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.3 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.13.5 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-YZW2QELD.js 127.20 KB
14
+ ESM dist/chunk-IYNL2EJM.js 127.59 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-YZW2QELD.js.map 300.00 KB
18
- ESM ⚡️ Build success in 67ms
17
+ ESM dist/chunk-IYNL2EJM.js.map 300.73 KB
18
+ ESM ⚡️ Build success in 69ms
19
19
 
20
- > jazz-tools@0.13.3 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.13.5 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.13.5
4
+
5
+ ### Patch Changes
6
+
7
+ - fe6f561: Gracefully handle unavailable messages error in the Inbox
8
+ - Updated dependencies [e090b39]
9
+ - cojson@0.13.5
10
+
11
+ ## 0.13.4
12
+
13
+ ### Patch Changes
14
+
15
+ - 3129982: Add logOutReplacement hook to replace the Jazz logout function with a custom one
16
+
3
17
  ## 0.13.3
4
18
 
5
19
  ### Patch Changes
@@ -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) => {
@@ -3947,8 +3957,12 @@ var JazzContextManager = class {
3947
3957
  return;
3948
3958
  }
3949
3959
  await this.props.onLogOut?.();
3950
- await this.context.logOut();
3951
- return this.createContext(this.props);
3960
+ if (this.props.logOutReplacement) {
3961
+ await this.props.logOutReplacement();
3962
+ } else {
3963
+ await this.context.logOut();
3964
+ return this.createContext(this.props);
3965
+ }
3952
3966
  };
3953
3967
  this.done = () => {
3954
3968
  if (!this.context) {
@@ -4427,4 +4441,4 @@ export {
4427
4441
  consumeInviteLink
4428
4442
  };
4429
4443
  /* istanbul ignore file -- @preserve */
4430
- //# sourceMappingURL=chunk-YZW2QELD.js.map
4444
+ //# sourceMappingURL=chunk-IYNL2EJM.js.map