@eluvio/elv-client-js 3.2.37 → 3.2.38

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.
@@ -84,15 +84,19 @@ exports.Visibility = /*#__PURE__*/function () {
84
84
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref) {
85
85
  var _this = this;
86
86
 
87
- var id, address;
87
+ var id, clearCache, address;
88
88
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
89
89
  while (1) {
90
90
  switch (_context2.prev = _context2.next) {
91
91
  case 0:
92
- id = _ref.id;
92
+ id = _ref.id, clearCache = _ref.clearCache;
93
93
  _context2.prev = 1;
94
94
  address = this.utils.HashToAddress(id);
95
95
 
96
+ if (clearCache) {
97
+ delete this.visibilityInfo[address];
98
+ }
99
+
96
100
  if (!this.visibilityInfo[address]) {
97
101
  this.visibilityInfo[address] = new Promise( /*#__PURE__*/function () {
98
102
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve, reject) {
@@ -152,43 +156,43 @@ exports.Visibility = /*#__PURE__*/function () {
152
156
  }());
153
157
  }
154
158
 
155
- _context2.prev = 4;
156
- _context2.next = 7;
159
+ _context2.prev = 5;
160
+ _context2.next = 8;
157
161
  return this.visibilityInfo[address];
158
162
 
159
- case 7:
163
+ case 8:
160
164
  return _context2.abrupt("return", _context2.sent);
161
165
 
162
- case 10:
163
- _context2.prev = 10;
164
- _context2.t0 = _context2["catch"](4);
166
+ case 11:
167
+ _context2.prev = 11;
168
+ _context2.t0 = _context2["catch"](5);
165
169
  delete this.visibilityInfo[address];
166
170
  throw _context2.t0;
167
171
 
168
- case 14:
169
- _context2.next = 21;
172
+ case 15:
173
+ _context2.next = 22;
170
174
  break;
171
175
 
172
- case 16:
173
- _context2.prev = 16;
176
+ case 17:
177
+ _context2.prev = 17;
174
178
  _context2.t1 = _context2["catch"](1);
175
179
 
176
180
  if (!(_context2.t1.code === "CALL_EXCEPTION")) {
177
- _context2.next = 20;
181
+ _context2.next = 21;
178
182
  break;
179
183
  }
180
184
 
181
185
  return _context2.abrupt("return", 0);
182
186
 
183
- case 20:
187
+ case 21:
184
188
  throw _context2.t1;
185
189
 
186
- case 21:
190
+ case 22:
187
191
  case "end":
188
192
  return _context2.stop();
189
193
  }
190
194
  }
191
- }, _callee2, this, [[1, 16], [4, 10]]);
195
+ }, _callee2, this, [[1, 17], [5, 11]]);
192
196
  }));
193
197
 
194
198
  return function (_x) {
@@ -211,12 +215,12 @@ exports.Permission = /*#__PURE__*/function () {
211
215
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
212
216
  var _this2 = this;
213
217
 
214
- var objectId, visibility, kmsAddress, kmsId, hasKmsConk, statusCode, permission;
218
+ var objectId, clearCache, visibility, kmsAddress, kmsId, hasKmsConk, statusCode, permission;
215
219
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
216
220
  while (1) {
217
221
  switch (_context3.prev = _context3.next) {
218
222
  case 0:
219
- objectId = _ref4.objectId;
223
+ objectId = _ref4.objectId, clearCache = _ref4.clearCache;
220
224
  ValidateObject(objectId);
221
225
  _context3.next = 4;
222
226
  return this.AccessType({
@@ -237,7 +241,8 @@ exports.Permission = /*#__PURE__*/function () {
237
241
  case 8:
238
242
  _context3.next = 10;
239
243
  return this.Visibility({
240
- id: objectId
244
+ id: objectId,
245
+ clearCache: clearCache
241
246
  });
242
247
 
243
248
  case 10:
@@ -1173,7 +1173,7 @@ exports.CopyContentObject = /*#__PURE__*/function () {
1173
1173
  var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref22) {
1174
1174
  var _this2 = this;
1175
1175
 
1176
- var libraryId, originalVersionHash, _ref22$options, options, _yield$this$CreateCon, objectId, writeToken, originalObjectId, metadata, permission, userCapKey, isOwner, userConkKey;
1176
+ var libraryId, originalVersionHash, _ref22$options, options, _yield$this$CreateCon, objectId, writeToken, originalObjectId, metadata, permission, userCapKey, userConkKey;
1177
1177
 
1178
1178
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1179
1179
  while (1) {
@@ -1212,57 +1212,38 @@ exports.CopyContentObject = /*#__PURE__*/function () {
1212
1212
  userCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
1213
1213
 
1214
1214
  if (!metadata[userCapKey]) {
1215
- _context13.next = 40;
1215
+ _context13.next = 33;
1216
1216
  break;
1217
1217
  }
1218
1218
 
1219
- _context13.t0 = this.utils;
1220
- _context13.t1 = this.signer.address;
1221
- _context13.next = 22;
1222
- return this.ContentObjectOwner({
1223
- objectId: originalObjectId
1224
- });
1225
-
1226
- case 22:
1227
- _context13.t2 = _context13.sent;
1228
- isOwner = _context13.t0.EqualAddress.call(_context13.t0, _context13.t1, _context13.t2);
1229
-
1230
- if (isOwner) {
1231
- _context13.next = 26;
1232
- break;
1233
- }
1234
-
1235
- throw Error("Current user is not owner of object ".concat(metadata));
1236
-
1237
- case 26:
1238
- _context13.next = 28;
1219
+ _context13.next = 20;
1239
1220
  return this.Crypto.DecryptCap(metadata[userCapKey], this.signer.signingKey.privateKey);
1240
1221
 
1241
- case 28:
1222
+ case 20:
1242
1223
  userConkKey = _context13.sent;
1243
1224
  userConkKey.qid = objectId;
1244
- _context13.t3 = this;
1245
- _context13.t4 = libraryId;
1246
- _context13.t5 = objectId;
1247
- _context13.t6 = writeToken;
1248
- _context13.t7 = userCapKey;
1249
- _context13.next = 37;
1225
+ _context13.t0 = this;
1226
+ _context13.t1 = libraryId;
1227
+ _context13.t2 = objectId;
1228
+ _context13.t3 = writeToken;
1229
+ _context13.t4 = userCapKey;
1230
+ _context13.next = 29;
1250
1231
  return this.Crypto.EncryptConk(userConkKey, this.signer.signingKey.publicKey);
1251
1232
 
1252
- case 37:
1253
- _context13.t8 = _context13.sent;
1254
- _context13.t9 = {
1255
- libraryId: _context13.t4,
1256
- objectId: _context13.t5,
1257
- writeToken: _context13.t6,
1258
- metadataSubtree: _context13.t7,
1259
- metadata: _context13.t8
1233
+ case 29:
1234
+ _context13.t5 = _context13.sent;
1235
+ _context13.t6 = {
1236
+ libraryId: _context13.t1,
1237
+ objectId: _context13.t2,
1238
+ writeToken: _context13.t3,
1239
+ metadataSubtree: _context13.t4,
1240
+ metadata: _context13.t5
1260
1241
  };
1242
+ _context13.next = 33;
1243
+ return _context13.t0.ReplaceMetadata.call(_context13.t0, _context13.t6);
1261
1244
 
1262
- _context13.t3.ReplaceMetadata.call(_context13.t3, _context13.t9);
1263
-
1264
- case 40:
1265
- _context13.next = 42;
1245
+ case 33:
1246
+ _context13.next = 35;
1266
1247
  return Promise.all(Object.keys(metadata).filter(function (key) {
1267
1248
  return key.startsWith("eluv.caps.ikms");
1268
1249
  }).map( /*#__PURE__*/function () {
@@ -1295,31 +1276,31 @@ exports.CopyContentObject = /*#__PURE__*/function () {
1295
1276
  };
1296
1277
  }()));
1297
1278
 
1298
- case 42:
1279
+ case 35:
1299
1280
  if (!(permission !== "owner")) {
1300
- _context13.next = 45;
1281
+ _context13.next = 38;
1301
1282
  break;
1302
1283
  }
1303
1284
 
1304
- _context13.next = 45;
1285
+ _context13.next = 38;
1305
1286
  return this.SetPermission({
1306
1287
  objectId: objectId,
1307
1288
  permission: permission,
1308
1289
  writeToken: writeToken
1309
1290
  });
1310
1291
 
1311
- case 45:
1312
- _context13.next = 47;
1292
+ case 38:
1293
+ _context13.next = 40;
1313
1294
  return this.FinalizeContentObject({
1314
1295
  libraryId: libraryId,
1315
1296
  objectId: objectId,
1316
1297
  writeToken: writeToken
1317
1298
  });
1318
1299
 
1319
- case 47:
1300
+ case 40:
1320
1301
  return _context13.abrupt("return", _context13.sent);
1321
1302
 
1322
- case 48:
1303
+ case 41:
1323
1304
  case "end":
1324
1305
  return _context13.stop();
1325
1306
  }