@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.cjs CHANGED
@@ -2502,6 +2502,29 @@ var CalimeroClient = class _CalimeroClient {
2502
2502
  async signOutEverywhere() {
2503
2503
  await this.signingOut("auth/logout-all");
2504
2504
  }
2505
+ /**
2506
+ * The signed-in account's live sessions, latest active first (at most 256,
2507
+ * `GET /auth/sessions`); `current` marks this one. The account holder's own
2508
+ * session on the cluster's origin only: an API key or a package-bound
2509
+ * session is refused (`403`). A node before core #4894 has no such route
2510
+ * ({@link NotFound}).
2511
+ */
2512
+ async listSessions() {
2513
+ const { sessions } = await this.get("auth/sessions");
2514
+ return sessions;
2515
+ }
2516
+ /**
2517
+ * End one of the signed-in account's sessions (`DELETE
2518
+ * /auth/sessions/{session}`), say a lost phone's, from another; no passkey
2519
+ * is asked. A session the account does not hold live (ended already, or
2520
+ * another account's) is {@link NotFound}; gated as {@link listSessions}.
2521
+ * To end this client's own session ({@link AccountSession.current}) use
2522
+ * {@link signOut}, which also drops its tokens: ended here, they stay
2523
+ * held and the next request or refresh is {@link LoginRequired}.
2524
+ */
2525
+ async revokeSession(session) {
2526
+ await this.delete(`auth/sessions/${seg(session)}`);
2527
+ }
2505
2528
  async signingOut(path) {
2506
2529
  try {
2507
2530
  await this.post(path);
@@ -2761,7 +2784,10 @@ var CalimeroClient = class _CalimeroClient {
2761
2784
  }
2762
2785
  /**
2763
2786
  * Hand the app to another account (an organization's app only to one of its
2764
- * members). The owner approves with `passkey`.
2787
+ * members), approved with `passkey`. The app's owner may; for an
2788
+ * organization's app, its owner only while a member of the organization
2789
+ * (`member` or above), and the organization's admins (`admin`, `owner`)
2790
+ * too, so an organization can hand on an app whose owner left (core #4893).
2765
2791
  */
2766
2792
  async transferApp(app, to, passkey) {
2767
2793
  await this.postConfirmed(`apps/${seg(app)}/transfer`, { to }, passkey);
@@ -3234,9 +3260,17 @@ var CalimeroClient = class _CalimeroClient {
3234
3260
  async updateTeam(org, team, update) {
3235
3261
  await this.post(`orgs/${seg(org)}/teams/${seg(team)}`, update);
3236
3262
  }
3237
- /** Delete a team, the teams below it and their apps. */
3238
- async deleteTeam(org, team) {
3239
- await this.delete(`orgs/${seg(org)}/teams/${seg(team)}`);
3263
+ /**
3264
+ * Delete a team, the teams below it and their apps. When any of those
3265
+ * teams holds apps the node asks for the caller's passkey (`412
3266
+ * CONFIRM_REQUIRED`, its details listing the `apps` that go, which the
3267
+ * approval names; an app added after it is refused), which `passkey` gives.
3268
+ * Without one that `412` reaches the caller as {@link ConfirmRequired}. A
3269
+ * team with no apps is deleted without a passkey.
3270
+ */
3271
+ async deleteTeam(org, team, passkey) {
3272
+ const path = `orgs/${seg(org)}/teams/${seg(team)}`;
3273
+ await (passkey ? this.deleteConfirmed(path, passkey) : this.delete(path));
3240
3274
  }
3241
3275
  /**
3242
3276
  * Add a member to a team, or change their row: role, lead, capability bits.