@salesforce/core 3.32.9 → 3.32.10
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/config/config.d.ts +1 -1
- package/lib/config/configStore.d.ts +4 -4
- package/lib/config/envVars.d.ts +2 -2
- package/lib/config/sandboxProcessCache.d.ts +1 -1
- package/lib/crypto/keyChainImpl.d.ts +3 -3
- package/lib/crypto/secureBuffer.d.ts +1 -1
- package/lib/lifecycleEvents.d.ts +1 -1
- package/lib/logger.d.ts +3 -3
- package/lib/messages.d.ts +5 -5
- package/lib/org/authInfo.d.ts +5 -5
- package/lib/org/connection.d.ts +2 -2
- package/lib/org/org.d.ts +6 -6
- package/lib/org/scratchOrgCache.d.ts +1 -1
- package/lib/org/scratchOrgInfoGenerator.d.ts +1 -1
- package/lib/org/user.d.ts +1 -1
- package/lib/sfProject.d.ts +4 -4
- package/lib/stateAggregator/accessors/aliasAccessor.d.ts +1 -1
- package/lib/stateAggregator/accessors/tokenAccessor.d.ts +2 -2
- package/lib/status/types.d.ts +2 -2
- package/lib/testSetup.d.ts +29 -5
- package/lib/testSetup.js +41 -4
- package/package.json +5 -5
package/lib/config/config.d.ts
CHANGED
|
@@ -181,7 +181,7 @@ export declare const SFDX_ALLOWED_PROPERTIES: ({
|
|
|
181
181
|
export declare const SfProperty: {
|
|
182
182
|
[index: string]: ConfigPropertyMeta;
|
|
183
183
|
};
|
|
184
|
-
export
|
|
184
|
+
export type ConfigProperties = {
|
|
185
185
|
[index: string]: JsonPrimitive;
|
|
186
186
|
};
|
|
187
187
|
/**
|
|
@@ -4,16 +4,16 @@ import { Crypto } from '../crypto/crypto';
|
|
|
4
4
|
/**
|
|
5
5
|
* The allowed types stored in a config store.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type ConfigValue = AnyJson;
|
|
8
8
|
/**
|
|
9
9
|
* The type of entries in a config store defined by the key and value type of {@link ConfigContents}.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type ConfigEntry = [string, ConfigValue];
|
|
12
12
|
/**
|
|
13
13
|
* The type of content a config stores.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
16
|
-
export
|
|
15
|
+
export type ConfigContents<T = ConfigValue> = Dictionary<T>;
|
|
16
|
+
export type Key<P extends ConfigContents> = Extract<keyof P, string>;
|
|
17
17
|
/**
|
|
18
18
|
* An interface for a config object with a persistent store.
|
|
19
19
|
*/
|
package/lib/config/envVars.d.ts
CHANGED
|
@@ -79,11 +79,11 @@ export declare enum EnvironmentVariable {
|
|
|
79
79
|
'SF_INSTALLER' = "SF_INSTALLER",
|
|
80
80
|
'SF_ENV' = "SF_ENV"
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
type EnvMetaData = {
|
|
83
83
|
description: string;
|
|
84
84
|
synonymOf: Nullable<string>;
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
type EnvType = {
|
|
87
87
|
[key in EnvironmentVariable]: EnvMetaData;
|
|
88
88
|
};
|
|
89
89
|
export declare const SUPPORTED_ENV_VARS: EnvType;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as childProcess from 'child_process';
|
|
5
5
|
import * as nodeFs from 'fs';
|
|
6
6
|
import { Nullable } from '@salesforce/ts-types';
|
|
7
|
-
export
|
|
7
|
+
export type FsIfc = Pick<typeof nodeFs, 'statSync'>;
|
|
8
8
|
/**
|
|
9
9
|
* Basic keychain interface.
|
|
10
10
|
*/
|
|
@@ -77,7 +77,7 @@ declare enum SecretField {
|
|
|
77
77
|
ACCOUNT = "account",
|
|
78
78
|
KEY = "key"
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
type SecretContents = {
|
|
81
81
|
[SecretField.ACCOUNT]: string;
|
|
82
82
|
[SecretField.KEY]?: string;
|
|
83
83
|
[SecretField.SERVICE]: string;
|
|
@@ -112,5 +112,5 @@ export declare const keyChainImpl: {
|
|
|
112
112
|
linux: KeychainAccess;
|
|
113
113
|
validateProgram: (programPath: string, fsIfc: FsIfc, isExeIfc: (mode: number, gid: number, uid: number) => boolean) => Promise<void>;
|
|
114
114
|
};
|
|
115
|
-
export
|
|
115
|
+
export type KeyChain = GenericUnixKeychainAccess | GenericWindowsKeychainAccess | KeychainAccess;
|
|
116
116
|
export {};
|
|
@@ -5,7 +5,7 @@ import { Optional } from '@salesforce/ts-types';
|
|
|
5
5
|
*
|
|
6
6
|
* @param buffer A buffer containing the decrypted secret.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type DecipherCallback<T> = (buffer: Buffer) => T;
|
|
9
9
|
/**
|
|
10
10
|
* Used to store and retrieve a sensitive information in memory. This is not meant for at rest encryption.
|
|
11
11
|
*
|
package/lib/lifecycleEvents.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyJson } from '@salesforce/ts-types';
|
|
2
|
-
|
|
2
|
+
type callback = (data: any) => Promise<void>;
|
|
3
3
|
/**
|
|
4
4
|
* An asynchronous event listener and emitter that follows the singleton pattern. The singleton pattern allows lifecycle
|
|
5
5
|
* events to be emitted from deep within a library and still be consumed by any other library or tool. It allows other
|
package/lib/logger.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Writable } from 'stream';
|
|
|
6
6
|
* @param input The input to be serialized.
|
|
7
7
|
* **See** {@link https://github.com/forcedotcom/node-bunyan#serializers|Bunyan Serializers API}
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type Serializer = (input: unknown) => unknown;
|
|
10
10
|
/**
|
|
11
11
|
* A collection of named `Serializer`s.
|
|
12
12
|
*
|
|
@@ -99,7 +99,7 @@ export interface LoggerStream {
|
|
|
99
99
|
/**
|
|
100
100
|
* Any numeric `Logger` level.
|
|
101
101
|
*/
|
|
102
|
-
export
|
|
102
|
+
export type LoggerLevelValue = LoggerLevel | number;
|
|
103
103
|
/**
|
|
104
104
|
* A collection of named `FieldValue`s.
|
|
105
105
|
*
|
|
@@ -111,7 +111,7 @@ export interface Fields {
|
|
|
111
111
|
/**
|
|
112
112
|
* All possible field value types.
|
|
113
113
|
*/
|
|
114
|
-
export
|
|
114
|
+
export type FieldValue = string | number | boolean;
|
|
115
115
|
/**
|
|
116
116
|
* Log line interface
|
|
117
117
|
*/
|
package/lib/messages.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyJson } from '@salesforce/ts-types';
|
|
2
2
|
import { SfError } from './sfError';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type Tokens = Array<string | boolean | number | null | undefined>;
|
|
4
|
+
export type StructuredMessage = {
|
|
5
5
|
message: string;
|
|
6
6
|
name: string;
|
|
7
7
|
actions?: string[];
|
|
@@ -11,11 +11,11 @@ export declare type StructuredMessage = {
|
|
|
11
11
|
*
|
|
12
12
|
* @param locale The local set by the framework.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
15
|
-
export
|
|
14
|
+
export type LoaderFunction<T extends string> = (locale: string) => Messages<T>;
|
|
15
|
+
export type StoredMessage = string | string[] | {
|
|
16
16
|
[s: string]: StoredMessage;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type StoredMessageMap = Map<string, StoredMessage>;
|
|
19
19
|
/**
|
|
20
20
|
* The core message framework manages messages and allows them to be accessible by
|
|
21
21
|
* all plugins and consumers of sfdx-core. It is set up to handle localization down
|
package/lib/org/authInfo.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Org } from './org';
|
|
|
6
6
|
/**
|
|
7
7
|
* Fields for authorization, org, and local information.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type AuthFields = {
|
|
10
10
|
accessToken?: string;
|
|
11
11
|
alias?: string;
|
|
12
12
|
authCode?: string;
|
|
@@ -39,7 +39,7 @@ export declare type AuthFields = {
|
|
|
39
39
|
[Org.Fields.IS_SCRATCH]?: boolean;
|
|
40
40
|
[Org.Fields.TRIAL_EXPIRATION_DATE]?: Nullable<string>;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type OrgAuthorization = {
|
|
43
43
|
orgId: string;
|
|
44
44
|
username: string;
|
|
45
45
|
oauthMethod: 'jwt' | 'web' | 'token' | 'unknown';
|
|
@@ -61,7 +61,7 @@ export interface AccessTokenOptions {
|
|
|
61
61
|
loginUrl?: string;
|
|
62
62
|
instanceUrl?: string;
|
|
63
63
|
}
|
|
64
|
-
export
|
|
64
|
+
export type AuthSideEffects = {
|
|
65
65
|
alias?: string;
|
|
66
66
|
setDefault: boolean;
|
|
67
67
|
setDefaultDevHub: boolean;
|
|
@@ -70,11 +70,11 @@ export declare type AuthSideEffects = {
|
|
|
70
70
|
/**
|
|
71
71
|
* A function to update a refresh token when the access token is expired.
|
|
72
72
|
*/
|
|
73
|
-
export
|
|
73
|
+
export type RefreshFn = (conn: Connection, callback: (err: Nullable<Error>, accessToken?: string, res?: Record<string, unknown>) => Promise<void>) => Promise<void>;
|
|
74
74
|
/**
|
|
75
75
|
* Options for {@link Connection}.
|
|
76
76
|
*/
|
|
77
|
-
export
|
|
77
|
+
export type ConnectionOptions = AuthFields & {
|
|
78
78
|
/**
|
|
79
79
|
* OAuth options.
|
|
80
80
|
*/
|
package/lib/org/connection.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export declare const SFDX_HTTP_HEADERS: {
|
|
|
11
11
|
'user-agent': string;
|
|
12
12
|
};
|
|
13
13
|
export declare const DNS_ERROR_NAME = "DomainNotFoundError";
|
|
14
|
-
|
|
14
|
+
type recentValidationOptions = {
|
|
15
15
|
id: string;
|
|
16
16
|
rest?: boolean;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type DeployOptionsWithRest = Partial<DeployOptions> & {
|
|
19
19
|
rest?: boolean;
|
|
20
20
|
};
|
|
21
21
|
export interface Tooling<S extends Schema = Schema> extends JSForceTooling<S> {
|
package/lib/org/org.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { OrgUsersConfig } from '../config/orgUsersConfig';
|
|
|
5
5
|
import { Connection } from './connection';
|
|
6
6
|
import { AuthFields, AuthInfo } from './authInfo';
|
|
7
7
|
import { ScratchOrgCreateOptions, ScratchOrgCreateResult } from './scratchOrgCreate';
|
|
8
|
-
export
|
|
8
|
+
export type OrganizationInformation = {
|
|
9
9
|
Name: string;
|
|
10
10
|
InstanceName: string;
|
|
11
11
|
IsSandbox: boolean;
|
|
@@ -44,7 +44,7 @@ export interface SandboxUserAuthResponse {
|
|
|
44
44
|
instanceUrl: string;
|
|
45
45
|
loginUrl: string;
|
|
46
46
|
}
|
|
47
|
-
export
|
|
47
|
+
export type SandboxProcessObject = {
|
|
48
48
|
Id: string;
|
|
49
49
|
Status: string;
|
|
50
50
|
SandboxName: string;
|
|
@@ -58,19 +58,19 @@ export declare type SandboxProcessObject = {
|
|
|
58
58
|
ApexClassId?: string;
|
|
59
59
|
EndDate?: string;
|
|
60
60
|
};
|
|
61
|
-
export
|
|
61
|
+
export type SandboxRequest = {
|
|
62
62
|
SandboxName: string;
|
|
63
63
|
LicenseType?: string;
|
|
64
64
|
/** Should match a SandboxInfoId, not a SandboxProcessId */
|
|
65
65
|
SourceId?: string;
|
|
66
66
|
Description?: string;
|
|
67
67
|
};
|
|
68
|
-
export
|
|
68
|
+
export type ResumeSandboxRequest = {
|
|
69
69
|
SandboxName?: string;
|
|
70
70
|
SandboxProcessObjId?: string;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
73
|
-
export
|
|
72
|
+
export type ScratchOrgRequest = Omit<ScratchOrgCreateOptions, 'hubOrg'>;
|
|
73
|
+
export type SandboxFields = {
|
|
74
74
|
sandboxOrgId: string;
|
|
75
75
|
prodOrgUsername: string;
|
|
76
76
|
sandboxName?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JsonMap } from '@salesforce/ts-types';
|
|
2
2
|
import { TTLConfig } from '../config/ttlConfig';
|
|
3
|
-
export
|
|
3
|
+
export type CachedOptions = {
|
|
4
4
|
hubUsername: string;
|
|
5
5
|
/** stores the scratch definition, including settings/objectSettings */
|
|
6
6
|
definitionjson: JsonMap;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SfProjectJson } from '../sfProject';
|
|
2
2
|
import { Org } from './org';
|
|
3
3
|
import { ScratchOrgInfo } from './scratchOrgTypes';
|
|
4
|
-
|
|
4
|
+
type PartialScratchOrgInfo = Pick<ScratchOrgInfo, 'ConnectedAppConsumerKey' | 'AuthCode' | 'Snapshot' | 'Status' | 'LoginUrl' | 'SignupEmail' | 'SignupUsername' | 'SignupInstance' | 'Username'>;
|
|
5
5
|
export interface ScratchOrgInfoPayload extends PartialScratchOrgInfo {
|
|
6
6
|
orgName: string;
|
|
7
7
|
package2AncestorIds: string;
|
package/lib/org/user.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const REQUIRED_FIELDS: {
|
|
|
22
22
|
*
|
|
23
23
|
* **See** https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export type UserFields = {
|
|
26
26
|
-readonly [K in keyof typeof REQUIRED_FIELDS]: string;
|
|
27
27
|
};
|
|
28
28
|
/**
|
package/lib/sfProject.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Dictionary, JsonMap, Nullable, Optional } from '@salesforce/ts-types';
|
|
2
2
|
import { ConfigFile } from './config/configFile';
|
|
3
3
|
import { ConfigContents } from './config/configStore';
|
|
4
|
-
export
|
|
4
|
+
export type PackageDirDependency = {
|
|
5
5
|
[k: string]: unknown;
|
|
6
6
|
package: string;
|
|
7
7
|
versionNumber?: string;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type PackageDir = {
|
|
10
10
|
ancestorId?: string;
|
|
11
11
|
ancestorVersion?: string;
|
|
12
12
|
default?: boolean;
|
|
@@ -23,7 +23,7 @@ export declare type PackageDir = {
|
|
|
23
23
|
versionName?: string;
|
|
24
24
|
versionNumber?: string;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type NamedPackageDir = PackageDir & {
|
|
27
27
|
/**
|
|
28
28
|
* The [normalized](https://nodejs.org/api/path.html#path_path_normalize_path) path used as the package name.
|
|
29
29
|
*/
|
|
@@ -33,7 +33,7 @@ export declare type NamedPackageDir = PackageDir & {
|
|
|
33
33
|
*/
|
|
34
34
|
fullPath: string;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type ProjectJson = ConfigContents & {
|
|
37
37
|
packageDirectories: PackageDir[];
|
|
38
38
|
namespace?: string;
|
|
39
39
|
sourceApiVersion?: string;
|
|
@@ -2,7 +2,7 @@ import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
|
2
2
|
import { Nullable } from '@salesforce/ts-types';
|
|
3
3
|
import { AuthFields, ConfigContents } from '../../exported';
|
|
4
4
|
import { SfToken } from './tokenAccessor';
|
|
5
|
-
export
|
|
5
|
+
export type Aliasable = string | (Partial<AuthFields> & Partial<SfToken>);
|
|
6
6
|
export declare class AliasAccessor extends AsyncOptionalCreatable {
|
|
7
7
|
private config;
|
|
8
8
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
2
2
|
import { JsonMap, Optional } from '@salesforce/ts-types';
|
|
3
|
-
export
|
|
3
|
+
export type SfToken = {
|
|
4
4
|
token: string;
|
|
5
5
|
url: string;
|
|
6
6
|
user?: string;
|
|
7
7
|
timestamp: string;
|
|
8
8
|
} & JsonMap;
|
|
9
|
-
export
|
|
9
|
+
export type SfTokens = {
|
|
10
10
|
[key: string]: SfToken;
|
|
11
11
|
};
|
|
12
12
|
export declare class TokenAccessor extends AsyncOptionalCreatable {
|
package/lib/status/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { AnyFunction, AnyJson, JsonMap } from '@salesforce/ts-types';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type Message = JsonMap;
|
|
5
|
+
export type Callback<T = unknown> = (...args: any[]) => T;
|
|
6
6
|
export interface StatusResult {
|
|
7
7
|
/**
|
|
8
8
|
* If the result of the streaming or polling client is expected to return a result
|
package/lib/testSetup.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export declare class TestContext {
|
|
|
87
87
|
Config?: ConfigStub;
|
|
88
88
|
SfProjectJson?: ConfigStub;
|
|
89
89
|
TokensConfig?: ConfigStub;
|
|
90
|
+
OrgUsersConfig?: ConfigStub;
|
|
90
91
|
};
|
|
91
92
|
/**
|
|
92
93
|
* A record of stubs created during instantiation.
|
|
@@ -170,6 +171,15 @@ export declare class TestContext {
|
|
|
170
171
|
* Stub salesforce org authorizations.
|
|
171
172
|
*/
|
|
172
173
|
stubAuths(...orgs: MockTestOrgData[]): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Stub salesforce user authorizations.
|
|
176
|
+
*
|
|
177
|
+
* @param users The users to stub.
|
|
178
|
+
* The key is the username of the admin user and it must be included in the users array in order to obtain the orgId key for the remaining users.
|
|
179
|
+
* The admin user is excluded from the users array.
|
|
180
|
+
*
|
|
181
|
+
*/
|
|
182
|
+
stubUsers(users: Record<string, MockTestOrgData[]>): void;
|
|
173
183
|
/**
|
|
174
184
|
* Stub salesforce sandbox authorizations.
|
|
175
185
|
*/
|
|
@@ -315,8 +325,8 @@ export declare const restoreContext: (testContext: TestContext) => void;
|
|
|
315
325
|
* $$.stubAliases({ 'myTestAlias': 'user@company.com' });
|
|
316
326
|
*
|
|
317
327
|
* // Will use the contents set above.
|
|
318
|
-
* const username = (await StateAggregator.getInstance()).aliases.resolveUsername(
|
|
319
|
-
* expect(username).to.equal(
|
|
328
|
+
* const username = (await StateAggregator.getInstance()).aliases.resolveUsername("myTestAlias");
|
|
329
|
+
* expect(username).to.equal("user@company.com");
|
|
320
330
|
* });
|
|
321
331
|
* });
|
|
322
332
|
* ```
|
|
@@ -333,7 +343,7 @@ export declare const unexpectedResult: SfError;
|
|
|
333
343
|
* ```
|
|
334
344
|
* try {
|
|
335
345
|
* await call()
|
|
336
|
-
* assert.fail(
|
|
346
|
+
* assert.fail("this should never happen");
|
|
337
347
|
* } catch (e) {
|
|
338
348
|
* ...
|
|
339
349
|
* }
|
|
@@ -355,7 +365,7 @@ export declare function shouldThrow(f: Promise<unknown>, message?: string): Prom
|
|
|
355
365
|
* ```
|
|
356
366
|
* try {
|
|
357
367
|
* call()
|
|
358
|
-
* assert.fail(
|
|
368
|
+
* assert.fail("this should never happen");
|
|
359
369
|
* } catch (e) {
|
|
360
370
|
* ...
|
|
361
371
|
* }
|
|
@@ -469,6 +479,19 @@ export declare class StreamingMockCometClient extends CometClient {
|
|
|
469
479
|
*/
|
|
470
480
|
disconnect(): Promise<void>;
|
|
471
481
|
}
|
|
482
|
+
type MockUserInfo = {
|
|
483
|
+
Id: string;
|
|
484
|
+
Username: string;
|
|
485
|
+
LastName: string;
|
|
486
|
+
Alias: string;
|
|
487
|
+
Configs: string[] | undefined;
|
|
488
|
+
TimeZoneSidKey: string;
|
|
489
|
+
LocaleSidKey: string;
|
|
490
|
+
EmailEncodingKey: string;
|
|
491
|
+
ProfileId: string;
|
|
492
|
+
LanguageLocaleKey: string;
|
|
493
|
+
Email: string;
|
|
494
|
+
};
|
|
472
495
|
/**
|
|
473
496
|
* Mock class for Salesforce Orgs.
|
|
474
497
|
*
|
|
@@ -517,7 +540,7 @@ export declare class MockTestOrgData {
|
|
|
517
540
|
/**
|
|
518
541
|
* Return mock user information based on this org.
|
|
519
542
|
*/
|
|
520
|
-
getMockUserInfo():
|
|
543
|
+
getMockUserInfo(): MockUserInfo;
|
|
521
544
|
/**
|
|
522
545
|
* Return the auth config file contents.
|
|
523
546
|
*/
|
|
@@ -552,3 +575,4 @@ export declare class MockTestSandboxData {
|
|
|
552
575
|
*/
|
|
553
576
|
getConfig(): Promise<SandboxFields>;
|
|
554
577
|
}
|
|
578
|
+
export {};
|
package/lib/testSetup.js
CHANGED
|
@@ -196,6 +196,43 @@ class TestContext {
|
|
|
196
196
|
};
|
|
197
197
|
this.configStubs.AuthInfoConfig = { retrieveContents };
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Stub salesforce user authorizations.
|
|
201
|
+
*
|
|
202
|
+
* @param users The users to stub.
|
|
203
|
+
* The key is the username of the admin user and it must be included in the users array in order to obtain the orgId key for the remaining users.
|
|
204
|
+
* The admin user is excluded from the users array.
|
|
205
|
+
*
|
|
206
|
+
*/
|
|
207
|
+
stubUsers(users) {
|
|
208
|
+
const mockUsers = Object.values(users).flatMap((orgUsers) => orgUsers.map((user) => {
|
|
209
|
+
const userInfo = user.getMockUserInfo();
|
|
210
|
+
return {
|
|
211
|
+
alias: userInfo.Alias ?? '',
|
|
212
|
+
email: userInfo.Email ?? '',
|
|
213
|
+
emailEncodingKey: userInfo.EmailEncodingKey ?? '',
|
|
214
|
+
id: userInfo.Id ?? '',
|
|
215
|
+
languageLocaleKey: userInfo.LanguageLocaleKey ?? '',
|
|
216
|
+
lastName: userInfo.LastName ?? '',
|
|
217
|
+
localeSidKey: userInfo.LocaleSidKey ?? '',
|
|
218
|
+
profileId: userInfo.ProfileId ?? '',
|
|
219
|
+
timeZoneSidKey: userInfo.TimeZoneSidKey ?? '',
|
|
220
|
+
username: userInfo.Username ?? '',
|
|
221
|
+
};
|
|
222
|
+
}));
|
|
223
|
+
const userOrgsMap = new Map(Object.entries(users).map(([adminUsername, orgs]) => {
|
|
224
|
+
const adminOrg = orgs.find((org) => org.username === adminUsername);
|
|
225
|
+
return adminOrg
|
|
226
|
+
? [adminOrg.orgId, { usernames: orgs.filter((org) => org.username !== adminUsername) }]
|
|
227
|
+
: [undefined, undefined];
|
|
228
|
+
}));
|
|
229
|
+
(0, ts_sinon_1.stubMethod)(this.SANDBOX, org_1.User.prototype, 'retrieve').callsFake((username) => Promise.resolve(mockUsers.find((org) => org.username === username)));
|
|
230
|
+
const retrieveContents = async function () {
|
|
231
|
+
const orgId = (0, path_1.basename)(this.path.replace('.json', ''));
|
|
232
|
+
return Promise.resolve(userOrgsMap.get(orgId) ?? {});
|
|
233
|
+
};
|
|
234
|
+
this.configStubs.OrgUsersConfig = { retrieveContents };
|
|
235
|
+
}
|
|
199
236
|
/**
|
|
200
237
|
* Stub salesforce sandbox authorizations.
|
|
201
238
|
*/
|
|
@@ -535,8 +572,8 @@ const _testSetup = (sinon) => {
|
|
|
535
572
|
* $$.stubAliases({ 'myTestAlias': 'user@company.com' });
|
|
536
573
|
*
|
|
537
574
|
* // Will use the contents set above.
|
|
538
|
-
* const username = (await StateAggregator.getInstance()).aliases.resolveUsername(
|
|
539
|
-
* expect(username).to.equal(
|
|
575
|
+
* const username = (await StateAggregator.getInstance()).aliases.resolveUsername("myTestAlias");
|
|
576
|
+
* expect(username).to.equal("user@company.com");
|
|
540
577
|
* });
|
|
541
578
|
* });
|
|
542
579
|
* ```
|
|
@@ -553,7 +590,7 @@ exports.unexpectedResult = new sfError_1.SfError('This code was expected to fail
|
|
|
553
590
|
* ```
|
|
554
591
|
* try {
|
|
555
592
|
* await call()
|
|
556
|
-
* assert.fail(
|
|
593
|
+
* assert.fail("this should never happen");
|
|
557
594
|
* } catch (e) {
|
|
558
595
|
* ...
|
|
559
596
|
* }
|
|
@@ -584,7 +621,7 @@ exports.shouldThrow = shouldThrow;
|
|
|
584
621
|
* ```
|
|
585
622
|
* try {
|
|
586
623
|
* call()
|
|
587
|
-
* assert.fail(
|
|
624
|
+
* assert.fail("this should never happen");
|
|
588
625
|
* } catch (e) {
|
|
589
626
|
* ...
|
|
590
627
|
* }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "3.32.
|
|
3
|
+
"version": "3.32.10",
|
|
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",
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"@types/shelljs": "0.8.11",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
|
68
68
|
"@typescript-eslint/parser": "^5.45.0",
|
|
69
|
-
"chai": "^4.3.
|
|
69
|
+
"chai": "^4.3.7",
|
|
70
70
|
"chai-string": "^1.5.0",
|
|
71
71
|
"commitizen": "^3.1.2",
|
|
72
|
-
"eslint": "^8.
|
|
72
|
+
"eslint": "^8.29.0",
|
|
73
73
|
"eslint-config-prettier": "^8.5.0",
|
|
74
74
|
"eslint-config-salesforce": "^1.1.0",
|
|
75
75
|
"eslint-config-salesforce-license": "^0.1.6",
|
|
@@ -81,12 +81,12 @@
|
|
|
81
81
|
"lodash": "^4.17.21",
|
|
82
82
|
"mocha": "^9.1.3",
|
|
83
83
|
"nyc": "^15.1.0",
|
|
84
|
-
"prettier": "^2.
|
|
84
|
+
"prettier": "^2.8.1",
|
|
85
85
|
"pretty-quick": "^3.1.3",
|
|
86
86
|
"shelljs": "0.8.5",
|
|
87
87
|
"sinon": "^14.0.2",
|
|
88
88
|
"ts-node": "^10.4.0",
|
|
89
|
-
"typescript": "^4.
|
|
89
|
+
"typescript": "^4.9.4"
|
|
90
90
|
},
|
|
91
91
|
"repository": {
|
|
92
92
|
"type": "git",
|