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