@eluvio/elv-client-js 4.0.105 → 4.0.107
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/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +7 -7
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/UserProfileClient.js +160 -132
- package/dist/src/client/Contracts.js +431 -106
- package/dist/src/client/LiveConf.js +1 -1
- package/dist/src/client/LiveStream.js +229 -136
- package/package.json +1 -1
- package/src/UserProfileClient.js +19 -20
- package/src/client/Contracts.js +244 -42
- package/src/client/LiveConf.js +1 -1
- package/src/client/LiveStream.js +122 -44
- package/testScripts/TestAddTenantContractId.js +45 -4
|
@@ -935,21 +935,9 @@ exports.SendFunds = /*#__PURE__*/function () {
|
|
|
935
935
|
return _ref36.apply(this, arguments);
|
|
936
936
|
};
|
|
937
937
|
}();
|
|
938
|
-
|
|
939
|
-
/**
|
|
940
|
-
* Retrieve the ID of the tenant contract for the specified object
|
|
941
|
-
*
|
|
942
|
-
* @methodGroup Tenant
|
|
943
|
-
* @namedParams
|
|
944
|
-
* @param {string=} contractAddress - The address of the object
|
|
945
|
-
* @param {string=} objectId - The ID of the object
|
|
946
|
-
* @param {string=} versionHash - A version hash of the object
|
|
947
|
-
*
|
|
948
|
-
* @returns {Promise<string|undefined>}
|
|
949
|
-
*/
|
|
950
|
-
exports.TenantContractId = /*#__PURE__*/function () {
|
|
938
|
+
var GetObjectIDAndContractAddress = /*#__PURE__*/function () {
|
|
951
939
|
var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref37) {
|
|
952
|
-
var contractAddress, objectId, versionHash
|
|
940
|
+
var contractAddress, objectId, versionHash;
|
|
953
941
|
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
954
942
|
while (1) switch (_context18.prev = _context18.next) {
|
|
955
943
|
case 0:
|
|
@@ -984,57 +972,190 @@ exports.TenantContractId = /*#__PURE__*/function () {
|
|
|
984
972
|
case 17:
|
|
985
973
|
throw Error("contractAddress or objectId or versionHash not specified");
|
|
986
974
|
case 18:
|
|
987
|
-
_context18.
|
|
975
|
+
return _context18.abrupt("return", {
|
|
976
|
+
contractAddress: contractAddress,
|
|
977
|
+
objectId: objectId
|
|
978
|
+
});
|
|
979
|
+
case 19:
|
|
980
|
+
case "end":
|
|
981
|
+
return _context18.stop();
|
|
982
|
+
}
|
|
983
|
+
}, _callee18, this);
|
|
984
|
+
}));
|
|
985
|
+
return function GetObjectIDAndContractAddress(_x16) {
|
|
986
|
+
return _ref38.apply(this, arguments);
|
|
987
|
+
};
|
|
988
|
+
}();
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Retrieve the ID of the tenant admin group set for the specified object
|
|
992
|
+
*
|
|
993
|
+
* @methodGroup Tenant
|
|
994
|
+
* @namedParams
|
|
995
|
+
* @param {string=} contractAddress - The address of the object
|
|
996
|
+
* @param {string=} objectId - The ID of the object
|
|
997
|
+
* @param {string=} versionHash - A version hash of the object
|
|
998
|
+
*
|
|
999
|
+
* @returns {Promise<string|undefined>}
|
|
1000
|
+
*/
|
|
1001
|
+
exports.TenantId = /*#__PURE__*/function () {
|
|
1002
|
+
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref39) {
|
|
1003
|
+
var contractAddress, objectId, versionHash, tenantId, hasGetMetaMethod, libraryId;
|
|
1004
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1005
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1006
|
+
case 0:
|
|
1007
|
+
contractAddress = _ref39.contractAddress, objectId = _ref39.objectId, versionHash = _ref39.versionHash;
|
|
1008
|
+
_context19.next = 3;
|
|
1009
|
+
return GetObjectIDAndContractAddress({
|
|
1010
|
+
contractAddress: contractAddress,
|
|
1011
|
+
objectId: objectId,
|
|
1012
|
+
versionHash: versionHash
|
|
1013
|
+
});
|
|
1014
|
+
case 3:
|
|
1015
|
+
objectInfo = _context19.sent;
|
|
1016
|
+
contractAddress = objectInfo.contractAddress;
|
|
1017
|
+
objectId = objectInfo.objectId;
|
|
1018
|
+
_context19.prev = 6;
|
|
1019
|
+
_context19.next = 9;
|
|
988
1020
|
return this.authClient.ContractHasMethod({
|
|
989
1021
|
contractAddress: contractAddress,
|
|
990
1022
|
methodName: "getMeta"
|
|
991
1023
|
});
|
|
1024
|
+
case 9:
|
|
1025
|
+
hasGetMetaMethod = _context19.sent;
|
|
1026
|
+
if (!hasGetMetaMethod) {
|
|
1027
|
+
_context19.next = 14;
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
_context19.next = 13;
|
|
1031
|
+
return this.ContractMetadata({
|
|
1032
|
+
contractAddress: contractAddress,
|
|
1033
|
+
metadataKey: "_tenantId"
|
|
1034
|
+
});
|
|
1035
|
+
case 13:
|
|
1036
|
+
tenantId = _context19.sent;
|
|
1037
|
+
case 14:
|
|
1038
|
+
if (!(tenantId === undefined)) {
|
|
1039
|
+
_context19.next = 21;
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
_context19.next = 17;
|
|
1043
|
+
return this.ContentObjectLibraryId({
|
|
1044
|
+
objectId: objectId
|
|
1045
|
+
});
|
|
1046
|
+
case 17:
|
|
1047
|
+
libraryId = _context19.sent;
|
|
1048
|
+
_context19.next = 20;
|
|
1049
|
+
return this.ContentObjectMetadata({
|
|
1050
|
+
libraryId: libraryId,
|
|
1051
|
+
objectId: objectId,
|
|
1052
|
+
metadataSubtree: "tenantId"
|
|
1053
|
+
});
|
|
992
1054
|
case 20:
|
|
993
|
-
|
|
1055
|
+
tenantId = _context19.sent;
|
|
1056
|
+
case 21:
|
|
1057
|
+
return _context19.abrupt("return", tenantId);
|
|
1058
|
+
case 24:
|
|
1059
|
+
_context19.prev = 24;
|
|
1060
|
+
_context19.t0 = _context19["catch"](6);
|
|
1061
|
+
return _context19.abrupt("return", "");
|
|
1062
|
+
case 27:
|
|
1063
|
+
case "end":
|
|
1064
|
+
return _context19.stop();
|
|
1065
|
+
}
|
|
1066
|
+
}, _callee19, this, [[6, 24]]);
|
|
1067
|
+
}));
|
|
1068
|
+
return function (_x17) {
|
|
1069
|
+
return _ref40.apply(this, arguments);
|
|
1070
|
+
};
|
|
1071
|
+
}();
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Retrieve the ID of the tenant contract for the specified object
|
|
1075
|
+
*
|
|
1076
|
+
* @methodGroup Tenant
|
|
1077
|
+
* @namedParams
|
|
1078
|
+
* @param {string=} contractAddress - The address of the object
|
|
1079
|
+
* @param {string=} objectId - The ID of the object
|
|
1080
|
+
* @param {string=} versionHash - A version hash of the object
|
|
1081
|
+
*
|
|
1082
|
+
* @returns {Promise<string|undefined>}
|
|
1083
|
+
*/
|
|
1084
|
+
exports.TenantContractId = /*#__PURE__*/function () {
|
|
1085
|
+
var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref41) {
|
|
1086
|
+
var contractAddress, objectId, versionHash, hasGetMetaMethod, _tenantContractId, libraryId;
|
|
1087
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1088
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1089
|
+
case 0:
|
|
1090
|
+
contractAddress = _ref41.contractAddress, objectId = _ref41.objectId, versionHash = _ref41.versionHash;
|
|
1091
|
+
_context20.next = 3;
|
|
1092
|
+
return GetObjectIDAndContractAddress({
|
|
1093
|
+
contractAddress: contractAddress,
|
|
1094
|
+
objectId: objectId,
|
|
1095
|
+
versionHash: versionHash
|
|
1096
|
+
});
|
|
1097
|
+
case 3:
|
|
1098
|
+
objectInfo = _context20.sent;
|
|
1099
|
+
contractAddress = objectInfo.contractAddress;
|
|
1100
|
+
objectId = objectInfo.objectId;
|
|
1101
|
+
_context20.prev = 6;
|
|
1102
|
+
_context20.next = 9;
|
|
1103
|
+
return this.authClient.ContractHasMethod({
|
|
1104
|
+
contractAddress: contractAddress,
|
|
1105
|
+
methodName: "getMeta"
|
|
1106
|
+
});
|
|
1107
|
+
case 9:
|
|
1108
|
+
hasGetMetaMethod = _context20.sent;
|
|
994
1109
|
if (!hasGetMetaMethod) {
|
|
995
|
-
|
|
1110
|
+
_context20.next = 14;
|
|
996
1111
|
break;
|
|
997
1112
|
}
|
|
998
|
-
|
|
1113
|
+
_context20.next = 13;
|
|
999
1114
|
return this.ContractMetadata({
|
|
1000
1115
|
contractAddress: contractAddress,
|
|
1001
1116
|
metadataKey: "_ELV_TENANT_ID"
|
|
1002
1117
|
});
|
|
1003
|
-
case
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1118
|
+
case 13:
|
|
1119
|
+
_tenantContractId = _context20.sent;
|
|
1120
|
+
case 14:
|
|
1121
|
+
if (!(_tenantContractId === undefined)) {
|
|
1122
|
+
_context20.next = 21;
|
|
1007
1123
|
break;
|
|
1008
1124
|
}
|
|
1009
|
-
|
|
1010
|
-
case 27:
|
|
1011
|
-
_context18.next = 29;
|
|
1125
|
+
_context20.next = 17;
|
|
1012
1126
|
return this.ContentObjectLibraryId({
|
|
1013
1127
|
objectId: objectId
|
|
1014
1128
|
});
|
|
1015
|
-
case
|
|
1016
|
-
libraryId =
|
|
1017
|
-
|
|
1129
|
+
case 17:
|
|
1130
|
+
libraryId = _context20.sent;
|
|
1131
|
+
_context20.next = 20;
|
|
1018
1132
|
return this.ContentObjectMetadata({
|
|
1019
1133
|
libraryId: libraryId,
|
|
1020
1134
|
objectId: objectId,
|
|
1021
1135
|
metadataSubtree: "tenantContractId"
|
|
1022
1136
|
});
|
|
1023
|
-
case
|
|
1024
|
-
|
|
1025
|
-
case
|
|
1137
|
+
case 20:
|
|
1138
|
+
_tenantContractId = _context20.sent;
|
|
1139
|
+
case 21:
|
|
1140
|
+
return _context20.abrupt("return", _tenantContractId);
|
|
1141
|
+
case 24:
|
|
1142
|
+
_context20.prev = 24;
|
|
1143
|
+
_context20.t0 = _context20["catch"](6);
|
|
1144
|
+
return _context20.abrupt("return", "");
|
|
1145
|
+
case 27:
|
|
1026
1146
|
case "end":
|
|
1027
|
-
return
|
|
1147
|
+
return _context20.stop();
|
|
1028
1148
|
}
|
|
1029
|
-
},
|
|
1149
|
+
}, _callee20, this, [[6, 24]]);
|
|
1030
1150
|
}));
|
|
1031
|
-
return function (
|
|
1032
|
-
return
|
|
1151
|
+
return function (_x18) {
|
|
1152
|
+
return _ref42.apply(this, arguments);
|
|
1033
1153
|
};
|
|
1034
1154
|
}();
|
|
1035
1155
|
|
|
1036
1156
|
/**
|
|
1037
|
-
* Set the tenant contract ID for the specified object
|
|
1157
|
+
* Set the tenant contract ID and tenant admin group ID for the specified object
|
|
1158
|
+
* when tenant admin group ID is provided
|
|
1038
1159
|
*
|
|
1039
1160
|
* @methodGroup Tenant
|
|
1040
1161
|
* @namedParams
|
|
@@ -1042,125 +1163,205 @@ exports.TenantContractId = /*#__PURE__*/function () {
|
|
|
1042
1163
|
* @param {string=} objectId - The ID of the object
|
|
1043
1164
|
* @param {string=} versionHash - A version hash of the object
|
|
1044
1165
|
* @param {string} tenantContractId - The tenant contract ID to set
|
|
1166
|
+
* @param {string} tenantId - The tenant ID to set
|
|
1045
1167
|
*
|
|
1046
1168
|
* @returns {Promise<{tenantId: (undefined|string), tenantContractId}>}
|
|
1047
1169
|
*/
|
|
1048
|
-
exports.
|
|
1049
|
-
var
|
|
1050
|
-
var contractAddress, objectId, versionHash,
|
|
1051
|
-
return _regeneratorRuntime.wrap(function
|
|
1052
|
-
while (1) switch (
|
|
1170
|
+
exports.SetTenantId = /*#__PURE__*/function () {
|
|
1171
|
+
var _ref44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref43) {
|
|
1172
|
+
var contractAddress, objectId, versionHash, tenantId, objectVersion, version;
|
|
1173
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1174
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1053
1175
|
case 0:
|
|
1054
|
-
contractAddress =
|
|
1055
|
-
|
|
1056
|
-
|
|
1176
|
+
contractAddress = _ref43.contractAddress, objectId = _ref43.objectId, versionHash = _ref43.versionHash, tenantId = _ref43.tenantId;
|
|
1177
|
+
_context21.next = 3;
|
|
1178
|
+
return GetObjectIDAndContractAddress({
|
|
1179
|
+
contractAddress: contractAddress,
|
|
1180
|
+
objectId: objectId,
|
|
1181
|
+
versionHash: versionHash
|
|
1182
|
+
});
|
|
1183
|
+
case 3:
|
|
1184
|
+
objectInfo = _context21.sent;
|
|
1185
|
+
contractAddress = objectInfo.contractAddress;
|
|
1186
|
+
objectId = objectInfo.objectId;
|
|
1187
|
+
_context21.next = 8;
|
|
1188
|
+
return this.authClient.AccessType(objectId);
|
|
1189
|
+
case 8:
|
|
1190
|
+
objectVersion = _context21.sent;
|
|
1191
|
+
if (!(objectVersion !== this.authClient.ACCESS_TYPES.GROUP && objectVersion !== this.authClient.ACCESS_TYPES.WALLET && objectVersion !== this.authClient.ACCESS_TYPES.LIBRARY && objectVersion !== this.authClient.ACCESS_TYPES.TYPE && objectVersion !== this.authClient.ACCESS_TYPES.TENANT)) {
|
|
1192
|
+
_context21.next = 11;
|
|
1057
1193
|
break;
|
|
1058
1194
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
if (!versionHash) {
|
|
1065
|
-
_context19.next = 12;
|
|
1195
|
+
throw Error("Invalid object ID: ".concat(objectId, ", \n applicable only for wallet,group, library or content_type object."));
|
|
1196
|
+
case 11:
|
|
1197
|
+
ValidateObject(tenantId);
|
|
1198
|
+
if (!(!tenantId.startsWith("iten") || !Utils.ValidHash(tenantId))) {
|
|
1199
|
+
_context21.next = 14;
|
|
1066
1200
|
break;
|
|
1067
1201
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
if (!
|
|
1075
|
-
|
|
1202
|
+
throw Error("Invalid tenant ID: ".concat(tenantId));
|
|
1203
|
+
case 14:
|
|
1204
|
+
_context21.next = 16;
|
|
1205
|
+
return this.authClient.AccessType(tenantId);
|
|
1206
|
+
case 16:
|
|
1207
|
+
version = _context21.sent;
|
|
1208
|
+
if (!(version !== this.authClient.ACCESS_TYPES.GROUP)) {
|
|
1209
|
+
_context21.next = 19;
|
|
1076
1210
|
break;
|
|
1077
1211
|
}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
case
|
|
1212
|
+
throw Error("Invalid tenant ID: " + tenantId);
|
|
1213
|
+
case 19:
|
|
1214
|
+
_context21.next = 21;
|
|
1215
|
+
return this.TenantContractId({
|
|
1216
|
+
objectId: tenantId
|
|
1217
|
+
});
|
|
1218
|
+
case 21:
|
|
1219
|
+
tenantContractId = _context21.sent;
|
|
1220
|
+
if (!tenantContractId) {
|
|
1221
|
+
_context21.next = 28;
|
|
1222
|
+
break;
|
|
1223
|
+
}
|
|
1224
|
+
_context21.next = 25;
|
|
1225
|
+
return this.SetTenantContractId({
|
|
1226
|
+
contractAddress: contractAddress,
|
|
1227
|
+
objectId: objectId,
|
|
1228
|
+
versionHash: versionHash,
|
|
1229
|
+
tenantContractId: tenantContractId
|
|
1230
|
+
});
|
|
1231
|
+
case 25:
|
|
1232
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1233
|
+
case 28:
|
|
1234
|
+
throw Error("Invalid tenantId: tenant contract id not found");
|
|
1235
|
+
case 29:
|
|
1236
|
+
case "end":
|
|
1237
|
+
return _context21.stop();
|
|
1238
|
+
}
|
|
1239
|
+
}, _callee21, this);
|
|
1240
|
+
}));
|
|
1241
|
+
return function (_x19) {
|
|
1242
|
+
return _ref44.apply(this, arguments);
|
|
1243
|
+
};
|
|
1244
|
+
}();
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Set the tenant contract ID and tenant admin group ID for the specified object
|
|
1248
|
+
* when tenant contract ID is provided
|
|
1249
|
+
*
|
|
1250
|
+
* @methodGroup Tenant
|
|
1251
|
+
* @namedParams
|
|
1252
|
+
* @param {string=} contractAddress - The address of the object
|
|
1253
|
+
* @param {string=} objectId - The ID of the object
|
|
1254
|
+
* @param {string=} versionHash - A version hash of the object
|
|
1255
|
+
* @param {string} tenantContractId - The tenant contract ID to set
|
|
1256
|
+
*
|
|
1257
|
+
* @returns {Promise<{tenantId: (undefined|string), tenantContractId}>}
|
|
1258
|
+
*/
|
|
1259
|
+
exports.SetTenantContractId = /*#__PURE__*/function () {
|
|
1260
|
+
var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref45) {
|
|
1261
|
+
var contractAddress, objectId, versionHash, tenantContractId, objectVersion, tenantAddress, version, tenantAdminGroupAddress, hasPutMetaMethod, libraryId, editRequest;
|
|
1262
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1263
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1264
|
+
case 0:
|
|
1265
|
+
contractAddress = _ref45.contractAddress, objectId = _ref45.objectId, versionHash = _ref45.versionHash, tenantContractId = _ref45.tenantContractId;
|
|
1266
|
+
_context22.next = 3;
|
|
1267
|
+
return GetObjectIDAndContractAddress({
|
|
1268
|
+
contractAddress: contractAddress,
|
|
1269
|
+
objectId: objectId,
|
|
1270
|
+
versionHash: versionHash
|
|
1271
|
+
});
|
|
1272
|
+
case 3:
|
|
1273
|
+
objectInfo = _context22.sent;
|
|
1274
|
+
contractAddress = objectInfo.contractAddress;
|
|
1275
|
+
objectId = objectInfo.objectId;
|
|
1276
|
+
_context22.next = 8;
|
|
1277
|
+
return this.authClient.AccessType(objectId);
|
|
1278
|
+
case 8:
|
|
1279
|
+
objectVersion = _context22.sent;
|
|
1280
|
+
if (!(objectVersion !== this.authClient.ACCESS_TYPES.GROUP && objectVersion !== this.authClient.ACCESS_TYPES.WALLET && objectVersion !== this.authClient.ACCESS_TYPES.LIBRARY && objectVersion !== this.authClient.ACCESS_TYPES.TYPE && objectVersion !== this.authClient.ACCESS_TYPES.TENANT)) {
|
|
1281
|
+
_context22.next = 11;
|
|
1282
|
+
break;
|
|
1283
|
+
}
|
|
1284
|
+
throw Error("Invalid object ID: ".concat(objectId, ", \n applicable only for wallet,group, library or content_type object."));
|
|
1285
|
+
case 11:
|
|
1085
1286
|
ValidateObject(tenantContractId);
|
|
1086
1287
|
if (!(tenantContractId && (!tenantContractId.startsWith("iten") || !Utils.ValidHash(tenantContractId)))) {
|
|
1087
|
-
|
|
1288
|
+
_context22.next = 14;
|
|
1088
1289
|
break;
|
|
1089
1290
|
}
|
|
1090
1291
|
throw Error("Invalid tenant ID: ".concat(tenantContractId));
|
|
1091
|
-
case
|
|
1292
|
+
case 14:
|
|
1092
1293
|
tenantAddress = Utils.HashToAddress(tenantContractId);
|
|
1093
|
-
|
|
1294
|
+
_context22.next = 17;
|
|
1094
1295
|
return this.authClient.AccessType(tenantContractId);
|
|
1095
|
-
case
|
|
1096
|
-
version =
|
|
1296
|
+
case 17:
|
|
1297
|
+
version = _context22.sent;
|
|
1097
1298
|
if (!(version !== this.authClient.ACCESS_TYPES.TENANT)) {
|
|
1098
|
-
|
|
1299
|
+
_context22.next = 20;
|
|
1099
1300
|
break;
|
|
1100
1301
|
}
|
|
1101
1302
|
throw Error("Invalid tenant ID: " + tenantContractId);
|
|
1102
|
-
case
|
|
1103
|
-
|
|
1303
|
+
case 20:
|
|
1304
|
+
_context22.next = 22;
|
|
1104
1305
|
return this.CallContractMethod({
|
|
1105
1306
|
contractAddress: tenantAddress,
|
|
1106
1307
|
methodName: "groupsMapping",
|
|
1107
1308
|
methodArgs: ["tenant_admin", 0],
|
|
1108
1309
|
formatArguments: true
|
|
1109
1310
|
});
|
|
1110
|
-
case
|
|
1111
|
-
tenantAdminGroupAddress =
|
|
1112
|
-
|
|
1311
|
+
case 22:
|
|
1312
|
+
tenantAdminGroupAddress = _context22.sent;
|
|
1313
|
+
_context22.next = 25;
|
|
1113
1314
|
return this.authClient.ContractHasMethod({
|
|
1114
1315
|
contractAddress: contractAddress,
|
|
1115
1316
|
methodName: "putMeta"
|
|
1116
1317
|
});
|
|
1117
|
-
case
|
|
1118
|
-
hasPutMetaMethod =
|
|
1318
|
+
case 25:
|
|
1319
|
+
hasPutMetaMethod = _context22.sent;
|
|
1119
1320
|
if (!hasPutMetaMethod) {
|
|
1120
|
-
|
|
1321
|
+
_context22.next = 37;
|
|
1121
1322
|
break;
|
|
1122
1323
|
}
|
|
1123
|
-
|
|
1324
|
+
_context22.next = 29;
|
|
1124
1325
|
return this.ReplaceContractMetadata({
|
|
1125
1326
|
contractAddress: contractAddress,
|
|
1126
1327
|
metadataKey: "_ELV_TENANT_ID",
|
|
1127
1328
|
metadata: tenantContractId
|
|
1128
1329
|
});
|
|
1129
|
-
case
|
|
1330
|
+
case 29:
|
|
1130
1331
|
if (!tenantAdminGroupAddress) {
|
|
1131
|
-
|
|
1332
|
+
_context22.next = 34;
|
|
1132
1333
|
break;
|
|
1133
1334
|
}
|
|
1134
|
-
|
|
1335
|
+
_context22.next = 32;
|
|
1135
1336
|
return this.ReplaceContractMetadata({
|
|
1136
1337
|
contractAddress: contractAddress,
|
|
1137
1338
|
metadataKey: "_tenantId",
|
|
1138
1339
|
metadata: "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
|
|
1139
1340
|
});
|
|
1140
|
-
case
|
|
1141
|
-
|
|
1341
|
+
case 32:
|
|
1342
|
+
_context22.next = 35;
|
|
1142
1343
|
break;
|
|
1143
|
-
case
|
|
1344
|
+
case 34:
|
|
1144
1345
|
// eslint-disable-next-line no-console
|
|
1145
1346
|
console.warn("No tenant ID associated with current tenant.");
|
|
1146
|
-
case
|
|
1147
|
-
|
|
1347
|
+
case 35:
|
|
1348
|
+
_context22.next = 47;
|
|
1148
1349
|
break;
|
|
1149
|
-
case
|
|
1150
|
-
|
|
1350
|
+
case 37:
|
|
1351
|
+
_context22.next = 39;
|
|
1151
1352
|
return this.ContentObjectLibraryId({
|
|
1152
1353
|
objectId: objectId
|
|
1153
1354
|
});
|
|
1154
|
-
case
|
|
1155
|
-
libraryId =
|
|
1156
|
-
|
|
1355
|
+
case 39:
|
|
1356
|
+
libraryId = _context22.sent;
|
|
1357
|
+
_context22.next = 42;
|
|
1157
1358
|
return this.EditContentObject({
|
|
1158
1359
|
libraryId: libraryId,
|
|
1159
1360
|
objectId: objectId
|
|
1160
1361
|
});
|
|
1161
|
-
case
|
|
1162
|
-
editRequest =
|
|
1163
|
-
|
|
1362
|
+
case 42:
|
|
1363
|
+
editRequest = _context22.sent;
|
|
1364
|
+
_context22.next = 45;
|
|
1164
1365
|
return this.MergeMetadata({
|
|
1165
1366
|
libraryId: libraryId,
|
|
1166
1367
|
objectId: objectId,
|
|
@@ -1170,26 +1371,150 @@ exports.SetTenantContractId = /*#__PURE__*/function () {
|
|
|
1170
1371
|
tenantId: !tenantAdminGroupAddress ? undefined : "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
|
|
1171
1372
|
}
|
|
1172
1373
|
});
|
|
1173
|
-
case
|
|
1174
|
-
|
|
1374
|
+
case 45:
|
|
1375
|
+
_context22.next = 47;
|
|
1175
1376
|
return this.FinalizeContentObject({
|
|
1176
1377
|
libraryId: libraryId,
|
|
1177
1378
|
objectId: objectId,
|
|
1178
1379
|
writeToken: editRequest.write_token,
|
|
1179
1380
|
commitMessage: "set tenant_contract_id"
|
|
1180
1381
|
});
|
|
1181
|
-
case
|
|
1182
|
-
return
|
|
1382
|
+
case 47:
|
|
1383
|
+
return _context22.abrupt("return", {
|
|
1183
1384
|
tenantContractId: tenantContractId,
|
|
1184
1385
|
tenantId: !tenantAdminGroupAddress ? undefined : "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
|
|
1185
1386
|
});
|
|
1186
|
-
case
|
|
1387
|
+
case 48:
|
|
1187
1388
|
case "end":
|
|
1188
|
-
return
|
|
1389
|
+
return _context22.stop();
|
|
1189
1390
|
}
|
|
1190
|
-
},
|
|
1391
|
+
}, _callee22, this);
|
|
1191
1392
|
}));
|
|
1192
|
-
return function (
|
|
1193
|
-
return
|
|
1393
|
+
return function (_x20) {
|
|
1394
|
+
return _ref46.apply(this, arguments);
|
|
1395
|
+
};
|
|
1396
|
+
}();
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Remove the tenant contract ID and tenant admin group ID for the specified object
|
|
1400
|
+
*
|
|
1401
|
+
* @methodGroup Tenant
|
|
1402
|
+
* @namedParams
|
|
1403
|
+
* @param {string=} contractAddress - The address of the object
|
|
1404
|
+
* @param {string=} objectId - The ID of the object
|
|
1405
|
+
* @param {string=} versionHash - A version hash of the object
|
|
1406
|
+
*
|
|
1407
|
+
* @returns {Promise<void>}
|
|
1408
|
+
*/
|
|
1409
|
+
exports.ResetTenantId = /*#__PURE__*/function () {
|
|
1410
|
+
var _ref48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref47) {
|
|
1411
|
+
var contractAddress, objectId, versionHash, objectVersion, tenantContractId, tenantId, hasPutMetaMethod, libraryId, editRequest;
|
|
1412
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
1413
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1414
|
+
case 0:
|
|
1415
|
+
contractAddress = _ref47.contractAddress, objectId = _ref47.objectId, versionHash = _ref47.versionHash;
|
|
1416
|
+
_context23.next = 3;
|
|
1417
|
+
return GetObjectIDAndContractAddress({
|
|
1418
|
+
contractAddress: contractAddress,
|
|
1419
|
+
objectId: objectId,
|
|
1420
|
+
versionHash: versionHash
|
|
1421
|
+
});
|
|
1422
|
+
case 3:
|
|
1423
|
+
objectInfo = _context23.sent;
|
|
1424
|
+
contractAddress = objectInfo.contractAddress;
|
|
1425
|
+
objectId = objectInfo.objectId;
|
|
1426
|
+
_context23.next = 8;
|
|
1427
|
+
return this.authClient.AccessType(objectId);
|
|
1428
|
+
case 8:
|
|
1429
|
+
objectVersion = _context23.sent;
|
|
1430
|
+
if (!(objectVersion !== this.authClient.ACCESS_TYPES.GROUP && objectVersion !== this.authClient.ACCESS_TYPES.WALLET && objectVersion !== this.authClient.ACCESS_TYPES.LIBRARY && objectVersion !== this.authClient.ACCESS_TYPES.TYPE && objectVersion !== this.authClient.ACCESS_TYPES.TENANT)) {
|
|
1431
|
+
_context23.next = 11;
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1434
|
+
throw Error("Invalid object ID: ".concat(objectId, ", \n applicable only for wallet,group, library or content_type object."));
|
|
1435
|
+
case 11:
|
|
1436
|
+
tenantContractId = this.TenantContractId({
|
|
1437
|
+
objectId: objectId
|
|
1438
|
+
});
|
|
1439
|
+
tenantId = this.TenantId({
|
|
1440
|
+
objectId: objectId
|
|
1441
|
+
});
|
|
1442
|
+
if (!(tenantContractId || tenantId)) {
|
|
1443
|
+
_context23.next = 36;
|
|
1444
|
+
break;
|
|
1445
|
+
}
|
|
1446
|
+
_context23.next = 16;
|
|
1447
|
+
return this.authClient.ContractHasMethod({
|
|
1448
|
+
contractAddress: contractAddress,
|
|
1449
|
+
methodName: "putMeta"
|
|
1450
|
+
});
|
|
1451
|
+
case 16:
|
|
1452
|
+
hasPutMetaMethod = _context23.sent;
|
|
1453
|
+
if (!hasPutMetaMethod) {
|
|
1454
|
+
_context23.next = 24;
|
|
1455
|
+
break;
|
|
1456
|
+
}
|
|
1457
|
+
_context23.next = 20;
|
|
1458
|
+
return this.ReplaceContractMetadata({
|
|
1459
|
+
contractAddress: contractAddress,
|
|
1460
|
+
metadataKey: "_ELV_TENANT_ID",
|
|
1461
|
+
metadata: ""
|
|
1462
|
+
});
|
|
1463
|
+
case 20:
|
|
1464
|
+
_context23.next = 22;
|
|
1465
|
+
return this.ReplaceContractMetadata({
|
|
1466
|
+
contractAddress: contractAddress,
|
|
1467
|
+
metadataKey: "_tenantId",
|
|
1468
|
+
metadata: ""
|
|
1469
|
+
});
|
|
1470
|
+
case 22:
|
|
1471
|
+
_context23.next = 34;
|
|
1472
|
+
break;
|
|
1473
|
+
case 24:
|
|
1474
|
+
_context23.next = 26;
|
|
1475
|
+
return this.ContentObjectLibraryId({
|
|
1476
|
+
objectId: objectId
|
|
1477
|
+
});
|
|
1478
|
+
case 26:
|
|
1479
|
+
libraryId = _context23.sent;
|
|
1480
|
+
_context23.next = 29;
|
|
1481
|
+
return this.EditContentObject({
|
|
1482
|
+
libraryId: libraryId,
|
|
1483
|
+
objectId: objectId
|
|
1484
|
+
});
|
|
1485
|
+
case 29:
|
|
1486
|
+
editRequest = _context23.sent;
|
|
1487
|
+
_context23.next = 32;
|
|
1488
|
+
return this.MergeMetadata({
|
|
1489
|
+
libraryId: libraryId,
|
|
1490
|
+
objectId: objectId,
|
|
1491
|
+
writeToken: editRequest.write_token,
|
|
1492
|
+
metadata: {
|
|
1493
|
+
tenantContractId: undefined,
|
|
1494
|
+
tenantId: undefined
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
case 32:
|
|
1498
|
+
_context23.next = 34;
|
|
1499
|
+
return this.FinalizeContentObject({
|
|
1500
|
+
libraryId: libraryId,
|
|
1501
|
+
objectId: objectId,
|
|
1502
|
+
writeToken: editRequest.write_token,
|
|
1503
|
+
commitMessage: "remove tenant_contract_id"
|
|
1504
|
+
});
|
|
1505
|
+
case 34:
|
|
1506
|
+
_context23.next = 37;
|
|
1507
|
+
break;
|
|
1508
|
+
case 36:
|
|
1509
|
+
// eslint-disable-next-line no-console
|
|
1510
|
+
console.warn("No tenant ID associated with current tenant.");
|
|
1511
|
+
case 37:
|
|
1512
|
+
case "end":
|
|
1513
|
+
return _context23.stop();
|
|
1514
|
+
}
|
|
1515
|
+
}, _callee23, this);
|
|
1516
|
+
}));
|
|
1517
|
+
return function (_x21) {
|
|
1518
|
+
return _ref48.apply(this, arguments);
|
|
1194
1519
|
};
|
|
1195
1520
|
}();
|
|
@@ -516,7 +516,7 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
516
516
|
elem.media_type = 1;
|
|
517
517
|
elem.stream_name = "video";
|
|
518
518
|
elem.stream_index = 0;
|
|
519
|
-
elem.representation = "videovideo_" +
|
|
519
|
+
elem.representation = "videovideo_" + elem.width + "x" + elem.height + "_h264@" + elem.bit_rate;
|
|
520
520
|
conf.live_recording.recording_config.recording_params.ladder_specs.push(elem);
|
|
521
521
|
}
|
|
522
522
|
// Currently the recording bitrate is the top bitrate of the ladder (it will be configurable separately in the future)
|