@eluvio/elv-client-js 3.1.78 → 3.1.83
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 +2 -2
- package/dist/ElvClient-node-min.js +3 -3
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/src/AuthorizationClient.js +175 -142
- package/dist/src/ElvClient.js +14 -10
- package/dist/src/RemoteSigner.js +22 -5
- package/dist/src/UserProfileClient.js +19 -12
- package/dist/src/client/ContentAccess.js +68 -58
- package/dist/src/client/ContentManagement.js +40 -17
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/AuthorizationClient.js +19 -1
- package/src/ElvClient.js +12 -7
- package/src/RemoteSigner.js +15 -3
- package/src/UserProfileClient.js +14 -6
- package/src/client/ContentAccess.js +28 -17
- package/testScripts/CreateABRMezzanine.js +0 -1
- package/testScripts/OfferingRemoveDash.js +49 -0
- package/typeSpecs/DropEventSite.js +308 -105
- package/typeSpecs/EventTenant.js +1 -1
- package/typeSpecs/Marketplace.js +234 -148
- package/typeSpecs/NFTTemplate.js +26 -4
- package/typeSpecs/UpdateTypes.js +92 -0
- package/utilities/ChannelGetTestUrls.js +179 -0
- package/utilities/MezzanineCreate.js +0 -1
- package/typeSpecs/EventSite.js +0 -803
- package/utilities/ChannelGetLiveUrls.js +0 -136
|
@@ -880,7 +880,7 @@ exports.RemoveLibraryContentType = function _callee9(_ref12) {
|
|
|
880
880
|
|
|
881
881
|
|
|
882
882
|
exports.CreateContentObject = function _callee10(_ref13) {
|
|
883
|
-
var libraryId, objectId, _ref13$options, options, typeId, type, _ref14, contractAddress, path, createResponse;
|
|
883
|
+
var libraryId, objectId, _ref13$options, options, typeId, type, currentAccountAddress, canContribute, _ref14, contractAddress, path, createResponse;
|
|
884
884
|
|
|
885
885
|
return _regeneratorRuntime.async(function _callee10$(_context11) {
|
|
886
886
|
while (1) {
|
|
@@ -957,65 +957,88 @@ exports.CreateContentObject = function _callee10(_ref13) {
|
|
|
957
957
|
|
|
958
958
|
case 26:
|
|
959
959
|
if (objectId) {
|
|
960
|
-
_context11.next =
|
|
960
|
+
_context11.next = 44;
|
|
961
961
|
break;
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
+
_context11.next = 29;
|
|
965
|
+
return _regeneratorRuntime.awrap(this.CurrentAccountAddress());
|
|
966
|
+
|
|
967
|
+
case 29:
|
|
968
|
+
currentAccountAddress = _context11.sent;
|
|
969
|
+
_context11.next = 32;
|
|
970
|
+
return _regeneratorRuntime.awrap(this.CallContractMethod({
|
|
971
|
+
contractAddress: this.utils.HashToAddress(libraryId),
|
|
972
|
+
methodName: "canContribute",
|
|
973
|
+
methodArgs: [currentAccountAddress]
|
|
974
|
+
}));
|
|
975
|
+
|
|
976
|
+
case 32:
|
|
977
|
+
canContribute = _context11.sent;
|
|
978
|
+
|
|
979
|
+
if (canContribute) {
|
|
980
|
+
_context11.next = 35;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
throw Error("Current user does not have permission to create content in library ".concat(libraryId));
|
|
985
|
+
|
|
986
|
+
case 35:
|
|
964
987
|
this.Log("Deploying contract...");
|
|
965
|
-
_context11.next =
|
|
988
|
+
_context11.next = 38;
|
|
966
989
|
return _regeneratorRuntime.awrap(this.authClient.CreateContentObject({
|
|
967
990
|
libraryId: libraryId,
|
|
968
991
|
typeId: typeId
|
|
969
992
|
}));
|
|
970
993
|
|
|
971
|
-
case
|
|
994
|
+
case 38:
|
|
972
995
|
_ref14 = _context11.sent;
|
|
973
996
|
contractAddress = _ref14.contractAddress;
|
|
974
997
|
objectId = this.utils.AddressToObjectId(contractAddress);
|
|
975
998
|
this.Log("Contract deployed: ".concat(contractAddress, " ").concat(objectId));
|
|
976
|
-
_context11.next =
|
|
999
|
+
_context11.next = 51;
|
|
977
1000
|
break;
|
|
978
1001
|
|
|
979
|
-
case
|
|
1002
|
+
case 44:
|
|
980
1003
|
_context11.t0 = this;
|
|
981
1004
|
_context11.t1 = "Contract already deployed for contract type: ";
|
|
982
|
-
_context11.next =
|
|
1005
|
+
_context11.next = 48;
|
|
983
1006
|
return _regeneratorRuntime.awrap(this.AccessType({
|
|
984
1007
|
id: objectId
|
|
985
1008
|
}));
|
|
986
1009
|
|
|
987
|
-
case
|
|
1010
|
+
case 48:
|
|
988
1011
|
_context11.t2 = _context11.sent;
|
|
989
1012
|
_context11.t3 = _context11.t1.concat.call(_context11.t1, _context11.t2);
|
|
990
1013
|
|
|
991
1014
|
_context11.t0.Log.call(_context11.t0, _context11.t3);
|
|
992
1015
|
|
|
993
|
-
case
|
|
1016
|
+
case 51:
|
|
994
1017
|
if (!options.visibility) {
|
|
995
|
-
_context11.next =
|
|
1018
|
+
_context11.next = 55;
|
|
996
1019
|
break;
|
|
997
1020
|
}
|
|
998
1021
|
|
|
999
1022
|
this.Log("Setting visibility to ".concat(options.visibility));
|
|
1000
|
-
_context11.next =
|
|
1023
|
+
_context11.next = 55;
|
|
1001
1024
|
return _regeneratorRuntime.awrap(this.SetVisibility({
|
|
1002
1025
|
id: objectId,
|
|
1003
1026
|
visibility: options.visibility
|
|
1004
1027
|
}));
|
|
1005
1028
|
|
|
1006
|
-
case
|
|
1029
|
+
case 55:
|
|
1007
1030
|
path = UrlJoin("qid", objectId);
|
|
1008
1031
|
_context11.t4 = _regeneratorRuntime;
|
|
1009
1032
|
_context11.t5 = this.utils;
|
|
1010
1033
|
_context11.t6 = this.HttpClient;
|
|
1011
|
-
_context11.next =
|
|
1034
|
+
_context11.next = 61;
|
|
1012
1035
|
return _regeneratorRuntime.awrap(this.authClient.AuthorizationHeader({
|
|
1013
1036
|
libraryId: libraryId,
|
|
1014
1037
|
objectId: objectId,
|
|
1015
1038
|
update: true
|
|
1016
1039
|
}));
|
|
1017
1040
|
|
|
1018
|
-
case
|
|
1041
|
+
case 61:
|
|
1019
1042
|
_context11.t7 = _context11.sent;
|
|
1020
1043
|
_context11.t8 = path;
|
|
1021
1044
|
_context11.t9 = options;
|
|
@@ -1027,10 +1050,10 @@ exports.CreateContentObject = function _callee10(_ref13) {
|
|
|
1027
1050
|
};
|
|
1028
1051
|
_context11.t11 = _context11.t6.Request.call(_context11.t6, _context11.t10);
|
|
1029
1052
|
_context11.t12 = _context11.t5.ResponseToJson.call(_context11.t5, _context11.t11);
|
|
1030
|
-
_context11.next =
|
|
1053
|
+
_context11.next = 69;
|
|
1031
1054
|
return _context11.t4.awrap.call(_context11.t4, _context11.t12);
|
|
1032
1055
|
|
|
1033
|
-
case
|
|
1056
|
+
case 69:
|
|
1034
1057
|
createResponse = _context11.sent;
|
|
1035
1058
|
// Record the node used in creating this write token
|
|
1036
1059
|
this.HttpClient.RecordWriteToken(createResponse.write_token);
|
|
@@ -1038,7 +1061,7 @@ exports.CreateContentObject = function _callee10(_ref13) {
|
|
|
1038
1061
|
createResponse.objectId = createResponse.id;
|
|
1039
1062
|
return _context11.abrupt("return", createResponse);
|
|
1040
1063
|
|
|
1041
|
-
case
|
|
1064
|
+
case 74:
|
|
1042
1065
|
case "end":
|
|
1043
1066
|
return _context11.stop();
|
|
1044
1067
|
}
|
package/package-lock.json
CHANGED
package/package.json
CHANGED
|
@@ -84,6 +84,16 @@ class AuthorizationClient {
|
|
|
84
84
|
this.providers = {};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
CreateStaticToken({libraryId}) {
|
|
88
|
+
let token = { qspace_id: this.client.contentSpaceId };
|
|
89
|
+
|
|
90
|
+
if(libraryId) {
|
|
91
|
+
token.qlib_id = libraryId;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return Utils.B64(JSON.stringify(token));
|
|
95
|
+
}
|
|
96
|
+
|
|
87
97
|
// Return authorization token in appropriate headers
|
|
88
98
|
async AuthorizationHeader(params) {
|
|
89
99
|
const authorizationToken = await this.AuthorizationToken(params);
|
|
@@ -150,6 +160,10 @@ class AuthorizationClient {
|
|
|
150
160
|
oauthToken
|
|
151
161
|
});
|
|
152
162
|
} else {
|
|
163
|
+
if(noAuth) {
|
|
164
|
+
return this.CreateStaticToken({libraryId});
|
|
165
|
+
}
|
|
166
|
+
|
|
153
167
|
authorizationToken = await this.GenerateAuthorizationToken({
|
|
154
168
|
libraryId,
|
|
155
169
|
objectId,
|
|
@@ -177,7 +191,7 @@ class AuthorizationClient {
|
|
|
177
191
|
if(encryption && encryption !== "none" && objectId && await this.AccessType(objectId) === ACCESS_TYPES.OBJECT) {
|
|
178
192
|
const owner = await this.Owner({id: objectId});
|
|
179
193
|
const ownerCapKey = `eluv.caps.iusr${Utils.AddressToHash(this.client.signer.address)}`;
|
|
180
|
-
const ownerCap = await client.ContentObjectMetadata({libraryId, objectId, metadataSubtree: ownerCapKey});
|
|
194
|
+
const ownerCap = await this.client.ContentObjectMetadata({libraryId, objectId, metadataSubtree: ownerCapKey});
|
|
181
195
|
|
|
182
196
|
if(!Utils.EqualAddress(owner, this.client.signer.address) && !ownerCap) {
|
|
183
197
|
const cap = await this.ReEncryptionConk({libraryId, objectId});
|
|
@@ -613,6 +627,10 @@ class AuthorizationClient {
|
|
|
613
627
|
}
|
|
614
628
|
|
|
615
629
|
async IsV3({id}) {
|
|
630
|
+
if(this.client.assumeV3) {
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
|
|
616
634
|
const contractName = await this.client.ethClient.ContractName(Utils.HashToAddress(id), true);
|
|
617
635
|
|
|
618
636
|
if(!this.accessVersions[contractName]) {
|
package/src/ElvClient.js
CHANGED
|
@@ -148,7 +148,8 @@ class ElvClient {
|
|
|
148
148
|
trustAuthorityId,
|
|
149
149
|
staticToken,
|
|
150
150
|
noCache=false,
|
|
151
|
-
noAuth=false
|
|
151
|
+
noAuth=false,
|
|
152
|
+
assumeV3=false
|
|
152
153
|
}) {
|
|
153
154
|
this.utils = Utils;
|
|
154
155
|
|
|
@@ -171,6 +172,7 @@ class ElvClient {
|
|
|
171
172
|
|
|
172
173
|
this.noCache = noCache;
|
|
173
174
|
this.noAuth = noAuth;
|
|
175
|
+
this.assumeV3 = assumeV3;
|
|
174
176
|
|
|
175
177
|
this.debug = false;
|
|
176
178
|
|
|
@@ -270,7 +272,8 @@ class ElvClient {
|
|
|
270
272
|
staticToken,
|
|
271
273
|
ethereumContractTimeout=10,
|
|
272
274
|
noCache=false,
|
|
273
|
-
noAuth=false
|
|
275
|
+
noAuth=false,
|
|
276
|
+
assumeV3
|
|
274
277
|
}) {
|
|
275
278
|
const configUrl = networks[networkName];
|
|
276
279
|
|
|
@@ -283,7 +286,8 @@ class ElvClient {
|
|
|
283
286
|
staticToken,
|
|
284
287
|
ethereumContractTimeout,
|
|
285
288
|
noCache,
|
|
286
|
-
noAuth
|
|
289
|
+
noAuth,
|
|
290
|
+
assumeV3
|
|
287
291
|
});
|
|
288
292
|
}
|
|
289
293
|
|
|
@@ -309,7 +313,8 @@ class ElvClient {
|
|
|
309
313
|
staticToken,
|
|
310
314
|
ethereumContractTimeout=10,
|
|
311
315
|
noCache=false,
|
|
312
|
-
noAuth=false
|
|
316
|
+
noAuth=false,
|
|
317
|
+
assumeV3=false
|
|
313
318
|
}) {
|
|
314
319
|
const {
|
|
315
320
|
contentSpaceId,
|
|
@@ -336,7 +341,8 @@ class ElvClient {
|
|
|
336
341
|
trustAuthorityId,
|
|
337
342
|
staticToken,
|
|
338
343
|
noCache,
|
|
339
|
-
noAuth
|
|
344
|
+
noAuth,
|
|
345
|
+
assumeV3
|
|
340
346
|
});
|
|
341
347
|
|
|
342
348
|
client.configUrl = configUrl;
|
|
@@ -593,13 +599,12 @@ class ElvClient {
|
|
|
593
599
|
* @param {string=} tenantId - If specified, user will be associated with the tenant
|
|
594
600
|
* @param {Object=} extraData - Additional data to pass to the login API
|
|
595
601
|
*/
|
|
596
|
-
async SetRemoteSigner({idToken, authToken, tenantId,
|
|
602
|
+
async SetRemoteSigner({idToken, authToken, tenantId, extraData}) {
|
|
597
603
|
const signer = new RemoteSigner({
|
|
598
604
|
rpcUris: this.authServiceURIs,
|
|
599
605
|
idToken,
|
|
600
606
|
authToken,
|
|
601
607
|
tenantId,
|
|
602
|
-
address,
|
|
603
608
|
provider: this.ethClient.provider,
|
|
604
609
|
extraData
|
|
605
610
|
});
|
package/src/RemoteSigner.js
CHANGED
|
@@ -8,7 +8,6 @@ class RemoteSigner extends Ethers.Signer {
|
|
|
8
8
|
rpcUris,
|
|
9
9
|
idToken,
|
|
10
10
|
authToken,
|
|
11
|
-
address,
|
|
12
11
|
tenantId,
|
|
13
12
|
provider,
|
|
14
13
|
extraData={}
|
|
@@ -22,8 +21,6 @@ class RemoteSigner extends Ethers.Signer {
|
|
|
22
21
|
this.tenantId = tenantId;
|
|
23
22
|
|
|
24
23
|
this.authToken = authToken;
|
|
25
|
-
this.address = address ? Utils.FormatAddress(address) : undefined;
|
|
26
|
-
this.id = this.address ? `ikms${Utils.AddressToHash(this.address)}` : undefined;
|
|
27
24
|
this.extraLoginData = extraData || {};
|
|
28
25
|
|
|
29
26
|
this.provider = provider;
|
|
@@ -47,6 +44,21 @@ class RemoteSigner extends Ethers.Signer {
|
|
|
47
44
|
this.id = eth;
|
|
48
45
|
}
|
|
49
46
|
|
|
47
|
+
if(!this.address) {
|
|
48
|
+
const keys = await Utils.ResponseToJson(
|
|
49
|
+
this.HttpClient.Request({
|
|
50
|
+
method: "GET",
|
|
51
|
+
path: UrlJoin("as", "wlt", "keys"),
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: `Bearer ${this.authToken}`
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
this.address = Utils.HashToAddress(keys.eth[0]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.id = this.address ? `ikms${Utils.AddressToHash(this.address)}` : undefined;
|
|
50
62
|
this.signer = this.provider.getSigner(this.address);
|
|
51
63
|
}
|
|
52
64
|
|
package/src/UserProfileClient.js
CHANGED
|
@@ -56,6 +56,8 @@ await client.userProfileClient.UserMetadata()
|
|
|
56
56
|
this.client = client;
|
|
57
57
|
this.debug = debug;
|
|
58
58
|
this.userWalletAddresses = {};
|
|
59
|
+
this.walletAddress = undefined;
|
|
60
|
+
this.walletAddressRetrieved = false;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
async CreateWallet() {
|
|
@@ -130,13 +132,17 @@ await client.userProfileClient.UserMetadata()
|
|
|
130
132
|
* @return {Promise<string>} - The contract address of the current user's wallet contract
|
|
131
133
|
*/
|
|
132
134
|
async WalletAddress(autoCreate=true) {
|
|
133
|
-
if(this.walletAddress) { return this.walletAddress; }
|
|
135
|
+
if(this.walletAddress || this.walletAddressRetrieved) { return this.walletAddress; }
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
if(!this.walletAddressPromise) {
|
|
138
|
+
this.walletAddressPromise = this.client.CallContractMethod({
|
|
139
|
+
contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
|
|
140
|
+
methodName: "userWallets",
|
|
141
|
+
methodArgs: [this.client.signer.address]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const walletAddress = await this.walletAddressPromise;
|
|
140
146
|
|
|
141
147
|
if(!Utils.EqualAddress(walletAddress, Utils.nullAddress)) {
|
|
142
148
|
this.walletAddress = walletAddress;
|
|
@@ -146,6 +152,8 @@ await client.userProfileClient.UserMetadata()
|
|
|
146
152
|
await this.CreateWallet();
|
|
147
153
|
}
|
|
148
154
|
|
|
155
|
+
this.walletAddressRetrieved = true;
|
|
156
|
+
|
|
149
157
|
return this.walletAddress;
|
|
150
158
|
}
|
|
151
159
|
|
|
@@ -703,7 +703,8 @@ exports.ProduceMetadataLinks = async function({
|
|
|
703
703
|
versionHash,
|
|
704
704
|
path="/",
|
|
705
705
|
metadata,
|
|
706
|
-
authorizationToken
|
|
706
|
+
authorizationToken,
|
|
707
|
+
noAuth
|
|
707
708
|
}) {
|
|
708
709
|
// Primitive
|
|
709
710
|
if(!metadata || typeof metadata !== "object") { return metadata; }
|
|
@@ -719,7 +720,8 @@ exports.ProduceMetadataLinks = async function({
|
|
|
719
720
|
versionHash,
|
|
720
721
|
path: UrlJoin(path, i.toString()),
|
|
721
722
|
metadata: entry,
|
|
722
|
-
authorizationToken
|
|
723
|
+
authorizationToken,
|
|
724
|
+
noAuth
|
|
723
725
|
})
|
|
724
726
|
);
|
|
725
727
|
}
|
|
@@ -747,7 +749,8 @@ exports.ProduceMetadataLinks = async function({
|
|
|
747
749
|
versionHash,
|
|
748
750
|
path: UrlJoin(path, key),
|
|
749
751
|
metadata: metadata[key],
|
|
750
|
-
authorizationToken
|
|
752
|
+
authorizationToken,
|
|
753
|
+
noAuth
|
|
751
754
|
});
|
|
752
755
|
}
|
|
753
756
|
);
|
|
@@ -760,17 +763,22 @@ exports.MetadataAuth = async function({
|
|
|
760
763
|
objectId,
|
|
761
764
|
versionHash,
|
|
762
765
|
path="/",
|
|
763
|
-
channelAuth=false
|
|
766
|
+
channelAuth=false,
|
|
767
|
+
noAuth=false
|
|
764
768
|
}) {
|
|
765
769
|
ValidateParameters({libraryId, objectId, versionHash});
|
|
766
770
|
|
|
767
771
|
if(versionHash) { objectId = this.utils.DecodeVersionHash(versionHash).objectId; }
|
|
768
772
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
773
|
+
noAuth = this.noAuth || noAuth;
|
|
774
|
+
let isPublic = noAuth;
|
|
775
|
+
let accessType;
|
|
776
|
+
if(!noAuth) {
|
|
777
|
+
const visibility = await this.Visibility({id: objectId});
|
|
778
|
+
accessType = await this.AccessType({id: objectId});
|
|
779
|
+
isPublic = (path || "").replace(/^\/+/, "").startsWith("public");
|
|
780
|
+
noAuth = visibility >= 10 || (isPublic && visibility >= 1);
|
|
781
|
+
}
|
|
774
782
|
|
|
775
783
|
if(this.oauthToken) {
|
|
776
784
|
// Check that KMS is set on this object
|
|
@@ -823,6 +831,7 @@ exports.MetadataAuth = async function({
|
|
|
823
831
|
* - Note: Selection is relative to "metadataSubtree". For example, metadataSubtree="public" and select=["name", "description"] would select "public/name" and "public/description"
|
|
824
832
|
* @param {Array<string>=} remove - Exclude the specified items from the retrieved metadata
|
|
825
833
|
* @param {string=} authorizationToken - Additional authorization token for this request
|
|
834
|
+
* @param {string=} noAuth=false - If specified, the normal authorization flow will be skipped. Useful if you know the metadata you're retrieving is publicly accessible
|
|
826
835
|
* @param {boolean=} resolveLinks=false - If specified, links in the metadata will be resolved
|
|
827
836
|
* @param {boolean=} resolveIncludeSource=false - If specified, resolved links will include the hash of the link at the root of the metadata
|
|
828
837
|
|
|
@@ -857,6 +866,7 @@ exports.ContentObjectMetadata = async function({
|
|
|
857
866
|
select=[],
|
|
858
867
|
remove=[],
|
|
859
868
|
authorizationToken,
|
|
869
|
+
noAuth=false,
|
|
860
870
|
resolveLinks=false,
|
|
861
871
|
resolveIncludeSource=false,
|
|
862
872
|
resolveIgnoreErrors=false,
|
|
@@ -877,7 +887,7 @@ exports.ContentObjectMetadata = async function({
|
|
|
877
887
|
let path = UrlJoin("q", writeToken || versionHash || objectId, "meta", metadataSubtree);
|
|
878
888
|
|
|
879
889
|
// Main authorization
|
|
880
|
-
let defaultAuthToken = await this.MetadataAuth({libraryId, objectId, versionHash, path: metadataSubtree});
|
|
890
|
+
let defaultAuthToken = await this.MetadataAuth({libraryId, objectId, versionHash, path: metadataSubtree, noAuth});
|
|
881
891
|
|
|
882
892
|
// All authorization
|
|
883
893
|
const authTokens = [authorizationToken, queryParams.authorization, defaultAuthToken].flat().filter(token => token);
|
|
@@ -917,7 +927,8 @@ exports.ContentObjectMetadata = async function({
|
|
|
917
927
|
versionHash,
|
|
918
928
|
path: metadataSubtree,
|
|
919
929
|
metadata,
|
|
920
|
-
authorizationToken
|
|
930
|
+
authorizationToken,
|
|
931
|
+
noAuth
|
|
921
932
|
});
|
|
922
933
|
};
|
|
923
934
|
|
|
@@ -944,7 +955,7 @@ exports.ContentObjectMetadata = async function({
|
|
|
944
955
|
* @param {boolean=} produceLinkUrls=false - If specified, file and rep links will automatically be populated with a
|
|
945
956
|
* full URL
|
|
946
957
|
*/
|
|
947
|
-
exports.AssetMetadata = async function({libraryId, objectId, versionHash, metadata, localization, produceLinkUrls=false}) {
|
|
958
|
+
exports.AssetMetadata = async function({libraryId, objectId, versionHash, metadata, localization, noAuth, produceLinkUrls=false}) {
|
|
948
959
|
ValidateParameters({libraryId, objectId, versionHash});
|
|
949
960
|
|
|
950
961
|
if(!objectId) {
|
|
@@ -960,7 +971,8 @@ exports.AssetMetadata = async function({libraryId, objectId, versionHash, metada
|
|
|
960
971
|
resolveLinks: true,
|
|
961
972
|
linkDepthLimit: 2,
|
|
962
973
|
resolveIgnoreErrors: true,
|
|
963
|
-
produceLinkUrls
|
|
974
|
+
produceLinkUrls,
|
|
975
|
+
noAuth
|
|
964
976
|
})) || {};
|
|
965
977
|
} else if(produceLinkUrls) {
|
|
966
978
|
metadata = await this.ProduceMetadataLinks({
|
|
@@ -968,7 +980,8 @@ exports.AssetMetadata = async function({libraryId, objectId, versionHash, metada
|
|
|
968
980
|
objectId,
|
|
969
981
|
versionHash,
|
|
970
982
|
path: UrlJoin("public", "asset_metadata"),
|
|
971
|
-
metadata
|
|
983
|
+
metadata,
|
|
984
|
+
noAuth
|
|
972
985
|
});
|
|
973
986
|
}
|
|
974
987
|
|
|
@@ -2259,9 +2272,7 @@ exports.LinkUrl = async function({
|
|
|
2259
2272
|
}
|
|
2260
2273
|
|
|
2261
2274
|
let authorization = [ authorizationToken ];
|
|
2262
|
-
|
|
2263
|
-
authorization.push(await this.MetadataAuth({libraryId, objectId, versionHash, path: linkPath, channelAuth}));
|
|
2264
|
-
}
|
|
2275
|
+
authorization.push(await this.MetadataAuth({libraryId, objectId, versionHash, path: linkPath, channelAuth, noAuth}));
|
|
2265
2276
|
|
|
2266
2277
|
if(queryParams.authorization) {
|
|
2267
2278
|
authorization.push(queryParams.authorization);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
// Removes HLS playout options from an existing offering of a mezzanine
|
|
4
|
+
|
|
5
|
+
const ScriptOffering = require("./parentClasses/ScriptOffering");
|
|
6
|
+
|
|
7
|
+
class OfferingRemoveDash extends ScriptOffering {
|
|
8
|
+
|
|
9
|
+
async body() {
|
|
10
|
+
const client = await this.client();
|
|
11
|
+
|
|
12
|
+
const libraryId = this.args.libraryId;
|
|
13
|
+
const objectId = this.args.objectId;
|
|
14
|
+
const offeringKey = this.args.offeringKey;
|
|
15
|
+
|
|
16
|
+
let dashFound = false;
|
|
17
|
+
|
|
18
|
+
let metadata = await client.ContentObjectMetadata({
|
|
19
|
+
libraryId,
|
|
20
|
+
objectId
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
this.validateOffering(metadata, offeringKey);
|
|
24
|
+
|
|
25
|
+
// loop through playout formats, delete ones where protocol is Dash
|
|
26
|
+
const playoutFormatKeys = Object.keys(metadata.offerings[offeringKey].playout.playout_formats);
|
|
27
|
+
for(let i = 0; i < playoutFormatKeys.length; i++) {
|
|
28
|
+
const key = playoutFormatKeys[i];
|
|
29
|
+
if(metadata.offerings[offeringKey].playout.playout_formats[key].protocol.type === "ProtoDash") {
|
|
30
|
+
console.log("Found Dash playout format '" + key + "', removing...");
|
|
31
|
+
delete metadata.offerings[offeringKey].playout.playout_formats[key];
|
|
32
|
+
dashFound = true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if(dashFound) {
|
|
37
|
+
await this.metadataWrite(metadata);
|
|
38
|
+
} else {
|
|
39
|
+
console.log("No playout formats found with Dash");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
header() {
|
|
44
|
+
return "Removing playout formats with Dash from mezzanine offering '" + this.args.offeringKey + "'... ";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const script = new OfferingRemoveDash;
|
|
49
|
+
script.run();
|