@peer2peer/cli 0.1.1 → 0.1.2

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.
package/dist/social.js CHANGED
@@ -294,10 +294,21 @@ export async function onUnfriendKind(app, env, r) {
294
294
  return [makeEvent(env, "p2p.unfriend", r.envelope.ts, { from: await fromOf(app, r), peer: r.envelope.from })];
295
295
  }
296
296
  async function afterUnfriend(app, peer) {
297
+ // Only when it ended the last friendship with them (issue #3). An unfriend that arrives after a
298
+ // re-friend (a late copy, another device's, one queued while this device was away) ends only the
299
+ // friendships invited at or before it: the new one stands, and so must the caps it exchanged
300
+ // (caps name no friendship). Revoking them anyway left a "friend" neither side could message.
301
+ if (await stillFriends(app, peer))
302
+ return;
297
303
  const caps = await capsToRevokeOnUnfriend(app.store, peer);
298
304
  await app.revokeCaps(caps).catch(() => 0);
299
305
  await app.store.removeCapsHeld((c) => c.iss === peer);
300
306
  }
307
+ /** A friendship with `peer` that no unfriend this device holds ends. */
308
+ async function stillFriends(app, peer) {
309
+ const unfriends = await app.store.listUnfriends();
310
+ return (await liveFriendshipsV3(app.store, app.signerCtx())).some((f) => (f.inviter === peer || f.invitee === peer) && !unfriends.some((u) => unfriendApplies(f, u)));
311
+ }
301
312
  export async function unfriend(app, who) {
302
313
  const peer = await app.resolveUser(who);
303
314
  // Handle what's queued first: it was sent while we were still friends.
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.1";
1
+ export declare const VERSION = "0.1.2";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  //
3
3
  // This CLI's version (scripts/set-version.mjs writes it), on its own so the status and identity
4
4
  // code can advertise it (features.ts) without importing the command line.
5
- export const VERSION = "0.1.1";
5
+ export const VERSION = "0.1.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer2peer/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The standalone Peer2Peer v3 CLI (`p2p`): an account-free identity, friends, circles, end-to-end encrypted session messaging and status over open relays",
5
5
  "keywords": [
6
6
  "peer2peer",
@@ -53,10 +53,13 @@
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
55
  "dependencies": {
56
- "@peer2peer/codex-bridge": "0.1.1",
57
- "@peer2peer/core": "0.1.1",
56
+ "@peer2peer/codex-bridge": "0.1.2",
57
+ "@peer2peer/core": "0.1.2",
58
58
  "commander": "15.0.0",
59
59
  "uqr": "0.1.3",
60
60
  "ws": "8.22.0"
61
+ },
62
+ "overrides": {
63
+ "minimatch": "^11.0.8"
61
64
  }
62
65
  }