@eluvio/elv-client-js 4.0.8 → 4.0.9

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.
Files changed (40) hide show
  1. package/dist/ElvClient-min.js +10 -11
  2. package/dist/ElvClient-node-min.js +10 -11
  3. package/dist/ElvFrameClient-min.js +10 -11
  4. package/dist/ElvPermissionsClient-min.js +9 -10
  5. package/dist/ElvWalletClient-min.js +10 -11
  6. package/dist/ElvWalletClient-node-min.js +9 -10
  7. package/dist/src/AuthorizationClient.js +2069 -1548
  8. package/dist/src/ContentObjectVerification.js +185 -134
  9. package/dist/src/Crypto.js +323 -226
  10. package/dist/src/ElvClient.js +1118 -824
  11. package/dist/src/ElvWallet.js +106 -64
  12. package/dist/src/EthClient.js +974 -719
  13. package/dist/src/FrameClient.js +318 -222
  14. package/dist/src/HttpClient.js +154 -112
  15. package/dist/src/Id.js +6 -1
  16. package/dist/src/LogMessage.js +8 -4
  17. package/dist/src/PermissionsClient.js +1271 -973
  18. package/dist/src/RemoteSigner.js +232 -161
  19. package/dist/src/UserProfileClient.js +1038 -781
  20. package/dist/src/Utils.js +302 -160
  21. package/dist/src/Validation.js +17 -2
  22. package/dist/src/client/ABRPublishing.js +942 -772
  23. package/dist/src/client/AccessGroups.js +1095 -849
  24. package/dist/src/client/ContentAccess.js +4198 -3272
  25. package/dist/src/client/ContentManagement.js +2284 -1812
  26. package/dist/src/client/Contracts.js +614 -468
  27. package/dist/src/client/Files.js +1831 -1491
  28. package/dist/src/client/NFT.js +116 -94
  29. package/dist/src/client/NTP.js +425 -326
  30. package/dist/src/index.js +5 -2
  31. package/dist/src/walletClient/ClientMethods.js +1766 -1350
  32. package/dist/src/walletClient/Configuration.js +2 -4
  33. package/dist/src/walletClient/Notifications.js +127 -98
  34. package/dist/src/walletClient/Profile.js +246 -184
  35. package/dist/src/walletClient/Utils.js +124 -78
  36. package/dist/src/walletClient/index.js +1498 -1169
  37. package/package.json +1 -1
  38. package/src/client/ContentAccess.js +27 -10
  39. package/src/walletClient/ClientMethods.js +18 -10
  40. package/src/walletClient/index.js +7 -2
@@ -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
- // No production environment on demo
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
- path = _ref.path;
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) switch (_context.prev = _context.next) {
30
- case 0:
31
- tenantId = _ref2.tenantId, eventType = _ref2.eventType, data = _ref2.data;
32
- _context.next = 3;
33
- return this.stateStoreClient.Request({
34
- method: "POST",
35
- path: NotificationPath({
36
- network: this.network,
37
- path: UrlJoin("notify_user", this.UserAddress(), tenantId, eventType)
38
- }),
39
- body: data,
40
- headers: {
41
- Authorization: "Bearer ".concat(this.AuthToken())
42
- }
43
- });
44
- case 3:
45
- case "end":
46
- return _context.stop();
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) switch (_context2.prev = _context2.next) {
68
- case 0:
69
- onMessage = _ref4.onMessage;
70
- if (onMessage) {
71
- _context2.next = 3;
72
- break;
73
- }
74
- throw Error("Eluvio Wallet Client: No onMessage callback provided to AddNotificationListener");
75
- case 3:
76
- url = new URL(this.stateStoreClient.BaseURI().toString());
77
- url.pathname = NotificationPath({
78
- network: this.network,
79
- path: UrlJoin("register", this.UserAddress(), this.AuthToken())
80
- });
81
- source = new EventSource(url);
82
- source.onmessage = function (event) {
83
- var parsedMessage = JSON.parse(event.data);
84
- try {
85
- parsedMessage.data = JSON.parse(parsedMessage.data);
86
- // eslint-disable-next-line no-empty
87
- } catch (error) {}
88
- onMessage(parsedMessage);
89
- };
90
- return _context2.abrupt("return", source);
91
- case 8:
92
- case "end":
93
- return _context2.stop();
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
- tenantId,
116
- types,
117
- offsetId,
118
- _ref7$limit,
119
- limit,
120
- queryParams,
121
- _yield$Utils$Response,
122
- records,
123
- _args3 = arguments;
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) switch (_context3.prev = _context3.next) {
126
- case 0:
127
- _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;
128
- queryParams = {
129
- limit: limit
130
- };
131
- if (tenantId) {
132
- queryParams.tenant_id = tenantId;
133
- }
134
- if (types) {
135
- queryParams.types = Array.isArray(types) ? types.join(",") : types;
136
- }
137
- if (offsetId) {
138
- queryParams.offset_by = offsetId;
139
- }
140
- _context3.next = 7;
141
- return Utils.ResponseToJson(this.stateStoreClient.Request({
142
- method: "GET",
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
- case 7:
153
- _yield$Utils$Response = _context3.sent;
154
- records = _yield$Utils$Response.records;
155
- return _context3.abrupt("return", records.map(function (record) {
156
- try {
157
- record.data = JSON.parse(record.data);
158
- // eslint-disable-next-line no-empty
159
- } catch (error) {}
160
- return record;
161
- }));
162
- case 10:
163
- case "end":
164
- return _context3.stop();
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
  }));