@eluvio/elv-client-js 4.0.120 → 4.0.122

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.
@@ -0,0 +1,284 @@
1
+ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
+ var _regeneratorRuntime = require("@babel/runtime/regenerator");
3
+ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
4
+ 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; }
5
+ 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; }
6
+ /**
7
+ * Methods for creating and managing shared authorization tokens
8
+ *
9
+ * @module ElvClient/Shares
10
+ */
11
+
12
+ var UrlJoin = require("url-join");
13
+
14
+ /**
15
+ * Create a share
16
+ *
17
+ * @namedParams
18
+ * @param {string} objectId - The object to create a share for
19
+ * @param {Date} expiresAt - The expiration time of the share
20
+ * @param {Object=} params - Additional parameters
21
+ *
22
+ * @returns {Promise<Object>} - Info about the created share
23
+ */
24
+ exports.CreateShare = /*#__PURE__*/function () {
25
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
26
+ var objectId, expiresAt, _ref$params, params, tenantId;
27
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
28
+ while (1) switch (_context.prev = _context.next) {
29
+ case 0:
30
+ objectId = _ref.objectId, expiresAt = _ref.expiresAt, _ref$params = _ref.params, params = _ref$params === void 0 ? {} : _ref$params;
31
+ _context.next = 3;
32
+ return this.userProfileClient.TenantContractId();
33
+ case 3:
34
+ tenantId = _context.sent;
35
+ params.object_id = objectId;
36
+ if (expiresAt) {
37
+ params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
38
+ }
39
+ _context.next = 8;
40
+ return this.MakeAuthServiceRequest({
41
+ path: UrlJoin("as", "sharing", tenantId, "share"),
42
+ method: "POST",
43
+ body: params,
44
+ headers: {
45
+ Authorization: "Bearer ".concat(this.signedToken)
46
+ }
47
+ });
48
+ case 8:
49
+ return _context.abrupt("return", _context.sent);
50
+ case 9:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }, _callee, this);
55
+ }));
56
+ return function (_x) {
57
+ return _ref2.apply(this, arguments);
58
+ };
59
+ }();
60
+
61
+ /**
62
+ * List shares associated with your tenancy
63
+ *
64
+ * @namedParams
65
+ * @param {string=} objectId - If specified, the results will be limited shares for the specified object
66
+ * @param {number=} limit=100 - Maximum number of results to return
67
+ * @param {number=} offset=0 - Offset from which to return results
68
+ *
69
+ * @returns {Promise<Array<Object>>} - Info about the shares
70
+ */
71
+ exports.Shares = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
72
+ var _ref4,
73
+ objectId,
74
+ _ref4$limit,
75
+ limit,
76
+ _ref4$offset,
77
+ offset,
78
+ tenantId,
79
+ response,
80
+ _args2 = arguments;
81
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
82
+ while (1) switch (_context2.prev = _context2.next) {
83
+ case 0:
84
+ _ref4 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, objectId = _ref4.objectId, _ref4$limit = _ref4.limit, limit = _ref4$limit === void 0 ? 100 : _ref4$limit, _ref4$offset = _ref4.offset, offset = _ref4$offset === void 0 ? 0 : _ref4$offset;
85
+ _context2.next = 3;
86
+ return this.userProfileClient.TenantContractId();
87
+ case 3:
88
+ tenantId = _context2.sent;
89
+ _context2.next = 6;
90
+ return this.MakeAuthServiceRequest({
91
+ path: UrlJoin("as", "sharing", tenantId, "shares"),
92
+ method: objectId ? "POST" : "GET",
93
+ queryParams: {
94
+ limit: limit,
95
+ offset: offset
96
+ },
97
+ body: objectId ? {
98
+ object_id: objectId
99
+ } : undefined,
100
+ format: "JSON",
101
+ headers: {
102
+ Authorization: "Bearer ".concat(this.signedToken)
103
+ }
104
+ });
105
+ case 6:
106
+ response = _context2.sent;
107
+ // Convert dates from seconds to date strings
108
+ if (response && response.shares) {
109
+ response.shares = response.shares.map(function (share) {
110
+ return _objectSpread(_objectSpread({}, share), {}, {
111
+ start_time: share.start_time ? new Date(share.start_time * 1000).toISOString() : null,
112
+ end_time: share.end_time ? new Date(share.end_time * 1000).toISOString() : null
113
+ });
114
+ });
115
+ }
116
+ return _context2.abrupt("return", response);
117
+ case 9:
118
+ case "end":
119
+ return _context2.stop();
120
+ }
121
+ }, _callee2, this);
122
+ }));
123
+
124
+ /**
125
+ * Update the specified share
126
+ *
127
+ * @namedParams
128
+ * @param {string} shareId - The ID of the share to modify
129
+ * @param {Date=} expiresAt - The new expiration time of the share
130
+ * @param {Object=} params - Additional parameters
131
+ *
132
+ * @returns {Promise<Object>} - Info about the updated share
133
+ */
134
+ exports.UpdateShare = /*#__PURE__*/function () {
135
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
136
+ var shareId, expiresAt, _ref5$params, params, tenantId;
137
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
138
+ while (1) switch (_context3.prev = _context3.next) {
139
+ case 0:
140
+ shareId = _ref5.shareId, expiresAt = _ref5.expiresAt, _ref5$params = _ref5.params, params = _ref5$params === void 0 ? {} : _ref5$params;
141
+ _context3.next = 3;
142
+ return this.userProfileClient.TenantContractId();
143
+ case 3:
144
+ tenantId = _context3.sent;
145
+ if (expiresAt) {
146
+ params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
147
+ }
148
+ _context3.next = 7;
149
+ return this.MakeAuthServiceRequest({
150
+ path: UrlJoin("as", "sharing", tenantId, "share", shareId),
151
+ method: "PUT",
152
+ format: "JSON",
153
+ body: params,
154
+ headers: {
155
+ Authorization: "Bearer ".concat(this.signedToken)
156
+ }
157
+ });
158
+ case 7:
159
+ return _context3.abrupt("return", _context3.sent);
160
+ case 8:
161
+ case "end":
162
+ return _context3.stop();
163
+ }
164
+ }, _callee3, this);
165
+ }));
166
+ return function (_x2) {
167
+ return _ref6.apply(this, arguments);
168
+ };
169
+ }();
170
+
171
+ /**
172
+ * Revoke the specified share
173
+ *
174
+ * @namedParams
175
+ * @param {string} shareId - The ID of the share to modify
176
+ */
177
+ exports.RevokeShare = /*#__PURE__*/function () {
178
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
179
+ var shareId, tenantId;
180
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
181
+ while (1) switch (_context4.prev = _context4.next) {
182
+ case 0:
183
+ shareId = _ref7.shareId;
184
+ _context4.next = 3;
185
+ return this.userProfileClient.TenantContractId();
186
+ case 3:
187
+ tenantId = _context4.sent;
188
+ _context4.next = 6;
189
+ return this.MakeAuthServiceRequest({
190
+ path: UrlJoin("as", "sharing", tenantId, "share", shareId, "revoke"),
191
+ method: "PUT",
192
+ format: "JSON",
193
+ headers: {
194
+ Authorization: "Bearer ".concat(this.signedToken)
195
+ }
196
+ });
197
+ case 6:
198
+ return _context4.abrupt("return", _context4.sent);
199
+ case 7:
200
+ case "end":
201
+ return _context4.stop();
202
+ }
203
+ }, _callee4, this);
204
+ }));
205
+ return function (_x3) {
206
+ return _ref8.apply(this, arguments);
207
+ };
208
+ }();
209
+
210
+ /**
211
+ * Retrieve info about the specified share
212
+ *
213
+ * @namedParams
214
+ * @param {string} shareId - The ID of the share
215
+ *
216
+ * @returns {Promise<Object>} - Info about the share
217
+ */
218
+ exports.ShareInfo = /*#__PURE__*/function () {
219
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref9) {
220
+ var shareId, _yield$this$MakeAuthS, share;
221
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
222
+ while (1) switch (_context5.prev = _context5.next) {
223
+ case 0:
224
+ shareId = _ref9.shareId;
225
+ _context5.next = 3;
226
+ return this.MakeAuthServiceRequest({
227
+ path: UrlJoin("as", "sharing", "share", shareId, "info"),
228
+ method: "GET",
229
+ format: "JSON"
230
+ });
231
+ case 3:
232
+ _yield$this$MakeAuthS = _context5.sent;
233
+ share = _yield$this$MakeAuthS.share;
234
+ if (share.start_time) {
235
+ share.start_time = new Date(share.start_time * 1000).toISOString();
236
+ }
237
+ if (share.end_time) {
238
+ share.end_time = new Date(share.end_time * 1000).toISOString();
239
+ }
240
+ return _context5.abrupt("return", share);
241
+ case 8:
242
+ case "end":
243
+ return _context5.stop();
244
+ }
245
+ }, _callee5, this);
246
+ }));
247
+ return function (_x4) {
248
+ return _ref10.apply(this, arguments);
249
+ };
250
+ }();
251
+
252
+ /**
253
+ * Retrieve the authorization token for the specified share
254
+ *
255
+ * @namedParams
256
+ * @param {string} shareId - The ID of the share
257
+ *
258
+ * @returns {Promise<Object>} - The authorization token for the share
259
+ */
260
+ exports.RedeemShareToken = /*#__PURE__*/function () {
261
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref11) {
262
+ var shareId;
263
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
264
+ while (1) switch (_context6.prev = _context6.next) {
265
+ case 0:
266
+ shareId = _ref11.shareId;
267
+ _context6.next = 3;
268
+ return this.MakeAuthServiceRequest({
269
+ path: UrlJoin("as", "sharing", "share", shareId, "token"),
270
+ method: "GET",
271
+ format: "JSON"
272
+ });
273
+ case 3:
274
+ return _context6.abrupt("return", _context6.sent.token);
275
+ case 4:
276
+ case "end":
277
+ return _context6.stop();
278
+ }
279
+ }, _callee6, this);
280
+ }));
281
+ return function (_x5) {
282
+ return _ref12.apply(this, arguments);
283
+ };
284
+ }();
@@ -2134,7 +2134,7 @@ exports.PurchaseStatus = /*#__PURE__*/function () {
2134
2134
  marketplaceInfo = _context38.sent;
2135
2135
  _context38.next = 7;
2136
2136
  return this.MintingStatus({
2137
- tenantId: marketplaceInfo.tenant_id
2137
+ tenantId: marketplaceInfo.tenantId
2138
2138
  });
2139
2139
  case 7:
2140
2140
  statuses = _context38.sent;
@@ -1085,11 +1085,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
1085
1085
  var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
1086
1086
  var _this4 = this;
1087
1087
  var forceReload,
1088
- metadata,
1089
- marketplaceOrder,
1090
- previewTenantSlug,
1091
- previewMarketplaceSlug,
1092
- previewMarketplaceMetadata,
1088
+ marketplaces,
1093
1089
  availableMarketplaces,
1094
1090
  availableMarketplacesById,
1095
1091
  _args18 = arguments;
@@ -1103,124 +1099,27 @@ var ElvWalletClient = /*#__PURE__*/function () {
1103
1099
  }
1104
1100
  return _context18.abrupt("return");
1105
1101
  case 3:
1106
- _context18.next = 5;
1107
- return this.client.ContentObjectMetadata({
1108
- libraryId: this.mainSiteLibraryId,
1109
- objectId: this.mainSiteId,
1110
- metadataSubtree: "public/asset_metadata",
1111
- resolveLinks: true,
1112
- linkDepthLimit: 2,
1113
- resolveIncludeSource: true,
1114
- resolveIgnoreErrors: true,
1115
- produceLinkUrls: true,
1116
- authorizationToken: this.publicStaticToken,
1117
- noAuth: true,
1118
- select: ["info/marketplace_order", "tenants/*/.", "tenants/*/info/branding/show", "tenants/*/info/branding/name", "tenants/*/marketplaces/*/.", "tenants/*/marketplaces/*/info/tenant_id", "tenants/*/marketplaces/*/info/tenant_name", "tenants/*/marketplaces/*/info/branding/show", "tenants/*/marketplaces/*/info/branding/name"]
1119
- });
1120
- case 5:
1121
- metadata = _context18.sent;
1122
- marketplaceOrder = ((metadata || {}).info || {}).marketplace_order || [];
1123
- metadata = (metadata || {}).tenants || {};
1124
-
1125
- // If preview marketplace is specified, load it appropriately
1126
- if (!this.previewMarketplaceId) {
1127
- _context18.next = 23;
1128
- break;
1129
- }
1130
- previewTenantSlug = "PREVIEW";
1131
- Object.keys(metadata || {}).forEach(function (tenantSlug) {
1132
- return Object.keys(metadata[tenantSlug].marketplaces || {}).forEach(function (marketplaceSlug) {
1133
- var versionHash = metadata[tenantSlug].marketplaces[marketplaceSlug]["."].source;
1134
- var objectId = _this4.utils.DecodeVersionHash(versionHash).objectId;
1135
- if (objectId === _this4.previewMarketplaceId) {
1136
- // Marketplace exists in site meta
1137
- previewTenantSlug = tenantSlug;
1138
- previewMarketplaceSlug = marketplaceSlug;
1139
-
1140
- // Deployed marketplace is same as preview marketplace
1141
- if (versionHash === _this4.previewMarketplaceHash) {
1142
- previewMarketplaceMetadata = metadata[tenantSlug].marketplaces[marketplaceSlug];
1143
- }
1144
- }
1145
- });
1146
- });
1147
-
1148
- // Marketplace not present in branch, or preview version is different - Load metadata directly
1149
- if (previewMarketplaceMetadata) {
1150
- _context18.next = 16;
1151
- break;
1152
- }
1153
- _context18.next = 14;
1154
- return this.client.ContentObjectMetadata({
1155
- versionHash: this.previewMarketplaceHash,
1156
- metadataSubtree: "public/asset_metadata",
1157
- produceLinkUrls: true,
1158
- authorizationToken: this.publicStaticToken,
1159
- noAuth: true,
1160
- select: ["slug", "info/tenant_id", "info/tenant_name", "info/branding"],
1161
- remove: ["info/branding/custom_css"]
1162
- });
1163
- case 14:
1164
- previewMarketplaceMetadata = _context18.sent;
1165
- if (!previewMarketplaceSlug) {
1166
- previewMarketplaceSlug = previewMarketplaceMetadata.slug;
1167
- }
1168
- case 16:
1169
- previewMarketplaceMetadata["."] = {
1170
- source: this.previewMarketplaceHash
1171
- };
1172
- previewMarketplaceMetadata.info["."] = {
1173
- source: this.previewMarketplaceHash
1174
- };
1175
- previewMarketplaceMetadata.info.branding.preview = true;
1176
- previewMarketplaceMetadata.info.branding.show = true;
1177
- metadata[previewTenantSlug] = metadata[previewTenantSlug] || {};
1178
- metadata[previewTenantSlug].marketplaces = metadata[previewTenantSlug].marketplaces || {};
1179
- metadata[previewTenantSlug].marketplaces[previewMarketplaceSlug] = previewMarketplaceMetadata;
1180
- case 23:
1102
+ marketplaces = this.topLevelInfo.marketplaces;
1181
1103
  availableMarketplaces = _objectSpread({}, this.availableMarketplaces || {});
1182
1104
  availableMarketplacesById = _objectSpread({}, this.availableMarketplacesById || {});
1183
- Object.keys(metadata || {}).forEach(function (tenantSlug) {
1184
- try {
1185
- availableMarketplaces[tenantSlug] = metadata[tenantSlug]["."] ? {
1186
- versionHash: metadata[tenantSlug]["."].source
1187
- } : {};
1188
- Object.keys(metadata[tenantSlug].marketplaces || {}).forEach(function (marketplaceSlug) {
1189
- try {
1190
- var versionHash = metadata[tenantSlug].marketplaces[marketplaceSlug]["."].source;
1191
- var objectId = _this4.utils.DecodeVersionHash(versionHash).objectId;
1192
- availableMarketplaces[tenantSlug][marketplaceSlug] = _objectSpread(_objectSpread({}, metadata[tenantSlug].marketplaces[marketplaceSlug].info || {}), {}, {
1193
- tenantName: metadata[tenantSlug].marketplaces[marketplaceSlug].info.tenant_name,
1194
- tenantId: metadata[tenantSlug].marketplaces[marketplaceSlug].info.tenant_id,
1195
- tenantSlug: tenantSlug,
1196
- marketplaceSlug: marketplaceSlug,
1197
- marketplaceId: objectId,
1198
- marketplaceHash: versionHash,
1199
- tenantBranding: (metadata[tenantSlug].info || {}).branding || {},
1200
- order: marketplaceOrder.findIndex(function (slug) {
1201
- return slug === marketplaceSlug;
1202
- })
1203
- });
1204
- availableMarketplacesById[objectId] = availableMarketplaces[tenantSlug][marketplaceSlug];
1205
- _this4.marketplaceHashes[objectId] = versionHash;
1206
-
1207
- // Fill out selected marketplace info
1208
- if (_this4.selectedMarketplaceInfo) {
1209
- if (_this4.selectedMarketplaceInfo.tenantSlug === tenantSlug && _this4.selectedMarketplaceInfo.marketplaceSlug === marketplaceSlug || _this4.selectedMarketplaceInfo.marketplaceId === objectId) {
1210
- _this4.selectedMarketplaceInfo = availableMarketplaces[tenantSlug][marketplaceSlug];
1211
- }
1212
- }
1213
- } catch (error) {
1214
- _this4.Log("Eluvio Wallet Client: Unable to load info for marketplace ".concat(tenantSlug, "/").concat(marketplaceSlug), true);
1215
- }
1216
- });
1217
- } catch (error) {
1218
- _this4.Log("Eluvio Wallet Client: Failed to load tenant info ".concat(tenantSlug), true, error);
1219
- }
1105
+ marketplaces.map(function (marketplaceInfo) {
1106
+ var marketplaceId = Utils.DecodeVersionHash(marketplaceInfo.source_hash).objectId;
1107
+ var marketplaceSlug = marketplaceInfo.slug || marketplaceInfo.name;
1108
+ availableMarketplaces[marketplaceInfo.tenant_slug] = availableMarketplaces[marketplaceInfo.tenant_slug] || {};
1109
+ availableMarketplaces[marketplaceInfo.tenant_slug][marketplaceSlug] = _objectSpread(_objectSpread({}, marketplaceInfo), {}, {
1110
+ tenantName: marketplaceInfo.tenant_slug,
1111
+ tenantSlug: marketplaceInfo.tenant_slug,
1112
+ tenantId: marketplaceInfo.tenant_id,
1113
+ marketplaceSlug: marketplaceSlug,
1114
+ marketplaceId: marketplaceId,
1115
+ marketplaceHash: marketplaceInfo.source_hash
1116
+ });
1117
+ availableMarketplacesById[marketplaceId] = availableMarketplaces[marketplaceInfo.tenant_slug][marketplaceSlug];
1118
+ _this4.marketplaceHashes[marketplaceId] = marketplaceInfo.source_hash;
1220
1119
  });
1221
1120
  this.availableMarketplaces = availableMarketplaces;
1222
1121
  this.availableMarketplacesById = availableMarketplacesById;
1223
- case 28:
1122
+ case 9:
1224
1123
  case "end":
1225
1124
  return _context18.stop();
1226
1125
  }
@@ -1830,6 +1729,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
1830
1729
  offerId = status.op.split(":")[3];
1831
1730
  }
1832
1731
  if (op === "nft-claim-entitlement") {
1732
+ // eslint-disable-next-line no-unused-vars
1833
1733
  var _status$op$split3 = status.op.split(":"),
1834
1734
  _status$op$split4 = _slicedToArray(_status$op$split3, 4),
1835
1735
  _op = _status$op$split4[0],
@@ -2078,15 +1978,24 @@ var ElvWalletClient = /*#__PURE__*/function () {
2078
1978
  _context25.prev = 35;
2079
1979
  _context25.t0 = _context25["catch"](28);
2080
1980
  case 37:
1981
+ _context25.next = 39;
1982
+ return client.utils.ResponseToJson(client.MakeAuthServiceRequest({
1983
+ path: "/as/mw/toplevel",
1984
+ queryParams: {
1985
+ env: mode
1986
+ }
1987
+ }));
1988
+ case 39:
1989
+ walletClient.topLevelInfo = _context25.sent;
2081
1990
  if (skipMarketplaceLoad) {
2082
- _context25.next = 40;
1991
+ _context25.next = 43;
2083
1992
  break;
2084
1993
  }
2085
- _context25.next = 40;
1994
+ _context25.next = 43;
2086
1995
  return walletClient.LoadAvailableMarketplaces();
2087
- case 40:
1996
+ case 43:
2088
1997
  return _context25.abrupt("return", walletClient);
2089
- case 41:
1998
+ case 44:
2090
1999
  case "end":
2091
2000
  return _context25.stop();
2092
2001
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.120",
3
+ "version": "4.0.122",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "bump-version": "npm --git-tag-version --no-commit-hooks version patch",
11
11
  "build": "npm run build-docs && npm run build-dist && npm run build-frame-client && npm run build-permissions-client && npm run build-wallet-client-web && npm run build-wallet-client-node && npm run build-prod",
12
- "build-docs": "node build/BuildDocs.js && npm run build-client-docs && npm run build-wallet-client-docs",
12
+ "build-docs": "npm run build-client-docs && npm run build-wallet-client-docs",
13
13
  "build-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc.json --readme README.md",
14
14
  "build-wallet-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc-mc.json --readme ./src/walletClient/README.md",
15
15
  "build-dist": "node ./node_modules/@babel/cli/bin/babel.js --source-type=unambiguous --presets=@babel/preset-env --plugins @babel/plugin-transform-runtime src --out-dir dist/src",
package/src/ElvClient.js CHANGED
@@ -750,6 +750,9 @@ class ElvClient {
750
750
  signer.provider.pollingInterval = 500;
751
751
  this.signer = signer;
752
752
 
753
+ this.CreateFabricToken({})
754
+ .then(token => this.signedToken = token);
755
+
753
756
  if(reset) {
754
757
  this.InitializeClients();
755
758
  }
@@ -1299,8 +1302,11 @@ class ElvClient {
1299
1302
  );
1300
1303
  }
1301
1304
 
1302
- async MakeAuthServiceRequest({kmsId, objectId, versionHash, method="GET", path, bodyType, body={}, queryParams={}, headers}) {
1303
- return this.authClient.MakeAuthServiceRequest({kmsId, objectId, versionHash, method, path, bodyType, body, queryParams, headers});
1305
+ async MakeAuthServiceRequest({kmsId, objectId, versionHash, method="GET", path, bodyType, body={}, queryParams={}, headers, format}) {
1306
+ const response = this.authClient.MakeAuthServiceRequest({kmsId, objectId, versionHash, method, path, bodyType, body, queryParams, headers});
1307
+
1308
+ return !format ? response :
1309
+ this.utils.ResponseToFormat(format, response);
1304
1310
  }
1305
1311
 
1306
1312
  /* FrameClient related */
@@ -1416,5 +1422,6 @@ Object.assign(ElvClient.prototype, require("./client/LiveStream"));
1416
1422
  Object.assign(ElvClient.prototype, require("./client/ContentManagement"));
1417
1423
  Object.assign(ElvClient.prototype, require("./client/NTP"));
1418
1424
  Object.assign(ElvClient.prototype, require("./client/NFT"));
1425
+ Object.assign(ElvClient.prototype, require("./client/Shares"));
1419
1426
 
1420
1427
  exports.ElvClient = ElvClient;
@@ -375,6 +375,7 @@ class FrameClient {
375
375
  "CreateNonOwnerCap",
376
376
  "CreatePart",
377
377
  "CreateProductionMaster",
378
+ "CreateShare",
378
379
  "CreateSignedToken",
379
380
  "CreateStaticToken",
380
381
  "CurrentAccountAddress",
@@ -452,6 +453,7 @@ class FrameClient {
452
453
  "QParts",
453
454
  "RecordWriteToken",
454
455
  "RedeemCode",
456
+ "RedeemShareToken",
455
457
  "RemoveAccessGroupManager",
456
458
  "RemoveAccessGroupMember",
457
459
  "RemoveContentObjectGroupPermission",
@@ -462,6 +464,7 @@ class FrameClient {
462
464
  "ReplaceMetadata",
463
465
  "Request",
464
466
  "ResetRegion",
467
+ "RevokeShare",
465
468
  "SendFunds",
466
469
  "SetAccessCharge",
467
470
  "SetAuth",
@@ -478,6 +481,7 @@ class FrameClient {
478
481
  "SetStaticToken",
479
482
  "SetVisibility",
480
483
  "SetPermission",
484
+ "Shares",
481
485
  "SpaceNodes",
482
486
  "StartABRMezzanineJobs",
483
487
  "StreamAddWatermark",
@@ -495,6 +499,7 @@ class FrameClient {
495
499
  "UnlinkAccessGroupFromOauth",
496
500
  "UpdateContentObjectGraph",
497
501
  "UpdateNTPInstance",
502
+ "UpdateShare",
498
503
  "UploadFileData",
499
504
  "UploadFilesFromS3",
500
505
  "UploadJobStatus",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Methods for ABR video creation and management
3
3
  *
4
- * For more information on how to publish ABR content see <a href="./abr/index.html">this detailed guide</a>
4
+ * For more information on how to publish ABR content see <a href="https://docs.eluv.io/docs/guides/media-ingest/">this detailed guide</a>
5
5
  *
6
6
  * @module ElvClient/ABRPublishing
7
7
  */
@@ -1358,10 +1358,19 @@ exports.StreamInsertion = async function({name, insertionTime, sinceStart=false,
1358
1358
  * @param {string} name - Object ID or name of the live stream object
1359
1359
  * @param {Object=} customSettings - Additional options to customize configuration settings
1360
1360
  * @param {Object=} probeMetadata - Metadata for the probe. If not specified, a new probe will be configured
1361
+ * @param {string=} writeToken - Write token of the draft
1362
+ * @param {boolean=} finalize - If enabled, target object will be finalized after configuring
1363
+ *
1361
1364
  * @return {Promise<Object>} - The status response for the stream
1362
1365
  *
1363
1366
  */
1364
- exports.StreamConfig = async function({name, customSettings={}, probeMetadata}) {
1367
+ exports.StreamConfig = async function({
1368
+ name,
1369
+ customSettings={},
1370
+ probeMetadata,
1371
+ writeToken,
1372
+ finalize=true
1373
+ }) {
1365
1374
  let objectId = name;
1366
1375
  let status = {name};
1367
1376
 
@@ -1444,11 +1453,13 @@ exports.StreamConfig = async function({name, customSettings={}, probeMetadata})
1444
1453
  });
1445
1454
 
1446
1455
  // Store live recording config into the stream object
1447
- let e = await this.EditContentObject({
1448
- libraryId,
1449
- objectId: objectId
1450
- });
1451
- let writeToken = e.write_token;
1456
+ if(!writeToken) {
1457
+ let e = await this.EditContentObject({
1458
+ libraryId,
1459
+ objectId: objectId
1460
+ });
1461
+ writeToken = e.write_token;
1462
+ }
1452
1463
 
1453
1464
  await this.ReplaceMetadata({
1454
1465
  libraryId,
@@ -1466,12 +1477,14 @@ exports.StreamConfig = async function({name, customSettings={}, probeMetadata})
1466
1477
  metadata: probe
1467
1478
  });
1468
1479
 
1469
- status.fin = await this.FinalizeContentObject({
1470
- libraryId,
1471
- objectId,
1472
- writeToken,
1473
- commitMessage: "Apply live stream configuration"
1474
- });
1480
+ if(finalize) {
1481
+ status.fin = await this.FinalizeContentObject({
1482
+ libraryId,
1483
+ objectId,
1484
+ writeToken,
1485
+ commitMessage: "Apply live stream configuration"
1486
+ });
1487
+ }
1475
1488
 
1476
1489
  return status;
1477
1490
  };