@jsforce/jsforce-node 0.0.1 → 3.0.0-next.2

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