@eluvio/elv-client-js 4.0.11 → 4.0.13
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/.keep +0 -0
- package/dist/ElvClient-min.js +11 -10
- package/dist/ElvClient-node-min.js +11 -10
- package/dist/ElvFrameClient-min.js +11 -10
- package/dist/ElvPermissionsClient-min.js +10 -9
- package/dist/ElvWalletClient-min.js +10 -9
- package/dist/ElvWalletClient-node-min.js +10 -9
- package/dist/src/AuthorizationClient.js +1555 -2076
- package/dist/src/ContentObjectVerification.js +134 -185
- package/dist/src/Crypto.js +224 -319
- package/dist/src/ElvClient.js +822 -1114
- package/dist/src/ElvWallet.js +64 -106
- package/dist/src/EthClient.js +719 -974
- package/dist/src/FrameClient.js +223 -319
- package/dist/src/HttpClient.js +117 -156
- package/dist/src/Id.js +1 -6
- package/dist/src/LogMessage.js +4 -8
- package/dist/src/PermissionsClient.js +973 -1271
- package/dist/src/RemoteSigner.js +161 -232
- package/dist/src/UserProfileClient.js +781 -1038
- package/dist/src/Utils.js +159 -299
- package/dist/src/Validation.js +2 -17
- package/dist/src/client/ABRPublishing.js +828 -958
- package/dist/src/client/AccessGroups.js +849 -1095
- package/dist/src/client/ContentAccess.js +3323 -4195
- package/dist/src/client/ContentManagement.js +1818 -2290
- package/dist/src/client/Contracts.js +468 -614
- package/dist/src/client/Files.js +1506 -1846
- package/dist/src/client/NFT.js +94 -116
- package/dist/src/client/NTP.js +326 -425
- package/dist/src/index.js +2 -5
- package/dist/src/walletClient/ClientMethods.js +1368 -1763
- package/dist/src/walletClient/Configuration.js +5 -3
- package/dist/src/walletClient/Notifications.js +98 -127
- package/dist/src/walletClient/Profile.js +184 -246
- package/dist/src/walletClient/Utils.js +76 -122
- package/dist/src/walletClient/index.js +1171 -1496
- package/package.json +4 -21
- package/src/FrameClient.js +1 -0
- package/src/HttpClient.js +4 -2
- package/src/client/ABRPublishing.js +126 -105
- package/src/client/ContentAccess.js +1 -0
- package/src/client/ContentManagement.js +4 -2
- package/src/walletClient/Configuration.js +3 -2
- package/dist/AccessClient-min.js +0 -54
- package/dist/AccessClient-node-min.js +0 -74
- package/dist/src/AccessClient.js +0 -798
- package/dist/src/LimitedMap.js +0 -120
- package/dist/src/client/Access.js +0 -1
- package/dist/src/client/Management.js +0 -1606
- package/dist/src/contracts/AccessIndexor.js +0 -831
- package/dist/src/contracts/Accessible.js +0 -31
- package/dist/src/contracts/AdmgrAdvertisement.js +0 -695
- package/dist/src/contracts/AdmgrCampaign.js +0 -648
- package/dist/src/contracts/AdmgrCampaignManager.js +0 -493
- package/dist/src/contracts/AdmgrCommercialOffering.js +0 -622
- package/dist/src/contracts/AdmgrCommercialOfferingManager.js +0 -413
- package/dist/src/contracts/AdmgrMarketPlace.js +0 -413
- package/dist/src/contracts/AvailsDelivery.js +0 -535
- package/dist/src/contracts/BaseAccessControlGroup.js +0 -1221
- package/dist/src/contracts/BaseAccessWallet.js +0 -1575
- package/dist/src/contracts/BaseAccessWalletFactory.js +0 -93
- package/dist/src/contracts/BaseContent.js +0 -1104
- package/dist/src/contracts/BaseContentFactory.js +0 -99
- package/dist/src/contracts/BaseContentFactoryExt.js +0 -219
- package/dist/src/contracts/BaseContentSpace.js +0 -1346
- package/dist/src/contracts/BaseContentType.js +0 -353
- package/dist/src/contracts/BaseFactory.js +0 -107
- package/dist/src/contracts/BaseGroupFactory.js +0 -93
- package/dist/src/contracts/BaseLibrary.js +0 -1035
- package/dist/src/contracts/BaseLibraryFactory.js +0 -96
- package/dist/src/contracts/Certifyer.js +0 -87
- package/dist/src/contracts/Container.js +0 -543
- package/dist/src/contracts/Content.js +0 -432
- package/dist/src/contracts/Editable.js +0 -295
- package/dist/src/contracts/FactorySpace.js +0 -57
- package/dist/src/contracts/KmsSpace.js +0 -52
- package/dist/src/contracts/LvProvider.js +0 -512
- package/dist/src/contracts/LvRecordableStream.js +0 -1026
- package/dist/src/contracts/LvRecording.js +0 -627
- package/dist/src/contracts/LvStreamRightsHolder.js +0 -551
- package/dist/src/contracts/MetaObject.js +0 -110
- package/dist/src/contracts/Node.js +0 -167
- package/dist/src/contracts/NodeSpace.js +0 -18
- package/dist/src/contracts/NodeSpaceImpl.js +0 -273
- package/dist/src/contracts/Ownable.js +0 -87
- package/dist/src/contracts/PaymentService.js +0 -616
- package/dist/src/contracts/Precompile.js +0 -15
- package/dist/src/contracts/SampleContentAdMarketplace.js +0 -564
- package/dist/src/contracts/SampleContentAdvertising.js +0 -444
- package/dist/src/contracts/SampleContentHelloWorld.js +0 -459
- package/dist/src/contracts/SampleContentLicensing.js +0 -618
- package/dist/src/contracts/SampleContentSigned.js +0 -447
- package/dist/src/contracts/SampleInstance.js +0 -438
- package/dist/src/contracts/SampleInstanceFactory.js +0 -451
- package/dist/src/contracts/Transactable.js +0 -82
- package/dist/src/contracts/UserSpace.js +0 -18
- package/dist/src/contracts/UserSpaceImpl.js +0 -43
- package/dist/src/contracts/Utils.js +0 -18
- package/dist/src/contracts/Verifier.js +0 -53
- package/dist/src/contracts/strings.js +0 -4
- package/dist/src/contracts/v2/BaseContentFactoryExt.js +0 -219
- package/dist/src/contracts/v2/FactorySpace.js +0 -57
- package/dist/src/contracts/v2/KmsSpace.js +0 -52
- package/dist/src/contracts/v2/NodeSpaceImpl.js +0 -273
- package/dist/src/contracts/v2/UserSpaceImpl.js +0 -43
- package/dist/src/marketplaceClient/ClientMethods.js +0 -1918
- package/dist/src/marketplaceClient/Configuration.js +0 -29
- package/dist/src/marketplaceClient/Utils.js +0 -304
- package/dist/src/marketplaceClient/index.js +0 -1553
- package/utilities/ListAccessGroups.js +0 -34
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
|
|
2
|
-
|
|
3
2
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
|
-
|
|
5
3
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
6
|
-
|
|
7
4
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
8
|
-
|
|
9
5
|
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; }
|
|
10
|
-
|
|
11
6
|
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; }
|
|
12
|
-
|
|
13
7
|
/**
|
|
14
8
|
* Methods for ABR video creation and management
|
|
15
9
|
*
|
|
@@ -17,16 +11,29 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
11
|
*
|
|
18
12
|
* @module ElvClient/ABRPublishing
|
|
19
13
|
*/
|
|
20
|
-
var R = require("ramda");
|
|
21
14
|
|
|
15
|
+
var R = require("ramda");
|
|
22
16
|
var UrlJoin = require("url-join");
|
|
23
|
-
|
|
24
|
-
var HttpClient = require("../HttpClient");
|
|
25
|
-
|
|
26
17
|
var _require = require("../Validation"),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
ValidateLibrary = _require.ValidateLibrary,
|
|
19
|
+
ValidateVersion = _require.ValidateVersion,
|
|
20
|
+
ValidateParameters = _require.ValidateParameters;
|
|
21
|
+
|
|
22
|
+
// When `/abr_mezzanine/offerings` contains more than one entry, only 1 is the 'real' offering, the others are
|
|
23
|
+
// additional copies to be modified upon finalization due to addlOfferingSpecs having been specified in call to
|
|
24
|
+
// `CreateABRMezzanine()`. The 'real' offering will have an object stored in `mez_prep_specs`, the copies will not.
|
|
25
|
+
// This function accepts the metadata retrieved from `/abr_mezzanine/offerings` and returns the offering key for the
|
|
26
|
+
// 'real' offering that actually has transcode LROs.
|
|
27
|
+
// If no suitable offering is found, throws an error.
|
|
28
|
+
var MezJobMainOfferingKey = function MezJobMainOfferingKey(abrMezOfferings) {
|
|
29
|
+
if (!abrMezOfferings) throw Error("No mezzanine preparation job info found at /abr_mezzanine");
|
|
30
|
+
var mainOfferingKey = Object.keys(abrMezOfferings).find(function (offKey) {
|
|
31
|
+
return abrMezOfferings[offKey].mez_prep_specs;
|
|
32
|
+
});
|
|
33
|
+
if (!mainOfferingKey) throw Error("Could not determine offering key for last submitted job");
|
|
34
|
+
return mainOfferingKey;
|
|
35
|
+
};
|
|
36
|
+
|
|
30
37
|
/**
|
|
31
38
|
* Create a master media content object with the given files.
|
|
32
39
|
*
|
|
@@ -79,266 +86,223 @@ var _require = require("../Validation"),
|
|
|
79
86
|
* @throws {Object} error - If the initialization of the master fails, error details can be found in error.body
|
|
80
87
|
* @return {Object} - The finalize response for the object, as well as logs, warnings and errors from the master initialization
|
|
81
88
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
89
|
exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
85
90
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
86
91
|
var libraryId, type, name, description, _ref$metadata, metadata, fileInfo, _ref$encrypt, encrypt, _ref$access, access, _ref$copy, copy, callback, _ref$respLogLevel, respLogLevel, _ref$structLogLevel, structLogLevel, _yield$this$CreateCon, id, write_token, s3prefixRegex, i, oneFileInfo, matched, j, credentialSet, credentialSetBucket, matchers, k, matcher, fileSourcePath, s3prefixMatch, bucketName, _i, _credentialSet, region, bucket, accessKey, secret, _yield$this$CallBitco, logs, errors, warnings, finalizeResponse;
|
|
87
|
-
|
|
88
92
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
89
|
-
while (1) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (!fileInfo) {
|
|
108
|
-
_context.next = 59;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (!(access.length > 0)) {
|
|
113
|
-
_context.next = 57;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// S3 Upload
|
|
118
|
-
s3prefixRegex = /^s3:\/\/([^/]+)\//i; // for matching and extracting bucket name when full s3:// path is specified
|
|
119
|
-
// batch the cloud storage files by matching credential set, check each file's source path against credential set path_matchers
|
|
120
|
-
|
|
121
|
-
i = 0;
|
|
122
|
-
|
|
123
|
-
case 11:
|
|
124
|
-
if (!(i < fileInfo.length)) {
|
|
125
|
-
_context.next = 42;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
oneFileInfo = fileInfo[i];
|
|
130
|
-
matched = false;
|
|
131
|
-
j = 0;
|
|
132
|
-
|
|
133
|
-
case 15:
|
|
134
|
-
if (!(!matched && j < access.length)) {
|
|
135
|
-
_context.next = 37;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
credentialSet = access[j]; // strip trailing slash to get bucket name for credential set
|
|
140
|
-
|
|
141
|
-
credentialSetBucket = credentialSet.remote_access.path.replace(/\/$/, "");
|
|
142
|
-
matchers = credentialSet.path_matchers;
|
|
143
|
-
k = 0;
|
|
144
|
-
|
|
145
|
-
case 20:
|
|
146
|
-
if (!(!matched && k < matchers.length)) {
|
|
147
|
-
_context.next = 34;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
matcher = new RegExp(matchers[k]);
|
|
152
|
-
fileSourcePath = oneFileInfo.source;
|
|
153
|
-
|
|
154
|
-
if (!matcher.test(fileSourcePath)) {
|
|
155
|
-
_context.next = 31;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
matched = true; // if full s3 path supplied, check bucket name
|
|
160
|
-
|
|
161
|
-
s3prefixMatch = s3prefixRegex.exec(fileSourcePath);
|
|
162
|
-
|
|
163
|
-
if (!s3prefixMatch) {
|
|
164
|
-
_context.next = 30;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
bucketName = s3prefixMatch[1];
|
|
169
|
-
|
|
170
|
-
if (!(bucketName !== credentialSetBucket)) {
|
|
171
|
-
_context.next = 30;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
throw Error("Full S3 file path \"" + fileSourcePath + "\" matched to credential set with different bucket name '" + credentialSetBucket + "'");
|
|
176
|
-
|
|
177
|
-
case 30:
|
|
178
|
-
if (credentialSet.hasOwnProperty("matched")) {
|
|
179
|
-
credentialSet.matched.push(oneFileInfo);
|
|
180
|
-
} else {
|
|
181
|
-
// first matching file path for this credential set,
|
|
182
|
-
// initialize new 'matched' property to 1-element array
|
|
183
|
-
credentialSet.matched = [oneFileInfo];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
case 31:
|
|
187
|
-
k++;
|
|
188
|
-
_context.next = 20;
|
|
93
|
+
while (1) switch (_context.prev = _context.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
libraryId = _ref.libraryId, type = _ref.type, name = _ref.name, description = _ref.description, _ref$metadata = _ref.metadata, metadata = _ref$metadata === void 0 ? {} : _ref$metadata, fileInfo = _ref.fileInfo, _ref$encrypt = _ref.encrypt, encrypt = _ref$encrypt === void 0 ? true : _ref$encrypt, _ref$access = _ref.access, access = _ref$access === void 0 ? [] : _ref$access, _ref$copy = _ref.copy, copy = _ref$copy === void 0 ? false : _ref$copy, callback = _ref.callback, _ref$respLogLevel = _ref.respLogLevel, respLogLevel = _ref$respLogLevel === void 0 ? "warn" : _ref$respLogLevel, _ref$structLogLevel = _ref.structLogLevel, structLogLevel = _ref$structLogLevel === void 0 ? "none" : _ref$structLogLevel;
|
|
96
|
+
ValidateLibrary(libraryId);
|
|
97
|
+
_context.next = 4;
|
|
98
|
+
return this.CreateContentObject({
|
|
99
|
+
libraryId: libraryId,
|
|
100
|
+
options: type ? {
|
|
101
|
+
type: type
|
|
102
|
+
} : {}
|
|
103
|
+
});
|
|
104
|
+
case 4:
|
|
105
|
+
_yield$this$CreateCon = _context.sent;
|
|
106
|
+
id = _yield$this$CreateCon.id;
|
|
107
|
+
write_token = _yield$this$CreateCon.write_token;
|
|
108
|
+
if (!fileInfo) {
|
|
109
|
+
_context.next = 59;
|
|
189
110
|
break;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
_context.next = 15;
|
|
111
|
+
}
|
|
112
|
+
if (!(access.length > 0)) {
|
|
113
|
+
_context.next = 57;
|
|
194
114
|
break;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
case 39:
|
|
205
|
-
i++;
|
|
206
|
-
_context.next = 11;
|
|
115
|
+
}
|
|
116
|
+
// S3 Upload
|
|
117
|
+
s3prefixRegex = /^s3:\/\/([^/]+)\//i; // for matching and extracting bucket name when full s3:// path is specified
|
|
118
|
+
// batch the cloud storage files by matching credential set, check each file's source path against credential set path_matchers
|
|
119
|
+
i = 0;
|
|
120
|
+
case 11:
|
|
121
|
+
if (!(i < fileInfo.length)) {
|
|
122
|
+
_context.next = 42;
|
|
207
123
|
break;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
_credentialSet = access[_i];
|
|
219
|
-
|
|
220
|
-
if (!(_credentialSet.hasOwnProperty("matched") && _credentialSet.matched.length > 0)) {
|
|
221
|
-
_context.next = 52;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
region = _credentialSet.remote_access.storage_endpoint.region;
|
|
226
|
-
bucket = _credentialSet.remote_access.path.replace(/\/$/, "");
|
|
227
|
-
accessKey = _credentialSet.remote_access.cloud_credentials.access_key_id;
|
|
228
|
-
secret = _credentialSet.remote_access.cloud_credentials.secret_access_key;
|
|
229
|
-
_context.next = 52;
|
|
230
|
-
return this.UploadFilesFromS3({
|
|
231
|
-
libraryId: libraryId,
|
|
232
|
-
objectId: id,
|
|
233
|
-
writeToken: write_token,
|
|
234
|
-
fileInfo: _credentialSet.matched,
|
|
235
|
-
region: region,
|
|
236
|
-
bucket: bucket,
|
|
237
|
-
accessKey: accessKey,
|
|
238
|
-
secret: secret,
|
|
239
|
-
copy: copy,
|
|
240
|
-
callback: callback,
|
|
241
|
-
encryption: encrypt ? "cgck" : "none"
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
case 52:
|
|
245
|
-
_i++;
|
|
246
|
-
_context.next = 43;
|
|
124
|
+
}
|
|
125
|
+
oneFileInfo = fileInfo[i];
|
|
126
|
+
matched = false;
|
|
127
|
+
j = 0;
|
|
128
|
+
case 15:
|
|
129
|
+
if (!(!matched && j < access.length)) {
|
|
130
|
+
_context.next = 37;
|
|
247
131
|
break;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
132
|
+
}
|
|
133
|
+
credentialSet = access[j]; // strip trailing slash to get bucket name for credential set
|
|
134
|
+
credentialSetBucket = credentialSet.remote_access.path.replace(/\/$/, "");
|
|
135
|
+
matchers = credentialSet.path_matchers;
|
|
136
|
+
k = 0;
|
|
137
|
+
case 20:
|
|
138
|
+
if (!(!matched && k < matchers.length)) {
|
|
139
|
+
_context.next = 34;
|
|
251
140
|
break;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
141
|
+
}
|
|
142
|
+
matcher = new RegExp(matchers[k]);
|
|
143
|
+
fileSourcePath = oneFileInfo.source;
|
|
144
|
+
if (!matcher.test(fileSourcePath)) {
|
|
145
|
+
_context.next = 31;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
matched = true;
|
|
149
|
+
// if full s3 path supplied, check bucket name
|
|
150
|
+
s3prefixMatch = s3prefixRegex.exec(fileSourcePath);
|
|
151
|
+
if (!s3prefixMatch) {
|
|
152
|
+
_context.next = 30;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
bucketName = s3prefixMatch[1];
|
|
156
|
+
if (!(bucketName !== credentialSetBucket)) {
|
|
157
|
+
_context.next = 30;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
throw Error("Full S3 file path \"" + fileSourcePath + "\" matched to credential set with different bucket name '" + credentialSetBucket + "'");
|
|
161
|
+
case 30:
|
|
162
|
+
if (credentialSet.hasOwnProperty("matched")) {
|
|
163
|
+
credentialSet.matched.push(oneFileInfo);
|
|
164
|
+
} else {
|
|
165
|
+
// first matching file path for this credential set,
|
|
166
|
+
// initialize new 'matched' property to 1-element array
|
|
167
|
+
credentialSet.matched = [oneFileInfo];
|
|
168
|
+
}
|
|
169
|
+
case 31:
|
|
170
|
+
k++;
|
|
171
|
+
_context.next = 20;
|
|
172
|
+
break;
|
|
173
|
+
case 34:
|
|
174
|
+
j++;
|
|
175
|
+
_context.next = 15;
|
|
176
|
+
break;
|
|
177
|
+
case 37:
|
|
178
|
+
if (matched) {
|
|
179
|
+
_context.next = 39;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
throw Error("no credential set found for file path: \"" + filePath + "\"");
|
|
183
|
+
case 39:
|
|
184
|
+
i++;
|
|
185
|
+
_context.next = 11;
|
|
186
|
+
break;
|
|
187
|
+
case 42:
|
|
188
|
+
_i = 0;
|
|
189
|
+
case 43:
|
|
190
|
+
if (!(_i < access.length)) {
|
|
191
|
+
_context.next = 55;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
_credentialSet = access[_i];
|
|
195
|
+
if (!(_credentialSet.hasOwnProperty("matched") && _credentialSet.matched.length > 0)) {
|
|
196
|
+
_context.next = 52;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
region = _credentialSet.remote_access.storage_endpoint.region;
|
|
200
|
+
bucket = _credentialSet.remote_access.path.replace(/\/$/, "");
|
|
201
|
+
accessKey = _credentialSet.remote_access.cloud_credentials.access_key_id;
|
|
202
|
+
secret = _credentialSet.remote_access.cloud_credentials.secret_access_key;
|
|
203
|
+
_context.next = 52;
|
|
204
|
+
return this.UploadFilesFromS3({
|
|
205
|
+
libraryId: libraryId,
|
|
206
|
+
objectId: id,
|
|
207
|
+
writeToken: write_token,
|
|
208
|
+
fileInfo: _credentialSet.matched,
|
|
209
|
+
region: region,
|
|
210
|
+
bucket: bucket,
|
|
211
|
+
accessKey: accessKey,
|
|
212
|
+
secret: secret,
|
|
213
|
+
copy: copy,
|
|
214
|
+
callback: callback,
|
|
215
|
+
encryption: encrypt ? "cgck" : "none"
|
|
216
|
+
});
|
|
217
|
+
case 52:
|
|
218
|
+
_i++;
|
|
219
|
+
_context.next = 43;
|
|
220
|
+
break;
|
|
221
|
+
case 55:
|
|
222
|
+
_context.next = 59;
|
|
223
|
+
break;
|
|
224
|
+
case 57:
|
|
225
|
+
_context.next = 59;
|
|
226
|
+
return this.UploadFiles({
|
|
227
|
+
libraryId: libraryId,
|
|
228
|
+
objectId: id,
|
|
229
|
+
writeToken: write_token,
|
|
230
|
+
fileInfo: fileInfo,
|
|
231
|
+
callback: callback,
|
|
232
|
+
encryption: encrypt ? "cgck" : "none"
|
|
233
|
+
});
|
|
234
|
+
case 59:
|
|
235
|
+
_context.next = 61;
|
|
236
|
+
return this.CreateEncryptionConk({
|
|
237
|
+
libraryId: libraryId,
|
|
238
|
+
objectId: id,
|
|
239
|
+
writeToken: write_token,
|
|
240
|
+
createKMSConk: true
|
|
241
|
+
});
|
|
242
|
+
case 61:
|
|
243
|
+
_context.next = 63;
|
|
244
|
+
return this.CallBitcodeMethod({
|
|
245
|
+
libraryId: libraryId,
|
|
246
|
+
objectId: id,
|
|
247
|
+
writeToken: write_token,
|
|
248
|
+
method: UrlJoin("media", "production_master", "init"),
|
|
249
|
+
queryParams: {
|
|
250
|
+
response_log_level: respLogLevel,
|
|
251
|
+
struct_log_level: structLogLevel
|
|
252
|
+
},
|
|
253
|
+
body: {
|
|
254
|
+
access: access
|
|
255
|
+
},
|
|
256
|
+
constant: false
|
|
257
|
+
});
|
|
258
|
+
case 63:
|
|
259
|
+
_yield$this$CallBitco = _context.sent;
|
|
260
|
+
logs = _yield$this$CallBitco.logs;
|
|
261
|
+
errors = _yield$this$CallBitco.errors;
|
|
262
|
+
warnings = _yield$this$CallBitco.warnings;
|
|
263
|
+
_context.next = 69;
|
|
264
|
+
return this.MergeMetadata({
|
|
265
|
+
libraryId: libraryId,
|
|
266
|
+
objectId: id,
|
|
267
|
+
writeToken: write_token,
|
|
268
|
+
metadata: _objectSpread(_objectSpread({}, metadata || {}), {}, {
|
|
269
|
+
name: name,
|
|
270
|
+
description: description,
|
|
271
|
+
reference: access && !copy,
|
|
272
|
+
"public": _objectSpread(_objectSpread({}, (metadata || {})["public"] || {}), {}, {
|
|
273
|
+
name: name || "",
|
|
274
|
+
description: description || ""
|
|
275
|
+
}),
|
|
276
|
+
elv_created_at: new Date().getTime()
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
case 69:
|
|
280
|
+
_context.next = 71;
|
|
281
|
+
return this.FinalizeContentObject({
|
|
282
|
+
libraryId: libraryId,
|
|
283
|
+
objectId: id,
|
|
284
|
+
writeToken: write_token,
|
|
285
|
+
commitMessage: "Create master",
|
|
286
|
+
awaitCommitConfirmation: false
|
|
287
|
+
});
|
|
288
|
+
case 71:
|
|
289
|
+
finalizeResponse = _context.sent;
|
|
290
|
+
return _context.abrupt("return", _objectSpread({
|
|
291
|
+
errors: errors || [],
|
|
292
|
+
logs: logs || [],
|
|
293
|
+
warnings: warnings || []
|
|
294
|
+
}, finalizeResponse));
|
|
295
|
+
case 73:
|
|
296
|
+
case "end":
|
|
297
|
+
return _context.stop();
|
|
334
298
|
}
|
|
335
299
|
}, _callee, this);
|
|
336
300
|
}));
|
|
337
|
-
|
|
338
301
|
return function (_x) {
|
|
339
302
|
return _ref2.apply(this, arguments);
|
|
340
303
|
};
|
|
341
304
|
}();
|
|
305
|
+
|
|
342
306
|
/**
|
|
343
307
|
* Create (or edit) a mezzanine offering based on the a given master content object version and variant key
|
|
344
308
|
*
|
|
@@ -362,586 +326,556 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
362
326
|
*
|
|
363
327
|
* @return {Object} - The finalize response for the object, as well as logs, warnings and errors from the mezzanine initialization
|
|
364
328
|
*/
|
|
365
|
-
|
|
366
|
-
|
|
367
329
|
exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
368
330
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
369
331
|
var libraryId, objectId, type, name, description, metadata, masterVersionHash, abrProfile, addlOfferingSpecs, _ref3$variant, variant, _ref3$offeringKey, offeringKey, _ref3$keepOtherStream, keepOtherStreams, _ref3$respLogLevel, respLogLevel, _ref3$structLogLevel, structLogLevel, streamKeys, existingMez, options, id, write_token, editResponse, createResponse, masterName, authorizationTokens, headers, body, storeClear, _yield$this$CallBitco2, logs, errors, warnings, existingMetadata, finalizeResponse;
|
|
370
|
-
|
|
371
332
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
372
|
-
while (1) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (masterVersionHash) {
|
|
380
|
-
_context2.next = 5;
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
throw Error("Master version hash not specified");
|
|
385
|
-
|
|
386
|
-
case 5:
|
|
387
|
-
if (!(!objectId && keepOtherStreams)) {
|
|
388
|
-
_context2.next = 7;
|
|
389
|
-
break;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
throw Error("Existing mezzanine object ID required in order to use 'keepOtherStreams'");
|
|
393
|
-
|
|
394
|
-
case 7:
|
|
395
|
-
if (!(addlOfferingSpecs && !abrProfile)) {
|
|
396
|
-
_context2.next = 9;
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
throw Error("abrProfile required when using addlOfferingSpecs");
|
|
401
|
-
|
|
402
|
-
case 9:
|
|
403
|
-
existingMez = !!objectId;
|
|
404
|
-
options = type ? {
|
|
405
|
-
type: type
|
|
406
|
-
} : {};
|
|
407
|
-
|
|
408
|
-
if (!existingMez) {
|
|
409
|
-
_context2.next = 19;
|
|
410
|
-
break;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
_context2.next = 14;
|
|
414
|
-
return this.EditContentObject({
|
|
415
|
-
libraryId: libraryId,
|
|
416
|
-
objectId: objectId,
|
|
417
|
-
options: options
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
case 14:
|
|
421
|
-
editResponse = _context2.sent;
|
|
422
|
-
id = editResponse.id;
|
|
423
|
-
write_token = editResponse.write_token;
|
|
424
|
-
_context2.next = 24;
|
|
333
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
334
|
+
case 0:
|
|
335
|
+
libraryId = _ref3.libraryId, objectId = _ref3.objectId, type = _ref3.type, name = _ref3.name, description = _ref3.description, metadata = _ref3.metadata, masterVersionHash = _ref3.masterVersionHash, abrProfile = _ref3.abrProfile, addlOfferingSpecs = _ref3.addlOfferingSpecs, _ref3$variant = _ref3.variant, variant = _ref3$variant === void 0 ? "default" : _ref3$variant, _ref3$offeringKey = _ref3.offeringKey, offeringKey = _ref3$offeringKey === void 0 ? "default" : _ref3$offeringKey, _ref3$keepOtherStream = _ref3.keepOtherStreams, keepOtherStreams = _ref3$keepOtherStream === void 0 ? false : _ref3$keepOtherStream, _ref3$respLogLevel = _ref3.respLogLevel, respLogLevel = _ref3$respLogLevel === void 0 ? "warn" : _ref3$respLogLevel, _ref3$structLogLevel = _ref3.structLogLevel, structLogLevel = _ref3$structLogLevel === void 0 ? "none" : _ref3$structLogLevel, streamKeys = _ref3.streamKeys;
|
|
336
|
+
ValidateLibrary(libraryId);
|
|
337
|
+
ValidateVersion(masterVersionHash);
|
|
338
|
+
if (masterVersionHash) {
|
|
339
|
+
_context2.next = 5;
|
|
425
340
|
break;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
options: options
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
case 21:
|
|
435
|
-
createResponse = _context2.sent;
|
|
436
|
-
id = createResponse.id;
|
|
437
|
-
write_token = createResponse.write_token;
|
|
438
|
-
|
|
439
|
-
case 24:
|
|
440
|
-
_context2.next = 26;
|
|
441
|
-
return this.CreateEncryptionConk({
|
|
442
|
-
libraryId: libraryId,
|
|
443
|
-
objectId: id,
|
|
444
|
-
writeToken: write_token,
|
|
445
|
-
createKMSConk: true
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
case 26:
|
|
449
|
-
_context2.next = 28;
|
|
450
|
-
return this.ContentObjectMetadata({
|
|
451
|
-
versionHash: masterVersionHash,
|
|
452
|
-
metadataSubtree: "public/name"
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
case 28:
|
|
456
|
-
masterName = _context2.sent;
|
|
457
|
-
// Include authorization for library, master, and mezzanine
|
|
458
|
-
authorizationTokens = [];
|
|
459
|
-
_context2.t0 = authorizationTokens;
|
|
460
|
-
_context2.next = 33;
|
|
461
|
-
return this.authClient.AuthorizationToken({
|
|
462
|
-
libraryId: libraryId,
|
|
463
|
-
objectId: id,
|
|
464
|
-
update: true
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
case 33:
|
|
468
|
-
_context2.t1 = _context2.sent;
|
|
469
|
-
|
|
470
|
-
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
471
|
-
|
|
472
|
-
_context2.t2 = authorizationTokens;
|
|
473
|
-
_context2.next = 38;
|
|
474
|
-
return this.authClient.AuthorizationToken({
|
|
475
|
-
libraryId: libraryId
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
case 38:
|
|
479
|
-
_context2.t3 = _context2.sent;
|
|
480
|
-
|
|
481
|
-
_context2.t2.push.call(_context2.t2, _context2.t3);
|
|
482
|
-
|
|
483
|
-
_context2.t4 = authorizationTokens;
|
|
484
|
-
_context2.next = 43;
|
|
485
|
-
return this.authClient.AuthorizationToken({
|
|
486
|
-
versionHash: masterVersionHash
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
case 43:
|
|
490
|
-
_context2.t5 = _context2.sent;
|
|
491
|
-
|
|
492
|
-
_context2.t4.push.call(_context2.t4, _context2.t5);
|
|
493
|
-
|
|
494
|
-
headers = {
|
|
495
|
-
Authorization: authorizationTokens.map(function (token) {
|
|
496
|
-
return "Bearer ".concat(token);
|
|
497
|
-
}).join(",")
|
|
498
|
-
};
|
|
499
|
-
body = {
|
|
500
|
-
additional_offering_specs: addlOfferingSpecs,
|
|
501
|
-
offering_key: offeringKey,
|
|
502
|
-
keep_other_streams: keepOtherStreams,
|
|
503
|
-
prod_master_hash: masterVersionHash,
|
|
504
|
-
stream_keys: streamKeys,
|
|
505
|
-
variant_key: variant
|
|
506
|
-
};
|
|
507
|
-
storeClear = false;
|
|
508
|
-
|
|
509
|
-
if (!abrProfile) {
|
|
510
|
-
_context2.next = 53;
|
|
511
|
-
break;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
body.abr_profile = abrProfile;
|
|
515
|
-
storeClear = abrProfile.store_clear;
|
|
516
|
-
_context2.next = 56;
|
|
341
|
+
}
|
|
342
|
+
throw Error("Master version hash not specified");
|
|
343
|
+
case 5:
|
|
344
|
+
if (!(!objectId && keepOtherStreams)) {
|
|
345
|
+
_context2.next = 7;
|
|
517
346
|
break;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
347
|
+
}
|
|
348
|
+
throw Error("Existing mezzanine object ID required in order to use 'keepOtherStreams'");
|
|
349
|
+
case 7:
|
|
350
|
+
if (!(addlOfferingSpecs && !abrProfile)) {
|
|
351
|
+
_context2.next = 9;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
throw Error("abrProfile required when using addlOfferingSpecs");
|
|
355
|
+
case 9:
|
|
356
|
+
existingMez = !!objectId;
|
|
357
|
+
options = type ? {
|
|
358
|
+
type: type
|
|
359
|
+
} : {};
|
|
360
|
+
if (!existingMez) {
|
|
361
|
+
_context2.next = 19;
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
_context2.next = 14;
|
|
365
|
+
return this.EditContentObject({
|
|
366
|
+
libraryId: libraryId,
|
|
367
|
+
objectId: objectId,
|
|
368
|
+
options: options
|
|
369
|
+
});
|
|
370
|
+
case 14:
|
|
371
|
+
editResponse = _context2.sent;
|
|
372
|
+
id = editResponse.id;
|
|
373
|
+
write_token = editResponse.write_token;
|
|
374
|
+
_context2.next = 24;
|
|
375
|
+
break;
|
|
376
|
+
case 19:
|
|
377
|
+
_context2.next = 21;
|
|
378
|
+
return this.CreateContentObject({
|
|
379
|
+
libraryId: libraryId,
|
|
380
|
+
options: options
|
|
381
|
+
});
|
|
382
|
+
case 21:
|
|
383
|
+
createResponse = _context2.sent;
|
|
384
|
+
id = createResponse.id;
|
|
385
|
+
write_token = createResponse.write_token;
|
|
386
|
+
case 24:
|
|
387
|
+
_context2.next = 26;
|
|
388
|
+
return this.CreateEncryptionConk({
|
|
389
|
+
libraryId: libraryId,
|
|
390
|
+
objectId: id,
|
|
391
|
+
writeToken: write_token,
|
|
392
|
+
createKMSConk: true
|
|
393
|
+
});
|
|
394
|
+
case 26:
|
|
395
|
+
_context2.next = 28;
|
|
396
|
+
return this.ContentObjectMetadata({
|
|
397
|
+
versionHash: masterVersionHash,
|
|
398
|
+
metadataSubtree: "public/name"
|
|
399
|
+
});
|
|
400
|
+
case 28:
|
|
401
|
+
masterName = _context2.sent;
|
|
402
|
+
// Include authorization for library, master, and mezzanine
|
|
403
|
+
authorizationTokens = [];
|
|
404
|
+
_context2.t0 = authorizationTokens;
|
|
405
|
+
_context2.next = 33;
|
|
406
|
+
return this.authClient.AuthorizationToken({
|
|
407
|
+
libraryId: libraryId,
|
|
408
|
+
objectId: id,
|
|
409
|
+
update: true
|
|
410
|
+
});
|
|
411
|
+
case 33:
|
|
412
|
+
_context2.t1 = _context2.sent;
|
|
413
|
+
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
414
|
+
_context2.t2 = authorizationTokens;
|
|
415
|
+
_context2.next = 38;
|
|
416
|
+
return this.authClient.AuthorizationToken({
|
|
417
|
+
libraryId: libraryId
|
|
418
|
+
});
|
|
419
|
+
case 38:
|
|
420
|
+
_context2.t3 = _context2.sent;
|
|
421
|
+
_context2.t2.push.call(_context2.t2, _context2.t3);
|
|
422
|
+
_context2.t4 = authorizationTokens;
|
|
423
|
+
_context2.next = 43;
|
|
424
|
+
return this.authClient.AuthorizationToken({
|
|
425
|
+
versionHash: masterVersionHash
|
|
426
|
+
});
|
|
427
|
+
case 43:
|
|
428
|
+
_context2.t5 = _context2.sent;
|
|
429
|
+
_context2.t4.push.call(_context2.t4, _context2.t5);
|
|
430
|
+
headers = {
|
|
431
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
432
|
+
return "Bearer ".concat(token);
|
|
433
|
+
}).join(",")
|
|
434
|
+
};
|
|
435
|
+
body = {
|
|
436
|
+
additional_offering_specs: addlOfferingSpecs,
|
|
437
|
+
offering_key: offeringKey,
|
|
438
|
+
keep_other_streams: keepOtherStreams,
|
|
439
|
+
prod_master_hash: masterVersionHash,
|
|
440
|
+
stream_keys: streamKeys,
|
|
441
|
+
variant_key: variant
|
|
442
|
+
};
|
|
443
|
+
storeClear = false;
|
|
444
|
+
if (!abrProfile) {
|
|
445
|
+
_context2.next = 53;
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
body.abr_profile = abrProfile;
|
|
449
|
+
storeClear = abrProfile.store_clear;
|
|
450
|
+
_context2.next = 56;
|
|
451
|
+
break;
|
|
452
|
+
case 53:
|
|
453
|
+
_context2.next = 55;
|
|
454
|
+
return this.ContentObjectMetadata({
|
|
455
|
+
libraryId: libraryId,
|
|
456
|
+
objectId: this.utils.AddressToObjectId(this.utils.HashToAddress(libraryId)),
|
|
457
|
+
metadataSubtree: "abr_profile/store_clear"
|
|
458
|
+
});
|
|
459
|
+
case 55:
|
|
460
|
+
storeClear = _context2.sent;
|
|
461
|
+
case 56:
|
|
462
|
+
if (storeClear) {
|
|
536
463
|
_context2.next = 59;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
finalizeResponse = _context2.sent;
|
|
639
|
-
return _context2.abrupt("return", _objectSpread({
|
|
640
|
-
logs: logs || [],
|
|
641
|
-
warnings: warnings || [],
|
|
642
|
-
errors: errors || []
|
|
643
|
-
}, finalizeResponse));
|
|
644
|
-
|
|
645
|
-
case 84:
|
|
646
|
-
case "end":
|
|
647
|
-
return _context2.stop();
|
|
648
|
-
}
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
_context2.next = 59;
|
|
467
|
+
return this.EncryptionConk({
|
|
468
|
+
libraryId: libraryId,
|
|
469
|
+
objectId: id,
|
|
470
|
+
writeToken: write_token
|
|
471
|
+
});
|
|
472
|
+
case 59:
|
|
473
|
+
_context2.next = 61;
|
|
474
|
+
return this.CallBitcodeMethod({
|
|
475
|
+
libraryId: libraryId,
|
|
476
|
+
objectId: id,
|
|
477
|
+
writeToken: write_token,
|
|
478
|
+
method: UrlJoin("media", "abr_mezzanine", "init"),
|
|
479
|
+
queryParams: {
|
|
480
|
+
response_log_level: respLogLevel,
|
|
481
|
+
struct_log_level: structLogLevel
|
|
482
|
+
},
|
|
483
|
+
headers: headers,
|
|
484
|
+
body: body,
|
|
485
|
+
constant: false
|
|
486
|
+
});
|
|
487
|
+
case 61:
|
|
488
|
+
_yield$this$CallBitco2 = _context2.sent;
|
|
489
|
+
logs = _yield$this$CallBitco2.logs;
|
|
490
|
+
errors = _yield$this$CallBitco2.errors;
|
|
491
|
+
warnings = _yield$this$CallBitco2.warnings;
|
|
492
|
+
if (!metadata) {
|
|
493
|
+
metadata = {};
|
|
494
|
+
}
|
|
495
|
+
if (!metadata["public"]) {
|
|
496
|
+
metadata["public"] = {};
|
|
497
|
+
}
|
|
498
|
+
if (!metadata["public"].asset_metadata) {
|
|
499
|
+
metadata["public"].asset_metadata = {};
|
|
500
|
+
}
|
|
501
|
+
metadata.master = {
|
|
502
|
+
name: masterName,
|
|
503
|
+
id: this.utils.DecodeVersionHash(masterVersionHash).objectId,
|
|
504
|
+
hash: masterVersionHash,
|
|
505
|
+
variant: variant
|
|
506
|
+
};
|
|
507
|
+
metadata["public"] = _objectSpread({}, metadata["public"]);
|
|
508
|
+
metadata["public"].asset_metadata = _objectSpread({
|
|
509
|
+
sources: _defineProperty({}, offeringKey, {
|
|
510
|
+
"/": "./rep/playout/".concat(offeringKey, "/options.json")
|
|
511
|
+
})
|
|
512
|
+
}, metadata["public"].asset_metadata);
|
|
513
|
+
if (name || !existingMez) {
|
|
514
|
+
metadata.name = name || "".concat(masterName, " Mezzanine");
|
|
515
|
+
metadata["public"].name = name || "".concat(masterName, " Mezzanine");
|
|
516
|
+
}
|
|
517
|
+
if (description || !existingMez) {
|
|
518
|
+
metadata.description = description || "";
|
|
519
|
+
metadata["public"].description = description || "";
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// retrieve existing metadata to merge with updated metadata
|
|
523
|
+
_context2.next = 75;
|
|
524
|
+
return this.ContentObjectMetadata({
|
|
525
|
+
libraryId: libraryId,
|
|
526
|
+
objectId: id,
|
|
527
|
+
writeToken: write_token
|
|
528
|
+
});
|
|
529
|
+
case 75:
|
|
530
|
+
existingMetadata = _context2.sent;
|
|
531
|
+
// newer metadata values replace existing metadata, unless both new and old values are objects,
|
|
532
|
+
// in which case their keys are merged recursively
|
|
533
|
+
metadata = R.mergeDeepRight(existingMetadata, metadata);
|
|
534
|
+
if (!existingMez) {
|
|
535
|
+
// set creation date
|
|
536
|
+
metadata.elv_created_at = new Date().getTime();
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// write metadata to mezzanine object
|
|
540
|
+
_context2.next = 80;
|
|
541
|
+
return this.ReplaceMetadata({
|
|
542
|
+
libraryId: libraryId,
|
|
543
|
+
objectId: id,
|
|
544
|
+
writeToken: write_token,
|
|
545
|
+
metadata: metadata
|
|
546
|
+
});
|
|
547
|
+
case 80:
|
|
548
|
+
_context2.next = 82;
|
|
549
|
+
return this.FinalizeContentObject({
|
|
550
|
+
libraryId: libraryId,
|
|
551
|
+
objectId: id,
|
|
552
|
+
writeToken: write_token,
|
|
553
|
+
commitMessage: "Create ABR mezzanine"
|
|
554
|
+
});
|
|
555
|
+
case 82:
|
|
556
|
+
finalizeResponse = _context2.sent;
|
|
557
|
+
return _context2.abrupt("return", _objectSpread({
|
|
558
|
+
logs: logs || [],
|
|
559
|
+
warnings: warnings || [],
|
|
560
|
+
errors: errors || []
|
|
561
|
+
}, finalizeResponse));
|
|
562
|
+
case 84:
|
|
563
|
+
case "end":
|
|
564
|
+
return _context2.stop();
|
|
649
565
|
}
|
|
650
566
|
}, _callee2, this);
|
|
651
567
|
}));
|
|
652
|
-
|
|
653
568
|
return function (_x2) {
|
|
654
569
|
return _ref4.apply(this, arguments);
|
|
655
570
|
};
|
|
656
571
|
}();
|
|
572
|
+
|
|
657
573
|
/**
|
|
658
|
-
* Start
|
|
574
|
+
* Start transcoding jobs previously set up by CreateABRMezzanine() on the specified mezzanine
|
|
659
575
|
*
|
|
660
576
|
* @methodGroup ABR Publishing
|
|
661
577
|
* @namedParams
|
|
662
578
|
* @param {string} libraryId - ID of the mezzanine library
|
|
663
579
|
* @param {string} objectId - ID of the mezzanine object
|
|
664
|
-
* @param {string=} offeringKey=default - The offering to process
|
|
665
580
|
* @param {Array<Object>=} access - Array of S3 credentials, along with path matching regexes - Required if any files in the masters are S3 references (See CreateProductionMaster method)
|
|
666
581
|
* - Format: {region, bucket, accessKey, secret}
|
|
667
582
|
* @param {number[]} jobIndexes - Array of LRO job indexes to start. LROs are listed in a map under metadata key /abr_mezzanine/offerings/(offeringKey)/mez_prep_specs/, and job indexes start with 0, corresponding to map keys in alphabetical order
|
|
668
583
|
*
|
|
669
584
|
* @return {Promise<Object>} - A write token for the mezzanine object, as well as any logs, warnings and errors from the job initialization
|
|
670
585
|
*/
|
|
671
|
-
|
|
672
|
-
|
|
673
586
|
exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
674
587
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
675
588
|
var _this = this;
|
|
676
|
-
|
|
677
|
-
var libraryId, objectId, _ref5$offeringKey, offeringKey, _ref5$access, access, _ref5$jobIndexes, jobIndexes, mezzanineMetadata, prepSpecs, masterVersionHashes, authorizationTokens, headers, processingDraft, lroInfo, statusDraft, finalizeResponse, _yield$this$CallBitco3, data, errors, warnings, logs;
|
|
678
|
-
|
|
589
|
+
var libraryId, objectId, _ref5$access, access, _ref5$jobIndexes, jobIndexes, lastJobOfferingsInfo, offeringKey, prepSpecs, masterVersionHashes, authorizationTokens, headers, processingDraft, lroInfo, statusDraft, finalizeResponse, _yield$this$CallBitco3, data, errors, warnings, logs;
|
|
679
590
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
680
|
-
while (1) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
return
|
|
707
|
-
})
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
return
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
})
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
};
|
|
737
|
-
}()));
|
|
738
|
-
|
|
739
|
-
case 10:
|
|
740
|
-
authorizationTokens = _context4.sent;
|
|
741
|
-
_context4.next = 13;
|
|
742
|
-
return this.authClient.AuthorizationToken({
|
|
743
|
-
libraryId: libraryId,
|
|
744
|
-
objectId: objectId,
|
|
745
|
-
update: true
|
|
746
|
-
});
|
|
747
|
-
|
|
748
|
-
case 13:
|
|
749
|
-
_context4.t0 = _context4.sent;
|
|
750
|
-
authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
|
|
751
|
-
headers = {
|
|
752
|
-
Authorization: authorizationTokens.map(function (token) {
|
|
753
|
-
return "Bearer ".concat(token);
|
|
754
|
-
}).join(",")
|
|
591
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
592
|
+
case 0:
|
|
593
|
+
libraryId = _ref5.libraryId, objectId = _ref5.objectId, _ref5$access = _ref5.access, access = _ref5$access === void 0 ? [] : _ref5$access, _ref5$jobIndexes = _ref5.jobIndexes, jobIndexes = _ref5$jobIndexes === void 0 ? null : _ref5$jobIndexes;
|
|
594
|
+
ValidateParameters({
|
|
595
|
+
libraryId: libraryId,
|
|
596
|
+
objectId: objectId
|
|
597
|
+
});
|
|
598
|
+
_context4.next = 4;
|
|
599
|
+
return this.ContentObjectMetadata({
|
|
600
|
+
libraryId: libraryId,
|
|
601
|
+
objectId: objectId,
|
|
602
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
603
|
+
});
|
|
604
|
+
case 4:
|
|
605
|
+
lastJobOfferingsInfo = _context4.sent;
|
|
606
|
+
offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
607
|
+
prepSpecs = lastJobOfferingsInfo[offeringKey].mez_prep_specs;
|
|
608
|
+
if (prepSpecs) {
|
|
609
|
+
_context4.next = 9;
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
throw Error("No stream preparation specs found");
|
|
613
|
+
case 9:
|
|
614
|
+
// Retrieve all masters associated with this offering
|
|
615
|
+
masterVersionHashes = Object.keys(prepSpecs).map(function (spec) {
|
|
616
|
+
return (prepSpecs[spec].source_streams || []).map(function (stream) {
|
|
617
|
+
return stream.source_hash;
|
|
618
|
+
});
|
|
619
|
+
}); // Flatten and filter
|
|
620
|
+
masterVersionHashes = [].concat.apply([], masterVersionHashes).filter(function (hash) {
|
|
621
|
+
return hash;
|
|
622
|
+
}).filter(function (v, i, a) {
|
|
623
|
+
return a.indexOf(v) === i;
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
// Retrieve authorization tokens for all masters and the mezzanine
|
|
627
|
+
_context4.next = 13;
|
|
628
|
+
return Promise.all(masterVersionHashes.map( /*#__PURE__*/function () {
|
|
629
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(versionHash) {
|
|
630
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
631
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
632
|
+
case 0:
|
|
633
|
+
_context3.next = 2;
|
|
634
|
+
return _this.authClient.AuthorizationToken({
|
|
635
|
+
versionHash: versionHash
|
|
636
|
+
});
|
|
637
|
+
case 2:
|
|
638
|
+
return _context3.abrupt("return", _context3.sent);
|
|
639
|
+
case 3:
|
|
640
|
+
case "end":
|
|
641
|
+
return _context3.stop();
|
|
642
|
+
}
|
|
643
|
+
}, _callee3);
|
|
644
|
+
}));
|
|
645
|
+
return function (_x4) {
|
|
646
|
+
return _ref7.apply(this, arguments);
|
|
755
647
|
};
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
648
|
+
}()));
|
|
649
|
+
case 13:
|
|
650
|
+
authorizationTokens = _context4.sent;
|
|
651
|
+
_context4.next = 16;
|
|
652
|
+
return this.authClient.AuthorizationToken({
|
|
653
|
+
libraryId: libraryId,
|
|
654
|
+
objectId: objectId,
|
|
655
|
+
update: true
|
|
656
|
+
});
|
|
657
|
+
case 16:
|
|
658
|
+
_context4.t0 = _context4.sent;
|
|
659
|
+
authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
|
|
660
|
+
headers = {
|
|
661
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
662
|
+
return "Bearer ".concat(token);
|
|
663
|
+
}).join(",")
|
|
664
|
+
};
|
|
665
|
+
_context4.next = 21;
|
|
666
|
+
return this.EditContentObject({
|
|
667
|
+
libraryId: libraryId,
|
|
668
|
+
objectId: objectId
|
|
669
|
+
});
|
|
670
|
+
case 21:
|
|
671
|
+
processingDraft = _context4.sent;
|
|
672
|
+
lroInfo = {
|
|
673
|
+
write_token: processingDraft.write_token,
|
|
674
|
+
node: processingDraft.nodeUrl,
|
|
675
|
+
offering: offeringKey
|
|
676
|
+
}; // Update metadata with LRO version write token
|
|
677
|
+
_context4.next = 25;
|
|
678
|
+
return this.EditContentObject({
|
|
679
|
+
libraryId: libraryId,
|
|
680
|
+
objectId: objectId
|
|
681
|
+
});
|
|
682
|
+
case 25:
|
|
683
|
+
statusDraft = _context4.sent;
|
|
684
|
+
_context4.next = 28;
|
|
685
|
+
return this.ReplaceMetadata({
|
|
686
|
+
libraryId: libraryId,
|
|
687
|
+
objectId: objectId,
|
|
688
|
+
writeToken: statusDraft.write_token,
|
|
689
|
+
metadataSubtree: "lro_draft",
|
|
690
|
+
metadata: lroInfo
|
|
691
|
+
});
|
|
692
|
+
case 28:
|
|
693
|
+
_context4.next = 30;
|
|
694
|
+
return this.FinalizeContentObject({
|
|
695
|
+
libraryId: libraryId,
|
|
696
|
+
objectId: objectId,
|
|
697
|
+
writeToken: statusDraft.write_token,
|
|
698
|
+
commitMessage: "Mezzanine LRO status"
|
|
699
|
+
});
|
|
700
|
+
case 30:
|
|
701
|
+
finalizeResponse = _context4.sent;
|
|
702
|
+
_context4.next = 33;
|
|
703
|
+
return this.CallBitcodeMethod({
|
|
704
|
+
libraryId: libraryId,
|
|
705
|
+
objectId: objectId,
|
|
706
|
+
writeToken: processingDraft.write_token,
|
|
707
|
+
headers: headers,
|
|
708
|
+
method: UrlJoin("media", "abr_mezzanine", "prep_start"),
|
|
709
|
+
constant: false,
|
|
710
|
+
body: {
|
|
711
|
+
access: access,
|
|
712
|
+
offering_key: offeringKey,
|
|
713
|
+
job_indexes: jobIndexes
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
case 33:
|
|
717
|
+
_yield$this$CallBitco3 = _context4.sent;
|
|
718
|
+
data = _yield$this$CallBitco3.data;
|
|
719
|
+
errors = _yield$this$CallBitco3.errors;
|
|
720
|
+
warnings = _yield$this$CallBitco3.warnings;
|
|
721
|
+
logs = _yield$this$CallBitco3.logs;
|
|
722
|
+
return _context4.abrupt("return", {
|
|
723
|
+
hash: finalizeResponse.hash,
|
|
724
|
+
lro_draft: lroInfo,
|
|
725
|
+
writeToken: processingDraft.write_token,
|
|
726
|
+
nodeUrl: processingDraft.nodeUrl,
|
|
727
|
+
data: data,
|
|
728
|
+
logs: logs || [],
|
|
729
|
+
warnings: warnings || [],
|
|
730
|
+
errors: errors || []
|
|
731
|
+
});
|
|
732
|
+
case 39:
|
|
733
|
+
case "end":
|
|
734
|
+
return _context4.stop();
|
|
833
735
|
}
|
|
834
736
|
}, _callee4, this);
|
|
835
737
|
}));
|
|
836
|
-
|
|
837
738
|
return function (_x3) {
|
|
838
739
|
return _ref6.apply(this, arguments);
|
|
839
740
|
};
|
|
840
741
|
}();
|
|
742
|
+
|
|
841
743
|
/**
|
|
842
|
-
* Retrieve
|
|
744
|
+
* Retrieve node and write token for a mezzanine's current offering preparation job (if any).
|
|
745
|
+
* Also returns the offering key.
|
|
843
746
|
*
|
|
844
747
|
* @methodGroup ABR Publishing
|
|
845
748
|
* @namedParams
|
|
846
749
|
* @param {string} libraryId - ID of the library
|
|
847
750
|
* @param {string} objectId - ID of the object
|
|
848
|
-
* @param {string=} offeringKey=default - Offering key of the mezzanine
|
|
849
751
|
*
|
|
850
752
|
* @return {Promise<Object>} - LRO status
|
|
851
753
|
*/
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
exports.LROStatus = /*#__PURE__*/function () {
|
|
754
|
+
exports.LRODraftInfo = /*#__PURE__*/function () {
|
|
855
755
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
856
|
-
var libraryId, objectId,
|
|
857
|
-
|
|
756
|
+
var libraryId, objectId, standardPathContents, lastJobOfferingsInfo, mainOfferingKey, ready, oldPathContents;
|
|
858
757
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
859
|
-
while (1) {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
ready = _context5.sent;
|
|
909
|
-
|
|
910
|
-
if (!ready) {
|
|
911
|
-
_context5.next = 18;
|
|
912
|
-
break;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
throw Error("Mezzanine already finalized for offering '".concat(offeringKey, "'"));
|
|
916
|
-
|
|
917
|
-
case 18:
|
|
918
|
-
throw Error("No LRO draft found for this mezzanine");
|
|
919
|
-
|
|
920
|
-
case 19:
|
|
921
|
-
this.HttpClient.RecordWriteToken(lroDraft.write_token, lroDraft.node);
|
|
758
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
759
|
+
case 0:
|
|
760
|
+
libraryId = _ref8.libraryId, objectId = _ref8.objectId;
|
|
761
|
+
_context5.next = 3;
|
|
762
|
+
return this.ContentObjectMetadata({
|
|
763
|
+
libraryId: libraryId,
|
|
764
|
+
objectId: objectId,
|
|
765
|
+
metadataSubtree: "lro_draft"
|
|
766
|
+
});
|
|
767
|
+
case 3:
|
|
768
|
+
standardPathContents = _context5.sent;
|
|
769
|
+
if (!standardPathContents) {
|
|
770
|
+
_context5.next = 6;
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
return _context5.abrupt("return", standardPathContents);
|
|
774
|
+
case 6:
|
|
775
|
+
_context5.next = 8;
|
|
776
|
+
return this.ContentObjectMetadata({
|
|
777
|
+
libraryId: libraryId,
|
|
778
|
+
objectId: objectId,
|
|
779
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
780
|
+
});
|
|
781
|
+
case 8:
|
|
782
|
+
lastJobOfferingsInfo = _context5.sent;
|
|
783
|
+
if (lastJobOfferingsInfo) {
|
|
784
|
+
_context5.next = 11;
|
|
785
|
+
break;
|
|
786
|
+
}
|
|
787
|
+
throw Error("No metadata for mezzanine preparation job found at /abr_mezzanine");
|
|
788
|
+
case 11:
|
|
789
|
+
mainOfferingKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
790
|
+
if (mainOfferingKey) {
|
|
791
|
+
_context5.next = 14;
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
throw Error("Could not determine offering key for last submitted job");
|
|
795
|
+
case 14:
|
|
796
|
+
// see if offering from last job was finalized
|
|
797
|
+
ready = lastJobOfferingsInfo[mainOfferingKey].ready; // old location for LRO draft info
|
|
798
|
+
_context5.next = 17;
|
|
799
|
+
return this.ContentObjectMetadata({
|
|
800
|
+
libraryId: libraryId,
|
|
801
|
+
objectId: objectId,
|
|
802
|
+
metadataSubtree: "lro_draft_".concat(mainOfferingKey)
|
|
803
|
+
});
|
|
804
|
+
case 17:
|
|
805
|
+
oldPathContents = _context5.sent;
|
|
806
|
+
if (!oldPathContents) {
|
|
922
807
|
_context5.next = 22;
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
return _context5.abrupt("return", oldPathContents);
|
|
811
|
+
case 22:
|
|
812
|
+
if (!ready) {
|
|
813
|
+
_context5.next = 26;
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
throw Error("No LRO draft found for this mezzanine - looks like last mez prep job was already finalized.");
|
|
817
|
+
case 26:
|
|
818
|
+
throw Error("No LRO draft found for this mezzanine - looks like last mez prep job was either cancelled or discarded.");
|
|
819
|
+
case 27:
|
|
820
|
+
case "end":
|
|
821
|
+
return _context5.stop();
|
|
937
822
|
}
|
|
938
823
|
}, _callee5, this);
|
|
939
824
|
}));
|
|
940
|
-
|
|
941
825
|
return function (_x5) {
|
|
942
826
|
return _ref9.apply(this, arguments);
|
|
943
827
|
};
|
|
944
828
|
}();
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Retrieve status information for mezzanine transcoding jobs, aka long running operations (LROs) on the given object.
|
|
832
|
+
*
|
|
833
|
+
* @methodGroup ABR Publishing
|
|
834
|
+
* @namedParams
|
|
835
|
+
* @param {string} libraryId - ID of the library
|
|
836
|
+
* @param {string} objectId - ID of the object
|
|
837
|
+
*
|
|
838
|
+
* @return {Promise<Object>} - LRO status
|
|
839
|
+
*/
|
|
840
|
+
exports.LROStatus = /*#__PURE__*/function () {
|
|
841
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
|
|
842
|
+
var libraryId, objectId, lroDraft;
|
|
843
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
844
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
845
|
+
case 0:
|
|
846
|
+
libraryId = _ref10.libraryId, objectId = _ref10.objectId;
|
|
847
|
+
ValidateParameters({
|
|
848
|
+
libraryId: libraryId,
|
|
849
|
+
objectId: objectId
|
|
850
|
+
});
|
|
851
|
+
_context6.next = 4;
|
|
852
|
+
return this.LRODraftInfo({
|
|
853
|
+
libraryId: libraryId,
|
|
854
|
+
objectId: objectId
|
|
855
|
+
});
|
|
856
|
+
case 4:
|
|
857
|
+
lroDraft = _context6.sent;
|
|
858
|
+
this.HttpClient.RecordWriteToken(lroDraft.write_token, lroDraft.node);
|
|
859
|
+
_context6.next = 8;
|
|
860
|
+
return this.ContentObjectMetadata({
|
|
861
|
+
libraryId: libraryId,
|
|
862
|
+
objectId: objectId,
|
|
863
|
+
writeToken: lroDraft.write_token,
|
|
864
|
+
metadataSubtree: "lro_status"
|
|
865
|
+
});
|
|
866
|
+
case 8:
|
|
867
|
+
return _context6.abrupt("return", _context6.sent);
|
|
868
|
+
case 9:
|
|
869
|
+
case "end":
|
|
870
|
+
return _context6.stop();
|
|
871
|
+
}
|
|
872
|
+
}, _callee6, this);
|
|
873
|
+
}));
|
|
874
|
+
return function (_x6) {
|
|
875
|
+
return _ref11.apply(this, arguments);
|
|
876
|
+
};
|
|
877
|
+
}();
|
|
878
|
+
|
|
945
879
|
/**
|
|
946
880
|
* Finalize a mezzanine object after all jobs have finished
|
|
947
881
|
*
|
|
@@ -950,193 +884,129 @@ exports.LROStatus = /*#__PURE__*/function () {
|
|
|
950
884
|
* @param {string} libraryId - ID of the mezzanine library
|
|
951
885
|
* @param {string} objectId - ID of the mezzanine object
|
|
952
886
|
* @param {string} writeToken - Write token for the mezzanine object
|
|
953
|
-
* @param {string=} offeringKey=default - The offering to process
|
|
954
887
|
* @param {function=} preFinalizeFn - A function to call before finalizing changes, to allow further modifications to offering. The function will be invoked with {elvClient, nodeUrl, writeToken} to allow access to the draft and MUST NOT finalize the draft.
|
|
955
888
|
* @param {boolean=} preFinalizeThrow - If set to `true` then any error thrown by preFinalizeFn will not be caught. Otherwise, any exception will be appended to the `warnings` array returned after finalization.
|
|
956
889
|
*
|
|
957
890
|
* @return {Promise<Object>} - The finalize response for the mezzanine object, as well as any logs, warnings and errors from the finalization
|
|
958
891
|
*/
|
|
959
|
-
|
|
960
|
-
|
|
961
892
|
exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
962
|
-
var
|
|
963
|
-
var libraryId, objectId,
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
libraryId
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
return "Bearer ".concat(token);
|
|
1031
|
-
}).join(",")
|
|
1032
|
-
};
|
|
1033
|
-
_context6.next = 24;
|
|
1034
|
-
return this.CallBitcodeMethod({
|
|
1035
|
-
objectId: objectId,
|
|
1036
|
-
libraryId: libraryId,
|
|
1037
|
-
writeToken: lroDraft.write_token,
|
|
1038
|
-
method: UrlJoin("media", "abr_mezzanine", "offerings", offeringKey, "finalize"),
|
|
1039
|
-
headers: headers,
|
|
1040
|
-
constant: false
|
|
1041
|
-
});
|
|
1042
|
-
|
|
1043
|
-
case 24:
|
|
1044
|
-
_yield$this$CallBitco4 = _context6.sent;
|
|
1045
|
-
data = _yield$this$CallBitco4.data;
|
|
1046
|
-
errors = _yield$this$CallBitco4.errors;
|
|
1047
|
-
warnings = _yield$this$CallBitco4.warnings;
|
|
1048
|
-
logs = _yield$this$CallBitco4.logs;
|
|
1049
|
-
preFinalizeWarnings = [];
|
|
1050
|
-
|
|
1051
|
-
if (!preFinalizeFn) {
|
|
1052
|
-
_context6.next = 45;
|
|
1053
|
-
break;
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
params = {
|
|
1057
|
-
elvClient: this,
|
|
1058
|
-
nodeUrl: lroDraft.node,
|
|
1059
|
-
writeToken: lroDraft.write_token
|
|
1060
|
-
};
|
|
1061
|
-
|
|
1062
|
-
if (!preFinalizeThrow) {
|
|
1063
|
-
_context6.next = 37;
|
|
1064
|
-
break;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
_context6.next = 35;
|
|
1068
|
-
return preFinalizeFn(params);
|
|
1069
|
-
|
|
1070
|
-
case 35:
|
|
1071
|
-
_context6.next = 45;
|
|
1072
|
-
break;
|
|
1073
|
-
|
|
1074
|
-
case 37:
|
|
1075
|
-
_context6.prev = 37;
|
|
1076
|
-
_context6.next = 40;
|
|
1077
|
-
return preFinalizeFn(params);
|
|
1078
|
-
|
|
1079
|
-
case 40:
|
|
1080
|
-
_context6.next = 45;
|
|
893
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref12) {
|
|
894
|
+
var libraryId, objectId, preFinalizeFn, preFinalizeThrow, lroDraft, lastJobOfferingsInfo, offeringKey, masterHash, authorizationTokens, headers, _yield$this$CallBitco4, data, errors, warnings, logs, preFinalizeWarnings, params, finalizeResponse;
|
|
895
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
896
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
897
|
+
case 0:
|
|
898
|
+
libraryId = _ref12.libraryId, objectId = _ref12.objectId, preFinalizeFn = _ref12.preFinalizeFn, preFinalizeThrow = _ref12.preFinalizeThrow;
|
|
899
|
+
ValidateParameters({
|
|
900
|
+
libraryId: libraryId,
|
|
901
|
+
objectId: objectId
|
|
902
|
+
});
|
|
903
|
+
_context7.next = 4;
|
|
904
|
+
return this.LRODraftInfo({
|
|
905
|
+
libraryId: libraryId,
|
|
906
|
+
objectId: objectId
|
|
907
|
+
});
|
|
908
|
+
case 4:
|
|
909
|
+
lroDraft = _context7.sent;
|
|
910
|
+
// tell http client what node to contact for this write token
|
|
911
|
+
this.HttpClient.RecordWriteToken(lroDraft.write_token, lroDraft.node);
|
|
912
|
+
_context7.next = 8;
|
|
913
|
+
return this.ContentObjectMetadata({
|
|
914
|
+
libraryId: libraryId,
|
|
915
|
+
objectId: objectId,
|
|
916
|
+
writeToken: lroDraft.write_token,
|
|
917
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
918
|
+
});
|
|
919
|
+
case 8:
|
|
920
|
+
lastJobOfferingsInfo = _context7.sent;
|
|
921
|
+
offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
922
|
+
masterHash = lastJobOfferingsInfo[offeringKey].prod_master_hash; // Authorization token for mezzanine and master
|
|
923
|
+
_context7.next = 13;
|
|
924
|
+
return this.authClient.AuthorizationToken({
|
|
925
|
+
libraryId: libraryId,
|
|
926
|
+
objectId: objectId,
|
|
927
|
+
update: true
|
|
928
|
+
});
|
|
929
|
+
case 13:
|
|
930
|
+
_context7.t0 = _context7.sent;
|
|
931
|
+
_context7.next = 16;
|
|
932
|
+
return this.authClient.AuthorizationToken({
|
|
933
|
+
versionHash: masterHash
|
|
934
|
+
});
|
|
935
|
+
case 16:
|
|
936
|
+
_context7.t1 = _context7.sent;
|
|
937
|
+
authorizationTokens = [_context7.t0, _context7.t1];
|
|
938
|
+
headers = {
|
|
939
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
940
|
+
return "Bearer ".concat(token);
|
|
941
|
+
}).join(",")
|
|
942
|
+
};
|
|
943
|
+
_context7.next = 21;
|
|
944
|
+
return this.CallBitcodeMethod({
|
|
945
|
+
objectId: objectId,
|
|
946
|
+
libraryId: libraryId,
|
|
947
|
+
writeToken: lroDraft.write_token,
|
|
948
|
+
method: UrlJoin("media", "abr_mezzanine", "offerings", offeringKey, "finalize"),
|
|
949
|
+
headers: headers,
|
|
950
|
+
constant: false
|
|
951
|
+
});
|
|
952
|
+
case 21:
|
|
953
|
+
_yield$this$CallBitco4 = _context7.sent;
|
|
954
|
+
data = _yield$this$CallBitco4.data;
|
|
955
|
+
errors = _yield$this$CallBitco4.errors;
|
|
956
|
+
warnings = _yield$this$CallBitco4.warnings;
|
|
957
|
+
logs = _yield$this$CallBitco4.logs;
|
|
958
|
+
preFinalizeWarnings = [];
|
|
959
|
+
if (!preFinalizeFn) {
|
|
960
|
+
_context7.next = 41;
|
|
1081
961
|
break;
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
finalizeResponse = _context6.sent;
|
|
1100
|
-
result = _objectSpread({
|
|
1101
|
-
data: data,
|
|
1102
|
-
logs: logs || [],
|
|
1103
|
-
warnings: (warnings || []).concat(preFinalizeWarnings),
|
|
1104
|
-
errors: errors || []
|
|
1105
|
-
}, finalizeResponse);
|
|
1106
|
-
_context6.next = 54;
|
|
962
|
+
}
|
|
963
|
+
params = {
|
|
964
|
+
elvClient: this,
|
|
965
|
+
nodeUrl: lroDraft.node,
|
|
966
|
+
writeToken: lroDraft.write_token
|
|
967
|
+
};
|
|
968
|
+
_context7.prev = 29;
|
|
969
|
+
_context7.next = 32;
|
|
970
|
+
return preFinalizeFn(params);
|
|
971
|
+
case 32:
|
|
972
|
+
_context7.next = 41;
|
|
973
|
+
break;
|
|
974
|
+
case 34:
|
|
975
|
+
_context7.prev = 34;
|
|
976
|
+
_context7.t2 = _context7["catch"](29);
|
|
977
|
+
if (!preFinalizeThrow) {
|
|
978
|
+
_context7.next = 40;
|
|
1107
979
|
break;
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
}
|
|
980
|
+
}
|
|
981
|
+
throw new Error("Error running preFinalize function", {
|
|
982
|
+
cause: _context7.t2
|
|
983
|
+
});
|
|
984
|
+
case 40:
|
|
985
|
+
preFinalizeWarnings = "Error running preFinalize function: ".concat(_context7.t2);
|
|
986
|
+
case 41:
|
|
987
|
+
_context7.next = 43;
|
|
988
|
+
return this.FinalizeContentObject({
|
|
989
|
+
libraryId: libraryId,
|
|
990
|
+
objectId: objectId,
|
|
991
|
+
writeToken: lroDraft.write_token,
|
|
992
|
+
commitMessage: "Finalize ABR mezzanine",
|
|
993
|
+
awaitCommitConfirmation: false
|
|
994
|
+
});
|
|
995
|
+
case 43:
|
|
996
|
+
finalizeResponse = _context7.sent;
|
|
997
|
+
return _context7.abrupt("return", _objectSpread({
|
|
998
|
+
data: data,
|
|
999
|
+
logs: logs || [],
|
|
1000
|
+
warnings: (warnings || []).concat(preFinalizeWarnings),
|
|
1001
|
+
errors: errors || []
|
|
1002
|
+
}, finalizeResponse));
|
|
1003
|
+
case 45:
|
|
1004
|
+
case "end":
|
|
1005
|
+
return _context7.stop();
|
|
1135
1006
|
}
|
|
1136
|
-
},
|
|
1007
|
+
}, _callee7, this, [[29, 34]]);
|
|
1137
1008
|
}));
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
return _ref11.apply(this, arguments);
|
|
1009
|
+
return function (_x7) {
|
|
1010
|
+
return _ref13.apply(this, arguments);
|
|
1141
1011
|
};
|
|
1142
1012
|
}();
|