UNPKG

jsforce

Version:

Salesforce API Library for JavaScript

3 lines (2 loc) 31.3 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:2}],2:[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')}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|v(e,r);return t=i(t,n),t.write(e,r),t}function l(t,e){var r=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===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||J(e.length)?i(t,0):l(t,e);if("Buffer"===e.type&&K(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 v(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"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":case void 0:return X(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(n)return X(t).length;e=(""+e).toLowerCase(),n=!0}}function w(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 O(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return U(this,e,r);case"binary":return k(this,e,r);case"base64":return P(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n){function o(t,e){return 1===i?t[e]:t.readUInt16BE(e*i)}var i=1,u=t.length,s=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;i=2,u/=2,s/=2,r/=2}for(var a=-1,f=r;f<u;++f)if(o(t,f)===o(e,a===-1?0:f-a)){if(a===-1&&(a=f),f-a+1===s)return a*i}else a!==-1&&(f-=f-a),a=-1;return-1}function A(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 Error("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 _(t,e,r,n){return Z(X(e,t.length-r),t,r,n)}function E(t,e,r,n){return Z(V(e),t,r,n)}function R(t,e,r,n){return E(t,e,r,n)}function T(t,e,r,n){return Z($(e),t,r,n)}function S(t,e,r,n){return Z(W(e,t.length-r),t,r,n)}function P(t,e,r){return 0===e&&r===t.length?G.fromByteArray(t):G.fromByteArray(t.slice(e,r))}function B(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 C(n)}function C(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Q));return r}function U(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 k(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 O(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+=z(t[i]);return o}function I(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 Y(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 M(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 x(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 D(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 N(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 L(t,e,r,n,o){return o||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),H.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return o||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),H.write(t,e,r,n,52,8),r+8}function F(t){if(t=q(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function X(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 V(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function W(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 $(t){return G.toByteArray(F(t))}function Z(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 J(t){return t!==t}var G=t("base64-js"),H=t("ieee754"),K=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"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!K(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=v,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)m(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)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?B(this,0,t):w.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.indexOf=function(t,e,r){if("string"==typeof e?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(e<0&&(e=Math.max(this.length+e,0)),"string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:b(this,t,e,r);if("number"==typeof t)return u.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):b(this,[t],e,r);throw new TypeError("val must be string, number or Buffer")},u.prototype.includes=function(t,e,r){return this.indexOf(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 A(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return E(this,t,e,r);case"binary":return R(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(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 Q=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||Y(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||Y(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||Y(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||Y(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||Y(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||Y(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||Y(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||Y(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||Y(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||Y(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},u.prototype.readInt16LE=function(t,e){e||Y(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||Y(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||Y(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||Y(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||Y(t,4,this.length),H.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||Y(t,4,this.length),H.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||Y(t,8,this.length),H.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||Y(t,8,this.length),H.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;M(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;M(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||M(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||M(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||M(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):D(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||M(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):D(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);M(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);M(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||M(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||M(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||M(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||M(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):D(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||M(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):D(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return j(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:X(new u(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":3,ieee754:4,isarray:5}],3:[function(t,e,r){"use strict";function n(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)a[e]=t[e],f[t.charCodeAt(e)]=e;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63}function o(t){var e,r,n,o,i,u,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[s-2]?2:"="===t[s-1]?1:0,u=new h(3*s/4-i),n=i>0?s-4:s;var a=0;for(e=0,r=0;e<n;e+=4,r+=3)o=f[t.charCodeAt(e)]<<18|f[t.charCodeAt(e+1)]<<12|f[t.charCodeAt(e+2)]<<6|f[t.charCodeAt(e+3)],u[a++]=o>>16&255,u[a++]=o>>8&255,u[a++]=255&o;return 2===i?(o=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,u[a++]=255&o):1===i&&(o=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,u[a++]=o>>8&255,u[a++]=255&o),u}function i(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function u(t,e,r){for(var n,o=[],u=e;u<r;u+=3)n=(t[u]<<16)+(t[u+1]<<8)+t[u+2],o.push(i(n));return o.join("")}function s(t){for(var e,r=t.length,n=r%3,o="",i=[],s=16383,f=0,h=r-n;f<h;f+=s)i.push(u(t,f,f+s>h?h:f+s));return 1===n?(e=t[r-1],o+=a[e>>2],o+=a[e<<4&63],o+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],o+=a[e>>10],o+=a[e>>4&63],o+=a[e<<2&63],o+="="),i.push(o),i.join("")}r.toByteArray=o,r.fromByteArray=s;var a=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array;n()},{}],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(){l&&h&&(l=!1,h.length?c=h.concat(c):p=-1,c.length&&o())}function o(){if(!l){var t=s(n);l=!0;for(var e=c.length;e;){for(h=c,c=[];++p<e;)h&&h[p].run();p=-1,e=c.length}h=null,l=!1,a(t)}}function i(t,e){this.fun=t,this.array=e}function u(){}var s,a,f=e.exports={};!function(){try{s=setTimeout}catch(t){s=function(){throw new Error("setTimeout is not defined")}}try{a=clearTimeout}catch(t){a=function(){throw new Error("clearTimeout is not defined")}}}();var h,c=[],l=!1,p=-1;f.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];c.push(new i(t,e)),1!==c.length||l||s(o,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}]},{},[1])(1)}); //# sourceMappingURL=jsforce-api-metadata.min.js.map