UNPKG

jsforce

Version:

Salesforce API Library for JavaScript

3 lines (2 loc) 2.86 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 e(t,o,r){function n(i,c){if(!o[i]){if(!t[i]){var u="function"==typeof require&&require;if(!c&&u)return u(i,!0);if(s)return s(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var h=o[i]={exports:{}};t[i][0].call(h.exports,function(e){var o=t[i][1][e];return n(o?o:e)},h,h.exports,e,t,o,r)}return o[i].exports}for(var s="function"==typeof require&&require,i=0;i<r.length;i++)n(r[i]);return n}({1:[function(e,t,o){"use strict";var r=window.jsforce.require("./core"),n=window.jsforce.require("lodash/core"),s=window.jsforce.require("./cache"),i=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 s;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()};i.prototype.initialize=function(){this.sobjects={},this.cache.clear(),this.cache.get("describeGlobal").on("value",n.bind(function(e){if(e.result){var t=n.map(e.result.sobjects,function(e){return e.name});t.forEach(this.sobject,this)}},this))},i.prototype._baseUrl=function(){return this._conn._baseUrl()+"/tooling"},i.prototype.request=function(){return this._conn.request.apply(this._conn,arguments)},i.prototype.executeAnonymous=function(e,t){var o=this._baseUrl()+"/executeAnonymous?anonymousBody="+encodeURIComponent(e);return this.request(o).thenCall(t)},i.prototype.runTestsAsynchronous=function(e,t){var o=this._baseUrl()+"/runTestsAsynchronous/?classids="+e.join(",");return this.request(o).thenCall(t)},i.prototype.runTestsSynchronous=function(e,t){var o=this._baseUrl()+"/runTestsSynchronous/?classnames="+e.join(",");return this.request(o).thenCall(t)},i.prototype.completions=function(e,t){n.isString(e)||(t=e,e="apex");var o=this._baseUrl()+"/completions?type="+encodeURIComponent(e);return this.request(o).thenCall(t)},r.on("connection:new",function(e){e.tooling=new i(e)}),t.exports=i},{}]},{},[1])(1)}); //# sourceMappingURL=jsforce-api-tooling.min.js.map