@eluvio/elv-client-js 3.2.2 → 3.2.6
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 +15 -11
- package/dist/ElvClient-node-min.js +17 -13
- package/dist/ElvFrameClient-min.js +12 -8
- package/dist/ElvPermissionsClient-min.js +13 -9
- package/dist/ElvWalletClient-min.js +58 -0
- package/dist/ElvWalletClient-node-min.js +78 -0
- package/dist/src/AuthorizationClient.js +2248 -1990
- package/dist/src/ContentObjectVerification.js +164 -173
- package/dist/src/Crypto.js +376 -324
- package/dist/src/ElvClient.js +1182 -1019
- package/dist/src/ElvWallet.js +119 -95
- package/dist/src/EthClient.js +1040 -896
- package/dist/src/FrameClient.js +331 -300
- package/dist/src/HttpClient.js +153 -147
- package/dist/src/Id.js +1 -3
- package/dist/src/PermissionsClient.js +1294 -1168
- package/dist/src/RemoteSigner.js +263 -211
- package/dist/src/UserProfileClient.js +1164 -1023
- package/dist/src/Utils.js +209 -181
- package/dist/src/client/ABRPublishing.js +895 -858
- package/dist/src/client/AccessGroups.js +1102 -959
- package/dist/src/client/ContentAccess.js +3724 -3431
- package/dist/src/client/ContentManagement.js +2252 -2068
- package/dist/src/client/Contracts.js +647 -563
- package/dist/src/client/Files.js +1886 -1757
- package/dist/src/client/NFT.js +126 -112
- package/dist/src/client/NTP.js +478 -422
- package/dist/src/walletClient/ClientMethods.js +1029 -879
- package/dist/src/walletClient/Utils.js +84 -70
- package/dist/src/walletClient/index.js +1203 -1087
- package/package.json +4 -2
- package/src/Utils.js +0 -1
- package/src/walletClient/ClientMethods.js +34 -2
- package/src/walletClient/index.js +3 -3
- package/utilities/ProductionMasterCreate.js +2 -2
package/dist/src/FrameClient.js
CHANGED
|
@@ -2,13 +2,21 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
|
2
2
|
|
|
3
3
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
4
|
|
|
5
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
6
|
+
|
|
5
7
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
6
8
|
|
|
7
9
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
8
10
|
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
+
|
|
15
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
10
16
|
|
|
11
|
-
function
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
|
|
19
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
20
|
|
|
13
21
|
var Id = require("./Id");
|
|
14
22
|
|
|
@@ -16,9 +24,7 @@ var Utils = require("./Utils");
|
|
|
16
24
|
|
|
17
25
|
var permissionLevels = require("./client/ContentAccess").permissionLevels;
|
|
18
26
|
|
|
19
|
-
var FrameClient =
|
|
20
|
-
/*#__PURE__*/
|
|
21
|
-
function () {
|
|
27
|
+
var FrameClient = /*#__PURE__*/function () {
|
|
22
28
|
"use strict";
|
|
23
29
|
|
|
24
30
|
/**
|
|
@@ -71,126 +77,118 @@ function () {
|
|
|
71
77
|
this.timeout = timeout;
|
|
72
78
|
this.utils = Utils; // Dynamically defined methods defined in AllowedMethods
|
|
73
79
|
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
var _iteratorError = undefined;
|
|
80
|
+
var _iterator = _createForOfIteratorHelper(this.AllowedMethods()),
|
|
81
|
+
_step;
|
|
77
82
|
|
|
78
83
|
try {
|
|
79
84
|
var _loop = function _loop() {
|
|
80
85
|
var methodName = _step.value;
|
|
81
86
|
|
|
82
|
-
_this[methodName] = function
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
_this[methodName] = /*#__PURE__*/function () {
|
|
88
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(args) {
|
|
89
|
+
var callback;
|
|
90
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
91
|
+
while (1) {
|
|
92
|
+
switch (_context.prev = _context.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
callback = args && args.callback;
|
|
95
|
+
|
|
96
|
+
if (callback) {
|
|
97
|
+
delete args.callback;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
_context.next = 4;
|
|
101
|
+
return _this.SendMessage({
|
|
102
|
+
options: {
|
|
103
|
+
calledMethod: methodName,
|
|
104
|
+
args: _this.utils.MakeClonable(args)
|
|
105
|
+
},
|
|
106
|
+
callback: callback
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
case 4:
|
|
110
|
+
return _context.abrupt("return", _context.sent);
|
|
111
|
+
|
|
112
|
+
case 5:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
115
|
+
}
|
|
109
116
|
}
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
117
|
+
}, _callee);
|
|
118
|
+
}));
|
|
119
|
+
|
|
120
|
+
return function (_x) {
|
|
121
|
+
return _ref2.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
}();
|
|
113
124
|
};
|
|
114
125
|
|
|
115
|
-
for (
|
|
126
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
116
127
|
_loop();
|
|
117
128
|
}
|
|
118
129
|
} catch (err) {
|
|
119
|
-
|
|
120
|
-
_iteratorError = err;
|
|
130
|
+
_iterator.e(err);
|
|
121
131
|
} finally {
|
|
122
|
-
|
|
123
|
-
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
|
|
124
|
-
_iterator["return"]();
|
|
125
|
-
}
|
|
126
|
-
} finally {
|
|
127
|
-
if (_didIteratorError) {
|
|
128
|
-
throw _iteratorError;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
132
|
+
_iterator.f();
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
this.userProfileClient = {}; // Dynamically defined user profile methods defined in AllowedUserProfileMethods
|
|
134
136
|
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
var _iteratorError2 = undefined;
|
|
137
|
+
var _iterator2 = _createForOfIteratorHelper(this.AllowedUserProfileMethods()),
|
|
138
|
+
_step2;
|
|
138
139
|
|
|
139
140
|
try {
|
|
140
141
|
var _loop2 = function _loop2() {
|
|
141
142
|
var methodName = _step2.value;
|
|
142
143
|
|
|
143
|
-
_this.userProfileClient[methodName] = function
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
144
|
+
_this.userProfileClient[methodName] = /*#__PURE__*/function () {
|
|
145
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(args) {
|
|
146
|
+
var callback;
|
|
147
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
148
|
+
while (1) {
|
|
149
|
+
switch (_context2.prev = _context2.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
callback = args && args.callback;
|
|
152
|
+
|
|
153
|
+
if (callback) {
|
|
154
|
+
delete args.callback;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
_context2.next = 4;
|
|
158
|
+
return _this.SendMessage({
|
|
159
|
+
options: {
|
|
160
|
+
module: "userProfileClient",
|
|
161
|
+
calledMethod: methodName,
|
|
162
|
+
args: _this.utils.MakeClonable(args),
|
|
163
|
+
prompted: FrameClient.PromptedMethods().includes(methodName)
|
|
164
|
+
},
|
|
165
|
+
callback: callback
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
case 4:
|
|
169
|
+
return _context2.abrupt("return", _context2.sent);
|
|
170
|
+
|
|
171
|
+
case 5:
|
|
172
|
+
case "end":
|
|
173
|
+
return _context2.stop();
|
|
174
|
+
}
|
|
172
175
|
}
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
+
}, _callee2);
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
return function (_x2) {
|
|
180
|
+
return _ref3.apply(this, arguments);
|
|
181
|
+
};
|
|
182
|
+
}();
|
|
176
183
|
};
|
|
177
184
|
|
|
178
|
-
for (
|
|
185
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
179
186
|
_loop2();
|
|
180
187
|
}
|
|
181
188
|
} catch (err) {
|
|
182
|
-
|
|
183
|
-
_iteratorError2 = err;
|
|
189
|
+
_iterator2.e(err);
|
|
184
190
|
} finally {
|
|
185
|
-
|
|
186
|
-
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
|
|
187
|
-
_iterator2["return"]();
|
|
188
|
-
}
|
|
189
|
-
} finally {
|
|
190
|
-
if (_didIteratorError2) {
|
|
191
|
-
throw _iteratorError2;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
191
|
+
_iterator2.f();
|
|
194
192
|
}
|
|
195
193
|
}
|
|
196
194
|
/**
|
|
@@ -205,246 +203,279 @@ function () {
|
|
|
205
203
|
|
|
206
204
|
_createClass(FrameClient, [{
|
|
207
205
|
key: "PassRequest",
|
|
208
|
-
value: function
|
|
209
|
-
var
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
_context3.next = 5;
|
|
228
|
-
return _regeneratorRuntime.awrap(this.SendMessage({
|
|
229
|
-
options: request,
|
|
230
|
-
callback: callback
|
|
231
|
-
}));
|
|
232
|
-
|
|
233
|
-
case 5:
|
|
234
|
-
response = _context3.sent;
|
|
235
|
-
_context3.next = 11;
|
|
236
|
-
break;
|
|
237
|
-
|
|
238
|
-
case 8:
|
|
239
|
-
_context3.prev = 8;
|
|
240
|
-
_context3.t0 = _context3["catch"](1);
|
|
241
|
-
error = _context3.t0;
|
|
242
|
-
|
|
243
|
-
case 11:
|
|
244
|
-
return _context3.abrupt("return", {
|
|
245
|
-
type: "ElvFrameResponse",
|
|
246
|
-
requestId: request.requestId,
|
|
247
|
-
response: response,
|
|
248
|
-
error: error
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
case 12:
|
|
252
|
-
case "end":
|
|
253
|
-
return _context3.stop();
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}, null, this, [[1, 8]]);
|
|
257
|
-
}
|
|
258
|
-
}, {
|
|
259
|
-
key: "SendMessage",
|
|
260
|
-
value: function SendMessage(_ref3) {
|
|
261
|
-
var _ref3$options, options, callback, _ref3$noResponse, noResponse, requestId, callbackId, operation, isFileOperation, timeout;
|
|
262
|
-
|
|
263
|
-
return _regeneratorRuntime.async(function SendMessage$(_context4) {
|
|
264
|
-
while (1) {
|
|
265
|
-
switch (_context4.prev = _context4.next) {
|
|
266
|
-
case 0:
|
|
267
|
-
_ref3$options = _ref3.options, options = _ref3$options === void 0 ? {} : _ref3$options, callback = _ref3.callback, _ref3$noResponse = _ref3.noResponse, noResponse = _ref3$noResponse === void 0 ? false : _ref3$noResponse;
|
|
268
|
-
requestId = Id.next();
|
|
269
|
-
|
|
270
|
-
if (callback) {
|
|
271
|
-
callbackId = Id.next();
|
|
272
|
-
}
|
|
206
|
+
value: function () {
|
|
207
|
+
var _PassRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
208
|
+
var request, Respond, response, error, callback;
|
|
209
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
210
|
+
while (1) {
|
|
211
|
+
switch (_context3.prev = _context3.next) {
|
|
212
|
+
case 0:
|
|
213
|
+
request = _ref4.request, Respond = _ref4.Respond;
|
|
214
|
+
_context3.prev = 1;
|
|
215
|
+
|
|
216
|
+
if (request.callbackId) {
|
|
217
|
+
callback = function callback(result) {
|
|
218
|
+
return Respond({
|
|
219
|
+
type: "ElvFrameResponse",
|
|
220
|
+
requestId: request.callbackId,
|
|
221
|
+
response: result
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
}
|
|
273
225
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
226
|
+
_context3.next = 5;
|
|
227
|
+
return this.SendMessage({
|
|
228
|
+
options: request,
|
|
229
|
+
callback: callback
|
|
230
|
+
});
|
|
279
231
|
|
|
280
|
-
|
|
281
|
-
|
|
232
|
+
case 5:
|
|
233
|
+
response = _context3.sent;
|
|
234
|
+
_context3.next = 11;
|
|
282
235
|
break;
|
|
283
|
-
}
|
|
284
236
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
237
|
+
case 8:
|
|
238
|
+
_context3.prev = 8;
|
|
239
|
+
_context3.t0 = _context3["catch"](1);
|
|
240
|
+
error = _context3.t0;
|
|
241
|
+
|
|
242
|
+
case 11:
|
|
243
|
+
return _context3.abrupt("return", {
|
|
244
|
+
type: "ElvFrameResponse",
|
|
245
|
+
requestId: request.requestId,
|
|
246
|
+
response: response,
|
|
247
|
+
error: error
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
case 12:
|
|
251
|
+
case "end":
|
|
252
|
+
return _context3.stop();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}, _callee3, this, [[1, 8]]);
|
|
256
|
+
}));
|
|
291
257
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
timeout = options.args.fcTimeout;
|
|
296
|
-
}
|
|
258
|
+
function PassRequest(_x3) {
|
|
259
|
+
return _PassRequest.apply(this, arguments);
|
|
260
|
+
}
|
|
297
261
|
|
|
298
|
-
|
|
299
|
-
|
|
262
|
+
return PassRequest;
|
|
263
|
+
}()
|
|
264
|
+
}, {
|
|
265
|
+
key: "SendMessage",
|
|
266
|
+
value: function () {
|
|
267
|
+
var _SendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
268
|
+
var _ref5$options, options, callback, _ref5$noResponse, noResponse, requestId, callbackId, operation, isFileOperation, timeout;
|
|
269
|
+
|
|
270
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
271
|
+
while (1) {
|
|
272
|
+
switch (_context4.prev = _context4.next) {
|
|
273
|
+
case 0:
|
|
274
|
+
_ref5$options = _ref5.options, options = _ref5$options === void 0 ? {} : _ref5$options, callback = _ref5.callback, _ref5$noResponse = _ref5.noResponse, noResponse = _ref5$noResponse === void 0 ? false : _ref5$noResponse;
|
|
275
|
+
requestId = Id.next();
|
|
276
|
+
|
|
277
|
+
if (callback) {
|
|
278
|
+
callbackId = Id.next();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
this.target.postMessage(_objectSpread(_objectSpread({}, options), {}, {
|
|
282
|
+
type: "ElvFrameRequest",
|
|
283
|
+
requestId: requestId,
|
|
284
|
+
callbackId: callbackId
|
|
285
|
+
}), "*"); // No timeout for prompted methods
|
|
286
|
+
|
|
287
|
+
if (!noResponse) {
|
|
288
|
+
_context4.next = 6;
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return _context4.abrupt("return");
|
|
293
|
+
|
|
294
|
+
case 6:
|
|
295
|
+
operation = options.calledMethod || options.operation;
|
|
296
|
+
isFileOperation = FrameClient.FileMethods().includes(options.calledMethod);
|
|
297
|
+
timeout = this.timeout;
|
|
298
|
+
|
|
299
|
+
if (options.prompted || isFileOperation) {
|
|
300
|
+
timeout = 0;
|
|
301
|
+
} else if (options.args && options.args.fcTimeout) {
|
|
302
|
+
timeout = options.args.fcTimeout;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
_context4.next = 12;
|
|
306
|
+
return this.AwaitMessage(requestId, timeout, callback, callbackId, operation);
|
|
307
|
+
|
|
308
|
+
case 12:
|
|
309
|
+
return _context4.abrupt("return", _context4.sent);
|
|
310
|
+
|
|
311
|
+
case 13:
|
|
312
|
+
case "end":
|
|
313
|
+
return _context4.stop();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}, _callee4, this);
|
|
317
|
+
}));
|
|
300
318
|
|
|
301
|
-
|
|
302
|
-
|
|
319
|
+
function SendMessage(_x4) {
|
|
320
|
+
return _SendMessage.apply(this, arguments);
|
|
321
|
+
}
|
|
303
322
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
return _context4.stop();
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}, null, this);
|
|
310
|
-
}
|
|
323
|
+
return SendMessage;
|
|
324
|
+
}()
|
|
311
325
|
}, {
|
|
312
326
|
key: "AwaitMessage",
|
|
313
|
-
value: function
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (timeout > 0) {
|
|
331
|
-
timeoutId = setTimeout(function () {
|
|
332
|
-
if (typeof window !== "undefined") {
|
|
333
|
-
window.removeEventListener("message", _methodListener);
|
|
334
|
-
|
|
335
|
-
if (callbackListener) {
|
|
336
|
-
window.removeEventListener("message", callbackListener);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
reject("Request ".concat(requestId, " timed out (").concat(operation, ")"));
|
|
341
|
-
}, timeout * 1000);
|
|
342
|
-
}
|
|
343
|
-
}; // Set up callback listener
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
var callbackListener;
|
|
347
|
-
|
|
348
|
-
if (callbackId) {
|
|
349
|
-
callbackListener = function callbackListener(event) {
|
|
350
|
-
try {
|
|
351
|
-
touchTimeout();
|
|
352
|
-
var message = event.data;
|
|
353
|
-
|
|
354
|
-
if (message.type !== "ElvFrameResponse" || message.requestId !== callbackId) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
callback(message.response);
|
|
359
|
-
} catch (error) {
|
|
360
|
-
// eslint-disable-next-line no-console
|
|
361
|
-
console.error(error);
|
|
327
|
+
value: function () {
|
|
328
|
+
var _AwaitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(requestId, timeout, callback, callbackId, operation) {
|
|
329
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
330
|
+
while (1) {
|
|
331
|
+
switch (_context6.prev = _context6.next) {
|
|
332
|
+
case 0:
|
|
333
|
+
_context6.next = 2;
|
|
334
|
+
return new Promise(function (resolve, reject) {
|
|
335
|
+
var methodListener; // Initialize or reset timeout
|
|
336
|
+
|
|
337
|
+
// Initialize or reset timeout
|
|
338
|
+
var timeoutId;
|
|
339
|
+
|
|
340
|
+
var touchTimeout = function touchTimeout() {
|
|
341
|
+
if (timeoutId) {
|
|
342
|
+
clearTimeout(timeoutId);
|
|
362
343
|
}
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
window.addEventListener("message", callbackListener);
|
|
366
|
-
} // Set up final method response listener
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
_methodListener = function methodListener(event) {
|
|
370
|
-
var message;
|
|
371
|
-
return _regeneratorRuntime.async(function methodListener$(_context5) {
|
|
372
|
-
while (1) {
|
|
373
|
-
switch (_context5.prev = _context5.next) {
|
|
374
|
-
case 0:
|
|
375
|
-
_context5.prev = 0;
|
|
376
|
-
message = event.data;
|
|
377
|
-
|
|
378
|
-
if (!(message.type !== "ElvFrameResponse" || message.requestId !== requestId)) {
|
|
379
|
-
_context5.next = 4;
|
|
380
|
-
break;
|
|
381
|
-
}
|
|
382
344
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
window.removeEventListener("message", _methodListener);
|
|
345
|
+
if (timeout > 0) {
|
|
346
|
+
timeoutId = setTimeout(function () {
|
|
347
|
+
if (typeof window !== "undefined") {
|
|
348
|
+
window.removeEventListener("message", methodListener);
|
|
388
349
|
|
|
389
350
|
if (callbackListener) {
|
|
390
351
|
window.removeEventListener("message", callbackListener);
|
|
391
352
|
}
|
|
353
|
+
}
|
|
392
354
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
355
|
+
reject("Request ".concat(requestId, " timed out (").concat(operation, ")"));
|
|
356
|
+
}, timeout * 1000);
|
|
357
|
+
}
|
|
358
|
+
}; // Set up callback listener
|
|
398
359
|
|
|
399
|
-
_context5.next = 16;
|
|
400
|
-
break;
|
|
401
360
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
_context5.t0 = _context5["catch"](0);
|
|
405
|
-
clearTimeout(timeoutId);
|
|
406
|
-
window.removeEventListener("message", _methodListener);
|
|
361
|
+
// Set up callback listener
|
|
362
|
+
var callbackListener;
|
|
407
363
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
364
|
+
if (callbackId) {
|
|
365
|
+
callbackListener = function callbackListener(event) {
|
|
366
|
+
try {
|
|
367
|
+
touchTimeout();
|
|
368
|
+
var message = event.data;
|
|
411
369
|
|
|
412
|
-
|
|
370
|
+
if (message.type !== "ElvFrameResponse" || message.requestId !== callbackId) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
413
373
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
374
|
+
callback(message.response);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
// eslint-disable-next-line no-console
|
|
377
|
+
console.error(error);
|
|
417
378
|
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
window.addEventListener("message", callbackListener);
|
|
382
|
+
} // Set up final method response listener
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
// Set up final method response listener
|
|
386
|
+
methodListener = /*#__PURE__*/function () {
|
|
387
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(event) {
|
|
388
|
+
var message;
|
|
389
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
390
|
+
while (1) {
|
|
391
|
+
switch (_context5.prev = _context5.next) {
|
|
392
|
+
case 0:
|
|
393
|
+
_context5.prev = 0;
|
|
394
|
+
message = event.data;
|
|
395
|
+
|
|
396
|
+
if (!(message.type !== "ElvFrameResponse" || message.requestId !== requestId)) {
|
|
397
|
+
_context5.next = 4;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return _context5.abrupt("return");
|
|
402
|
+
|
|
403
|
+
case 4:
|
|
404
|
+
clearTimeout(timeoutId);
|
|
405
|
+
window.removeEventListener("message", methodListener);
|
|
406
|
+
|
|
407
|
+
if (callbackListener) {
|
|
408
|
+
window.removeEventListener("message", callbackListener);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (message.error) {
|
|
412
|
+
reject(message.error);
|
|
413
|
+
} else {
|
|
414
|
+
resolve(message.response);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
_context5.next = 16;
|
|
418
|
+
break;
|
|
419
|
+
|
|
420
|
+
case 10:
|
|
421
|
+
_context5.prev = 10;
|
|
422
|
+
_context5.t0 = _context5["catch"](0);
|
|
423
|
+
clearTimeout(timeoutId);
|
|
424
|
+
window.removeEventListener("message", methodListener);
|
|
425
|
+
|
|
426
|
+
if (callbackListener) {
|
|
427
|
+
window.removeEventListener("message", callbackListener);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
reject(_context5.t0);
|
|
431
|
+
|
|
432
|
+
case 16:
|
|
433
|
+
case "end":
|
|
434
|
+
return _context5.stop();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}, _callee5, null, [[0, 10]]);
|
|
438
|
+
}));
|
|
439
|
+
|
|
440
|
+
return function methodListener(_x10) {
|
|
441
|
+
return _ref6.apply(this, arguments);
|
|
442
|
+
};
|
|
443
|
+
}(); // Start the timeout
|
|
421
444
|
|
|
422
445
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
446
|
+
// Start the timeout
|
|
447
|
+
touchTimeout();
|
|
448
|
+
window.addEventListener("message", methodListener);
|
|
449
|
+
});
|
|
426
450
|
|
|
427
|
-
|
|
428
|
-
|
|
451
|
+
case 2:
|
|
452
|
+
return _context6.abrupt("return", _context6.sent);
|
|
429
453
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
454
|
+
case 3:
|
|
455
|
+
case "end":
|
|
456
|
+
return _context6.stop();
|
|
457
|
+
}
|
|
433
458
|
}
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
|
|
459
|
+
}, _callee6);
|
|
460
|
+
}));
|
|
461
|
+
|
|
462
|
+
function AwaitMessage(_x5, _x6, _x7, _x8, _x9) {
|
|
463
|
+
return _AwaitMessage.apply(this, arguments);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return AwaitMessage;
|
|
467
|
+
}() // List of methods that may require a prompt - these should have an unlimited timeout period
|
|
437
468
|
|
|
438
469
|
}, {
|
|
439
470
|
key: "AllowedMethods",
|
|
440
|
-
// List of allowed methods available to frames
|
|
471
|
+
value: // List of allowed methods available to frames
|
|
441
472
|
// This should match ElvClient.FrameAvailableMethods()
|
|
442
473
|
// ElvClient will also reject any disallowed methods
|
|
443
474
|
|
|
444
475
|
/**
|
|
445
476
|
* @returns {Array<string>} - List of ElvClient methods available to a FrameClient
|
|
446
477
|
*/
|
|
447
|
-
|
|
478
|
+
function AllowedMethods() {
|
|
448
479
|
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFiles", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
|
|
449
480
|
}
|
|
450
481
|
}, {
|