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