@salesforce/core 3.6.4 → 3.7.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 +36 -10
- package/lib/config/config.d.ts +4 -0
- package/lib/config/config.js +4 -0
- package/lib/deviceOauthService.d.ts +3 -3
- package/lib/deviceOauthService.js +17 -18
- package/lib/exported.d.ts +3 -4
- package/lib/exported.js +1 -2
- package/lib/global.js +1 -1
- package/lib/globalInfo/accessors/aliasAccessor.d.ts +18 -1
- package/lib/globalInfo/accessors/aliasAccessor.js +29 -6
- package/lib/logger.d.ts +1 -1
- package/lib/logger.js +1 -1
- package/lib/org/authInfo.d.ts +15 -40
- package/lib/org/authInfo.js +30 -71
- package/lib/org/connection.d.ts +18 -25
- package/lib/org/connection.js +50 -78
- package/lib/org/org.js +4 -5
- package/lib/org/user.d.ts +1 -0
- package/lib/org/user.js +11 -2
- package/lib/status/pollingClient.d.ts +2 -1
- package/lib/status/streamingClient.d.ts +3 -77
- package/lib/status/streamingClient.js +3 -9
- package/lib/testSetup.d.ts +4 -3
- package/lib/testSetup.js +1 -1
- package/lib/util/getJwtAudienceUrl.d.ts +2 -2
- package/lib/util/sfdcUrl.js +1 -0
- package/lib/webOAuthServer.d.ts +2 -3
- package/lib/webOAuthServer.js +2 -1
- package/messages/config.md +6 -2
- package/package.json +4 -2
- package/lib/status/client.d.ts +0 -15
- package/lib/status/client.js +0 -9
|
@@ -1,75 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
1
|
import { AsyncOptionalCreatable, Duration, Env } from '@salesforce/kit/lib';
|
|
4
|
-
import {
|
|
2
|
+
import { AnyJson } from '@salesforce/ts-types/lib';
|
|
3
|
+
import type { Client as CometClient, StreamProcessor } from 'sfdx-faye';
|
|
5
4
|
import { Org } from '../org/org';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Types for defining extensions.
|
|
9
|
-
*/
|
|
10
|
-
export interface StreamingExtension {
|
|
11
|
-
/**
|
|
12
|
-
* Extension for outgoing message.
|
|
13
|
-
*
|
|
14
|
-
* @param message The message.
|
|
15
|
-
* @param callback The callback to invoke after the message is processed.
|
|
16
|
-
*/
|
|
17
|
-
outgoing?: (message: JsonMap, callback: AnyFunction) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Extension for the incoming message.
|
|
20
|
-
*
|
|
21
|
-
* @param message The message.
|
|
22
|
-
* @param callback The callback to invoke after the message is processed.
|
|
23
|
-
*/
|
|
24
|
-
incoming?: (message: JsonMap, callback: AnyFunction) => void;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Function type for processing messages
|
|
28
|
-
*/
|
|
29
|
-
export declare type StreamProcessor = (message: JsonMap) => StatusResult;
|
|
30
|
-
/**
|
|
31
|
-
* Comet client interface. The is to allow for mocking the inner streaming Cometd implementation.
|
|
32
|
-
* The Faye implementation is used by default but it could be used to adapt another Cometd impl.
|
|
33
|
-
*/
|
|
34
|
-
export declare abstract class CometClient extends EventEmitter {
|
|
35
|
-
/**
|
|
36
|
-
* Disable polling features.
|
|
37
|
-
*
|
|
38
|
-
* @param label Polling feature label.
|
|
39
|
-
*/
|
|
40
|
-
abstract disable(label: string): void;
|
|
41
|
-
/**
|
|
42
|
-
* Add a custom extension to the underlying client.
|
|
43
|
-
*
|
|
44
|
-
* @param extension The json function for the extension.
|
|
45
|
-
*/
|
|
46
|
-
abstract addExtension(extension: StreamingExtension): void;
|
|
47
|
-
/**
|
|
48
|
-
* Sets an http header name/value.
|
|
49
|
-
*
|
|
50
|
-
* @param name The header name.
|
|
51
|
-
* @param value The header value.
|
|
52
|
-
*/
|
|
53
|
-
abstract setHeader(name: string, value: string): void;
|
|
54
|
-
/**
|
|
55
|
-
* handshake with the streaming channel
|
|
56
|
-
*
|
|
57
|
-
* @param callback Callback for the handshake when it successfully completes. The handshake should throw
|
|
58
|
-
* errors when errors are encountered.
|
|
59
|
-
*/
|
|
60
|
-
abstract handshake(callback: () => void): void;
|
|
61
|
-
/**
|
|
62
|
-
* Subscribes to Comet topics. Subscribe should perform a handshake if one hasn't been performed yet.
|
|
63
|
-
*
|
|
64
|
-
* @param channel The topic to subscribe to.
|
|
65
|
-
* @param callback The callback to execute once a message has been received.
|
|
66
|
-
*/
|
|
67
|
-
abstract subscribe(channel: string, callback: (message: JsonMap) => void): CometSubscription;
|
|
68
|
-
/**
|
|
69
|
-
* Method to call to disconnect the client from the server.
|
|
70
|
-
*/
|
|
71
|
-
abstract disconnect(): void;
|
|
72
|
-
}
|
|
5
|
+
export { Client as CometClient, Message, StreamProcessor, CometSubscription, StatusResult, StreamingExtension, } from 'sfdx-faye';
|
|
73
6
|
/**
|
|
74
7
|
* Inner streaming client interface. This implements the Cometd behavior.
|
|
75
8
|
* Also allows for mocking the functional behavior.
|
|
@@ -88,13 +21,6 @@ export interface StreamingClientIfc {
|
|
|
88
21
|
*/
|
|
89
22
|
setLogger: (logLine: (message: string) => void) => void;
|
|
90
23
|
}
|
|
91
|
-
/**
|
|
92
|
-
* The subscription object returned from the cometd subscribe object.
|
|
93
|
-
*/
|
|
94
|
-
export interface CometSubscription {
|
|
95
|
-
callback(callback: () => void): void;
|
|
96
|
-
errback(callback: (error: Error) => void): void;
|
|
97
|
-
}
|
|
98
24
|
/**
|
|
99
25
|
* Api wrapper to support Salesforce streaming. The client contains an internal implementation of a cometd specification.
|
|
100
26
|
*
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.StreamingClient = exports.CometClient = void 0;
|
|
10
10
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
11
|
-
const events_1 = require("events");
|
|
12
11
|
const url_1 = require("url");
|
|
13
12
|
const lib_1 = require("@salesforce/kit/lib");
|
|
14
13
|
const lib_2 = require("@salesforce/ts-types/lib");
|
|
15
|
-
// @ts-ignore
|
|
16
14
|
const Faye = require("sfdx-faye");
|
|
17
15
|
const logger_1 = require("../logger");
|
|
18
16
|
const sfdxError_1 = require("../sfdxError");
|
|
19
17
|
const messages_1 = require("../messages");
|
|
18
|
+
var sfdx_faye_1 = require("sfdx-faye");
|
|
19
|
+
Object.defineProperty(exports, "CometClient", { enumerable: true, get: function () { return sfdx_faye_1.Client; } });
|
|
20
20
|
messages_1.Messages.importMessagesDirectory(__dirname);
|
|
21
21
|
const messages = messages_1.Messages.load('@salesforce/core', 'streaming', [
|
|
22
22
|
'waitParamValidValueError',
|
|
@@ -25,13 +25,6 @@ const messages = messages_1.Messages.load('@salesforce/core', 'streaming', [
|
|
|
25
25
|
'genericTimeout',
|
|
26
26
|
'handshakeApiVersionError',
|
|
27
27
|
]);
|
|
28
|
-
/**
|
|
29
|
-
* Comet client interface. The is to allow for mocking the inner streaming Cometd implementation.
|
|
30
|
-
* The Faye implementation is used by default but it could be used to adapt another Cometd impl.
|
|
31
|
-
*/
|
|
32
|
-
class CometClient extends events_1.EventEmitter {
|
|
33
|
-
}
|
|
34
|
-
exports.CometClient = CometClient;
|
|
35
28
|
/**
|
|
36
29
|
* Validation helper
|
|
37
30
|
*
|
|
@@ -382,6 +375,7 @@ exports.StreamingClient = StreamingClient;
|
|
|
382
375
|
});
|
|
383
376
|
},
|
|
384
377
|
setLogger: (logLine) => {
|
|
378
|
+
// @ts-ignore
|
|
385
379
|
Faye.logger = {};
|
|
386
380
|
['info', 'error', 'fatal', 'warn', 'debug'].forEach((element) => {
|
|
387
381
|
lib_1.set(Faye.logger, element, logLine);
|
package/lib/testSetup.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="sfdx-faye" />
|
|
1
2
|
/// <reference types="node" />
|
|
2
3
|
import { EventEmitter } from 'events';
|
|
3
4
|
import * as sinonType from 'sinon';
|
|
@@ -5,7 +6,7 @@ import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types';
|
|
|
5
6
|
import { ConfigContents } from './config/configStore';
|
|
6
7
|
import { Logger } from './logger';
|
|
7
8
|
import { SfdxError } from './sfdxError';
|
|
8
|
-
import { CometClient, CometSubscription, StreamingExtension } from './status/streamingClient';
|
|
9
|
+
import { CometClient, CometSubscription, Message, StreamingExtension } from './status/streamingClient';
|
|
9
10
|
import { SfOrg } from './globalInfo';
|
|
10
11
|
/**
|
|
11
12
|
* Different parts of the system that are mocked out. They can be restored for
|
|
@@ -306,7 +307,7 @@ export interface StreamingMockCometSubscriptionOptions {
|
|
|
306
307
|
/**
|
|
307
308
|
* A list of messages to playback for the client. One message per process tick.
|
|
308
309
|
*/
|
|
309
|
-
messagePlaylist?:
|
|
310
|
+
messagePlaylist?: Message[];
|
|
310
311
|
}
|
|
311
312
|
/**
|
|
312
313
|
* Simulates a comet subscription to a streaming channel.
|
|
@@ -366,7 +367,7 @@ export declare class StreamingMockCometClient extends CometClient {
|
|
|
366
367
|
* @param channel The streaming channel.
|
|
367
368
|
* @param callback The function to invoke after the subscription completes.
|
|
368
369
|
*/
|
|
369
|
-
subscribe(channel: string, callback: (message:
|
|
370
|
+
subscribe(channel: string, callback: (message: Message) => void): CometSubscription;
|
|
370
371
|
/**
|
|
371
372
|
* Fake disconnect. Does Nothing.
|
|
372
373
|
*/
|
package/lib/testSetup.js
CHANGED
|
@@ -413,7 +413,7 @@ class StreamingMockCometClient extends streamingClient_1.CometClient {
|
|
|
413
413
|
* @param {StreamingMockCometSubscriptionOptions} options Extends the StreamingClient options.
|
|
414
414
|
*/
|
|
415
415
|
constructor(options) {
|
|
416
|
-
super();
|
|
416
|
+
super(options.url);
|
|
417
417
|
this.options = options;
|
|
418
418
|
if (!this.options.messagePlaylist) {
|
|
419
419
|
this.options.messagePlaylist = [{ id: this.options.id }];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getJwtAudienceUrl(options:
|
|
1
|
+
import { OAuth2Config } from 'jsforce';
|
|
2
|
+
export declare function getJwtAudienceUrl(options: OAuth2Config & {
|
|
3
3
|
createdOrgInstance?: string;
|
|
4
4
|
}): Promise<string>;
|
package/lib/util/sfdcUrl.js
CHANGED
|
@@ -70,6 +70,7 @@ class SfdcUrl extends url_1.URL {
|
|
|
70
70
|
'.salesforce.com',
|
|
71
71
|
'.salesforceliveagent.com',
|
|
72
72
|
'.secure.force.com',
|
|
73
|
+
'crmforce.mil',
|
|
73
74
|
];
|
|
74
75
|
const allowlistOfSalesforceHosts = ['developer.salesforce.com', 'trailhead.salesforce.com'];
|
|
75
76
|
return allowlistOfSalesforceDomainPatterns.some((pattern) => {
|
package/lib/webOAuthServer.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as http from 'http';
|
|
3
3
|
import { AsyncCreatable } from '@salesforce/kit';
|
|
4
|
-
import {
|
|
5
|
-
import { AuthInfo } from './org/authInfo';
|
|
4
|
+
import { AuthInfo, OAuth2Config } from './org/authInfo';
|
|
6
5
|
/**
|
|
7
6
|
* Handles the creation of a web server for web based login flows.
|
|
8
7
|
*
|
|
@@ -80,7 +79,7 @@ export declare class WebOAuthServer extends AsyncCreatable<WebOAuthServer.Option
|
|
|
80
79
|
}
|
|
81
80
|
export declare namespace WebOAuthServer {
|
|
82
81
|
interface Options {
|
|
83
|
-
oauthConfig:
|
|
82
|
+
oauthConfig: OAuth2Config;
|
|
84
83
|
}
|
|
85
84
|
type Request = http.IncomingMessage & {
|
|
86
85
|
query: {
|
package/lib/webOAuthServer.js
CHANGED
|
@@ -13,6 +13,7 @@ const url_1 = require("url");
|
|
|
13
13
|
const net_1 = require("net");
|
|
14
14
|
const kit_1 = require("@salesforce/kit");
|
|
15
15
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
16
|
+
const jsforce_1 = require("jsforce");
|
|
16
17
|
const logger_1 = require("./logger");
|
|
17
18
|
const authInfo_1 = require("./org/authInfo");
|
|
18
19
|
const sfdxError_1 = require("./sfdxError");
|
|
@@ -132,7 +133,7 @@ class WebOAuthServer extends kit_1.AsyncCreatable {
|
|
|
132
133
|
if (!this.oauthConfig.redirectUri)
|
|
133
134
|
this.oauthConfig.redirectUri = `http://localhost:${port}/OauthRedirect`;
|
|
134
135
|
this.webServer = await WebServer.create({ port });
|
|
135
|
-
this.oauth2 = new
|
|
136
|
+
this.oauth2 = new jsforce_1.OAuth2(this.oauthConfig);
|
|
136
137
|
this.authUrl = authInfo_1.AuthInfo.getAuthorizationUrl(this.oauthConfig, this.oauth2);
|
|
137
138
|
}
|
|
138
139
|
/**
|
package/messages/config.md
CHANGED
|
@@ -22,6 +22,10 @@ Specify a valid Salesforce instance URL.
|
|
|
22
22
|
|
|
23
23
|
Specify a valid Salesforce API version, for example, 42.0.
|
|
24
24
|
|
|
25
|
+
# invalidCustomOrgMetadataTemplates
|
|
26
|
+
|
|
27
|
+
Specify a valid repository URL or directory for the custom org metadata templates.
|
|
28
|
+
|
|
25
29
|
# invalidIsvDebuggerSid
|
|
26
30
|
|
|
27
31
|
Specify a valid Debugger SID.
|
|
@@ -97,7 +101,7 @@ ISV debugger URL
|
|
|
97
101
|
|
|
98
102
|
# apiVersion
|
|
99
103
|
|
|
100
|
-
API version of your project. Default: API version of your Dev Hub org.
|
|
104
|
+
API version of your project. Default: API version of your Dev Hub org.
|
|
101
105
|
|
|
102
106
|
# disableTelemetry
|
|
103
107
|
|
|
@@ -109,7 +113,7 @@ Maximum number of Salesforce records returned by a CLI command. Default: 10,000.
|
|
|
109
113
|
|
|
110
114
|
# restDeploy
|
|
111
115
|
|
|
112
|
-
Whether deployments use the Metadata REST API (true) or SOAP API (false, default value).
|
|
116
|
+
Whether deployments use the Metadata REST API (true) or SOAP API (false, default value).
|
|
113
117
|
|
|
114
118
|
# instanceUrl
|
|
115
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -48,9 +48,10 @@
|
|
|
48
48
|
"@types/mkdirp": "^1.0.1",
|
|
49
49
|
"change-case": "^4.1.2",
|
|
50
50
|
"debug": "^3.1.0",
|
|
51
|
+
"form-data": "^4.0.0",
|
|
51
52
|
"graceful-fs": "^4.2.4",
|
|
52
53
|
"jsen": "0.6.6",
|
|
53
|
-
"jsforce": "
|
|
54
|
+
"jsforce": "2.0.0-beta.7",
|
|
54
55
|
"jsonwebtoken": "8.5.0",
|
|
55
56
|
"mkdirp": "1.0.4",
|
|
56
57
|
"sfdx-faye": "^1.0.9",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"@types/debug": "0.0.30",
|
|
65
66
|
"@types/jsen": "0.0.19",
|
|
66
67
|
"@types/jsonwebtoken": "8.3.2",
|
|
68
|
+
"@types/sfdx-faye": "^1.0.0",
|
|
67
69
|
"@types/shelljs": "0.7.8",
|
|
68
70
|
"@types/sinon": "^9.0.8",
|
|
69
71
|
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
package/lib/status/client.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AnyJson } from '@salesforce/ts-types';
|
|
2
|
-
/**
|
|
3
|
-
* Return type for the Streaming and Polling client.
|
|
4
|
-
*/
|
|
5
|
-
export interface StatusResult {
|
|
6
|
-
/**
|
|
7
|
-
* If the result of the streaming or polling client is expected to return a result
|
|
8
|
-
*/
|
|
9
|
-
payload?: AnyJson;
|
|
10
|
-
/**
|
|
11
|
-
* Indicates to the streaming or polling client that the subscriber has what its needs. If `true` the client will end
|
|
12
|
-
* the messaging exchanges with the endpoint.
|
|
13
|
-
*/
|
|
14
|
-
completed: boolean;
|
|
15
|
-
}
|
package/lib/status/client.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
//# sourceMappingURL=client.js.map
|