@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/README.md +1 -1
- package/dist/cloud-v2/client.d.ts +160 -3
- package/dist/cloud-v2/client.js +65 -2
- package/dist/cloud-v2/index.d.ts +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +61 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +61 -2
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3197,16 +3197,33 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
3197
3197
|
}
|
|
3198
3198
|
/**
|
|
3199
3199
|
* Set capability bits ({@link ORG_CAPABILITIES}): for a member (`account`),
|
|
3200
|
-
* for a member of one team (`account` and `team`),
|
|
3201
|
-
*
|
|
3200
|
+
* for a member of one team (`account` and `team`), a team's default
|
|
3201
|
+
* (`team` alone, {@link setTeamDefaultCapabilities}), or the
|
|
3202
|
+
* organization's default (neither). Approved with the caller's `passkey`.
|
|
3202
3203
|
*/
|
|
3203
3204
|
async setCapabilities(org, capabilities, passkey, at = {}) {
|
|
3204
3205
|
await this.postConfirmed(`orgs/${seg(org)}/capabilities`, { capabilities, ...at }, passkey);
|
|
3205
3206
|
}
|
|
3207
|
+
/**
|
|
3208
|
+
* Set the capability bits everyone in `team` holds there on top of their
|
|
3209
|
+
* own, unless their row sets its own (`POST /orgs/{org}/capabilities` with
|
|
3210
|
+
* `team` and no `account`): `ORG_CAPABILITIES.INVITE_MEMBERS` is "members
|
|
3211
|
+
* may invite others to this app". The team's managers, or whoever holds
|
|
3212
|
+
* `MANAGE_MEMBERS` on it; approved with the caller's `passkey`
|
|
3213
|
+
* (`__set_default_capabilities { team, capabilities }`).
|
|
3214
|
+
*/
|
|
3215
|
+
async setTeamDefaultCapabilities(org, team, capabilities, passkey) {
|
|
3216
|
+
await this.postConfirmed(`orgs/${seg(org)}/capabilities`, { team, capabilities }, passkey);
|
|
3217
|
+
}
|
|
3206
3218
|
async createTeam(org, name, join, parent) {
|
|
3207
3219
|
const { teamId } = await this.post(`orgs/${seg(org)}/teams`, { name, join, parent });
|
|
3208
3220
|
return teamId;
|
|
3209
3221
|
}
|
|
3222
|
+
/**
|
|
3223
|
+
* A team the caller sees: its rows (each with its effective capabilities),
|
|
3224
|
+
* children, apps, the package it is the app team of and its default
|
|
3225
|
+
* capabilities.
|
|
3226
|
+
*/
|
|
3210
3227
|
getTeam(org, team) {
|
|
3211
3228
|
return this.get(`orgs/${seg(org)}/teams/${seg(team)}`);
|
|
3212
3229
|
}
|
|
@@ -3248,6 +3265,48 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
3248
3265
|
redeemInvite(token) {
|
|
3249
3266
|
return this.post(`invites/${seg(token)}/redeem`);
|
|
3250
3267
|
}
|
|
3268
|
+
/**
|
|
3269
|
+
* The organization's pending invites the caller may see (never a token):
|
|
3270
|
+
* every one for an owner or admin, their own, and those naming only teams
|
|
3271
|
+
* they manage. Expired ones are listed (`expired: true`) until revoked. A
|
|
3272
|
+
* caller outside the organization: {@link NotFound}.
|
|
3273
|
+
*/
|
|
3274
|
+
async listInvites(org) {
|
|
3275
|
+
const { invites } = await this.get(`orgs/${seg(org)}/invites`);
|
|
3276
|
+
return invites;
|
|
3277
|
+
}
|
|
3278
|
+
/**
|
|
3279
|
+
* Withdraw an invite by its key ({@link listInvites}), approved with the
|
|
3280
|
+
* caller's `passkey` (`__revoke_invite { inviteKey }`). One the caller may
|
|
3281
|
+
* not see: {@link NotFound}.
|
|
3282
|
+
*/
|
|
3283
|
+
async revokeInvite(org, inviteKey, passkey) {
|
|
3284
|
+
await this.deleteConfirmed(`orgs/${seg(org)}/invites/${seg(inviteKey)}`, passkey);
|
|
3285
|
+
}
|
|
3286
|
+
// ---------------------------------------------------------------- app teams
|
|
3287
|
+
/**
|
|
3288
|
+
* The organization's mode and its app teams (one per package), for any
|
|
3289
|
+
* member; a guest sees only those they are in. A caller outside the
|
|
3290
|
+
* organization: {@link NotFound}.
|
|
3291
|
+
*/
|
|
3292
|
+
listAppTeams(org) {
|
|
3293
|
+
return this.get(`orgs/${seg(org)}/app-teams`);
|
|
3294
|
+
}
|
|
3295
|
+
/**
|
|
3296
|
+
* Give apps their own access lists in one step (owner or admin): find or
|
|
3297
|
+
* make each package's app team, add everyone who reaches its instances now,
|
|
3298
|
+
* and move those instances onto it; with `shared`, close every app team.
|
|
3299
|
+
* Idempotent per package. Approved with the caller's `passkey`
|
|
3300
|
+
* (`__scope_apps { apps, shared }`); a refusal is `400 REJECTED` with the
|
|
3301
|
+
* node's reason. For a fresh standalone install pass
|
|
3302
|
+
* `{ apps: [{ package, name, instances: [] }] }`.
|
|
3303
|
+
*/
|
|
3304
|
+
scopeApps(org, passkey, options = {}) {
|
|
3305
|
+
const body = {};
|
|
3306
|
+
if (options.apps !== void 0) body.apps = options.apps;
|
|
3307
|
+
if (options.shared !== void 0) body.shared = options.shared;
|
|
3308
|
+
return this.postConfirmed(`orgs/${seg(org)}/app-teams`, body, passkey);
|
|
3309
|
+
}
|
|
3251
3310
|
// ---------------------------------------------------------------- deployers
|
|
3252
3311
|
/**
|
|
3253
3312
|
* Let an account or organization install apps where the cluster's
|