@twilio/mcs-client 0.5.2-rc.4 → 0.5.2
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [0.5.2](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2-rc.4...@twilio/mcs-client@0.5.2) (2021-11-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @twilio/mcs-client
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
### [0.5.2-rc.4](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2-rc.3...@twilio/mcs-client@0.5.2-rc.4) (2021-11-12)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @twilio/mcs-client
|
package/builds/browser.js
CHANGED
package/builds/lib.js
CHANGED
|
@@ -59,4 +59,4 @@ this.Twilio=this.Twilio||{},this.Twilio.McsClient=function(t){"use strict";var e
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
*/
|
|
62
|
-
Object.defineProperty(Md,"__esModule",{value:!0});var wm=Dg.exports,xm=sm.exports,Sm=qh.exports,km=zh.exports,Am=Vh.exports,Em=Yh.exports;function Om(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var jm=Om(Hh.exports),Tm=Om(wm),Lm=Om(xm),_m=Om(Sm),Rm=Om(km),Im=Om(Am),Pm=Om(Em),Cm=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return{checks:e}};function Dm(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Mm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mm(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Mm(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Um=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Cm((function(t){var r,n=!1,o=[],i=Dm(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;"string"!=typeof a?(n=n||t instanceof a,o.push("an instance of ".concat(a.name))):(n=n||jm.default(t)===a,o.push("of type ".concat(a)))}}catch(t){i.e(t)}finally{i.f()}return[n,o]}))};function Nm(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Fm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fm(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Fm(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Bm=Cm((function(t){return["string"==typeof t&&t.length>0,"a non-empty string"]})),qm=Cm((function(t){return["number"==typeof t&&Number.isInteger(t)&&t>=0,"a non-negative integer"]})),Gm=Cm((function(t){return["object"===jm.default(t)&&null!==t&&!Array.isArray(t),"a pure object (non-null and non-array)"]}));function Wm(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Pm.default(t);if(e){var o=Pm.default(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Im.default(this,r)}}function zm(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return $m(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $m(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function $m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Vm=function(t,e){if(e.length>t.length)throw new Error("Expected at most ".concat(t.length," argument(s), but got ").concat(e.length));for(;e.length<t.length;)e.push(void 0);var r,n=zm(e.entries());try{for(n.s();!(r=n.n()).done;){var o=Tm.default(r.value,2),i=o[0],a=o[1],u=Xm(t[i],a),c=Tm.default(u,4),s=c[0],f=c[1],l=c[2],p=c[3];if(!s)throw new Error("Argument ".concat(i+1," is expected to be ").concat(l).concat(p," but got ").concat(f))}}catch(t){n.e(t)}finally{n.f()}},Hm=function(t){var e,r,n;(["undefined","boolean","number","bigint","string"].includes(jm.default(t))&&(r="string"==typeof t?'"'.concat(t,'"'):"".concat(t)),"object"===jm.default(t)&&"Object"!==(null==t||null===(e=t.constructor)||void 0===e?void 0:e.name))&&(r=null===t?"null":"instance of ".concat(null==t||null===(n=t.constructor)||void 0===n?void 0:n.name));return r||(r=jm.default(t)),r},Ym=function(t){var e,r=[],n=zm(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;r.push(Jm(o))}}catch(t){n.e(t)}finally{n.f()}return r},Jm=function(t){var e,r=[],n=zm(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var o=e.value;"string"!=typeof o&&"function"!=typeof o?r.push(o):r.push(Um(o))}}catch(t){n.e(t)}finally{n.f()}return r},Xm=function(t,e){var r,n,o=[],i=!1,a=zm(t);try{for(a.s();!(n=a.n()).done;){var u,c=zm(n.value.checks);try{for(c.s();!(u=c.n()).done;){var s=(0,u.value)(e),f=Tm.default(s,3),l=f[0],p=f[1],h=f[2];i=i||l,!r&&h&&(r=h),p&&(o=[].concat(Lm.default(o),"string"==typeof p?[p]:Lm.default(p)))}}catch(t){c.e(t)}finally{c.f()}}}catch(t){a.e(t)}finally{a.f()}if(i)return[!0];var d=r||Hm(e),v=o.length-1;return[!1,d,v>0?"".concat(o.slice(0,v).join(", ")," or ").concat(o[v]):o.join(", "),v>1?";":","]};function Km(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Zm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zm(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Zm(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Md.array=function(t,e){return Cm((function(r){if(!Array.isArray(r))return[!1,"an array of ".concat(t)];var n,o=Km(r.entries());try{for(o.s();!(n=o.n()).done;){var i=Tm.default(n.value,2),a=i[0],u=i[1],c=Xm(Jm(e),u),s=Tm.default(c,3),f=s[0],l=s[1],p=s[2];if(!f)return[!1,"a valid array of ".concat(t," (index ").concat(a," should be ").concat(p,")"),"malformed array of ".concat(t," (index ").concat(a," is ").concat(l,")")]}}catch(t){o.e(t)}finally{o.f()}return[!0]}))},Md.custom=Cm;var Qm=Md.literal=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Cm((function(t){var r,n=!1,o=[],i=Nm(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;n=n||t===a,o.push("string"==typeof a?'"'.concat(a,'"'):"".concat(a))}}catch(t){i.e(t)}finally{i.f()}return[n,o]}))},tb=Md.nonEmptyString=Bm;Md.nonNegativeInteger=qm,Md.objectSchema=function(t,e){return Cm((function(r){if("object"!==jm.default(r)||null===r||Array.isArray(r))return[!1,"valid ".concat(t," (should be a pure object)")];for(var n=0,o=Object.entries(e);n<o.length;n++){var i=Tm.default(o[n],2),a=i[0],u=i[1],c=Xm(Jm(u),r[a]),s=Tm.default(c,3),f=s[0],l=s[1],p=s[2];if(!f)return[!1,"valid ".concat(t,' (key "').concat(a,'" should be ').concat(p,")"),"malformed ".concat(t,' (key "').concat(a,'" is ').concat(l,")")]}return[!0]}))};var eb=Md.pureObject=Gm;Md.runtimeTypeValidation=Vm,Md.stringifyReceivedType=Hm,Md.type=Um;var rb,nb,ob=Md.validateConstructorTypes=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=Ym(e);return function(t){return function(t){Rm.default(r,t);var e=Wm(r);function r(){_m.default(this,r);for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return Vm(n,o),e.call.apply(e,[this].concat(o))}return r}(t)}},ib=Md.validateTypes=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=Ym(e);return function(t,e,r){if("function"!=typeof r.value)throw new Error("The validateTypes decorator can only be applied to methods");var o=r.value;r.value=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Vm(n,e),o.apply(this,e)}}},ab=Md.validateTypesAsync=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=Ym(e);return function(t,e,r){if("function"!=typeof r.value)throw new Error("The validateTypesAsync decorator can only be applied to methods");var o=r.value;r.value=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];try{Vm(n,e)}catch(t){return Promise.reject(t)}return o.apply(this,e)}}},ub=Va.scope("");return t.default=(nb=rb=class{constructor(t,e,r){var n,o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.options=i,this.options.logLevel=null!==(n=this.options.logLevel)&&void 0!==n?n:"silent",this.config=new hu(t,e,r,this.options),ub.setLevel(this.options.logLevel),this.options.transport=null!==(o=this.options.transport)&&void 0!==o?o:new Zc,this.transport=this.options.transport,this.network=new Dd(this.config,this.transport)}updateToken(t){ub.info("updateToken"),this.config.updateToken(t)}get(t){var e=this;return n(Sa.mark((function r(){var n;return Sa.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.network.get("".concat(e.config.mediaUrl,"/").concat(t));case 2:return n=r.sent,r.abrupt("return",new du(e.config,e.network,n.body));case 4:case"end":return r.stop()}}),r)})))()}post(t,e,r,o){var i=this;return n(Sa.mark((function n(){var a;return Sa.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.network.post(i.config.mediaUrl,null!=r?r:"media",e,t,o);case 2:return a=n.sent,n.abrupt("return",new du(i.config,i.network,a.body));case 4:case"end":return n.stop()}}),n)})))()}postFormData(t,e){var r=this;return n(Sa.mark((function n(){var o;return Sa.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.network.post(r.config.mediaUrl,null!=e?e:"media",t);case 2:return o=n.sent,n.abrupt("return",new du(r.config,r.network,o.body));case 4:case"end":return n.stop()}}),n)})))()}mediaSetGet(t){var e=this;return n(Sa.mark((function r(){var n,o;return Sa.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n={command:"get",list:t.map((t=>({media_sid:t})))},r.next=3,e.network.post("".concat(e.config.mediaSetUrl),null,JSON.stringify(n),"application/json");case 3:return o=r.sent,r.abrupt("return",o.map((t=>{if(200!==t.code)throw new Error("Failed to obtain detailed information about Media items (failed SID ".concat(t.media_record.sid,")"));return new du(e.config,e.network,t.media_record)})));case 5:case"end":return r.stop()}}),r)})))()}},o(rb,"version","0.5.2-rc.4"),nb),ka([ib(tb),Aa("design:type",Function),Aa("design:paramtypes",[String]),Aa("design:returntype",void 0)],t.default.prototype,"updateToken",null),ka([ab(tb),Aa("design:type",Function),Aa("design:paramtypes",[String]),Aa("design:returntype",Promise)],t.default.prototype,"get",null),t.default=ka([ob(tb,tb,[tb,Qm(null)],[eb,"undefined"]),Aa("design:paramtypes",[String,String,Object,Object])],t.default),t.Client=t.default,t.McsClient=t.default,t.McsMedia=du,t.Media=du,t.default=t.default,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
62
|
+
Object.defineProperty(Md,"__esModule",{value:!0});var wm=Dg.exports,xm=sm.exports,Sm=qh.exports,km=zh.exports,Am=Vh.exports,Em=Yh.exports;function Om(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var jm=Om(Hh.exports),Tm=Om(wm),Lm=Om(xm),_m=Om(Sm),Rm=Om(km),Im=Om(Am),Pm=Om(Em),Cm=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return{checks:e}};function Dm(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Mm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mm(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Mm(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Um=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Cm((function(t){var r,n=!1,o=[],i=Dm(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;"string"!=typeof a?(n=n||t instanceof a,o.push("an instance of ".concat(a.name))):(n=n||jm.default(t)===a,o.push("of type ".concat(a)))}}catch(t){i.e(t)}finally{i.f()}return[n,o]}))};function Nm(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Fm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fm(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Fm(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Bm=Cm((function(t){return["string"==typeof t&&t.length>0,"a non-empty string"]})),qm=Cm((function(t){return["number"==typeof t&&Number.isInteger(t)&&t>=0,"a non-negative integer"]})),Gm=Cm((function(t){return["object"===jm.default(t)&&null!==t&&!Array.isArray(t),"a pure object (non-null and non-array)"]}));function Wm(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Pm.default(t);if(e){var o=Pm.default(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Im.default(this,r)}}function zm(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return $m(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $m(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function $m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Vm=function(t,e){if(e.length>t.length)throw new Error("Expected at most ".concat(t.length," argument(s), but got ").concat(e.length));for(;e.length<t.length;)e.push(void 0);var r,n=zm(e.entries());try{for(n.s();!(r=n.n()).done;){var o=Tm.default(r.value,2),i=o[0],a=o[1],u=Xm(t[i],a),c=Tm.default(u,4),s=c[0],f=c[1],l=c[2],p=c[3];if(!s)throw new Error("Argument ".concat(i+1," is expected to be ").concat(l).concat(p," but got ").concat(f))}}catch(t){n.e(t)}finally{n.f()}},Hm=function(t){var e,r,n;(["undefined","boolean","number","bigint","string"].includes(jm.default(t))&&(r="string"==typeof t?'"'.concat(t,'"'):"".concat(t)),"object"===jm.default(t)&&"Object"!==(null==t||null===(e=t.constructor)||void 0===e?void 0:e.name))&&(r=null===t?"null":"instance of ".concat(null==t||null===(n=t.constructor)||void 0===n?void 0:n.name));return r||(r=jm.default(t)),r},Ym=function(t){var e,r=[],n=zm(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;r.push(Jm(o))}}catch(t){n.e(t)}finally{n.f()}return r},Jm=function(t){var e,r=[],n=zm(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var o=e.value;"string"!=typeof o&&"function"!=typeof o?r.push(o):r.push(Um(o))}}catch(t){n.e(t)}finally{n.f()}return r},Xm=function(t,e){var r,n,o=[],i=!1,a=zm(t);try{for(a.s();!(n=a.n()).done;){var u,c=zm(n.value.checks);try{for(c.s();!(u=c.n()).done;){var s=(0,u.value)(e),f=Tm.default(s,3),l=f[0],p=f[1],h=f[2];i=i||l,!r&&h&&(r=h),p&&(o=[].concat(Lm.default(o),"string"==typeof p?[p]:Lm.default(p)))}}catch(t){c.e(t)}finally{c.f()}}}catch(t){a.e(t)}finally{a.f()}if(i)return[!0];var d=r||Hm(e),v=o.length-1;return[!1,d,v>0?"".concat(o.slice(0,v).join(", ")," or ").concat(o[v]):o.join(", "),v>1?";":","]};function Km(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Zm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zm(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Zm(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Md.array=function(t,e){return Cm((function(r){if(!Array.isArray(r))return[!1,"an array of ".concat(t)];var n,o=Km(r.entries());try{for(o.s();!(n=o.n()).done;){var i=Tm.default(n.value,2),a=i[0],u=i[1],c=Xm(Jm(e),u),s=Tm.default(c,3),f=s[0],l=s[1],p=s[2];if(!f)return[!1,"a valid array of ".concat(t," (index ").concat(a," should be ").concat(p,")"),"malformed array of ".concat(t," (index ").concat(a," is ").concat(l,")")]}}catch(t){o.e(t)}finally{o.f()}return[!0]}))},Md.custom=Cm;var Qm=Md.literal=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Cm((function(t){var r,n=!1,o=[],i=Nm(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;n=n||t===a,o.push("string"==typeof a?'"'.concat(a,'"'):"".concat(a))}}catch(t){i.e(t)}finally{i.f()}return[n,o]}))},tb=Md.nonEmptyString=Bm;Md.nonNegativeInteger=qm,Md.objectSchema=function(t,e){return Cm((function(r){if("object"!==jm.default(r)||null===r||Array.isArray(r))return[!1,"valid ".concat(t," (should be a pure object)")];for(var n=0,o=Object.entries(e);n<o.length;n++){var i=Tm.default(o[n],2),a=i[0],u=i[1],c=Xm(Jm(u),r[a]),s=Tm.default(c,3),f=s[0],l=s[1],p=s[2];if(!f)return[!1,"valid ".concat(t,' (key "').concat(a,'" should be ').concat(p,")"),"malformed ".concat(t,' (key "').concat(a,'" is ').concat(l,")")]}return[!0]}))};var eb=Md.pureObject=Gm;Md.runtimeTypeValidation=Vm,Md.stringifyReceivedType=Hm,Md.type=Um;var rb,nb,ob=Md.validateConstructorTypes=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=Ym(e);return function(t){return function(t){Rm.default(r,t);var e=Wm(r);function r(){_m.default(this,r);for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return Vm(n,o),e.call.apply(e,[this].concat(o))}return r}(t)}},ib=Md.validateTypes=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=Ym(e);return function(t,e,r){if("function"!=typeof r.value)throw new Error("The validateTypes decorator can only be applied to methods");var o=r.value;r.value=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Vm(n,e),o.apply(this,e)}}},ab=Md.validateTypesAsync=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=Ym(e);return function(t,e,r){if("function"!=typeof r.value)throw new Error("The validateTypesAsync decorator can only be applied to methods");var o=r.value;r.value=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];try{Vm(n,e)}catch(t){return Promise.reject(t)}return o.apply(this,e)}}},ub=Va.scope("");return t.default=(nb=rb=class{constructor(t,e,r){var n,o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.options=i,this.options.logLevel=null!==(n=this.options.logLevel)&&void 0!==n?n:"silent",this.config=new hu(t,e,r,this.options),ub.setLevel(this.options.logLevel),this.options.transport=null!==(o=this.options.transport)&&void 0!==o?o:new Zc,this.transport=this.options.transport,this.network=new Dd(this.config,this.transport)}updateToken(t){ub.info("updateToken"),this.config.updateToken(t)}get(t){var e=this;return n(Sa.mark((function r(){var n;return Sa.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.network.get("".concat(e.config.mediaUrl,"/").concat(t));case 2:return n=r.sent,r.abrupt("return",new du(e.config,e.network,n.body));case 4:case"end":return r.stop()}}),r)})))()}post(t,e,r,o){var i=this;return n(Sa.mark((function n(){var a;return Sa.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.network.post(i.config.mediaUrl,null!=r?r:"media",e,t,o);case 2:return a=n.sent,n.abrupt("return",new du(i.config,i.network,a.body));case 4:case"end":return n.stop()}}),n)})))()}postFormData(t,e){var r=this;return n(Sa.mark((function n(){var o;return Sa.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.network.post(r.config.mediaUrl,null!=e?e:"media",t);case 2:return o=n.sent,n.abrupt("return",new du(r.config,r.network,o.body));case 4:case"end":return n.stop()}}),n)})))()}mediaSetGet(t){var e=this;return n(Sa.mark((function r(){var n,o;return Sa.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n={command:"get",list:t.map((t=>({media_sid:t})))},r.next=3,e.network.post("".concat(e.config.mediaSetUrl),null,JSON.stringify(n),"application/json");case 3:return o=r.sent,r.abrupt("return",o.map((t=>{if(200!==t.code)throw new Error("Failed to obtain detailed information about Media items (failed SID ".concat(t.media_record.sid,")"));return new du(e.config,e.network,t.media_record)})));case 5:case"end":return r.stop()}}),r)})))()}},o(rb,"version","0.5.2"),nb),ka([ib(tb),Aa("design:type",Function),Aa("design:paramtypes",[String]),Aa("design:returntype",void 0)],t.default.prototype,"updateToken",null),ka([ab(tb),Aa("design:type",Function),Aa("design:paramtypes",[String]),Aa("design:returntype",Promise)],t.default.prototype,"get",null),t.default=ka([ob(tb,tb,[tb,Qm(null)],[eb,"undefined"]),Aa("design:paramtypes",[String,String,Object,Object])],t.default),t.Client=t.default,t.McsClient=t.default,t.McsMedia=du,t.Media=du,t.default=t.default,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twilio/mcs-client",
|
|
3
|
-
"version": "0.5.2
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Twilio Media Content Service client library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Twilio",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.14.5",
|
|
37
|
-
"@twilio/declarative-type-validator": "^0.1.10
|
|
38
|
-
"@twilio/operation-retrier": "^4.0.6
|
|
37
|
+
"@twilio/declarative-type-validator": "^0.1.10",
|
|
38
|
+
"@twilio/operation-retrier": "^4.0.6",
|
|
39
39
|
"core-js": "^3.17.3",
|
|
40
40
|
"loglevel": "^1.7.1",
|
|
41
41
|
"xmlhttprequest": "^1.8.0"
|