UNPKG

jsforce

Version:

Salesforce API Library for JavaScript

4 lines (3 loc) 32.7 kB
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e=e.jsforce||(e.jsforce={}),e=e.modules||(e.modules={}),e=e.api||(e.api={}),e.Metadata=t()}}(function(){return function t(e,r,n){function o(u,s){if(!r[u]){if(!e[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var h=r[u]={exports:{}};e[u][0].call(h.exports,function(t){var r=e[u][1][t];return o(r?r:t)},h,h.exports,t,e,r,n)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(t,e,r){(function(t,r){"use strict";function n(t){var e=f.clone(t);return e.success="true"===e.success,e}function o(t){var e=n(t);return e.created="true"===e.created,e}function i(t){var e=f.clone(t);return delete e.$,e}var u=window.jsforce.require("inherits"),s=window.jsforce.require("events"),a=window.jsforce.require("readable-stream"),f=window.jsforce.require("lodash/core"),h=window.jsforce.require("./core"),c=window.jsforce.require("./promise"),l=window.jsforce.require("./soap"),p=e.exports=function(t){this._conn=t};p.prototype.pollInterval=1e3,p.prototype.pollTimeout=1e4,p.prototype._invoke=function(t,e,r){var n=new l(this._conn,{xmlns:"http://soap.sforce.com/2006/04/metadata",endpointUrl:this._conn.instanceUrl+"/services/Soap/m/"+this._conn.version});return n.invoke(t,e).then(function(t){return t.result}).thenCall(r)},p.prototype.createAsync=function(t,e,r){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var n=function(e){return e["@xsi:type"]=t,e},o=f.isArray(e);e=o?f.map(e,n):n(e);var i=this._invoke("create",{metadata:e});return new y(this,i,o).thenCall(r)},p.prototype.createSync=p.prototype.create=function(t,e,r){var o=function(e){return e["@xsi:type"]=t,e},i=f.isArray(e);return e=i?f.map(e,o):o(e),this._invoke("createMetadata",{metadata:e}).then(function(t){return f.isArray(t)?f.map(t,n):n(t)}).thenCall(r)},p.prototype.readSync=p.prototype.read=function(t,e,r){return this._invoke("readMetadata",{type:t,fullNames:e}).then(function(t){return f.isArray(t.records)?f.map(t.records,i):i(t.records)}).thenCall(r)},p.prototype.updateAsync=function(t,e,r){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var n=function(e){return e.metadata["@xsi:type"]=t,e},o=f.isArray(e);e=o?f.map(e,n):n(e);var i=this._invoke("update",{updateMetadata:e});return new y(this,i,o).thenCall(r)},p.prototype.updateSync=p.prototype.update=function(t,e,r){var o=function(e){return e["@xsi:type"]=t,e},i=f.isArray(e);return e=i?f.map(e,o):o(e),this._invoke("updateMetadata",{metadata:e}).then(function(t){return f.isArray(t)?f.map(t,n):n(t)}).thenCall(r)},p.prototype.upsertSync=p.prototype.upsert=function(t,e,r){var n=function(e){return e["@xsi:type"]=t,e},i=f.isArray(e);return e=i?f.map(e,n):n(e),this._invoke("upsertMetadata",{metadata:e}).then(function(t){return f.isArray(t)?f.map(t,o):o(t)}).thenCall(r)},p.prototype.deleteAsync=function(t,e,r){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var n=function(e){return f.isString(e)&&(e={fullName:e}),e["@xsi:type"]=t,e},o=f.isArray(e);e=o?f.map(e,n):n(e);var i=this._invoke("delete",{metadata:e});return new y(this,i,o).thenCall(r)},p.prototype.del=p.prototype.deleteSync=p.prototype["delete"]=function(t,e,r){return this._invoke("deleteMetadata",{type:t,fullNames:e}).then(function(t){return f.isArray(t)?f.map(t,n):n(t)}).thenCall(r)},p.prototype.rename=function(t,e,r,o){return this._invoke("renameMetadata",{type:t,oldFullName:e,newFullName:r}).then(function(t){return n(t)}).thenCall(o)},p.prototype.checkStatus=function(t,e){var r=f.isArray(t),n=this._invoke("checkStatus",{asyncProcessId:t});return new y(this,n,r).thenCall(e)},p.prototype.describe=function(t,e){return f.isString(t)||(e=t,t=this._conn.version),this._invoke("describeMetadata",{asOfVersion:t}).then(function(t){return t.metadataObjects=f.isArray(t.metadataObjects)?t.metadataObjects:[t.metadataObjects],t.metadataObjects=f.map(t.metadataObjects,function(t){return t.childXmlNames&&(t.childXmlNames=f.isArray(t.childXmlNames)?t.childXmlNames:[t.childXmlNames]),t.inFolder="true"===t.inFolder,t.metaFile="true"===t.metaFile,t}),t.partialSaveAllowed="true"===t.partialSaveAllowed,t.testRequired="true"===t.testRequired,t}).thenCall(e)},p.prototype.list=function(t,e,r){return f.isString(e)||(r=e,e=this._conn.version),f.isArray(t)||(t=[t]),this._invoke("listMetadata",{queries:t,asOfVersion:e},r)},p.prototype.retrieve=function(t,e){var r=this._invoke("retrieve",{request:t});return new d(this,r).thenCall(e)},p.prototype.checkRetrieveStatus=function(t,e){return this._invoke("checkRetrieveStatus",{asyncProcessId:t},e)},p.prototype.deploy=function(t,e,n){e&&!f.isFunction(e)||(n=e,e={});var o=c.defer();if(f.isObject(t)&&f.isFunction(t.pipe)){var i=[];t.on("data",function(t){i.push(t)}),t.on("end",function(){o.resolve(r.concat(i).toString("base64"))})}else if(t instanceof r)o.resolve(t.toString("base64"));else{if(!(t instanceof String||"string"==typeof t))throw"Unexpected zipInput type";o.resolve(t)}var u=this,s=o.promise.then(function(t){return u._invoke("deploy",{ZipFile:t,DeployOptions:e},n)});return new g(this,s).thenCall(n)},p.prototype.checkDeployStatus=function(t,e,r){return f.isObject(e)||f.isBoolean(e)?e=!!e:(r=e,e=!1),this._invoke("checkDeployStatus",{asyncProcessId:t,includeDetails:e}).then(function(t){return t.done="true"===t.done,t.success="true"===t.success,t.checkOnly="true"===t.checkOnly,t.ignoreWarnings&&(t.ignoreWarnings="true"===t.ignoreWarnings),t.rollbackOnError&&(t.rollbackOnError="true"===t.rollbackOnError),t.numberComponentErrors=Number(t.numberComponentErrors),t.numberComponentsDeployed=Number(t.numberComponentsDeployed),t.numberComponentsTotal=Number(t.numberComponentsTotal),t.numberTestErrors=Number(t.numberTestErrors),t.numberTestsCompleted=Number(t.numberTestsCompleted),t.numberTestsTotal=Number(t.numberTestsTotal),t}).thenCall(r)};var y=function(t,e,r){this._meta=t,this._results=e,this._isArray=r};u(y,s.EventEmitter),y.prototype.then=function(t,e){var r=this;return this._results.then(function(e){var n=function(t){return t.$&&"true"===t.$["xsi:nil"]?null:(t.done="true"===t.done,t)};return e=f.isArray(e)?f.map(e,n):n(e),r._isArray&&!f.isArray(e)&&(e=[e]),t(e)},e)},y.prototype.thenCall=function(e){return f.isFunction(e)?this.then(function(r){t.nextTick(function(){e(null,r)})},function(r){t.nextTick(function(){e(r)})}):this},y.prototype.check=function(t){var e=this,r=this._meta;return this.then(function(t){var n=f.isArray(t)?f.map(t,function(t){return t.id}):t.id;return e._ids=n,r.checkStatus(n)}).thenCall(t)},y.prototype.poll=function(t,e){var r=this,n=(new Date).getTime(),o=function(){var i=(new Date).getTime();if(n+e<i){var u="Polling time out.";return r._ids&&(u+=" Process Id = "+r._ids),void r.emit("error",new Error(u))}r.check().then(function(e){for(var n=!0,i=f.isArray(e)?e:[e],u=0,s=i.length;u<s;u++){var a=i[u];a&&!a.done&&(r.emit("progress",a),n=!1)}n?r.emit("complete",e):setTimeout(o,t)},function(t){r.emit("error",t)})};setTimeout(o,t)},y.prototype.complete=function(t){var e=c.defer();this.on("complete",function(t){e.resolve(t)}),this.on("error",function(t){e.reject(t)});var r=this._meta;return this.poll(r.pollInterval,r.pollTimeout),e.promise.thenCall(t)};var d=function(t,e){d.super_.call(this,t,e)};u(d,y),d.prototype.complete=function(t){var e=this._meta;return d.super_.prototype.complete.call(this).then(function(t){return e.checkRetrieveStatus(t.id)}).thenCall(t)},d.prototype.stream=function(){var t=this,e=new a.Readable,n=!1;return e._read=function(){n||(n=!0,t.complete(function(t,n){t?e.emit("error",t):(e.push(new r(n.zipFile,"base64")),e.push(null))}))},e};var g=function(t,e){g.super_.call(this,t,e)};u(g,y),g.prototype.complete=function(t,e){f.isFunction(t)&&(e=t,t=!1);var r=this._meta;return g.super_.prototype.complete.call(this).then(function(e){return r.checkDeployStatus(e.id,t)}).thenCall(e)},h.on("connection:new",function(t){t.metadata=new p(t)})}).call(this,t("_process"),t("buffer").Buffer)},{_process:6,buffer:3}],2:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function o(t){return 3*t.length/4-n(t)}function i(t){var e,r,o,i,u,s,a=t.length;u=n(t),s=new c(3*a/4-u),o=u>0?a-4:a;var f=0;for(e=0,r=0;e<o;e+=4,r+=3)i=h[t.charCodeAt(e)]<<18|h[t.charCodeAt(e+1)]<<12|h[t.charCodeAt(e+2)]<<6|h[t.charCodeAt(e+3)],s[f++]=i>>16&255,s[f++]=i>>8&255,s[f++]=255&i;return 2===u?(i=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[f++]=255&i):1===u&&(i=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[f++]=i>>8&255,s[f++]=255&i),s}function u(t){return f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}function s(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],o.push(u(n));return o.join("")}function a(t){for(var e,r=t.length,n=r%3,o="",i=[],u=16383,a=0,h=r-n;a<h;a+=u)i.push(s(t,a,a+u>h?h:a+u));return 1===n?(e=t[r-1],o+=f[e>>2],o+=f[e<<4&63],o+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],o+=f[e>>10],o+=f[e>>4&63],o+=f[e<<2&63],o+="="),i.push(o),i.join("")}r.byteLength=o,r.toByteArray=i,r.fromByteArray=a;for(var f=[],h=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,y=l.length;p<y;++p)f[p]=l[p],h[l.charCodeAt(p)]=p;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(o()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=u.prototype):(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return s(this,t,e,r)}function s(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?p(t,e,r,n):"string"==typeof e?c(t,e,r):y(t,e)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e,r,n){return a(e),e<=0?i(t,e):void 0!==r?"string"==typeof n?i(t,e).fill(r,n):i(t,e).fill(r):i(t,e)}function h(t,e){if(a(e),t=i(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function c(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(e,r);t=i(t,n);var o=t.write(e,r);return o!==n&&(t=t.slice(0,o)),t}function l(t,e){var r=e.length<0?0:0|d(e.length);t=i(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),u.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=u.prototype):t=l(t,e),t}function y(t,e){if(u.isBuffer(e)){var r=0|d(e.length);return t=i(t,r),0===t.length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||G(e.length)?i(t,0):l(t,e);if("Buffer"===e.type&&Q(e.data))return l(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function d(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),u.alloc(+t)}function m(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Z(t).length;default:if(n)return V(t).length;e=(""+e).toLowerCase(),n=!0}}function v(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:A(t,e,r,n,o);if("number"==typeof e)return e=255&e,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):A(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function A(t,e,r,n,o){function i(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}var u=1,s=t.length,a=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,r/=2}var f;if(o){var h=-1;for(f=r;f<s;f++)if(i(t,f)===i(e,h===-1?0:f-h)){if(h===-1&&(h=f),f-h+1===a)return h*u}else h!==-1&&(f-=f-h),h=-1}else for(r+a>s&&(r=s-a),f=r;f>=0;f--){for(var c=!0,l=0;l<a;l++)if(i(t,f+l)!==i(e,l)){c=!1;break}if(c)return f}return-1}function _(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=e.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var s=parseInt(e.substr(2*u,2),16);if(isNaN(s))return u;t[r+u]=s}return u}function E(t,e,r,n){return J(V(e,t.length-r),t,r,n)}function T(t,e,r,n){return J(W(e),t,r,n)}function R(t,e,r,n){return T(t,e,r,n)}function S(t,e,r,n){return J(Z(e),t,r,n)}function P(t,e,r,n){return J($(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?H.fromByteArray(t):H.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i=t[o],u=null,s=i>239?4:i>223?3:i>191?2:1;if(o+s<=r){var a,f,h,c;switch(s){case 1:i<128&&(u=i);break;case 2:a=t[o+1],128===(192&a)&&(c=(31&i)<<6|63&a,c>127&&(u=c));break;case 3:a=t[o+1],f=t[o+2],128===(192&a)&&128===(192&f)&&(c=(15&i)<<12|(63&a)<<6|63&f,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:a=t[o+1],f=t[o+2],h=t[o+3],128===(192&a)&&128===(192&f)&&128===(192&h)&&(c=(15&i)<<18|(63&a)<<12|(63&f)<<6|63&h,c>65535&&c<1114112&&(u=c))}}null===u?(u=65533,s=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),o+=s}return U(n)}function U(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=tt));return r}function k(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=X(t[i]);return o}function Y(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function M(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function D(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function N(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,o){return o||L(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,o){return o||L(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function q(t){if(t=z(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function z(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function X(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],u=0;u<n;++u){if(r=t.charCodeAt(u),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function W(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function $(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function Z(t){return H.toByteArray(q(t))}function J(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function G(t){return t!==t}var H=t("base64-js"),K=t("ieee754"),Q=t("isarray");r.Buffer=u,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=o(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return s(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return f(null,t,e,r)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(!u.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)w(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?C(this,0,t):v.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,s=r-e,a=Math.min(i,s),f=this.slice(n,o),h=t.slice(e,r),c=0;c<a;++c)if(f[c]!==h[c]){i=f[c],s=h[c];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return T(this,t,e,r);case"latin1":case"binary":return R(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;u.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var n;if(u.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=u.prototype;else{var o=e-t;n=new u(o,(void 0));for(var i=0;i<o;++i)n[i]=this[i+t]}return n},u.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||M(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||M(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUInt8=function(t,e){return e||M(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||M(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||M(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||M(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||M(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return e||M(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},u.prototype.readInt16LE=function(t,e){e||M(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||M(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||M(t,4,this.length),K.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||M(t,4,this.length),K.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||M(t,8,this.length),K.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||M(t,8,this.length),K.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e=0|e,r=0|r,!n){var o=Math.pow(2,8*r)-1;x(this,t,e,r,o,0)}var i=1,u=0;for(this[e]=255&t;++u<r&&(i*=256);)this[e+u]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e=0|e,r=0|r,!n){var o=Math.pow(2,8*r)-1;x(this,t,e,r,o,0)}var i=r-1,u=1;for(this[e+i]=255&t;--i>=0&&(u*=256);)this[e+i]=t/u&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,u=1,s=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t=255&t);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var i;if("number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=u.isBuffer(t)?t:V(new u(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":2,ieee754:4,isarray:5}],4:[function(t,e,r){r.read=function(t,e,r,n,o){var i,u,s=8*o-n-1,a=(1<<s)-1,f=a>>1,h=-7,c=r?o-1:0,l=r?-1:1,p=t[e+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=s;h>0;i=256*i+t[e+c],c+=l,h-=8);for(u=i&(1<<-h)-1,i>>=-h,h+=n;h>0;u=256*u+t[e+c],c+=l,h-=8);if(0===i)i=1-f;else{if(i===a)return u?NaN:(p?-1:1)*(1/0);u+=Math.pow(2,n),i-=f}return(p?-1:1)*u*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var u,s,a,f=8*i-o-1,h=(1<<f)-1,c=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=h):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),e+=u+c>=1?l/a:l*Math.pow(2,1-c),e*a>=2&&(u++,a/=2),u+c>=h?(s=0,u=h):u+c>=1?(s=(e*a-1)*Math.pow(2,o),u+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),u=0));o>=8;t[r+p]=255&s,p+=y,s/=256,o-=8);for(u=u<<o|s,f+=o;f>0;t[r+p]=255&u,p+=y,u/=256,f-=8);t[r+p-y]|=128*d}},{}],5:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],6:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(t){if(c===setTimeout)return setTimeout(t,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function u(t){if(l===clearTimeout)return clearTimeout(t);if((l===o||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function s(){g&&y&&(g=!1,y.length?d=y.concat(d):m=-1,d.length&&a())}function a(){if(!g){var t=i(s);g=!0;for(var e=d.length;e;){for(y=d,d=[];++m<e;)y&&y[m].run();m=-1,e=d.length}y=null,g=!1,u(t)}}function f(t,e){this.fun=t,this.array=e}function h(){}var c,l,p=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(t){c=n}try{l="function"==typeof clearTimeout?clearTimeout:o}catch(t){l=o}}();var y,d=[],g=!1,m=-1;p.nextTick=function(t){ var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];d.push(new f(t,e)),1!==d.length||g||i(a)},f.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=h,p.addListener=h,p.once=h,p.off=h,p.removeListener=h,p.removeAllListeners=h,p.emit=h,p.binding=function(t){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(t){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}]},{},[1])(1)}); //# sourceMappingURL=jsforce-api-metadata.min.js.map