@eluvio/elv-client-js 4.0.126 → 4.0.128
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/ElvClient.js +5 -3
- package/src/FrameClient.js +1 -0
- package/src/client/Shares.js +14 -5
package/package.json
CHANGED
package/src/ElvClient.js
CHANGED
|
@@ -750,9 +750,6 @@ 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
|
-
|
|
756
753
|
if(reset) {
|
|
757
754
|
this.InitializeClients();
|
|
758
755
|
}
|
|
@@ -1016,6 +1013,9 @@ class ElvClient {
|
|
|
1016
1013
|
]))}`;
|
|
1017
1014
|
}
|
|
1018
1015
|
|
|
1016
|
+
async CreateAuthorizationToken(args) {
|
|
1017
|
+
return await this.authClient.AuthorizationToken(args);
|
|
1018
|
+
}
|
|
1019
1019
|
|
|
1020
1020
|
/**
|
|
1021
1021
|
* Build a signed message (JSON) using the current signer.
|
|
@@ -1403,6 +1403,8 @@ class ElvClient {
|
|
|
1403
1403
|
true
|
|
1404
1404
|
);
|
|
1405
1405
|
|
|
1406
|
+
// eslint-disable-next-line no-console
|
|
1407
|
+
console.error(message);
|
|
1406
1408
|
// eslint-disable-next-line no-console
|
|
1407
1409
|
console.error(error);
|
|
1408
1410
|
|
package/src/FrameClient.js
CHANGED
package/src/client/Shares.js
CHANGED
|
@@ -18,6 +18,7 @@ const UrlJoin = require("url-join");
|
|
|
18
18
|
*/
|
|
19
19
|
exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
20
20
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
21
|
+
const token = await this.CreateFabricToken({});
|
|
21
22
|
|
|
22
23
|
params.object_id = objectId;
|
|
23
24
|
|
|
@@ -25,15 +26,20 @@ exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
|
25
26
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
const share = await this.MakeAuthServiceRequest({
|
|
29
30
|
path: UrlJoin("as", "sharing", tenantId, "share"),
|
|
30
31
|
method: "POST",
|
|
31
32
|
format: "JSON",
|
|
32
33
|
body: params,
|
|
33
34
|
headers: {
|
|
34
|
-
Authorization: `Bearer ${
|
|
35
|
+
Authorization: `Bearer ${token}`
|
|
35
36
|
}
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
share.start_time = share.start_time ? new Date(share.start_time * 1000).toISOString() : undefined;
|
|
40
|
+
share.end_time = share.end_time ? new Date(share.end_time * 1000).toISOString() : undefined;
|
|
41
|
+
|
|
42
|
+
return share;
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
/**
|
|
@@ -49,6 +55,7 @@ exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
|
49
55
|
*/
|
|
50
56
|
exports.Shares = async function({objectId, limit=100, offset=0, params={}}={}) {
|
|
51
57
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
58
|
+
const token = await this.CreateFabricToken({});
|
|
52
59
|
|
|
53
60
|
const response = await this.MakeAuthServiceRequest({
|
|
54
61
|
path: UrlJoin("as", "sharing", tenantId, "shares"),
|
|
@@ -57,7 +64,7 @@ exports.Shares = async function({objectId, limit=100, offset=0, params={}}={}) {
|
|
|
57
64
|
body: objectId ? {object_id: objectId, ...params} : undefined,
|
|
58
65
|
format: "JSON",
|
|
59
66
|
headers: {
|
|
60
|
-
Authorization: `Bearer ${
|
|
67
|
+
Authorization: `Bearer ${token}`
|
|
61
68
|
}
|
|
62
69
|
});
|
|
63
70
|
|
|
@@ -85,6 +92,7 @@ exports.Shares = async function({objectId, limit=100, offset=0, params={}}={}) {
|
|
|
85
92
|
*/
|
|
86
93
|
exports.UpdateShare = async function({shareId, expiresAt, params={}}) {
|
|
87
94
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
95
|
+
const token = await this.CreateFabricToken({});
|
|
88
96
|
|
|
89
97
|
if(expiresAt) {
|
|
90
98
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|
|
@@ -96,7 +104,7 @@ exports.UpdateShare = async function({shareId, expiresAt, params={}}) {
|
|
|
96
104
|
format: "JSON",
|
|
97
105
|
body: params,
|
|
98
106
|
headers: {
|
|
99
|
-
Authorization: `Bearer ${
|
|
107
|
+
Authorization: `Bearer ${token}`
|
|
100
108
|
}
|
|
101
109
|
});
|
|
102
110
|
};
|
|
@@ -109,13 +117,14 @@ exports.UpdateShare = async function({shareId, expiresAt, params={}}) {
|
|
|
109
117
|
*/
|
|
110
118
|
exports.RevokeShare = async function({shareId}) {
|
|
111
119
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
120
|
+
const token = await this.CreateFabricToken({});
|
|
112
121
|
|
|
113
122
|
return await this.MakeAuthServiceRequest({
|
|
114
123
|
path: UrlJoin("as", "sharing", tenantId, "share", shareId, "revoke"),
|
|
115
124
|
method: "PUT",
|
|
116
125
|
format: "JSON",
|
|
117
126
|
headers: {
|
|
118
|
-
Authorization: `Bearer ${
|
|
127
|
+
Authorization: `Bearer ${token}`
|
|
119
128
|
}
|
|
120
129
|
});
|
|
121
130
|
};
|