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