@calimero-network/mero-js 29.8.0 → 29.9.0

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/index.mjs CHANGED
@@ -2369,6 +2369,29 @@ var CalimeroClient = class _CalimeroClient {
2369
2369
  async signOutEverywhere() {
2370
2370
  await this.signingOut("auth/logout-all");
2371
2371
  }
2372
+ /**
2373
+ * The signed-in account's live sessions, latest active first (at most 256,
2374
+ * `GET /auth/sessions`); `current` marks this one. The account holder's own
2375
+ * session on the cluster's origin only: an API key or a package-bound
2376
+ * session is refused (`403`). A node before core #4894 has no such route
2377
+ * ({@link NotFound}).
2378
+ */
2379
+ async listSessions() {
2380
+ const { sessions } = await this.get("auth/sessions");
2381
+ return sessions;
2382
+ }
2383
+ /**
2384
+ * End one of the signed-in account's sessions (`DELETE
2385
+ * /auth/sessions/{session}`), say a lost phone's, from another; no passkey
2386
+ * is asked. A session the account does not hold live (ended already, or
2387
+ * another account's) is {@link NotFound}; gated as {@link listSessions}.
2388
+ * To end this client's own session ({@link AccountSession.current}) use
2389
+ * {@link signOut}, which also drops its tokens: ended here, they stay
2390
+ * held and the next request or refresh is {@link LoginRequired}.
2391
+ */
2392
+ async revokeSession(session) {
2393
+ await this.delete(`auth/sessions/${seg(session)}`);
2394
+ }
2372
2395
  async signingOut(path) {
2373
2396
  try {
2374
2397
  await this.post(path);
@@ -2628,7 +2651,10 @@ var CalimeroClient = class _CalimeroClient {
2628
2651
  }
2629
2652
  /**
2630
2653
  * Hand the app to another account (an organization's app only to one of its
2631
- * members). The owner approves with `passkey`.
2654
+ * members), approved with `passkey`. The app's owner may; for an
2655
+ * organization's app, its owner only while a member of the organization
2656
+ * (`member` or above), and the organization's admins (`admin`, `owner`)
2657
+ * too, so an organization can hand on an app whose owner left (core #4893).
2632
2658
  */
2633
2659
  async transferApp(app, to, passkey) {
2634
2660
  await this.postConfirmed(`apps/${seg(app)}/transfer`, { to }, passkey);
@@ -3101,9 +3127,17 @@ var CalimeroClient = class _CalimeroClient {
3101
3127
  async updateTeam(org, team, update) {
3102
3128
  await this.post(`orgs/${seg(org)}/teams/${seg(team)}`, update);
3103
3129
  }
3104
- /** Delete a team, the teams below it and their apps. */
3105
- async deleteTeam(org, team) {
3106
- await this.delete(`orgs/${seg(org)}/teams/${seg(team)}`);
3130
+ /**
3131
+ * Delete a team, the teams below it and their apps. When any of those
3132
+ * teams holds apps the node asks for the caller's passkey (`412
3133
+ * CONFIRM_REQUIRED`, its details listing the `apps` that go, which the
3134
+ * approval names; an app added after it is refused), which `passkey` gives.
3135
+ * Without one that `412` reaches the caller as {@link ConfirmRequired}. A
3136
+ * team with no apps is deleted without a passkey.
3137
+ */
3138
+ async deleteTeam(org, team, passkey) {
3139
+ const path = `orgs/${seg(org)}/teams/${seg(team)}`;
3140
+ await (passkey ? this.deleteConfirmed(path, passkey) : this.delete(path));
3107
3141
  }
3108
3142
  /**
3109
3143
  * Add a member to a team, or change their row: role, lead, capability bits.