@calimero-network/mero-js 2.0.1 → 2.2.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/admin-api/admin-client.d.ts +12 -3
- package/dist/admin-api/admin-client.d.ts.map +1 -1
- package/dist/admin-api/admin-client.js +28 -4
- package/dist/admin-api/admin-client.js.map +1 -1
- package/dist/admin-api/admin-types.d.ts +58 -21
- package/dist/admin-api/admin-types.d.ts.map +1 -1
- package/dist/capabilities.d.ts +31 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +42 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +4 -4
- package/dist/index.cjs +65 -5
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -5
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var index_exports = {};
|
|
|
21
21
|
__export(index_exports, {
|
|
22
22
|
AdminApiClient: () => AdminApiClient,
|
|
23
23
|
AuthApiClient: () => AuthApiClient,
|
|
24
|
+
CAPABILITIES: () => CAPABILITIES,
|
|
24
25
|
CloudClient: () => CloudClient,
|
|
25
26
|
HTTPError: () => HTTPError,
|
|
26
27
|
LocalStorageTokenStore: () => LocalStorageTokenStore,
|
|
@@ -48,8 +49,11 @@ __export(index_exports, {
|
|
|
48
49
|
createRetryableMethod: () => createRetryableMethod,
|
|
49
50
|
createTimeoutSignal: () => createTimeoutSignal,
|
|
50
51
|
createUniversalHttpClient: () => createUniversalHttpClient,
|
|
52
|
+
hasCap: () => hasCap,
|
|
51
53
|
parseAuthCallback: () => parseAuthCallback,
|
|
52
|
-
|
|
54
|
+
withCap: () => withCap,
|
|
55
|
+
withRetry: () => withRetry,
|
|
56
|
+
withoutCap: () => withoutCap
|
|
53
57
|
});
|
|
54
58
|
module.exports = __toCommonJS(index_exports);
|
|
55
59
|
|
|
@@ -952,6 +956,14 @@ var AdminApiClient = class {
|
|
|
952
956
|
async getGroupInfo(groupId) {
|
|
953
957
|
return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}`));
|
|
954
958
|
}
|
|
959
|
+
/** Thin wrapper over {@link getGroupInfo}: returns the group's `defaultCapabilities` bitmask. */
|
|
960
|
+
async getDefaultCapabilities(groupId) {
|
|
961
|
+
return (await this.getGroupInfo(groupId)).defaultCapabilities;
|
|
962
|
+
}
|
|
963
|
+
/** Thin wrapper over {@link getGroupInfo}: returns the group's `subgroupVisibility`. */
|
|
964
|
+
async getSubgroupVisibility(groupId) {
|
|
965
|
+
return (await this.getGroupInfo(groupId)).subgroupVisibility;
|
|
966
|
+
}
|
|
955
967
|
async deleteGroup(groupId, request) {
|
|
956
968
|
if (request) {
|
|
957
969
|
return unwrap(
|
|
@@ -1010,11 +1022,28 @@ var AdminApiClient = class {
|
|
|
1010
1022
|
async updateGroupSettings(groupId, request) {
|
|
1011
1023
|
await this.httpClient.patch(`/admin-api/groups/${groupId}`, request);
|
|
1012
1024
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1025
|
+
// ---- Group / member / context metadata ----
|
|
1026
|
+
async setGroupMetadata(groupId, request) {
|
|
1027
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/metadata`, request);
|
|
1028
|
+
}
|
|
1029
|
+
async getGroupMetadata(groupId) {
|
|
1030
|
+
return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}/metadata`)).data;
|
|
1031
|
+
}
|
|
1032
|
+
async setMemberMetadata(groupId, identity, request) {
|
|
1033
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/members/${identity}/metadata`, request);
|
|
1034
|
+
}
|
|
1035
|
+
async getMemberMetadata(groupId, identity) {
|
|
1036
|
+
return unwrap(
|
|
1037
|
+
await this.httpClient.get(`/admin-api/groups/${groupId}/members/${identity}/metadata`)
|
|
1038
|
+
).data;
|
|
1039
|
+
}
|
|
1040
|
+
async setContextMetadata(groupId, contextId, request) {
|
|
1041
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/contexts/${contextId}/metadata`, request);
|
|
1015
1042
|
}
|
|
1016
|
-
async
|
|
1017
|
-
|
|
1043
|
+
async getContextMetadata(groupId, contextId) {
|
|
1044
|
+
return unwrap(
|
|
1045
|
+
await this.httpClient.get(`/admin-api/groups/${groupId}/contexts/${contextId}/metadata`)
|
|
1046
|
+
).data;
|
|
1018
1047
|
}
|
|
1019
1048
|
async syncGroup(groupId, request) {
|
|
1020
1049
|
return unwrap(await this.httpClient.post(`/admin-api/groups/${groupId}/sync`, request ?? {}));
|
|
@@ -1069,6 +1098,14 @@ var AdminApiClient = class {
|
|
|
1069
1098
|
await this.httpClient.post("/admin-api/groups/join", request)
|
|
1070
1099
|
);
|
|
1071
1100
|
}
|
|
1101
|
+
async joinSubgroupInheritance(groupId) {
|
|
1102
|
+
return unwrap(
|
|
1103
|
+
await this.httpClient.post(
|
|
1104
|
+
`/admin-api/groups/${groupId}/join-via-inheritance`,
|
|
1105
|
+
{}
|
|
1106
|
+
)
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1072
1109
|
// ---- TEE ----
|
|
1073
1110
|
async getTeeInfo() {
|
|
1074
1111
|
return unwrap(await this.httpClient.get("/admin-api/tee/info"));
|
|
@@ -1944,4 +1981,27 @@ var CloudClient = class {
|
|
|
1944
1981
|
window.open(`${this.baseUrl}/disable-ha?${params.toString()}`);
|
|
1945
1982
|
}
|
|
1946
1983
|
};
|
|
1984
|
+
|
|
1985
|
+
// src/capabilities.ts
|
|
1986
|
+
var CAPABILITIES = {
|
|
1987
|
+
CAN_CREATE_CONTEXT: 1 << 0,
|
|
1988
|
+
CAN_INVITE_MEMBERS: 1 << 1,
|
|
1989
|
+
CAN_JOIN_OPEN_SUBGROUPS: 1 << 2,
|
|
1990
|
+
MANAGE_MEMBERS: 1 << 3,
|
|
1991
|
+
MANAGE_APPLICATION: 1 << 4,
|
|
1992
|
+
CAN_CREATE_SUBGROUP: 1 << 5,
|
|
1993
|
+
CAN_DELETE_SUBGROUP: 1 << 6,
|
|
1994
|
+
CAN_MANAGE_VISIBILITY: 1 << 7,
|
|
1995
|
+
CAN_MANAGE_METADATA: 1 << 8
|
|
1996
|
+
};
|
|
1997
|
+
function hasCap(mask, cap) {
|
|
1998
|
+
const capU32 = cap >>> 0;
|
|
1999
|
+
return (mask & capU32) >>> 0 === capU32;
|
|
2000
|
+
}
|
|
2001
|
+
function withCap(mask, cap) {
|
|
2002
|
+
return (mask | cap) >>> 0;
|
|
2003
|
+
}
|
|
2004
|
+
function withoutCap(mask, cap) {
|
|
2005
|
+
return (mask & ~cap) >>> 0;
|
|
2006
|
+
}
|
|
1947
2007
|
//# sourceMappingURL=index.cjs.map
|