@jsforce/jsforce-node 0.0.1 → 3.0.0-next.1
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/LICENSE +22 -0
- package/README.md +54 -0
- package/index.d.ts +4 -0
- package/index.js +1 -0
- package/lib/VERSION.d.ts +2 -0
- package/lib/VERSION.js +3 -0
- package/lib/api/analytics/types.d.ts +509 -0
- package/lib/api/analytics/types.js +2 -0
- package/lib/api/analytics.d.ts +163 -0
- package/lib/api/analytics.js +342 -0
- package/lib/api/apex.d.ts +44 -0
- package/lib/api/apex.js +86 -0
- package/lib/api/bulk.d.ts +444 -0
- package/lib/api/bulk.js +1372 -0
- package/lib/api/chatter.d.ts +133 -0
- package/lib/api/chatter.js +248 -0
- package/lib/api/metadata/schema.d.ts +16117 -0
- package/lib/api/metadata/schema.js +9094 -0
- package/lib/api/metadata.d.ts +189 -0
- package/lib/api/metadata.js +406 -0
- package/lib/api/soap/schema.d.ts +3167 -0
- package/lib/api/soap/schema.js +1787 -0
- package/lib/api/soap.d.ts +76 -0
- package/lib/api/soap.js +155 -0
- package/lib/api/streaming/extension.d.ts +94 -0
- package/lib/api/streaming/extension.js +151 -0
- package/lib/api/streaming.d.ts +160 -0
- package/lib/api/streaming.js +252 -0
- package/lib/api/tooling.d.ts +284 -0
- package/lib/api/tooling.js +202 -0
- package/lib/api/wsdl/wsdl2schema.d.ts +1 -0
- package/lib/api/wsdl/wsdl2schema.js +354 -0
- package/lib/browser/canvas.d.ts +12 -0
- package/lib/browser/canvas.js +77 -0
- package/lib/browser/client.d.ts +82 -0
- package/lib/browser/client.js +244 -0
- package/lib/browser/jsonp.d.ts +12 -0
- package/lib/browser/jsonp.js +69 -0
- package/lib/browser/registry.d.ts +3 -0
- package/lib/browser/registry.js +5 -0
- package/lib/browser/request.d.ts +10 -0
- package/lib/browser/request.js +202 -0
- package/lib/cache.d.ts +74 -0
- package/lib/cache.js +159 -0
- package/lib/connection.d.ts +355 -0
- package/lib/connection.js +1153 -0
- package/lib/core.d.ts +17 -0
- package/lib/core.js +55 -0
- package/lib/csv.d.ts +23 -0
- package/lib/csv.js +35 -0
- package/lib/date.d.ts +82 -0
- package/lib/date.js +201 -0
- package/lib/http-api.d.ts +75 -0
- package/lib/http-api.js +257 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +31 -0
- package/lib/jsforce.d.ts +26 -0
- package/lib/jsforce.js +67 -0
- package/lib/jwtOAuth2.d.ts +8 -0
- package/lib/jwtOAuth2.js +23 -0
- package/lib/oauth2.d.ts +92 -0
- package/lib/oauth2.js +245 -0
- package/lib/process.d.ts +157 -0
- package/lib/process.js +143 -0
- package/lib/query.d.ts +341 -0
- package/lib/query.js +817 -0
- package/lib/quick-action.d.ts +44 -0
- package/lib/quick-action.js +46 -0
- package/lib/record-reference.d.ts +46 -0
- package/lib/record-reference.js +65 -0
- package/lib/record-stream.d.ts +83 -0
- package/lib/record-stream.js +233 -0
- package/lib/registry/base.d.ts +43 -0
- package/lib/registry/base.js +96 -0
- package/lib/registry/empty.d.ts +7 -0
- package/lib/registry/empty.js +13 -0
- package/lib/registry/file.d.ts +11 -0
- package/lib/registry/file.js +51 -0
- package/lib/registry/index.d.ts +8 -0
- package/lib/registry/index.js +21 -0
- package/lib/registry/sfdx.d.ts +56 -0
- package/lib/registry/sfdx.js +133 -0
- package/lib/registry/types.d.ts +47 -0
- package/lib/registry/types.js +2 -0
- package/lib/request-helper.d.ts +23 -0
- package/lib/request-helper.js +102 -0
- package/lib/request.d.ts +11 -0
- package/lib/request.js +75 -0
- package/lib/session-refresh-delegate.d.ts +31 -0
- package/lib/session-refresh-delegate.js +69 -0
- package/lib/soap.d.ts +60 -0
- package/lib/soap.js +246 -0
- package/lib/sobject.d.ts +258 -0
- package/lib/sobject.js +376 -0
- package/lib/soql-builder.d.ts +25 -0
- package/lib/soql-builder.js +226 -0
- package/lib/transport.d.ts +63 -0
- package/lib/transport.js +175 -0
- package/lib/types/common.d.ts +560 -0
- package/lib/types/common.js +2 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.js +23 -0
- package/lib/types/projection.d.ts +26 -0
- package/lib/types/projection.js +2 -0
- package/lib/types/record.d.ts +44 -0
- package/lib/types/record.js +2 -0
- package/lib/types/schema.d.ts +50 -0
- package/lib/types/schema.js +2 -0
- package/lib/types/soap.d.ts +43 -0
- package/lib/types/soap.js +2 -0
- package/lib/types/standard-schema.d.ts +16199 -0
- package/lib/types/standard-schema.js +2 -0
- package/lib/types/util.d.ts +7 -0
- package/lib/types/util.js +2 -0
- package/lib/util/formatter.d.ts +8 -0
- package/lib/util/formatter.js +24 -0
- package/lib/util/function.d.ts +32 -0
- package/lib/util/function.js +52 -0
- package/lib/util/logger.d.ts +29 -0
- package/lib/util/logger.js +102 -0
- package/lib/util/promise.d.ts +19 -0
- package/lib/util/promise.js +25 -0
- package/lib/util/stream.d.ts +12 -0
- package/lib/util/stream.js +88 -0
- package/package.json +260 -6
- package/typings/faye/index.d.ts +16 -0
- package/typings/index.d.ts +1 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.StreamingExtension = exports.Streaming = exports.Subscription = exports.Client = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* @file Manages Streaming APIs
|
|
29
|
+
* @author Shinichi Tomita <shinichi.tomita@gmail.com>
|
|
30
|
+
*/
|
|
31
|
+
const events_1 = require("events");
|
|
32
|
+
const faye_1 = require("faye");
|
|
33
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return faye_1.Client; } });
|
|
34
|
+
Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return faye_1.Subscription; } });
|
|
35
|
+
const jsforce_1 = require("../jsforce");
|
|
36
|
+
const StreamingExtension = __importStar(require("./streaming/extension"));
|
|
37
|
+
exports.StreamingExtension = StreamingExtension;
|
|
38
|
+
/*--------------------------------------------*/
|
|
39
|
+
/**
|
|
40
|
+
* Streaming API topic class
|
|
41
|
+
*/
|
|
42
|
+
class Topic {
|
|
43
|
+
_streaming;
|
|
44
|
+
name;
|
|
45
|
+
constructor(streaming, name) {
|
|
46
|
+
this._streaming = streaming;
|
|
47
|
+
this.name = name;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Subscribe listener to topic
|
|
51
|
+
*/
|
|
52
|
+
subscribe(listener) {
|
|
53
|
+
return this._streaming.subscribe(this.name, listener);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Unsubscribe listener from topic
|
|
57
|
+
*/
|
|
58
|
+
unsubscribe(subscr) {
|
|
59
|
+
this._streaming.unsubscribe(this.name, subscr);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/*--------------------------------------------*/
|
|
64
|
+
/**
|
|
65
|
+
* Streaming API Generic Streaming Channel
|
|
66
|
+
*/
|
|
67
|
+
class Channel {
|
|
68
|
+
_streaming;
|
|
69
|
+
_id;
|
|
70
|
+
name;
|
|
71
|
+
constructor(streaming, name) {
|
|
72
|
+
this._streaming = streaming;
|
|
73
|
+
this.name = name;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Subscribe to channel
|
|
77
|
+
*/
|
|
78
|
+
subscribe(listener) {
|
|
79
|
+
return this._streaming.subscribe(this.name, listener);
|
|
80
|
+
}
|
|
81
|
+
unsubscribe(subscr) {
|
|
82
|
+
this._streaming.unsubscribe(this.name, subscr);
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
async push(events) {
|
|
86
|
+
const isArray = Array.isArray(events);
|
|
87
|
+
const pushEvents = Array.isArray(events) ? events : [events];
|
|
88
|
+
const conn = this._streaming._conn;
|
|
89
|
+
if (!this._id) {
|
|
90
|
+
this._id = conn
|
|
91
|
+
.sobject('StreamingChannel')
|
|
92
|
+
.findOne({ Name: this.name }, ['Id'])
|
|
93
|
+
.then((rec) => rec?.Id);
|
|
94
|
+
}
|
|
95
|
+
const id = await this._id;
|
|
96
|
+
if (!id) {
|
|
97
|
+
throw new Error(`No streaming channel available for name: ${this.name}`);
|
|
98
|
+
}
|
|
99
|
+
const channelUrl = `/sobjects/StreamingChannel/${id}/push`;
|
|
100
|
+
const rets = await conn.requestPost(channelUrl, {
|
|
101
|
+
pushEvents,
|
|
102
|
+
});
|
|
103
|
+
return isArray ? rets : rets[0];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/*--------------------------------------------*/
|
|
107
|
+
/**
|
|
108
|
+
* Streaming API class
|
|
109
|
+
*/
|
|
110
|
+
class Streaming extends events_1.EventEmitter {
|
|
111
|
+
_conn;
|
|
112
|
+
_topics = {};
|
|
113
|
+
_fayeClients = {};
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
constructor(conn) {
|
|
118
|
+
super();
|
|
119
|
+
this._conn = conn;
|
|
120
|
+
}
|
|
121
|
+
/* @private */
|
|
122
|
+
_createClient(forChannelName, extensions) {
|
|
123
|
+
// forChannelName is advisory, for an API workaround. It does not restrict or select the channel.
|
|
124
|
+
const needsReplayFix = typeof forChannelName === 'string' && forChannelName.indexOf('/u/') === 0;
|
|
125
|
+
const endpointUrl = [
|
|
126
|
+
this._conn.instanceUrl,
|
|
127
|
+
// special endpoint "/cometd/replay/xx.x" is only available in 36.0.
|
|
128
|
+
// See https://releasenotes.docs.salesforce.com/en-us/summer16/release-notes/rn_api_streaming_classic_replay.htm
|
|
129
|
+
'cometd' +
|
|
130
|
+
(needsReplayFix === true && this._conn.version === '36.0'
|
|
131
|
+
? '/replay'
|
|
132
|
+
: ''),
|
|
133
|
+
this._conn.version,
|
|
134
|
+
].join('/');
|
|
135
|
+
const fayeClient = new faye_1.Client(endpointUrl, {});
|
|
136
|
+
fayeClient.setHeader('Authorization', 'OAuth ' + this._conn.accessToken);
|
|
137
|
+
if (Array.isArray(extensions)) {
|
|
138
|
+
for (const extension of extensions) {
|
|
139
|
+
fayeClient.addExtension(extension);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// prevent streaming API server error
|
|
143
|
+
const dispatcher = fayeClient._dispatcher;
|
|
144
|
+
if (dispatcher.getConnectionTypes().indexOf('callback-polling') === -1) {
|
|
145
|
+
dispatcher.selectTransport('long-polling');
|
|
146
|
+
dispatcher._transport.batching = false;
|
|
147
|
+
}
|
|
148
|
+
return fayeClient;
|
|
149
|
+
}
|
|
150
|
+
/** @private **/
|
|
151
|
+
_getFayeClient(channelName) {
|
|
152
|
+
const isGeneric = channelName.indexOf('/u/') === 0;
|
|
153
|
+
const clientType = isGeneric ? 'generic' : 'pushTopic';
|
|
154
|
+
if (!this._fayeClients[clientType]) {
|
|
155
|
+
this._fayeClients[clientType] = this._createClient(channelName);
|
|
156
|
+
}
|
|
157
|
+
return this._fayeClients[clientType];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get named topic
|
|
161
|
+
*/
|
|
162
|
+
topic(name) {
|
|
163
|
+
this._topics = this._topics || {};
|
|
164
|
+
const topic = (this._topics[name] =
|
|
165
|
+
this._topics[name] || new Topic(this, name));
|
|
166
|
+
return topic;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get channel for channel name
|
|
170
|
+
*/
|
|
171
|
+
channel(name) {
|
|
172
|
+
return new Channel(this, name);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Subscribe topic/channel
|
|
176
|
+
*/
|
|
177
|
+
subscribe(name, listener) {
|
|
178
|
+
const channelName = name.indexOf('/') === 0 ? name : '/topic/' + name;
|
|
179
|
+
const fayeClient = this._getFayeClient(channelName);
|
|
180
|
+
return fayeClient.subscribe(channelName, listener);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Unsubscribe topic
|
|
184
|
+
*/
|
|
185
|
+
unsubscribe(name, subscription) {
|
|
186
|
+
const channelName = name.indexOf('/') === 0 ? name : '/topic/' + name;
|
|
187
|
+
const fayeClient = this._getFayeClient(channelName);
|
|
188
|
+
fayeClient.unsubscribe(channelName, subscription);
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Create a Streaming client, optionally with extensions
|
|
193
|
+
*
|
|
194
|
+
* See Faye docs for implementation details: https://faye.jcoglan.com/browser/extensions.html
|
|
195
|
+
*
|
|
196
|
+
* Example usage:
|
|
197
|
+
*
|
|
198
|
+
* ```javascript
|
|
199
|
+
* const jsforce = require('jsforce');
|
|
200
|
+
*
|
|
201
|
+
* // Establish a Salesforce connection. (Details elided)
|
|
202
|
+
* const conn = new jsforce.Connection({ … });
|
|
203
|
+
*
|
|
204
|
+
* const fayeClient = conn.streaming.createClient();
|
|
205
|
+
*
|
|
206
|
+
* const subscription = fayeClient.subscribe(channel, data => {
|
|
207
|
+
* console.log('topic received data', data);
|
|
208
|
+
* });
|
|
209
|
+
*
|
|
210
|
+
* subscription.cancel();
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* Example with extensions, using Replay & Auth Failure extensions in a server-side Node.js app:
|
|
214
|
+
*
|
|
215
|
+
* ```javascript
|
|
216
|
+
* const jsforce = require('jsforce');
|
|
217
|
+
* const { StreamingExtension } = require('jsforce/api/streaming');
|
|
218
|
+
*
|
|
219
|
+
* // Establish a Salesforce connection. (Details elided)
|
|
220
|
+
* const conn = new jsforce.Connection({ … });
|
|
221
|
+
*
|
|
222
|
+
* const channel = "/event/My_Event__e";
|
|
223
|
+
* const replayId = -2; // -2 is all retained events
|
|
224
|
+
*
|
|
225
|
+
* const exitCallback = () => process.exit(1);
|
|
226
|
+
* const authFailureExt = new StreamingExtension.AuthFailure(exitCallback);
|
|
227
|
+
*
|
|
228
|
+
* const replayExt = new StreamingExtension.Replay(channel, replayId);
|
|
229
|
+
*
|
|
230
|
+
* const fayeClient = conn.streaming.createClient([
|
|
231
|
+
* authFailureExt,
|
|
232
|
+
* replayExt
|
|
233
|
+
* ]);
|
|
234
|
+
*
|
|
235
|
+
* const subscription = fayeClient.subscribe(channel, data => {
|
|
236
|
+
* console.log('topic received data', data);
|
|
237
|
+
* });
|
|
238
|
+
*
|
|
239
|
+
* subscription.cancel();
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
createClient(extensions) {
|
|
243
|
+
return this._createClient(null, extensions);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.Streaming = Streaming;
|
|
247
|
+
/*--------------------------------------------*/
|
|
248
|
+
/*
|
|
249
|
+
* Register hook in connection instantiation for dynamically adding this API module features
|
|
250
|
+
*/
|
|
251
|
+
(0, jsforce_1.registerModule)('streaming', (conn) => new Streaming(conn));
|
|
252
|
+
exports.default = Streaming;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import Connection from '../connection';
|
|
2
|
+
import Cache, { CachedFunction } from '../cache';
|
|
3
|
+
import SObject from '../sobject';
|
|
4
|
+
import { DescribeGlobalResult, DescribeSObjectResult, HttpRequest, Schema, SObjectNames } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export type ExecuteAnonymousResult = {
|
|
9
|
+
compiled: boolean;
|
|
10
|
+
compileProblem: string | null;
|
|
11
|
+
success: boolean;
|
|
12
|
+
line: number;
|
|
13
|
+
column: number;
|
|
14
|
+
exceptionMessage: string | null;
|
|
15
|
+
exceptionStackTrace: string | null;
|
|
16
|
+
};
|
|
17
|
+
export type RunTestLevel = 'RunSpecifiedTests' | 'RunLocalTests' | 'RunAllTestsInOrg';
|
|
18
|
+
type TestsNode = {
|
|
19
|
+
classId: string;
|
|
20
|
+
testMethods?: string[];
|
|
21
|
+
} | {
|
|
22
|
+
className: string;
|
|
23
|
+
testMethods?: string[];
|
|
24
|
+
};
|
|
25
|
+
export type RunTestsRequest = {
|
|
26
|
+
tests: TestsNode[];
|
|
27
|
+
maxFailedTests?: number;
|
|
28
|
+
testLevel?: RunTestLevel;
|
|
29
|
+
skipCodeCoverage?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type RunTestsAsyncRequest = {
|
|
32
|
+
classids?: string;
|
|
33
|
+
classNames?: string;
|
|
34
|
+
suiteids?: string;
|
|
35
|
+
suiteNames?: string;
|
|
36
|
+
maxFailedTests?: number;
|
|
37
|
+
testLevel?: RunTestLevel;
|
|
38
|
+
skipCodeCoverage?: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
tests: TestsNode[];
|
|
41
|
+
maxFailedTests?: number;
|
|
42
|
+
testLevel?: RunTestLevel;
|
|
43
|
+
skipCodeCoverage?: boolean;
|
|
44
|
+
};
|
|
45
|
+
type CodeCoverageResult = {
|
|
46
|
+
id: string;
|
|
47
|
+
locationsNotCovered: any[];
|
|
48
|
+
name: string;
|
|
49
|
+
namespace: string | null;
|
|
50
|
+
numLocations: number;
|
|
51
|
+
numLocationsNotCovered: number;
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
type CodeCoverageWarning = {
|
|
55
|
+
id: string;
|
|
56
|
+
message: string;
|
|
57
|
+
name: string | null;
|
|
58
|
+
namespace: string | null;
|
|
59
|
+
};
|
|
60
|
+
type FlowCoverageResult = {
|
|
61
|
+
elementsNotCovered: string[];
|
|
62
|
+
flowId: string;
|
|
63
|
+
flowName: string;
|
|
64
|
+
flowNamespace: string | null;
|
|
65
|
+
numElements: number;
|
|
66
|
+
numElementsNotCovered: number;
|
|
67
|
+
processType: string;
|
|
68
|
+
};
|
|
69
|
+
type FlowCoverageWarning = {
|
|
70
|
+
flowId: string;
|
|
71
|
+
flowName: string;
|
|
72
|
+
flowNamespace: string | null;
|
|
73
|
+
message: string;
|
|
74
|
+
};
|
|
75
|
+
type RunTestSuccess = {
|
|
76
|
+
id: string;
|
|
77
|
+
methodName: string;
|
|
78
|
+
name: string;
|
|
79
|
+
namespace: string | null;
|
|
80
|
+
seeAllData: boolean;
|
|
81
|
+
time: number;
|
|
82
|
+
};
|
|
83
|
+
type RunTestFailure = {
|
|
84
|
+
id: string;
|
|
85
|
+
message: string;
|
|
86
|
+
methodName: string;
|
|
87
|
+
name: string;
|
|
88
|
+
namespace: string | null;
|
|
89
|
+
seeAllData: boolean;
|
|
90
|
+
stackTrace: string;
|
|
91
|
+
time: number;
|
|
92
|
+
type: string;
|
|
93
|
+
};
|
|
94
|
+
export type RunTestsResult = {
|
|
95
|
+
apexLogId: string;
|
|
96
|
+
codeCoverage: CodeCoverageResult[];
|
|
97
|
+
codeCoverageWarnings: CodeCoverageWarning[];
|
|
98
|
+
flowCoverage: FlowCoverageResult[];
|
|
99
|
+
flowCoverageWarnings: FlowCoverageWarning[];
|
|
100
|
+
numFailures: number;
|
|
101
|
+
numTestsRun: number;
|
|
102
|
+
successes: RunTestSuccess[];
|
|
103
|
+
failures: RunTestFailure[];
|
|
104
|
+
totalTime: number;
|
|
105
|
+
};
|
|
106
|
+
type ConstructorDeclaration = {
|
|
107
|
+
methodDoc: string | null;
|
|
108
|
+
name: string;
|
|
109
|
+
parameters: Array<{
|
|
110
|
+
name: string;
|
|
111
|
+
type: string;
|
|
112
|
+
}>;
|
|
113
|
+
references: any[];
|
|
114
|
+
};
|
|
115
|
+
type MethodDeclaration = {
|
|
116
|
+
argTypes: string[];
|
|
117
|
+
isStatic: boolean;
|
|
118
|
+
methodDoc: string | null;
|
|
119
|
+
name: string;
|
|
120
|
+
parameters: Array<{
|
|
121
|
+
name: string;
|
|
122
|
+
type: string;
|
|
123
|
+
}>;
|
|
124
|
+
references: any[];
|
|
125
|
+
};
|
|
126
|
+
type PropertyDeclaration = {
|
|
127
|
+
name: string;
|
|
128
|
+
references: any[];
|
|
129
|
+
};
|
|
130
|
+
type ClassDeclaration = {
|
|
131
|
+
constructors: ConstructorDeclaration[];
|
|
132
|
+
methods: MethodDeclaration[];
|
|
133
|
+
properties: PropertyDeclaration[];
|
|
134
|
+
};
|
|
135
|
+
export type CompletionsResult = {
|
|
136
|
+
publicDeclarations?: {
|
|
137
|
+
[namespace: string]: {
|
|
138
|
+
[name: string]: ClassDeclaration;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
completions?: {
|
|
142
|
+
[component: string]: {
|
|
143
|
+
simple: boolean;
|
|
144
|
+
attribs: {
|
|
145
|
+
[attr: string]: {};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* API class for Tooling API call
|
|
152
|
+
*/
|
|
153
|
+
export declare class Tooling<S extends Schema> {
|
|
154
|
+
_conn: Connection<S>;
|
|
155
|
+
get version(): string;
|
|
156
|
+
/**
|
|
157
|
+
* Execute query by using SOQL
|
|
158
|
+
*/
|
|
159
|
+
query: Connection<S>['query'];
|
|
160
|
+
/**
|
|
161
|
+
* Query next record set by using query locator
|
|
162
|
+
*/
|
|
163
|
+
queryMore: Connection<S>['queryMore'];
|
|
164
|
+
_ensureVersion: Connection<S>['_ensureVersion'];
|
|
165
|
+
/**
|
|
166
|
+
* Create records
|
|
167
|
+
*/
|
|
168
|
+
create: Connection<S>['create'];
|
|
169
|
+
_createSingle: (type: string, record: import("../types").Record, options: import("../types").DmlOptions) => Promise<unknown>;
|
|
170
|
+
_createParallel: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise<unknown[]>;
|
|
171
|
+
_createMany: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise<import("../types").SaveResult[]>;
|
|
172
|
+
/**
|
|
173
|
+
* Synonym of Tooling#create()
|
|
174
|
+
*/
|
|
175
|
+
insert: {
|
|
176
|
+
<N extends string, InputRecord extends Partial<import("../types").SObjectRecord<any, N, "*", import("../types").Record, {}>> = Partial<import("../types").SObjectRecord<any, N, "*", import("../types").Record, {}>>>(type: N, records: InputRecord[], options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult[]>;
|
|
177
|
+
<N_1 extends string, InputRecord_1 extends Partial<import("../types").SObjectRecord<any, N_1, "*", import("../types").Record, {}>> = Partial<import("../types").SObjectRecord<any, N_1, "*", import("../types").Record, {}>>>(type: N_1, record: InputRecord_1, options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult>;
|
|
178
|
+
<N_2 extends string, InputRecord_2 extends Partial<import("../types").SObjectRecord<any, N_2, "*", import("../types").Record, {}>> = Partial<import("../types").SObjectRecord<any, N_2, "*", import("../types").Record, {}>>>(type: N_2, records: InputRecord_2 | InputRecord_2[], options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult | import("../types").SaveResult[]>;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Retrieve specified records
|
|
182
|
+
*/
|
|
183
|
+
retrieve: Connection<S>['retrieve'];
|
|
184
|
+
_retrieveSingle: (type: string, id: string, options: import("../types").RetrieveOptions) => Promise<unknown>;
|
|
185
|
+
_retrieveParallel: (type: string, ids: string[], options: import("../types").RetrieveOptions) => Promise<unknown[]>;
|
|
186
|
+
_retrieveMany: (type: string, ids: string[], options: import("../types").RetrieveOptions) => Promise<unknown>;
|
|
187
|
+
/**
|
|
188
|
+
* Update records
|
|
189
|
+
*/
|
|
190
|
+
update: Connection<S>['update'];
|
|
191
|
+
_updateSingle: (type: string, record: import("../types").Record, options: import("../types").DmlOptions) => Promise<import("../types").SaveResult>;
|
|
192
|
+
_updateParallel: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise<import("../types").SaveResult[]>;
|
|
193
|
+
_updateMany: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise<import("../types").SaveResult[]>;
|
|
194
|
+
/**
|
|
195
|
+
* Upsert records
|
|
196
|
+
*/
|
|
197
|
+
upsert: Connection<S>['upsert'];
|
|
198
|
+
/**
|
|
199
|
+
* Delete records
|
|
200
|
+
*/
|
|
201
|
+
destroy: Connection<S>['destroy'];
|
|
202
|
+
_destroySingle: (type: string, id: string, options: import("../types").DmlOptions) => Promise<import("../types").SaveResult>;
|
|
203
|
+
_destroyParallel: (type: string, ids: string[], options: import("../types").DmlOptions) => Promise<import("../types").SaveResult[]>;
|
|
204
|
+
_destroyMany: (type: string, ids: string[], options: import("../types").DmlOptions) => Promise<import("../types").SaveResult[]>;
|
|
205
|
+
/**
|
|
206
|
+
* Synonym of Tooling#destroy()
|
|
207
|
+
*/
|
|
208
|
+
delete: {
|
|
209
|
+
<N extends string>(type: N, ids: string[], options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult[]>;
|
|
210
|
+
<N_1 extends string>(type: N_1, id: string, options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult>;
|
|
211
|
+
<N_2 extends string>(type: N_2, ids: string | string[], options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult | import("../types").SaveResult[]>;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Synonym of Tooling#destroy()
|
|
215
|
+
*/
|
|
216
|
+
del: {
|
|
217
|
+
<N extends string>(type: N, ids: string[], options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult[]>;
|
|
218
|
+
<N_1 extends string>(type: N_1, id: string, options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult>;
|
|
219
|
+
<N_2 extends string>(type: N_2, ids: string | string[], options?: import("../types").DmlOptions | undefined): Promise<import("../types").SaveResult | import("../types").SaveResult[]>;
|
|
220
|
+
};
|
|
221
|
+
cache: Cache;
|
|
222
|
+
/**
|
|
223
|
+
* Describe SObject metadata
|
|
224
|
+
*/
|
|
225
|
+
describe: CachedFunction<(type: string) => Promise<DescribeSObjectResult>>;
|
|
226
|
+
describe$: CachedFunction<(type: string) => Promise<DescribeSObjectResult>>;
|
|
227
|
+
describe$$: CachedFunction<(name: string) => DescribeSObjectResult>;
|
|
228
|
+
/**
|
|
229
|
+
* Synonym of Tooling#describe()
|
|
230
|
+
*/
|
|
231
|
+
describeSObject: CachedFunction<(type: string) => Promise<DescribeSObjectResult>>;
|
|
232
|
+
describeSObject$: CachedFunction<(type: string) => Promise<DescribeSObjectResult>>;
|
|
233
|
+
describeSObject$$: CachedFunction<(name: string) => DescribeSObjectResult>;
|
|
234
|
+
/**
|
|
235
|
+
* Describe global SObjects
|
|
236
|
+
*/
|
|
237
|
+
describeGlobal: CachedFunction<() => Promise<DescribeGlobalResult>>;
|
|
238
|
+
describeGlobal$: CachedFunction<() => Promise<DescribeGlobalResult>>;
|
|
239
|
+
describeGlobal$$: CachedFunction<(name: string) => DescribeGlobalResult>;
|
|
240
|
+
/**
|
|
241
|
+
* Get SObject instance
|
|
242
|
+
*/
|
|
243
|
+
sobject: Connection<S>['sobject'];
|
|
244
|
+
sobjects: {
|
|
245
|
+
[N in SObjectNames<S>]?: SObject<S, N>;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
*/
|
|
250
|
+
constructor(conn: Connection<S>);
|
|
251
|
+
/**
|
|
252
|
+
* @private
|
|
253
|
+
*/
|
|
254
|
+
_establish(): void;
|
|
255
|
+
/**
|
|
256
|
+
* @private
|
|
257
|
+
*/
|
|
258
|
+
_baseUrl(): string;
|
|
259
|
+
/**
|
|
260
|
+
* @private
|
|
261
|
+
*/
|
|
262
|
+
_supports(feature: string): boolean;
|
|
263
|
+
/**
|
|
264
|
+
*
|
|
265
|
+
*/
|
|
266
|
+
request<R = unknown>(request: string | HttpRequest, options?: Object): import("../util/promise").StreamPromise<R>;
|
|
267
|
+
/**
|
|
268
|
+
* Executes Apex code anonymously
|
|
269
|
+
*/
|
|
270
|
+
executeAnonymous(body: string): import("../util/promise").StreamPromise<ExecuteAnonymousResult>;
|
|
271
|
+
/**
|
|
272
|
+
* Executes Apex tests asynchronously
|
|
273
|
+
*/
|
|
274
|
+
runTestsAsynchronous(req: RunTestsAsyncRequest): import("../util/promise").StreamPromise<string | null>;
|
|
275
|
+
/**
|
|
276
|
+
* Executes Apex tests synchronously
|
|
277
|
+
*/
|
|
278
|
+
runTestsSynchronous(req: RunTestsRequest): import("../util/promise").StreamPromise<RunTestsResult | null>;
|
|
279
|
+
/**
|
|
280
|
+
* Retrieves available code completions of the referenced type
|
|
281
|
+
*/
|
|
282
|
+
completions(type?: 'apex' | 'visualforce'): import("../util/promise").StreamPromise<CompletionsResult>;
|
|
283
|
+
}
|
|
284
|
+
export default Tooling;
|