@calimero-network/mero-js 29.7.7 → 29.8.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
@@ -3064,16 +3064,33 @@ var CalimeroClient = class _CalimeroClient {
3064
3064
  }
3065
3065
  /**
3066
3066
  * Set capability bits ({@link ORG_CAPABILITIES}): for a member (`account`),
3067
- * for a member of one team (`account` and `team`), or the organization's
3068
- * default (neither). Approved with the caller's `passkey`.
3067
+ * for a member of one team (`account` and `team`), a team's default
3068
+ * (`team` alone, {@link setTeamDefaultCapabilities}), or the
3069
+ * organization's default (neither). Approved with the caller's `passkey`.
3069
3070
  */
3070
3071
  async setCapabilities(org, capabilities, passkey, at = {}) {
3071
3072
  await this.postConfirmed(`orgs/${seg(org)}/capabilities`, { capabilities, ...at }, passkey);
3072
3073
  }
3074
+ /**
3075
+ * Set the capability bits everyone in `team` holds there on top of their
3076
+ * own, unless their row sets its own (`POST /orgs/{org}/capabilities` with
3077
+ * `team` and no `account`): `ORG_CAPABILITIES.INVITE_MEMBERS` is "members
3078
+ * may invite others to this app". The team's managers, or whoever holds
3079
+ * `MANAGE_MEMBERS` on it; approved with the caller's `passkey`
3080
+ * (`__set_default_capabilities { team, capabilities }`).
3081
+ */
3082
+ async setTeamDefaultCapabilities(org, team, capabilities, passkey) {
3083
+ await this.postConfirmed(`orgs/${seg(org)}/capabilities`, { team, capabilities }, passkey);
3084
+ }
3073
3085
  async createTeam(org, name, join, parent) {
3074
3086
  const { teamId } = await this.post(`orgs/${seg(org)}/teams`, { name, join, parent });
3075
3087
  return teamId;
3076
3088
  }
3089
+ /**
3090
+ * A team the caller sees: its rows (each with its effective capabilities),
3091
+ * children, apps, the package it is the app team of and its default
3092
+ * capabilities.
3093
+ */
3077
3094
  getTeam(org, team) {
3078
3095
  return this.get(`orgs/${seg(org)}/teams/${seg(team)}`);
3079
3096
  }
@@ -3115,6 +3132,48 @@ var CalimeroClient = class _CalimeroClient {
3115
3132
  redeemInvite(token) {
3116
3133
  return this.post(`invites/${seg(token)}/redeem`);
3117
3134
  }
3135
+ /**
3136
+ * The organization's pending invites the caller may see (never a token):
3137
+ * every one for an owner or admin, their own, and those naming only teams
3138
+ * they manage. Expired ones are listed (`expired: true`) until revoked. A
3139
+ * caller outside the organization: {@link NotFound}.
3140
+ */
3141
+ async listInvites(org) {
3142
+ const { invites } = await this.get(`orgs/${seg(org)}/invites`);
3143
+ return invites;
3144
+ }
3145
+ /**
3146
+ * Withdraw an invite by its key ({@link listInvites}), approved with the
3147
+ * caller's `passkey` (`__revoke_invite { inviteKey }`). One the caller may
3148
+ * not see: {@link NotFound}.
3149
+ */
3150
+ async revokeInvite(org, inviteKey, passkey) {
3151
+ await this.deleteConfirmed(`orgs/${seg(org)}/invites/${seg(inviteKey)}`, passkey);
3152
+ }
3153
+ // ---------------------------------------------------------------- app teams
3154
+ /**
3155
+ * The organization's mode and its app teams (one per package), for any
3156
+ * member; a guest sees only those they are in. A caller outside the
3157
+ * organization: {@link NotFound}.
3158
+ */
3159
+ listAppTeams(org) {
3160
+ return this.get(`orgs/${seg(org)}/app-teams`);
3161
+ }
3162
+ /**
3163
+ * Give apps their own access lists in one step (owner or admin): find or
3164
+ * make each package's app team, add everyone who reaches its instances now,
3165
+ * and move those instances onto it; with `shared`, close every app team.
3166
+ * Idempotent per package. Approved with the caller's `passkey`
3167
+ * (`__scope_apps { apps, shared }`); a refusal is `400 REJECTED` with the
3168
+ * node's reason. For a fresh standalone install pass
3169
+ * `{ apps: [{ package, name, instances: [] }] }`.
3170
+ */
3171
+ scopeApps(org, passkey, options = {}) {
3172
+ const body = {};
3173
+ if (options.apps !== void 0) body.apps = options.apps;
3174
+ if (options.shared !== void 0) body.shared = options.shared;
3175
+ return this.postConfirmed(`orgs/${seg(org)}/app-teams`, body, passkey);
3176
+ }
3118
3177
  // ---------------------------------------------------------------- deployers
3119
3178
  /**
3120
3179
  * Let an account or organization install apps where the cluster's