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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) 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 +444 -0
  14. package/lib/api/bulk.js +1372 -0
  15. package/lib/api/chatter.d.ts +133 -0
  16. package/lib/api/chatter.js +248 -0
  17. package/lib/api/metadata/schema.d.ts +16117 -0
  18. package/lib/api/metadata/schema.js +9094 -0
  19. package/lib/api/metadata.d.ts +189 -0
  20. package/lib/api/metadata.js +406 -0
  21. package/lib/api/soap/schema.d.ts +3167 -0
  22. package/lib/api/soap/schema.js +1787 -0
  23. package/lib/api/soap.d.ts +76 -0
  24. package/lib/api/soap.js +155 -0
  25. package/lib/api/streaming/extension.d.ts +94 -0
  26. package/lib/api/streaming/extension.js +151 -0
  27. package/lib/api/streaming.d.ts +160 -0
  28. package/lib/api/streaming.js +252 -0
  29. package/lib/api/tooling.d.ts +284 -0
  30. package/lib/api/tooling.js +202 -0
  31. package/lib/api/wsdl/wsdl2schema.d.ts +1 -0
  32. package/lib/api/wsdl/wsdl2schema.js +354 -0
  33. package/lib/browser/canvas.d.ts +12 -0
  34. package/lib/browser/canvas.js +77 -0
  35. package/lib/browser/client.d.ts +82 -0
  36. package/lib/browser/client.js +244 -0
  37. package/lib/browser/jsonp.d.ts +12 -0
  38. package/lib/browser/jsonp.js +69 -0
  39. package/lib/browser/registry.d.ts +3 -0
  40. package/lib/browser/registry.js +5 -0
  41. package/lib/browser/request.d.ts +10 -0
  42. package/lib/browser/request.js +202 -0
  43. package/lib/cache.d.ts +74 -0
  44. package/lib/cache.js +159 -0
  45. package/lib/connection.d.ts +355 -0
  46. package/lib/connection.js +1153 -0
  47. package/lib/core.d.ts +17 -0
  48. package/lib/core.js +55 -0
  49. package/lib/csv.d.ts +23 -0
  50. package/lib/csv.js +35 -0
  51. package/lib/date.d.ts +82 -0
  52. package/lib/date.js +201 -0
  53. package/lib/http-api.d.ts +75 -0
  54. package/lib/http-api.js +257 -0
  55. package/lib/index.d.ts +12 -0
  56. package/lib/index.js +31 -0
  57. package/lib/jsforce.d.ts +26 -0
  58. package/lib/jsforce.js +67 -0
  59. package/lib/jwtOAuth2.d.ts +8 -0
  60. package/lib/jwtOAuth2.js +23 -0
  61. package/lib/oauth2.d.ts +92 -0
  62. package/lib/oauth2.js +245 -0
  63. package/lib/process.d.ts +157 -0
  64. package/lib/process.js +143 -0
  65. package/lib/query.d.ts +341 -0
  66. package/lib/query.js +817 -0
  67. package/lib/quick-action.d.ts +44 -0
  68. package/lib/quick-action.js +46 -0
  69. package/lib/record-reference.d.ts +46 -0
  70. package/lib/record-reference.js +65 -0
  71. package/lib/record-stream.d.ts +83 -0
  72. package/lib/record-stream.js +233 -0
  73. package/lib/registry/base.d.ts +43 -0
  74. package/lib/registry/base.js +96 -0
  75. package/lib/registry/empty.d.ts +7 -0
  76. package/lib/registry/empty.js +13 -0
  77. package/lib/registry/file.d.ts +11 -0
  78. package/lib/registry/file.js +51 -0
  79. package/lib/registry/index.d.ts +8 -0
  80. package/lib/registry/index.js +21 -0
  81. package/lib/registry/sfdx.d.ts +56 -0
  82. package/lib/registry/sfdx.js +133 -0
  83. package/lib/registry/types.d.ts +47 -0
  84. package/lib/registry/types.js +2 -0
  85. package/lib/request-helper.d.ts +23 -0
  86. package/lib/request-helper.js +102 -0
  87. package/lib/request.d.ts +11 -0
  88. package/lib/request.js +75 -0
  89. package/lib/session-refresh-delegate.d.ts +31 -0
  90. package/lib/session-refresh-delegate.js +69 -0
  91. package/lib/soap.d.ts +60 -0
  92. package/lib/soap.js +246 -0
  93. package/lib/sobject.d.ts +258 -0
  94. package/lib/sobject.js +376 -0
  95. package/lib/soql-builder.d.ts +25 -0
  96. package/lib/soql-builder.js +226 -0
  97. package/lib/transport.d.ts +63 -0
  98. package/lib/transport.js +175 -0
  99. package/lib/types/common.d.ts +560 -0
  100. package/lib/types/common.js +2 -0
  101. package/lib/types/index.d.ts +7 -0
  102. package/lib/types/index.js +23 -0
  103. package/lib/types/projection.d.ts +26 -0
  104. package/lib/types/projection.js +2 -0
  105. package/lib/types/record.d.ts +44 -0
  106. package/lib/types/record.js +2 -0
  107. package/lib/types/schema.d.ts +50 -0
  108. package/lib/types/schema.js +2 -0
  109. package/lib/types/soap.d.ts +43 -0
  110. package/lib/types/soap.js +2 -0
  111. package/lib/types/standard-schema.d.ts +16199 -0
  112. package/lib/types/standard-schema.js +2 -0
  113. package/lib/types/util.d.ts +7 -0
  114. package/lib/types/util.js +2 -0
  115. package/lib/util/formatter.d.ts +8 -0
  116. package/lib/util/formatter.js +24 -0
  117. package/lib/util/function.d.ts +32 -0
  118. package/lib/util/function.js +52 -0
  119. package/lib/util/logger.d.ts +29 -0
  120. package/lib/util/logger.js +102 -0
  121. package/lib/util/promise.d.ts +19 -0
  122. package/lib/util/promise.js +25 -0
  123. package/lib/util/stream.d.ts +12 -0
  124. package/lib/util/stream.js +88 -0
  125. package/package.json +260 -6
  126. package/typings/faye/index.d.ts +16 -0
  127. package/typings/index.d.ts +1 -0
@@ -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.HttpApi = void 0;
7
+ /**
8
+ *
9
+ */
10
+ const events_1 = require("events");
11
+ const xml2js_1 = __importDefault(require("xml2js"));
12
+ const logger_1 = require("./util/logger");
13
+ const promise_1 = require("./util/promise");
14
+ const csv_1 = require("./csv");
15
+ const stream_1 = require("./util/stream");
16
+ /** @private */
17
+ function parseJSON(str) {
18
+ return JSON.parse(str);
19
+ }
20
+ /** @private */
21
+ async function parseXML(str) {
22
+ return xml2js_1.default.parseStringPromise(str, { explicitArray: false });
23
+ }
24
+ /** @private */
25
+ function parseText(str) {
26
+ return str;
27
+ }
28
+ /**
29
+ * HTTP based API class with authorization hook
30
+ */
31
+ class HttpApi extends events_1.EventEmitter {
32
+ static _logger = (0, logger_1.getLogger)('http-api');
33
+ _conn;
34
+ _logger;
35
+ _transport;
36
+ _responseType;
37
+ _noContentResponse;
38
+ _options;
39
+ constructor(conn, options) {
40
+ super();
41
+ this._conn = conn;
42
+ this._logger = conn._logLevel
43
+ ? HttpApi._logger.createInstance(conn._logLevel)
44
+ : HttpApi._logger;
45
+ this._responseType = options.responseType;
46
+ this._transport = options.transport || conn._transport;
47
+ this._noContentResponse = options.noContentResponse;
48
+ this._options = options;
49
+ }
50
+ /**
51
+ * Callout to API endpoint using http
52
+ */
53
+ request(request) {
54
+ return promise_1.StreamPromise.create(() => {
55
+ const { stream, setStream } = (0, stream_1.createLazyStream)();
56
+ const promise = (async () => {
57
+ const refreshDelegate = this.getRefreshDelegate();
58
+ /* TODO decide remove or not this section */
59
+ /*
60
+ // remember previous instance url in case it changes after a refresh
61
+ const lastInstanceUrl = conn.instanceUrl;
62
+
63
+ // check to see if the token refresh has changed the instance url
64
+ if(lastInstanceUrl !== conn.instanceUrl){
65
+ // if the instance url has changed
66
+ // then replace the current request urls instance url fragment
67
+ // with the updated instance url
68
+ request.url = request.url.replace(lastInstanceUrl,conn.instanceUrl);
69
+ }
70
+ */
71
+ if (refreshDelegate && refreshDelegate.isRefreshing()) {
72
+ await refreshDelegate.waitRefresh();
73
+ const bodyPromise = this.request(request);
74
+ setStream(bodyPromise.stream());
75
+ const body = await bodyPromise;
76
+ return body;
77
+ }
78
+ // hook before sending
79
+ this.beforeSend(request);
80
+ this.emit('request', request);
81
+ this._logger.debug(`<request> method=${request.method}, url=${request.url}`);
82
+ const requestTime = Date.now();
83
+ const requestPromise = this._transport.httpRequest(request, this._options);
84
+ setStream(requestPromise.stream());
85
+ let response;
86
+ try {
87
+ response = await requestPromise;
88
+ }
89
+ catch (err) {
90
+ this._logger.error(err);
91
+ throw err;
92
+ }
93
+ finally {
94
+ const responseTime = Date.now();
95
+ this._logger.debug(`elapsed time: ${responseTime - requestTime} msec`);
96
+ }
97
+ if (!response) {
98
+ return;
99
+ }
100
+ this._logger.debug(`<response> status=${String(response.statusCode)}, url=${request.url}`);
101
+ this.emit('response', response);
102
+ // Refresh token if session has been expired and requires authentication
103
+ // when session refresh delegate is available
104
+ if (this.isSessionExpired(response) && refreshDelegate) {
105
+ await refreshDelegate.refresh(requestTime);
106
+ return this.request(request);
107
+ }
108
+ if (this.isErrorResponse(response)) {
109
+ const err = await this.getError(response);
110
+ throw err;
111
+ }
112
+ const body = await this.getResponseBody(response);
113
+ return body;
114
+ })();
115
+ return { stream, promise };
116
+ });
117
+ }
118
+ /**
119
+ * @protected
120
+ */
121
+ getRefreshDelegate() {
122
+ return this._conn._refreshDelegate;
123
+ }
124
+ /**
125
+ * @protected
126
+ */
127
+ beforeSend(request) {
128
+ /* eslint-disable no-param-reassign */
129
+ const headers = request.headers || {};
130
+ if (this._conn.accessToken) {
131
+ headers.Authorization = `Bearer ${this._conn.accessToken}`;
132
+ }
133
+ if (this._conn._callOptions) {
134
+ const callOptions = [];
135
+ for (const name of Object.keys(this._conn._callOptions)) {
136
+ callOptions.push(`${name}=${this._conn._callOptions[name]}`);
137
+ }
138
+ headers['Sforce-Call-Options'] = callOptions.join(', ');
139
+ }
140
+ request.headers = headers;
141
+ }
142
+ /**
143
+ * Detect response content mime-type
144
+ * @protected
145
+ */
146
+ getResponseContentType(response) {
147
+ return (this._responseType ||
148
+ (response.headers && response.headers['content-type']));
149
+ }
150
+ /**
151
+ * @private
152
+ */
153
+ async parseResponseBody(response) {
154
+ const contentType = this.getResponseContentType(response) || '';
155
+ const parseBody = /^(text|application)\/xml(;|$)/.test(contentType)
156
+ ? parseXML
157
+ : /^application\/json(;|$)/.test(contentType)
158
+ ? parseJSON
159
+ : /^text\/csv(;|$)/.test(contentType)
160
+ ? csv_1.parseCSV
161
+ : parseText;
162
+ try {
163
+ return parseBody(response.body);
164
+ }
165
+ catch (e) {
166
+ return response.body;
167
+ }
168
+ }
169
+ /**
170
+ * Get response body
171
+ * @protected
172
+ */
173
+ async getResponseBody(response) {
174
+ if (response.statusCode === 204) {
175
+ // No Content
176
+ return this._noContentResponse;
177
+ }
178
+ const body = await this.parseResponseBody(response);
179
+ let err;
180
+ if (this.hasErrorInResponseBody(body)) {
181
+ err = await this.getError(response, body);
182
+ throw err;
183
+ }
184
+ if (response.statusCode === 300) {
185
+ // Multiple Choices
186
+ throw new HttpApiError('Multiple records found', 'MULTIPLE_CHOICES', body);
187
+ }
188
+ return body;
189
+ }
190
+ /**
191
+ * Detect session expiry
192
+ * @protected
193
+ */
194
+ isSessionExpired(response) {
195
+ return response.statusCode === 401;
196
+ }
197
+ /**
198
+ * Detect error response
199
+ * @protected
200
+ */
201
+ isErrorResponse(response) {
202
+ return response.statusCode >= 400;
203
+ }
204
+ /**
205
+ * Detect error in response body
206
+ * @protected
207
+ */
208
+ hasErrorInResponseBody(_body) {
209
+ return false;
210
+ }
211
+ /**
212
+ * Parsing error message in response
213
+ * @protected
214
+ */
215
+ parseError(body) {
216
+ const errors = body;
217
+ return Array.isArray(errors) ? errors[0] : errors;
218
+ }
219
+ /**
220
+ * Get error message in response
221
+ * @protected
222
+ */
223
+ async getError(response, body) {
224
+ let error;
225
+ try {
226
+ error = this.parseError(body || (await this.parseResponseBody(response)));
227
+ }
228
+ catch (e) {
229
+ // eslint-disable no-empty
230
+ }
231
+ error =
232
+ typeof error === 'object' &&
233
+ error !== null &&
234
+ typeof error.message === 'string'
235
+ ? error
236
+ : {
237
+ errorCode: `ERROR_HTTP_${response.statusCode}`,
238
+ message: response.body,
239
+ };
240
+ return new HttpApiError(error.message, error.errorCode);
241
+ }
242
+ }
243
+ exports.HttpApi = HttpApi;
244
+ /**
245
+ *
246
+ */
247
+ class HttpApiError extends Error {
248
+ errorCode;
249
+ content;
250
+ constructor(message, errorCode, content) {
251
+ super(message);
252
+ this.name = errorCode || this.name;
253
+ this.errorCode = this.name;
254
+ this.content = content;
255
+ }
256
+ }
257
+ exports.default = HttpApi;
package/lib/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import jsforce from './jsforce';
2
+ import './api/analytics';
3
+ import './api/apex';
4
+ import './api/bulk';
5
+ import './api/chatter';
6
+ import './api/metadata';
7
+ import './api/soap';
8
+ import './api/streaming';
9
+ import './api/tooling';
10
+ export * from './types';
11
+ export * from './core';
12
+ export default jsforce;
package/lib/index.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const jsforce_1 = __importDefault(require("./jsforce"));
21
+ require("./api/analytics");
22
+ require("./api/apex");
23
+ require("./api/bulk");
24
+ require("./api/chatter");
25
+ require("./api/metadata");
26
+ require("./api/soap");
27
+ require("./api/streaming");
28
+ require("./api/tooling");
29
+ __exportStar(require("./types"), exports);
30
+ __exportStar(require("./core"), exports);
31
+ exports.default = jsforce_1.default;
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import VERSION from './VERSION';
4
+ import Connection from './connection';
5
+ import OAuth2 from './oauth2';
6
+ import SfDate from './date';
7
+ import { Registry } from './registry';
8
+ import { BrowserClient } from './browser/client';
9
+ import { JwtOAuth2 } from './jwtOAuth2';
10
+ /**
11
+ *
12
+ */
13
+ declare class JSforce extends EventEmitter {
14
+ VERSION: typeof VERSION;
15
+ Connection: typeof Connection;
16
+ OAuth2: typeof OAuth2;
17
+ JwtOAuth2: typeof JwtOAuth2;
18
+ SfDate: typeof SfDate;
19
+ Date: typeof SfDate;
20
+ BrowserClient: typeof BrowserClient;
21
+ registry: Registry;
22
+ browser: BrowserClient;
23
+ }
24
+ export declare function registerModule(name: string, factory: (conn: Connection) => any): void;
25
+ declare const jsforce: JSforce;
26
+ export default jsforce;
package/lib/jsforce.js ADDED
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.registerModule = void 0;
30
+ const events_1 = require("events");
31
+ const VERSION_1 = __importDefault(require("./VERSION"));
32
+ const connection_1 = __importDefault(require("./connection"));
33
+ const oauth2_1 = __importDefault(require("./oauth2"));
34
+ const date_1 = __importDefault(require("./date"));
35
+ const registry_1 = __importDefault(require("./registry"));
36
+ const client_1 = __importStar(require("./browser/client"));
37
+ const jwtOAuth2_1 = require("./jwtOAuth2");
38
+ /**
39
+ *
40
+ */
41
+ class JSforce extends events_1.EventEmitter {
42
+ VERSION = VERSION_1.default;
43
+ Connection = connection_1.default;
44
+ OAuth2 = oauth2_1.default;
45
+ JwtOAuth2 = jwtOAuth2_1.JwtOAuth2;
46
+ SfDate = date_1.default;
47
+ Date = date_1.default;
48
+ BrowserClient = client_1.BrowserClient;
49
+ registry = registry_1.default;
50
+ browser = client_1.default;
51
+ }
52
+ function registerModule(name, factory) {
53
+ jsforce.on('connection:new', (conn) => {
54
+ let obj = undefined;
55
+ Object.defineProperty(conn, name, {
56
+ get() {
57
+ obj = obj ?? factory(conn);
58
+ return obj;
59
+ },
60
+ enumerable: true,
61
+ configurable: true,
62
+ });
63
+ });
64
+ }
65
+ exports.registerModule = registerModule;
66
+ const jsforce = new JSforce();
67
+ exports.default = jsforce;
@@ -0,0 +1,8 @@
1
+ import OAuth2, { OAuth2Config } from './oauth2';
2
+ /**
3
+ * @deprecated
4
+ */
5
+ export declare class JwtOAuth2 extends OAuth2 {
6
+ constructor(config: OAuth2Config);
7
+ jwtAuthorize(innerToken: string): Promise<any>;
8
+ }
@@ -0,0 +1,23 @@
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.JwtOAuth2 = void 0;
7
+ const oauth2_1 = __importDefault(require("./oauth2"));
8
+ /**
9
+ * @deprecated
10
+ */
11
+ class JwtOAuth2 extends oauth2_1.default {
12
+ constructor(config) {
13
+ console.warn('JwtOAuth2 is deprecated and will be removed in next stable release, please use OAuth2 instead.');
14
+ super(config);
15
+ }
16
+ jwtAuthorize(innerToken) {
17
+ return super._postParams({
18
+ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
19
+ assertion: innerToken,
20
+ });
21
+ }
22
+ }
23
+ exports.JwtOAuth2 = JwtOAuth2;
@@ -0,0 +1,92 @@
1
+ import Transport from './transport';
2
+ import { Optional } from './types';
3
+ /**
4
+ * type defs
5
+ */
6
+ export type OAuth2Config = {
7
+ clientId?: string;
8
+ clientSecret?: string;
9
+ redirectUri?: string;
10
+ loginUrl?: string;
11
+ authzServiceUrl?: string;
12
+ tokenServiceUrl?: string;
13
+ revokeServiceUrl?: string;
14
+ proxyUrl?: string;
15
+ httpProxy?: string;
16
+ useVerifier?: boolean;
17
+ };
18
+ export type AuthzRequestParams = {
19
+ scope?: string;
20
+ state?: string;
21
+ code_challenge?: string;
22
+ } & {
23
+ [attr: string]: string;
24
+ };
25
+ export type TokenResponse = {
26
+ token_type: 'Bearer';
27
+ /**
28
+ * Identity URL
29
+ *
30
+ * The format of the URL is https://login.salesforce.com/id/orgID/userID.
31
+ */
32
+ id: string;
33
+ access_token: string;
34
+ refresh_token?: string;
35
+ signature: string;
36
+ issued_at: string;
37
+ instance_url: string;
38
+ sfdc_community_url?: string;
39
+ sfdc_community_id?: string;
40
+ };
41
+ /**
42
+ * OAuth2 class
43
+ */
44
+ export declare class OAuth2 {
45
+ loginUrl: string;
46
+ authzServiceUrl: string;
47
+ tokenServiceUrl: string;
48
+ revokeServiceUrl: string;
49
+ clientId: Optional<string>;
50
+ clientSecret: Optional<string>;
51
+ redirectUri: Optional<string>;
52
+ codeVerifier: Optional<string>;
53
+ _transport: Transport;
54
+ /**
55
+ *
56
+ */
57
+ constructor(config: OAuth2Config);
58
+ /**
59
+ * Get Salesforce OAuth2 authorization page URL to redirect user agent.
60
+ */
61
+ getAuthorizationUrl(params?: AuthzRequestParams): string;
62
+ /**
63
+ * OAuth2 Refresh Token Flow
64
+ */
65
+ refreshToken(refreshToken: string): Promise<TokenResponse>;
66
+ /**
67
+ * Send access token request to the token endpoint.
68
+ * When a code (string) is passed in first argument, it will use Web Server Authentication Flow (Authorization Code Grant).
69
+ * Otherwise, it will use the specified `grant_type` and pass parameters to the endpoint.
70
+ */
71
+ requestToken(codeOrParams: string | {
72
+ grant_type: string;
73
+ [name: string]: string;
74
+ }, params?: {
75
+ [prop: string]: string;
76
+ }): Promise<TokenResponse>;
77
+ /**
78
+ * OAuth2 Username-Password Flow (Resource Owner Password Credentials)
79
+ */
80
+ authenticate(username: string, password: string): Promise<TokenResponse>;
81
+ /**
82
+ * OAuth2 Revoke Session Token
83
+ */
84
+ revokeToken(token: string): Promise<void>;
85
+ /**
86
+ * @private
87
+ */
88
+ _postParams(params: {
89
+ [name: string]: string;
90
+ }): Promise<any>;
91
+ }
92
+ export default OAuth2;