@eluvio/elv-client-js 3.1.96 → 3.2.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/dist/ElvClient-min.js +11 -15
- package/dist/ElvClient-node-min.js +13 -17
- package/dist/ElvFrameClient-min.js +9 -13
- package/dist/ElvPermissionsClient-min.js +9 -13
- package/dist/src/AuthorizationClient.js +1980 -2238
- package/dist/src/ContentObjectVerification.js +173 -164
- package/dist/src/Crypto.js +324 -376
- package/dist/src/ElvClient.js +1022 -1182
- package/dist/src/ElvWallet.js +95 -119
- package/dist/src/EthClient.js +896 -1040
- package/dist/src/FrameClient.js +300 -331
- package/dist/src/HttpClient.js +147 -153
- package/dist/src/Id.js +3 -1
- package/dist/src/PermissionsClient.js +1168 -1294
- package/dist/src/RemoteSigner.js +211 -263
- package/dist/src/UserProfileClient.js +1023 -1164
- package/dist/src/Utils.js +217 -212
- package/dist/src/client/ABRPublishing.js +858 -895
- package/dist/src/client/AccessGroups.js +959 -1102
- package/dist/src/client/ContentAccess.js +3434 -3727
- package/dist/src/client/ContentManagement.js +2068 -2252
- package/dist/src/client/Contracts.js +563 -647
- package/dist/src/client/Files.js +1757 -1886
- package/dist/src/client/NFT.js +112 -126
- package/dist/src/client/NTP.js +422 -478
- package/dist/src/index.js +11 -0
- package/dist/src/marketplaceClient/ClientMethods.js +1918 -0
- package/dist/src/marketplaceClient/Configuration.js +29 -0
- package/dist/src/marketplaceClient/Utils.js +304 -0
- package/dist/src/marketplaceClient/index.js +1553 -0
- package/dist/src/walletClient/ClientMethods.js +1828 -0
- package/dist/src/walletClient/Configuration.js +29 -0
- package/dist/src/walletClient/Utils.js +290 -0
- package/dist/src/walletClient/index.js +1459 -0
- package/package.json +5 -3
- package/src/ElvClient.js +4 -1
- package/src/Utils.js +44 -3
- package/src/index.js +7 -0
- package/src/walletClient/ClientMethods.js +1016 -0
- package/src/walletClient/Configuration.js +40 -0
- package/src/walletClient/README.md +185 -0
- package/src/walletClient/Utils.js +234 -0
- package/src/walletClient/index.js +884 -0
- package/testScripts/TestMarketplaceClient.js +25 -0
package/dist/src/FrameClient.js
CHANGED
|
@@ -2,21 +2,13 @@ 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
|
-
|
|
7
5
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
8
6
|
|
|
9
7
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
10
8
|
|
|
11
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly
|
|
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; } } }; }
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
16
10
|
|
|
17
|
-
function
|
|
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; }
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
20
12
|
|
|
21
13
|
var Id = require("./Id");
|
|
22
14
|
|
|
@@ -24,7 +16,9 @@ var Utils = require("./Utils");
|
|
|
24
16
|
|
|
25
17
|
var permissionLevels = require("./client/ContentAccess").permissionLevels;
|
|
26
18
|
|
|
27
|
-
var FrameClient =
|
|
19
|
+
var FrameClient =
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
function () {
|
|
28
22
|
"use strict";
|
|
29
23
|
|
|
30
24
|
/**
|
|
@@ -77,118 +71,126 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
77
71
|
this.timeout = timeout;
|
|
78
72
|
this.utils = Utils; // Dynamically defined methods defined in AllowedMethods
|
|
79
73
|
|
|
80
|
-
var
|
|
81
|
-
|
|
74
|
+
var _iteratorNormalCompletion = true;
|
|
75
|
+
var _didIteratorError = false;
|
|
76
|
+
var _iteratorError = undefined;
|
|
82
77
|
|
|
83
78
|
try {
|
|
84
79
|
var _loop = function _loop() {
|
|
85
80
|
var methodName = _step.value;
|
|
86
81
|
|
|
87
|
-
_this[methodName] =
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return _context.stop();
|
|
115
|
-
}
|
|
82
|
+
_this[methodName] = function _callee(args) {
|
|
83
|
+
var callback;
|
|
84
|
+
return _regeneratorRuntime.async(function _callee$(_context) {
|
|
85
|
+
while (1) {
|
|
86
|
+
switch (_context.prev = _context.next) {
|
|
87
|
+
case 0:
|
|
88
|
+
callback = args && args.callback;
|
|
89
|
+
|
|
90
|
+
if (callback) {
|
|
91
|
+
delete args.callback;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_context.next = 4;
|
|
95
|
+
return _regeneratorRuntime.awrap(_this.SendMessage({
|
|
96
|
+
options: {
|
|
97
|
+
calledMethod: methodName,
|
|
98
|
+
args: _this.utils.MakeClonable(args)
|
|
99
|
+
},
|
|
100
|
+
callback: callback
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
case 4:
|
|
104
|
+
return _context.abrupt("return", _context.sent);
|
|
105
|
+
|
|
106
|
+
case 5:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context.stop();
|
|
116
109
|
}
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
return function (_x) {
|
|
121
|
-
return _ref2.apply(this, arguments);
|
|
122
|
-
};
|
|
123
|
-
}();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
};
|
|
124
113
|
};
|
|
125
114
|
|
|
126
|
-
for (_iterator.
|
|
115
|
+
for (var _iterator = this.AllowedMethods()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
127
116
|
_loop();
|
|
128
117
|
}
|
|
129
118
|
} catch (err) {
|
|
130
|
-
|
|
119
|
+
_didIteratorError = true;
|
|
120
|
+
_iteratorError = err;
|
|
131
121
|
} finally {
|
|
132
|
-
|
|
122
|
+
try {
|
|
123
|
+
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
|
|
124
|
+
_iterator["return"]();
|
|
125
|
+
}
|
|
126
|
+
} finally {
|
|
127
|
+
if (_didIteratorError) {
|
|
128
|
+
throw _iteratorError;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
this.userProfileClient = {}; // Dynamically defined user profile methods defined in AllowedUserProfileMethods
|
|
136
134
|
|
|
137
|
-
var
|
|
138
|
-
|
|
135
|
+
var _iteratorNormalCompletion2 = true;
|
|
136
|
+
var _didIteratorError2 = false;
|
|
137
|
+
var _iteratorError2 = undefined;
|
|
139
138
|
|
|
140
139
|
try {
|
|
141
140
|
var _loop2 = function _loop2() {
|
|
142
141
|
var methodName = _step2.value;
|
|
143
142
|
|
|
144
|
-
_this.userProfileClient[methodName] =
|
|
145
|
-
var
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
return _context2.stop();
|
|
174
|
-
}
|
|
143
|
+
_this.userProfileClient[methodName] = function _callee2(args) {
|
|
144
|
+
var callback;
|
|
145
|
+
return _regeneratorRuntime.async(function _callee2$(_context2) {
|
|
146
|
+
while (1) {
|
|
147
|
+
switch (_context2.prev = _context2.next) {
|
|
148
|
+
case 0:
|
|
149
|
+
callback = args && args.callback;
|
|
150
|
+
|
|
151
|
+
if (callback) {
|
|
152
|
+
delete args.callback;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
_context2.next = 4;
|
|
156
|
+
return _regeneratorRuntime.awrap(_this.SendMessage({
|
|
157
|
+
options: {
|
|
158
|
+
module: "userProfileClient",
|
|
159
|
+
calledMethod: methodName,
|
|
160
|
+
args: _this.utils.MakeClonable(args),
|
|
161
|
+
prompted: FrameClient.PromptedMethods().includes(methodName)
|
|
162
|
+
},
|
|
163
|
+
callback: callback
|
|
164
|
+
}));
|
|
165
|
+
|
|
166
|
+
case 4:
|
|
167
|
+
return _context2.abrupt("return", _context2.sent);
|
|
168
|
+
|
|
169
|
+
case 5:
|
|
170
|
+
case "end":
|
|
171
|
+
return _context2.stop();
|
|
175
172
|
}
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
return function (_x2) {
|
|
180
|
-
return _ref3.apply(this, arguments);
|
|
181
|
-
};
|
|
182
|
-
}();
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
};
|
|
183
176
|
};
|
|
184
177
|
|
|
185
|
-
for (_iterator2.
|
|
178
|
+
for (var _iterator2 = this.AllowedUserProfileMethods()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
186
179
|
_loop2();
|
|
187
180
|
}
|
|
188
181
|
} catch (err) {
|
|
189
|
-
|
|
182
|
+
_didIteratorError2 = true;
|
|
183
|
+
_iteratorError2 = err;
|
|
190
184
|
} finally {
|
|
191
|
-
|
|
185
|
+
try {
|
|
186
|
+
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
|
|
187
|
+
_iterator2["return"]();
|
|
188
|
+
}
|
|
189
|
+
} finally {
|
|
190
|
+
if (_didIteratorError2) {
|
|
191
|
+
throw _iteratorError2;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
196
|
/**
|
|
@@ -203,279 +205,246 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
203
205
|
|
|
204
206
|
_createClass(FrameClient, [{
|
|
205
207
|
key: "PassRequest",
|
|
206
|
-
value: function () {
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
208
|
+
value: function PassRequest(_ref2) {
|
|
209
|
+
var request, Respond, response, error, callback;
|
|
210
|
+
return _regeneratorRuntime.async(function PassRequest$(_context3) {
|
|
211
|
+
while (1) {
|
|
212
|
+
switch (_context3.prev = _context3.next) {
|
|
213
|
+
case 0:
|
|
214
|
+
request = _ref2.request, Respond = _ref2.Respond;
|
|
215
|
+
_context3.prev = 1;
|
|
216
|
+
|
|
217
|
+
if (request.callbackId) {
|
|
218
|
+
callback = function callback(result) {
|
|
219
|
+
return Respond({
|
|
220
|
+
type: "ElvFrameResponse",
|
|
221
|
+
requestId: request.callbackId,
|
|
222
|
+
response: result
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
}
|
|
225
226
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
|
+
}
|
|
231
273
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
274
|
+
this.target.postMessage(_objectSpread({}, options, {
|
|
275
|
+
type: "ElvFrameRequest",
|
|
276
|
+
requestId: requestId,
|
|
277
|
+
callbackId: callbackId
|
|
278
|
+
}), "*"); // No timeout for prompted methods
|
|
279
|
+
|
|
280
|
+
if (!noResponse) {
|
|
281
|
+
_context4.next = 6;
|
|
235
282
|
break;
|
|
283
|
+
}
|
|
236
284
|
|
|
237
|
-
|
|
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
|
-
}));
|
|
285
|
+
return _context4.abrupt("return");
|
|
257
286
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
287
|
+
case 6:
|
|
288
|
+
operation = options.calledMethod || options.operation;
|
|
289
|
+
isFileOperation = FrameClient.FileMethods().includes(options.calledMethod);
|
|
290
|
+
timeout = this.timeout;
|
|
261
291
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
-
}));
|
|
292
|
+
if (options.prompted || isFileOperation) {
|
|
293
|
+
timeout = 0;
|
|
294
|
+
} else if (options.args && options.args.fcTimeout) {
|
|
295
|
+
timeout = options.args.fcTimeout;
|
|
296
|
+
}
|
|
318
297
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
298
|
+
_context4.next = 12;
|
|
299
|
+
return _regeneratorRuntime.awrap(this.AwaitMessage(requestId, timeout, callback, callbackId, operation));
|
|
300
|
+
|
|
301
|
+
case 12:
|
|
302
|
+
return _context4.abrupt("return", _context4.sent);
|
|
322
303
|
|
|
323
|
-
|
|
324
|
-
|
|
304
|
+
case 13:
|
|
305
|
+
case "end":
|
|
306
|
+
return _context4.stop();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}, null, this);
|
|
310
|
+
}
|
|
325
311
|
}, {
|
|
326
312
|
key: "AwaitMessage",
|
|
327
|
-
value: function () {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
313
|
+
value: function AwaitMessage(requestId, timeout, callback, callbackId, operation) {
|
|
314
|
+
return _regeneratorRuntime.async(function AwaitMessage$(_context6) {
|
|
315
|
+
while (1) {
|
|
316
|
+
switch (_context6.prev = _context6.next) {
|
|
317
|
+
case 0:
|
|
318
|
+
_context6.next = 2;
|
|
319
|
+
return _regeneratorRuntime.awrap(new Promise(function (resolve, reject) {
|
|
320
|
+
var _methodListener; // Initialize or reset timeout
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
var timeoutId;
|
|
324
|
+
|
|
325
|
+
var touchTimeout = function touchTimeout() {
|
|
326
|
+
if (timeoutId) {
|
|
327
|
+
clearTimeout(timeoutId);
|
|
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);
|
|
343
362
|
}
|
|
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
|
+
}
|
|
344
382
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
383
|
+
return _context5.abrupt("return");
|
|
384
|
+
|
|
385
|
+
case 4:
|
|
386
|
+
clearTimeout(timeoutId);
|
|
387
|
+
window.removeEventListener("message", _methodListener);
|
|
349
388
|
|
|
350
389
|
if (callbackListener) {
|
|
351
390
|
window.removeEventListener("message", callbackListener);
|
|
352
391
|
}
|
|
353
|
-
}
|
|
354
392
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
393
|
+
if (message.error) {
|
|
394
|
+
reject(message.error);
|
|
395
|
+
} else {
|
|
396
|
+
resolve(message.response);
|
|
397
|
+
}
|
|
359
398
|
|
|
399
|
+
_context5.next = 16;
|
|
400
|
+
break;
|
|
360
401
|
|
|
361
|
-
|
|
362
|
-
|
|
402
|
+
case 10:
|
|
403
|
+
_context5.prev = 10;
|
|
404
|
+
_context5.t0 = _context5["catch"](0);
|
|
405
|
+
clearTimeout(timeoutId);
|
|
406
|
+
window.removeEventListener("message", _methodListener);
|
|
363
407
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
touchTimeout();
|
|
368
|
-
var message = event.data;
|
|
408
|
+
if (callbackListener) {
|
|
409
|
+
window.removeEventListener("message", callbackListener);
|
|
410
|
+
}
|
|
369
411
|
|
|
370
|
-
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
412
|
+
reject(_context5.t0);
|
|
373
413
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
console.error(error);
|
|
414
|
+
case 16:
|
|
415
|
+
case "end":
|
|
416
|
+
return _context5.stop();
|
|
378
417
|
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
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
|
|
418
|
+
}
|
|
419
|
+
}, null, null, [[0, 10]]);
|
|
420
|
+
}; // Start the timeout
|
|
444
421
|
|
|
445
422
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
});
|
|
423
|
+
touchTimeout();
|
|
424
|
+
window.addEventListener("message", _methodListener);
|
|
425
|
+
}));
|
|
450
426
|
|
|
451
|
-
|
|
452
|
-
|
|
427
|
+
case 2:
|
|
428
|
+
return _context6.abrupt("return", _context6.sent);
|
|
453
429
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
430
|
+
case 3:
|
|
431
|
+
case "end":
|
|
432
|
+
return _context6.stop();
|
|
458
433
|
}
|
|
459
|
-
}
|
|
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
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
} // List of methods that may require a prompt - these should have an unlimited timeout period
|
|
468
437
|
|
|
469
438
|
}, {
|
|
470
439
|
key: "AllowedMethods",
|
|
471
|
-
|
|
440
|
+
// List of allowed methods available to frames
|
|
472
441
|
// This should match ElvClient.FrameAvailableMethods()
|
|
473
442
|
// ElvClient will also reject any disallowed methods
|
|
474
443
|
|
|
475
444
|
/**
|
|
476
445
|
* @returns {Array<string>} - List of ElvClient methods available to a FrameClient
|
|
477
446
|
*/
|
|
478
|
-
function AllowedMethods() {
|
|
447
|
+
value: function AllowedMethods() {
|
|
479
448
|
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"];
|
|
480
449
|
}
|
|
481
450
|
}, {
|