@eluvio/elv-client-js 4.2.0 → 4.2.2
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/src/HttpClient.js +3 -2
- package/src/client/ContentAccess.js +1 -1
- package/src/client/Shares.js +9 -3
package/package.json
CHANGED
package/src/HttpClient.js
CHANGED
|
@@ -2,6 +2,7 @@ const URI = require("urijs");
|
|
|
2
2
|
const Fetch = typeof fetch !== "undefined" ? fetch : require("node-fetch").default;
|
|
3
3
|
const {LogMessage} = require("./LogMessage");
|
|
4
4
|
const Utils = require("./Utils");
|
|
5
|
+
const UrlJoin = require("url-join");
|
|
5
6
|
|
|
6
7
|
class HttpClient {
|
|
7
8
|
Log(message, error=false) {
|
|
@@ -83,7 +84,7 @@ class HttpClient {
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
let uri = baseURI
|
|
86
|
-
.path(path)
|
|
87
|
+
.path(UrlJoin(baseURI.path(), path).replace("/as/as", "/as"))
|
|
87
88
|
.query(queryParams)
|
|
88
89
|
.hash("");
|
|
89
90
|
|
|
@@ -237,7 +238,7 @@ class HttpClient {
|
|
|
237
238
|
|
|
238
239
|
return (
|
|
239
240
|
baseURI
|
|
240
|
-
.path(path)
|
|
241
|
+
.path(UrlJoin(baseURI.path(), path).replace("/as/as", "/as"))
|
|
241
242
|
.query(queryParams)
|
|
242
243
|
.hash("")
|
|
243
244
|
.toString()
|
|
@@ -635,7 +635,7 @@ exports.ContentObjectOwner = async function({objectId, versionHash}) {
|
|
|
635
635
|
|
|
636
636
|
this.Log(`Retrieving content object owner: ${objectId}`);
|
|
637
637
|
|
|
638
|
-
return (await this.ContentObject({objectId, versionHash})).content_profile.owner;
|
|
638
|
+
return this.utils.HashToAddress((await this.ContentObject({objectId, versionHash})).content_profile.owner);
|
|
639
639
|
};
|
|
640
640
|
|
|
641
641
|
/**
|
package/src/client/Shares.js
CHANGED
|
@@ -10,17 +10,23 @@ const UrlJoin = require("url-join");
|
|
|
10
10
|
* Create a share
|
|
11
11
|
*
|
|
12
12
|
* @namedParams
|
|
13
|
-
* @param {string} objectId - The object to
|
|
13
|
+
* @param {string} objectId - The ID of the object to share
|
|
14
|
+
* @param {Array<string>} objectIds - Additional object IDs to authorize
|
|
14
15
|
* @param {Date} expiresAt - The expiration time of the share
|
|
15
16
|
* @param {Object=} params - Additional parameters
|
|
16
17
|
*
|
|
17
18
|
* @returns {Promise<Object>} - Info about the created share
|
|
18
19
|
*/
|
|
19
|
-
exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
20
|
+
exports.CreateShare = async function({objectId, objectIds=[], expiresAt, params={}}) {
|
|
20
21
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
21
22
|
const token = await this.CreateFabricToken({});
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
if(objectId) {
|
|
25
|
+
objectIds = [objectId, ...objectIds]
|
|
26
|
+
.filter((x, i, a) => x && a.indexOf(x) == i);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
params.object_ids = objectIds;
|
|
24
30
|
|
|
25
31
|
if(expiresAt) {
|
|
26
32
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|