@eluvio/elv-client-js 3.2.2 → 3.2.6
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 -11
- package/dist/ElvClient-node-min.js +17 -13
- package/dist/ElvFrameClient-min.js +12 -8
- package/dist/ElvPermissionsClient-min.js +13 -9
- package/dist/ElvWalletClient-min.js +58 -0
- package/dist/ElvWalletClient-node-min.js +78 -0
- package/dist/src/AuthorizationClient.js +2248 -1990
- package/dist/src/ContentObjectVerification.js +164 -173
- package/dist/src/Crypto.js +376 -324
- package/dist/src/ElvClient.js +1182 -1019
- package/dist/src/ElvWallet.js +119 -95
- package/dist/src/EthClient.js +1040 -896
- package/dist/src/FrameClient.js +331 -300
- package/dist/src/HttpClient.js +153 -147
- package/dist/src/Id.js +1 -3
- package/dist/src/PermissionsClient.js +1294 -1168
- package/dist/src/RemoteSigner.js +263 -211
- package/dist/src/UserProfileClient.js +1164 -1023
- package/dist/src/Utils.js +209 -181
- package/dist/src/client/ABRPublishing.js +895 -858
- package/dist/src/client/AccessGroups.js +1102 -959
- package/dist/src/client/ContentAccess.js +3724 -3431
- package/dist/src/client/ContentManagement.js +2252 -2068
- package/dist/src/client/Contracts.js +647 -563
- package/dist/src/client/Files.js +1886 -1757
- package/dist/src/client/NFT.js +126 -112
- package/dist/src/client/NTP.js +478 -422
- package/dist/src/walletClient/ClientMethods.js +1029 -879
- package/dist/src/walletClient/Utils.js +84 -70
- package/dist/src/walletClient/index.js +1203 -1087
- package/package.json +4 -2
- package/src/Utils.js +0 -1
- package/src/walletClient/ClientMethods.js +34 -2
- package/src/walletClient/index.js +3 -3
- package/utilities/ProductionMasterCreate.js +2 -2
|
@@ -4,9 +4,11 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Methods for ABR video creation and management
|
|
@@ -77,254 +79,260 @@ var _require = require("../Validation"),
|
|
|
77
79
|
*/
|
|
78
80
|
|
|
79
81
|
|
|
80
|
-
exports.CreateProductionMaster = function
|
|
81
|
-
var
|
|
82
|
+
exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
83
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
84
|
+
var libraryId, type, name, description, _ref$metadata, metadata, fileInfo, _ref$encrypt, encrypt, _ref$access, access, _ref$copy, copy, callback, _yield$this$CreateCon, id, write_token, s3prefixRegex, i, oneFileInfo, matched, j, credentialSet, credentialSetBucket, matchers, k, matcher, fileSourcePath, s3prefixMatch, bucketName, _i, _credentialSet, region, bucket, accessKey, secret, _yield$this$CallBitco, logs, errors, warnings, finalizeResponse;
|
|
85
|
+
|
|
86
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
87
|
+
while (1) {
|
|
88
|
+
switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
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 ? false : _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;
|
|
91
|
+
ValidateLibrary(libraryId);
|
|
92
|
+
_context.next = 4;
|
|
93
|
+
return this.CreateContentObject({
|
|
94
|
+
libraryId: libraryId,
|
|
95
|
+
options: type ? {
|
|
96
|
+
type: type
|
|
97
|
+
} : {}
|
|
98
|
+
});
|
|
82
99
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
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 ? false : _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;
|
|
88
|
-
ValidateLibrary(libraryId);
|
|
89
|
-
_context.next = 4;
|
|
90
|
-
return _regeneratorRuntime.awrap(this.CreateContentObject({
|
|
91
|
-
libraryId: libraryId,
|
|
92
|
-
options: type ? {
|
|
93
|
-
type: type
|
|
94
|
-
} : {}
|
|
95
|
-
}));
|
|
100
|
+
case 4:
|
|
101
|
+
_yield$this$CreateCon = _context.sent;
|
|
102
|
+
id = _yield$this$CreateCon.id;
|
|
103
|
+
write_token = _yield$this$CreateCon.write_token;
|
|
96
104
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
if (!fileInfo) {
|
|
106
|
+
_context.next = 59;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
101
109
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
if (!(access.length > 0)) {
|
|
111
|
+
_context.next = 57;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
106
114
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
115
|
+
// S3 Upload
|
|
116
|
+
s3prefixRegex = /^s3:\/\/([^/]+)\//i; // for matching and extracting bucket name when full s3:// path is specified
|
|
117
|
+
// batch the cloud storage files by matching credential set, check each file's source path against credential set path_matchers
|
|
111
118
|
|
|
112
|
-
|
|
113
|
-
s3prefixRegex = /^s3:\/\/([^/]+)\//i; // for matching and extracting bucket name when full s3:// path is specified
|
|
114
|
-
// batch the cloud storage files by matching credential set, check each file's source path against credential set path_matchers
|
|
119
|
+
i = 0;
|
|
115
120
|
|
|
116
|
-
|
|
121
|
+
case 11:
|
|
122
|
+
if (!(i < fileInfo.length)) {
|
|
123
|
+
_context.next = 42;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
117
126
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
127
|
+
oneFileInfo = fileInfo[i];
|
|
128
|
+
matched = false;
|
|
129
|
+
j = 0;
|
|
123
130
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
case 15:
|
|
132
|
+
if (!(!matched && j < access.length)) {
|
|
133
|
+
_context.next = 37;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
127
136
|
|
|
128
|
-
|
|
129
|
-
if (!(!matched && j < access.length)) {
|
|
130
|
-
_context.next = 37;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
137
|
+
credentialSet = access[j]; // strip trailing slash to get bucket name for credential set
|
|
133
138
|
|
|
134
|
-
|
|
139
|
+
credentialSetBucket = credentialSet.remote_access.path.replace(/\/$/, "");
|
|
140
|
+
matchers = credentialSet.path_matchers;
|
|
141
|
+
k = 0;
|
|
135
142
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
case 20:
|
|
144
|
+
if (!(!matched && k < matchers.length)) {
|
|
145
|
+
_context.next = 34;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
139
148
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
_context.next = 34;
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
149
|
+
matcher = new RegExp(matchers[k]);
|
|
150
|
+
fileSourcePath = oneFileInfo.source;
|
|
145
151
|
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
if (!matcher.test(fileSourcePath)) {
|
|
153
|
+
_context.next = 31;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
148
156
|
|
|
149
|
-
|
|
150
|
-
_context.next = 31;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
157
|
+
matched = true; // if full s3 path supplied, check bucket name
|
|
153
158
|
|
|
154
|
-
|
|
159
|
+
s3prefixMatch = s3prefixRegex.exec(fileSourcePath);
|
|
155
160
|
|
|
156
|
-
|
|
161
|
+
if (!s3prefixMatch) {
|
|
162
|
+
_context.next = 30;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
157
165
|
|
|
158
|
-
|
|
159
|
-
_context.next = 30;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
166
|
+
bucketName = s3prefixMatch[1];
|
|
162
167
|
|
|
163
|
-
|
|
168
|
+
if (!(bucketName !== credentialSetBucket)) {
|
|
169
|
+
_context.next = 30;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
164
172
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
case 31:
|
|
182
|
-
k++;
|
|
183
|
-
_context.next = 20;
|
|
184
|
-
break;
|
|
185
|
-
|
|
186
|
-
case 34:
|
|
187
|
-
j++;
|
|
188
|
-
_context.next = 15;
|
|
189
|
-
break;
|
|
190
|
-
|
|
191
|
-
case 37:
|
|
192
|
-
if (matched) {
|
|
193
|
-
_context.next = 39;
|
|
173
|
+
throw Error("Full S3 file path \"" + fileSourcePath + "\" matched to credential set with different bucket name '" + credentialSetBucket + "'");
|
|
174
|
+
|
|
175
|
+
case 30:
|
|
176
|
+
if (credentialSet.hasOwnProperty("matched")) {
|
|
177
|
+
credentialSet.matched.push(oneFileInfo);
|
|
178
|
+
} else {
|
|
179
|
+
// first matching file path for this credential set,
|
|
180
|
+
// initialize new 'matched' property to 1-element array
|
|
181
|
+
credentialSet.matched = [oneFileInfo];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
case 31:
|
|
185
|
+
k++;
|
|
186
|
+
_context.next = 20;
|
|
194
187
|
break;
|
|
195
|
-
}
|
|
196
188
|
|
|
197
|
-
|
|
189
|
+
case 34:
|
|
190
|
+
j++;
|
|
191
|
+
_context.next = 15;
|
|
192
|
+
break;
|
|
198
193
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
case 37:
|
|
195
|
+
if (matched) {
|
|
196
|
+
_context.next = 39;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
203
199
|
|
|
204
|
-
|
|
205
|
-
_i = 0;
|
|
200
|
+
throw Error("no credential set found for file path: \"" + filePath + "\"");
|
|
206
201
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
_context.next =
|
|
202
|
+
case 39:
|
|
203
|
+
i++;
|
|
204
|
+
_context.next = 11;
|
|
210
205
|
break;
|
|
211
|
-
}
|
|
212
206
|
|
|
213
|
-
|
|
207
|
+
case 42:
|
|
208
|
+
_i = 0;
|
|
209
|
+
|
|
210
|
+
case 43:
|
|
211
|
+
if (!(_i < access.length)) {
|
|
212
|
+
_context.next = 55;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
_credentialSet = access[_i];
|
|
214
217
|
|
|
215
|
-
|
|
218
|
+
if (!(_credentialSet.hasOwnProperty("matched") && _credentialSet.matched.length > 0)) {
|
|
219
|
+
_context.next = 52;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
region = _credentialSet.remote_access.storage_endpoint.region;
|
|
224
|
+
bucket = _credentialSet.remote_access.path.replace(/\/$/, "");
|
|
225
|
+
accessKey = _credentialSet.remote_access.cloud_credentials.access_key_id;
|
|
226
|
+
secret = _credentialSet.remote_access.cloud_credentials.secret_access_key;
|
|
216
227
|
_context.next = 52;
|
|
228
|
+
return this.UploadFilesFromS3({
|
|
229
|
+
libraryId: libraryId,
|
|
230
|
+
objectId: id,
|
|
231
|
+
writeToken: write_token,
|
|
232
|
+
fileInfo: _credentialSet.matched,
|
|
233
|
+
region: region,
|
|
234
|
+
bucket: bucket,
|
|
235
|
+
accessKey: accessKey,
|
|
236
|
+
secret: secret,
|
|
237
|
+
copy: copy,
|
|
238
|
+
callback: callback,
|
|
239
|
+
encryption: encrypt ? "cgck" : "none"
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
case 52:
|
|
243
|
+
_i++;
|
|
244
|
+
_context.next = 43;
|
|
245
|
+
break;
|
|
246
|
+
|
|
247
|
+
case 55:
|
|
248
|
+
_context.next = 59;
|
|
217
249
|
break;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
name: name || "",
|
|
297
|
-
description: description || ""
|
|
298
|
-
}),
|
|
299
|
-
elv_created_at: new Date().getTime()
|
|
300
|
-
})
|
|
301
|
-
}));
|
|
302
|
-
|
|
303
|
-
case 69:
|
|
304
|
-
_context.next = 71;
|
|
305
|
-
return _regeneratorRuntime.awrap(this.FinalizeContentObject({
|
|
306
|
-
libraryId: libraryId,
|
|
307
|
-
objectId: id,
|
|
308
|
-
writeToken: write_token,
|
|
309
|
-
commitMessage: "Create master",
|
|
310
|
-
awaitCommitConfirmation: false
|
|
311
|
-
}));
|
|
312
|
-
|
|
313
|
-
case 71:
|
|
314
|
-
finalizeResponse = _context.sent;
|
|
315
|
-
return _context.abrupt("return", _objectSpread({
|
|
316
|
-
errors: errors || [],
|
|
317
|
-
logs: logs || [],
|
|
318
|
-
warnings: warnings || []
|
|
319
|
-
}, finalizeResponse));
|
|
320
|
-
|
|
321
|
-
case 73:
|
|
322
|
-
case "end":
|
|
323
|
-
return _context.stop();
|
|
250
|
+
|
|
251
|
+
case 57:
|
|
252
|
+
_context.next = 59;
|
|
253
|
+
return this.UploadFiles({
|
|
254
|
+
libraryId: libraryId,
|
|
255
|
+
objectId: id,
|
|
256
|
+
writeToken: write_token,
|
|
257
|
+
fileInfo: fileInfo,
|
|
258
|
+
callback: callback,
|
|
259
|
+
encryption: encrypt ? "cgck" : "none"
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
case 59:
|
|
263
|
+
_context.next = 61;
|
|
264
|
+
return this.CreateEncryptionConk({
|
|
265
|
+
libraryId: libraryId,
|
|
266
|
+
objectId: id,
|
|
267
|
+
writeToken: write_token,
|
|
268
|
+
createKMSConk: true
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
case 61:
|
|
272
|
+
_context.next = 63;
|
|
273
|
+
return this.CallBitcodeMethod({
|
|
274
|
+
libraryId: libraryId,
|
|
275
|
+
objectId: id,
|
|
276
|
+
writeToken: write_token,
|
|
277
|
+
method: UrlJoin("media", "production_master", "init"),
|
|
278
|
+
body: {
|
|
279
|
+
access: access
|
|
280
|
+
},
|
|
281
|
+
constant: false
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
case 63:
|
|
285
|
+
_yield$this$CallBitco = _context.sent;
|
|
286
|
+
logs = _yield$this$CallBitco.logs;
|
|
287
|
+
errors = _yield$this$CallBitco.errors;
|
|
288
|
+
warnings = _yield$this$CallBitco.warnings;
|
|
289
|
+
_context.next = 69;
|
|
290
|
+
return this.MergeMetadata({
|
|
291
|
+
libraryId: libraryId,
|
|
292
|
+
objectId: id,
|
|
293
|
+
writeToken: write_token,
|
|
294
|
+
metadata: _objectSpread(_objectSpread({}, metadata || {}), {}, {
|
|
295
|
+
name: name,
|
|
296
|
+
description: description,
|
|
297
|
+
reference: access && !copy,
|
|
298
|
+
"public": _objectSpread(_objectSpread({}, (metadata || {})["public"] || {}), {}, {
|
|
299
|
+
name: name || "",
|
|
300
|
+
description: description || ""
|
|
301
|
+
}),
|
|
302
|
+
elv_created_at: new Date().getTime()
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
case 69:
|
|
307
|
+
_context.next = 71;
|
|
308
|
+
return this.FinalizeContentObject({
|
|
309
|
+
libraryId: libraryId,
|
|
310
|
+
objectId: id,
|
|
311
|
+
writeToken: write_token,
|
|
312
|
+
commitMessage: "Create master",
|
|
313
|
+
awaitCommitConfirmation: false
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
case 71:
|
|
317
|
+
finalizeResponse = _context.sent;
|
|
318
|
+
return _context.abrupt("return", _objectSpread({
|
|
319
|
+
errors: errors || [],
|
|
320
|
+
logs: logs || [],
|
|
321
|
+
warnings: warnings || []
|
|
322
|
+
}, finalizeResponse));
|
|
323
|
+
|
|
324
|
+
case 73:
|
|
325
|
+
case "end":
|
|
326
|
+
return _context.stop();
|
|
327
|
+
}
|
|
324
328
|
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
329
|
+
}, _callee, this);
|
|
330
|
+
}));
|
|
331
|
+
|
|
332
|
+
return function (_x) {
|
|
333
|
+
return _ref2.apply(this, arguments);
|
|
334
|
+
};
|
|
335
|
+
}();
|
|
328
336
|
/**
|
|
329
337
|
* Create a mezzanine of the given master content object
|
|
330
338
|
*
|
|
@@ -345,267 +353,273 @@ exports.CreateProductionMaster = function _callee(_ref) {
|
|
|
345
353
|
*/
|
|
346
354
|
|
|
347
355
|
|
|
348
|
-
exports.CreateABRMezzanine = function
|
|
349
|
-
var
|
|
356
|
+
exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
357
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
358
|
+
var libraryId, objectId, type, name, description, metadata, masterVersionHash, abrProfile, _ref3$variant, variant, _ref3$offeringKey, offeringKey, existingMez, options, id, write_token, editResponse, createResponse, masterName, authorizationTokens, headers, body, storeClear, _yield$this$CallBitco2, logs, errors, warnings, existingMetadata, finalizeResponse;
|
|
350
359
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
360
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
361
|
+
while (1) {
|
|
362
|
+
switch (_context2.prev = _context2.next) {
|
|
363
|
+
case 0:
|
|
364
|
+
libraryId = _ref3.libraryId, objectId = _ref3.objectId, type = _ref3.type, name = _ref3.name, description = _ref3.description, metadata = _ref3.metadata, masterVersionHash = _ref3.masterVersionHash, abrProfile = _ref3.abrProfile, _ref3$variant = _ref3.variant, variant = _ref3$variant === void 0 ? "default" : _ref3$variant, _ref3$offeringKey = _ref3.offeringKey, offeringKey = _ref3$offeringKey === void 0 ? "default" : _ref3$offeringKey;
|
|
365
|
+
ValidateLibrary(libraryId);
|
|
366
|
+
ValidateVersion(masterVersionHash);
|
|
358
367
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
368
|
+
if (masterVersionHash) {
|
|
369
|
+
_context2.next = 5;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
363
372
|
|
|
364
|
-
|
|
373
|
+
throw Error("Master version hash not specified");
|
|
365
374
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
375
|
+
case 5:
|
|
376
|
+
existingMez = !!objectId;
|
|
377
|
+
options = type ? {
|
|
378
|
+
type: type
|
|
379
|
+
} : {};
|
|
371
380
|
|
|
372
|
-
|
|
373
|
-
|
|
381
|
+
if (!existingMez) {
|
|
382
|
+
_context2.next = 15;
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
_context2.next = 10;
|
|
387
|
+
return this.EditContentObject({
|
|
388
|
+
libraryId: libraryId,
|
|
389
|
+
objectId: objectId,
|
|
390
|
+
options: options
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
case 10:
|
|
394
|
+
editResponse = _context2.sent;
|
|
395
|
+
id = editResponse.id;
|
|
396
|
+
write_token = editResponse.write_token;
|
|
397
|
+
_context2.next = 20;
|
|
374
398
|
break;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
body = {
|
|
464
|
-
offering_key: offeringKey,
|
|
465
|
-
variant_key: variant,
|
|
466
|
-
prod_master_hash: masterVersionHash
|
|
467
|
-
};
|
|
468
|
-
storeClear = false;
|
|
469
|
-
|
|
470
|
-
if (!abrProfile) {
|
|
471
|
-
_context2.next = 49;
|
|
399
|
+
|
|
400
|
+
case 15:
|
|
401
|
+
_context2.next = 17;
|
|
402
|
+
return this.CreateContentObject({
|
|
403
|
+
libraryId: libraryId,
|
|
404
|
+
options: options
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
case 17:
|
|
408
|
+
createResponse = _context2.sent;
|
|
409
|
+
id = createResponse.id;
|
|
410
|
+
write_token = createResponse.write_token;
|
|
411
|
+
|
|
412
|
+
case 20:
|
|
413
|
+
_context2.next = 22;
|
|
414
|
+
return this.CreateEncryptionConk({
|
|
415
|
+
libraryId: libraryId,
|
|
416
|
+
objectId: id,
|
|
417
|
+
writeToken: write_token,
|
|
418
|
+
createKMSConk: true
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
case 22:
|
|
422
|
+
_context2.next = 24;
|
|
423
|
+
return this.ContentObjectMetadata({
|
|
424
|
+
versionHash: masterVersionHash,
|
|
425
|
+
metadataSubtree: "public/name"
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
case 24:
|
|
429
|
+
masterName = _context2.sent;
|
|
430
|
+
// Include authorization for library, master, and mezzanine
|
|
431
|
+
authorizationTokens = [];
|
|
432
|
+
_context2.t0 = authorizationTokens;
|
|
433
|
+
_context2.next = 29;
|
|
434
|
+
return this.authClient.AuthorizationToken({
|
|
435
|
+
libraryId: libraryId,
|
|
436
|
+
objectId: id,
|
|
437
|
+
update: true
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
case 29:
|
|
441
|
+
_context2.t1 = _context2.sent;
|
|
442
|
+
|
|
443
|
+
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
444
|
+
|
|
445
|
+
_context2.t2 = authorizationTokens;
|
|
446
|
+
_context2.next = 34;
|
|
447
|
+
return this.authClient.AuthorizationToken({
|
|
448
|
+
libraryId: libraryId
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
case 34:
|
|
452
|
+
_context2.t3 = _context2.sent;
|
|
453
|
+
|
|
454
|
+
_context2.t2.push.call(_context2.t2, _context2.t3);
|
|
455
|
+
|
|
456
|
+
_context2.t4 = authorizationTokens;
|
|
457
|
+
_context2.next = 39;
|
|
458
|
+
return this.authClient.AuthorizationToken({
|
|
459
|
+
versionHash: masterVersionHash
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
case 39:
|
|
463
|
+
_context2.t5 = _context2.sent;
|
|
464
|
+
|
|
465
|
+
_context2.t4.push.call(_context2.t4, _context2.t5);
|
|
466
|
+
|
|
467
|
+
headers = {
|
|
468
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
469
|
+
return "Bearer ".concat(token);
|
|
470
|
+
}).join(",")
|
|
471
|
+
};
|
|
472
|
+
body = {
|
|
473
|
+
offering_key: offeringKey,
|
|
474
|
+
variant_key: variant,
|
|
475
|
+
prod_master_hash: masterVersionHash
|
|
476
|
+
};
|
|
477
|
+
storeClear = false;
|
|
478
|
+
|
|
479
|
+
if (!abrProfile) {
|
|
480
|
+
_context2.next = 49;
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
body.abr_profile = abrProfile;
|
|
485
|
+
storeClear = abrProfile.store_clear;
|
|
486
|
+
_context2.next = 52;
|
|
472
487
|
break;
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
case 52:
|
|
492
|
-
if (storeClear) {
|
|
488
|
+
|
|
489
|
+
case 49:
|
|
490
|
+
_context2.next = 51;
|
|
491
|
+
return this.ContentObjectMetadata({
|
|
492
|
+
libraryId: libraryId,
|
|
493
|
+
objectId: this.utils.AddressToObjectId(this.utils.HashToAddress(libraryId)),
|
|
494
|
+
metadataSubtree: "abr_profile/store_clear"
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
case 51:
|
|
498
|
+
storeClear = _context2.sent;
|
|
499
|
+
|
|
500
|
+
case 52:
|
|
501
|
+
if (storeClear) {
|
|
502
|
+
_context2.next = 55;
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
505
|
+
|
|
493
506
|
_context2.next = 55;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
case 80:
|
|
603
|
-
case "end":
|
|
604
|
-
return _context2.stop();
|
|
507
|
+
return this.EncryptionConk({
|
|
508
|
+
libraryId: libraryId,
|
|
509
|
+
objectId: id,
|
|
510
|
+
writeToken: write_token
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
case 55:
|
|
514
|
+
_context2.next = 57;
|
|
515
|
+
return this.CallBitcodeMethod({
|
|
516
|
+
libraryId: libraryId,
|
|
517
|
+
objectId: id,
|
|
518
|
+
writeToken: write_token,
|
|
519
|
+
method: UrlJoin("media", "abr_mezzanine", "init"),
|
|
520
|
+
headers: headers,
|
|
521
|
+
body: body,
|
|
522
|
+
constant: false
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
case 57:
|
|
526
|
+
_yield$this$CallBitco2 = _context2.sent;
|
|
527
|
+
logs = _yield$this$CallBitco2.logs;
|
|
528
|
+
errors = _yield$this$CallBitco2.errors;
|
|
529
|
+
warnings = _yield$this$CallBitco2.warnings;
|
|
530
|
+
|
|
531
|
+
if (!metadata) {
|
|
532
|
+
metadata = {};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (!metadata["public"]) {
|
|
536
|
+
metadata["public"] = {};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (!metadata["public"].asset_metadata) {
|
|
540
|
+
metadata["public"].asset_metadata = {};
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
metadata.master = {
|
|
544
|
+
name: masterName,
|
|
545
|
+
id: this.utils.DecodeVersionHash(masterVersionHash).objectId,
|
|
546
|
+
hash: masterVersionHash,
|
|
547
|
+
variant: variant
|
|
548
|
+
};
|
|
549
|
+
metadata["public"] = _objectSpread({}, metadata["public"]);
|
|
550
|
+
metadata["public"].asset_metadata = _objectSpread({
|
|
551
|
+
sources: _defineProperty({}, offeringKey, {
|
|
552
|
+
"/": "./rep/playout/".concat(offeringKey, "/options.json")
|
|
553
|
+
})
|
|
554
|
+
}, metadata["public"].asset_metadata);
|
|
555
|
+
|
|
556
|
+
if (name || !existingMez) {
|
|
557
|
+
metadata.name = name || "".concat(masterName, " Mezzanine");
|
|
558
|
+
metadata["public"].name = name || "".concat(masterName, " Mezzanine");
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (description || !existingMez) {
|
|
562
|
+
metadata.description = description || "";
|
|
563
|
+
metadata["public"].description = description || "";
|
|
564
|
+
} // retrieve existing metadata to merge with updated metadata
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
_context2.next = 71;
|
|
568
|
+
return this.ContentObjectMetadata({
|
|
569
|
+
libraryId: libraryId,
|
|
570
|
+
objectId: id,
|
|
571
|
+
writeToken: write_token
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
case 71:
|
|
575
|
+
existingMetadata = _context2.sent;
|
|
576
|
+
// newer metadata values replace existing metadata, unless both new and old values are objects,
|
|
577
|
+
// in which case their keys are merged recursively
|
|
578
|
+
metadata = R.mergeDeepRight(existingMetadata, metadata);
|
|
579
|
+
|
|
580
|
+
if (!existingMez) {
|
|
581
|
+
// set creation date
|
|
582
|
+
metadata.elv_created_at = new Date().getTime();
|
|
583
|
+
} // write metadata to mezzanine object
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
_context2.next = 76;
|
|
587
|
+
return this.ReplaceMetadata({
|
|
588
|
+
libraryId: libraryId,
|
|
589
|
+
objectId: id,
|
|
590
|
+
writeToken: write_token,
|
|
591
|
+
metadata: metadata
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
case 76:
|
|
595
|
+
_context2.next = 78;
|
|
596
|
+
return this.FinalizeContentObject({
|
|
597
|
+
libraryId: libraryId,
|
|
598
|
+
objectId: id,
|
|
599
|
+
writeToken: write_token,
|
|
600
|
+
commitMessage: "Create ABR mezzanine"
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
case 78:
|
|
604
|
+
finalizeResponse = _context2.sent;
|
|
605
|
+
return _context2.abrupt("return", _objectSpread({
|
|
606
|
+
logs: logs || [],
|
|
607
|
+
warnings: warnings || [],
|
|
608
|
+
errors: errors || []
|
|
609
|
+
}, finalizeResponse));
|
|
610
|
+
|
|
611
|
+
case 80:
|
|
612
|
+
case "end":
|
|
613
|
+
return _context2.stop();
|
|
614
|
+
}
|
|
605
615
|
}
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
616
|
+
}, _callee2, this);
|
|
617
|
+
}));
|
|
618
|
+
|
|
619
|
+
return function (_x2) {
|
|
620
|
+
return _ref4.apply(this, arguments);
|
|
621
|
+
};
|
|
622
|
+
}();
|
|
609
623
|
/**
|
|
610
624
|
* Start any incomplete jobs on the specified mezzanine
|
|
611
625
|
*
|
|
@@ -622,163 +636,174 @@ exports.CreateABRMezzanine = function _callee2(_ref4) {
|
|
|
622
636
|
*/
|
|
623
637
|
|
|
624
638
|
|
|
625
|
-
exports.StartABRMezzanineJobs = function
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
case 4:
|
|
647
|
-
mezzanineMetadata = _context4.sent;
|
|
648
|
-
prepSpecs = mezzanineMetadata[offeringKey].mez_prep_specs || []; // Retrieve all masters associated with this offering
|
|
649
|
-
|
|
650
|
-
masterVersionHashes = Object.keys(prepSpecs).map(function (spec) {
|
|
651
|
-
return (prepSpecs[spec].source_streams || []).map(function (stream) {
|
|
652
|
-
return stream.source_hash;
|
|
639
|
+
exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
640
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
641
|
+
var _this = this;
|
|
642
|
+
|
|
643
|
+
var libraryId, objectId, _ref5$offeringKey, offeringKey, _ref5$access, access, _ref5$jobIndexes, jobIndexes, mezzanineMetadata, prepSpecs, masterVersionHashes, authorizationTokens, headers, processingDraft, lroInfo, statusDraft, finalizeResponse, _yield$this$CallBitco3, data, errors, warnings, logs;
|
|
644
|
+
|
|
645
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
646
|
+
while (1) {
|
|
647
|
+
switch (_context4.prev = _context4.next) {
|
|
648
|
+
case 0:
|
|
649
|
+
libraryId = _ref5.libraryId, objectId = _ref5.objectId, _ref5$offeringKey = _ref5.offeringKey, offeringKey = _ref5$offeringKey === void 0 ? "default" : _ref5$offeringKey, _ref5$access = _ref5.access, access = _ref5$access === void 0 ? [] : _ref5$access, _ref5$jobIndexes = _ref5.jobIndexes, jobIndexes = _ref5$jobIndexes === void 0 ? null : _ref5$jobIndexes;
|
|
650
|
+
ValidateParameters({
|
|
651
|
+
libraryId: libraryId,
|
|
652
|
+
objectId: objectId
|
|
653
|
+
});
|
|
654
|
+
_context4.next = 4;
|
|
655
|
+
return this.ContentObjectMetadata({
|
|
656
|
+
libraryId: libraryId,
|
|
657
|
+
objectId: objectId,
|
|
658
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
653
659
|
});
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
660
|
+
|
|
661
|
+
case 4:
|
|
662
|
+
mezzanineMetadata = _context4.sent;
|
|
663
|
+
prepSpecs = mezzanineMetadata[offeringKey].mez_prep_specs || []; // Retrieve all masters associated with this offering
|
|
664
|
+
|
|
665
|
+
masterVersionHashes = Object.keys(prepSpecs).map(function (spec) {
|
|
666
|
+
return (prepSpecs[spec].source_streams || []).map(function (stream) {
|
|
667
|
+
return stream.source_hash;
|
|
668
|
+
});
|
|
669
|
+
}); // Flatten and filter
|
|
670
|
+
|
|
671
|
+
masterVersionHashes = [].concat.apply([], masterVersionHashes).filter(function (hash) {
|
|
672
|
+
return hash;
|
|
673
|
+
}).filter(function (v, i, a) {
|
|
674
|
+
return a.indexOf(v) === i;
|
|
675
|
+
}); // Retrieve authorization tokens for all masters and the mezzanine
|
|
676
|
+
|
|
677
|
+
_context4.next = 10;
|
|
678
|
+
return Promise.all(masterVersionHashes.map( /*#__PURE__*/function () {
|
|
679
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(versionHash) {
|
|
680
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
681
|
+
while (1) {
|
|
682
|
+
switch (_context3.prev = _context3.next) {
|
|
683
|
+
case 0:
|
|
684
|
+
_context3.next = 2;
|
|
685
|
+
return _this.authClient.AuthorizationToken({
|
|
686
|
+
versionHash: versionHash
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
case 2:
|
|
690
|
+
return _context3.abrupt("return", _context3.sent);
|
|
691
|
+
|
|
692
|
+
case 3:
|
|
693
|
+
case "end":
|
|
694
|
+
return _context3.stop();
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}, _callee3);
|
|
698
|
+
}));
|
|
699
|
+
|
|
700
|
+
return function (_x4) {
|
|
701
|
+
return _ref7.apply(this, arguments);
|
|
702
|
+
};
|
|
703
|
+
}()));
|
|
704
|
+
|
|
705
|
+
case 10:
|
|
706
|
+
authorizationTokens = _context4.sent;
|
|
707
|
+
_context4.next = 13;
|
|
708
|
+
return this.authClient.AuthorizationToken({
|
|
709
|
+
libraryId: libraryId,
|
|
710
|
+
objectId: objectId,
|
|
711
|
+
update: true
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
case 13:
|
|
715
|
+
_context4.t0 = _context4.sent;
|
|
716
|
+
authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
|
|
717
|
+
headers = {
|
|
718
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
719
|
+
return "Bearer ".concat(token);
|
|
720
|
+
}).join(",")
|
|
721
|
+
};
|
|
722
|
+
_context4.next = 18;
|
|
723
|
+
return this.EditContentObject({
|
|
724
|
+
libraryId: libraryId,
|
|
725
|
+
objectId: objectId
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
case 18:
|
|
729
|
+
processingDraft = _context4.sent;
|
|
730
|
+
lroInfo = {
|
|
731
|
+
write_token: processingDraft.write_token,
|
|
732
|
+
node: this.HttpClient.BaseURI().toString(),
|
|
733
|
+
offering: offeringKey
|
|
734
|
+
}; // Update metadata with LRO version write token
|
|
735
|
+
|
|
736
|
+
_context4.next = 22;
|
|
737
|
+
return this.EditContentObject({
|
|
738
|
+
libraryId: libraryId,
|
|
739
|
+
objectId: objectId
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
case 22:
|
|
743
|
+
statusDraft = _context4.sent;
|
|
744
|
+
_context4.next = 25;
|
|
745
|
+
return this.ReplaceMetadata({
|
|
746
|
+
libraryId: libraryId,
|
|
747
|
+
objectId: objectId,
|
|
748
|
+
writeToken: statusDraft.write_token,
|
|
749
|
+
metadataSubtree: "lro_draft_".concat(offeringKey),
|
|
750
|
+
metadata: lroInfo
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
case 25:
|
|
754
|
+
_context4.next = 27;
|
|
755
|
+
return this.FinalizeContentObject({
|
|
756
|
+
libraryId: libraryId,
|
|
757
|
+
objectId: objectId,
|
|
758
|
+
writeToken: statusDraft.write_token,
|
|
759
|
+
commitMessage: "Mezzanine LRO status"
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
case 27:
|
|
763
|
+
finalizeResponse = _context4.sent;
|
|
764
|
+
_context4.next = 30;
|
|
765
|
+
return this.CallBitcodeMethod({
|
|
766
|
+
libraryId: libraryId,
|
|
767
|
+
objectId: objectId,
|
|
768
|
+
writeToken: processingDraft.write_token,
|
|
769
|
+
headers: headers,
|
|
770
|
+
method: UrlJoin("media", "abr_mezzanine", "prep_start"),
|
|
771
|
+
constant: false,
|
|
772
|
+
body: {
|
|
773
|
+
access: access,
|
|
774
|
+
offering_key: offeringKey,
|
|
775
|
+
job_indexes: jobIndexes
|
|
680
776
|
}
|
|
681
777
|
});
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
return _regeneratorRuntime.awrap(this.EditContentObject({
|
|
704
|
-
libraryId: libraryId,
|
|
705
|
-
objectId: objectId
|
|
706
|
-
}));
|
|
707
|
-
|
|
708
|
-
case 19:
|
|
709
|
-
processingDraft = _context4.sent;
|
|
710
|
-
lroInfo = {
|
|
711
|
-
write_token: processingDraft.write_token,
|
|
712
|
-
node: this.HttpClient.BaseURI().toString(),
|
|
713
|
-
offering: offeringKey
|
|
714
|
-
}; // Update metadata with LRO version write token
|
|
715
|
-
|
|
716
|
-
_context4.next = 23;
|
|
717
|
-
return _regeneratorRuntime.awrap(this.EditContentObject({
|
|
718
|
-
libraryId: libraryId,
|
|
719
|
-
objectId: objectId
|
|
720
|
-
}));
|
|
721
|
-
|
|
722
|
-
case 23:
|
|
723
|
-
statusDraft = _context4.sent;
|
|
724
|
-
_context4.next = 26;
|
|
725
|
-
return _regeneratorRuntime.awrap(this.ReplaceMetadata({
|
|
726
|
-
libraryId: libraryId,
|
|
727
|
-
objectId: objectId,
|
|
728
|
-
writeToken: statusDraft.write_token,
|
|
729
|
-
metadataSubtree: "lro_draft_".concat(offeringKey),
|
|
730
|
-
metadata: lroInfo
|
|
731
|
-
}));
|
|
732
|
-
|
|
733
|
-
case 26:
|
|
734
|
-
_context4.next = 28;
|
|
735
|
-
return _regeneratorRuntime.awrap(this.FinalizeContentObject({
|
|
736
|
-
libraryId: libraryId,
|
|
737
|
-
objectId: objectId,
|
|
738
|
-
writeToken: statusDraft.write_token,
|
|
739
|
-
commitMessage: "Mezzanine LRO status"
|
|
740
|
-
}));
|
|
741
|
-
|
|
742
|
-
case 28:
|
|
743
|
-
finalizeResponse = _context4.sent;
|
|
744
|
-
_context4.next = 31;
|
|
745
|
-
return _regeneratorRuntime.awrap(this.CallBitcodeMethod({
|
|
746
|
-
libraryId: libraryId,
|
|
747
|
-
objectId: objectId,
|
|
748
|
-
writeToken: processingDraft.write_token,
|
|
749
|
-
headers: headers,
|
|
750
|
-
method: UrlJoin("media", "abr_mezzanine", "prep_start"),
|
|
751
|
-
constant: false,
|
|
752
|
-
body: {
|
|
753
|
-
access: access,
|
|
754
|
-
offering_key: offeringKey,
|
|
755
|
-
job_indexes: jobIndexes
|
|
756
|
-
}
|
|
757
|
-
}));
|
|
758
|
-
|
|
759
|
-
case 31:
|
|
760
|
-
_ref7 = _context4.sent;
|
|
761
|
-
data = _ref7.data;
|
|
762
|
-
errors = _ref7.errors;
|
|
763
|
-
warnings = _ref7.warnings;
|
|
764
|
-
logs = _ref7.logs;
|
|
765
|
-
return _context4.abrupt("return", {
|
|
766
|
-
hash: finalizeResponse.hash,
|
|
767
|
-
lro_draft: lroInfo,
|
|
768
|
-
writeToken: processingDraft.write_token,
|
|
769
|
-
data: data,
|
|
770
|
-
logs: logs || [],
|
|
771
|
-
warnings: warnings || [],
|
|
772
|
-
errors: errors || []
|
|
773
|
-
});
|
|
774
|
-
|
|
775
|
-
case 37:
|
|
776
|
-
case "end":
|
|
777
|
-
return _context4.stop();
|
|
778
|
+
|
|
779
|
+
case 30:
|
|
780
|
+
_yield$this$CallBitco3 = _context4.sent;
|
|
781
|
+
data = _yield$this$CallBitco3.data;
|
|
782
|
+
errors = _yield$this$CallBitco3.errors;
|
|
783
|
+
warnings = _yield$this$CallBitco3.warnings;
|
|
784
|
+
logs = _yield$this$CallBitco3.logs;
|
|
785
|
+
return _context4.abrupt("return", {
|
|
786
|
+
hash: finalizeResponse.hash,
|
|
787
|
+
lro_draft: lroInfo,
|
|
788
|
+
writeToken: processingDraft.write_token,
|
|
789
|
+
data: data,
|
|
790
|
+
logs: logs || [],
|
|
791
|
+
warnings: warnings || [],
|
|
792
|
+
errors: errors || []
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
case 36:
|
|
796
|
+
case "end":
|
|
797
|
+
return _context4.stop();
|
|
798
|
+
}
|
|
778
799
|
}
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
800
|
+
}, _callee4, this);
|
|
801
|
+
}));
|
|
802
|
+
|
|
803
|
+
return function (_x3) {
|
|
804
|
+
return _ref6.apply(this, arguments);
|
|
805
|
+
};
|
|
806
|
+
}();
|
|
782
807
|
/**
|
|
783
808
|
* Retrieve status information for a long running operation (LRO) on the given object.
|
|
784
809
|
*
|
|
@@ -792,120 +817,126 @@ exports.StartABRMezzanineJobs = function _callee4(_ref6) {
|
|
|
792
817
|
*/
|
|
793
818
|
|
|
794
819
|
|
|
795
|
-
exports.LROStatus = function
|
|
796
|
-
var
|
|
797
|
-
|
|
798
|
-
return _regeneratorRuntime.async(function _callee5$(_context5) {
|
|
799
|
-
while (1) {
|
|
800
|
-
switch (_context5.prev = _context5.next) {
|
|
801
|
-
case 0:
|
|
802
|
-
libraryId = _ref8.libraryId, objectId = _ref8.objectId, _ref8$offeringKey = _ref8.offeringKey, offeringKey = _ref8$offeringKey === void 0 ? "default" : _ref8$offeringKey;
|
|
803
|
-
ValidateParameters({
|
|
804
|
-
libraryId: libraryId,
|
|
805
|
-
objectId: objectId
|
|
806
|
-
});
|
|
807
|
-
_context5.next = 4;
|
|
808
|
-
return _regeneratorRuntime.awrap(this.ContentObjectMetadata({
|
|
809
|
-
libraryId: libraryId,
|
|
810
|
-
objectId: objectId,
|
|
811
|
-
metadataSubtree: "lro_draft_".concat(offeringKey)
|
|
812
|
-
}));
|
|
813
|
-
|
|
814
|
-
case 4:
|
|
815
|
-
_context5.t0 = _context5.sent;
|
|
816
|
-
|
|
817
|
-
if (_context5.t0) {
|
|
818
|
-
_context5.next = 9;
|
|
819
|
-
break;
|
|
820
|
-
}
|
|
820
|
+
exports.LROStatus = /*#__PURE__*/function () {
|
|
821
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
822
|
+
var libraryId, objectId, _ref8$offeringKey, offeringKey, lroDraft, ready, error, result, fabricURIs;
|
|
821
823
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
824
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
825
|
+
while (1) {
|
|
826
|
+
switch (_context5.prev = _context5.next) {
|
|
827
|
+
case 0:
|
|
828
|
+
libraryId = _ref8.libraryId, objectId = _ref8.objectId, _ref8$offeringKey = _ref8.offeringKey, offeringKey = _ref8$offeringKey === void 0 ? "default" : _ref8$offeringKey;
|
|
829
|
+
ValidateParameters({
|
|
830
|
+
libraryId: libraryId,
|
|
831
|
+
objectId: objectId
|
|
832
|
+
});
|
|
833
|
+
_context5.next = 4;
|
|
834
|
+
return this.ContentObjectMetadata({
|
|
835
|
+
libraryId: libraryId,
|
|
836
|
+
objectId: objectId,
|
|
837
|
+
metadataSubtree: "lro_draft_".concat(offeringKey)
|
|
838
|
+
});
|
|
828
839
|
|
|
829
|
-
|
|
830
|
-
|
|
840
|
+
case 4:
|
|
841
|
+
_context5.t0 = _context5.sent;
|
|
831
842
|
|
|
832
|
-
|
|
833
|
-
|
|
843
|
+
if (_context5.t0) {
|
|
844
|
+
_context5.next = 9;
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
834
847
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
848
|
+
_context5.next = 8;
|
|
849
|
+
return this.ContentObjectMetadata({
|
|
850
|
+
libraryId: libraryId,
|
|
851
|
+
objectId: objectId,
|
|
852
|
+
metadataSubtree: "lro_draft"
|
|
853
|
+
});
|
|
839
854
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
libraryId: libraryId,
|
|
843
|
-
objectId: objectId,
|
|
844
|
-
metadataSubtree: UrlJoin("abr_mezzanine", "offerings", offeringKey, "ready")
|
|
845
|
-
}));
|
|
855
|
+
case 8:
|
|
856
|
+
_context5.t0 = _context5.sent;
|
|
846
857
|
|
|
847
|
-
|
|
848
|
-
|
|
858
|
+
case 9:
|
|
859
|
+
lroDraft = _context5.t0;
|
|
849
860
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
if (!error) {
|
|
893
|
-
_context5.next = 35;
|
|
861
|
+
if (!(!lroDraft || !lroDraft.write_token)) {
|
|
862
|
+
_context5.next = 19;
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
_context5.next = 13;
|
|
867
|
+
return this.ContentObjectMetadata({
|
|
868
|
+
libraryId: libraryId,
|
|
869
|
+
objectId: objectId,
|
|
870
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings", offeringKey, "ready")
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
case 13:
|
|
874
|
+
ready = _context5.sent;
|
|
875
|
+
|
|
876
|
+
if (!ready) {
|
|
877
|
+
_context5.next = 18;
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
throw Error("Mezzanine already finalized for offering '".concat(offeringKey, "'"));
|
|
882
|
+
|
|
883
|
+
case 18:
|
|
884
|
+
throw Error("No LRO draft found for this mezzanine");
|
|
885
|
+
|
|
886
|
+
case 19:
|
|
887
|
+
fabricURIs = this.fabricURIs;
|
|
888
|
+
_context5.prev = 20;
|
|
889
|
+
this.SetNodes({
|
|
890
|
+
fabricURIs: [lroDraft.node].concat(_toConsumableArray(fabricURIs))
|
|
891
|
+
});
|
|
892
|
+
_context5.next = 24;
|
|
893
|
+
return this.ContentObjectMetadata({
|
|
894
|
+
libraryId: libraryId,
|
|
895
|
+
objectId: objectId,
|
|
896
|
+
writeToken: lroDraft.write_token,
|
|
897
|
+
metadataSubtree: "lro_status"
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
case 24:
|
|
901
|
+
result = _context5.sent;
|
|
902
|
+
_context5.next = 30;
|
|
894
903
|
break;
|
|
895
|
-
}
|
|
896
904
|
|
|
897
|
-
|
|
905
|
+
case 27:
|
|
906
|
+
_context5.prev = 27;
|
|
907
|
+
_context5.t1 = _context5["catch"](20);
|
|
908
|
+
error = _context5.t1;
|
|
898
909
|
|
|
899
|
-
|
|
900
|
-
|
|
910
|
+
case 30:
|
|
911
|
+
_context5.prev = 30;
|
|
912
|
+
this.SetNodes({
|
|
913
|
+
fabricURIs: fabricURIs
|
|
914
|
+
});
|
|
915
|
+
return _context5.finish(30);
|
|
916
|
+
|
|
917
|
+
case 33:
|
|
918
|
+
if (!error) {
|
|
919
|
+
_context5.next = 35;
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
901
922
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
923
|
+
throw error;
|
|
924
|
+
|
|
925
|
+
case 35:
|
|
926
|
+
return _context5.abrupt("return", result);
|
|
927
|
+
|
|
928
|
+
case 36:
|
|
929
|
+
case "end":
|
|
930
|
+
return _context5.stop();
|
|
931
|
+
}
|
|
905
932
|
}
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
|
|
933
|
+
}, _callee5, this, [[20, 27, 30, 33]]);
|
|
934
|
+
}));
|
|
935
|
+
|
|
936
|
+
return function (_x5) {
|
|
937
|
+
return _ref9.apply(this, arguments);
|
|
938
|
+
};
|
|
939
|
+
}();
|
|
909
940
|
/**
|
|
910
941
|
* Finalize a mezzanine object after all jobs have finished
|
|
911
942
|
*
|
|
@@ -920,139 +951,145 @@ exports.LROStatus = function _callee5(_ref8) {
|
|
|
920
951
|
*/
|
|
921
952
|
|
|
922
953
|
|
|
923
|
-
exports.FinalizeABRMezzanine = function
|
|
924
|
-
var
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
case 35:
|
|
1031
|
-
_context6.prev = 35;
|
|
1032
|
-
_context6.t2 = _context6["catch"](8);
|
|
1033
|
-
error = _context6.t2;
|
|
1034
|
-
|
|
1035
|
-
case 38:
|
|
1036
|
-
_context6.prev = 38;
|
|
1037
|
-
// Ensure original http client is restored
|
|
1038
|
-
this.HttpClient = httpClient;
|
|
1039
|
-
return _context6.finish(38);
|
|
1040
|
-
|
|
1041
|
-
case 41:
|
|
1042
|
-
if (!error) {
|
|
1043
|
-
_context6.next = 43;
|
|
954
|
+
exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
955
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
|
|
956
|
+
var libraryId, objectId, _ref10$offeringKey, offeringKey, lroDraft, httpClient, error, result, mezzanineMetadata, masterHash, authorizationTokens, headers, _yield$this$CallBitco4, data, errors, warnings, logs, finalizeResponse;
|
|
957
|
+
|
|
958
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
959
|
+
while (1) {
|
|
960
|
+
switch (_context6.prev = _context6.next) {
|
|
961
|
+
case 0:
|
|
962
|
+
libraryId = _ref10.libraryId, objectId = _ref10.objectId, _ref10$offeringKey = _ref10.offeringKey, offeringKey = _ref10$offeringKey === void 0 ? "default" : _ref10$offeringKey;
|
|
963
|
+
ValidateParameters({
|
|
964
|
+
libraryId: libraryId,
|
|
965
|
+
objectId: objectId
|
|
966
|
+
});
|
|
967
|
+
_context6.next = 4;
|
|
968
|
+
return this.ContentObjectMetadata({
|
|
969
|
+
libraryId: libraryId,
|
|
970
|
+
objectId: objectId,
|
|
971
|
+
metadataSubtree: "lro_draft_".concat(offeringKey)
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
case 4:
|
|
975
|
+
lroDraft = _context6.sent;
|
|
976
|
+
|
|
977
|
+
if (!(!lroDraft || !lroDraft.write_token)) {
|
|
978
|
+
_context6.next = 7;
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
throw Error("No LRO draft found for this mezzanine");
|
|
983
|
+
|
|
984
|
+
case 7:
|
|
985
|
+
httpClient = this.HttpClient;
|
|
986
|
+
_context6.prev = 8;
|
|
987
|
+
// Point directly to the node containing the draft
|
|
988
|
+
this.HttpClient = new HttpClient({
|
|
989
|
+
uris: [lroDraft.node],
|
|
990
|
+
debug: httpClient.debug
|
|
991
|
+
});
|
|
992
|
+
_context6.next = 12;
|
|
993
|
+
return this.ContentObjectMetadata({
|
|
994
|
+
libraryId: libraryId,
|
|
995
|
+
objectId: objectId,
|
|
996
|
+
writeToken: lroDraft.write_token,
|
|
997
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
case 12:
|
|
1001
|
+
mezzanineMetadata = _context6.sent;
|
|
1002
|
+
masterHash = mezzanineMetadata[offeringKey].prod_master_hash; // Authorization token for mezzanine and master
|
|
1003
|
+
|
|
1004
|
+
_context6.next = 16;
|
|
1005
|
+
return this.authClient.AuthorizationToken({
|
|
1006
|
+
libraryId: libraryId,
|
|
1007
|
+
objectId: objectId,
|
|
1008
|
+
update: true
|
|
1009
|
+
});
|
|
1010
|
+
|
|
1011
|
+
case 16:
|
|
1012
|
+
_context6.t0 = _context6.sent;
|
|
1013
|
+
_context6.next = 19;
|
|
1014
|
+
return this.authClient.AuthorizationToken({
|
|
1015
|
+
versionHash: masterHash
|
|
1016
|
+
});
|
|
1017
|
+
|
|
1018
|
+
case 19:
|
|
1019
|
+
_context6.t1 = _context6.sent;
|
|
1020
|
+
authorizationTokens = [_context6.t0, _context6.t1];
|
|
1021
|
+
headers = {
|
|
1022
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
1023
|
+
return "Bearer ".concat(token);
|
|
1024
|
+
}).join(",")
|
|
1025
|
+
};
|
|
1026
|
+
_context6.next = 24;
|
|
1027
|
+
return this.CallBitcodeMethod({
|
|
1028
|
+
objectId: objectId,
|
|
1029
|
+
libraryId: libraryId,
|
|
1030
|
+
writeToken: lroDraft.write_token,
|
|
1031
|
+
method: UrlJoin("media", "abr_mezzanine", "offerings", offeringKey, "finalize"),
|
|
1032
|
+
headers: headers,
|
|
1033
|
+
constant: false
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
case 24:
|
|
1037
|
+
_yield$this$CallBitco4 = _context6.sent;
|
|
1038
|
+
data = _yield$this$CallBitco4.data;
|
|
1039
|
+
errors = _yield$this$CallBitco4.errors;
|
|
1040
|
+
warnings = _yield$this$CallBitco4.warnings;
|
|
1041
|
+
logs = _yield$this$CallBitco4.logs;
|
|
1042
|
+
_context6.next = 31;
|
|
1043
|
+
return this.FinalizeContentObject({
|
|
1044
|
+
libraryId: libraryId,
|
|
1045
|
+
objectId: objectId,
|
|
1046
|
+
writeToken: lroDraft.write_token,
|
|
1047
|
+
commitMessage: "Finalize ABR mezzanine",
|
|
1048
|
+
awaitCommitConfirmation: false
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
case 31:
|
|
1052
|
+
finalizeResponse = _context6.sent;
|
|
1053
|
+
result = _objectSpread({
|
|
1054
|
+
data: data,
|
|
1055
|
+
logs: logs || [],
|
|
1056
|
+
warnings: warnings || [],
|
|
1057
|
+
errors: errors || []
|
|
1058
|
+
}, finalizeResponse);
|
|
1059
|
+
_context6.next = 38;
|
|
1044
1060
|
break;
|
|
1045
|
-
}
|
|
1046
1061
|
|
|
1047
|
-
|
|
1062
|
+
case 35:
|
|
1063
|
+
_context6.prev = 35;
|
|
1064
|
+
_context6.t2 = _context6["catch"](8);
|
|
1065
|
+
error = _context6.t2;
|
|
1066
|
+
|
|
1067
|
+
case 38:
|
|
1068
|
+
_context6.prev = 38;
|
|
1069
|
+
// Ensure original http client is restored
|
|
1070
|
+
this.HttpClient = httpClient;
|
|
1071
|
+
return _context6.finish(38);
|
|
1072
|
+
|
|
1073
|
+
case 41:
|
|
1074
|
+
if (!error) {
|
|
1075
|
+
_context6.next = 43;
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1048
1078
|
|
|
1049
|
-
|
|
1050
|
-
return _context6.abrupt("return", result);
|
|
1079
|
+
throw error;
|
|
1051
1080
|
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1081
|
+
case 43:
|
|
1082
|
+
return _context6.abrupt("return", result);
|
|
1083
|
+
|
|
1084
|
+
case 44:
|
|
1085
|
+
case "end":
|
|
1086
|
+
return _context6.stop();
|
|
1087
|
+
}
|
|
1055
1088
|
}
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1089
|
+
}, _callee6, this, [[8, 35, 38, 41]]);
|
|
1090
|
+
}));
|
|
1091
|
+
|
|
1092
|
+
return function (_x6) {
|
|
1093
|
+
return _ref11.apply(this, arguments);
|
|
1094
|
+
};
|
|
1095
|
+
}();
|