@salesforce/core 4.0.0-v3.0 → 4.0.0

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 (125) hide show
  1. package/CHANGELOG.md +569 -24
  2. package/LICENSE.txt +1 -1
  3. package/lib/config/config.d.ts +110 -42
  4. package/lib/config/config.js +309 -138
  5. package/lib/config/configAggregator.d.ts +22 -11
  6. package/lib/config/configAggregator.js +50 -26
  7. package/lib/config/configFile.js +10 -10
  8. package/lib/config/configStore.js +15 -14
  9. package/lib/config/envVars.d.ts +96 -0
  10. package/lib/config/envVars.js +433 -0
  11. package/lib/config/keychainConfig.js +1 -1
  12. package/lib/config/orgUsersConfig.d.ts +8 -0
  13. package/lib/config/orgUsersConfig.js +10 -0
  14. package/lib/config/sandboxOrgConfig.d.ts +8 -0
  15. package/lib/config/sandboxOrgConfig.js +10 -0
  16. package/lib/crypto/crypto.js +28 -8
  17. package/lib/crypto/keyChain.js +2 -1
  18. package/lib/crypto/keyChainImpl.js +8 -6
  19. package/lib/crypto/secureBuffer.js +1 -1
  20. package/lib/deviceOauthService.d.ts +3 -3
  21. package/lib/deviceOauthService.js +22 -20
  22. package/lib/exported.d.ts +13 -9
  23. package/lib/exported.js +25 -13
  24. package/lib/global.d.ts +6 -0
  25. package/lib/global.js +7 -1
  26. package/lib/globalInfo/accessors/aliasAccessor.d.ts +83 -0
  27. package/lib/globalInfo/accessors/aliasAccessor.js +130 -0
  28. package/lib/globalInfo/accessors/orgAccessor.d.ts +13 -0
  29. package/lib/globalInfo/accessors/orgAccessor.js +45 -0
  30. package/lib/globalInfo/accessors/tokenAccessor.d.ts +13 -0
  31. package/lib/globalInfo/accessors/tokenAccessor.js +35 -0
  32. package/lib/globalInfo/globalInfoConfig.d.ts +36 -0
  33. package/lib/globalInfo/globalInfoConfig.js +105 -0
  34. package/lib/globalInfo/index.d.ts +6 -0
  35. package/lib/globalInfo/index.js +29 -0
  36. package/lib/{config → globalInfo}/sfdxDataHandler.d.ts +10 -3
  37. package/lib/{config → globalInfo}/sfdxDataHandler.js +71 -19
  38. package/lib/globalInfo/types.d.ts +39 -0
  39. package/lib/globalInfo/types.js +10 -0
  40. package/lib/lifecycleEvents.d.ts +38 -1
  41. package/lib/lifecycleEvents.js +74 -3
  42. package/lib/logger.d.ts +2 -2
  43. package/lib/logger.js +16 -26
  44. package/lib/messages.js +12 -10
  45. package/lib/org/authInfo.d.ts +41 -65
  46. package/lib/org/authInfo.js +138 -233
  47. package/lib/org/authRemover.d.ts +11 -19
  48. package/lib/org/authRemover.js +47 -49
  49. package/lib/org/connection.d.ts +24 -26
  50. package/lib/org/connection.js +77 -92
  51. package/lib/org/index.js +1 -1
  52. package/lib/org/org.d.ts +134 -12
  53. package/lib/org/org.js +436 -97
  54. package/lib/org/orgConfigProperties.d.ts +8 -0
  55. package/lib/org/orgConfigProperties.js +29 -0
  56. package/lib/org/permissionSetAssignment.js +3 -3
  57. package/lib/org/scratchOrgCreate.d.ts +43 -0
  58. package/lib/org/scratchOrgCreate.js +142 -0
  59. package/lib/org/scratchOrgErrorCodes.d.ts +4 -0
  60. package/lib/org/scratchOrgErrorCodes.js +62 -0
  61. package/lib/org/scratchOrgFeatureDeprecation.d.ts +26 -0
  62. package/lib/org/scratchOrgFeatureDeprecation.js +110 -0
  63. package/lib/org/scratchOrgInfoApi.d.ts +94 -0
  64. package/lib/org/scratchOrgInfoApi.js +350 -0
  65. package/lib/org/scratchOrgInfoGenerator.d.ts +63 -0
  66. package/lib/org/scratchOrgInfoGenerator.js +223 -0
  67. package/lib/org/scratchOrgSettingsGenerator.d.ts +56 -0
  68. package/lib/org/scratchOrgSettingsGenerator.js +210 -0
  69. package/lib/org/user.d.ts +6 -1
  70. package/lib/org/user.js +69 -36
  71. package/lib/schema/printer.js +18 -18
  72. package/lib/schema/validator.js +8 -8
  73. package/lib/sfdxError.d.ts +6 -1
  74. package/lib/sfdxError.js +10 -2
  75. package/lib/sfdxProject.js +33 -22
  76. package/lib/status/myDomainResolver.js +6 -6
  77. package/lib/status/pollingClient.d.ts +2 -6
  78. package/lib/status/pollingClient.js +37 -63
  79. package/lib/status/streamingClient.d.ts +5 -80
  80. package/lib/status/streamingClient.js +18 -33
  81. package/lib/status/types.d.ts +89 -0
  82. package/lib/status/types.js +18 -0
  83. package/lib/testSetup.d.ts +7 -5
  84. package/lib/testSetup.js +38 -40
  85. package/lib/util/cache.d.ts +11 -0
  86. package/lib/util/cache.js +70 -0
  87. package/lib/util/checkLightningDomain.d.ts +1 -0
  88. package/lib/util/checkLightningDomain.js +30 -0
  89. package/lib/util/fs.d.ts +3 -0
  90. package/lib/util/fs.js +16 -12
  91. package/lib/util/getJwtAudienceUrl.d.ts +4 -0
  92. package/lib/util/getJwtAudienceUrl.js +19 -0
  93. package/lib/util/jsonXmlTools.d.ts +14 -0
  94. package/lib/util/jsonXmlTools.js +41 -0
  95. package/lib/util/mapKeys.d.ts +14 -0
  96. package/lib/util/mapKeys.js +48 -0
  97. package/lib/util/sfdc.d.ts +1 -13
  98. package/lib/util/sfdc.js +5 -52
  99. package/lib/util/sfdcUrl.d.ts +78 -0
  100. package/lib/util/sfdcUrl.js +206 -0
  101. package/lib/util/zipWriter.d.ts +14 -0
  102. package/lib/util/zipWriter.js +68 -0
  103. package/lib/webOAuthServer.d.ts +2 -3
  104. package/lib/webOAuthServer.js +11 -10
  105. package/messages/auth.md +2 -2
  106. package/messages/config.md +58 -6
  107. package/messages/core.json +3 -3
  108. package/messages/core.md +1 -1
  109. package/messages/envVars.md +279 -0
  110. package/messages/org.md +44 -0
  111. package/messages/scratchOrgCreate.md +27 -0
  112. package/messages/scratchOrgErrorCodes.md +99 -0
  113. package/messages/scratchOrgFeatureDeprecation.md +11 -0
  114. package/messages/scratchOrgInfoApi.md +11 -0
  115. package/messages/scratchOrgInfoGenerator.md +19 -0
  116. package/messages/user.md +12 -0
  117. package/package.json +50 -53
  118. package/lib/config/aliases.d.ts +0 -56
  119. package/lib/config/aliases.js +0 -96
  120. package/lib/config/configGroup.d.ts +0 -141
  121. package/lib/config/configGroup.js +0 -223
  122. package/lib/config/globalInfoConfig.d.ts +0 -74
  123. package/lib/config/globalInfoConfig.js +0 -144
  124. package/lib/status/client.d.ts +0 -15
  125. package/lib/status/client.js +0 -9
@@ -1,7 +1,7 @@
1
1
  import { AsyncOptionalCreatable } from '@salesforce/kit';
2
- import { SfOrg, SfOrgs } from '../config/globalInfoConfig';
2
+ import { SfOrg, SfOrgs } from '../globalInfo';
3
3
  /**
4
- * Handles the removing of authorizations, which includes deleting the auth file
4
+ * Handles the removing of authorizations, which includes deleting the auth file
5
5
  * in the global .sfdx folder, deleting any configs that are associated with the username/alias,
6
6
  * and deleting any aliases associated with the username
7
7
  *
@@ -24,11 +24,9 @@ import { SfOrg, SfOrgs } from '../config/globalInfoConfig';
24
24
  * ```
25
25
  */
26
26
  export declare class AuthRemover extends AsyncOptionalCreatable {
27
- private globalConfig;
28
- private localConfig;
27
+ private config;
29
28
  private globalInfo;
30
29
  private logger;
31
- private aliases;
32
30
  /**
33
31
  * Removes the authentication and any configs or aliases associated with it
34
32
  *
@@ -41,17 +39,17 @@ export declare class AuthRemover extends AsyncOptionalCreatable {
41
39
  removeAllAuths(): Promise<void>;
42
40
  /**
43
41
  * Finds authorization files for username/alias in the global .sfdx folder
44
- * **Throws** *{@link SfdxError}{ name: 'DefaultUsernameNotSetError' }* if no defaultusername
42
+ * **Throws** *{@link SfdxError}{ name: 'TargetOrgNotSetError' }* if no target-org
45
43
  * **Throws** *{@link SfdxError}{ name: 'NamedOrgNotFoundError' }* if specified user is not found
46
44
  *
47
- * @param usernameOrAlias username or alias of the auth you want to find, defaults to the configured defaultusername
48
- * @returns {Promise<Authorization>}
45
+ * @param usernameOrAlias username or alias of the auth you want to find, defaults to the configured target-org
46
+ * @returns {Promise<SfOrg>}
49
47
  */
50
48
  findAuth(usernameOrAlias?: string): Promise<SfOrg>;
51
49
  /**
52
- * Finds all authorization files in the global .sfdx folder
50
+ * Finds all org authorizations in the global info file (.sf/sf.json)
53
51
  *
54
- * @returns {Promise<SfOrgs>}
52
+ * @returns {SfOrgs}
55
53
  */
56
54
  findAllAuths(): SfOrgs;
57
55
  protected init(): Promise<void>;
@@ -63,16 +61,9 @@ export declare class AuthRemover extends AsyncOptionalCreatable {
63
61
  */
64
62
  private resolveUsername;
65
63
  /**
66
- * Instantiates config class
67
- *
68
- * @param isGlobal
69
- * @returns {Promise<Nullable<Config>>}
70
- */
71
- private getConfig;
72
- /**
73
- * @returns {Promise<string>}
64
+ * @returns {string}
74
65
  */
75
- private getDefaultUsername;
66
+ private getTargetOrg;
76
67
  /**
77
68
  * Returns aliases for provided username
78
69
  *
@@ -92,4 +83,5 @@ export declare class AuthRemover extends AsyncOptionalCreatable {
92
83
  * @param username username that you want to remove from aliases
93
84
  */
94
85
  private unsetAliases;
86
+ private unsetTokens;
95
87
  }
@@ -8,17 +8,16 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.AuthRemover = void 0;
10
10
  const kit_1 = require("@salesforce/kit");
11
- const aliases_1 = require("../config/aliases");
12
- const config_1 = require("../config/config");
13
11
  const configAggregator_1 = require("../config/configAggregator");
14
12
  const logger_1 = require("../logger");
15
13
  const messages_1 = require("../messages");
16
- const globalInfoConfig_1 = require("../config/globalInfoConfig");
14
+ const globalInfo_1 = require("../globalInfo");
15
+ const orgConfigProperties_1 = require("./orgConfigProperties");
17
16
  messages_1.Messages.importMessagesDirectory(__dirname);
18
17
  const coreMessages = messages_1.Messages.load('@salesforce/core', 'core', ['namedOrgNotFound']);
19
- const messages = messages_1.Messages.load('@salesforce/core', 'auth', ['defaultUsernameNotSet']);
18
+ const messages = messages_1.Messages.load('@salesforce/core', 'auth', ['targetOrgNotSet']);
20
19
  /**
21
- * Handles the removing of authorizations, which includes deleting the auth file
20
+ * Handles the removing of authorizations, which includes deleting the auth file
22
21
  * in the global .sfdx folder, deleting any configs that are associated with the username/alias,
23
22
  * and deleting any aliases associated with the username
24
23
  *
@@ -51,7 +50,8 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
51
50
  this.logger.debug(`Removing authorization for user ${username}`);
52
51
  await this.unsetConfigValues(username);
53
52
  await this.unsetAliases(username);
54
- this.globalInfo.unsetOrg(username);
53
+ this.unsetTokens(username);
54
+ this.globalInfo.orgs.unset(username);
55
55
  await this.globalInfo.write();
56
56
  }
57
57
  /**
@@ -66,34 +66,32 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
66
66
  }
67
67
  /**
68
68
  * Finds authorization files for username/alias in the global .sfdx folder
69
- * **Throws** *{@link SfdxError}{ name: 'DefaultUsernameNotSetError' }* if no defaultusername
69
+ * **Throws** *{@link SfdxError}{ name: 'TargetOrgNotSetError' }* if no target-org
70
70
  * **Throws** *{@link SfdxError}{ name: 'NamedOrgNotFoundError' }* if specified user is not found
71
71
  *
72
- * @param usernameOrAlias username or alias of the auth you want to find, defaults to the configured defaultusername
73
- * @returns {Promise<Authorization>}
72
+ * @param usernameOrAlias username or alias of the auth you want to find, defaults to the configured target-org
73
+ * @returns {Promise<SfOrg>}
74
74
  */
75
75
  async findAuth(usernameOrAlias) {
76
- const username = usernameOrAlias ? await this.resolveUsername(usernameOrAlias) : await this.getDefaultUsername();
77
- const auth = this.globalInfo.getOrg(username);
76
+ const username = usernameOrAlias ? await this.resolveUsername(usernameOrAlias) : this.getTargetOrg();
77
+ const auth = this.globalInfo.orgs.get(username);
78
78
  if (!auth) {
79
79
  throw coreMessages.createError('namedOrgNotFound');
80
80
  }
81
81
  return auth;
82
82
  }
83
83
  /**
84
- * Finds all authorization files in the global .sfdx folder
84
+ * Finds all org authorizations in the global info file (.sf/sf.json)
85
85
  *
86
- * @returns {Promise<SfOrgs>}
86
+ * @returns {SfOrgs}
87
87
  */
88
88
  findAllAuths() {
89
- return this.globalInfo.getOrgs();
89
+ return this.globalInfo.orgs.getAll();
90
90
  }
91
91
  async init() {
92
92
  this.logger = await logger_1.Logger.child(this.constructor.name);
93
- this.globalConfig = await this.getConfig(true);
94
- this.localConfig = await this.getConfig(false);
95
- this.globalInfo = await globalInfoConfig_1.GlobalInfo.getInstance();
96
- this.aliases = await aliases_1.Aliases.create(aliases_1.Aliases.getDefaultOptions());
93
+ this.config = await configAggregator_1.ConfigAggregator.create();
94
+ this.globalInfo = await globalInfo_1.GlobalInfo.getInstance();
97
95
  }
98
96
  /**
99
97
  * Returns the username for a given alias if the alias exists.
@@ -102,35 +100,17 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
102
100
  * @returns {Promise<string>}
103
101
  */
104
102
  async resolveUsername(usernameOrAlias) {
105
- const aliasedValue = this.aliases.get(usernameOrAlias);
106
- return (aliasedValue || usernameOrAlias);
103
+ return this.globalInfo.aliases.resolveUsername(usernameOrAlias);
107
104
  }
108
105
  /**
109
- * Instantiates config class
110
- *
111
- * @param isGlobal
112
- * @returns {Promise<Nullable<Config>>}
113
- */
114
- async getConfig(isGlobal) {
115
- let config;
116
- try {
117
- config = await config_1.Config.create({ isGlobal });
118
- }
119
- catch (_a) {
120
- config = null;
121
- }
122
- return config;
123
- }
124
- /**
125
- * @returns {Promise<string>}
106
+ * @returns {string}
126
107
  */
127
- async getDefaultUsername() {
128
- const configAggregator = await configAggregator_1.ConfigAggregator.create();
129
- const defaultUsername = configAggregator.getInfo(config_1.Config.DEFAULT_USERNAME).value;
130
- if (!defaultUsername) {
131
- throw messages.createError('defaultUsernameNotSet');
108
+ getTargetOrg() {
109
+ const targetOrg = this.config.getInfo(orgConfigProperties_1.OrgConfigProperties.TARGET_ORG).value;
110
+ if (!targetOrg) {
111
+ throw messages.createError('targetOrgNotSet');
132
112
  }
133
- return defaultUsername;
113
+ return targetOrg;
134
114
  }
135
115
  /**
136
116
  * Returns aliases for provided username
@@ -139,7 +119,7 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
139
119
  * @returns {Promise<string[]>}
140
120
  */
141
121
  getAliases(username) {
142
- return this.aliases.getKeysByValue(username) || [];
122
+ return this.globalInfo.aliases.getAll(username);
143
123
  }
144
124
  /**
145
125
  * Unsets any configured values (both global and local) for provided username
@@ -149,7 +129,8 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
149
129
  async unsetConfigValues(username) {
150
130
  const aliases = this.getAliases(username);
151
131
  this.logger.debug(`Clearing config keys for username ${username} and aliases: ${aliases}`);
152
- for (const config of [this.globalConfig, this.localConfig]) {
132
+ const configs = [this.config.getGlobalConfig(), this.config.getLocalConfig()];
133
+ for (const config of configs) {
153
134
  if (config) {
154
135
  const keysWithUsername = config.getKeysByValue(username) || [];
155
136
  const keysWithAlias = aliases
@@ -158,7 +139,14 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
158
139
  .reduce((x, y) => x.concat(y), []);
159
140
  const allKeys = keysWithUsername.concat(keysWithAlias);
160
141
  this.logger.debug(`Found these config keys to remove: ${allKeys}`);
161
- allKeys.forEach((key) => config.unset(key));
142
+ allKeys.forEach((key) => {
143
+ try {
144
+ config.unset(key);
145
+ }
146
+ catch {
147
+ this.logger.debug(`Failed to remove ${key}`);
148
+ }
149
+ });
162
150
  await config.write();
163
151
  }
164
152
  }
@@ -170,10 +158,20 @@ class AuthRemover extends kit_1.AsyncOptionalCreatable {
170
158
  */
171
159
  async unsetAliases(username) {
172
160
  this.logger.debug(`Clearing aliases for username: ${username}`);
173
- const existingAliases = this.aliases.getKeysByValue(username);
161
+ const existingAliases = this.globalInfo.aliases.getAll(username);
162
+ if (existingAliases.length === 0)
163
+ return;
174
164
  this.logger.debug(`Found these aliases to remove: ${existingAliases}`);
175
- existingAliases.forEach((alias) => this.aliases.unset(alias));
176
- await this.aliases.write();
165
+ existingAliases.forEach((alias) => this.globalInfo.aliases.unset(alias));
166
+ }
167
+ unsetTokens(username) {
168
+ this.logger.debug(`Clearing tokens for username: ${username}`);
169
+ const tokens = this.globalInfo.tokens.getAll();
170
+ for (const [key, token] of Object.entries(tokens)) {
171
+ if (token.user === username) {
172
+ this.globalInfo.tokens.unset(key);
173
+ }
174
+ }
177
175
  }
178
176
  }
179
177
  exports.AuthRemover = AuthRemover;
@@ -1,10 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { AsyncResult, DeployOptions, DeployResultLocator } from 'jsforce/api/metadata';
3
- import { Callback } from 'jsforce/connection';
4
3
  import { JsonCollection, JsonMap, Optional } from '@salesforce/ts-types';
5
- import { Connection as JSForceConnection, ConnectionOptions, ExecuteOptions, QueryResult, RequestInfo, Tooling as JSForceTooling } from 'jsforce';
6
- import { AuthFields, AuthInfo } from '../org/authInfo';
4
+ import { Connection as JSForceConnection, ConnectionConfig, HttpRequest, QueryOptions, QueryResult, Record, Schema } from 'jsforce';
5
+ import { Tooling as JSForceTooling } from 'jsforce/lib/api/tooling';
6
+ import { StreamPromise } from 'jsforce/lib/util/promise';
7
7
  import { ConfigAggregator } from '../config/configAggregator';
8
+ import { AuthFields, AuthInfo } from './authInfo';
8
9
  export declare const SFDX_HTTP_HEADERS: {
9
10
  'content-type': string;
10
11
  'user-agent': string;
@@ -14,10 +15,11 @@ declare type recentValidationOptions = {
14
15
  id: string;
15
16
  rest?: boolean;
16
17
  };
17
- export declare type DeployOptionsWithRest = DeployOptions & {
18
+ export declare type DeployOptionsWithRest = Partial<DeployOptions> & {
18
19
  rest?: boolean;
19
20
  };
20
- export interface Tooling extends JSForceTooling {
21
+ export interface Tooling<S extends Schema = Schema> extends JSForceTooling<S> {
22
+ _logger: any;
21
23
  /**
22
24
  * Executes a query and auto-fetches (i.e., "queryMore") all results. This is especially
23
25
  * useful with large query result sizes, such as over 2000 records. The default maximum
@@ -26,7 +28,7 @@ export interface Tooling extends JSForceTooling {
26
28
  * @param soql The SOQL string.
27
29
  * @param options The query options. NOTE: the autoFetch option will always be true.
28
30
  */
29
- autoFetchQuery<T>(soql: string, options?: ExecuteOptions): Promise<QueryResult<T>>;
31
+ autoFetchQuery<T extends Schema = S>(soql: string, options?: QueryOptions): Promise<QueryResult<T>>;
30
32
  }
31
33
  /**
32
34
  * Handles connections and requests to Salesforce Orgs.
@@ -43,14 +45,12 @@ export interface Tooling extends JSForceTooling {
43
45
  * connection.query('SELECT Name from Account');
44
46
  * ```
45
47
  */
46
- export declare class Connection extends JSForceConnection {
48
+ export declare class Connection<S extends Schema = Schema> extends JSForceConnection<S> {
47
49
  /**
48
50
  * Tooling api reference.
49
51
  */
50
- tooling: Tooling;
52
+ get tooling(): Tooling<S>;
51
53
  private logger;
52
- private _transport;
53
- private _normalizeUrl;
54
54
  private options;
55
55
  private username;
56
56
  /**
@@ -60,13 +60,13 @@ export declare class Connection extends JSForceConnection {
60
60
  * @param options The options for the class instance.
61
61
  * @ignore
62
62
  */
63
- constructor(options: Connection.Options);
63
+ constructor(options: Connection.Options<S>);
64
64
  /**
65
65
  * Creates an instance of a Connection. Performs additional async initializations.
66
66
  *
67
67
  * @param options Constructor options.
68
68
  */
69
- static create(this: new (options: Connection.Options) => Connection, options: Connection.Options): Promise<Connection>;
69
+ static create<S extends Schema>(this: new (options: Connection.Options<S>) => Connection<S>, options: Connection.Options<S>): Promise<Connection<S>>;
70
70
  /**
71
71
  * Async initializer.
72
72
  */
@@ -81,7 +81,7 @@ export declare class Connection extends JSForceConnection {
81
81
  * @param options JSForce deploy options + a boolean for rest
82
82
  * @param callback
83
83
  */
84
- deploy(zipInput: Buffer, options: DeployOptionsWithRest, callback?: Callback<AsyncResult>): Promise<DeployResultLocator<AsyncResult>>;
84
+ deploy(zipInput: Buffer, options: DeployOptionsWithRest): Promise<DeployResultLocator<AsyncResult & Schema>>;
85
85
  /**
86
86
  * Send REST API request with given HTTP request info, with connected session information
87
87
  * and SFDX headers.
@@ -89,14 +89,7 @@ export declare class Connection extends JSForceConnection {
89
89
  * @param request HTTP request object or URL to GET request.
90
90
  * @param options HTTP API request options.
91
91
  */
92
- request(request: RequestInfo | string, options?: JsonMap): Promise<JsonCollection>;
93
- /**
94
- * Send REST API request with given HTTP request info, with connected session information
95
- * and SFDX headers. This method returns a raw http response which includes a response body and statusCode.
96
- *
97
- * @param request HTTP request object or URL to GET request.
98
- */
99
- requestRaw(request: RequestInfo): Promise<JsonMap>;
92
+ request<R = unknown>(request: string | HttpRequest, options?: JsonMap): StreamPromise<R>;
100
93
  /**
101
94
  * The Force API base url for the instance.
102
95
  */
@@ -167,9 +160,9 @@ export declare class Connection extends JSForceConnection {
167
160
  * fetch size is 10,000 records. Modify this via the options argument.
168
161
  *
169
162
  * @param soql The SOQL string.
170
- * @param executeOptions The query options. NOTE: the autoFetch option will always be true.
163
+ * @param queryOptions The query options. NOTE: the autoFetch option will always be true.
171
164
  */
172
- autoFetchQuery<T>(soql: string, executeOptions?: ExecuteOptions): Promise<QueryResult<T>>;
165
+ autoFetchQuery<T extends Schema = S>(soql: string, queryOptions?: Partial<QueryOptions>): Promise<QueryResult<T>>;
173
166
  /**
174
167
  * Executes a query using either standard REST or Tooling API, returning a single record.
175
168
  * Will throw if either zero records are found OR multiple records are found.
@@ -177,7 +170,12 @@ export declare class Connection extends JSForceConnection {
177
170
  * @param soql The SOQL string.
178
171
  * @param options The query options.
179
172
  */
180
- singleRecordQuery<T>(soql: string, options?: SingleRecordQueryOptions): Promise<T>;
173
+ singleRecordQuery<T extends Record>(soql: string, options?: SingleRecordQueryOptions): Promise<T>;
174
+ /**
175
+ * Executes a get request on the baseUrl to force an auth refresh
176
+ * Useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes
177
+ */
178
+ refreshAuth(): Promise<void>;
181
179
  private loadInstanceApiVersion;
182
180
  }
183
181
  export declare const SingleRecordQueryErrors: {
@@ -193,7 +191,7 @@ export declare namespace Connection {
193
191
  /**
194
192
  * Connection Options.
195
193
  */
196
- interface Options {
194
+ interface Options<S extends Schema> {
197
195
  /**
198
196
  * AuthInfo instance.
199
197
  */
@@ -205,7 +203,7 @@ export declare namespace Connection {
205
203
  /**
206
204
  * Additional connection parameters.
207
205
  */
208
- connectionOptions?: ConnectionOptions;
206
+ connectionOptions?: ConnectionConfig<S>;
209
207
  }
210
208
  }
211
209
  export {};