@nomad-media/full 1.1.13 → 1.1.15
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/nomad-media-sdk-debug.js +111 -189
- package/dist/nomad-media-sdk.min.js +5 -13
- package/package.json +1 -1
|
@@ -1258,6 +1258,11 @@ class NomadMediaSDK {
|
|
|
1258
1258
|
await this._init();
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
1261
|
+
if (this.config.apiType !== "admin")
|
|
1262
|
+
{
|
|
1263
|
+
throw new Error("This function is only available for admin API type.");
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1261
1266
|
_printDatetime(`Creating ${TYPE}: ${TAG_NAME}`);
|
|
1262
1267
|
|
|
1263
1268
|
try
|
|
@@ -3245,8 +3250,7 @@ class NomadMediaSDK {
|
|
|
3245
3250
|
* @throws {Error} - An error is thrown if the input schedule event fails to add.
|
|
3246
3251
|
* @throws {Error} - An error is thrown if the API type is not admin.
|
|
3247
3252
|
*/
|
|
3248
|
-
async updateInputScheduleEvent(ID, CHANNEL_ID, INPUT, BACKUP_INPUT, FIXED_ON_AIR_TIME_UTC
|
|
3249
|
-
PREVIOUS_ID)
|
|
3253
|
+
async updateInputScheduleEvent(ID, CHANNEL_ID, INPUT, BACKUP_INPUT, FIXED_ON_AIR_TIME_UTC)
|
|
3250
3254
|
{
|
|
3251
3255
|
if (this.token === null)
|
|
3252
3256
|
{
|
|
@@ -3264,7 +3268,7 @@ class NomadMediaSDK {
|
|
|
3264
3268
|
{
|
|
3265
3269
|
const ADD_INPUT_SCHEDULE_EVENT_INFO = await _updateInputScheduleEvent(this, this.token,
|
|
3266
3270
|
this.config.serviceApiUrl, ID, CHANNEL_ID, INPUT, BACKUP_INPUT,
|
|
3267
|
-
FIXED_ON_AIR_TIME_UTC,
|
|
3271
|
+
FIXED_ON_AIR_TIME_UTC, this.debugMode);
|
|
3268
3272
|
_printDatetime(`Input schedule event updated`);
|
|
3269
3273
|
return ADD_INPUT_SCHEDULE_EVENT_INFO;
|
|
3270
3274
|
}
|
|
@@ -8058,7 +8062,7 @@ class NomadMediaSDK {
|
|
|
8058
8062
|
try
|
|
8059
8063
|
{
|
|
8060
8064
|
const REMOVE_CONTENT_FROM_CONTENT_GROUP_INFO = await _removeContentsFromContentGroup(
|
|
8061
|
-
this.token, this.config.serviceApiUrl, CONTENT_GROUP_ID, CONTENTS, this.debugMode);
|
|
8065
|
+
this, this.token, this.config.serviceApiUrl, CONTENT_GROUP_ID, CONTENTS, this.debugMode);
|
|
8062
8066
|
_printDatetime(`Content removed from content group: ${CONTENT_GROUP_ID}`);
|
|
8063
8067
|
return REMOVE_CONTENT_FROM_CONTENT_GROUP_INFO;
|
|
8064
8068
|
}
|
|
@@ -8178,7 +8182,7 @@ class NomadMediaSDK {
|
|
|
8178
8182
|
try
|
|
8179
8183
|
{
|
|
8180
8184
|
const STOP_SHARING_CONTENT_GROUP_WITH_USERS_INFO = await _stopSharingContentGroupWithUsers(
|
|
8181
|
-
this.token, this.config.serviceApiUrl, CONTENT_GROUP_ID, USER_IDS, this.debugMode);
|
|
8185
|
+
this, this.token, this.config.serviceApiUrl, CONTENT_GROUP_ID, USER_IDS, this.debugMode);
|
|
8182
8186
|
_printDatetime(`Content group stopped sharing with users: ${CONTENT_GROUP_ID}`);
|
|
8183
8187
|
return STOP_SHARING_CONTENT_GROUP_WITH_USERS_INFO;
|
|
8184
8188
|
}
|
|
@@ -8796,7 +8800,7 @@ class NomadMediaSDK {
|
|
|
8796
8800
|
|
|
8797
8801
|
try
|
|
8798
8802
|
{
|
|
8799
|
-
const CREATE_MEDIA_BUILDER_ITEM_INFO = await _createMediaBuilderItemsAddAnnotations(
|
|
8803
|
+
const CREATE_MEDIA_BUILDER_ITEM_INFO = await _createMediaBuilderItemsAddAnnotations(this,
|
|
8800
8804
|
this.token, this.config.serviceApiUrl, MEDIA_BUILDER_ID, SOURCE_ASSET_ID,
|
|
8801
8805
|
this.debugMode);
|
|
8802
8806
|
|
|
@@ -9217,7 +9221,7 @@ class NomadMediaSDK {
|
|
|
9217
9221
|
* @throws {Error} - An error is thrown if the API type is not portal.
|
|
9218
9222
|
*/
|
|
9219
9223
|
async updateMediaBuilder(MEDIA_BUILDER_ID, NAME, DESTINATION_FOLDER_ID, COLLECTIONS,
|
|
9220
|
-
RELATED_CONTENTS, PROPERTIES)
|
|
9224
|
+
RELATED_CONTENTS, TAGS, PROPERTIES)
|
|
9221
9225
|
{
|
|
9222
9226
|
if (this.token === null)
|
|
9223
9227
|
{
|
|
@@ -9235,7 +9239,7 @@ class NomadMediaSDK {
|
|
|
9235
9239
|
{
|
|
9236
9240
|
const UPDATE_MEDIA_BUILDER_INFO = await _updateMediaBuilder(this, this.token,
|
|
9237
9241
|
this.config.serviceApiUrl, MEDIA_BUILDER_ID, NAME, DESTINATION_FOLDER_ID, COLLECTIONS,
|
|
9238
|
-
RELATED_CONTENTS, PROPERTIES, this.debugMode);
|
|
9242
|
+
RELATED_CONTENTS, TAGS, PROPERTIES, this.debugMode);
|
|
9239
9243
|
_printDatetime(`Media builder updated: ${MEDIA_BUILDER_ID}`);
|
|
9240
9244
|
return UPDATE_MEDIA_BUILDER_INFO;
|
|
9241
9245
|
}
|
|
@@ -9982,17 +9986,11 @@ async function _startRelatedAssetUpload(instance, AUTH_TOKEN, URL, EXISTING_ASSE
|
|
|
9982
9986
|
{
|
|
9983
9987
|
const API_URL = `${URL}/api/asset/upload/start-related-asset`;
|
|
9984
9988
|
|
|
9985
|
-
const
|
|
9986
|
-
let chunkSize = FILE.size / 10000;
|
|
9987
|
-
|
|
9988
|
-
if (chunkSize < (AWS_MIN_LIMIT * 4))
|
|
9989
|
-
{
|
|
9990
|
-
chunkSize = 20971520;
|
|
9991
|
-
}
|
|
9989
|
+
const CHUNK_SIZE = 8388608;
|
|
9992
9990
|
|
|
9993
9991
|
const BODY = {
|
|
9992
|
+
chunkSize: CHUNK_SIZE,
|
|
9994
9993
|
contentLength: FILE.size,
|
|
9995
|
-
chunkSize: chunkSize,
|
|
9996
9994
|
existingAssetId: EXISTING_ASSET_ID,
|
|
9997
9995
|
languageId: LANGUAGE_ID,
|
|
9998
9996
|
newRelatedAssetMetadataType: NEW_RELATED_ASSET_METADATA_TYPE,
|
|
@@ -10001,7 +9999,7 @@ async function _startRelatedAssetUpload(instance, AUTH_TOKEN, URL, EXISTING_ASSE
|
|
|
10001
9999
|
uploadOverwriteOption: UPLOAD_OVERWRITE_OPTION,
|
|
10002
10000
|
};
|
|
10003
10001
|
|
|
10004
|
-
await _sendRequest(instance, AUTH_TOKEN, "Start related asset upload", API_URL, "POST", null, BODY, DEBUG_MODE);
|
|
10002
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Start related asset upload", API_URL, "POST", null, BODY, DEBUG_MODE);
|
|
10005
10003
|
|
|
10006
10004
|
}
|
|
10007
10005
|
|
|
@@ -10379,7 +10377,7 @@ async function _updateContent(instance, AUTH_TOKEN, URL, CONTENT_ID, CONTENT_DEF
|
|
|
10379
10377
|
}
|
|
10380
10378
|
}
|
|
10381
10379
|
|
|
10382
|
-
return await _sendRequest(instance, AUTH_TOKEN, "Update Content", API_URL, "PUT",
|
|
10380
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Update Content", API_URL, "PUT", null, body, DEBUG_MODE);
|
|
10383
10381
|
}
|
|
10384
10382
|
|
|
10385
10383
|
function _updateProperties(body, properties) {
|
|
@@ -10448,7 +10446,8 @@ async function _createAndUpdateEvent(instance, AUTH_TOKEN, URL, CONTENT_ID,
|
|
|
10448
10446
|
{
|
|
10449
10447
|
const GET_API_URL = `${URL}/api/content/new?contentDefinitionId=${CONTENT_DEFINITION_ID}`;
|
|
10450
10448
|
|
|
10451
|
-
|
|
10449
|
+
const INFO = await _sendRequest(instance, AUTH_TOKEN, "Get Content ID", GET_API_URL, "GET", null, null, DEBUG_MODE);
|
|
10450
|
+
CONTENT_ID = INFO.contentId;
|
|
10452
10451
|
}
|
|
10453
10452
|
|
|
10454
10453
|
const API_URL = `${URL}/api/content/${CONTENT_ID}`;
|
|
@@ -10562,7 +10561,6 @@ async function _clipLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, START_TIM
|
|
|
10562
10561
|
|
|
10563
10562
|
|
|
10564
10563
|
|
|
10565
|
-
|
|
10566
10564
|
async function _createLiveChannel(instance, AUTH_TOKEN, URL, NAME, THUMBNAIL_IMAGE_ID, ARCHIVE_FOLDER_ASSET_ID,
|
|
10567
10565
|
ENABLE_HIGH_AVAILABILITY, ENABLE_LIVE_CLIPPING, IS_SECURE_OUTPUT, IS_OUTPUT_SCREENSHOTS,
|
|
10568
10566
|
TYPE, EXTERNAL_URL, EXTERNAL_OUTPUT_PROFILES, SECURITY_GROUPS, DEBUG_MODE)
|
|
@@ -10603,7 +10601,7 @@ async function _createLiveChannel(instance, AUTH_TOKEN, URL, NAME, THUMBNAIL_IMA
|
|
|
10603
10601
|
if (SECURITY_GROUPS) {
|
|
10604
10602
|
const NOMAD_SECURITY_GROUPS = await _getSecurityGroups(instance, AUTH_TOKEN, URL, DEBUG_MODE);
|
|
10605
10603
|
|
|
10606
|
-
BODY.securityGroups = NOMAD_SECURITY_GROUPS
|
|
10604
|
+
BODY.securityGroups = NOMAD_SECURITY_GROUPS.items
|
|
10607
10605
|
.filter(group => SECURITY_GROUPS.includes(group.description))
|
|
10608
10606
|
.map(group => ({
|
|
10609
10607
|
description: group.description,
|
|
@@ -10632,7 +10630,7 @@ async function _deleteLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, DELETE_
|
|
|
10632
10630
|
{
|
|
10633
10631
|
console.log(`Getting Live Channel Inputs IDs...`);
|
|
10634
10632
|
}
|
|
10635
|
-
INPUT_IDS = await _getLiveChannelInputsIds(AUTH_TOKEN, CHANNEL_ID);
|
|
10633
|
+
INPUT_IDS = await _getLiveChannelInputsIds(instance, AUTH_TOKEN, CHANNEL_ID);
|
|
10636
10634
|
}
|
|
10637
10635
|
else
|
|
10638
10636
|
{
|
|
@@ -10649,7 +10647,7 @@ async function _deleteLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, DELETE_
|
|
|
10649
10647
|
for (let index = 0; index < INPUT_IDS.length; index++)
|
|
10650
10648
|
{
|
|
10651
10649
|
// Delete Live Input
|
|
10652
|
-
await _deleteLiveInput(AUTH_TOKEN, INPUT_IDS[index]);
|
|
10650
|
+
await _deleteLiveInput(instance, AUTH_TOKEN, INPUT_IDS[index]);
|
|
10653
10651
|
}
|
|
10654
10652
|
}
|
|
10655
10653
|
|
|
@@ -10696,31 +10694,7 @@ async function _getLiveChannelScheduleEvents(instance, AUTH_TOKEN, URL, CHANNEL_
|
|
|
10696
10694
|
{
|
|
10697
10695
|
const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/liveScheduleEvent`
|
|
10698
10696
|
|
|
10699
|
-
|
|
10700
|
-
const HEADERS = new Headers();
|
|
10701
|
-
HEADERS.append("Content-Type", "application/json");
|
|
10702
|
-
HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
|
|
10703
|
-
|
|
10704
|
-
if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: GET`);
|
|
10705
|
-
|
|
10706
|
-
try
|
|
10707
|
-
{
|
|
10708
|
-
const RESPONSE = await fetch(API_URL, {
|
|
10709
|
-
method: "GET",
|
|
10710
|
-
headers: HEADERS
|
|
10711
|
-
});
|
|
10712
|
-
|
|
10713
|
-
// Check for success
|
|
10714
|
-
if (!RESPONSE.ok) {
|
|
10715
|
-
throw await RESPONSE.json()
|
|
10716
|
-
}
|
|
10717
|
-
|
|
10718
|
-
return await RESPONSE.json();
|
|
10719
|
-
}
|
|
10720
|
-
catch (error)
|
|
10721
|
-
{
|
|
10722
|
-
_apiExceptionHandler(error, "Get Live Channel Schedule Events Failed");
|
|
10723
|
-
}
|
|
10697
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Get Live Channel Schedule Events", API_URL, "GET", null, null, DEBUG_MODE);
|
|
10724
10698
|
}
|
|
10725
10699
|
|
|
10726
10700
|
|
|
@@ -10866,10 +10840,10 @@ async function _startLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, WAIT_FOR
|
|
|
10866
10840
|
{
|
|
10867
10841
|
const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/start`
|
|
10868
10842
|
|
|
10869
|
-
|
|
10870
|
-
await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, CHANNEL_ID, _LIVE_CHANNEL_STATUSES.Running, 1200, 20), DEBUG_MODE;
|
|
10843
|
+
await _sendRequest(instance, AUTH_TOKEN, "Start Live Channel", API_URL, "POST", null, null, DEBUG_MODE);
|
|
10871
10844
|
|
|
10872
|
-
|
|
10845
|
+
if (!WAIT_FOR_START) return;
|
|
10846
|
+
await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, CHANNEL_ID, _LIVE_CHANNEL_STATUSES.Running, 1200, 20, DEBUG_MODE);
|
|
10873
10847
|
}
|
|
10874
10848
|
|
|
10875
10849
|
|
|
@@ -10879,28 +10853,7 @@ async function _startOutputTracking(instance, AUTH_TOKEN, URL, CHANNEL_ID, DEBUG
|
|
|
10879
10853
|
{
|
|
10880
10854
|
const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/startOutputTracking`;
|
|
10881
10855
|
|
|
10882
|
-
|
|
10883
|
-
const HEADERS = new Headers();
|
|
10884
|
-
HEADERS.append("Content-Type", "application/json");
|
|
10885
|
-
HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
|
|
10886
|
-
|
|
10887
|
-
if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: POST`);
|
|
10888
|
-
|
|
10889
|
-
try
|
|
10890
|
-
{
|
|
10891
|
-
const RESPONSE = await fetch(`${API_URL}`, {
|
|
10892
|
-
method: "POST",
|
|
10893
|
-
headers: HEADERS
|
|
10894
|
-
});
|
|
10895
|
-
|
|
10896
|
-
if (!RESPONSE.ok) {
|
|
10897
|
-
throw await RESPONSE.json()
|
|
10898
|
-
}
|
|
10899
|
-
}
|
|
10900
|
-
catch (error)
|
|
10901
|
-
{
|
|
10902
|
-
_apiExceptionHandler(error, "Start Output Tracking Failed");
|
|
10903
|
-
}
|
|
10856
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Start Output Tracking", API_URL, "POST", null, null, DEBUG_MODE);
|
|
10904
10857
|
}
|
|
10905
10858
|
|
|
10906
10859
|
|
|
@@ -10912,30 +10865,10 @@ async function _stopLiveChannel(instance, AUTH_TOKEN, URL, CHANNEL_ID, WAIT_FOR_
|
|
|
10912
10865
|
{
|
|
10913
10866
|
const API_URL = `${URL}/api/liveChannel/${CHANNEL_ID}/stop`
|
|
10914
10867
|
|
|
10915
|
-
|
|
10916
|
-
const HEADERS = new Headers();
|
|
10917
|
-
HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
|
|
10918
|
-
|
|
10919
|
-
if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: POST`);
|
|
10920
|
-
|
|
10921
|
-
try
|
|
10922
|
-
{
|
|
10923
|
-
const RESPONSE = await fetch(API_URL, {
|
|
10924
|
-
method: "POST",
|
|
10925
|
-
headers: HEADERS
|
|
10926
|
-
});
|
|
10927
|
-
|
|
10928
|
-
if (!RESPONSE.ok) {
|
|
10929
|
-
throw await RESPONSE.json()
|
|
10930
|
-
}
|
|
10868
|
+
await _sendRequest(instance, AUTH_TOKEN, "Stop Live Channel", API_URL, "POST", null, null, DEBUG_MODE);
|
|
10931
10869
|
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
}
|
|
10935
|
-
catch (error)
|
|
10936
|
-
{
|
|
10937
|
-
_apiExceptionHandler(error, "Stop Live Channel Failed");
|
|
10938
|
-
}
|
|
10870
|
+
if (!WAIT_FOR_STOP) return;
|
|
10871
|
+
await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, CHANNEL_ID, _LIVE_CHANNEL_STATUSES.Idle, 1200, 20, DEBUG_MODE);
|
|
10939
10872
|
}
|
|
10940
10873
|
|
|
10941
10874
|
|
|
@@ -11001,30 +10934,11 @@ async function _updateLiveChannel(instance, AUTH_TOKEN, URL, ID, NAME, THUMBNAIL
|
|
|
11001
10934
|
if (FILTERED_SECURITY_GROUPS !== BODY.securityGroups) BODY.securityGroups = FILTERED_SECURITY_GROUPS;
|
|
11002
10935
|
}
|
|
11003
10936
|
|
|
11004
|
-
|
|
10937
|
+
const INFO = await _sendRequest(instance, AUTH_TOKEN, "Update Live Channel", API_URL, "PUT", HEADERS, BODY, DEBUG_MODE);
|
|
11005
10938
|
|
|
11006
|
-
|
|
11007
|
-
{
|
|
11008
|
-
const RESPONSE = await fetch(API_URL, {
|
|
11009
|
-
method: "PUT",
|
|
11010
|
-
headers: HEADERS,
|
|
11011
|
-
body: JSON.stringify(BODY)
|
|
11012
|
-
});
|
|
10939
|
+
await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, INFO.id, _LIVE_CHANNEL_STATUSES.Idle, 120, 2, DEBUG_MODE);
|
|
11013
10940
|
|
|
11014
|
-
|
|
11015
|
-
throw await RESPONSE.json()
|
|
11016
|
-
}
|
|
11017
|
-
|
|
11018
|
-
const INFO = await RESPONSE.json();
|
|
11019
|
-
|
|
11020
|
-
await _waitForLiveChannelStatus(instance, AUTH_TOKEN, URL, INFO.id, _LIVE_CHANNEL_STATUSES.Idle, 120, 2, DEBUG_MODE);
|
|
11021
|
-
|
|
11022
|
-
return INFO;
|
|
11023
|
-
}
|
|
11024
|
-
catch (error)
|
|
11025
|
-
{
|
|
11026
|
-
_apiExceptionHandler(error, "Updating Live Channel Failed");
|
|
11027
|
-
}
|
|
10941
|
+
return INFO;
|
|
11028
10942
|
}
|
|
11029
10943
|
|
|
11030
10944
|
|
|
@@ -11313,7 +11227,7 @@ async function _waitForLiveInputStatus(instance, AUTH_TOKEN, URL, INPUT_ID, STAT
|
|
|
11313
11227
|
// Check for Error status
|
|
11314
11228
|
if (INPUT_STATUS === "Error") {
|
|
11315
11229
|
// Get the error message
|
|
11316
|
-
const INPUT_STATUS_MESSAGE = await _getLiveInputStatusMessage(AUTH_TOKEN, INPUT_ID,
|
|
11230
|
+
const INPUT_STATUS_MESSAGE = await _getLiveInputStatusMessage(instance, AUTH_TOKEN, INPUT_ID,
|
|
11317
11231
|
DEBUG_MODE);
|
|
11318
11232
|
|
|
11319
11233
|
// Can't continue if Live Input is in error status
|
|
@@ -11600,29 +11514,7 @@ async function _updateLiveOutputProfileGroup(instance, AUTH_TOKEN, URL, LIVE_OUT
|
|
|
11600
11514
|
outputProfiles: LIVE_OUTPUT_PROFILES || PROFILE_GROUP_INFO.outputProfiles
|
|
11601
11515
|
};
|
|
11602
11516
|
|
|
11603
|
-
|
|
11604
|
-
{
|
|
11605
|
-
console.log(`API_URL: ${API_URL}\nMETHOD: PUT\nBODY: ${JSON.stringify(BODY, null, 4)}`);
|
|
11606
|
-
}
|
|
11607
|
-
|
|
11608
|
-
try
|
|
11609
|
-
{
|
|
11610
|
-
const RESPONSE = await fetch(API_URL, {
|
|
11611
|
-
method: "PUT",
|
|
11612
|
-
headers: HEADERS,
|
|
11613
|
-
body: JSON.stringify(BODY)
|
|
11614
|
-
});
|
|
11615
|
-
|
|
11616
|
-
if (!RESPONSE.ok) {
|
|
11617
|
-
throw new Error();
|
|
11618
|
-
}
|
|
11619
|
-
|
|
11620
|
-
return await RESPONSE.json();
|
|
11621
|
-
}
|
|
11622
|
-
catch (error)
|
|
11623
|
-
{
|
|
11624
|
-
_apiExceptionHandler(error, "Update Live Output Profile Group Failed");
|
|
11625
|
-
}
|
|
11517
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Update Live Output Profile Group", API_URL, "PUT", HEADERS, BODY, DEBUG_MODE);
|
|
11626
11518
|
}
|
|
11627
11519
|
|
|
11628
11520
|
|
|
@@ -11663,28 +11555,7 @@ async function _deleteLiveOutputProfile(instance, AUTH_TOKEN, URL, OUTPUT_ID, DE
|
|
|
11663
11555
|
{
|
|
11664
11556
|
const API_URL = `${URL}/api/liveOutputProfile/${OUTPUT_ID}`;
|
|
11665
11557
|
|
|
11666
|
-
|
|
11667
|
-
const HEADERS = new Headers();
|
|
11668
|
-
HEADERS.append("Content-Type", "application/json");
|
|
11669
|
-
HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
|
|
11670
|
-
|
|
11671
|
-
if (DEBUG_MODE) console.log(`URL: ${API_URL}\nMETHOD: DELETE`);
|
|
11672
|
-
|
|
11673
|
-
try
|
|
11674
|
-
{
|
|
11675
|
-
const RESPONSE = await fetch(API_URL, {
|
|
11676
|
-
method: "DELETE",
|
|
11677
|
-
headers: HEADERS
|
|
11678
|
-
});
|
|
11679
|
-
|
|
11680
|
-
if (!RESPONSE.ok) {
|
|
11681
|
-
throw await RESPONSE.json()
|
|
11682
|
-
}
|
|
11683
|
-
}
|
|
11684
|
-
catch (error)
|
|
11685
|
-
{
|
|
11686
|
-
_apiExceptionHandler(error, "Delete Live Output Profile Failed");
|
|
11687
|
-
}
|
|
11558
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Delete Live Output Profile", API_URL, "DELETE", null, null, DEBUG_MODE);
|
|
11688
11559
|
}
|
|
11689
11560
|
|
|
11690
11561
|
|
|
@@ -11729,7 +11600,7 @@ async function _updateLiveOutputProfile(instance, AUTH_TOKEN, URL, ID, NAME, OUT
|
|
|
11729
11600
|
{
|
|
11730
11601
|
const API_URL = `${URL}/api/liveOutputProfile/${ID}`;
|
|
11731
11602
|
|
|
11732
|
-
const PROFILE_INFO = await _getLiveOutputProfile(AUTH_TOKEN, URL, ID, DEBUG_MODE);
|
|
11603
|
+
const PROFILE_INFO = await _getLiveOutputProfile(instance, AUTH_TOKEN, URL, ID, DEBUG_MODE);
|
|
11733
11604
|
|
|
11734
11605
|
const BODY = {
|
|
11735
11606
|
name: NAME || PROFILE_INFO.name,
|
|
@@ -11918,8 +11789,33 @@ async function _updateInputScheduleEvent(instance, AUTH_TOKEN, URL, ID, CHANNEL_
|
|
|
11918
11789
|
BODY.id = ID && ID !== SCHEDULE_EVENT_INFO.id ? ID : SCHEDULE_EVENT_INFO.id;
|
|
11919
11790
|
BODY.channelId = CHANNEL_ID && CHANNEL_ID !== SCHEDULE_EVENT_INFO.channelId ? CHANNEL_ID : SCHEDULE_EVENT_INFO.channelId;
|
|
11920
11791
|
BODY.fixedOnAirTimeUtc = FIXED_ON_AIR_TIME_UTC && FIXED_ON_AIR_TIME_UTC !== SCHEDULE_EVENT_INFO.fixedOnAirTimeUtc ? FIXED_ON_AIR_TIME_UTC : SCHEDULE_EVENT_INFO.fixedOnAirTimeUtc;
|
|
11921
|
-
|
|
11922
|
-
|
|
11792
|
+
|
|
11793
|
+
if (INPUT && INPUT !== SCHEDULE_EVENT_INFO.liveInput)
|
|
11794
|
+
{
|
|
11795
|
+
BODY.liveInput = {
|
|
11796
|
+
id: INPUT.id,
|
|
11797
|
+
description: INPUT.name
|
|
11798
|
+
};
|
|
11799
|
+
}
|
|
11800
|
+
else
|
|
11801
|
+
{
|
|
11802
|
+
BODY.liveInput = {
|
|
11803
|
+
id: SCHEDULE_EVENT_INFO.liveInput.id,
|
|
11804
|
+
description: SCHEDULE_EVENT_INFO.liveInput.name
|
|
11805
|
+
};
|
|
11806
|
+
}
|
|
11807
|
+
|
|
11808
|
+
if (BACKUP_INPUT && BACKUP_INPUT !== SCHEDULE_EVENT_INFO.liveInput2) {
|
|
11809
|
+
BODY.liveInput2 = {
|
|
11810
|
+
id: BACKUP_INPUT.id,
|
|
11811
|
+
description: BACKUP_INPUT.name
|
|
11812
|
+
};
|
|
11813
|
+
} else if (SCHEDULE_EVENT_INFO.liveInput2) {
|
|
11814
|
+
BODY.liveInput2 = {
|
|
11815
|
+
id: SCHEDULE_EVENT_INFO.liveInput2.id,
|
|
11816
|
+
description: SCHEDULE_EVENT_INFO.liveInput2.name
|
|
11817
|
+
};
|
|
11818
|
+
}
|
|
11923
11819
|
|
|
11924
11820
|
return await _sendRequest(instance, AUTH_TOKEN, "Updating Input Schedule Event", API_URL, "PUT", null, BODY, DEBUG_MODE);
|
|
11925
11821
|
}
|
|
@@ -12339,7 +12235,7 @@ async function _updateIntelligentSchedule(instance, AUTH_TOKEN, URL, SCHEDULE_ID
|
|
|
12339
12235
|
{
|
|
12340
12236
|
const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}`;
|
|
12341
12237
|
|
|
12342
|
-
const INTELLIGENT_SCHEDULE_INFO = await _getIntelligentSchedule(AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
|
|
12238
|
+
const INTELLIGENT_SCHEDULE_INFO = await _getIntelligentSchedule(instance, AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
|
|
12343
12239
|
|
|
12344
12240
|
const BODY = {
|
|
12345
12241
|
defaultVideoAsset: DEFAULT_VIDEO_ASSET || INTELLIGENT_SCHEDULE_INFO.defaultVideoAsset,
|
|
@@ -12376,7 +12272,7 @@ async function _updatePlaylist(instance, AUTH_TOKEN, URL, SCHEDULE_ID, DEFAULT_V
|
|
|
12376
12272
|
{
|
|
12377
12273
|
const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}`;
|
|
12378
12274
|
|
|
12379
|
-
const PLAYLIST_INFO = await _getPlaylist(AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
|
|
12275
|
+
const PLAYLIST_INFO = await _getPlaylist(instance, AUTH_TOKEN, URL, SCHEDULE_ID, DEBUG_MODE);
|
|
12380
12276
|
|
|
12381
12277
|
const BODY = {
|
|
12382
12278
|
defaultVideoAsset: DEFAULT_VIDEO_ASSET || PLAYLIST_INFO.defaultVideoAsset,
|
|
@@ -12399,7 +12295,7 @@ async function _updateScheduleItemAsset(instance, AUTH_TOKEN, URL, SCHEDULE_ID,
|
|
|
12399
12295
|
{
|
|
12400
12296
|
const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
|
|
12401
12297
|
|
|
12402
|
-
const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12298
|
+
const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12403
12299
|
|
|
12404
12300
|
const BODY = {
|
|
12405
12301
|
asset: ASSET || ITEM_INFO.asset,
|
|
@@ -12424,7 +12320,7 @@ async function _updateScheduleItemLiveChannel(instance, AUTH_TOKEN, URL, SCHEDUL
|
|
|
12424
12320
|
{
|
|
12425
12321
|
const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
|
|
12426
12322
|
|
|
12427
|
-
const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12323
|
+
const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12428
12324
|
|
|
12429
12325
|
const BODY = {
|
|
12430
12326
|
days: DAYS || ITEM_INFO.days,
|
|
@@ -12449,7 +12345,7 @@ async function _updateScheduleItemPlaylistSchedule(instance, AUTH_TOKEN, URL, SC
|
|
|
12449
12345
|
{
|
|
12450
12346
|
const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
|
|
12451
12347
|
|
|
12452
|
-
const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12348
|
+
const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12453
12349
|
|
|
12454
12350
|
const BODY = {
|
|
12455
12351
|
days: DAYS || ITEM_INFO.days,
|
|
@@ -12476,7 +12372,7 @@ async function _updateScheduleItemSearchFilter(instance, AUTH_TOKEN, URL, SCHEDU
|
|
|
12476
12372
|
{
|
|
12477
12373
|
const API_URL = `${URL}/api/admin/schedule/${SCHEDULE_ID}/item/${ITEM_ID}`;
|
|
12478
12374
|
|
|
12479
|
-
const ITEM_INFO = await _getScheduleItem(AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12375
|
+
const ITEM_INFO = await _getScheduleItem(instance, AUTH_TOKEN, URL, SCHEDULE_ID, ITEM_ID, DEBUG_MODE);
|
|
12480
12376
|
|
|
12481
12377
|
const BODY = {
|
|
12482
12378
|
collections: COLLECTIONS || ITEM_INFO.collections,
|
|
@@ -12745,14 +12641,27 @@ async function _login(instance, USERNAME, PASSWORD, URL, DEBUG_MODE)
|
|
|
12745
12641
|
"password": PASSWORD
|
|
12746
12642
|
};
|
|
12747
12643
|
|
|
12748
|
-
|
|
12644
|
+
try
|
|
12645
|
+
{
|
|
12646
|
+
return await _sendRequest(instance, null, "Login", API_URL, "POST", null, BODY, DEBUG_MODE);
|
|
12647
|
+
}
|
|
12648
|
+
catch (error)
|
|
12649
|
+
{
|
|
12650
|
+
if (error.message.includes("409"))
|
|
12651
|
+
{
|
|
12652
|
+
throw new Error("Invalid username or password");
|
|
12653
|
+
}
|
|
12654
|
+
else
|
|
12655
|
+
{
|
|
12656
|
+
throw error;
|
|
12657
|
+
}
|
|
12658
|
+
}
|
|
12749
12659
|
}
|
|
12750
12660
|
|
|
12751
12661
|
|
|
12752
12662
|
|
|
12753
12663
|
|
|
12754
12664
|
|
|
12755
|
-
|
|
12756
12665
|
async function _logout(instance, AUTH_TOKEN, URL, DEBUG_MODE)
|
|
12757
12666
|
{
|
|
12758
12667
|
const API_URL = `${URL}/api/account/logout`;
|
|
@@ -12774,7 +12683,7 @@ async function _refreshToken(instance, AUTH_TOKEN, URL, REFRESH_TOKEN, DEBUG_MOD
|
|
|
12774
12683
|
};
|
|
12775
12684
|
|
|
12776
12685
|
const TOKEN_INFO = await _sendRequest(instance, AUTH_TOKEN, "Refreshing Token", API_URL, "POST", null, BODY, DEBUG_MODE);
|
|
12777
|
-
|
|
12686
|
+
return TOKEN_INFO;
|
|
12778
12687
|
}
|
|
12779
12688
|
|
|
12780
12689
|
|
|
@@ -13007,7 +12916,7 @@ async function _downloadArchiveAsset(instance, AUTH_TOKEN, URL, API_TYPE, ASSET_
|
|
|
13007
12916
|
BODY.downloadProxy = DOWNLOAD_PROXY;
|
|
13008
12917
|
}
|
|
13009
12918
|
|
|
13010
|
-
return await _sendRequest(AUTH_TOKEN, "Asset Download Archive", API_URL, "POST", null, BODY, DEBUG_MODE);
|
|
12919
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Asset Download Archive", API_URL, "POST", null, BODY, DEBUG_MODE);
|
|
13011
12920
|
}
|
|
13012
12921
|
|
|
13013
12922
|
|
|
@@ -13069,7 +12978,7 @@ async function _getAssetDetails(instance, AUTH_TOKEN, URL, ASSET_ID, API_TYPE, D
|
|
|
13069
12978
|
? `${URL}/api/admin/asset/${ASSET_ID}/detail`
|
|
13070
12979
|
: `${URL}/api/asset/${ASSET_ID}/detail`;
|
|
13071
12980
|
|
|
13072
|
-
return await _sendRequest(AUTH_TOKEN, "Get Asset Details", API_URL, "GET", null, null, DEBUG_MODE);
|
|
12981
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Get Asset Details", API_URL, "GET", null, null, DEBUG_MODE);
|
|
13073
12982
|
}
|
|
13074
12983
|
|
|
13075
12984
|
|
|
@@ -13377,12 +13286,13 @@ async function _updateAnnotation(instance, AUTH_TOKEN, URL, ASSET_ID, ANNOTATION
|
|
|
13377
13286
|
|
|
13378
13287
|
|
|
13379
13288
|
|
|
13289
|
+
|
|
13380
13290
|
async function _updateAssetAdBreak(instance, AUTH_TOKEN, URL, ASSET_ID, AD_BREAK_ID, TIME_CODE, TAGS,
|
|
13381
13291
|
LABELS, DEBUG_MODE)
|
|
13382
13292
|
{
|
|
13383
13293
|
const API_URL = `${URL}/api/admin/asset/${ASSET_ID}/adbreak/${AD_BREAK_ID}`;
|
|
13384
13294
|
|
|
13385
|
-
const ASSET_AD_BREAKS = _getAssetAdBreaks(instance, AUTH_TOKEN, URL, ASSET_ID, DEBUG_MODE);
|
|
13295
|
+
const ASSET_AD_BREAKS = await _getAssetAdBreaks(instance, AUTH_TOKEN, URL, ASSET_ID, DEBUG_MODE);
|
|
13386
13296
|
const AD_BREAK_INFO = ASSET_AD_BREAKS.find(adBreak => adBreak.id === AD_BREAK_ID);
|
|
13387
13297
|
|
|
13388
13298
|
const BODY = {
|
|
@@ -13500,7 +13410,7 @@ async function _bulkUpdateMetadata(instance, AUTH_TOKEN, URL, CONTENT_IDS, COLLE
|
|
|
13500
13410
|
{
|
|
13501
13411
|
const API_URL = `${URL}/api/admin/content/bulk-metadata-update`;
|
|
13502
13412
|
|
|
13503
|
-
const ASSET_DETAILS = await _getAssetDetails(AUTH_TOKEN, URL, CONTENT_IDS[0], "admin", DEBUG_MODE);
|
|
13413
|
+
const ASSET_DETAILS = await _getAssetDetails(this, AUTH_TOKEN, URL, CONTENT_IDS[0], "admin", DEBUG_MODE);
|
|
13504
13414
|
|
|
13505
13415
|
const BODY = {
|
|
13506
13416
|
collections: [
|
|
@@ -13564,7 +13474,7 @@ async function _deleteTagOrCollection(instance, AUTH_TOKEN, URL, TYPE, TAG_ID, D
|
|
|
13564
13474
|
{
|
|
13565
13475
|
const API_URL = `${URL}/api/admin/${TYPE}/${TAG_ID}`;
|
|
13566
13476
|
|
|
13567
|
-
return await _sendRequest(instance, AUTH_TOKEN, "Delete Tag or Collection", API_URL, "
|
|
13477
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Delete Tag or Collection", API_URL, "DELETE", null, null, DEBUG_MODE);
|
|
13568
13478
|
}
|
|
13569
13479
|
|
|
13570
13480
|
|
|
@@ -13747,7 +13657,7 @@ async function _sendRequest(instance, AUTH_TOKEN, FUNCTION_NAME, URL, METHOD_TYP
|
|
|
13747
13657
|
|
|
13748
13658
|
if (AUTH_TOKEN) HEADERS["Authorization"] = `Bearer ${AUTH_TOKEN}`;
|
|
13749
13659
|
|
|
13750
|
-
if (DEBUG) console.log(`URL: ${URL}\nMETHOD: ${METHOD_TYPE}` + (PARAMS ? `\nPARAMS: ${JSON.stringify(PARAMS, null, 4)}` : "") + (BODY ? `\nBODY: ${JSON.stringify(BODY, null, 4)}` : ""));
|
|
13660
|
+
if (DEBUG) console.log(`URL: ${URL}\nMETHOD: ${METHOD_TYPE}` + (PARAMS && PARAMS.size === 0 ? `\nPARAMS: ${JSON.stringify(PARAMS, null, 4)}` : "") + (BODY ? `\nBODY: ${JSON.stringify(BODY, null, 4)}` : ""));
|
|
13751
13661
|
|
|
13752
13662
|
let retries = 0;
|
|
13753
13663
|
let RESPONSE = null;
|
|
@@ -13784,12 +13694,11 @@ async function _sendRequest(instance, AUTH_TOKEN, FUNCTION_NAME, URL, METHOD_TYP
|
|
|
13784
13694
|
if (error.code === 'ECONNABORTED' && retries < MAX_RETRIES)
|
|
13785
13695
|
{
|
|
13786
13696
|
retries++;
|
|
13787
|
-
await _sleep(SLEEP_TIME
|
|
13697
|
+
await _sleep(SLEEP_TIME);
|
|
13788
13698
|
}
|
|
13789
13699
|
else
|
|
13790
13700
|
{
|
|
13791
|
-
|
|
13792
|
-
_apiExceptionHandler(error, FUNCTION_NAME);
|
|
13701
|
+
_apiExceptionHandler(error.response?.data.message ? error.response.data.message : error.message, `${FUNCTION_NAME} failed`);
|
|
13793
13702
|
}
|
|
13794
13703
|
}
|
|
13795
13704
|
} while (!RESPONSE || RESPONSE.status < 200 || RESPONSE.status >= 300);
|
|
@@ -13978,7 +13887,7 @@ async function _deleteContentGroup(instance, AUTH_TOKEN, URL, CONTENT_GROUP_ID,
|
|
|
13978
13887
|
{
|
|
13979
13888
|
const API_URL = `${URL}/api/contentgroup/${CONTENT_GROUP_ID}`;
|
|
13980
13889
|
|
|
13981
|
-
return await _sendRequest(AUTH_TOKEN, "Delete Content Group", API_URL, "DELETE", null, null, DEBUG_MODE);
|
|
13890
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Delete Content Group", API_URL, "DELETE", null, null, DEBUG_MODE);
|
|
13982
13891
|
}
|
|
13983
13892
|
|
|
13984
13893
|
|
|
@@ -14297,7 +14206,7 @@ async function _updateMediaBuilder(instance, AUTH_TOKEN, URL, ID, NAME, DESTINAT
|
|
|
14297
14206
|
{
|
|
14298
14207
|
const API_URL = `${URL}/api/mediaBuilder/${ID}`;
|
|
14299
14208
|
|
|
14300
|
-
const MEDIA_BUILDER_INFO = await _getMediaBuilder(AUTH_TOKEN, URL, ID, DEBUG_MODE);
|
|
14209
|
+
const MEDIA_BUILDER_INFO = await _getMediaBuilder(this, AUTH_TOKEN, URL, ID, DEBUG_MODE);
|
|
14301
14210
|
|
|
14302
14211
|
const BODY = {
|
|
14303
14212
|
name: NAME || MEDIA_BUILDER_INFO.name,
|
|
@@ -14541,7 +14450,20 @@ async function _getSearchSaved(instance, AUTH_TOKEN, URL, QUERY, OFFSET, SIZE ,
|
|
|
14541
14450
|
{
|
|
14542
14451
|
const API_URL = `${URL}/api/portal/search-saved`;
|
|
14543
14452
|
|
|
14544
|
-
|
|
14453
|
+
const BODY = {
|
|
14454
|
+
"query": QUERY,
|
|
14455
|
+
"pageOffset": OFFSET,
|
|
14456
|
+
"pageSize": SIZE,
|
|
14457
|
+
"filters": FILTERS,
|
|
14458
|
+
"sortFields": SORT_FIELDS,
|
|
14459
|
+
"searchResultFields": SEARCH_RESULT_FIELDS,
|
|
14460
|
+
"similarAssetId": SIMILAR_ASSET_ID,
|
|
14461
|
+
"minScore": MIN_SCORE,
|
|
14462
|
+
"excludeTotalRecordCount": EXCLUDE_TOTAL_RECORD_COUNT,
|
|
14463
|
+
"filterBinder": FILTER_BINDER
|
|
14464
|
+
};
|
|
14465
|
+
|
|
14466
|
+
return await _sendRequest(instance, AUTH_TOKEN, "Get Search Saved", API_URL, "POST", null, BODY, DEBUG_MODE);
|
|
14545
14467
|
}
|
|
14546
14468
|
|
|
14547
14469
|
|
|
@@ -14573,7 +14495,7 @@ async function _updateSavedSearch(instance, AUTH_TOKEN, URL, ID, NAME, FEATURED,
|
|
|
14573
14495
|
{
|
|
14574
14496
|
const API_URL = `${URL}/api/portal/savedsearch/${ID}`;
|
|
14575
14497
|
|
|
14576
|
-
const SAVED_SEARCH_INFO = await _getSavedSearch(AUTH_TOKEN, URL, ID, DEBUG_MODE);
|
|
14498
|
+
const SAVED_SEARCH_INFO = await _getSavedSearch(instance, AUTH_TOKEN, URL, ID, DEBUG_MODE);
|
|
14577
14499
|
|
|
14578
14500
|
const BODY= {
|
|
14579
14501
|
"id": ID,
|