@jsforce/jsforce-node 3.10.5 → 3.10.6

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/lib/VERSION.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "3.10.5";
1
+ declare const _default: "3.10.6";
2
2
  export default _default;
package/lib/VERSION.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '3.10.5';
3
+ exports.default = '3.10.6';
@@ -150,7 +150,7 @@ export declare class Analytics<S extends Schema> {
150
150
  /**
151
151
  * Get recent report list
152
152
  */
153
- reports(): import("../util/promise").StreamPromise<ReportInfo[]>;
153
+ reports(): import("../types").StreamPromise<ReportInfo[]>;
154
154
  /**
155
155
  * Get dashboard object of Analytics API
156
156
  */
@@ -158,6 +158,6 @@ export declare class Analytics<S extends Schema> {
158
158
  /**
159
159
  * Get recent dashboard list
160
160
  */
161
- dashboards(): import("../util/promise").StreamPromise<DashboardInfo[]>;
161
+ dashboards(): import("../types").StreamPromise<DashboardInfo[]>;
162
162
  }
163
163
  export default Analytics;
package/lib/api/apex.d.ts CHANGED
@@ -19,26 +19,26 @@ export declare class Apex<S extends Schema> {
19
19
  /**
20
20
  * Call Apex REST service in GET request
21
21
  */
22
- get<R = unknown>(path: string, options?: Object): import("../util/promise").StreamPromise<R>;
22
+ get<R = unknown>(path: string, options?: Object): import("../types").StreamPromise<R>;
23
23
  /**
24
24
  * Call Apex REST service in POST request
25
25
  */
26
- post<R = unknown>(path: string, body?: Object, options?: Object): import("../util/promise").StreamPromise<R>;
26
+ post<R = unknown>(path: string, body?: Object, options?: Object): import("../types").StreamPromise<R>;
27
27
  /**
28
28
  * Call Apex REST service in PUT request
29
29
  */
30
- put<R = unknown>(path: string, body?: Object, options?: Object): import("../util/promise").StreamPromise<R>;
30
+ put<R = unknown>(path: string, body?: Object, options?: Object): import("../types").StreamPromise<R>;
31
31
  /**
32
32
  * Call Apex REST service in PATCH request
33
33
  */
34
- patch<R = unknown>(path: string, body?: Object, options?: Object): import("../util/promise").StreamPromise<R>;
34
+ patch<R = unknown>(path: string, body?: Object, options?: Object): import("../types").StreamPromise<R>;
35
35
  /**
36
36
  * Call Apex REST service in DELETE request
37
37
  */
38
- delete<R = unknown>(path: string, options?: Object): import("../util/promise").StreamPromise<R>;
38
+ delete<R = unknown>(path: string, options?: Object): import("../types").StreamPromise<R>;
39
39
  /**
40
40
  * Synonym of Apex#delete()
41
41
  */
42
- del: <R = unknown>(path: string, options?: Object) => import("../util/promise").StreamPromise<R>;
42
+ del: <R = unknown>(path: string, options?: Object) => import("../types").StreamPromise<R>;
43
43
  }
44
44
  export default Apex;
package/lib/api/bulk.d.ts CHANGED
@@ -220,7 +220,7 @@ export declare class Bulk<S extends Schema> {
220
220
  /**
221
221
  *
222
222
  */
223
- _request<T>(request_: BulkRequest): import("../util/promise").StreamPromise<T>;
223
+ _request<T>(request_: BulkRequest): import("../types").StreamPromise<T>;
224
224
  /**
225
225
  * Create and start bulkload job and batch
226
226
  *
@@ -109,7 +109,7 @@ export declare class Chatter<S extends Schema> {
109
109
  * Sending request to API endpoint
110
110
  * @private
111
111
  */
112
- _request<R>(req_: ChatterRequestParams): import("../util/promise").StreamPromise<R>;
112
+ _request<R>(req_: ChatterRequestParams): import("../types").StreamPromise<R>;
113
113
  /**
114
114
  * Convert path to site root relative url
115
115
  * @private
@@ -263,22 +263,22 @@ export declare class Tooling<S extends Schema> {
263
263
  /**
264
264
  *
265
265
  */
266
- request<R = unknown>(request: string | HttpRequest, options?: Object): import("../util/promise").StreamPromise<R>;
266
+ request<R = unknown>(request: string | HttpRequest, options?: Object): import("../types").StreamPromise<R>;
267
267
  /**
268
268
  * Executes Apex code anonymously
269
269
  */
270
- executeAnonymous(body: string): import("../util/promise").StreamPromise<ExecuteAnonymousResult>;
270
+ executeAnonymous(body: string): import("../types").StreamPromise<ExecuteAnonymousResult>;
271
271
  /**
272
272
  * Executes Apex tests asynchronously
273
273
  */
274
- runTestsAsynchronous(req: RunTestsAsyncRequest): import("../util/promise").StreamPromise<string | null>;
274
+ runTestsAsynchronous(req: RunTestsAsyncRequest): import("../types").StreamPromise<string | null>;
275
275
  /**
276
276
  * Executes Apex tests synchronously
277
277
  */
278
- runTestsSynchronous(req: RunTestsRequest): import("../util/promise").StreamPromise<RunTestsResult | null>;
278
+ runTestsSynchronous(req: RunTestsRequest): import("../types").StreamPromise<RunTestsResult | null>;
279
279
  /**
280
280
  * Retrieves available code completions of the referenced type
281
281
  */
282
- completions(type?: 'apex' | 'visualforce'): import("../util/promise").StreamPromise<CompletionsResult>;
282
+ completions(type?: 'apex' | 'visualforce'): import("../types").StreamPromise<CompletionsResult>;
283
283
  }
284
284
  export default Tooling;
package/lib/index.d.ts CHANGED
@@ -10,4 +10,5 @@ import './api/streaming';
10
10
  import './api/tooling';
11
11
  export * from './types';
12
12
  export * from './core';
13
+ export * from './util/promise';
13
14
  export default jsforce;
package/lib/index.js CHANGED
@@ -29,4 +29,5 @@ require("./api/streaming");
29
29
  require("./api/tooling");
30
30
  __exportStar(require("./types"), exports);
31
31
  __exportStar(require("./core"), exports);
32
+ __exportStar(require("./util/promise"), exports);
32
33
  exports.default = jsforce_1.default;
package/lib/process.d.ts CHANGED
@@ -39,7 +39,7 @@ export declare class ProcessRule<S extends Schema> {
39
39
  /**
40
40
  * Trigger process rule for given entities
41
41
  */
42
- trigger(contextIds: string | string[]): import("./util/promise").StreamPromise<{
42
+ trigger(contextIds: string | string[]): import("./types").StreamPromise<{
43
43
  errors: null;
44
44
  success: true;
45
45
  } | {
@@ -98,7 +98,7 @@ export declare class ApprovalProcess<S extends Schema> {
98
98
  /**
99
99
  * Send bulk requests for approval process
100
100
  */
101
- request(requests: Array<ApprovalProcessRequestConfig | ApprovalProcessRequest<S>>): import("./util/promise").StreamPromise<ApprovalProcessRequestResult[]>;
101
+ request(requests: Array<ApprovalProcessRequestConfig | ApprovalProcessRequest<S>>): import("./types").StreamPromise<ApprovalProcessRequestResult[]>;
102
102
  /**
103
103
  * Create approval process request
104
104
  *
package/lib/query.d.ts CHANGED
@@ -288,6 +288,11 @@ export declare class Query<S extends Schema, N extends SObjectNames<S>, R extend
288
288
  update<UR extends SObjectInputRecord<S, N>>(mapping: ((rec: R) => UR) | UR, type: N, options?: QueryUpdateOptions): Promise<SaveResult[]>;
289
289
  update<UR extends SObjectInputRecord<S, N>>(mapping: ((rec: R) => UR) | UR, options?: QueryUpdateOptions): Promise<SaveResult[]>;
290
290
  private mapBulkV2ResultsToSaveResults;
291
+ /**
292
+ * Fetches all records for a subquery field by following nextRecordsUrl
293
+ * @private
294
+ */
295
+ private _fetchAllSubqueryRecords;
291
296
  }
292
297
  /**
293
298
  * SubQuery object for representing child relationship query
package/lib/query.js CHANGED
@@ -373,6 +373,23 @@ class Query extends events_1.EventEmitter {
373
373
  const data = await this._conn.request({ method: 'GET', url, headers });
374
374
  this.emit('fetch');
375
375
  this.totalSize = data.totalSize;
376
+ // If autoFetch is true, fetch all records for any subqueries
377
+ if (autoFetch && data.records.length > 0) {
378
+ const recordKeys = Object.keys(data.records[0]);
379
+ for (const record of data.records) {
380
+ for (const key of recordKeys) {
381
+ const field = record[key];
382
+ if (field && typeof field === 'object' && 'records' in field && 'nextRecordsUrl' in field) {
383
+ record[key] = {
384
+ ...field,
385
+ records: await this._fetchAllSubqueryRecords(record, key, headers),
386
+ done: true,
387
+ nextRecordsUrl: undefined
388
+ };
389
+ }
390
+ }
391
+ }
392
+ }
376
393
  this.records = this.records?.concat(maxFetch - this.records.length > data.records.length
377
394
  ? data.records
378
395
  : data.records.slice(0, maxFetch - this.records.length));
@@ -741,6 +758,30 @@ class Query extends events_1.EventEmitter {
741
758
  });
742
759
  return [...successSaveResults, ...failedSaveResults];
743
760
  }
761
+ /**
762
+ * Fetches all records for a subquery field by following nextRecordsUrl
763
+ * @private
764
+ */
765
+ async _fetchAllSubqueryRecords(record, fieldName, headers) {
766
+ const subqueryField = record[fieldName];
767
+ if (!subqueryField || !subqueryField.records) {
768
+ return [];
769
+ }
770
+ let allRecords = [...subqueryField.records];
771
+ let nextRecordsUrl = subqueryField.nextRecordsUrl;
772
+ while (nextRecordsUrl) {
773
+ // When following nextRecordsUrl for a subquery, we need to preserve the relationship context
774
+ // by using the full URL as-is rather than trying to reconstruct it
775
+ const data = await this._conn.request({
776
+ method: 'GET',
777
+ url: nextRecordsUrl,
778
+ headers
779
+ });
780
+ allRecords = allRecords.concat(data.records);
781
+ nextRecordsUrl = data.nextRecordsUrl;
782
+ }
783
+ return allRecords;
784
+ }
744
785
  }
745
786
  exports.Query = Query;
746
787
  /*--------------------------------------------*/
package/lib/sobject.d.ts CHANGED
@@ -198,7 +198,7 @@ export declare class SObject<S extends Schema, N extends SObjectNames<S>, FieldN
198
198
  * @param {Callback.<ListViewsInfo>} [callback] - Callback function
199
199
  * @returns {Promise.<ListViewsInfo>}
200
200
  */
201
- listviews(): import("./util/promise").StreamPromise<unknown>;
201
+ listviews(): import("./types").StreamPromise<unknown>;
202
202
  /**
203
203
  * Returns the list view info in specifed view id
204
204
  *
@@ -212,7 +212,7 @@ export declare class SObject<S extends Schema, N extends SObjectNames<S>, FieldN
212
212
  * @param {Callback.<Array.<QuickAction~QuickActionInfo>>} [callback] - Callback function
213
213
  * @returns {Promise.<Array.<QuickAction~QuickActionInfo>>}
214
214
  */
215
- quickActions(): import("./util/promise").StreamPromise<unknown>;
215
+ quickActions(): import("./types").StreamPromise<unknown>;
216
216
  /**
217
217
  * Get reference for specified quick aciton in the SObject
218
218
  *
@@ -241,7 +241,7 @@ declare class ListView {
241
241
  /**
242
242
  * Executes query for the list view and returns the resulting data and presentation information.
243
243
  */
244
- results(): import("./util/promise").StreamPromise<unknown>;
244
+ results(): import("./types").StreamPromise<unknown>;
245
245
  /**
246
246
  * Returns detailed information about a list view
247
247
  */
@@ -249,10 +249,10 @@ declare class ListView {
249
249
  headers?: {
250
250
  [name: string]: string;
251
251
  };
252
- }): import("./util/promise").StreamPromise<unknown>;
252
+ }): import("./types").StreamPromise<unknown>;
253
253
  /**
254
254
  * Explain plan for executing list view
255
255
  */
256
- explain(): import("./util/promise").StreamPromise<any>;
256
+ explain(): import("./types").StreamPromise<any>;
257
257
  }
258
258
  export default SObject;
@@ -5,3 +5,4 @@ export * from './record';
5
5
  export * from './util';
6
6
  export * from './soap';
7
7
  export * from './standard-schema';
8
+ export * from '../util/promise';
@@ -21,3 +21,4 @@ __exportStar(require("./record"), exports);
21
21
  __exportStar(require("./util"), exports);
22
22
  __exportStar(require("./soap"), exports);
23
23
  __exportStar(require("./standard-schema"), exports);
24
+ __exportStar(require("../util/promise"), exports);
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "database.com"
11
11
  ],
12
12
  "homepage": "http://github.com/jsforce/jsforce",
13
- "version": "3.10.5",
13
+ "version": "3.10.6",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git://github.com/jsforce/jsforce.git"
@@ -243,6 +243,7 @@
243
243
  "karma-sourcemap-loader": "^0.4.0",
244
244
  "karma-webpack": "^5.0.0",
245
245
  "nock": "^13.4.0",
246
+ "os-browserify": "^0.3.0",
246
247
  "path-browserify": "^1.0.1",
247
248
  "power-assert": "^1.6.1",
248
249
  "prettier": "^2.2.1",