@calimero-network/mero-js 29.7.7 → 29.8.1
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 +169 -5
- package/dist/cloud-v2/client.js +76 -5
- 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 +72 -5
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +72 -5
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
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`),
|
|
3068
|
-
*
|
|
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
|
}
|
|
@@ -3084,9 +3101,17 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
3084
3101
|
async updateTeam(org, team, update) {
|
|
3085
3102
|
await this.post(`orgs/${seg(org)}/teams/${seg(team)}`, update);
|
|
3086
3103
|
}
|
|
3087
|
-
/**
|
|
3088
|
-
|
|
3089
|
-
|
|
3104
|
+
/**
|
|
3105
|
+
* Delete a team, the teams below it and their apps. When any of those
|
|
3106
|
+
* teams holds apps the node asks for the caller's passkey (`412
|
|
3107
|
+
* CONFIRM_REQUIRED`, its details listing the `apps` that go, which the
|
|
3108
|
+
* approval names; an app added after it is refused), which `passkey` gives.
|
|
3109
|
+
* Without one that `412` reaches the caller as {@link ConfirmRequired}. A
|
|
3110
|
+
* team with no apps is deleted without a passkey.
|
|
3111
|
+
*/
|
|
3112
|
+
async deleteTeam(org, team, passkey) {
|
|
3113
|
+
const path = `orgs/${seg(org)}/teams/${seg(team)}`;
|
|
3114
|
+
await (passkey ? this.deleteConfirmed(path, passkey) : this.delete(path));
|
|
3090
3115
|
}
|
|
3091
3116
|
/**
|
|
3092
3117
|
* Add a member to a team, or change their row: role, lead, capability bits.
|
|
@@ -3115,6 +3140,48 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
3115
3140
|
redeemInvite(token) {
|
|
3116
3141
|
return this.post(`invites/${seg(token)}/redeem`);
|
|
3117
3142
|
}
|
|
3143
|
+
/**
|
|
3144
|
+
* The organization's pending invites the caller may see (never a token):
|
|
3145
|
+
* every one for an owner or admin, their own, and those naming only teams
|
|
3146
|
+
* they manage. Expired ones are listed (`expired: true`) until revoked. A
|
|
3147
|
+
* caller outside the organization: {@link NotFound}.
|
|
3148
|
+
*/
|
|
3149
|
+
async listInvites(org) {
|
|
3150
|
+
const { invites } = await this.get(`orgs/${seg(org)}/invites`);
|
|
3151
|
+
return invites;
|
|
3152
|
+
}
|
|
3153
|
+
/**
|
|
3154
|
+
* Withdraw an invite by its key ({@link listInvites}), approved with the
|
|
3155
|
+
* caller's `passkey` (`__revoke_invite { inviteKey }`). One the caller may
|
|
3156
|
+
* not see: {@link NotFound}.
|
|
3157
|
+
*/
|
|
3158
|
+
async revokeInvite(org, inviteKey, passkey) {
|
|
3159
|
+
await this.deleteConfirmed(`orgs/${seg(org)}/invites/${seg(inviteKey)}`, passkey);
|
|
3160
|
+
}
|
|
3161
|
+
// ---------------------------------------------------------------- app teams
|
|
3162
|
+
/**
|
|
3163
|
+
* The organization's mode and its app teams (one per package), for any
|
|
3164
|
+
* member; a guest sees only those they are in. A caller outside the
|
|
3165
|
+
* organization: {@link NotFound}.
|
|
3166
|
+
*/
|
|
3167
|
+
listAppTeams(org) {
|
|
3168
|
+
return this.get(`orgs/${seg(org)}/app-teams`);
|
|
3169
|
+
}
|
|
3170
|
+
/**
|
|
3171
|
+
* Give apps their own access lists in one step (owner or admin): find or
|
|
3172
|
+
* make each package's app team, add everyone who reaches its instances now,
|
|
3173
|
+
* and move those instances onto it; with `shared`, close every app team.
|
|
3174
|
+
* Idempotent per package. Approved with the caller's `passkey`
|
|
3175
|
+
* (`__scope_apps { apps, shared }`); a refusal is `400 REJECTED` with the
|
|
3176
|
+
* node's reason. For a fresh standalone install pass
|
|
3177
|
+
* `{ apps: [{ package, name, instances: [] }] }`.
|
|
3178
|
+
*/
|
|
3179
|
+
scopeApps(org, passkey, options = {}) {
|
|
3180
|
+
const body = {};
|
|
3181
|
+
if (options.apps !== void 0) body.apps = options.apps;
|
|
3182
|
+
if (options.shared !== void 0) body.shared = options.shared;
|
|
3183
|
+
return this.postConfirmed(`orgs/${seg(org)}/app-teams`, body, passkey);
|
|
3184
|
+
}
|
|
3118
3185
|
// ---------------------------------------------------------------- deployers
|
|
3119
3186
|
/**
|
|
3120
3187
|
* Let an account or organization install apps where the cluster's
|