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