@calimero-network/mero-js 1.3.0 → 1.4.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 +39 -0
- package/dist/admin-api/admin-client.d.ts +64 -14
- package/dist/admin-api/admin-client.d.ts.map +1 -1
- package/dist/admin-api/admin-client.js +186 -13
- package/dist/admin-api/admin-client.js.map +1 -1
- package/dist/admin-api/admin-types.d.ts +391 -12
- package/dist/admin-api/admin-types.d.ts.map +1 -1
- package/dist/admin-api/admin-types.js +2 -1
- package/dist/admin-api/admin-types.js.map +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +288 -15
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +288 -15
- package/dist/index.mjs.map +2 -2
- package/dist/rpc/index.d.ts +2 -1
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +0 -1
- package/dist/rpc/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -721,6 +721,16 @@ var AdminApiClient = class {
|
|
|
721
721
|
return unwrap(await this.httpClient.get(`/admin-api/applications/${appId}`));
|
|
722
722
|
}
|
|
723
723
|
// ---- Package Management ----
|
|
724
|
+
async listPackages() {
|
|
725
|
+
return unwrap(await this.httpClient.get("/admin-api/packages"));
|
|
726
|
+
}
|
|
727
|
+
async listPackageVersions(packageName) {
|
|
728
|
+
return unwrap(
|
|
729
|
+
await this.httpClient.get(
|
|
730
|
+
`/admin-api/packages/${encodeURIComponent(packageName)}/versions`
|
|
731
|
+
)
|
|
732
|
+
);
|
|
733
|
+
}
|
|
724
734
|
async getLatestPackageVersion(packageName) {
|
|
725
735
|
return this.httpClient.get(
|
|
726
736
|
`/admin-api/packages/${encodeURIComponent(packageName)}/latest`
|
|
@@ -730,7 +740,16 @@ var AdminApiClient = class {
|
|
|
730
740
|
async createContext(request) {
|
|
731
741
|
return unwrap(await this.httpClient.post("/admin-api/contexts", request));
|
|
732
742
|
}
|
|
733
|
-
async deleteContext(contextId) {
|
|
743
|
+
async deleteContext(contextId, request) {
|
|
744
|
+
if (request) {
|
|
745
|
+
return unwrap(
|
|
746
|
+
await this.httpClient.request(`/admin-api/contexts/${contextId}`, {
|
|
747
|
+
method: "DELETE",
|
|
748
|
+
body: JSON.stringify(request),
|
|
749
|
+
headers: { "Content-Type": "application/json" }
|
|
750
|
+
})
|
|
751
|
+
);
|
|
752
|
+
}
|
|
734
753
|
return unwrap(await this.httpClient.delete(`/admin-api/contexts/${contextId}`));
|
|
735
754
|
}
|
|
736
755
|
async getContexts() {
|
|
@@ -752,12 +771,39 @@ var AdminApiClient = class {
|
|
|
752
771
|
async getContextIdentitiesOwned(contextId) {
|
|
753
772
|
return unwrap(await this.httpClient.get(`/admin-api/contexts/${contextId}/identities-owned`));
|
|
754
773
|
}
|
|
755
|
-
// ---- Context
|
|
756
|
-
async
|
|
757
|
-
return unwrap(
|
|
774
|
+
// ---- Context join (group membership) ----
|
|
775
|
+
async joinContext(contextId) {
|
|
776
|
+
return unwrap(
|
|
777
|
+
await this.httpClient.post(`/admin-api/contexts/${contextId}/join`, {})
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
// ---- Context group / storage / sync ----
|
|
781
|
+
async getContextGroup(contextId) {
|
|
782
|
+
return unwrap(await this.httpClient.get(`/admin-api/contexts/${contextId}/group`));
|
|
783
|
+
}
|
|
784
|
+
async getContextStorage(contextId) {
|
|
785
|
+
return unwrap(await this.httpClient.get(`/admin-api/contexts/${contextId}/storage`));
|
|
786
|
+
}
|
|
787
|
+
async syncContext(contextId) {
|
|
788
|
+
await this.httpClient.post(`/admin-api/contexts/sync/${contextId ?? ""}`, {});
|
|
789
|
+
}
|
|
790
|
+
async inviteSpecializedNode(request) {
|
|
791
|
+
return unwrap(
|
|
792
|
+
await this.httpClient.post(
|
|
793
|
+
"/admin-api/contexts/invite-specialized-node",
|
|
794
|
+
request
|
|
795
|
+
)
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
async updateContextApplication(contextId, request) {
|
|
799
|
+
await this.httpClient.post(`/admin-api/contexts/${contextId}/application`, request);
|
|
758
800
|
}
|
|
759
|
-
async
|
|
760
|
-
return unwrap(
|
|
801
|
+
async getContextsWithExecutorsForApplication(applicationId) {
|
|
802
|
+
return unwrap(
|
|
803
|
+
await this.httpClient.get(
|
|
804
|
+
`/admin-api/contexts/with-executors/for-application/${applicationId}`
|
|
805
|
+
)
|
|
806
|
+
);
|
|
761
807
|
}
|
|
762
808
|
// ---- Blob Management ----
|
|
763
809
|
async uploadBlob(data) {
|
|
@@ -773,24 +819,43 @@ var AdminApiClient = class {
|
|
|
773
819
|
return unwrap(await this.httpClient.get(`/admin-api/blobs/${blobId}`));
|
|
774
820
|
}
|
|
775
821
|
// ---- Alias Management ----
|
|
776
|
-
// Server uses type-specific alias routes: /admin-api/alias/{create,lookup,delete,list}/{context,application}
|
|
777
822
|
async createContextAlias(request) {
|
|
778
|
-
return this.httpClient.post("/admin-api/alias/create/context", request);
|
|
823
|
+
return unwrap(await this.httpClient.post("/admin-api/alias/create/context", request));
|
|
779
824
|
}
|
|
780
825
|
async createApplicationAlias(request) {
|
|
781
|
-
return this.httpClient.post("/admin-api/alias/create/application", request);
|
|
826
|
+
return unwrap(await this.httpClient.post("/admin-api/alias/create/application", request));
|
|
782
827
|
}
|
|
783
828
|
async lookupContextAlias(name) {
|
|
784
|
-
return
|
|
829
|
+
return unwrap(
|
|
830
|
+
await this.httpClient.post(
|
|
831
|
+
`/admin-api/alias/lookup/context/${encodeURIComponent(name)}`,
|
|
832
|
+
{}
|
|
833
|
+
)
|
|
834
|
+
);
|
|
785
835
|
}
|
|
786
836
|
async lookupApplicationAlias(name) {
|
|
787
|
-
return
|
|
837
|
+
return unwrap(
|
|
838
|
+
await this.httpClient.post(
|
|
839
|
+
`/admin-api/alias/lookup/application/${encodeURIComponent(name)}`,
|
|
840
|
+
{}
|
|
841
|
+
)
|
|
842
|
+
);
|
|
788
843
|
}
|
|
789
844
|
async deleteContextAlias(name) {
|
|
790
|
-
return
|
|
845
|
+
return unwrap(
|
|
846
|
+
await this.httpClient.post(
|
|
847
|
+
`/admin-api/alias/delete/context/${encodeURIComponent(name)}`,
|
|
848
|
+
{}
|
|
849
|
+
)
|
|
850
|
+
);
|
|
791
851
|
}
|
|
792
852
|
async deleteApplicationAlias(name) {
|
|
793
|
-
return
|
|
853
|
+
return unwrap(
|
|
854
|
+
await this.httpClient.post(
|
|
855
|
+
`/admin-api/alias/delete/application/${encodeURIComponent(name)}`,
|
|
856
|
+
{}
|
|
857
|
+
)
|
|
858
|
+
);
|
|
794
859
|
}
|
|
795
860
|
async listContextAliases() {
|
|
796
861
|
return unwrap(await this.httpClient.get("/admin-api/alias/list/context"));
|
|
@@ -798,6 +863,215 @@ var AdminApiClient = class {
|
|
|
798
863
|
async listApplicationAliases() {
|
|
799
864
|
return unwrap(await this.httpClient.get("/admin-api/alias/list/application"));
|
|
800
865
|
}
|
|
866
|
+
// ---- Context Identity Aliases ----
|
|
867
|
+
async listContextIdentityAliases(contextId) {
|
|
868
|
+
return unwrap(
|
|
869
|
+
await this.httpClient.get(
|
|
870
|
+
`/admin-api/alias/list/identity/${contextId}`
|
|
871
|
+
)
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
async createContextIdentityAlias(contextId, request) {
|
|
875
|
+
return unwrap(
|
|
876
|
+
await this.httpClient.post(
|
|
877
|
+
`/admin-api/alias/create/identity/${contextId}`,
|
|
878
|
+
request
|
|
879
|
+
)
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
async lookupContextIdentityAlias(contextId, name) {
|
|
883
|
+
return unwrap(
|
|
884
|
+
await this.httpClient.post(
|
|
885
|
+
`/admin-api/alias/lookup/identity/${contextId}/${encodeURIComponent(name)}`,
|
|
886
|
+
{}
|
|
887
|
+
)
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
async deleteContextIdentityAlias(contextId, name) {
|
|
891
|
+
return unwrap(
|
|
892
|
+
await this.httpClient.post(
|
|
893
|
+
`/admin-api/alias/delete/identity/${contextId}/${encodeURIComponent(name)}`,
|
|
894
|
+
{}
|
|
895
|
+
)
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
// ---- Namespace Management ----
|
|
899
|
+
async listNamespaces() {
|
|
900
|
+
return unwrap(await this.httpClient.get("/admin-api/namespaces"));
|
|
901
|
+
}
|
|
902
|
+
async getNamespace(namespaceId) {
|
|
903
|
+
return unwrap(await this.httpClient.get(`/admin-api/namespaces/${namespaceId}`));
|
|
904
|
+
}
|
|
905
|
+
async getNamespaceIdentity(namespaceId) {
|
|
906
|
+
return unwrap(await this.httpClient.get(`/admin-api/namespaces/${namespaceId}/identity`));
|
|
907
|
+
}
|
|
908
|
+
async listNamespacesForApplication(applicationId) {
|
|
909
|
+
return unwrap(await this.httpClient.get(`/admin-api/namespaces/for-application/${applicationId}`));
|
|
910
|
+
}
|
|
911
|
+
async createNamespace(request) {
|
|
912
|
+
return unwrap(await this.httpClient.post("/admin-api/namespaces", request));
|
|
913
|
+
}
|
|
914
|
+
async deleteNamespace(namespaceId, request) {
|
|
915
|
+
return unwrap(
|
|
916
|
+
await this.httpClient.request(`/admin-api/namespaces/${namespaceId}`, {
|
|
917
|
+
method: "DELETE",
|
|
918
|
+
body: request ? JSON.stringify(request) : void 0,
|
|
919
|
+
headers: request ? { "Content-Type": "application/json" } : void 0
|
|
920
|
+
})
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
async createNamespaceInvitation(namespaceId, request) {
|
|
924
|
+
return unwrap(
|
|
925
|
+
await this.httpClient.post(
|
|
926
|
+
`/admin-api/namespaces/${namespaceId}/invite`,
|
|
927
|
+
request ?? {}
|
|
928
|
+
)
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
async joinNamespace(namespaceId, request) {
|
|
932
|
+
return unwrap(
|
|
933
|
+
await this.httpClient.post(
|
|
934
|
+
`/admin-api/namespaces/${namespaceId}/join`,
|
|
935
|
+
request,
|
|
936
|
+
{ timeoutMs: 65e3 }
|
|
937
|
+
)
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
async createGroupInNamespace(namespaceId, request) {
|
|
941
|
+
return unwrap(
|
|
942
|
+
await this.httpClient.post(
|
|
943
|
+
`/admin-api/namespaces/${namespaceId}/groups`,
|
|
944
|
+
request ?? {}
|
|
945
|
+
)
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
async listNamespaceGroups(namespaceId) {
|
|
949
|
+
return unwrap(await this.httpClient.get(`/admin-api/namespaces/${namespaceId}/groups`));
|
|
950
|
+
}
|
|
951
|
+
// ---- Group Management ----
|
|
952
|
+
async getGroupInfo(groupId) {
|
|
953
|
+
return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}`));
|
|
954
|
+
}
|
|
955
|
+
async deleteGroup(groupId, request) {
|
|
956
|
+
if (request) {
|
|
957
|
+
return unwrap(
|
|
958
|
+
await this.httpClient.request(`/admin-api/groups/${groupId}`, {
|
|
959
|
+
method: "DELETE",
|
|
960
|
+
body: JSON.stringify(request),
|
|
961
|
+
headers: { "Content-Type": "application/json" }
|
|
962
|
+
})
|
|
963
|
+
);
|
|
964
|
+
}
|
|
965
|
+
return unwrap(await this.httpClient.delete(`/admin-api/groups/${groupId}`));
|
|
966
|
+
}
|
|
967
|
+
async listGroupMembers(groupId) {
|
|
968
|
+
return this.httpClient.get(`/admin-api/groups/${groupId}/members`);
|
|
969
|
+
}
|
|
970
|
+
async listGroupContexts(groupId) {
|
|
971
|
+
return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}/contexts`));
|
|
972
|
+
}
|
|
973
|
+
async addGroupMembers(groupId, request) {
|
|
974
|
+
await this.httpClient.post(`/admin-api/groups/${groupId}/members`, request);
|
|
975
|
+
}
|
|
976
|
+
async removeGroupMembers(groupId, request) {
|
|
977
|
+
await this.httpClient.post(`/admin-api/groups/${groupId}/members/remove`, request);
|
|
978
|
+
}
|
|
979
|
+
async updateMemberRole(groupId, identity, request) {
|
|
980
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/members/${identity}/role`, request);
|
|
981
|
+
}
|
|
982
|
+
async getMemberCapabilities(groupId, identity) {
|
|
983
|
+
return unwrap(
|
|
984
|
+
await this.httpClient.get(
|
|
985
|
+
`/admin-api/groups/${groupId}/members/${identity}/capabilities`
|
|
986
|
+
)
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
async setMemberCapabilities(groupId, identity, request) {
|
|
990
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/members/${identity}/capabilities`, request);
|
|
991
|
+
}
|
|
992
|
+
async setDefaultCapabilities(groupId, request) {
|
|
993
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/settings/default-capabilities`, request);
|
|
994
|
+
}
|
|
995
|
+
async setDefaultVisibility(groupId, request) {
|
|
996
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/settings/default-visibility`, request);
|
|
997
|
+
}
|
|
998
|
+
async setTeeAdmissionPolicy(groupId, request) {
|
|
999
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/settings/tee-admission-policy`, request);
|
|
1000
|
+
}
|
|
1001
|
+
async updateGroupSettings(groupId, request) {
|
|
1002
|
+
await this.httpClient.patch(`/admin-api/groups/${groupId}`, request);
|
|
1003
|
+
}
|
|
1004
|
+
async setGroupAlias(groupId, request) {
|
|
1005
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/alias`, request);
|
|
1006
|
+
}
|
|
1007
|
+
async setMemberAlias(groupId, identity, request) {
|
|
1008
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/members/${identity}/alias`, request);
|
|
1009
|
+
}
|
|
1010
|
+
async syncGroup(groupId, request) {
|
|
1011
|
+
return unwrap(await this.httpClient.post(`/admin-api/groups/${groupId}/sync`, request ?? {}));
|
|
1012
|
+
}
|
|
1013
|
+
async registerGroupSigningKey(groupId, request) {
|
|
1014
|
+
return unwrap(
|
|
1015
|
+
await this.httpClient.post(
|
|
1016
|
+
`/admin-api/groups/${groupId}/signing-key`,
|
|
1017
|
+
request
|
|
1018
|
+
)
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
async upgradeGroup(groupId, request) {
|
|
1022
|
+
return unwrap(await this.httpClient.post(`/admin-api/groups/${groupId}/upgrade`, request));
|
|
1023
|
+
}
|
|
1024
|
+
async getGroupUpgradeStatus(groupId) {
|
|
1025
|
+
return unwrap(
|
|
1026
|
+
await this.httpClient.get(`/admin-api/groups/${groupId}/upgrade/status`)
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
async retryGroupUpgrade(groupId, request) {
|
|
1030
|
+
return unwrap(
|
|
1031
|
+
await this.httpClient.post(
|
|
1032
|
+
`/admin-api/groups/${groupId}/upgrade/retry`,
|
|
1033
|
+
request ?? {}
|
|
1034
|
+
)
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
async nestGroup(parentGroupId, request) {
|
|
1038
|
+
await this.httpClient.post(`/admin-api/groups/${parentGroupId}/nest`, request);
|
|
1039
|
+
}
|
|
1040
|
+
async unnestGroup(parentGroupId, request) {
|
|
1041
|
+
await this.httpClient.post(`/admin-api/groups/${parentGroupId}/unnest`, request);
|
|
1042
|
+
}
|
|
1043
|
+
async listSubgroups(groupId) {
|
|
1044
|
+
return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}/subgroups`));
|
|
1045
|
+
}
|
|
1046
|
+
async detachContextFromGroup(groupId, contextId, request) {
|
|
1047
|
+
await this.httpClient.post(`/admin-api/groups/${groupId}/contexts/${contextId}/remove`, request ?? {});
|
|
1048
|
+
}
|
|
1049
|
+
// ---- Group Invitation & Join ----
|
|
1050
|
+
async createGroupInvitation(groupId, request) {
|
|
1051
|
+
return unwrap(
|
|
1052
|
+
await this.httpClient.post(
|
|
1053
|
+
`/admin-api/groups/${groupId}/invite`,
|
|
1054
|
+
request ?? {}
|
|
1055
|
+
)
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
async joinGroup(request) {
|
|
1059
|
+
return unwrap(
|
|
1060
|
+
await this.httpClient.post("/admin-api/groups/join", request)
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
// ---- TEE ----
|
|
1064
|
+
async getTeeInfo() {
|
|
1065
|
+
return unwrap(await this.httpClient.get("/admin-api/tee/info"));
|
|
1066
|
+
}
|
|
1067
|
+
async teeAttest(request) {
|
|
1068
|
+
return unwrap(await this.httpClient.post("/admin-api/tee/attest", request));
|
|
1069
|
+
}
|
|
1070
|
+
async teeVerifyQuote(request) {
|
|
1071
|
+
return unwrap(
|
|
1072
|
+
await this.httpClient.post("/admin-api/tee/verify-quote", request)
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
801
1075
|
// ---- Network ----
|
|
802
1076
|
async getPeersCount() {
|
|
803
1077
|
return this.httpClient.get("/admin-api/peers");
|
|
@@ -921,8 +1195,7 @@ var RpcClient = class {
|
|
|
921
1195
|
params: {
|
|
922
1196
|
contextId: params.contextId,
|
|
923
1197
|
method: params.method,
|
|
924
|
-
argsJson: params.argsJson ?? {}
|
|
925
|
-
executorPublicKey: params.executorPublicKey
|
|
1198
|
+
argsJson: params.argsJson ?? {}
|
|
926
1199
|
}
|
|
927
1200
|
};
|
|
928
1201
|
const response = await this.httpClient.post(
|