@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/soap.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @file Manages method call to SOAP endpoint
3
+ * @author Shinichi Tomita <shinichi.tomita@gmail.com>
4
+ */
5
+ import HttpApi from './http-api';
6
+ import Connection from './connection';
7
+ import { Schema, HttpResponse, HttpRequest, SoapSchema, SoapSchemaDef } from './types';
8
+ /**
9
+ *
10
+ */
11
+ export declare function castTypeUsingSchema(value: unknown, schema?: SoapSchema | SoapSchemaDef, schemaDict?: {
12
+ [name: string]: SoapSchemaDef;
13
+ }): any;
14
+ /**
15
+ *
16
+ */
17
+ export type SOAPOptions = {
18
+ endpointUrl: string;
19
+ xmlns?: string;
20
+ };
21
+ /**
22
+ * Class for SOAP endpoint of Salesforce
23
+ *
24
+ * @protected
25
+ * @class
26
+ * @constructor
27
+ * @param {Connection} conn - Connection instance
28
+ * @param {Object} options - SOAP endpoint setting options
29
+ * @param {String} options.endpointUrl - SOAP endpoint URL
30
+ * @param {String} [options.xmlns] - XML namespace for method call (default is "urn:partner.soap.sforce.com")
31
+ */
32
+ export declare class SOAP<S extends Schema> extends HttpApi<S> {
33
+ _endpointUrl: string;
34
+ _xmlns: string;
35
+ constructor(conn: Connection<S>, options: SOAPOptions);
36
+ /**
37
+ * Invoke SOAP call using method and arguments
38
+ */
39
+ invoke(method: string, args: object, schema?: SoapSchema | SoapSchemaDef, schemaDict?: {
40
+ [name: string]: SoapSchemaDef;
41
+ }): Promise<any>;
42
+ /** @override */
43
+ beforeSend(request: HttpRequest & {
44
+ _message: object;
45
+ }): void;
46
+ /** @override **/
47
+ isSessionExpired(response: HttpResponse): boolean;
48
+ /** @override **/
49
+ parseError(body: string): {
50
+ errorCode: string | undefined;
51
+ message: string | undefined;
52
+ };
53
+ /** @override **/
54
+ getResponseBody(response: HttpResponse): Promise<unknown>;
55
+ /**
56
+ * @private
57
+ */
58
+ _createEnvelope(message: object): string;
59
+ }
60
+ export default SOAP;
package/lib/soap.js ADDED
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SOAP = exports.castTypeUsingSchema = void 0;
7
+ /**
8
+ * @file Manages method call to SOAP endpoint
9
+ * @author Shinichi Tomita <shinichi.tomita@gmail.com>
10
+ */
11
+ const http_api_1 = __importDefault(require("./http-api"));
12
+ const function_1 = require("./util/function");
13
+ const get_body_size_1 = require("./util/get-body-size");
14
+ /**
15
+ *
16
+ */
17
+ function getPropsSchema(schema, schemaDict) {
18
+ if (schema.extends && schemaDict[schema.extends]) {
19
+ const extendSchema = schemaDict[schema.extends];
20
+ return {
21
+ ...getPropsSchema(extendSchema, schemaDict),
22
+ ...schema.props,
23
+ };
24
+ }
25
+ return schema.props;
26
+ }
27
+ function isNillValue(value) {
28
+ return (value == null ||
29
+ ((0, function_1.isMapObject)(value) &&
30
+ (0, function_1.isMapObject)(value.$) &&
31
+ value.$['xsi:nil'] === 'true'));
32
+ }
33
+ /**
34
+ *
35
+ */
36
+ function castTypeUsingSchema(value, schema, schemaDict = {}) {
37
+ if (Array.isArray(schema)) {
38
+ const nillable = schema.length === 2 && schema[0] === '?';
39
+ const schema_ = nillable ? schema[1] : schema[0];
40
+ if (value == null) {
41
+ return nillable ? null : [];
42
+ }
43
+ return (Array.isArray(value) ? value : [value]).map((v) => castTypeUsingSchema(v, schema_, schemaDict));
44
+ }
45
+ else if ((0, function_1.isMapObject)(schema)) {
46
+ // if schema is Schema Definition, not schema element
47
+ if ('type' in schema && 'props' in schema && (0, function_1.isMapObject)(schema.props)) {
48
+ const props = getPropsSchema(schema, schemaDict);
49
+ return castTypeUsingSchema(value, props, schemaDict);
50
+ }
51
+ const nillable = '?' in schema;
52
+ const schema_ = '?' in schema ? schema['?'] : schema;
53
+ if (nillable && isNillValue(value)) {
54
+ return null;
55
+ }
56
+ const obj = (0, function_1.isMapObject)(value) ? value : {};
57
+ return Object.keys(schema_).reduce((o, k) => {
58
+ const s = schema_[k];
59
+ const v = obj[k];
60
+ const nillable = (Array.isArray(s) && s.length === 2 && s[0] === '?') ||
61
+ ((0, function_1.isMapObject)(s) && '?' in s) ||
62
+ (typeof s === 'string' && s[0] === '?');
63
+ if (typeof v === 'undefined' && nillable) {
64
+ return o;
65
+ }
66
+ return {
67
+ ...o,
68
+ [k]: castTypeUsingSchema(v, s, schemaDict),
69
+ };
70
+ }, obj);
71
+ }
72
+ else {
73
+ const nillable = typeof schema === 'string' && schema[0] === '?';
74
+ const type = typeof schema === 'string'
75
+ ? nillable
76
+ ? schema.substring(1)
77
+ : schema
78
+ : 'any';
79
+ switch (type) {
80
+ case 'string':
81
+ return isNillValue(value) ? (nillable ? null : '') : String(value);
82
+ case 'number':
83
+ return isNillValue(value) ? (nillable ? null : 0) : Number(value);
84
+ case 'boolean':
85
+ return isNillValue(value)
86
+ ? nillable
87
+ ? null
88
+ : false
89
+ : value === 'true';
90
+ case 'null':
91
+ return null;
92
+ default: {
93
+ if (schemaDict[type]) {
94
+ const cvalue = castTypeUsingSchema(value, schemaDict[type], schemaDict);
95
+ const isEmpty = (0, function_1.isMapObject)(cvalue) && Object.keys(cvalue).length === 0;
96
+ return isEmpty && nillable ? null : cvalue;
97
+ }
98
+ return value;
99
+ }
100
+ }
101
+ }
102
+ }
103
+ exports.castTypeUsingSchema = castTypeUsingSchema;
104
+ /**
105
+ * @private
106
+ */
107
+ function lookupValue(obj, propRegExps) {
108
+ const regexp = propRegExps.shift();
109
+ if (!regexp) {
110
+ return obj;
111
+ }
112
+ if ((0, function_1.isMapObject)(obj)) {
113
+ for (const prop of Object.keys(obj)) {
114
+ if (regexp.test(prop)) {
115
+ return lookupValue(obj[prop], propRegExps);
116
+ }
117
+ }
118
+ return null;
119
+ }
120
+ }
121
+ /**
122
+ * @private
123
+ */
124
+ function toXML(name, value) {
125
+ if ((0, function_1.isObject)(name)) {
126
+ value = name;
127
+ name = null;
128
+ }
129
+ if (Array.isArray(value)) {
130
+ return value.map((v) => toXML(name, v)).join('');
131
+ }
132
+ else {
133
+ const attrs = [];
134
+ const elems = [];
135
+ if ((0, function_1.isMapObject)(value)) {
136
+ for (const k of Object.keys(value)) {
137
+ const v = value[k];
138
+ if (k[0] === '@') {
139
+ const kk = k.substring(1);
140
+ attrs.push(kk + '="' + v + '"');
141
+ }
142
+ else {
143
+ elems.push(toXML(k, v));
144
+ }
145
+ }
146
+ value = elems.join('');
147
+ }
148
+ else {
149
+ value = String(value)
150
+ .replace(/&/g, '&amp;')
151
+ .replace(/</g, '&lt;')
152
+ .replace(/>/g, '&gt;')
153
+ .replace(/"/g, '&quot;')
154
+ .replace(/'/g, '&apos;');
155
+ }
156
+ const startTag = name
157
+ ? '<' + name + (attrs.length > 0 ? ' ' + attrs.join(' ') : '') + '>'
158
+ : '';
159
+ const endTag = name ? '</' + name + '>' : '';
160
+ return startTag + value + endTag;
161
+ }
162
+ }
163
+ /**
164
+ * Class for SOAP endpoint of Salesforce
165
+ *
166
+ * @protected
167
+ * @class
168
+ * @constructor
169
+ * @param {Connection} conn - Connection instance
170
+ * @param {Object} options - SOAP endpoint setting options
171
+ * @param {String} options.endpointUrl - SOAP endpoint URL
172
+ * @param {String} [options.xmlns] - XML namespace for method call (default is "urn:partner.soap.sforce.com")
173
+ */
174
+ class SOAP extends http_api_1.default {
175
+ _endpointUrl;
176
+ _xmlns;
177
+ constructor(conn, options) {
178
+ super(conn, options);
179
+ this._endpointUrl = options.endpointUrl;
180
+ this._xmlns = options.xmlns || 'urn:partner.soap.sforce.com';
181
+ }
182
+ /**
183
+ * Invoke SOAP call using method and arguments
184
+ */
185
+ async invoke(method, args, schema, schemaDict) {
186
+ const res = await this.request({
187
+ method: 'POST',
188
+ url: this._endpointUrl,
189
+ headers: {
190
+ 'Content-Type': 'text/xml',
191
+ SOAPAction: '""',
192
+ },
193
+ _message: { [method]: args },
194
+ });
195
+ return schema ? castTypeUsingSchema(res, schema, schemaDict) : res;
196
+ }
197
+ /** @override */
198
+ beforeSend(request) {
199
+ request.body = this._createEnvelope(request._message);
200
+ const headers = request.headers || {};
201
+ const bodySize = (0, get_body_size_1.getBodySize)(request.body, request.headers);
202
+ if (request.method === 'POST' &&
203
+ !('transfer-encoding' in headers) &&
204
+ !('content-length' in headers) &&
205
+ !!bodySize) {
206
+ this._logger.debug(`missing 'content-length' header, setting it to: ${bodySize}`);
207
+ headers['content-length'] = String(bodySize);
208
+ }
209
+ request.headers = headers;
210
+ }
211
+ /** @override **/
212
+ isSessionExpired(response) {
213
+ return (response.statusCode === 500 &&
214
+ /<faultcode>[a-zA-Z]+:INVALID_SESSION_ID<\/faultcode>/.test(response.body));
215
+ }
216
+ /** @override **/
217
+ parseError(body) {
218
+ const error = lookupValue(body, [/:Envelope$/, /:Body$/, /:Fault$/]);
219
+ return {
220
+ errorCode: error.faultcode,
221
+ message: error.faultstring,
222
+ };
223
+ }
224
+ /** @override **/
225
+ async getResponseBody(response) {
226
+ const body = await super.getResponseBody(response);
227
+ return lookupValue(body, [/:Envelope$/, /:Body$/, /.+/]);
228
+ }
229
+ /**
230
+ * @private
231
+ */
232
+ _createEnvelope(message) {
233
+ const header = {};
234
+ const conn = this._conn;
235
+ if (conn.accessToken) {
236
+ header.SessionHeader = { sessionId: conn.accessToken };
237
+ }
238
+ if (conn._callOptions) {
239
+ header.CallOptions = conn._callOptions;
240
+ }
241
+ return [
242
+ '<?xml version="1.0" encoding="UTF-8"?>',
243
+ '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"',
244
+ ' xmlns:xsd="http://www.w3.org/2001/XMLSchema"',
245
+ ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">',
246
+ '<soapenv:Header xmlns="' + this._xmlns + '">',
247
+ toXML(header),
248
+ '</soapenv:Header>',
249
+ '<soapenv:Body xmlns="' + this._xmlns + '">',
250
+ toXML(message),
251
+ '</soapenv:Body>',
252
+ '</soapenv:Envelope>',
253
+ ].join('');
254
+ }
255
+ }
256
+ exports.SOAP = SOAP;
257
+ exports.default = SOAP;
@@ -0,0 +1,258 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ *
4
+ */
5
+ import { Logger } from './util/logger';
6
+ import { Record, DescribeLayoutResult, DescribeCompactLayoutsResult, DescribeApprovalLayoutsResult, Optional, DmlOptions, SaveResult, UpsertResult, RetrieveOptions, Schema, SObjectNames, SObjectRecord, SObjectInputRecord, SObjectUpdateRecord, SObjectFieldNames, FieldProjectionConfig, FieldPathSpecifier, FieldPathScopedProjection } from './types';
7
+ import Connection from './connection';
8
+ import RecordReference from './record-reference';
9
+ import Query, { QueryOptions, QueryField, QueryCondition, QueryConfig } from './query';
10
+ import QuickAction from './quick-action';
11
+ import { CachedFunction } from './cache';
12
+ import { Readable } from 'stream';
13
+ export type FindOptions<S extends Schema, N extends SObjectNames<S>> = Partial<QueryOptions & Pick<QueryConfig<S, N>, 'sort' | 'includes'> & {
14
+ limit: number;
15
+ offset: number;
16
+ }>;
17
+ /**
18
+ * A class for organizing all SObject access
19
+ */
20
+ export declare class SObject<S extends Schema, N extends SObjectNames<S>, FieldNames extends SObjectFieldNames<S, N> = SObjectFieldNames<S, N>, RetrieveRecord extends SObjectRecord<S, N, '*'> = SObjectRecord<S, N, '*'>, InputRecord extends SObjectInputRecord<S, N> = SObjectInputRecord<S, N>, UpdateRecord extends SObjectUpdateRecord<S, N> = SObjectUpdateRecord<S, N>> {
21
+ static _logger: Logger;
22
+ type: N;
23
+ _conn: Connection<S>;
24
+ _logger: Logger;
25
+ layouts$: CachedFunction<(ln?: string) => Promise<DescribeLayoutResult>>;
26
+ layouts$$: CachedFunction<(ln?: string) => DescribeLayoutResult>;
27
+ compactLayouts$: CachedFunction<() => Promise<DescribeCompactLayoutsResult>>;
28
+ compactLayouts$$: CachedFunction<() => DescribeCompactLayoutsResult>;
29
+ approvalLayouts$: CachedFunction<() => Promise<DescribeApprovalLayoutsResult>>;
30
+ approvalLayouts$$: CachedFunction<() => DescribeApprovalLayoutsResult>;
31
+ /**
32
+ *
33
+ */
34
+ constructor(conn: Connection<S>, type: N);
35
+ /**
36
+ * Create records
37
+ */
38
+ create(records: InputRecord[], options?: DmlOptions): Promise<SaveResult[]>;
39
+ create(records: InputRecord, options?: DmlOptions): Promise<SaveResult>;
40
+ create(records: InputRecord | InputRecord[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
41
+ /**
42
+ * Synonym of SObject#create()
43
+ */
44
+ insert: {
45
+ (records: InputRecord[], options?: DmlOptions): Promise<SaveResult[]>;
46
+ (records: InputRecord, options?: DmlOptions): Promise<SaveResult>;
47
+ (records: InputRecord | InputRecord[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
48
+ };
49
+ /**
50
+ * Retrieve specified records
51
+ */
52
+ retrieve(ids: string[], options?: RetrieveOptions): Promise<RetrieveRecord[]>;
53
+ retrieve(ids: string, options?: RetrieveOptions): Promise<RetrieveRecord>;
54
+ retrieve(ids: string | string[], options?: RetrieveOptions): Promise<RetrieveRecord | RetrieveRecord[]>;
55
+ /**
56
+ * Update records
57
+ */
58
+ update(records: UpdateRecord[], options?: DmlOptions): Promise<SaveResult[]>;
59
+ update(records: UpdateRecord, options?: DmlOptions): Promise<SaveResult>;
60
+ update(records: UpdateRecord | UpdateRecord[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
61
+ /**
62
+ * Upsert records
63
+ */
64
+ upsert(records: InputRecord[], extIdField: FieldNames, options?: DmlOptions): Promise<UpsertResult[]>;
65
+ upsert(records: InputRecord, extIdField: FieldNames, options?: DmlOptions): Promise<UpsertResult>;
66
+ upsert(records: InputRecord | InputRecord[], extIdField: FieldNames, options?: DmlOptions): Promise<UpsertResult | UpsertResult[]>;
67
+ /**
68
+ * Delete records
69
+ */
70
+ destroy(ids: string[], options?: DmlOptions): Promise<SaveResult[]>;
71
+ destroy(ids: string, options?: DmlOptions): Promise<SaveResult>;
72
+ destroy(ids: string | string[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
73
+ /**
74
+ * Synonym of SObject#destroy()
75
+ */
76
+ delete: {
77
+ (ids: string[], options?: DmlOptions): Promise<SaveResult[]>;
78
+ (ids: string, options?: DmlOptions): Promise<SaveResult>;
79
+ (ids: string | string[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
80
+ };
81
+ /**
82
+ * Synonym of SObject#destroy()
83
+ */
84
+ del: {
85
+ (ids: string[], options?: DmlOptions): Promise<SaveResult[]>;
86
+ (ids: string, options?: DmlOptions): Promise<SaveResult>;
87
+ (ids: string | string[], options?: DmlOptions): Promise<SaveResult | SaveResult[]>;
88
+ };
89
+ /**
90
+ * Call Bulk#load() to execute bulkload, returning batch object
91
+ */
92
+ bulkload(operation: 'insert' | 'update' | 'upsert' | 'delete' | 'hardDelete', optionsOrInput?: Object | Record[] | Readable | string, input?: Record[] | Readable | string): import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
93
+ /**
94
+ * Bulkly insert input data using bulk API
95
+ */
96
+ createBulk(input?: Record[] | Readable | string): import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
97
+ /**
98
+ * Synonym of SObject#createBulk()
99
+ */
100
+ insertBulk: (input?: Record[] | Readable | string) => import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
101
+ /**
102
+ * Bulkly update records by input data using bulk API
103
+ */
104
+ updateBulk(input?: Record[] | Readable | string): import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
105
+ /**
106
+ * Bulkly upsert records by input data using bulk API
107
+ */
108
+ upsertBulk(input?: Record[] | Readable | string, extIdField?: string): import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
109
+ /**
110
+ * Bulkly delete records specified by input data using bulk API
111
+ */
112
+ destroyBulk(input?: Record[] | Readable | string): import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
113
+ /**
114
+ * Synonym of SObject#destroyBulk()
115
+ */
116
+ deleteBulk: (input?: Record[] | Readable | string) => import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
117
+ /**
118
+ * Bulkly hard delete records specified in input data using bulk API
119
+ */
120
+ destroyHardBulk(input: Record[] | Readable): import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
121
+ /**
122
+ * Synonym of SObject#destroyHardBulk()
123
+ */
124
+ deleteHardBulk: (input: Record[] | Readable) => import("./api/bulk").Batch<S, "insert" | "update" | "upsert" | "delete" | "hardDelete">;
125
+ /**
126
+ * Describe SObject metadata
127
+ */
128
+ describe(): Promise<import("./types").DescribeSObjectResult>;
129
+ /**
130
+ *
131
+ */
132
+ describe$(): Promise<import("./types").DescribeSObjectResult>;
133
+ /**
134
+ *
135
+ */
136
+ describe$$(): import("./types").DescribeSObjectResult;
137
+ /**
138
+ * Get record representation instance by given id
139
+ */
140
+ record(id: string): RecordReference<S, N>;
141
+ /**
142
+ * Retrieve recently accessed records
143
+ */
144
+ recent(): Promise<Record[]>;
145
+ /**
146
+ * Retrieve the updated records
147
+ */
148
+ updated(start: string | Date, end: string | Date): Promise<import("./types").UpdatedResult>;
149
+ /**
150
+ * Retrieve the deleted records
151
+ */
152
+ deleted(start: string | Date, end: string | Date): Promise<import("./types").DeletedResult>;
153
+ /**
154
+ * Describe layout information for SObject
155
+ */
156
+ layouts(layoutName?: string): Promise<DescribeLayoutResult>;
157
+ /**
158
+ * @typedef {Object} CompactLayoutInfo
159
+ * @prop {Array.<Object>} compactLayouts - Array of compact layouts
160
+ * @prop {String} defaultCompactLayoutId - ID of default compact layout
161
+ * @prop {Array.<Object>} recordTypeCompactLayoutMappings - Array of record type mappings
162
+ */
163
+ /**
164
+ * Describe compact layout information defined for SObject
165
+ *
166
+ * @param {Callback.<CompactLayoutInfo>} [callback] - Callback function
167
+ * @returns {Promise.<CompactLayoutInfo>}
168
+ */
169
+ compactLayouts(): Promise<DescribeCompactLayoutsResult>;
170
+ /**
171
+ * Describe compact layout information defined for SObject
172
+ *
173
+ * @param {Callback.<ApprovalLayoutInfo>} [callback] - Callback function
174
+ * @returns {Promise.<ApprovalLayoutInfo>}
175
+ */
176
+ approvalLayouts(): Promise<DescribeApprovalLayoutsResult>;
177
+ /**
178
+ * Find and fetch records which matches given conditions
179
+ */
180
+ find<R extends Record = Record>(conditions?: Optional<QueryCondition<S, N>>): Query<S, N, SObjectRecord<S, N, '*', R>, 'Records'>;
181
+ find<R extends Record = Record, FP extends FieldPathSpecifier<S, N> = FieldPathSpecifier<S, N>, FPC extends FieldProjectionConfig = FieldPathScopedProjection<S, N, FP>>(conditions: Optional<QueryCondition<S, N>>, fields?: Optional<QueryField<S, N, FP>>, options?: FindOptions<S, N>): Query<S, N, SObjectRecord<S, N, FPC, R>, 'Records'>;
182
+ /**
183
+ * Fetch one record which matches given conditions
184
+ */
185
+ findOne<R extends Record = Record>(conditions?: Optional<QueryCondition<S, N>>): Query<S, N, SObjectRecord<S, N, '*', R>, 'SingleRecord'>;
186
+ findOne<R extends Record = Record, FP extends FieldPathSpecifier<S, N> = FieldPathSpecifier<S, N>, FPC extends FieldProjectionConfig = FieldPathScopedProjection<S, N, FP>>(conditions: Optional<QueryCondition<S, N>>, fields?: Optional<QueryField<S, N, FP>>, options?: FindOptions<S, N>): Query<S, N, SObjectRecord<S, N, FPC, R>, 'SingleRecord'>;
187
+ /**
188
+ * Find and fetch records only by specifying fields to fetch.
189
+ */
190
+ select<R extends Record = Record, FP extends FieldPathSpecifier<S, N> = FieldPathSpecifier<S, N>, FPC extends FieldProjectionConfig = FieldPathScopedProjection<S, N, FP>>(fields: QueryField<S, N, FP>): Query<S, N, SObjectRecord<S, N, FPC, R>, 'Records'>;
191
+ /**
192
+ * Count num of records which matches given conditions
193
+ */
194
+ count(conditions?: Optional<QueryCondition<S, N>>): Query<S, N, SObjectRecord<S, N, "*" | FieldPathScopedProjection<S, N, Extract<keyof S["SObjects"][N]["Fields"], string>> | FieldPathScopedProjection<S, N, { [K in Extract<keyof S["SObjects"][N]["ParentReferences"], string>]?: "*" | ("*" | Extract<keyof Extract<S["SObjects"][N]["ParentReferences"][K], import("./types").SObjectDefinition<string>>["Fields"], string> | { [K_1 in Extract<keyof Extract<S["SObjects"][N]["ParentReferences"][K], import("./types").SObjectDefinition<string>>["ParentReferences"], string>]?: "*" | ("*" | Extract<keyof Extract<Extract<S["SObjects"][N]["ParentReferences"][K], import("./types").SObjectDefinition<string>>["ParentReferences"][K_1], import("./types").SObjectDefinition<string>>["Fields"], string> | { [K_2 in Extract<keyof Extract<Extract<S["SObjects"][N]["ParentReferences"][K], import("./types").SObjectDefinition<string>>["ParentReferences"][K_1], import("./types").SObjectDefinition<string>>["ParentReferences"], string>]?: "*" | ("*" | Extract<keyof Extract<Extract<Extract<S["SObjects"][N]["ParentReferences"][K], import("./types").SObjectDefinition<string>>["ParentReferences"][K_1], import("./types").SObjectDefinition<string>>["ParentReferences"][K_2], import("./types").SObjectDefinition<string>>["Fields"], string>[])[] | undefined; })[] | undefined; })[] | undefined; }>, Record, {}>, "Count">;
195
+ /**
196
+ * Returns the list of list views for the SObject
197
+ *
198
+ * @param {Callback.<ListViewsInfo>} [callback] - Callback function
199
+ * @returns {Promise.<ListViewsInfo>}
200
+ */
201
+ listviews(): import("./util/promise").StreamPromise<unknown>;
202
+ /**
203
+ * Returns the list view info in specifed view id
204
+ *
205
+ * @param {String} id - List view ID
206
+ * @returns {ListView}
207
+ */
208
+ listview(id: string): ListView;
209
+ /**
210
+ * Returns all registered quick actions for the SObject
211
+ *
212
+ * @param {Callback.<Array.<QuickAction~QuickActionInfo>>} [callback] - Callback function
213
+ * @returns {Promise.<Array.<QuickAction~QuickActionInfo>>}
214
+ */
215
+ quickActions(): import("./util/promise").StreamPromise<unknown>;
216
+ /**
217
+ * Get reference for specified quick aciton in the SObject
218
+ *
219
+ * @param {String} actionName - Name of the quick action
220
+ * @returns {QuickAction}
221
+ */
222
+ quickAction(actionName: string): QuickAction<S>;
223
+ }
224
+ /**
225
+ * A class for organizing list view information
226
+ *
227
+ * @protected
228
+ * @class ListView
229
+ * @param {Connection} conn - Connection instance
230
+ * @param {SObject} type - SObject type
231
+ * @param {String} id - List view ID
232
+ */
233
+ declare class ListView {
234
+ _conn: Connection;
235
+ type: string;
236
+ id: string;
237
+ /**
238
+ *
239
+ */
240
+ constructor(conn: Connection, type: string, id: string);
241
+ /**
242
+ * Executes query for the list view and returns the resulting data and presentation information.
243
+ */
244
+ results(): import("./util/promise").StreamPromise<unknown>;
245
+ /**
246
+ * Returns detailed information about a list view
247
+ */
248
+ describe(options?: {
249
+ headers?: {
250
+ [name: string]: string;
251
+ };
252
+ }): import("./util/promise").StreamPromise<unknown>;
253
+ /**
254
+ * Explain plan for executing list view
255
+ */
256
+ explain(): import("./util/promise").StreamPromise<any>;
257
+ }
258
+ export default SObject;