@eluvio/elv-client-js 4.0.112 → 4.0.113
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/package.json +1 -1
- package/dist/ElvClient-min.js +0 -67
- package/dist/ElvClient-node-min.js +0 -66
- package/dist/ElvFrameClient-min.js +0 -60
- package/dist/ElvPermissionsClient-min.js +0 -60
- package/dist/ElvWalletClient-min.js +0 -67
- package/dist/ElvWalletClient-node-min.js +0 -66
- package/dist/src/AuthorizationClient.js +0 -2157
- package/dist/src/ContentObjectAudit.js +0 -175
- package/dist/src/ContentObjectVerification.js +0 -281
- package/dist/src/Crypto.js +0 -412
- package/dist/src/ElvClient.js +0 -2022
- package/dist/src/ElvWallet.js +0 -245
- package/dist/src/EthClient.js +0 -1154
- package/dist/src/FrameClient.js +0 -485
- package/dist/src/HttpClient.js +0 -315
- package/dist/src/Id.js +0 -21
- package/dist/src/LogMessage.js +0 -25
- package/dist/src/PermissionsClient.js +0 -1544
- package/dist/src/RemoteSigner.js +0 -385
- package/dist/src/UserProfileClient.js +0 -1450
- package/dist/src/Utils.js +0 -894
- package/dist/src/Validation.js +0 -121
- package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -1661
- package/dist/src/abr_profiles/abr_profile_live_to_vod.js +0 -1606
- package/dist/src/client/ABRPublishing.js +0 -1018
- package/dist/src/client/AccessGroups.js +0 -1503
- package/dist/src/client/ContentAccess.js +0 -5173
- package/dist/src/client/ContentManagement.js +0 -2680
- package/dist/src/client/Contracts.js +0 -1520
- package/dist/src/client/Files.js +0 -2181
- package/dist/src/client/LiveConf.js +0 -567
- package/dist/src/client/LiveStream.js +0 -2638
- package/dist/src/client/NFT.js +0 -162
- package/dist/src/client/NTP.js +0 -581
- package/dist/src/contracts/v2/AccessIndexor.js +0 -831
- package/dist/src/contracts/v2/Accessible.js +0 -31
- package/dist/src/contracts/v2/BaseAccessControlGroup.js +0 -1263
- package/dist/src/contracts/v2/BaseAccessWallet.js +0 -1609
- package/dist/src/contracts/v2/BaseAccessWalletFactory.js +0 -93
- package/dist/src/contracts/v2/BaseContent.js +0 -1076
- package/dist/src/contracts/v2/BaseContentFactory.js +0 -219
- package/dist/src/contracts/v2/BaseContentSpace.js +0 -1352
- package/dist/src/contracts/v2/BaseContentType.js +0 -364
- package/dist/src/contracts/v2/BaseFactory.js +0 -107
- package/dist/src/contracts/v2/BaseGroupFactory.js +0 -93
- package/dist/src/contracts/v2/BaseLibrary.js +0 -1041
- package/dist/src/contracts/v2/BaseLibraryFactory.js +0 -96
- package/dist/src/contracts/v2/Certifyer.js +0 -86
- package/dist/src/contracts/v2/Container.js +0 -540
- package/dist/src/contracts/v2/Content.js +0 -443
- package/dist/src/contracts/v2/Editable.js +0 -306
- package/dist/src/contracts/v2/ExternalUserWallet.js +0 -379
- package/dist/src/contracts/v2/IFactorySpace.js +0 -57
- package/dist/src/contracts/v2/IKmsSpace.js +0 -52
- package/dist/src/contracts/v2/INodeSpace.js +0 -18
- package/dist/src/contracts/v2/IUserSpace.js +0 -18
- package/dist/src/contracts/v2/LvRecordableStream.js +0 -1037
- package/dist/src/contracts/v2/LvRecording.js +0 -627
- package/dist/src/contracts/v2/LvStreamRightsHolder.js +0 -562
- package/dist/src/contracts/v2/MetaObject.js +0 -119
- package/dist/src/contracts/v2/Node.js +0 -167
- package/dist/src/contracts/v2/NodeSpace.js +0 -273
- package/dist/src/contracts/v2/Ownable.js +0 -87
- package/dist/src/contracts/v2/PaymentService.js +0 -627
- package/dist/src/contracts/v2/Precompile.js +0 -15
- package/dist/src/contracts/v2/Transactable.js +0 -82
- package/dist/src/contracts/v2/UserSpace.js +0 -29
- package/dist/src/contracts/v2/Utils.js +0 -18
- package/dist/src/contracts/v2/Verifier.js +0 -53
- package/dist/src/contracts/v2/strings.js +0 -4
- package/dist/src/contracts/v3/AccessIndexor.js +0 -774
- package/dist/src/contracts/v3/Accessible.js +0 -232
- package/dist/src/contracts/v3/Adminable.js +0 -107
- package/dist/src/contracts/v3/AvailsDelivery.js +0 -586
- package/dist/src/contracts/v3/BaseAccessControlGroup.js +0 -1603
- package/dist/src/contracts/v3/BaseAccessWallet.js +0 -1628
- package/dist/src/contracts/v3/BaseAccessWalletFactory.js +0 -112
- package/dist/src/contracts/v3/BaseContent.js +0 -1312
- package/dist/src/contracts/v3/BaseContentFactory.js +0 -183
- package/dist/src/contracts/v3/BaseContentFactoryExt.js +0 -175
- package/dist/src/contracts/v3/BaseContentSpace.js +0 -1515
- package/dist/src/contracts/v3/BaseContentType.js +0 -527
- package/dist/src/contracts/v3/BaseFactory.js +0 -126
- package/dist/src/contracts/v3/BaseGroupFactory.js +0 -112
- package/dist/src/contracts/v3/BaseLibrary.js +0 -1204
- package/dist/src/contracts/v3/BaseLibraryFactory.js +0 -115
- package/dist/src/contracts/v3/BaseTenantSpace.js +0 -1587
- package/dist/src/contracts/v3/Certifyer.js +0 -86
- package/dist/src/contracts/v3/Container.js +0 -739
- package/dist/src/contracts/v3/Content.js +0 -438
- package/dist/src/contracts/v3/CounterObject.js +0 -243
- package/dist/src/contracts/v3/Editable.js +0 -519
- package/dist/src/contracts/v3/EncToken.js +0 -4
- package/dist/src/contracts/v3/ExternalUserWallet.js +0 -587
- package/dist/src/contracts/v3/IAdmin.js +0 -18
- package/dist/src/contracts/v3/IFactorySpace.js +0 -57
- package/dist/src/contracts/v3/IKmsSpace.js +0 -52
- package/dist/src/contracts/v3/INodeSpace.js +0 -18
- package/dist/src/contracts/v3/IUserSpace.js +0 -32
- package/dist/src/contracts/v3/LvRecordableStream.js +0 -1032
- package/dist/src/contracts/v3/LvRecording.js +0 -650
- package/dist/src/contracts/v3/LvStreamRightsHolder.js +0 -557
- package/dist/src/contracts/v3/MetaObject.js +0 -144
- package/dist/src/contracts/v3/Node.js +0 -178
- package/dist/src/contracts/v3/NodeSpace.js +0 -284
- package/dist/src/contracts/v3/Ownable.js +0 -98
- package/dist/src/contracts/v3/PaymentService.js +0 -622
- package/dist/src/contracts/v3/Precompile.js +0 -26
- package/dist/src/contracts/v3/TenantFuncsBase.js +0 -351
- package/dist/src/contracts/v3/Transactable.js +0 -82
- package/dist/src/contracts/v3/UserSpace.js +0 -43
- package/dist/src/contracts/v3/Utils.js +0 -18
- package/dist/src/contracts/v3/Verifier.js +0 -53
- package/dist/src/contracts/v3/strings.js +0 -4
- package/dist/src/contracts/v3b/BaseAccessControlGroup.js +0 -1704
- package/dist/src/events/Topics.js +0 -1793
- package/dist/src/index.js +0 -8
- package/dist/src/walletClient/ClientMethods.js +0 -3102
- package/dist/src/walletClient/Configuration.js +0 -38
- package/dist/src/walletClient/Notifications.js +0 -168
- package/dist/src/walletClient/Profile.js +0 -332
- package/dist/src/walletClient/Utils.js +0 -281
- package/dist/src/walletClient/index.js +0 -2106
package/dist/src/FrameClient.js
DELETED
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
|
-
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
3
|
-
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
5
|
-
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
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 _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); }
|
|
10
|
-
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
|
-
var Id = require("./Id");
|
|
12
|
-
var Utils = require("./Utils");
|
|
13
|
-
var permissionLevels = require("./client/ContentAccess").permissionLevels;
|
|
14
|
-
var _require = require("./LogMessage"),
|
|
15
|
-
LogMessage = _require.LogMessage;
|
|
16
|
-
var Crypto = require("./Crypto");
|
|
17
|
-
var FrameClient = /*#__PURE__*/function () {
|
|
18
|
-
"use strict";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* FrameClient is a client that looks to the user like an ElvClient, but works by passing messages
|
|
22
|
-
* to another frame with an actual ElvClient instead of making the calls itself.
|
|
23
|
-
*
|
|
24
|
-
* The purpose of this is to isolate users' private keys and the usage thereof in one trusted application,
|
|
25
|
-
* while still allowing other (possibly less trustworthy) applications to communicate with the content fabric
|
|
26
|
-
* on behalf of the user from a sandboxed IFrame.
|
|
27
|
-
*
|
|
28
|
-
* FrameClient has available almost all of the same methods as ElvClient, and should be transparently
|
|
29
|
-
* interchangable with it from a usage perspective.
|
|
30
|
-
*
|
|
31
|
-
* The methods available in FrameClient are generated automatically from ElvClient. These methods will use a
|
|
32
|
-
* messaging protocol to communicate intent to a specified frame, which can listen for such messages, perform
|
|
33
|
-
* the actions using the real ElvClient, and return the results via a response message.
|
|
34
|
-
*
|
|
35
|
-
* Because the privileged frame is doing the actual work, it may decide to allow or disallow any actions
|
|
36
|
-
* it sees fit - for example, limiting a dependent app to a few safe calls while preventing it from making any
|
|
37
|
-
* significant changes.
|
|
38
|
-
*
|
|
39
|
-
* The most important aspect of this architecture is to prevent leaking of users' private keys. Be careful when
|
|
40
|
-
* setting up a project using this architecture - make sure the untrusted app is properly contained in a sandboxed
|
|
41
|
-
* IFrame and served from a different origin than the privileged app.
|
|
42
|
-
*
|
|
43
|
-
* @see test/frames/Parent.html and test/frames/Client.html for an example setup using this scheme
|
|
44
|
-
*
|
|
45
|
-
* @namedParams
|
|
46
|
-
* @param {Object} target - The window or frame that will listen for messages produced by this client
|
|
47
|
-
* @param {number} timeout - How long to wait for a response after calling a method before giving up
|
|
48
|
-
* and generating a timeout error
|
|
49
|
-
*/
|
|
50
|
-
function FrameClient() {
|
|
51
|
-
var _this = this;
|
|
52
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
53
|
-
target = _ref.target,
|
|
54
|
-
_ref$timeout = _ref.timeout,
|
|
55
|
-
timeout = _ref$timeout === void 0 ? 30 : _ref$timeout;
|
|
56
|
-
_classCallCheck(this, FrameClient);
|
|
57
|
-
this.permissionLevels = permissionLevels;
|
|
58
|
-
if (!target && typeof window !== "undefined" && window.parent) {
|
|
59
|
-
target = window.parent;
|
|
60
|
-
}
|
|
61
|
-
this.target = target;
|
|
62
|
-
this.timeout = timeout;
|
|
63
|
-
this.utils = Utils;
|
|
64
|
-
this.Crypto = Crypto;
|
|
65
|
-
this.Crypto.ElvCrypto();
|
|
66
|
-
|
|
67
|
-
// Dynamically defined methods defined in AllowedMethods
|
|
68
|
-
var _iterator = _createForOfIteratorHelper(this.AllowedMethods()),
|
|
69
|
-
_step;
|
|
70
|
-
try {
|
|
71
|
-
var _loop = function _loop() {
|
|
72
|
-
var methodName = _step.value;
|
|
73
|
-
_this[methodName] = /*#__PURE__*/function () {
|
|
74
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(args) {
|
|
75
|
-
var callback;
|
|
76
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
77
|
-
while (1) switch (_context.prev = _context.next) {
|
|
78
|
-
case 0:
|
|
79
|
-
callback = args && args.callback;
|
|
80
|
-
if (callback) {
|
|
81
|
-
delete args.callback;
|
|
82
|
-
}
|
|
83
|
-
_context.next = 4;
|
|
84
|
-
return _this.SendMessage({
|
|
85
|
-
options: {
|
|
86
|
-
calledMethod: methodName,
|
|
87
|
-
args: _this.utils.MakeClonable(args)
|
|
88
|
-
},
|
|
89
|
-
callback: callback
|
|
90
|
-
});
|
|
91
|
-
case 4:
|
|
92
|
-
return _context.abrupt("return", _context.sent);
|
|
93
|
-
case 5:
|
|
94
|
-
case "end":
|
|
95
|
-
return _context.stop();
|
|
96
|
-
}
|
|
97
|
-
}, _callee);
|
|
98
|
-
}));
|
|
99
|
-
return function (_x) {
|
|
100
|
-
return _ref2.apply(this, arguments);
|
|
101
|
-
};
|
|
102
|
-
}();
|
|
103
|
-
};
|
|
104
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
105
|
-
_loop();
|
|
106
|
-
}
|
|
107
|
-
} catch (err) {
|
|
108
|
-
_iterator.e(err);
|
|
109
|
-
} finally {
|
|
110
|
-
_iterator.f();
|
|
111
|
-
}
|
|
112
|
-
this.userProfileClient = {};
|
|
113
|
-
// Dynamically defined user profile methods defined in AllowedUserProfileMethods
|
|
114
|
-
var _iterator2 = _createForOfIteratorHelper(this.AllowedUserProfileMethods()),
|
|
115
|
-
_step2;
|
|
116
|
-
try {
|
|
117
|
-
var _loop2 = function _loop2() {
|
|
118
|
-
var methodName = _step2.value;
|
|
119
|
-
_this.userProfileClient[methodName] = /*#__PURE__*/function () {
|
|
120
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(args) {
|
|
121
|
-
var callback;
|
|
122
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
123
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
124
|
-
case 0:
|
|
125
|
-
callback = args && args.callback;
|
|
126
|
-
if (callback) {
|
|
127
|
-
delete args.callback;
|
|
128
|
-
}
|
|
129
|
-
_context2.next = 4;
|
|
130
|
-
return _this.SendMessage({
|
|
131
|
-
options: {
|
|
132
|
-
module: "userProfileClient",
|
|
133
|
-
calledMethod: methodName,
|
|
134
|
-
args: _this.utils.MakeClonable(args),
|
|
135
|
-
prompted: FrameClient.PromptedMethods().includes(methodName)
|
|
136
|
-
},
|
|
137
|
-
callback: callback
|
|
138
|
-
});
|
|
139
|
-
case 4:
|
|
140
|
-
return _context2.abrupt("return", _context2.sent);
|
|
141
|
-
case 5:
|
|
142
|
-
case "end":
|
|
143
|
-
return _context2.stop();
|
|
144
|
-
}
|
|
145
|
-
}, _callee2);
|
|
146
|
-
}));
|
|
147
|
-
return function (_x2) {
|
|
148
|
-
return _ref3.apply(this, arguments);
|
|
149
|
-
};
|
|
150
|
-
}();
|
|
151
|
-
};
|
|
152
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
153
|
-
_loop2();
|
|
154
|
-
}
|
|
155
|
-
} catch (err) {
|
|
156
|
-
_iterator2.e(err);
|
|
157
|
-
} finally {
|
|
158
|
-
_iterator2.f();
|
|
159
|
-
}
|
|
160
|
-
this.walletClient = {};
|
|
161
|
-
// Dynamically defined wallet client methods defined in AllowedWalletClientMethods
|
|
162
|
-
var _iterator3 = _createForOfIteratorHelper(this.AllowedWalletClientMethods()),
|
|
163
|
-
_step3;
|
|
164
|
-
try {
|
|
165
|
-
var _loop3 = function _loop3() {
|
|
166
|
-
var methodName = _step3.value;
|
|
167
|
-
_this.walletClient[methodName] = /*#__PURE__*/function () {
|
|
168
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(args) {
|
|
169
|
-
var callback;
|
|
170
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
171
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
172
|
-
case 0:
|
|
173
|
-
callback = args && args.callback;
|
|
174
|
-
if (callback) {
|
|
175
|
-
delete args.callback;
|
|
176
|
-
}
|
|
177
|
-
_context3.next = 4;
|
|
178
|
-
return _this.SendMessage({
|
|
179
|
-
options: {
|
|
180
|
-
module: "walletClient",
|
|
181
|
-
calledMethod: methodName,
|
|
182
|
-
args: _this.utils.MakeClonable(args)
|
|
183
|
-
},
|
|
184
|
-
callback: callback
|
|
185
|
-
});
|
|
186
|
-
case 4:
|
|
187
|
-
return _context3.abrupt("return", _context3.sent);
|
|
188
|
-
case 5:
|
|
189
|
-
case "end":
|
|
190
|
-
return _context3.stop();
|
|
191
|
-
}
|
|
192
|
-
}, _callee3);
|
|
193
|
-
}));
|
|
194
|
-
return function (_x3) {
|
|
195
|
-
return _ref4.apply(this, arguments);
|
|
196
|
-
};
|
|
197
|
-
}();
|
|
198
|
-
};
|
|
199
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
200
|
-
_loop3();
|
|
201
|
-
}
|
|
202
|
-
} catch (err) {
|
|
203
|
-
_iterator3.e(err);
|
|
204
|
-
} finally {
|
|
205
|
-
_iterator3.f();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Pass an ElvFrameRequest to the target and receive a ElvFrameResponse.
|
|
211
|
-
* Useful when acting as an intermediate between a contained app and a parent app.
|
|
212
|
-
*
|
|
213
|
-
* @namedParams
|
|
214
|
-
* @param {object} request - An ElvFrameRequest
|
|
215
|
-
* @returns {object} - The resultant ElvFrameResponse
|
|
216
|
-
*/
|
|
217
|
-
_createClass(FrameClient, [{
|
|
218
|
-
key: "Log",
|
|
219
|
-
value: function Log(message) {
|
|
220
|
-
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
221
|
-
LogMessage(this, message, error);
|
|
222
|
-
}
|
|
223
|
-
}, {
|
|
224
|
-
key: "PassRequest",
|
|
225
|
-
value: function () {
|
|
226
|
-
var _PassRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
227
|
-
var request, Respond, response, error, callback;
|
|
228
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
229
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
230
|
-
case 0:
|
|
231
|
-
request = _ref5.request, Respond = _ref5.Respond;
|
|
232
|
-
_context4.prev = 1;
|
|
233
|
-
if (request.callbackId) {
|
|
234
|
-
callback = function callback(result) {
|
|
235
|
-
return Respond({
|
|
236
|
-
type: "ElvFrameResponse",
|
|
237
|
-
requestId: request.callbackId,
|
|
238
|
-
response: result
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
_context4.next = 5;
|
|
243
|
-
return this.SendMessage({
|
|
244
|
-
options: request,
|
|
245
|
-
callback: callback
|
|
246
|
-
});
|
|
247
|
-
case 5:
|
|
248
|
-
response = _context4.sent;
|
|
249
|
-
_context4.next = 11;
|
|
250
|
-
break;
|
|
251
|
-
case 8:
|
|
252
|
-
_context4.prev = 8;
|
|
253
|
-
_context4.t0 = _context4["catch"](1);
|
|
254
|
-
error = _context4.t0;
|
|
255
|
-
case 11:
|
|
256
|
-
return _context4.abrupt("return", {
|
|
257
|
-
type: "ElvFrameResponse",
|
|
258
|
-
requestId: request.requestId,
|
|
259
|
-
response: response,
|
|
260
|
-
error: error
|
|
261
|
-
});
|
|
262
|
-
case 12:
|
|
263
|
-
case "end":
|
|
264
|
-
return _context4.stop();
|
|
265
|
-
}
|
|
266
|
-
}, _callee4, this, [[1, 8]]);
|
|
267
|
-
}));
|
|
268
|
-
function PassRequest(_x4) {
|
|
269
|
-
return _PassRequest.apply(this, arguments);
|
|
270
|
-
}
|
|
271
|
-
return PassRequest;
|
|
272
|
-
}()
|
|
273
|
-
}, {
|
|
274
|
-
key: "SendMessage",
|
|
275
|
-
value: function () {
|
|
276
|
-
var _SendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref6) {
|
|
277
|
-
var _ref6$options, options, callback, _ref6$noResponse, noResponse, requestId, callbackId, operation, isFileOperation, timeout;
|
|
278
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
279
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
280
|
-
case 0:
|
|
281
|
-
_ref6$options = _ref6.options, options = _ref6$options === void 0 ? {} : _ref6$options, callback = _ref6.callback, _ref6$noResponse = _ref6.noResponse, noResponse = _ref6$noResponse === void 0 ? false : _ref6$noResponse;
|
|
282
|
-
requestId = Id.next();
|
|
283
|
-
if (callback) {
|
|
284
|
-
callbackId = Id.next();
|
|
285
|
-
}
|
|
286
|
-
this.target.postMessage(_objectSpread(_objectSpread({}, options), {}, {
|
|
287
|
-
type: "ElvFrameRequest",
|
|
288
|
-
requestId: requestId,
|
|
289
|
-
callbackId: callbackId
|
|
290
|
-
}), "*");
|
|
291
|
-
|
|
292
|
-
// No timeout for prompted methods
|
|
293
|
-
if (!noResponse) {
|
|
294
|
-
_context5.next = 6;
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
return _context5.abrupt("return");
|
|
298
|
-
case 6:
|
|
299
|
-
operation = options.calledMethod || options.operation;
|
|
300
|
-
isFileOperation = FrameClient.FileMethods().includes(options.calledMethod);
|
|
301
|
-
timeout = this.timeout;
|
|
302
|
-
if (options.prompted || isFileOperation) {
|
|
303
|
-
timeout = 0;
|
|
304
|
-
} else if (options.args && options.args.fcTimeout) {
|
|
305
|
-
timeout = options.args.fcTimeout;
|
|
306
|
-
}
|
|
307
|
-
_context5.next = 12;
|
|
308
|
-
return this.AwaitMessage(requestId, timeout, callback, callbackId, operation);
|
|
309
|
-
case 12:
|
|
310
|
-
return _context5.abrupt("return", _context5.sent);
|
|
311
|
-
case 13:
|
|
312
|
-
case "end":
|
|
313
|
-
return _context5.stop();
|
|
314
|
-
}
|
|
315
|
-
}, _callee5, this);
|
|
316
|
-
}));
|
|
317
|
-
function SendMessage(_x5) {
|
|
318
|
-
return _SendMessage.apply(this, arguments);
|
|
319
|
-
}
|
|
320
|
-
return SendMessage;
|
|
321
|
-
}()
|
|
322
|
-
}, {
|
|
323
|
-
key: "AwaitMessage",
|
|
324
|
-
value: function () {
|
|
325
|
-
var _AwaitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(requestId, timeout, callback, callbackId, operation) {
|
|
326
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
327
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
328
|
-
case 0:
|
|
329
|
-
_context7.next = 2;
|
|
330
|
-
return new Promise(function (resolve, reject) {
|
|
331
|
-
var methodListener;
|
|
332
|
-
|
|
333
|
-
// Initialize or reset timeout
|
|
334
|
-
var timeoutId;
|
|
335
|
-
var touchTimeout = function touchTimeout() {
|
|
336
|
-
if (timeoutId) {
|
|
337
|
-
clearTimeout(timeoutId);
|
|
338
|
-
}
|
|
339
|
-
if (timeout > 0) {
|
|
340
|
-
timeoutId = setTimeout(function () {
|
|
341
|
-
if (typeof window !== "undefined") {
|
|
342
|
-
window.removeEventListener("message", methodListener);
|
|
343
|
-
if (callbackListener) {
|
|
344
|
-
window.removeEventListener("message", callbackListener);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
reject("Request ".concat(requestId, " timed out (").concat(operation, ")"));
|
|
348
|
-
}, timeout * 1000);
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
// Set up callback listener
|
|
353
|
-
var callbackListener;
|
|
354
|
-
if (callbackId) {
|
|
355
|
-
callbackListener = function callbackListener(event) {
|
|
356
|
-
try {
|
|
357
|
-
touchTimeout();
|
|
358
|
-
var message = event.data;
|
|
359
|
-
if (message.type !== "ElvFrameResponse" || message.requestId !== callbackId) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
callback(message.response);
|
|
363
|
-
} catch (error) {
|
|
364
|
-
// eslint-disable-next-line no-console
|
|
365
|
-
console.error(error);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
window.addEventListener("message", callbackListener);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// Set up final method response listener
|
|
372
|
-
methodListener = /*#__PURE__*/function () {
|
|
373
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(event) {
|
|
374
|
-
var message;
|
|
375
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
376
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
377
|
-
case 0:
|
|
378
|
-
_context6.prev = 0;
|
|
379
|
-
message = event.data;
|
|
380
|
-
if (!(message.type !== "ElvFrameResponse" || message.requestId !== requestId)) {
|
|
381
|
-
_context6.next = 4;
|
|
382
|
-
break;
|
|
383
|
-
}
|
|
384
|
-
return _context6.abrupt("return");
|
|
385
|
-
case 4:
|
|
386
|
-
clearTimeout(timeoutId);
|
|
387
|
-
window.removeEventListener("message", methodListener);
|
|
388
|
-
if (callbackListener) {
|
|
389
|
-
window.removeEventListener("message", callbackListener);
|
|
390
|
-
}
|
|
391
|
-
if (message.error) {
|
|
392
|
-
reject(message.error);
|
|
393
|
-
} else {
|
|
394
|
-
resolve(message.response);
|
|
395
|
-
}
|
|
396
|
-
_context6.next = 16;
|
|
397
|
-
break;
|
|
398
|
-
case 10:
|
|
399
|
-
_context6.prev = 10;
|
|
400
|
-
_context6.t0 = _context6["catch"](0);
|
|
401
|
-
clearTimeout(timeoutId);
|
|
402
|
-
window.removeEventListener("message", methodListener);
|
|
403
|
-
if (callbackListener) {
|
|
404
|
-
window.removeEventListener("message", callbackListener);
|
|
405
|
-
}
|
|
406
|
-
reject(_context6.t0);
|
|
407
|
-
case 16:
|
|
408
|
-
case "end":
|
|
409
|
-
return _context6.stop();
|
|
410
|
-
}
|
|
411
|
-
}, _callee6, null, [[0, 10]]);
|
|
412
|
-
}));
|
|
413
|
-
return function methodListener(_x11) {
|
|
414
|
-
return _ref7.apply(this, arguments);
|
|
415
|
-
};
|
|
416
|
-
}();
|
|
417
|
-
|
|
418
|
-
// Start the timeout
|
|
419
|
-
touchTimeout();
|
|
420
|
-
window.addEventListener("message", methodListener);
|
|
421
|
-
});
|
|
422
|
-
case 2:
|
|
423
|
-
return _context7.abrupt("return", _context7.sent);
|
|
424
|
-
case 3:
|
|
425
|
-
case "end":
|
|
426
|
-
return _context7.stop();
|
|
427
|
-
}
|
|
428
|
-
}, _callee7);
|
|
429
|
-
}));
|
|
430
|
-
function AwaitMessage(_x6, _x7, _x8, _x9, _x10) {
|
|
431
|
-
return _AwaitMessage.apply(this, arguments);
|
|
432
|
-
}
|
|
433
|
-
return AwaitMessage;
|
|
434
|
-
}() // List of methods that may require a prompt - these should have an unlimited timeout period
|
|
435
|
-
}, {
|
|
436
|
-
key: "OverriddenMethods",
|
|
437
|
-
value:
|
|
438
|
-
// List of methods that are defined separately in FrameClient
|
|
439
|
-
function OverriddenMethods() {
|
|
440
|
-
return ["UploadFiles"];
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// List of allowed methods available to frames
|
|
444
|
-
// This should match ElvClient.FrameAvailableMethods()
|
|
445
|
-
// ElvClient will also reject any disallowed methods
|
|
446
|
-
/**
|
|
447
|
-
* @returns {Array<string>} - List of ElvClient methods available to a FrameClient
|
|
448
|
-
*/
|
|
449
|
-
}, {
|
|
450
|
-
key: "AllowedMethods",
|
|
451
|
-
value: function AllowedMethods() {
|
|
452
|
-
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AuditContentObject", "AuditStream", "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", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CreateStaticToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeleteWriteToken", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "EmbedUrl", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "GlobalUrl", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MakeFileServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "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", "SpaceNodes", "StartABRMezzanineJobs", "StreamAddWatermark", "StreamConfig", "StreamCopyToVod", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamListUrls", "StreamRemoveWatermark", "StreamStatus", "StreamStartOrStopOrReset", "StreamStopSession", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "Visibility", "WriteTokenNodeUrl"];
|
|
453
|
-
}
|
|
454
|
-
}, {
|
|
455
|
-
key: "AllowedUserProfileMethods",
|
|
456
|
-
value: function AllowedUserProfileMethods() {
|
|
457
|
-
return ["AccessLevel", "CollectedTags", "CreateWallet", "DeleteUserMetadata", "MergeUserMetadata", "PublicUserMetadata", "ReplaceUserMetadata", "TenantContractId", "TenantId", "UserMetadata", "UserProfileImage", "UserWalletAddress", "UserWalletObjectInfo", "WalletAddress"];
|
|
458
|
-
}
|
|
459
|
-
}, {
|
|
460
|
-
key: "AllowedWalletClientMethods",
|
|
461
|
-
value: function AllowedWalletClientMethods() {
|
|
462
|
-
return ["AcceptMarketplaceOffer", "AddNotificationListener", "AvailableMarketplaces", "CanSign", "CastVote", "ClaimItem", "ClaimStatus", "CollectionRedemptionStatus", "CreateListing", "CreateMarketplaceOffer", "DeployTenant", "DropStatus", "ExchangeRate", "FilteredQuery", "LatestMarketplaceHash", "Leaderboard", "Listing", "ListingAttributes", "ListingEditionNames", "ListingNames", "ListingPurchaseStatus", "ListingStats", "ListingStatus", "Listings", "LoadAvailableMarketplaces", "LoadDrop", "LoadMarketplace", "Marketplace", "MarketplaceCSS", "MarketplaceInfo", "MarketplaceOffers", "MarketplaceStock", "MintingStatus", "NFT", "NFTContractStats", "Notifications", "PackOpenStatus", "Profile", "ProfileMetadata", "PurchaseStatus", "PushNotification", "RejectMarketplaceOffer", "RemoveListing", "RemoveMarketplaceOffer", "RemoveProfileMetadata", "RevokeVote", "Sales", "SalesNames", "SalesStats", "SetProfileMetadata", "SubmitDropVote", "TenantConfiguration", "TransferNFT", "Transfers", "UserAddress", "UserInfo", "UserItemAttributes", "UserItemEditionNames", "UserItemNames", "UserItems", "UserListings", "UserNameToAddress", "UserSales", "UserTransfers", "UserWalletBalance", "VoteStatus"];
|
|
463
|
-
}
|
|
464
|
-
}], [{
|
|
465
|
-
key: "PromptedMethods",
|
|
466
|
-
value: function PromptedMethods() {
|
|
467
|
-
return ["CollectedTags", "DeleteUserMetadata", "MergeUserMetadata", "ReplaceUserMetadata", "UserMetadata"];
|
|
468
|
-
}
|
|
469
|
-
}, {
|
|
470
|
-
key: "MetadataMethods",
|
|
471
|
-
value: function MetadataMethods() {
|
|
472
|
-
return ["DeleteUserMetadata", "MergeUserMetadata", "ReplaceUserMetadata", "UserMetadata"];
|
|
473
|
-
}
|
|
474
|
-
}, {
|
|
475
|
-
key: "FileMethods",
|
|
476
|
-
value: function FileMethods() {
|
|
477
|
-
return ["CreateFileUploadJob", "DownloadEncrypted", "DownloadFile", "DownloadPart", "FinalizeUploadJob", "UpdateContentObjectGraph", "UploadFileData", "UploadFiles", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus"];
|
|
478
|
-
}
|
|
479
|
-
}]);
|
|
480
|
-
return FrameClient;
|
|
481
|
-
}();
|
|
482
|
-
var _require2 = require("./client/Files"),
|
|
483
|
-
UploadFiles = _require2.UploadFiles;
|
|
484
|
-
FrameClient.prototype.UploadFiles = UploadFiles;
|
|
485
|
-
exports.FrameClient = FrameClient;
|