@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
package/lib/cache.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Cache = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @file Manages asynchronous method response cache
|
|
6
|
+
* @author Shinichi Tomita <shinichi.tomita@gmail.com>
|
|
7
|
+
*/
|
|
8
|
+
const events_1 = require("events");
|
|
9
|
+
/**
|
|
10
|
+
* Class for managing cache entry
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
* @class
|
|
14
|
+
* @constructor
|
|
15
|
+
* @template T
|
|
16
|
+
*/
|
|
17
|
+
class CacheEntry extends events_1.EventEmitter {
|
|
18
|
+
_fetching = false;
|
|
19
|
+
_value = undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Get value in the cache entry
|
|
22
|
+
*
|
|
23
|
+
* @param {() => Promise<T>} [callback] - Callback function callbacked the cache entry updated
|
|
24
|
+
* @returns {T|undefined}
|
|
25
|
+
*/
|
|
26
|
+
get(callback) {
|
|
27
|
+
if (callback) {
|
|
28
|
+
const cb = callback;
|
|
29
|
+
this.once('value', (v) => cb(v));
|
|
30
|
+
if (typeof this._value !== 'undefined') {
|
|
31
|
+
this.emit('value', this._value);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return this._value;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set value in the cache entry
|
|
38
|
+
*/
|
|
39
|
+
set(value) {
|
|
40
|
+
this._value = value;
|
|
41
|
+
this.emit('value', this._value);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Clear cached value
|
|
45
|
+
*/
|
|
46
|
+
clear() {
|
|
47
|
+
this._fetching = false;
|
|
48
|
+
this._value = undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* create and return cache key from namespace and serialized arguments.
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
function createCacheKey(namespace, args) {
|
|
56
|
+
return `${namespace || ''}(${[...args]
|
|
57
|
+
.map((a) => JSON.stringify(a))
|
|
58
|
+
.join(',')})`;
|
|
59
|
+
}
|
|
60
|
+
function generateKeyString(options, scope, args) {
|
|
61
|
+
return typeof options.key === 'string'
|
|
62
|
+
? options.key
|
|
63
|
+
: typeof options.key === 'function'
|
|
64
|
+
? options.key.apply(scope, args)
|
|
65
|
+
: createCacheKey(options.namespace, args);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Caching manager for async methods
|
|
69
|
+
*
|
|
70
|
+
* @class
|
|
71
|
+
* @constructor
|
|
72
|
+
*/
|
|
73
|
+
class Cache {
|
|
74
|
+
_entries = {};
|
|
75
|
+
/**
|
|
76
|
+
* retrive cache entry, or create if not exists.
|
|
77
|
+
*
|
|
78
|
+
* @param {String} [key] - Key of cache entry
|
|
79
|
+
* @returns {CacheEntry}
|
|
80
|
+
*/
|
|
81
|
+
get(key) {
|
|
82
|
+
if (this._entries[key]) {
|
|
83
|
+
return this._entries[key];
|
|
84
|
+
}
|
|
85
|
+
const entry = new CacheEntry();
|
|
86
|
+
this._entries[key] = entry;
|
|
87
|
+
return entry;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* clear cache entries prefix matching given key
|
|
91
|
+
*/
|
|
92
|
+
clear(key) {
|
|
93
|
+
for (const k of Object.keys(this._entries)) {
|
|
94
|
+
if (!key || k.indexOf(key) === 0) {
|
|
95
|
+
this._entries[k].clear();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Enable caching for async call fn to lookup the response cache first,
|
|
101
|
+
* then invoke original if no cached value.
|
|
102
|
+
*/
|
|
103
|
+
createCachedFunction(fn, scope, options = { strategy: 'NOCACHE' }) {
|
|
104
|
+
const strategy = options.strategy;
|
|
105
|
+
const $fn = (...args) => {
|
|
106
|
+
const key = generateKeyString(options, scope, args);
|
|
107
|
+
const entry = this.get(key);
|
|
108
|
+
const executeFetch = async () => {
|
|
109
|
+
entry._fetching = true;
|
|
110
|
+
try {
|
|
111
|
+
const result = await fn.apply(scope || this, args);
|
|
112
|
+
entry.set({ error: undefined, result });
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
entry.set({ error: error, result: undefined });
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
let value;
|
|
121
|
+
switch (strategy) {
|
|
122
|
+
case 'IMMEDIATE':
|
|
123
|
+
value = entry.get();
|
|
124
|
+
if (!value) {
|
|
125
|
+
throw new Error('Function call result is not cached yet.');
|
|
126
|
+
}
|
|
127
|
+
if (value.error) {
|
|
128
|
+
throw value.error;
|
|
129
|
+
}
|
|
130
|
+
return value.result;
|
|
131
|
+
case 'HIT':
|
|
132
|
+
return (async () => {
|
|
133
|
+
if (!entry._fetching) {
|
|
134
|
+
// only when no other client is calling function
|
|
135
|
+
await executeFetch();
|
|
136
|
+
}
|
|
137
|
+
return new Promise((resolve, reject) => {
|
|
138
|
+
entry.get(({ error, result }) => {
|
|
139
|
+
if (error)
|
|
140
|
+
reject(error);
|
|
141
|
+
else
|
|
142
|
+
resolve(result);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
})();
|
|
146
|
+
case 'NOCACHE':
|
|
147
|
+
default:
|
|
148
|
+
return executeFetch();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
$fn.clear = (...args) => {
|
|
152
|
+
const key = generateKeyString(options, scope, args);
|
|
153
|
+
this.clear(key);
|
|
154
|
+
};
|
|
155
|
+
return $fn;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.Cache = Cache;
|
|
159
|
+
exports.default = Cache;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
import { HttpRequest, Record, SaveResult, UpsertResult, DescribeGlobalResult, DescribeSObjectResult, DescribeTab, DescribeTheme, DescribeQuickActionResult, UpdatedResult, DeletedResult, SearchResult, OrganizationLimitsInfo, Optional, SignedRequestObject, DmlOptions, RetrieveOptions, Schema, SObjectNames, SObjectInputRecord, SObjectUpdateRecord, SObjectFieldNames, UserInfo, IdentityInfo, LimitInfo } from './types';
|
|
7
|
+
import { StreamPromise } from './util/promise';
|
|
8
|
+
import Transport from './transport';
|
|
9
|
+
import { Logger } from './util/logger';
|
|
10
|
+
import { LogLevelConfig } from './util/logger';
|
|
11
|
+
import OAuth2 from './oauth2';
|
|
12
|
+
import { OAuth2Config } from './oauth2';
|
|
13
|
+
import Cache, { CachedFunction } from './cache';
|
|
14
|
+
import SessionRefreshDelegate, { SessionRefreshFunc } from './session-refresh-delegate';
|
|
15
|
+
import Query from './query';
|
|
16
|
+
import { QueryOptions } from './query';
|
|
17
|
+
import SObject from './sobject';
|
|
18
|
+
import QuickAction from './quick-action';
|
|
19
|
+
import Process from './process';
|
|
20
|
+
import Analytics from './api/analytics';
|
|
21
|
+
import Apex from './api/apex';
|
|
22
|
+
import { Bulk, BulkV2 } from './api/bulk';
|
|
23
|
+
import Chatter from './api/chatter';
|
|
24
|
+
import Metadata from './api/metadata';
|
|
25
|
+
import SoapApi from './api/soap';
|
|
26
|
+
import Streaming from './api/streaming';
|
|
27
|
+
import Tooling from './api/tooling';
|
|
28
|
+
/**
|
|
29
|
+
* type definitions
|
|
30
|
+
*/
|
|
31
|
+
export type ConnectionConfig<S extends Schema = Schema> = {
|
|
32
|
+
version?: string;
|
|
33
|
+
loginUrl?: string;
|
|
34
|
+
accessToken?: string;
|
|
35
|
+
refreshToken?: string;
|
|
36
|
+
instanceUrl?: string;
|
|
37
|
+
sessionId?: string;
|
|
38
|
+
serverUrl?: string;
|
|
39
|
+
signedRequest?: string;
|
|
40
|
+
oauth2?: OAuth2 | OAuth2Config;
|
|
41
|
+
maxRequest?: number;
|
|
42
|
+
proxyUrl?: string;
|
|
43
|
+
httpProxy?: string;
|
|
44
|
+
logLevel?: LogLevelConfig;
|
|
45
|
+
callOptions?: {
|
|
46
|
+
[name: string]: string;
|
|
47
|
+
};
|
|
48
|
+
refreshFn?: SessionRefreshFunc<S>;
|
|
49
|
+
};
|
|
50
|
+
export type ConnectionEstablishOptions = {
|
|
51
|
+
accessToken?: Optional<string>;
|
|
52
|
+
refreshToken?: Optional<string>;
|
|
53
|
+
instanceUrl?: Optional<string>;
|
|
54
|
+
sessionId?: Optional<string>;
|
|
55
|
+
serverUrl?: Optional<string>;
|
|
56
|
+
signedRequest?: Optional<string | SignedRequestObject>;
|
|
57
|
+
userInfo?: Optional<UserInfo>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
export declare class Connection<S extends Schema = Schema> extends EventEmitter {
|
|
63
|
+
static _logger: Logger;
|
|
64
|
+
version: string;
|
|
65
|
+
loginUrl: string;
|
|
66
|
+
instanceUrl: string;
|
|
67
|
+
accessToken: Optional<string>;
|
|
68
|
+
refreshToken: Optional<string>;
|
|
69
|
+
userInfo: Optional<UserInfo>;
|
|
70
|
+
limitInfo: LimitInfo;
|
|
71
|
+
oauth2: OAuth2;
|
|
72
|
+
sobjects: {
|
|
73
|
+
[N in SObjectNames<S>]?: SObject<S, N>;
|
|
74
|
+
};
|
|
75
|
+
cache: Cache;
|
|
76
|
+
_callOptions: Optional<{
|
|
77
|
+
[name: string]: string;
|
|
78
|
+
}>;
|
|
79
|
+
_maxRequest: number;
|
|
80
|
+
_logger: Logger;
|
|
81
|
+
_logLevel: Optional<LogLevelConfig>;
|
|
82
|
+
_transport: Transport;
|
|
83
|
+
_sessionType: Optional<'soap' | 'oauth2'>;
|
|
84
|
+
_refreshDelegate: Optional<SessionRefreshDelegate<S>>;
|
|
85
|
+
describe$: CachedFunction<(name: string) => Promise<DescribeSObjectResult>>;
|
|
86
|
+
describe$$: CachedFunction<(name: string) => DescribeSObjectResult>;
|
|
87
|
+
describeSObject: (name: string) => Promise<DescribeSObjectResult>;
|
|
88
|
+
describeSObject$: CachedFunction<(name: string) => Promise<DescribeSObjectResult>>;
|
|
89
|
+
describeSObject$$: CachedFunction<(name: string) => DescribeSObjectResult>;
|
|
90
|
+
describeGlobal$: CachedFunction<() => Promise<DescribeGlobalResult>>;
|
|
91
|
+
describeGlobal$$: CachedFunction<() => DescribeGlobalResult>;
|
|
92
|
+
get analytics(): Analytics<S>;
|
|
93
|
+
get apex(): Apex<S>;
|
|
94
|
+
get bulk(): Bulk<S>;
|
|
95
|
+
get bulk2(): BulkV2<S>;
|
|
96
|
+
get chatter(): Chatter<S>;
|
|
97
|
+
get metadata(): Metadata<S>;
|
|
98
|
+
get soap(): SoapApi<S>;
|
|
99
|
+
get streaming(): Streaming<S>;
|
|
100
|
+
get tooling(): Tooling<S>;
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
constructor(config?: ConnectionConfig<S>);
|
|
105
|
+
_establish(options: ConnectionEstablishOptions): void;
|
|
106
|
+
_clearSession(): void;
|
|
107
|
+
_resetInstance(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Authorize the connection using OAuth2 flow.
|
|
110
|
+
* Typically, just pass the code returned from authorization server in the first argument to complete authorization.
|
|
111
|
+
* If you want to authorize with grant types other than `authorization_code`, you can also pass params object with the grant type.
|
|
112
|
+
*
|
|
113
|
+
* @returns {Promise<UserInfo>} An object that contains the user ID, org ID and identity URL.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
authorize(codeOrParams: string | {
|
|
117
|
+
grant_type: string;
|
|
118
|
+
[name: string]: string;
|
|
119
|
+
}, params?: {
|
|
120
|
+
[name: string]: string;
|
|
121
|
+
}): Promise<UserInfo>;
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
125
|
+
login(username: string, password: string): Promise<UserInfo>;
|
|
126
|
+
/**
|
|
127
|
+
* Login by OAuth2 username & password flow
|
|
128
|
+
*/
|
|
129
|
+
loginByOAuth2(username: string, password: string): Promise<UserInfo>;
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
loginBySoap(username: string, password: string): Promise<UserInfo>;
|
|
134
|
+
/**
|
|
135
|
+
* Logout the current session
|
|
136
|
+
*/
|
|
137
|
+
logout(revoke?: boolean): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Logout the current session by revoking access token via OAuth2 session revoke
|
|
140
|
+
*/
|
|
141
|
+
logoutByOAuth2(revoke?: boolean): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Logout the session by using SOAP web service API
|
|
144
|
+
*/
|
|
145
|
+
logoutBySoap(revoke?: boolean): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Send REST API request with given HTTP request info, with connected session information.
|
|
148
|
+
*
|
|
149
|
+
* Endpoint URL can be absolute URL ('https://na1.salesforce.com/services/data/v32.0/sobjects/Account/describe')
|
|
150
|
+
* , relative path from root ('/services/data/v32.0/sobjects/Account/describe')
|
|
151
|
+
* , or relative path from version root ('/sobjects/Account/describe').
|
|
152
|
+
*/
|
|
153
|
+
request<R = unknown>(request: string | HttpRequest, options?: Object): StreamPromise<R>;
|
|
154
|
+
/**
|
|
155
|
+
* Send HTTP GET request
|
|
156
|
+
*
|
|
157
|
+
* Endpoint URL can be absolute URL ('https://na1.salesforce.com/services/data/v32.0/sobjects/Account/describe')
|
|
158
|
+
* , relative path from root ('/services/data/v32.0/sobjects/Account/describe')
|
|
159
|
+
* , or relative path from version root ('/sobjects/Account/describe').
|
|
160
|
+
*/
|
|
161
|
+
requestGet<R = unknown>(url: string, options?: Object): StreamPromise<R>;
|
|
162
|
+
/**
|
|
163
|
+
* Send HTTP POST request with JSON body, with connected session information
|
|
164
|
+
*
|
|
165
|
+
* Endpoint URL can be absolute URL ('https://na1.salesforce.com/services/data/v32.0/sobjects/Account/describe')
|
|
166
|
+
* , relative path from root ('/services/data/v32.0/sobjects/Account/describe')
|
|
167
|
+
* , or relative path from version root ('/sobjects/Account/describe').
|
|
168
|
+
*/
|
|
169
|
+
requestPost<R = unknown>(url: string, body: Object, options?: Object): StreamPromise<R>;
|
|
170
|
+
/**
|
|
171
|
+
* Send HTTP PUT request with JSON body, with connected session information
|
|
172
|
+
*
|
|
173
|
+
* Endpoint URL can be absolute URL ('https://na1.salesforce.com/services/data/v32.0/sobjects/Account/describe')
|
|
174
|
+
* , relative path from root ('/services/data/v32.0/sobjects/Account/describe')
|
|
175
|
+
* , or relative path from version root ('/sobjects/Account/describe').
|
|
176
|
+
*/
|
|
177
|
+
requestPut<R>(url: string, body: Object, options?: Object): StreamPromise<R>;
|
|
178
|
+
/**
|
|
179
|
+
* Send HTTP PATCH request with JSON body
|
|
180
|
+
*
|
|
181
|
+
* Endpoint URL can be absolute URL ('https://na1.salesforce.com/services/data/v32.0/sobjects/Account/describe')
|
|
182
|
+
* , relative path from root ('/services/data/v32.0/sobjects/Account/describe')
|
|
183
|
+
* , or relative path from version root ('/sobjects/Account/describe').
|
|
184
|
+
*/
|
|
185
|
+
requestPatch<R = unknown>(url: string, body: Object, options?: Object): StreamPromise<R>;
|
|
186
|
+
/**
|
|
187
|
+
* Send HTTP DELETE request
|
|
188
|
+
*
|
|
189
|
+
* Endpoint URL can be absolute URL ('https://na1.salesforce.com/services/data/v32.0/sobjects/Account/describe')
|
|
190
|
+
* , relative path from root ('/services/data/v32.0/sobjects/Account/describe')
|
|
191
|
+
* , or relative path from version root ('/sobjects/Account/describe').
|
|
192
|
+
*/
|
|
193
|
+
requestDelete<R>(url: string, options?: Object): StreamPromise<R>;
|
|
194
|
+
/** @private **/
|
|
195
|
+
_baseUrl(): string;
|
|
196
|
+
/**
|
|
197
|
+
* Convert path to absolute url
|
|
198
|
+
* @private
|
|
199
|
+
*/
|
|
200
|
+
_normalizeUrl(url: string): string;
|
|
201
|
+
/**
|
|
202
|
+
*
|
|
203
|
+
*/
|
|
204
|
+
query<T extends Record>(soql: string, options?: Partial<QueryOptions>): Query<S, SObjectNames<S>, T, 'QueryResult'>;
|
|
205
|
+
/**
|
|
206
|
+
* Execute search by SOSL
|
|
207
|
+
*
|
|
208
|
+
* @param {String} sosl - SOSL string
|
|
209
|
+
* @param {Callback.<Array.<RecordResult>>} [callback] - Callback function
|
|
210
|
+
* @returns {Promise.<Array.<RecordResult>>}
|
|
211
|
+
*/
|
|
212
|
+
search(sosl: string): StreamPromise<SearchResult>;
|
|
213
|
+
/**
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
queryMore(locator: string, options?: QueryOptions): Query<S, Extract<keyof S["SObjects"], string>, Record, "QueryResult">;
|
|
217
|
+
_ensureVersion(majorVersion: number): boolean;
|
|
218
|
+
_supports(feature: string): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Retrieve specified records
|
|
221
|
+
*/
|
|
222
|
+
retrieve<N extends SObjectNames<S>>(type: N, ids: string, options?: RetrieveOptions): Promise<Record>;
|
|
223
|
+
retrieve<N extends SObjectNames<S>>(type: N, ids: string[], options?: RetrieveOptions): Promise<Record[]>;
|
|
224
|
+
retrieve<N extends SObjectNames<S>>(type: N, ids: string | string[], options?: RetrieveOptions): Promise<Record | Record[]>;
|
|
225
|
+
/** @private */
|
|
226
|
+
_retrieveSingle(type: string, id: string, options: RetrieveOptions): Promise<unknown>;
|
|
227
|
+
/** @private */
|
|
228
|
+
_retrieveParallel(type: string, ids: string[], options: RetrieveOptions): Promise<unknown[]>;
|
|
229
|
+
/** @private */
|
|
230
|
+
_retrieveMany(type: string, ids: string[], options: RetrieveOptions): Promise<unknown>;
|
|
231
|
+
/**
|
|
232
|
+
* Create records
|
|
233
|
+
*/
|
|
234
|
+
create<N extends SObjectNames<S>, InputRecord extends SObjectInputRecord<S, N> = SObjectInputRecord<S, N>>(type: N, records: InputRecord[], options?: DmlOptions): Promise<SaveResult[]>;
|
|
235
|
+
create<N extends SObjectNames<S>, InputRecord extends SObjectInputRecord<S, N> = SObjectInputRecord<S, N>>(type: N, record: InputRecord, options?: DmlOptions): Promise<SaveResult>;
|
|
236
|
+
create<N extends SObjectNames<S>, InputRecord extends SObjectInputRecord<S, N> = SObjectInputRecord<S, N>>(type: N, records: InputRecord | InputRecord[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
|
|
237
|
+
/** @private */
|
|
238
|
+
_createSingle(type: string, record: Record, options: DmlOptions): Promise<unknown>;
|
|
239
|
+
/** @private */
|
|
240
|
+
_createParallel(type: string, records: Record[], options: DmlOptions): Promise<unknown[]>;
|
|
241
|
+
/** @private */
|
|
242
|
+
_createMany(type: string, records: Record[], options: DmlOptions): Promise<SaveResult[]>;
|
|
243
|
+
/**
|
|
244
|
+
* Synonym of Connection#create()
|
|
245
|
+
*/
|
|
246
|
+
insert: {
|
|
247
|
+
<N extends Extract<keyof S["SObjects"], string>, InputRecord extends Partial<import("./types").SObjectRecord<S, N, "*", Record, {}>> = Partial<import("./types").SObjectRecord<S, N, "*", Record, {}>>>(type: N, records: InputRecord[], options?: DmlOptions): Promise<SaveResult[]>;
|
|
248
|
+
<N_1 extends Extract<keyof S["SObjects"], string>, InputRecord_1 extends Partial<import("./types").SObjectRecord<S, N_1, "*", Record, {}>> = Partial<import("./types").SObjectRecord<S, N_1, "*", Record, {}>>>(type: N_1, record: InputRecord_1, options?: DmlOptions): Promise<SaveResult>;
|
|
249
|
+
<N_2 extends Extract<keyof S["SObjects"], string>, InputRecord_2 extends Partial<import("./types").SObjectRecord<S, N_2, "*", Record, {}>> = Partial<import("./types").SObjectRecord<S, N_2, "*", Record, {}>>>(type: N_2, records: InputRecord_2 | InputRecord_2[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Update records
|
|
253
|
+
*/
|
|
254
|
+
update<N extends SObjectNames<S>, UpdateRecord extends SObjectUpdateRecord<S, N> = SObjectUpdateRecord<S, N>>(type: N, records: UpdateRecord[], options?: DmlOptions): Promise<SaveResult[]>;
|
|
255
|
+
update<N extends SObjectNames<S>, UpdateRecord extends SObjectUpdateRecord<S, N> = SObjectUpdateRecord<S, N>>(type: N, record: UpdateRecord, options?: DmlOptions): Promise<SaveResult>;
|
|
256
|
+
update<N extends SObjectNames<S>, UpdateRecord extends SObjectUpdateRecord<S, N> = SObjectUpdateRecord<S, N>>(type: N, records: UpdateRecord | UpdateRecord[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
|
|
257
|
+
/** @private */
|
|
258
|
+
_updateSingle(type: string, record: Record, options: DmlOptions): Promise<SaveResult>;
|
|
259
|
+
/** @private */
|
|
260
|
+
_updateParallel(type: string, records: Record[], options: DmlOptions): Promise<SaveResult[]>;
|
|
261
|
+
/** @private */
|
|
262
|
+
_updateMany(type: string, records: Record[], options: DmlOptions): Promise<SaveResult[]>;
|
|
263
|
+
/**
|
|
264
|
+
* Upsert records
|
|
265
|
+
*/
|
|
266
|
+
upsert<N extends SObjectNames<S>, InputRecord extends SObjectInputRecord<S, N> = SObjectInputRecord<S, N>, FieldNames extends SObjectFieldNames<S, N> = SObjectFieldNames<S, N>>(type: N, records: InputRecord[], extIdField: FieldNames, options?: DmlOptions): Promise<UpsertResult[]>;
|
|
267
|
+
upsert<N extends SObjectNames<S>, InputRecord extends SObjectInputRecord<S, N> = SObjectInputRecord<S, N>, FieldNames extends SObjectFieldNames<S, N> = SObjectFieldNames<S, N>>(type: N, record: InputRecord, extIdField: FieldNames, options?: DmlOptions): Promise<UpsertResult>;
|
|
268
|
+
upsert<N extends SObjectNames<S>, InputRecord extends SObjectInputRecord<S, N> = SObjectInputRecord<S, N>, FieldNames extends SObjectFieldNames<S, N> = SObjectFieldNames<S, N>>(type: N, records: InputRecord | InputRecord[], extIdField: FieldNames, options?: DmlOptions): Promise<UpsertResult | UpsertResult[]>;
|
|
269
|
+
/**
|
|
270
|
+
* Delete records
|
|
271
|
+
*/
|
|
272
|
+
destroy<N extends SObjectNames<S>>(type: N, ids: string[], options?: DmlOptions): Promise<SaveResult[]>;
|
|
273
|
+
destroy<N extends SObjectNames<S>>(type: N, id: string, options?: DmlOptions): Promise<SaveResult>;
|
|
274
|
+
destroy<N extends SObjectNames<S>>(type: N, ids: string | string[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
|
|
275
|
+
/** @private */
|
|
276
|
+
_destroySingle(type: string, id: string, options: DmlOptions): Promise<SaveResult>;
|
|
277
|
+
/** @private */
|
|
278
|
+
_destroyParallel(type: string, ids: string[], options: DmlOptions): Promise<SaveResult[]>;
|
|
279
|
+
/** @private */
|
|
280
|
+
_destroyMany(type: string, ids: string[], options: DmlOptions): Promise<SaveResult[]>;
|
|
281
|
+
/**
|
|
282
|
+
* Synonym of Connection#destroy()
|
|
283
|
+
*/
|
|
284
|
+
delete: {
|
|
285
|
+
<N extends Extract<keyof S["SObjects"], string>>(type: N, ids: string[], options?: DmlOptions): Promise<SaveResult[]>;
|
|
286
|
+
<N_1 extends Extract<keyof S["SObjects"], string>>(type: N_1, id: string, options?: DmlOptions): Promise<SaveResult>;
|
|
287
|
+
<N_2 extends Extract<keyof S["SObjects"], string>>(type: N_2, ids: string | string[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Synonym of Connection#destroy()
|
|
291
|
+
*/
|
|
292
|
+
del: {
|
|
293
|
+
<N extends Extract<keyof S["SObjects"], string>>(type: N, ids: string[], options?: DmlOptions): Promise<SaveResult[]>;
|
|
294
|
+
<N_1 extends Extract<keyof S["SObjects"], string>>(type: N_1, id: string, options?: DmlOptions): Promise<SaveResult>;
|
|
295
|
+
<N_2 extends Extract<keyof S["SObjects"], string>>(type: N_2, ids: string | string[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Describe SObject metadata
|
|
299
|
+
*/
|
|
300
|
+
describe(type: string): Promise<DescribeSObjectResult>;
|
|
301
|
+
/**
|
|
302
|
+
* Describe global SObjects
|
|
303
|
+
*/
|
|
304
|
+
describeGlobal(): Promise<DescribeGlobalResult>;
|
|
305
|
+
/**
|
|
306
|
+
* Get SObject instance
|
|
307
|
+
*/
|
|
308
|
+
sobject<N extends SObjectNames<S>>(type: N): SObject<S, N>;
|
|
309
|
+
sobject<N extends SObjectNames<S>>(type: string): SObject<S, N>;
|
|
310
|
+
/**
|
|
311
|
+
* Get identity information of current user
|
|
312
|
+
*/
|
|
313
|
+
identity(options?: {
|
|
314
|
+
headers?: {
|
|
315
|
+
[name: string]: string;
|
|
316
|
+
};
|
|
317
|
+
}): Promise<IdentityInfo>;
|
|
318
|
+
/**
|
|
319
|
+
* List recently viewed records
|
|
320
|
+
*/
|
|
321
|
+
recent(type?: string | number, limit?: number): Promise<Record[]>;
|
|
322
|
+
/**
|
|
323
|
+
* Retrieve updated records
|
|
324
|
+
*/
|
|
325
|
+
updated(type: string, start: string | Date, end: string | Date): Promise<UpdatedResult>;
|
|
326
|
+
/**
|
|
327
|
+
* Retrieve deleted records
|
|
328
|
+
*/
|
|
329
|
+
deleted(type: string, start: string | Date, end: string | Date): Promise<DeletedResult>;
|
|
330
|
+
/**
|
|
331
|
+
* Returns a list of all tabs
|
|
332
|
+
*/
|
|
333
|
+
tabs(): Promise<DescribeTab[]>;
|
|
334
|
+
/**
|
|
335
|
+
* Returns current system limit in the organization
|
|
336
|
+
*/
|
|
337
|
+
limits(): Promise<OrganizationLimitsInfo>;
|
|
338
|
+
/**
|
|
339
|
+
* Returns a theme info
|
|
340
|
+
*/
|
|
341
|
+
theme(): Promise<DescribeTheme>;
|
|
342
|
+
/**
|
|
343
|
+
* Returns all registered global quick actions
|
|
344
|
+
*/
|
|
345
|
+
quickActions(): Promise<DescribeQuickActionResult[]>;
|
|
346
|
+
/**
|
|
347
|
+
* Get reference for specified global quick action
|
|
348
|
+
*/
|
|
349
|
+
quickAction(actionName: string): QuickAction<S>;
|
|
350
|
+
/**
|
|
351
|
+
* Module which manages process rules and approval processes
|
|
352
|
+
*/
|
|
353
|
+
process: Process<S>;
|
|
354
|
+
}
|
|
355
|
+
export default Connection;
|