@eluvio/elv-client-js 4.2.10 → 4.2.11
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 +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +723 -710
- package/dist/src/ContentObjectAudit.js +56 -56
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/Crypto.js +85 -85
- package/dist/src/ElvClient.js +500 -530
- package/dist/src/ElvWallet.js +28 -30
- package/dist/src/EthClient.js +311 -311
- package/dist/src/FrameClient.js +64 -63
- package/dist/src/HttpClient.js +60 -60
- package/dist/src/Id.js +2 -1
- package/dist/src/PermissionsClient.js +487 -499
- package/dist/src/RemoteSigner.js +163 -114
- package/dist/src/UserProfileClient.js +374 -392
- package/dist/src/Utils.js +66 -69
- package/dist/src/Validation.js +10 -10
- package/dist/src/client/ABRPublishing.js +238 -238
- package/dist/src/client/AccessGroups.js +474 -477
- package/dist/src/client/ContentAccess.js +1709 -1705
- package/dist/src/client/ContentManagement.js +871 -871
- package/dist/src/client/Contracts.js +578 -575
- package/dist/src/client/Files.js +684 -700
- package/dist/src/client/LiveConf.js +6 -1
- package/dist/src/client/LiveStream.js +686 -723
- package/dist/src/client/NFT.js +14 -14
- package/dist/src/client/NTP.js +84 -84
- package/dist/src/client/Shares.js +60 -53
- package/dist/src/walletClient/ClientMethods.js +951 -977
- package/dist/src/walletClient/Notifications.js +14 -14
- package/dist/src/walletClient/Profile.js +66 -66
- package/dist/src/walletClient/Utils.js +15 -15
- package/dist/src/walletClient/index.js +581 -579
- package/package.json +1 -1
- package/src/client/LiveConf.js +5 -1
- package/src/client/LiveStream.js +9 -39
|
@@ -90,89 +90,89 @@ var MezJobMainOfferingKey = function MezJobMainOfferingKey(abrMezOfferings) {
|
|
|
90
90
|
* @return {Object} - The finalize response for the object, as well as logs, warnings and errors from the master initialization
|
|
91
91
|
*/
|
|
92
92
|
exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
93
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
93
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
94
94
|
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;
|
|
95
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
95
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
96
96
|
while (1) switch (_context.prev = _context.next) {
|
|
97
97
|
case 0:
|
|
98
98
|
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;
|
|
99
99
|
ValidateLibrary(libraryId);
|
|
100
100
|
finalize = !writeToken;
|
|
101
101
|
if (!writeToken) {
|
|
102
|
-
_context.next =
|
|
102
|
+
_context.next = 7;
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
// if write token passed in, don't create a new object
|
|
106
106
|
objectId = this.utils.DecodeWriteToken(writeToken).objectId;
|
|
107
|
-
_context.next =
|
|
107
|
+
_context.next = 12;
|
|
108
108
|
break;
|
|
109
|
-
case
|
|
110
|
-
_context.next =
|
|
109
|
+
case 7:
|
|
110
|
+
_context.next = 9;
|
|
111
111
|
return this.CreateContentObject({
|
|
112
112
|
libraryId: libraryId,
|
|
113
113
|
options: type ? {
|
|
114
114
|
type: type
|
|
115
115
|
} : {}
|
|
116
116
|
});
|
|
117
|
-
case
|
|
117
|
+
case 9:
|
|
118
118
|
_yield$this$CreateCon = _context.sent;
|
|
119
119
|
objectId = _yield$this$CreateCon.objectId;
|
|
120
120
|
writeToken = _yield$this$CreateCon.writeToken;
|
|
121
|
-
case
|
|
121
|
+
case 12:
|
|
122
122
|
if (!fileInfo) {
|
|
123
|
-
_context.next =
|
|
123
|
+
_context.next = 64;
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
if (!(access.length > 0)) {
|
|
127
|
-
_context.next =
|
|
127
|
+
_context.next = 62;
|
|
128
128
|
break;
|
|
129
129
|
}
|
|
130
130
|
// S3 Upload
|
|
131
131
|
s3prefixRegex = /^s3:\/\/([^/]+)\//i; // for matching and extracting bucket name when full s3:// path is specified
|
|
132
132
|
// batch the cloud storage files by matching credential set, check each file's source path against credential set path_matchers
|
|
133
133
|
i = 0;
|
|
134
|
-
case
|
|
134
|
+
case 16:
|
|
135
135
|
if (!(i < fileInfo.length)) {
|
|
136
|
-
_context.next =
|
|
136
|
+
_context.next = 47;
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
139
|
oneFileInfo = fileInfo[i];
|
|
140
140
|
matched = false;
|
|
141
141
|
j = 0;
|
|
142
|
-
case
|
|
142
|
+
case 20:
|
|
143
143
|
if (!(!matched && j < access.length)) {
|
|
144
|
-
_context.next =
|
|
144
|
+
_context.next = 42;
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
147
|
credentialSet = access[j]; // strip trailing slash to get bucket name for credential set
|
|
148
148
|
credentialSetBucket = credentialSet.remote_access.path.replace(/\/$/, "");
|
|
149
149
|
matchers = credentialSet.path_matchers;
|
|
150
150
|
k = 0;
|
|
151
|
-
case
|
|
151
|
+
case 25:
|
|
152
152
|
if (!(!matched && k < matchers.length)) {
|
|
153
|
-
_context.next =
|
|
153
|
+
_context.next = 39;
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
156
|
matcher = new RegExp(matchers[k]);
|
|
157
157
|
fileSourcePath = oneFileInfo.source;
|
|
158
158
|
if (!matcher.test(fileSourcePath)) {
|
|
159
|
-
_context.next =
|
|
159
|
+
_context.next = 36;
|
|
160
160
|
break;
|
|
161
161
|
}
|
|
162
162
|
matched = true;
|
|
163
163
|
// if full s3 path supplied, check bucket name
|
|
164
164
|
s3prefixMatch = s3prefixRegex.exec(fileSourcePath);
|
|
165
165
|
if (!s3prefixMatch) {
|
|
166
|
-
_context.next =
|
|
166
|
+
_context.next = 35;
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
bucketName = s3prefixMatch[1];
|
|
170
170
|
if (!(bucketName !== credentialSetBucket)) {
|
|
171
|
-
_context.next =
|
|
171
|
+
_context.next = 35;
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
throw Error("Full S3 file path \"" + fileSourcePath + "\" matched to credential set with different bucket name '" + credentialSetBucket + "'");
|
|
175
|
-
case
|
|
175
|
+
case 35:
|
|
176
176
|
if (credentialSet.hasOwnProperty("matched")) {
|
|
177
177
|
credentialSet.matched.push(oneFileInfo);
|
|
178
178
|
} else {
|
|
@@ -180,41 +180,41 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
180
180
|
// initialize new 'matched' property to 1-element array
|
|
181
181
|
credentialSet.matched = [oneFileInfo];
|
|
182
182
|
}
|
|
183
|
-
case
|
|
183
|
+
case 36:
|
|
184
184
|
k++;
|
|
185
|
-
_context.next =
|
|
185
|
+
_context.next = 25;
|
|
186
186
|
break;
|
|
187
|
-
case
|
|
187
|
+
case 39:
|
|
188
188
|
j++;
|
|
189
|
-
_context.next =
|
|
189
|
+
_context.next = 20;
|
|
190
190
|
break;
|
|
191
|
-
case
|
|
191
|
+
case 42:
|
|
192
192
|
if (matched) {
|
|
193
|
-
_context.next =
|
|
193
|
+
_context.next = 44;
|
|
194
194
|
break;
|
|
195
195
|
}
|
|
196
196
|
throw Error("no credential set found for file path: \"" + filePath + "\"");
|
|
197
|
-
case
|
|
197
|
+
case 44:
|
|
198
198
|
i++;
|
|
199
|
-
_context.next =
|
|
199
|
+
_context.next = 16;
|
|
200
200
|
break;
|
|
201
|
-
case
|
|
201
|
+
case 47:
|
|
202
202
|
_i = 0;
|
|
203
|
-
case
|
|
203
|
+
case 48:
|
|
204
204
|
if (!(_i < access.length)) {
|
|
205
|
-
_context.next =
|
|
205
|
+
_context.next = 60;
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
208
|
_credentialSet = access[_i];
|
|
209
209
|
if (!(_credentialSet.hasOwnProperty("matched") && _credentialSet.matched.length > 0)) {
|
|
210
|
-
_context.next =
|
|
210
|
+
_context.next = 57;
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
213
|
region = _credentialSet.remote_access.storage_endpoint.region;
|
|
214
214
|
bucket = _credentialSet.remote_access.path.replace(/\/$/, "");
|
|
215
215
|
accessKey = _credentialSet.remote_access.cloud_credentials.access_key_id;
|
|
216
216
|
secret = _credentialSet.remote_access.cloud_credentials.secret_access_key;
|
|
217
|
-
_context.next =
|
|
217
|
+
_context.next = 57;
|
|
218
218
|
return this.UploadFilesFromS3({
|
|
219
219
|
libraryId: libraryId,
|
|
220
220
|
objectId: objectId,
|
|
@@ -228,15 +228,15 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
228
228
|
callback: callback,
|
|
229
229
|
encryption: encrypt ? "cgck" : "none"
|
|
230
230
|
});
|
|
231
|
-
case
|
|
231
|
+
case 57:
|
|
232
232
|
_i++;
|
|
233
|
-
_context.next =
|
|
233
|
+
_context.next = 48;
|
|
234
234
|
break;
|
|
235
|
-
case
|
|
236
|
-
_context.next =
|
|
235
|
+
case 60:
|
|
236
|
+
_context.next = 64;
|
|
237
237
|
break;
|
|
238
|
-
case
|
|
239
|
-
_context.next =
|
|
238
|
+
case 62:
|
|
239
|
+
_context.next = 64;
|
|
240
240
|
return this.UploadFiles({
|
|
241
241
|
libraryId: libraryId,
|
|
242
242
|
objectId: objectId,
|
|
@@ -245,16 +245,16 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
245
245
|
callback: callback,
|
|
246
246
|
encryption: encrypt ? "cgck" : "none"
|
|
247
247
|
});
|
|
248
|
-
case
|
|
249
|
-
_context.next =
|
|
248
|
+
case 64:
|
|
249
|
+
_context.next = 66;
|
|
250
250
|
return this.CreateEncryptionConk({
|
|
251
251
|
libraryId: libraryId,
|
|
252
252
|
objectId: objectId,
|
|
253
253
|
writeToken: writeToken,
|
|
254
254
|
createKMSConk: true
|
|
255
255
|
});
|
|
256
|
-
case
|
|
257
|
-
_context.next =
|
|
256
|
+
case 66:
|
|
257
|
+
_context.next = 68;
|
|
258
258
|
return this.CallBitcodeMethod({
|
|
259
259
|
libraryId: libraryId,
|
|
260
260
|
objectId: objectId,
|
|
@@ -269,12 +269,12 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
269
269
|
},
|
|
270
270
|
constant: false
|
|
271
271
|
});
|
|
272
|
-
case
|
|
272
|
+
case 68:
|
|
273
273
|
_yield$this$CallBitco = _context.sent;
|
|
274
274
|
logs = _yield$this$CallBitco.logs;
|
|
275
275
|
errors = _yield$this$CallBitco.errors;
|
|
276
276
|
warnings = _yield$this$CallBitco.warnings;
|
|
277
|
-
_context.next =
|
|
277
|
+
_context.next = 74;
|
|
278
278
|
return this.MergeMetadata({
|
|
279
279
|
libraryId: libraryId,
|
|
280
280
|
objectId: objectId,
|
|
@@ -290,12 +290,12 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
290
290
|
elv_created_at: new Date().getTime()
|
|
291
291
|
})
|
|
292
292
|
});
|
|
293
|
-
case
|
|
293
|
+
case 74:
|
|
294
294
|
if (!finalize) {
|
|
295
|
-
_context.next =
|
|
295
|
+
_context.next = 80;
|
|
296
296
|
break;
|
|
297
297
|
}
|
|
298
|
-
_context.next =
|
|
298
|
+
_context.next = 77;
|
|
299
299
|
return this.FinalizeContentObject({
|
|
300
300
|
libraryId: libraryId,
|
|
301
301
|
objectId: objectId,
|
|
@@ -303,24 +303,24 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
303
303
|
commitMessage: "Create master",
|
|
304
304
|
awaitCommitConfirmation: false
|
|
305
305
|
});
|
|
306
|
-
case
|
|
306
|
+
case 77:
|
|
307
307
|
additionalReturnVals = _context.sent;
|
|
308
|
-
_context.next =
|
|
308
|
+
_context.next = 81;
|
|
309
309
|
break;
|
|
310
|
-
case
|
|
310
|
+
case 80:
|
|
311
311
|
additionalReturnVals = {
|
|
312
312
|
write_token: writeToken,
|
|
313
313
|
type: type,
|
|
314
314
|
qlib_id: libraryId,
|
|
315
315
|
id: objectId
|
|
316
316
|
};
|
|
317
|
-
case
|
|
317
|
+
case 81:
|
|
318
318
|
return _context.abrupt("return", _objectSpread({
|
|
319
319
|
errors: errors || [],
|
|
320
320
|
logs: logs || [],
|
|
321
321
|
warnings: warnings || []
|
|
322
322
|
}, additionalReturnVals));
|
|
323
|
-
case
|
|
323
|
+
case 82:
|
|
324
324
|
case "end":
|
|
325
325
|
return _context.stop();
|
|
326
326
|
}
|
|
@@ -357,51 +357,51 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
357
357
|
* @return {Object} - The finalize response for the object, as well as logs, warnings and errors from the mezzanine initialization
|
|
358
358
|
*/
|
|
359
359
|
exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
360
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
361
|
-
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
|
|
362
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
360
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
361
|
+
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;
|
|
362
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
363
363
|
while (1) switch (_context2.prev = _context2.next) {
|
|
364
364
|
case 0:
|
|
365
365
|
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;
|
|
366
366
|
if (!(!masterVersionHash && !masterWriteToken)) {
|
|
367
|
-
_context2.next =
|
|
367
|
+
_context2.next = 3;
|
|
368
368
|
break;
|
|
369
369
|
}
|
|
370
370
|
throw Error("Neither master version hash nor master write token specified. One must be provided");
|
|
371
|
-
case
|
|
371
|
+
case 3:
|
|
372
372
|
if (!(masterVersionHash && masterWriteToken)) {
|
|
373
|
-
_context2.next =
|
|
373
|
+
_context2.next = 5;
|
|
374
374
|
break;
|
|
375
375
|
}
|
|
376
376
|
throw Error("Both master version hash and master write token specified. Only one can be provided");
|
|
377
|
-
case
|
|
377
|
+
case 5:
|
|
378
378
|
// double-check library id for mez
|
|
379
379
|
ValidateLibrary(libraryId);
|
|
380
380
|
|
|
381
381
|
// The following 2 vars are used only if masterWriteToken is passed in (to retrieve master name)
|
|
382
382
|
if (!masterVersionHash) {
|
|
383
|
-
_context2.next =
|
|
383
|
+
_context2.next = 10;
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
// NOTE: masterObjectId is left undefined if masterWriteToken not passed in
|
|
387
387
|
ValidateVersion(masterVersionHash);
|
|
388
|
-
_context2.next =
|
|
388
|
+
_context2.next = 16;
|
|
389
389
|
break;
|
|
390
|
-
case
|
|
390
|
+
case 10:
|
|
391
391
|
if (!masterWriteToken) {
|
|
392
|
-
_context2.next =
|
|
392
|
+
_context2.next = 16;
|
|
393
393
|
break;
|
|
394
394
|
}
|
|
395
395
|
// determine master object id if a master write token was passed in
|
|
396
396
|
ValidateWriteToken(masterWriteToken);
|
|
397
397
|
masterObjectId = this.utils.DecodeWriteToken(masterWriteToken).objectId;
|
|
398
|
-
_context2.next =
|
|
398
|
+
_context2.next = 15;
|
|
399
399
|
return client.ContentObjectLibraryId({
|
|
400
|
-
|
|
400
|
+
objectId: masterObjectId
|
|
401
401
|
});
|
|
402
|
-
case
|
|
402
|
+
case 15:
|
|
403
403
|
masterLibId = _context2.sent;
|
|
404
|
-
case
|
|
404
|
+
case 16:
|
|
405
405
|
// if pre-existing mez object id passed in, validate
|
|
406
406
|
if (objectId) ValidateObject(objectId);
|
|
407
407
|
|
|
@@ -416,57 +416,57 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
416
416
|
// meaning we must create a new object
|
|
417
417
|
useExistingMez = !!objectId; // type coerce string or undefined to boolean: "" -> false, undefined -> false, all else -> true
|
|
418
418
|
if (!(!objectId && keepOtherStreams)) {
|
|
419
|
-
_context2.next =
|
|
419
|
+
_context2.next = 21;
|
|
420
420
|
break;
|
|
421
421
|
}
|
|
422
422
|
throw Error("Existing mezzanine object ID required in order to use 'keepOtherStreams'");
|
|
423
|
-
case
|
|
423
|
+
case 21:
|
|
424
424
|
if (!(addlOfferingSpecs && !abrProfile)) {
|
|
425
|
-
_context2.next =
|
|
425
|
+
_context2.next = 23;
|
|
426
426
|
break;
|
|
427
427
|
}
|
|
428
428
|
throw Error("abrProfile required when using addlOfferingSpecs");
|
|
429
|
-
case
|
|
429
|
+
case 23:
|
|
430
430
|
options = type ? {
|
|
431
431
|
type: type
|
|
432
432
|
} : {};
|
|
433
433
|
finalize = !writeToken; // are we ingesting to an existing mez (and did NOT supply a write token?)
|
|
434
434
|
if (!(useExistingMez && !writeToken)) {
|
|
435
|
-
_context2.next =
|
|
435
|
+
_context2.next = 30;
|
|
436
436
|
break;
|
|
437
437
|
}
|
|
438
|
-
_context2.next =
|
|
438
|
+
_context2.next = 28;
|
|
439
439
|
return this.EditContentObject({
|
|
440
440
|
libraryId: libraryId,
|
|
441
441
|
objectId: objectId,
|
|
442
442
|
options: options
|
|
443
443
|
});
|
|
444
|
-
case
|
|
444
|
+
case 28:
|
|
445
445
|
_yield$this$EditConte = _context2.sent;
|
|
446
446
|
writeToken = _yield$this$EditConte.writeToken;
|
|
447
|
-
case
|
|
447
|
+
case 30:
|
|
448
448
|
if (useExistingMez) {
|
|
449
|
-
_context2.next =
|
|
449
|
+
_context2.next = 36;
|
|
450
450
|
break;
|
|
451
451
|
}
|
|
452
|
-
_context2.next =
|
|
452
|
+
_context2.next = 33;
|
|
453
453
|
return this.CreateContentObject({
|
|
454
454
|
libraryId: libraryId,
|
|
455
455
|
options: options
|
|
456
456
|
});
|
|
457
|
-
case
|
|
457
|
+
case 33:
|
|
458
458
|
_yield$this$CreateCon2 = _context2.sent;
|
|
459
459
|
objectId = _yield$this$CreateCon2.objectId;
|
|
460
460
|
writeToken = _yield$this$CreateCon2.writeToken;
|
|
461
|
-
case
|
|
462
|
-
_context2.next =
|
|
461
|
+
case 36:
|
|
462
|
+
_context2.next = 38;
|
|
463
463
|
return this.CreateEncryptionConk({
|
|
464
464
|
libraryId: libraryId,
|
|
465
465
|
objectId: objectId,
|
|
466
466
|
writeToken: writeToken,
|
|
467
467
|
createKMSConk: true
|
|
468
468
|
});
|
|
469
|
-
case
|
|
469
|
+
case 38:
|
|
470
470
|
// figure out where to read master metadata from
|
|
471
471
|
masterMetaSource = masterWriteToken ? {
|
|
472
472
|
libraryId: masterLibId,
|
|
@@ -475,41 +475,41 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
475
475
|
} : {
|
|
476
476
|
versionHash: masterVersionHash
|
|
477
477
|
};
|
|
478
|
-
_context2.next =
|
|
478
|
+
_context2.next = 41;
|
|
479
479
|
return this.ContentObjectMetadata(_objectSpread(_objectSpread({}, masterMetaSource), {}, {
|
|
480
480
|
metadataSubtree: "public/name"
|
|
481
481
|
}));
|
|
482
|
-
case
|
|
482
|
+
case 41:
|
|
483
483
|
masterName = _context2.sent;
|
|
484
484
|
// Include authorization for library, master, and mezzanine
|
|
485
485
|
authorizationTokens = [];
|
|
486
|
-
|
|
487
|
-
_context2.next =
|
|
486
|
+
_context2.t0 = authorizationTokens;
|
|
487
|
+
_context2.next = 46;
|
|
488
488
|
return this.authClient.AuthorizationToken({
|
|
489
489
|
libraryId: libraryId,
|
|
490
490
|
objectId: objectId,
|
|
491
491
|
update: true
|
|
492
492
|
});
|
|
493
|
-
case
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
_context2.next =
|
|
493
|
+
case 46:
|
|
494
|
+
_context2.t1 = _context2.sent;
|
|
495
|
+
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
496
|
+
_context2.t2 = authorizationTokens;
|
|
497
|
+
_context2.next = 51;
|
|
498
498
|
return this.authClient.AuthorizationToken({
|
|
499
499
|
libraryId: libraryId
|
|
500
500
|
});
|
|
501
|
-
case
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
_context2.next =
|
|
501
|
+
case 51:
|
|
502
|
+
_context2.t3 = _context2.sent;
|
|
503
|
+
_context2.t2.push.call(_context2.t2, _context2.t3);
|
|
504
|
+
_context2.t4 = authorizationTokens;
|
|
505
|
+
_context2.next = 56;
|
|
506
506
|
return this.authClient.AuthorizationToken({
|
|
507
507
|
versionHash: masterVersionHash,
|
|
508
508
|
objectId: masterObjectId
|
|
509
509
|
});
|
|
510
|
-
case
|
|
511
|
-
|
|
512
|
-
|
|
510
|
+
case 56:
|
|
511
|
+
_context2.t5 = _context2.sent;
|
|
512
|
+
_context2.t4.push.call(_context2.t4, _context2.t5);
|
|
513
513
|
headers = {
|
|
514
514
|
Authorization: authorizationTokens.map(function (token) {
|
|
515
515
|
return "Bearer ".concat(token);
|
|
@@ -524,35 +524,35 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
524
524
|
variant_key: variant
|
|
525
525
|
};
|
|
526
526
|
if (!abrProfile) {
|
|
527
|
-
_context2.next =
|
|
527
|
+
_context2.next = 65;
|
|
528
528
|
break;
|
|
529
529
|
}
|
|
530
530
|
body.abr_profile = abrProfile;
|
|
531
531
|
storeClear = abrProfile.store_clear;
|
|
532
|
-
_context2.next =
|
|
532
|
+
_context2.next = 68;
|
|
533
533
|
break;
|
|
534
|
-
case
|
|
535
|
-
_context2.next =
|
|
534
|
+
case 65:
|
|
535
|
+
_context2.next = 67;
|
|
536
536
|
return this.ContentObjectMetadata({
|
|
537
537
|
libraryId: libraryId,
|
|
538
538
|
objectId: this.utils.AddressToObjectId(this.utils.HashToAddress(libraryId)),
|
|
539
539
|
metadataSubtree: "abr_profile/store_clear"
|
|
540
540
|
});
|
|
541
|
-
case
|
|
541
|
+
case 67:
|
|
542
542
|
storeClear = _context2.sent;
|
|
543
|
-
case
|
|
543
|
+
case 68:
|
|
544
544
|
if (storeClear) {
|
|
545
|
-
_context2.next =
|
|
545
|
+
_context2.next = 71;
|
|
546
546
|
break;
|
|
547
547
|
}
|
|
548
|
-
_context2.next =
|
|
548
|
+
_context2.next = 71;
|
|
549
549
|
return this.EncryptionConk({
|
|
550
550
|
libraryId: libraryId,
|
|
551
551
|
objectId: objectId,
|
|
552
552
|
writeToken: writeToken
|
|
553
553
|
});
|
|
554
|
-
case
|
|
555
|
-
_context2.next =
|
|
554
|
+
case 71:
|
|
555
|
+
_context2.next = 73;
|
|
556
556
|
return this.CallBitcodeMethod({
|
|
557
557
|
libraryId: libraryId,
|
|
558
558
|
objectId: objectId,
|
|
@@ -566,7 +566,7 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
566
566
|
body: body,
|
|
567
567
|
constant: false
|
|
568
568
|
});
|
|
569
|
-
case
|
|
569
|
+
case 73:
|
|
570
570
|
_yield$this$CallBitco2 = _context2.sent;
|
|
571
571
|
logs = _yield$this$CallBitco2.logs;
|
|
572
572
|
errors = _yield$this$CallBitco2.errors;
|
|
@@ -607,13 +607,13 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
// retrieve existing metadata to merge with updated metadata
|
|
610
|
-
_context2.next =
|
|
610
|
+
_context2.next = 88;
|
|
611
611
|
return this.ContentObjectMetadata({
|
|
612
612
|
libraryId: libraryId,
|
|
613
613
|
objectId: objectId,
|
|
614
614
|
writeToken: writeToken
|
|
615
615
|
});
|
|
616
|
-
case
|
|
616
|
+
case 88:
|
|
617
617
|
existingMetadata = _context2.sent;
|
|
618
618
|
// newer metadata values replace existing metadata, unless both new and old values are objects,
|
|
619
619
|
// in which case their keys are merged recursively
|
|
@@ -624,43 +624,43 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
624
624
|
}
|
|
625
625
|
|
|
626
626
|
// write metadata to mezzanine object
|
|
627
|
-
_context2.next =
|
|
627
|
+
_context2.next = 93;
|
|
628
628
|
return this.ReplaceMetadata({
|
|
629
629
|
libraryId: libraryId,
|
|
630
630
|
objectId: objectId,
|
|
631
631
|
writeToken: writeToken,
|
|
632
632
|
metadata: metadata
|
|
633
633
|
});
|
|
634
|
-
case
|
|
634
|
+
case 93:
|
|
635
635
|
if (!finalize) {
|
|
636
|
-
_context2.next =
|
|
636
|
+
_context2.next = 99;
|
|
637
637
|
break;
|
|
638
638
|
}
|
|
639
|
-
_context2.next =
|
|
639
|
+
_context2.next = 96;
|
|
640
640
|
return this.FinalizeContentObject({
|
|
641
641
|
libraryId: libraryId,
|
|
642
642
|
objectId: objectId,
|
|
643
643
|
writeToken: writeToken,
|
|
644
644
|
commitMessage: "Create ABR mezzanine"
|
|
645
645
|
});
|
|
646
|
-
case
|
|
646
|
+
case 96:
|
|
647
647
|
additionalReturnVals = _context2.sent;
|
|
648
|
-
_context2.next =
|
|
648
|
+
_context2.next = 100;
|
|
649
649
|
break;
|
|
650
|
-
case
|
|
650
|
+
case 99:
|
|
651
651
|
additionalReturnVals = {
|
|
652
652
|
write_token: writeToken,
|
|
653
653
|
type: type,
|
|
654
654
|
qlib_id: libraryId,
|
|
655
655
|
id: objectId
|
|
656
656
|
};
|
|
657
|
-
case
|
|
657
|
+
case 100:
|
|
658
658
|
return _context2.abrupt("return", _objectSpread({
|
|
659
659
|
logs: logs || [],
|
|
660
660
|
warnings: warnings || [],
|
|
661
661
|
errors: errors || []
|
|
662
662
|
}, additionalReturnVals));
|
|
663
|
-
case
|
|
663
|
+
case 101:
|
|
664
664
|
case "end":
|
|
665
665
|
return _context2.stop();
|
|
666
666
|
}
|
|
@@ -686,10 +686,10 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
686
686
|
* @return {Promise<Object>} - A write token for the mezzanine object, as well as any logs, warnings and errors from the job initialization
|
|
687
687
|
*/
|
|
688
688
|
exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
689
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
689
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
690
690
|
var _this = this;
|
|
691
|
-
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
|
|
692
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
691
|
+
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;
|
|
692
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
693
693
|
while (1) switch (_context4.prev = _context4.next) {
|
|
694
694
|
case 0:
|
|
695
695
|
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;
|
|
@@ -702,23 +702,23 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
702
702
|
ValidateWriteToken(writeToken, objectId);
|
|
703
703
|
objectId = objectId || this.utils.DecodeWriteToken(writeToken).objectId;
|
|
704
704
|
}
|
|
705
|
-
_context4.next =
|
|
705
|
+
_context4.next = 6;
|
|
706
706
|
return this.ContentObjectMetadata({
|
|
707
707
|
libraryId: libraryId,
|
|
708
708
|
objectId: objectId,
|
|
709
709
|
writeToken: writeToken,
|
|
710
710
|
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
711
711
|
});
|
|
712
|
-
case
|
|
712
|
+
case 6:
|
|
713
713
|
lastJobOfferingsInfo = _context4.sent;
|
|
714
714
|
offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
715
715
|
prepSpecs = lastJobOfferingsInfo[offeringKey].mez_prep_specs;
|
|
716
716
|
if (prepSpecs) {
|
|
717
|
-
_context4.next =
|
|
717
|
+
_context4.next = 11;
|
|
718
718
|
break;
|
|
719
719
|
}
|
|
720
720
|
throw Error("No stream preparation specs found");
|
|
721
|
-
case
|
|
721
|
+
case 11:
|
|
722
722
|
// Retrieve all masters associated with this offering
|
|
723
723
|
masterVersionHashes = Object.keys(prepSpecs).map(function (spec) {
|
|
724
724
|
return (prepSpecs[spec].source_streams || []).map(function (stream) {
|
|
@@ -732,11 +732,11 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
732
732
|
});
|
|
733
733
|
|
|
734
734
|
// Retrieve authorization tokens for all masters and the mezzanine
|
|
735
|
-
_context4.next =
|
|
736
|
-
return Promise.all(masterVersionHashes.map(/*#__PURE__*/function () {
|
|
737
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(versionHash) {
|
|
735
|
+
_context4.next = 15;
|
|
736
|
+
return Promise.all(masterVersionHashes.map( /*#__PURE__*/function () {
|
|
737
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(versionHash) {
|
|
738
738
|
var payload;
|
|
739
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
739
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
740
740
|
while (1) switch (_context3.prev = _context3.next) {
|
|
741
741
|
case 0:
|
|
742
742
|
payload = {}; // Hash may be a write token since media/abr_mezzanine/init doesn't support write token, only prod_master_hash
|
|
@@ -745,11 +745,11 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
745
745
|
} else {
|
|
746
746
|
payload["versionHash"] = versionHash;
|
|
747
747
|
}
|
|
748
|
-
_context3.next =
|
|
748
|
+
_context3.next = 4;
|
|
749
749
|
return _this.authClient.AuthorizationToken(_objectSpread({}, payload));
|
|
750
|
-
case
|
|
750
|
+
case 4:
|
|
751
751
|
return _context3.abrupt("return", _context3.sent);
|
|
752
|
-
case
|
|
752
|
+
case 5:
|
|
753
753
|
case "end":
|
|
754
754
|
return _context3.stop();
|
|
755
755
|
}
|
|
@@ -759,50 +759,50 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
759
759
|
return _ref7.apply(this, arguments);
|
|
760
760
|
};
|
|
761
761
|
}()));
|
|
762
|
-
case
|
|
762
|
+
case 15:
|
|
763
763
|
authorizationTokens = _context4.sent;
|
|
764
|
-
_context4.next =
|
|
764
|
+
_context4.next = 18;
|
|
765
765
|
return this.authClient.AuthorizationToken({
|
|
766
766
|
libraryId: libraryId,
|
|
767
767
|
objectId: objectId,
|
|
768
768
|
update: true
|
|
769
769
|
});
|
|
770
|
-
case
|
|
771
|
-
|
|
772
|
-
authorizationTokens = [
|
|
770
|
+
case 18:
|
|
771
|
+
_context4.t0 = _context4.sent;
|
|
772
|
+
authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
|
|
773
773
|
headers = {
|
|
774
774
|
Authorization: authorizationTokens.map(function (token) {
|
|
775
775
|
return "Bearer ".concat(token);
|
|
776
776
|
}).join(",")
|
|
777
777
|
};
|
|
778
778
|
if (writeTokenSupplied) {
|
|
779
|
-
_context4.next =
|
|
779
|
+
_context4.next = 36;
|
|
780
780
|
break;
|
|
781
781
|
}
|
|
782
|
-
_context4.next =
|
|
782
|
+
_context4.next = 24;
|
|
783
783
|
return this.EditContentObject({
|
|
784
784
|
libraryId: libraryId,
|
|
785
785
|
objectId: objectId
|
|
786
786
|
});
|
|
787
|
-
case
|
|
787
|
+
case 24:
|
|
788
788
|
lroWorkingDraft = _context4.sent;
|
|
789
789
|
writeToken = lroWorkingDraft.writeToken;
|
|
790
790
|
|
|
791
791
|
// Save this write token (and node url, and offering key) to ANOTHER, NEW write token in order to
|
|
792
792
|
// record "bread crumb" metadata at /lro_draft, and save (finalize) this second write token
|
|
793
|
-
_context4.next =
|
|
793
|
+
_context4.next = 28;
|
|
794
794
|
return this.EditContentObject({
|
|
795
795
|
libraryId: libraryId,
|
|
796
796
|
objectId: objectId
|
|
797
797
|
});
|
|
798
|
-
case
|
|
798
|
+
case 28:
|
|
799
799
|
breadCrumbDraft = _context4.sent;
|
|
800
800
|
breadCrumb = {
|
|
801
801
|
write_token: lroWorkingDraft.writeToken,
|
|
802
802
|
node: lroWorkingDraft.nodeUrl,
|
|
803
803
|
offering: offeringKey
|
|
804
804
|
};
|
|
805
|
-
_context4.next =
|
|
805
|
+
_context4.next = 32;
|
|
806
806
|
return this.ReplaceMetadata({
|
|
807
807
|
libraryId: libraryId,
|
|
808
808
|
objectId: objectId,
|
|
@@ -810,23 +810,23 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
810
810
|
metadataSubtree: "lro_draft",
|
|
811
811
|
metadata: breadCrumb
|
|
812
812
|
});
|
|
813
|
-
case
|
|
814
|
-
_context4.next =
|
|
813
|
+
case 32:
|
|
814
|
+
_context4.next = 34;
|
|
815
815
|
return this.FinalizeContentObject({
|
|
816
816
|
libraryId: libraryId,
|
|
817
817
|
objectId: objectId,
|
|
818
818
|
writeToken: breadCrumbDraft.write_token,
|
|
819
819
|
commitMessage: "Save mez LRO write token to /lro_draft"
|
|
820
820
|
});
|
|
821
|
-
case
|
|
821
|
+
case 34:
|
|
822
822
|
finalizeResponse = _context4.sent;
|
|
823
823
|
breadCrumbHash = finalizeResponse.hash;
|
|
824
|
-
case
|
|
825
|
-
_context4.next =
|
|
824
|
+
case 36:
|
|
825
|
+
_context4.next = 38;
|
|
826
826
|
return this.WriteTokenNodeUrlNetwork({
|
|
827
827
|
writeToken: writeToken
|
|
828
828
|
});
|
|
829
|
-
case
|
|
829
|
+
case 38:
|
|
830
830
|
nodeUrl = _context4.sent;
|
|
831
831
|
// tell http client what node to contact for this write token
|
|
832
832
|
this.RecordWriteToken({
|
|
@@ -835,7 +835,7 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
835
835
|
});
|
|
836
836
|
|
|
837
837
|
// Make the API call that actually starts the LROs
|
|
838
|
-
_context4.next =
|
|
838
|
+
_context4.next = 42;
|
|
839
839
|
return this.CallBitcodeMethod({
|
|
840
840
|
libraryId: libraryId,
|
|
841
841
|
objectId: objectId,
|
|
@@ -849,7 +849,7 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
849
849
|
job_indexes: jobIndexes
|
|
850
850
|
}
|
|
851
851
|
});
|
|
852
|
-
case
|
|
852
|
+
case 42:
|
|
853
853
|
_yield$this$CallBitco3 = _context4.sent;
|
|
854
854
|
data = _yield$this$CallBitco3.data;
|
|
855
855
|
errors = _yield$this$CallBitco3.errors;
|
|
@@ -865,7 +865,7 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
865
865
|
warnings: warnings || [],
|
|
866
866
|
errors: errors || []
|
|
867
867
|
});
|
|
868
|
-
case
|
|
868
|
+
case 48:
|
|
869
869
|
case "end":
|
|
870
870
|
return _context4.stop();
|
|
871
871
|
}
|
|
@@ -892,73 +892,73 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
892
892
|
* @return {Promise<Object>} - LRO status
|
|
893
893
|
*/
|
|
894
894
|
exports.LRODraftInfo = /*#__PURE__*/function () {
|
|
895
|
-
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
895
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
896
896
|
var libraryId, objectId, standardPathContents, lastJobOfferingsInfo, mainOfferingKey, ready, oldPathContents;
|
|
897
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
897
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
898
898
|
while (1) switch (_context5.prev = _context5.next) {
|
|
899
899
|
case 0:
|
|
900
900
|
libraryId = _ref8.libraryId, objectId = _ref8.objectId;
|
|
901
|
-
_context5.next =
|
|
901
|
+
_context5.next = 3;
|
|
902
902
|
return this.ContentObjectMetadata({
|
|
903
903
|
libraryId: libraryId,
|
|
904
904
|
objectId: objectId,
|
|
905
905
|
metadataSubtree: "lro_draft"
|
|
906
906
|
});
|
|
907
|
-
case
|
|
907
|
+
case 3:
|
|
908
908
|
standardPathContents = _context5.sent;
|
|
909
909
|
if (!standardPathContents) {
|
|
910
|
-
_context5.next =
|
|
910
|
+
_context5.next = 6;
|
|
911
911
|
break;
|
|
912
912
|
}
|
|
913
913
|
return _context5.abrupt("return", standardPathContents);
|
|
914
|
-
case
|
|
915
|
-
_context5.next =
|
|
914
|
+
case 6:
|
|
915
|
+
_context5.next = 8;
|
|
916
916
|
return this.ContentObjectMetadata({
|
|
917
917
|
libraryId: libraryId,
|
|
918
918
|
objectId: objectId,
|
|
919
919
|
writeToken: writeToken,
|
|
920
920
|
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
921
921
|
});
|
|
922
|
-
case
|
|
922
|
+
case 8:
|
|
923
923
|
lastJobOfferingsInfo = _context5.sent;
|
|
924
924
|
if (lastJobOfferingsInfo) {
|
|
925
|
-
_context5.next =
|
|
925
|
+
_context5.next = 11;
|
|
926
926
|
break;
|
|
927
927
|
}
|
|
928
928
|
throw Error("No metadata for mezzanine preparation job found at /abr_mezzanine");
|
|
929
|
-
case
|
|
929
|
+
case 11:
|
|
930
930
|
mainOfferingKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
931
931
|
if (mainOfferingKey) {
|
|
932
|
-
_context5.next =
|
|
932
|
+
_context5.next = 14;
|
|
933
933
|
break;
|
|
934
934
|
}
|
|
935
935
|
throw Error("Could not determine offering key for last submitted job");
|
|
936
|
-
case
|
|
936
|
+
case 14:
|
|
937
937
|
// see if offering from last job was finalized
|
|
938
938
|
ready = lastJobOfferingsInfo[mainOfferingKey].ready; // old location for LRO draft info
|
|
939
|
-
_context5.next =
|
|
939
|
+
_context5.next = 17;
|
|
940
940
|
return this.ContentObjectMetadata({
|
|
941
941
|
libraryId: libraryId,
|
|
942
942
|
objectId: objectId,
|
|
943
943
|
writeToken: writeToken,
|
|
944
944
|
metadataSubtree: "lro_draft_".concat(mainOfferingKey)
|
|
945
945
|
});
|
|
946
|
-
case
|
|
946
|
+
case 17:
|
|
947
947
|
oldPathContents = _context5.sent;
|
|
948
948
|
if (!oldPathContents) {
|
|
949
|
-
_context5.next =
|
|
949
|
+
_context5.next = 22;
|
|
950
950
|
break;
|
|
951
951
|
}
|
|
952
952
|
return _context5.abrupt("return", oldPathContents);
|
|
953
|
-
case
|
|
953
|
+
case 22:
|
|
954
954
|
if (!ready) {
|
|
955
|
-
_context5.next =
|
|
955
|
+
_context5.next = 26;
|
|
956
956
|
break;
|
|
957
957
|
}
|
|
958
958
|
throw Error("No LRO draft found for this mezzanine - looks like last mez prep job was already finalized.");
|
|
959
|
-
case
|
|
959
|
+
case 26:
|
|
960
960
|
throw Error("No LRO draft found for this mezzanine - looks like last mez prep job was either cancelled or discarded.");
|
|
961
|
-
case
|
|
961
|
+
case 27:
|
|
962
962
|
case "end":
|
|
963
963
|
return _context5.stop();
|
|
964
964
|
}
|
|
@@ -984,61 +984,61 @@ exports.LRODraftInfo = /*#__PURE__*/function () {
|
|
|
984
984
|
* @return {Promise<Object>} - LRO status
|
|
985
985
|
*/
|
|
986
986
|
exports.LROStatus = /*#__PURE__*/function () {
|
|
987
|
-
var
|
|
988
|
-
var libraryId, objectId,
|
|
989
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
987
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
|
|
988
|
+
var libraryId, objectId, _ref10$writeToken, writeToken, activeWriteToken, lroDraft, fabricNodeUrl;
|
|
989
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
990
990
|
while (1) switch (_context6.prev = _context6.next) {
|
|
991
991
|
case 0:
|
|
992
|
-
libraryId =
|
|
992
|
+
libraryId = _ref10.libraryId, objectId = _ref10.objectId, _ref10$writeToken = _ref10.writeToken, writeToken = _ref10$writeToken === void 0 ? "" : _ref10$writeToken;
|
|
993
993
|
ValidateParameters({
|
|
994
994
|
libraryId: libraryId,
|
|
995
995
|
objectId: objectId
|
|
996
996
|
});
|
|
997
997
|
if (!writeToken) {
|
|
998
|
-
_context6.next =
|
|
998
|
+
_context6.next = 7;
|
|
999
999
|
break;
|
|
1000
1000
|
}
|
|
1001
1001
|
ValidateWriteToken(writeToken, objectId);
|
|
1002
1002
|
activeWriteToken = writeToken;
|
|
1003
|
-
_context6.next =
|
|
1003
|
+
_context6.next = 15;
|
|
1004
1004
|
break;
|
|
1005
|
-
case
|
|
1006
|
-
_context6.next =
|
|
1005
|
+
case 7:
|
|
1006
|
+
_context6.next = 9;
|
|
1007
1007
|
return this.LRODraftInfo({
|
|
1008
1008
|
libraryId: libraryId,
|
|
1009
1009
|
objectId: objectId
|
|
1010
1010
|
});
|
|
1011
|
-
case
|
|
1011
|
+
case 9:
|
|
1012
1012
|
lroDraft = _context6.sent;
|
|
1013
1013
|
activeWriteToken = lroDraft.write_token;
|
|
1014
|
-
_context6.next =
|
|
1014
|
+
_context6.next = 13;
|
|
1015
1015
|
return this.WriteTokenNodeUrlNetwork({
|
|
1016
1016
|
writeToken: activeWriteToken
|
|
1017
1017
|
});
|
|
1018
|
-
case
|
|
1018
|
+
case 13:
|
|
1019
1019
|
fabricNodeUrl = _context6.sent;
|
|
1020
1020
|
this.RecordWriteToken({
|
|
1021
1021
|
writeToken: lroDraft.write_token,
|
|
1022
1022
|
fabricNodeUrl: fabricNodeUrl
|
|
1023
1023
|
});
|
|
1024
|
-
case
|
|
1025
|
-
_context6.next =
|
|
1024
|
+
case 15:
|
|
1025
|
+
_context6.next = 17;
|
|
1026
1026
|
return this.ContentObjectMetadata({
|
|
1027
1027
|
libraryId: libraryId,
|
|
1028
1028
|
objectId: objectId,
|
|
1029
1029
|
writeToken: activeWriteToken,
|
|
1030
1030
|
metadataSubtree: "lro_status"
|
|
1031
1031
|
});
|
|
1032
|
-
case
|
|
1032
|
+
case 17:
|
|
1033
1033
|
return _context6.abrupt("return", _context6.sent);
|
|
1034
|
-
case
|
|
1034
|
+
case 18:
|
|
1035
1035
|
case "end":
|
|
1036
1036
|
return _context6.stop();
|
|
1037
1037
|
}
|
|
1038
1038
|
}, _callee6, this);
|
|
1039
1039
|
}));
|
|
1040
1040
|
return function (_x6) {
|
|
1041
|
-
return
|
|
1041
|
+
return _ref11.apply(this, arguments);
|
|
1042
1042
|
};
|
|
1043
1043
|
}();
|
|
1044
1044
|
|
|
@@ -1060,54 +1060,54 @@ exports.LROStatus = /*#__PURE__*/function () {
|
|
|
1060
1060
|
* @return {Promise<Object>} - The finalize response for the mezzanine object, as well as any logs, warnings and errors from the finalization
|
|
1061
1061
|
*/
|
|
1062
1062
|
exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
1063
|
-
var
|
|
1064
|
-
var libraryId, objectId, preFinalizeFn, preFinalizeThrow,
|
|
1065
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
1063
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref12) {
|
|
1064
|
+
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;
|
|
1065
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1066
1066
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1067
1067
|
case 0:
|
|
1068
|
-
libraryId =
|
|
1068
|
+
libraryId = _ref12.libraryId, objectId = _ref12.objectId, preFinalizeFn = _ref12.preFinalizeFn, preFinalizeThrow = _ref12.preFinalizeThrow, _ref12$writeToken = _ref12.writeToken, writeToken = _ref12$writeToken === void 0 ? "" : _ref12$writeToken;
|
|
1069
1069
|
ValidateParameters({
|
|
1070
1070
|
libraryId: libraryId,
|
|
1071
1071
|
objectId: objectId
|
|
1072
1072
|
});
|
|
1073
1073
|
writeTokenSupplied = !!writeToken;
|
|
1074
1074
|
if (!writeTokenSupplied) {
|
|
1075
|
-
_context7.next =
|
|
1075
|
+
_context7.next = 8;
|
|
1076
1076
|
break;
|
|
1077
1077
|
}
|
|
1078
1078
|
ValidateWriteToken(writeToken, objectId);
|
|
1079
1079
|
objectId = objectId || this.utils.DecodeWriteToken(writeToken).objectId;
|
|
1080
|
-
_context7.next =
|
|
1080
|
+
_context7.next = 12;
|
|
1081
1081
|
break;
|
|
1082
|
-
case
|
|
1083
|
-
_context7.next =
|
|
1082
|
+
case 8:
|
|
1083
|
+
_context7.next = 10;
|
|
1084
1084
|
return this.LRODraftInfo({
|
|
1085
1085
|
libraryId: libraryId,
|
|
1086
1086
|
objectId: objectId
|
|
1087
1087
|
});
|
|
1088
|
-
case
|
|
1088
|
+
case 10:
|
|
1089
1089
|
lroDraft = _context7.sent;
|
|
1090
1090
|
writeToken = lroDraft.write_token;
|
|
1091
|
-
case
|
|
1092
|
-
_context7.next =
|
|
1091
|
+
case 12:
|
|
1092
|
+
_context7.next = 14;
|
|
1093
1093
|
return this.WriteTokenNodeUrlNetwork({
|
|
1094
1094
|
writeToken: writeToken
|
|
1095
1095
|
});
|
|
1096
|
-
case
|
|
1096
|
+
case 14:
|
|
1097
1097
|
fabricNodeUrl = _context7.sent;
|
|
1098
1098
|
// tell http client what node to contact for this write token
|
|
1099
1099
|
this.RecordWriteToken({
|
|
1100
1100
|
writeToken: writeToken,
|
|
1101
1101
|
fabricNodeUrl: fabricNodeUrl
|
|
1102
1102
|
});
|
|
1103
|
-
_context7.next =
|
|
1103
|
+
_context7.next = 18;
|
|
1104
1104
|
return this.ContentObjectMetadata({
|
|
1105
1105
|
libraryId: libraryId,
|
|
1106
1106
|
objectId: objectId,
|
|
1107
1107
|
writeToken: writeToken,
|
|
1108
1108
|
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
1109
1109
|
});
|
|
1110
|
-
case
|
|
1110
|
+
case 18:
|
|
1111
1111
|
lastJobOfferingsInfo = _context7.sent;
|
|
1112
1112
|
offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
1113
1113
|
masterHash = lastJobOfferingsInfo[offeringKey].prod_master_hash;
|
|
@@ -1119,25 +1119,25 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
1121
|
// Authorization token for mezzanine and master
|
|
1122
|
-
_context7.next =
|
|
1122
|
+
_context7.next = 25;
|
|
1123
1123
|
return this.authClient.AuthorizationToken({
|
|
1124
1124
|
libraryId: libraryId,
|
|
1125
1125
|
objectId: objectId,
|
|
1126
1126
|
update: true
|
|
1127
1127
|
});
|
|
1128
|
-
case
|
|
1129
|
-
|
|
1130
|
-
_context7.next =
|
|
1128
|
+
case 25:
|
|
1129
|
+
_context7.t0 = _context7.sent;
|
|
1130
|
+
_context7.next = 28;
|
|
1131
1131
|
return this.authClient.AuthorizationToken(_objectSpread({}, masterIdentifier));
|
|
1132
|
-
case
|
|
1133
|
-
|
|
1134
|
-
authorizationTokens = [
|
|
1132
|
+
case 28:
|
|
1133
|
+
_context7.t1 = _context7.sent;
|
|
1134
|
+
authorizationTokens = [_context7.t0, _context7.t1];
|
|
1135
1135
|
headers = {
|
|
1136
1136
|
Authorization: authorizationTokens.map(function (token) {
|
|
1137
1137
|
return "Bearer ".concat(token);
|
|
1138
1138
|
}).join(",")
|
|
1139
1139
|
};
|
|
1140
|
-
_context7.next =
|
|
1140
|
+
_context7.next = 33;
|
|
1141
1141
|
return this.CallBitcodeMethod({
|
|
1142
1142
|
objectId: objectId,
|
|
1143
1143
|
libraryId: libraryId,
|
|
@@ -1146,7 +1146,7 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1146
1146
|
headers: headers,
|
|
1147
1147
|
constant: false
|
|
1148
1148
|
});
|
|
1149
|
-
case
|
|
1149
|
+
case 33:
|
|
1150
1150
|
_yield$this$CallBitco4 = _context7.sent;
|
|
1151
1151
|
data = _yield$this$CallBitco4.data;
|
|
1152
1152
|
errors = _yield$this$CallBitco4.errors;
|
|
@@ -1154,7 +1154,7 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1154
1154
|
logs = _yield$this$CallBitco4.logs;
|
|
1155
1155
|
preFinalizeWarnings = [];
|
|
1156
1156
|
if (!preFinalizeFn) {
|
|
1157
|
-
_context7.next =
|
|
1157
|
+
_context7.next = 53;
|
|
1158
1158
|
break;
|
|
1159
1159
|
}
|
|
1160
1160
|
params = {
|
|
@@ -1162,34 +1162,34 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1162
1162
|
offeringKey: offeringKey,
|
|
1163
1163
|
writeToken: writeToken
|
|
1164
1164
|
};
|
|
1165
|
-
_context7.prev =
|
|
1166
|
-
_context7.next =
|
|
1165
|
+
_context7.prev = 41;
|
|
1166
|
+
_context7.next = 44;
|
|
1167
1167
|
return preFinalizeFn(params);
|
|
1168
|
-
case
|
|
1169
|
-
_context7.next =
|
|
1168
|
+
case 44:
|
|
1169
|
+
_context7.next = 53;
|
|
1170
1170
|
break;
|
|
1171
|
-
case
|
|
1172
|
-
_context7.prev =
|
|
1173
|
-
|
|
1171
|
+
case 46:
|
|
1172
|
+
_context7.prev = 46;
|
|
1173
|
+
_context7.t2 = _context7["catch"](41);
|
|
1174
1174
|
if (!preFinalizeThrow) {
|
|
1175
|
-
_context7.next =
|
|
1175
|
+
_context7.next = 52;
|
|
1176
1176
|
break;
|
|
1177
1177
|
}
|
|
1178
1178
|
throw new Error("Error running preFinalize function", {
|
|
1179
|
-
cause:
|
|
1179
|
+
cause: _context7.t2
|
|
1180
1180
|
});
|
|
1181
|
-
case
|
|
1182
|
-
preFinalizeWarnings = "Error running preFinalize function: ".concat(
|
|
1183
|
-
case
|
|
1181
|
+
case 52:
|
|
1182
|
+
preFinalizeWarnings = "Error running preFinalize function: ".concat(_context7.t2);
|
|
1183
|
+
case 53:
|
|
1184
1184
|
if (!writeTokenSupplied) {
|
|
1185
|
-
_context7.next =
|
|
1185
|
+
_context7.next = 57;
|
|
1186
1186
|
break;
|
|
1187
1187
|
}
|
|
1188
|
-
|
|
1189
|
-
_context7.next =
|
|
1188
|
+
_context7.t3 = {};
|
|
1189
|
+
_context7.next = 60;
|
|
1190
1190
|
break;
|
|
1191
|
-
case
|
|
1192
|
-
_context7.next =
|
|
1191
|
+
case 57:
|
|
1192
|
+
_context7.next = 59;
|
|
1193
1193
|
return this.FinalizeContentObject({
|
|
1194
1194
|
libraryId: libraryId,
|
|
1195
1195
|
objectId: objectId,
|
|
@@ -1197,23 +1197,23 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1197
1197
|
commitMessage: "Finalize ABR mezzanine",
|
|
1198
1198
|
awaitCommitConfirmation: false
|
|
1199
1199
|
});
|
|
1200
|
-
case
|
|
1201
|
-
|
|
1202
|
-
case
|
|
1203
|
-
finalizeResponse =
|
|
1200
|
+
case 59:
|
|
1201
|
+
_context7.t3 = _context7.sent;
|
|
1202
|
+
case 60:
|
|
1203
|
+
finalizeResponse = _context7.t3;
|
|
1204
1204
|
return _context7.abrupt("return", _objectSpread({
|
|
1205
1205
|
data: data,
|
|
1206
1206
|
logs: logs || [],
|
|
1207
1207
|
warnings: (warnings || []).concat(preFinalizeWarnings),
|
|
1208
1208
|
errors: errors || []
|
|
1209
1209
|
}, finalizeResponse));
|
|
1210
|
-
case
|
|
1210
|
+
case 62:
|
|
1211
1211
|
case "end":
|
|
1212
1212
|
return _context7.stop();
|
|
1213
1213
|
}
|
|
1214
|
-
}, _callee7, this, [[
|
|
1214
|
+
}, _callee7, this, [[41, 46]]);
|
|
1215
1215
|
}));
|
|
1216
1216
|
return function (_x7) {
|
|
1217
|
-
return
|
|
1217
|
+
return _ref13.apply(this, arguments);
|
|
1218
1218
|
};
|
|
1219
1219
|
}();
|