@eluvio/elv-client-js 4.0.10 → 4.0.11
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 +10 -11
- package/dist/ElvClient-node-min.js +10 -11
- package/dist/ElvFrameClient-min.js +10 -11
- package/dist/ElvPermissionsClient-min.js +9 -10
- package/dist/ElvWalletClient-min.js +9 -10
- package/dist/ElvWalletClient-node-min.js +9 -10
- package/dist/src/AuthorizationClient.js +2070 -1550
- package/dist/src/ContentObjectVerification.js +185 -134
- package/dist/src/Crypto.js +319 -224
- package/dist/src/ElvClient.js +1114 -822
- package/dist/src/ElvWallet.js +106 -64
- package/dist/src/EthClient.js +974 -719
- package/dist/src/FrameClient.js +318 -222
- package/dist/src/HttpClient.js +154 -112
- package/dist/src/Id.js +6 -1
- package/dist/src/LogMessage.js +8 -4
- package/dist/src/PermissionsClient.js +1271 -973
- package/dist/src/RemoteSigner.js +232 -161
- package/dist/src/UserProfileClient.js +1038 -781
- package/dist/src/Utils.js +299 -159
- package/dist/src/Validation.js +17 -2
- package/dist/src/client/ABRPublishing.js +942 -772
- package/dist/src/client/AccessGroups.js +1095 -849
- package/dist/src/client/ContentAccess.js +4196 -3323
- package/dist/src/client/ContentManagement.js +2288 -1814
- package/dist/src/client/Contracts.js +614 -468
- package/dist/src/client/Files.js +1831 -1490
- package/dist/src/client/NFT.js +116 -94
- package/dist/src/client/NTP.js +425 -326
- package/dist/src/index.js +5 -2
- package/dist/src/walletClient/ClientMethods.js +1763 -1368
- package/dist/src/walletClient/Configuration.js +2 -4
- package/dist/src/walletClient/Notifications.js +127 -98
- package/dist/src/walletClient/Profile.js +246 -184
- package/dist/src/walletClient/Utils.js +122 -76
- package/dist/src/walletClient/index.js +1496 -1171
- package/package.json +1 -1
- package/src/AuthorizationClient.js +5 -5
- package/src/client/Files.js +1 -1
- package/testScripts/CreateMezMonolithic.js +0 -779
|
@@ -23,11 +23,9 @@ var WalletConfiguration = {
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
__MARKETPLACE_ORDER: ["PREVIEW", "de228e92-ed45-4fe0-8e52-658cf366e962", "wwe-marketplace-main", "realcannonballrun-marketplace", "maskverse-marketplace", "dolly-marketplace", "eluvio-live-marketplace-sonark", "cirkay-marketplace", "eluvio-live-marketplace-fuudge", "oc-marketplace", "emp-marketplace", "microsoft", "indieflix-marketplace", "angels-airwaves-marketplace"]
|
|
26
|
-
};
|
|
26
|
+
}; // No production environment on demo
|
|
27
27
|
|
|
28
|
-
//
|
|
29
|
-
WalletConfiguration.demo.production = WalletConfiguration.demo.staging;
|
|
28
|
+
WalletConfiguration.demo.production = WalletConfiguration.demo.staging; // Allow demo to be referred to as demov3
|
|
30
29
|
|
|
31
|
-
// Allow demo to be referred to as demov3
|
|
32
30
|
WalletConfiguration.demov3 = WalletConfiguration.demo;
|
|
33
31
|
module.exports = WalletConfiguration;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
2
|
+
|
|
2
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Methods related to notifications for the current user.
|
|
5
7
|
*
|
|
6
8
|
* @module Notifications
|
|
7
9
|
*/
|
|
8
|
-
|
|
9
10
|
var Utils = require("../Utils");
|
|
11
|
+
|
|
10
12
|
var UrlJoin = require("url-join");
|
|
13
|
+
|
|
11
14
|
var NotificationPath = function NotificationPath(_ref) {
|
|
12
15
|
var network = _ref.network,
|
|
13
|
-
|
|
16
|
+
path = _ref.path;
|
|
14
17
|
return UrlJoin("/push", network === "main" ? "/main" : "/dv3", path);
|
|
15
18
|
};
|
|
16
|
-
|
|
17
19
|
/**
|
|
18
20
|
* Push a notification to the current user
|
|
19
21
|
*
|
|
@@ -22,36 +24,41 @@ var NotificationPath = function NotificationPath(_ref) {
|
|
|
22
24
|
* @param {string} eventType - The type of the notification
|
|
23
25
|
* @param {(Object | string)=} data - Data associated with this notification
|
|
24
26
|
*/
|
|
27
|
+
|
|
28
|
+
|
|
25
29
|
exports.PushNotification = /*#__PURE__*/function () {
|
|
26
30
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
27
31
|
var tenantId, eventType, data;
|
|
28
32
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
29
|
-
while (1)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
while (1) {
|
|
34
|
+
switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
tenantId = _ref2.tenantId, eventType = _ref2.eventType, data = _ref2.data;
|
|
37
|
+
_context.next = 3;
|
|
38
|
+
return this.stateStoreClient.Request({
|
|
39
|
+
method: "POST",
|
|
40
|
+
path: NotificationPath({
|
|
41
|
+
network: this.network,
|
|
42
|
+
path: UrlJoin("notify_user", this.UserAddress(), tenantId, eventType)
|
|
43
|
+
}),
|
|
44
|
+
body: data,
|
|
45
|
+
headers: {
|
|
46
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
case 3:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
}, _callee, this);
|
|
49
56
|
}));
|
|
57
|
+
|
|
50
58
|
return function (_x) {
|
|
51
59
|
return _ref3.apply(this, arguments);
|
|
52
60
|
};
|
|
53
61
|
}();
|
|
54
|
-
|
|
55
62
|
/**
|
|
56
63
|
* Add a listener to receive new notifications.
|
|
57
64
|
*
|
|
@@ -60,45 +67,56 @@ exports.PushNotification = /*#__PURE__*/function () {
|
|
|
60
67
|
*
|
|
61
68
|
* @returns {Promise<EventSource>} - An EventSource instance listening for notifications. Use source.close() to close the listener.
|
|
62
69
|
*/
|
|
70
|
+
|
|
71
|
+
|
|
63
72
|
exports.AddNotificationListener = /*#__PURE__*/function () {
|
|
64
73
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4) {
|
|
65
74
|
var onMessage, url, source;
|
|
66
75
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
67
|
-
while (1)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
while (1) {
|
|
77
|
+
switch (_context2.prev = _context2.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
onMessage = _ref4.onMessage;
|
|
80
|
+
|
|
81
|
+
if (onMessage) {
|
|
82
|
+
_context2.next = 3;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
throw Error("Eluvio Wallet Client: No onMessage callback provided to AddNotificationListener");
|
|
87
|
+
|
|
88
|
+
case 3:
|
|
89
|
+
url = new URL(this.stateStoreClient.BaseURI().toString());
|
|
90
|
+
url.pathname = NotificationPath({
|
|
91
|
+
network: this.network,
|
|
92
|
+
path: UrlJoin("register", this.UserAddress(), this.AuthToken())
|
|
93
|
+
});
|
|
94
|
+
source = new EventSource(url);
|
|
95
|
+
|
|
96
|
+
source.onmessage = function (event) {
|
|
97
|
+
var parsedMessage = JSON.parse(event.data);
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
parsedMessage.data = JSON.parse(parsedMessage.data); // eslint-disable-next-line no-empty
|
|
101
|
+
} catch (error) {}
|
|
102
|
+
|
|
103
|
+
onMessage(parsedMessage);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return _context2.abrupt("return", source);
|
|
107
|
+
|
|
108
|
+
case 8:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context2.stop();
|
|
111
|
+
}
|
|
94
112
|
}
|
|
95
113
|
}, _callee2, this);
|
|
96
114
|
}));
|
|
115
|
+
|
|
97
116
|
return function (_x2) {
|
|
98
117
|
return _ref5.apply(this, arguments);
|
|
99
118
|
};
|
|
100
119
|
}();
|
|
101
|
-
|
|
102
120
|
/**
|
|
103
121
|
* Retrieve notifications for the current user.
|
|
104
122
|
*
|
|
@@ -110,58 +128,69 @@ exports.AddNotificationListener = /*#__PURE__*/function () {
|
|
|
110
128
|
*
|
|
111
129
|
* @returns {Promise<Array<Object>>} - A list of notifications for the specified parameters
|
|
112
130
|
*/
|
|
131
|
+
|
|
132
|
+
|
|
113
133
|
exports.Notifications = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
114
134
|
var _ref7,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
135
|
+
tenantId,
|
|
136
|
+
types,
|
|
137
|
+
offsetId,
|
|
138
|
+
_ref7$limit,
|
|
139
|
+
limit,
|
|
140
|
+
queryParams,
|
|
141
|
+
_yield$Utils$Response,
|
|
142
|
+
records,
|
|
143
|
+
_args3 = arguments;
|
|
144
|
+
|
|
124
145
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
125
|
-
while (1)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
path: NotificationPath({
|
|
144
|
-
network: this.network,
|
|
145
|
-
path: UrlJoin("history", this.UserAddress())
|
|
146
|
-
}),
|
|
147
|
-
queryParams: queryParams,
|
|
148
|
-
headers: {
|
|
149
|
-
Authorization: "Bearer ".concat(this.AuthToken())
|
|
146
|
+
while (1) {
|
|
147
|
+
switch (_context3.prev = _context3.next) {
|
|
148
|
+
case 0:
|
|
149
|
+
_ref7 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, tenantId = _ref7.tenantId, types = _ref7.types, offsetId = _ref7.offsetId, _ref7$limit = _ref7.limit, limit = _ref7$limit === void 0 ? 10 : _ref7$limit;
|
|
150
|
+
queryParams = {
|
|
151
|
+
limit: limit
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
if (tenantId) {
|
|
155
|
+
queryParams.tenant_id = tenantId;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (types) {
|
|
159
|
+
queryParams.types = Array.isArray(types) ? types.join(",") : types;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (offsetId) {
|
|
163
|
+
queryParams.offset_by = offsetId;
|
|
150
164
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
|
|
166
|
+
_context3.next = 7;
|
|
167
|
+
return Utils.ResponseToJson(this.stateStoreClient.Request({
|
|
168
|
+
method: "GET",
|
|
169
|
+
path: NotificationPath({
|
|
170
|
+
network: this.network,
|
|
171
|
+
path: UrlJoin("history", this.UserAddress())
|
|
172
|
+
}),
|
|
173
|
+
queryParams: queryParams,
|
|
174
|
+
headers: {
|
|
175
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
176
|
+
}
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
case 7:
|
|
180
|
+
_yield$Utils$Response = _context3.sent;
|
|
181
|
+
records = _yield$Utils$Response.records;
|
|
182
|
+
return _context3.abrupt("return", records.map(function (record) {
|
|
183
|
+
try {
|
|
184
|
+
record.data = JSON.parse(record.data); // eslint-disable-next-line no-empty
|
|
185
|
+
} catch (error) {}
|
|
186
|
+
|
|
187
|
+
return record;
|
|
188
|
+
}));
|
|
189
|
+
|
|
190
|
+
case 10:
|
|
191
|
+
case "end":
|
|
192
|
+
return _context3.stop();
|
|
193
|
+
}
|
|
165
194
|
}
|
|
166
195
|
}, _callee3, this);
|
|
167
196
|
}));
|