UNPKG

jsforce

Version:

Salesforce API Library for JavaScript

3 lines (2 loc) 2.9 kB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t=t.jsforce||(t.jsforce={}),t=t.modules||(t.modules={}),t=t.api||(t.api={}),t.Tooling=e()}}(function(){return function(){function e(t,o,n){function r(s,c){if(!o[s]){if(!t[s]){var u="function"==typeof require&&require;if(!c&&u)return u(s,!0);if(i)return i(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var h=o[s]={exports:{}};t[s][0].call(h.exports,function(e){var o=t[s][1][e];return r(o||e)},h,h.exports,e,t,o,n)}return o[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}return e}()({1:[function(e,t,o){"use strict";var n=window.jsforce.require("./core"),r=window.jsforce.require("lodash/core"),i=window.jsforce.require("./cache"),s=function(e){this._conn=e,this._logger=e._logger;var t=["query","queryMore","create","insert","retrieve","update","upsert","del","delete","destroy","describe","describeGlobal","sobject"];t.forEach(function(t){this[t]=e.constructor.prototype[t]},this),this.cache=new i;var o={key:function(e){return e?"describe."+e:"describe"}};this.describe$=this.cache.makeCacheable(this.describe,this,o),this.describe=this.cache.makeResponseCacheable(this.describe,this,o),this.describeSObject$=this.describe$,this.describeSObject=this.describe,o={key:"describeGlobal"},this.describeGlobal$=this.cache.makeCacheable(this.describeGlobal,this,o),this.describeGlobal=this.cache.makeResponseCacheable(this.describeGlobal,this,o),this.initialize()};s.prototype.initialize=function(){this.sobjects={},this.cache.clear(),this.cache.get("describeGlobal").on("value",r.bind(function(e){if(e.result){var t=r.map(e.result.sobjects,function(e){return e.name});t.forEach(this.sobject,this)}},this))},s.prototype._baseUrl=function(){return this._conn._baseUrl()+"/tooling"},s.prototype.request=function(){return this._conn.request.apply(this._conn,arguments)},s.prototype.executeAnonymous=function(e,t){var o=this._baseUrl()+"/executeAnonymous?anonymousBody="+encodeURIComponent(e);return this.request(o).thenCall(t)},s.prototype.runTestsAsynchronous=function(e,t){var o=this._baseUrl()+"/runTestsAsynchronous/";return this._conn.requestPost(o,{classids:e.join(",")},void 0,t)},s.prototype.runTestsSynchronous=function(e,t){var o=this._baseUrl()+"/runTestsSynchronous/";return this._conn.requestPost(o,{classnames:e.join(",")},void 0,t)},s.prototype.completions=function(e,t){r.isString(e)||(t=e,e="apex");var o=this._baseUrl()+"/completions?type="+encodeURIComponent(e);return this.request(o).thenCall(t)},n.on("connection:new",function(e){e.tooling=new s(e)}),t.exports=s},{}]},{},[1])(1)}); //# sourceMappingURL=jsforce-api-tooling.min.js.map