@dolbyio/dolbyio-rest-apis-client 3.4.2 → 3.4.4
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/{src/authentication.d.ts → authentication.d.ts} +0 -0
- package/dist/authentication.js +64 -0
- package/dist/{src/communications → communications}/authentication.d.ts +0 -0
- package/dist/communications/authentication.js +62 -0
- package/dist/{src/communications → communications}/conference.d.ts +0 -0
- package/dist/communications/conference.js +380 -0
- package/dist/{src/communications → communications}/index.d.ts +0 -0
- package/dist/communications/index.js +19 -0
- package/dist/{src/communications → communications}/internal/httpHelpers.d.ts +0 -0
- package/dist/communications/internal/httpHelpers.js +69 -0
- package/dist/{src/communications → communications}/internal/urls.d.ts +0 -0
- package/dist/communications/internal/urls.js +10 -0
- package/dist/{src/communications → communications}/monitor/conferences.d.ts +0 -0
- package/dist/communications/monitor/conferences.js +399 -0
- package/dist/{src/communications → communications}/monitor/index.d.ts +0 -0
- package/dist/communications/monitor/index.js +15 -0
- package/dist/{src/communications → communications}/monitor/recordings.d.ts +0 -0
- package/dist/communications/monitor/recordings.js +356 -0
- package/dist/{src/communications → communications}/monitor/webhooks.d.ts +0 -0
- package/dist/communications/monitor/webhooks.js +140 -0
- package/dist/{src/communications → communications}/recording.d.ts +0 -0
- package/dist/communications/recording.js +100 -0
- package/dist/communications/remix.js +107 -0
- package/dist/{src/communications → communications}/streaming.d.ts +0 -0
- package/dist/communications/streaming.js +191 -0
- package/dist/{src/communications → communications}/types/conference.d.ts +0 -0
- package/dist/communications/types/conference.js +5 -0
- package/dist/{src/communications → communications}/types/conferences.d.ts +0 -0
- package/dist/communications/types/conferences.js +5 -0
- package/dist/{src/communications → communications}/types/core.d.ts +0 -0
- package/dist/communications/types/core.js +5 -0
- package/dist/{src/communications → communications}/types/participant.d.ts +0 -0
- package/dist/communications/types/participant.js +1 -0
- package/dist/{src/communications → communications}/types/permission.d.ts +0 -0
- package/dist/communications/types/permission.js +22 -0
- package/dist/{src/communications → communications}/types/recordings.d.ts +0 -0
- package/dist/communications/types/recordings.js +5 -0
- package/dist/communications/types/remixStatus.js +1 -0
- package/dist/{src/communications → communications}/types/rtcpMode.d.ts +0 -0
- package/dist/communications/types/rtcpMode.js +13 -0
- package/dist/{src/communications → communications}/types/spatialAudio.d.ts +0 -0
- package/dist/communications/types/spatialAudio.js +5 -0
- package/dist/{src/communications → communications}/types/videoCodec.d.ts +0 -0
- package/dist/communications/types/videoCodec.js +12 -0
- package/dist/{src/communications → communications}/types/webhooks.d.ts +0 -0
- package/dist/communications/types/webhooks.js +5 -0
- package/dist/{src/index.d.ts → index.d.ts} +2 -1
- package/dist/index.js +17 -0
- package/dist/{src/internal → internal}/httpHelpers.d.ts +0 -0
- package/dist/internal/httpHelpers.js +217 -0
- package/dist/{src/internal → internal}/urls.d.ts +0 -0
- package/dist/internal/urls.js +8 -0
- package/dist/{src/media → media}/analyze.d.ts +0 -0
- package/dist/media/analyze.js +95 -0
- package/dist/{src/media → media}/analyzeSpeech.d.ts +0 -0
- package/dist/media/analyzeSpeech.js +89 -0
- package/dist/{src/media → media}/diagnose.d.ts +0 -0
- package/dist/media/diagnose.js +91 -0
- package/dist/{src/media → media}/enhance.d.ts +0 -0
- package/dist/media/enhance.js +86 -0
- package/dist/{src/media → media}/index.d.ts +0 -0
- package/dist/media/index.js +27 -0
- package/dist/{src/media → media}/internal/httpHelpers.d.ts +0 -0
- package/dist/media/internal/httpHelpers.js +61 -0
- package/dist/{src/media → media}/internal/jobsHelpers.d.ts +0 -0
- package/dist/media/internal/jobsHelpers.js +85 -0
- package/dist/{src/media → media}/internal/urls.d.ts +0 -0
- package/dist/media/internal/urls.js +8 -0
- package/dist/{src/media → media}/io.d.ts +0 -0
- package/dist/media/io.js +176 -0
- package/dist/{src/media → media}/jobs.d.ts +0 -0
- package/dist/media/jobs.js +182 -0
- package/dist/{src/media → media}/mastering.d.ts +0 -0
- package/dist/media/mastering.js +166 -0
- package/dist/{src/media → media}/transcode.d.ts +0 -0
- package/dist/media/transcode.js +82 -0
- package/dist/{src/media → media}/types/analyze.d.ts +0 -0
- package/dist/media/types/analyze.js +5 -0
- package/dist/{src/media → media}/types/analyzeSpeech.d.ts +0 -0
- package/dist/media/types/analyzeSpeech.js +5 -0
- package/dist/{src/media → media}/types/diagnose.d.ts +0 -0
- package/dist/media/types/diagnose.js +5 -0
- package/dist/{src/media → media}/types/enhance.d.ts +0 -0
- package/dist/media/types/enhance.js +5 -0
- package/dist/{src/media → media}/types/jobResults.d.ts +0 -0
- package/dist/media/types/jobResults.js +5 -0
- package/dist/{src/media → media}/types/jobs.d.ts +0 -0
- package/dist/media/types/jobs.js +5 -0
- package/dist/{src/media → media}/types/mastering.d.ts +0 -0
- package/dist/media/types/mastering.js +5 -0
- package/dist/{src/media → media}/types/transcode.d.ts +0 -0
- package/dist/media/types/transcode.js +5 -0
- package/dist/{src/media → media}/types/webhooks.d.ts +0 -0
- package/dist/media/types/webhooks.js +5 -0
- package/dist/{src/media → media}/webhooks.d.ts +0 -0
- package/dist/media/webhooks.js +216 -0
- package/dist/{src/types → types}/jwtToken.d.ts +0 -0
- package/dist/types/jwtToken.js +1 -0
- package/package.json +8 -3
- package/dist/package.json +0 -30
- package/dist/src/authentication.js +0 -48
- package/dist/src/authentication.js.map +0 -1
- package/dist/src/communications/authentication.js +0 -46
- package/dist/src/communications/authentication.js.map +0 -1
- package/dist/src/communications/conference.js +0 -255
- package/dist/src/communications/conference.js.map +0 -1
- package/dist/src/communications/index.js +0 -37
- package/dist/src/communications/index.js.map +0 -1
- package/dist/src/communications/internal/httpHelpers.js +0 -47
- package/dist/src/communications/internal/httpHelpers.js.map +0 -1
- package/dist/src/communications/internal/urls.js +0 -6
- package/dist/src/communications/internal/urls.js.map +0 -1
- package/dist/src/communications/monitor/conferences.js +0 -271
- package/dist/src/communications/monitor/conferences.js.map +0 -1
- package/dist/src/communications/monitor/index.js +0 -33
- package/dist/src/communications/monitor/index.js.map +0 -1
- package/dist/src/communications/monitor/recordings.js +0 -226
- package/dist/src/communications/monitor/recordings.js.map +0 -1
- package/dist/src/communications/monitor/webhooks.js +0 -104
- package/dist/src/communications/monitor/webhooks.js.map +0 -1
- package/dist/src/communications/recording.js +0 -69
- package/dist/src/communications/recording.js.map +0 -1
- package/dist/src/communications/streaming.js +0 -123
- package/dist/src/communications/streaming.js.map +0 -1
- package/dist/src/communications/types/conference.js +0 -3
- package/dist/src/communications/types/conference.js.map +0 -1
- package/dist/src/communications/types/conferences.js +0 -3
- package/dist/src/communications/types/conferences.js.map +0 -1
- package/dist/src/communications/types/core.js +0 -3
- package/dist/src/communications/types/core.js.map +0 -1
- package/dist/src/communications/types/participant.js +0 -3
- package/dist/src/communications/types/participant.js.map +0 -1
- package/dist/src/communications/types/permission.js +0 -31
- package/dist/src/communications/types/permission.js.map +0 -1
- package/dist/src/communications/types/recordings.js +0 -3
- package/dist/src/communications/types/recordings.js.map +0 -1
- package/dist/src/communications/types/rtcpMode.js +0 -13
- package/dist/src/communications/types/rtcpMode.js.map +0 -1
- package/dist/src/communications/types/spatialAudio.js +0 -3
- package/dist/src/communications/types/spatialAudio.js.map +0 -1
- package/dist/src/communications/types/videoCodec.js +0 -9
- package/dist/src/communications/types/videoCodec.js.map +0 -1
- package/dist/src/communications/types/webhooks.js +0 -3
- package/dist/src/communications/types/webhooks.js.map +0 -1
- package/dist/src/index.js +0 -33
- package/dist/src/index.js.map +0 -1
- package/dist/src/internal/httpHelpers.js +0 -184
- package/dist/src/internal/httpHelpers.js.map +0 -1
- package/dist/src/internal/urls.js +0 -5
- package/dist/src/internal/urls.js.map +0 -1
- package/dist/src/media/analyze.js +0 -61
- package/dist/src/media/analyze.js.map +0 -1
- package/dist/src/media/analyzeSpeech.js +0 -55
- package/dist/src/media/analyzeSpeech.js.map +0 -1
- package/dist/src/media/diagnose.js +0 -57
- package/dist/src/media/diagnose.js.map +0 -1
- package/dist/src/media/enhance.js +0 -52
- package/dist/src/media/enhance.js.map +0 -1
- package/dist/src/media/index.js +0 -45
- package/dist/src/media/index.js.map +0 -1
- package/dist/src/media/internal/httpHelpers.js +0 -76
- package/dist/src/media/internal/httpHelpers.js.map +0 -1
- package/dist/src/media/internal/jobsHelpers.js +0 -47
- package/dist/src/media/internal/jobsHelpers.js.map +0 -1
- package/dist/src/media/internal/urls.js +0 -5
- package/dist/src/media/internal/urls.js.map +0 -1
- package/dist/src/media/io.js +0 -99
- package/dist/src/media/io.js.map +0 -1
- package/dist/src/media/jobs.js +0 -120
- package/dist/src/media/jobs.js.map +0 -1
- package/dist/src/media/mastering.js +0 -94
- package/dist/src/media/mastering.js.map +0 -1
- package/dist/src/media/transcode.js +0 -48
- package/dist/src/media/transcode.js.map +0 -1
- package/dist/src/media/types/analyze.js +0 -3
- package/dist/src/media/types/analyze.js.map +0 -1
- package/dist/src/media/types/analyzeSpeech.js +0 -3
- package/dist/src/media/types/analyzeSpeech.js.map +0 -1
- package/dist/src/media/types/diagnose.js +0 -3
- package/dist/src/media/types/diagnose.js.map +0 -1
- package/dist/src/media/types/enhance.js +0 -3
- package/dist/src/media/types/enhance.js.map +0 -1
- package/dist/src/media/types/jobResults.js +0 -3
- package/dist/src/media/types/jobResults.js.map +0 -1
- package/dist/src/media/types/jobs.js +0 -3
- package/dist/src/media/types/jobs.js.map +0 -1
- package/dist/src/media/types/mastering.js +0 -3
- package/dist/src/media/types/mastering.js.map +0 -1
- package/dist/src/media/types/transcode.js +0 -3
- package/dist/src/media/types/transcode.js.map +0 -1
- package/dist/src/media/types/webhooks.js +0 -3
- package/dist/src/media/types/webhooks.js.map +0 -1
- package/dist/src/media/webhooks.js +0 -136
- package/dist/src/media/webhooks.js.map +0 -1
- package/dist/src/types/jwtToken.js +0 -3
- package/dist/src/types/jwtToken.js.map +0 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.start = exports.getResults = void 0;
|
|
8
|
+
var _jobsHelpers = require("./internal/jobsHelpers");
|
|
9
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
/**
|
|
13
|
+
* Starts enhancing to improve your media.
|
|
14
|
+
*
|
|
15
|
+
* The input location for your source media file as well as the output location for the processed result are required.
|
|
16
|
+
*
|
|
17
|
+
* This is an asynchronous operation so you will receive a job_id where you can retrieve the results when enhancement is complete.
|
|
18
|
+
*
|
|
19
|
+
* There are additional optional parameters that can be provided to control and select the type of enhancements made. See the samples for some examples of what requests and responses look like.
|
|
20
|
+
*
|
|
21
|
+
* @link https://docs.dolby.io/media-apis/reference/media-enhance-post
|
|
22
|
+
*
|
|
23
|
+
* @param accessToken Access token to use for authentication.
|
|
24
|
+
* @param jobContent Content of the job description as a JSON payload. You can find the definition at this URL: https://docs.dolby.io/media-apis/reference/media-enhance-post
|
|
25
|
+
*
|
|
26
|
+
* @returns The job identifier through a `Promise`.
|
|
27
|
+
*/
|
|
28
|
+
var start = /*#__PURE__*/function () {
|
|
29
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(accessToken, jobContent) {
|
|
30
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
31
|
+
while (1) {
|
|
32
|
+
switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
_context.next = 2;
|
|
35
|
+
return (0, _jobsHelpers.startJob)(accessToken, '/media/enhance', jobContent);
|
|
36
|
+
case 2:
|
|
37
|
+
return _context.abrupt("return", _context.sent);
|
|
38
|
+
case 3:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, _callee);
|
|
44
|
+
}));
|
|
45
|
+
return function start(_x, _x2) {
|
|
46
|
+
return _ref.apply(this, arguments);
|
|
47
|
+
};
|
|
48
|
+
}();
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Gets Enhance Results
|
|
52
|
+
*
|
|
53
|
+
* For a given job_id, this method will check if the processing task has completed and return the enhanced results.
|
|
54
|
+
*
|
|
55
|
+
* When the status is Success you'll be able to retrieve your result from the output location you provided in the original POST.
|
|
56
|
+
*
|
|
57
|
+
* @link https://docs.dolby.io/media-apis/reference/media-enhance-get
|
|
58
|
+
*
|
|
59
|
+
* @param accessToken Access token to use for authentication.
|
|
60
|
+
* @param jobId Identifier of the job to retrieve.
|
|
61
|
+
*
|
|
62
|
+
* @returns The `EnhanceJob` object through a `Promise`.
|
|
63
|
+
*/
|
|
64
|
+
exports.start = start;
|
|
65
|
+
var getResults = /*#__PURE__*/function () {
|
|
66
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(accessToken, jobId) {
|
|
67
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
68
|
+
while (1) {
|
|
69
|
+
switch (_context2.prev = _context2.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
_context2.next = 2;
|
|
72
|
+
return (0, _jobsHelpers.getJobResults)(accessToken, '/media/enhance', jobId);
|
|
73
|
+
case 2:
|
|
74
|
+
return _context2.abrupt("return", _context2.sent);
|
|
75
|
+
case 3:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, _callee2);
|
|
81
|
+
}));
|
|
82
|
+
return function getResults(_x3, _x4) {
|
|
83
|
+
return _ref2.apply(this, arguments);
|
|
84
|
+
};
|
|
85
|
+
}();
|
|
86
|
+
exports.getResults = getResults;
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.webhooks = exports.transcode = exports.mastering = exports.jobs = exports.io = exports.enhance = exports.diagnose = exports.analyzeSpeech = exports.analyze = void 0;
|
|
8
|
+
var analyze = _interopRequireWildcard(require("./analyze"));
|
|
9
|
+
exports.analyze = analyze;
|
|
10
|
+
var analyzeSpeech = _interopRequireWildcard(require("./analyzeSpeech"));
|
|
11
|
+
exports.analyzeSpeech = analyzeSpeech;
|
|
12
|
+
var diagnose = _interopRequireWildcard(require("./diagnose"));
|
|
13
|
+
exports.diagnose = diagnose;
|
|
14
|
+
var enhance = _interopRequireWildcard(require("./enhance"));
|
|
15
|
+
exports.enhance = enhance;
|
|
16
|
+
var io = _interopRequireWildcard(require("./io"));
|
|
17
|
+
exports.io = io;
|
|
18
|
+
var jobs = _interopRequireWildcard(require("./jobs"));
|
|
19
|
+
exports.jobs = jobs;
|
|
20
|
+
var mastering = _interopRequireWildcard(require("./mastering"));
|
|
21
|
+
exports.mastering = mastering;
|
|
22
|
+
var transcode = _interopRequireWildcard(require("./transcode"));
|
|
23
|
+
exports.transcode = transcode;
|
|
24
|
+
var webhooks = _interopRequireWildcard(require("./webhooks"));
|
|
25
|
+
exports.webhooks = webhooks;
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
File without changes
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.sendPut = exports.sendPost = exports.sendGet = exports.sendDelete = void 0;
|
|
8
|
+
var httpHelpers = _interopRequireWildcard(require("../../internal/httpHelpers"));
|
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
+
/**
|
|
12
|
+
* Sends a GET request.
|
|
13
|
+
*
|
|
14
|
+
* @param options Request options.
|
|
15
|
+
*
|
|
16
|
+
* @returns A JSON payload object through a Promise.
|
|
17
|
+
*/
|
|
18
|
+
var sendGet = function sendGet(options) {
|
|
19
|
+
options.headers['Authorization'] = "Bearer ".concat(options.accessToken.access_token);
|
|
20
|
+
return httpHelpers.sendGet(options);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Sends a POST request.
|
|
25
|
+
*
|
|
26
|
+
* @param options Request options.
|
|
27
|
+
*
|
|
28
|
+
* @returns A JSON payload object through a Promise.
|
|
29
|
+
*/
|
|
30
|
+
exports.sendGet = sendGet;
|
|
31
|
+
var sendPost = function sendPost(options) {
|
|
32
|
+
options.headers['Authorization'] = "Bearer ".concat(options.accessToken.access_token);
|
|
33
|
+
return httpHelpers.sendPost(options);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Sends a PUT request.
|
|
38
|
+
*
|
|
39
|
+
* @param options Request options.
|
|
40
|
+
*
|
|
41
|
+
* @returns A JSON payload object through a Promise.
|
|
42
|
+
*/
|
|
43
|
+
exports.sendPost = sendPost;
|
|
44
|
+
var sendPut = function sendPut(options) {
|
|
45
|
+
options.headers['Authorization'] = "Bearer ".concat(options.accessToken.access_token);
|
|
46
|
+
return httpHelpers.sendPut(options);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sends a DELETE request.
|
|
51
|
+
*
|
|
52
|
+
* @param options Request options.
|
|
53
|
+
*
|
|
54
|
+
* @returns A JSON payload object through a Promise.
|
|
55
|
+
*/
|
|
56
|
+
exports.sendPut = sendPut;
|
|
57
|
+
var sendDelete = function sendDelete(options) {
|
|
58
|
+
options.headers['Authorization'] = "Bearer ".concat(options.accessToken.access_token);
|
|
59
|
+
return httpHelpers.sendDelete(options);
|
|
60
|
+
};
|
|
61
|
+
exports.sendDelete = sendDelete;
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.startJob = exports.getJobResults = void 0;
|
|
8
|
+
var _httpHelpers = require("./httpHelpers");
|
|
9
|
+
var _urls = require("./urls");
|
|
10
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
11
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
|
+
var startJob = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(accessToken, urlPath, jobContent) {
|
|
15
|
+
var requestOptions, response;
|
|
16
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17
|
+
while (1) {
|
|
18
|
+
switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
requestOptions = {
|
|
21
|
+
hostname: _urls.API_HOSTNAME,
|
|
22
|
+
path: urlPath,
|
|
23
|
+
headers: {
|
|
24
|
+
Accept: 'application/json',
|
|
25
|
+
'Content-Type': 'application/json'
|
|
26
|
+
},
|
|
27
|
+
accessToken: accessToken,
|
|
28
|
+
body: jobContent
|
|
29
|
+
};
|
|
30
|
+
_context.next = 3;
|
|
31
|
+
return (0, _httpHelpers.sendPost)(requestOptions);
|
|
32
|
+
case 3:
|
|
33
|
+
response = _context.sent;
|
|
34
|
+
if (!response.hasOwnProperty('job_id')) {
|
|
35
|
+
_context.next = 6;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return _context.abrupt("return", response['job_id']);
|
|
39
|
+
case 6:
|
|
40
|
+
return _context.abrupt("return", null);
|
|
41
|
+
case 7:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
return function startJob(_x, _x2, _x3) {
|
|
49
|
+
return _ref.apply(this, arguments);
|
|
50
|
+
};
|
|
51
|
+
}();
|
|
52
|
+
exports.startJob = startJob;
|
|
53
|
+
var getJobResults = /*#__PURE__*/function () {
|
|
54
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(accessToken, urlPath, jobId) {
|
|
55
|
+
var requestOptions, response;
|
|
56
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
57
|
+
while (1) {
|
|
58
|
+
switch (_context2.prev = _context2.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
requestOptions = {
|
|
61
|
+
hostname: _urls.API_HOSTNAME,
|
|
62
|
+
path: urlPath,
|
|
63
|
+
params: {
|
|
64
|
+
job_id: jobId
|
|
65
|
+
},
|
|
66
|
+
headers: {},
|
|
67
|
+
accessToken: accessToken
|
|
68
|
+
};
|
|
69
|
+
_context2.next = 3;
|
|
70
|
+
return (0, _httpHelpers.sendGet)(requestOptions);
|
|
71
|
+
case 3:
|
|
72
|
+
response = _context2.sent;
|
|
73
|
+
return _context2.abrupt("return", response);
|
|
74
|
+
case 5:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context2.stop();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, _callee2);
|
|
80
|
+
}));
|
|
81
|
+
return function getJobResults(_x4, _x5, _x6) {
|
|
82
|
+
return _ref2.apply(this, arguments);
|
|
83
|
+
};
|
|
84
|
+
}();
|
|
85
|
+
exports.getJobResults = getJobResults;
|
|
File without changes
|
|
File without changes
|
package/dist/media/io.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getUploadUrl = exports.getDownloadUrl = exports.downloadFile = void 0;
|
|
8
|
+
var _httpHelpers = require("./internal/httpHelpers");
|
|
9
|
+
var _httpHelpers2 = require("../internal/httpHelpers");
|
|
10
|
+
var _urls = require("./internal/urls");
|
|
11
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
|
+
var getUrl = /*#__PURE__*/function () {
|
|
15
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(accessToken, endpointUrl, dlbUrl) {
|
|
16
|
+
var payload, requestOptions, response;
|
|
17
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
18
|
+
while (1) {
|
|
19
|
+
switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
payload = {
|
|
22
|
+
url: dlbUrl
|
|
23
|
+
};
|
|
24
|
+
requestOptions = {
|
|
25
|
+
hostname: _urls.API_HOSTNAME,
|
|
26
|
+
path: endpointUrl,
|
|
27
|
+
headers: {
|
|
28
|
+
Accept: 'application/json',
|
|
29
|
+
'Content-Type': 'application/json'
|
|
30
|
+
},
|
|
31
|
+
accessToken: accessToken,
|
|
32
|
+
body: JSON.stringify(payload, null, ' ')
|
|
33
|
+
};
|
|
34
|
+
_context.next = 4;
|
|
35
|
+
return (0, _httpHelpers.sendPost)(requestOptions);
|
|
36
|
+
case 4:
|
|
37
|
+
response = _context.sent;
|
|
38
|
+
if (!response.hasOwnProperty('url')) {
|
|
39
|
+
_context.next = 7;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
return _context.abrupt("return", response['url']);
|
|
43
|
+
case 7:
|
|
44
|
+
return _context.abrupt("return", null);
|
|
45
|
+
case 8:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, _callee);
|
|
51
|
+
}));
|
|
52
|
+
return function getUrl(_x, _x2, _x3) {
|
|
53
|
+
return _ref.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
}();
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Gets an upload URL.
|
|
59
|
+
*
|
|
60
|
+
* To use the Dolby provided temporary storage is a two step process.
|
|
61
|
+
*
|
|
62
|
+
* You start by declaring a dlb:// url that you can reference in any other Media API calls. The response will provide a url where you can put your media. This allows you to use the dlb:// url as a short-cut for a temporary storage location.
|
|
63
|
+
*
|
|
64
|
+
* You'll be returned a pre-signed url you can use to PUT and upload your media file. The temporary storage should allow you to read and write to the dlb:// locations for a period of at least 24 hours before it is removed.
|
|
65
|
+
*
|
|
66
|
+
* @link https://docs.dolby.io/media-apis/reference/media-input
|
|
67
|
+
*
|
|
68
|
+
* @param accessToken Access token to use for authentication.
|
|
69
|
+
* @param dlbUrl The `url` should be in the form `dlb://object-key` where the object-key can be any alpha-numeric string. The object-key is unique to your account API Key so there is no risk of collision with other users.
|
|
70
|
+
*
|
|
71
|
+
* @returns The upload URL through a `Promise`.
|
|
72
|
+
*/
|
|
73
|
+
var getUploadUrl = /*#__PURE__*/function () {
|
|
74
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(accessToken, dlbUrl) {
|
|
75
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
76
|
+
while (1) {
|
|
77
|
+
switch (_context2.prev = _context2.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
_context2.next = 2;
|
|
80
|
+
return getUrl(accessToken, '/media/input', dlbUrl);
|
|
81
|
+
case 2:
|
|
82
|
+
return _context2.abrupt("return", _context2.sent);
|
|
83
|
+
case 3:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, _callee2);
|
|
89
|
+
}));
|
|
90
|
+
return function getUploadUrl(_x4, _x5) {
|
|
91
|
+
return _ref2.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
}();
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Gets the download URL.
|
|
97
|
+
*
|
|
98
|
+
* You can download media you previously uploaded with /media/input or media that was generated through another Dolby Media API.
|
|
99
|
+
*
|
|
100
|
+
* The temporary storage should allow you to read and write to the dlb:// locations for a period of at least 24 hours before it is removed.
|
|
101
|
+
*
|
|
102
|
+
* @link https://docs.dolby.io/media-apis/reference/media-output-post
|
|
103
|
+
*
|
|
104
|
+
* @param accessToken Access token to use for authentication.
|
|
105
|
+
* @param dlbUrl The `url` should be in the form `dlb://object-key` where the object-key can be any alpha-numeric string. The object-key is unique to your account API Key so there is no risk of collision with other users.
|
|
106
|
+
*
|
|
107
|
+
* @returns The download URL through a `Promise`.
|
|
108
|
+
*/
|
|
109
|
+
exports.getUploadUrl = getUploadUrl;
|
|
110
|
+
var getDownloadUrl = /*#__PURE__*/function () {
|
|
111
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(accessToken, dlbUrl) {
|
|
112
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
113
|
+
while (1) {
|
|
114
|
+
switch (_context3.prev = _context3.next) {
|
|
115
|
+
case 0:
|
|
116
|
+
_context3.next = 2;
|
|
117
|
+
return getUrl(accessToken, '/media/output', dlbUrl);
|
|
118
|
+
case 2:
|
|
119
|
+
return _context3.abrupt("return", _context3.sent);
|
|
120
|
+
case 3:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context3.stop();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, _callee3);
|
|
126
|
+
}));
|
|
127
|
+
return function getDownloadUrl(_x6, _x7) {
|
|
128
|
+
return _ref3.apply(this, arguments);
|
|
129
|
+
};
|
|
130
|
+
}();
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Download a media file.
|
|
134
|
+
*
|
|
135
|
+
* You can download media you previously uploaded with /media/input or media that was generated through another Dolby Media API.
|
|
136
|
+
*
|
|
137
|
+
* The temporary storage should allow you to read and write to the dlb:// locations for a period of at least 24 hours before it is removed.
|
|
138
|
+
*
|
|
139
|
+
* @link https://docs.dolby.io/media-apis/reference/media-output-get
|
|
140
|
+
*
|
|
141
|
+
* @param accessToken Access token to use for authentication.
|
|
142
|
+
* @param dlbUrl The `url` should be in the form `dlb://object-key` where the object-key can be any alpha-numeric string. The object-key is unique to your account API Key so there is no risk of collision with other users.
|
|
143
|
+
* @param filePath Local file path where to download the file to.
|
|
144
|
+
*/
|
|
145
|
+
exports.getDownloadUrl = getDownloadUrl;
|
|
146
|
+
var downloadFile = /*#__PURE__*/function () {
|
|
147
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(accessToken, dlbUrl, filePath) {
|
|
148
|
+
var downloadUrl, idx, requestOptions;
|
|
149
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
150
|
+
while (1) {
|
|
151
|
+
switch (_context4.prev = _context4.next) {
|
|
152
|
+
case 0:
|
|
153
|
+
_context4.next = 2;
|
|
154
|
+
return getDownloadUrl(accessToken, dlbUrl);
|
|
155
|
+
case 2:
|
|
156
|
+
downloadUrl = _context4.sent;
|
|
157
|
+
downloadUrl = downloadUrl.replace('https://', '');
|
|
158
|
+
idx = downloadUrl.indexOf('/');
|
|
159
|
+
requestOptions = {
|
|
160
|
+
hostname: downloadUrl.substring(0, idx),
|
|
161
|
+
path: downloadUrl.substring(idx + 1),
|
|
162
|
+
headers: {}
|
|
163
|
+
};
|
|
164
|
+
return _context4.abrupt("return", (0, _httpHelpers2.download)(filePath, requestOptions));
|
|
165
|
+
case 7:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context4.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, _callee4);
|
|
171
|
+
}));
|
|
172
|
+
return function downloadFile(_x8, _x9, _x10) {
|
|
173
|
+
return _ref4.apply(this, arguments);
|
|
174
|
+
};
|
|
175
|
+
}();
|
|
176
|
+
exports.downloadFile = downloadFile;
|
|
File without changes
|