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