@salesforce/core 3.12.0 → 3.12.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.12.1](https://github.com/forcedotcom/sfdx-core/compare/v3.12.0...v3.12.1) (2022-04-05)
6
+
7
+ ### Bug Fixes
8
+
9
+ - more FormData with buffers and headers ([5ebf78f](https://github.com/forcedotcom/sfdx-core/commit/5ebf78fe2b037df395c87197b90ee06a0d34d5d0))
10
+
5
11
  ## [3.12.0](https://github.com/forcedotcom/sfdx-core/compare/v3.11.1...v3.12.0) (2022-04-04)
6
12
 
7
13
  ### Features
@@ -1,6 +1,6 @@
1
1
  import { AsyncCreatable } from '@salesforce/kit';
2
2
  import { OAuth2Config } from 'jsforce/lib/oauth2';
3
- import { Nullable, JsonMap } from '@salesforce/ts-types';
3
+ import { JsonMap, Nullable } from '@salesforce/ts-types';
4
4
  import { AuthInfo } from './org/authInfo';
5
5
  export interface DeviceCodeResponse extends JsonMap {
6
6
  device_code: string;
@@ -9,10 +9,10 @@
9
9
  /* eslint-disable @typescript-eslint/ban-types */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.DeviceOauthService = void 0;
12
- const url_1 = require("url");
13
12
  const transport_1 = require("jsforce/lib/transport");
14
13
  const kit_1 = require("@salesforce/kit");
15
14
  const ts_types_1 = require("@salesforce/ts-types");
15
+ const FormData = require("form-data");
16
16
  const logger_1 = require("./logger");
17
17
  const authInfo_1 = require("./org/authInfo");
18
18
  const sfError_1 = require("./sfError");
@@ -82,8 +82,7 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
82
82
  const deviceFlowRequestUrl = this.getDeviceFlowRequestUrl();
83
83
  const pollingOptions = this.getPollingOptions(deviceFlowRequestUrl, loginData.device_code);
84
84
  const interval = kit_1.Duration.seconds(loginData.interval).milliseconds;
85
- const response = await this.pollForDeviceApproval(pollingOptions, interval);
86
- return response;
85
+ return await this.pollForDeviceApproval(pollingOptions, interval);
87
86
  }
88
87
  /**
89
88
  * Creates and saves new AuthInfo
@@ -108,27 +107,27 @@ class DeviceOauthService extends kit_1.AsyncCreatable {
108
107
  this.logger.debug(`this.options.loginUrl: ${this.options.loginUrl}`);
109
108
  }
110
109
  getLoginOptions(url) {
111
- const body = new url_1.URLSearchParams();
112
- body.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
113
- body.append('response_type', DeviceOauthService.RESPONSE_TYPE);
114
- body.append('scope', DeviceOauthService.SCOPE);
110
+ const form = new FormData();
111
+ form.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
112
+ form.append('response_type', DeviceOauthService.RESPONSE_TYPE);
113
+ form.append('scope', DeviceOauthService.SCOPE);
115
114
  return {
116
115
  url,
117
- headers: connection_1.SFDX_HTTP_HEADERS,
116
+ headers: { ...connection_1.SFDX_HTTP_HEADERS, ...form.getHeaders() },
118
117
  method: 'POST',
119
- body,
118
+ body: form.getBuffer(),
120
119
  };
121
120
  }
122
121
  getPollingOptions(url, code) {
123
- const body = new url_1.URLSearchParams();
124
- body.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
125
- body.append('grant_type', DeviceOauthService.GRANT_TYPE);
126
- body.append('code', code);
122
+ const form = new FormData();
123
+ form.append('client_id', (0, ts_types_1.ensureString)(this.options.clientId));
124
+ form.append('grant_type', DeviceOauthService.GRANT_TYPE);
125
+ form.append('code', code);
127
126
  return {
128
127
  url,
129
- headers: connection_1.SFDX_HTTP_HEADERS,
128
+ headers: { ...connection_1.SFDX_HTTP_HEADERS, ...form.getHeaders() },
130
129
  method: 'POST',
131
- body,
130
+ body: form.getBuffer(),
132
131
  };
133
132
  }
134
133
  getDeviceFlowRequestUrl() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.12.0",
3
+ "version": "3.12.1",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",