@salesforce/core 8.14.0 → 8.15.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.
- package/lib/logger/logger.js +3 -1
- package/lib/org/org.d.ts +14 -0
- package/lib/org/org.js +40 -0
- package/package.json +1 -1
package/lib/logger/logger.js
CHANGED
|
@@ -397,7 +397,9 @@ const getWriteStream = (level = 'warn') => {
|
|
|
397
397
|
return {
|
|
398
398
|
target: 'pino-pretty',
|
|
399
399
|
options: {
|
|
400
|
-
|
|
400
|
+
// NOTE: env.getBoolean() defaults to false if the env var is not set
|
|
401
|
+
// so it's important to use `||` instead of `??`
|
|
402
|
+
colorize: env.getBoolean('SF_LOG_COLORIZE') || true,
|
|
401
403
|
destination: env.getBoolean('SF_LOG_STDERR') ? 2 : 1,
|
|
402
404
|
},
|
|
403
405
|
};
|
package/lib/org/org.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ 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 type XOR<T, U> = (T & {
|
|
9
|
+
[K in keyof U]?: never;
|
|
10
|
+
}) | (U & {
|
|
11
|
+
[K in keyof T]?: never;
|
|
12
|
+
});
|
|
8
13
|
export type OrganizationInformation = {
|
|
9
14
|
Name: string;
|
|
10
15
|
InstanceName: string;
|
|
@@ -59,6 +64,7 @@ export type SandboxProcessObject = {
|
|
|
59
64
|
Description?: string;
|
|
60
65
|
ApexClassId?: string;
|
|
61
66
|
EndDate?: string;
|
|
67
|
+
Features?: string[];
|
|
62
68
|
};
|
|
63
69
|
export type SandboxRequest = {
|
|
64
70
|
SandboxName: string;
|
|
@@ -68,6 +74,7 @@ export type SandboxRequest = {
|
|
|
68
74
|
Description?: string;
|
|
69
75
|
ApexClassId?: string;
|
|
70
76
|
ActivationUserGroupId?: string;
|
|
77
|
+
Features?: string[];
|
|
71
78
|
};
|
|
72
79
|
export type ResumeSandboxRequest = {
|
|
73
80
|
SandboxName?: string;
|
|
@@ -91,6 +98,7 @@ export type SandboxInfo = {
|
|
|
91
98
|
SourceId?: string;
|
|
92
99
|
ActivationUserGroupId?: string;
|
|
93
100
|
CopyArchivedActivities?: boolean;
|
|
101
|
+
Features?: string[];
|
|
94
102
|
};
|
|
95
103
|
export type ScratchOrgRequest = Omit<ScratchOrgCreateOptions, 'hubOrg'>;
|
|
96
104
|
export type SandboxFields = {
|
|
@@ -102,6 +110,11 @@ export type SandboxFields = {
|
|
|
102
110
|
sandboxInfoId?: string;
|
|
103
111
|
timestamp?: string;
|
|
104
112
|
};
|
|
113
|
+
export type SandboxInfoQueryFields = XOR<{
|
|
114
|
+
name: string;
|
|
115
|
+
}, {
|
|
116
|
+
id: string;
|
|
117
|
+
}>;
|
|
105
118
|
/**
|
|
106
119
|
* Provides a way to manage a locally authenticated Org.
|
|
107
120
|
*
|
|
@@ -313,6 +326,7 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
313
326
|
* @returns org information
|
|
314
327
|
*/
|
|
315
328
|
retrieveOrganizationInformation(): Promise<OrganizationInformation>;
|
|
329
|
+
querySandboxInfo(by: SandboxInfoQueryFields): Promise<SandboxInfo>;
|
|
316
330
|
/**
|
|
317
331
|
* Some organization information is locally cached, such as if the org name or if it is a scratch org.
|
|
318
332
|
* This method populates/updates the filesystem from information retrieved from the org.
|
package/lib/org/org.js
CHANGED
|
@@ -84,6 +84,26 @@ const sandboxProcessFields = [
|
|
|
84
84
|
'SourceId',
|
|
85
85
|
'Description',
|
|
86
86
|
'EndDate',
|
|
87
|
+
'Features',
|
|
88
|
+
];
|
|
89
|
+
const sandboxInfoFields = [
|
|
90
|
+
'Id',
|
|
91
|
+
'IsDeleted',
|
|
92
|
+
'CreatedDate',
|
|
93
|
+
'CreatedById',
|
|
94
|
+
'LastModifiedDate',
|
|
95
|
+
'LastModifiedById',
|
|
96
|
+
'SandboxName',
|
|
97
|
+
'LicenseType',
|
|
98
|
+
'TemplateId',
|
|
99
|
+
'HistoryDays',
|
|
100
|
+
'CopyChatter',
|
|
101
|
+
'AutoActivate',
|
|
102
|
+
'ApexClassId',
|
|
103
|
+
'Description',
|
|
104
|
+
'SourceId',
|
|
105
|
+
'ActivationUserGroupId',
|
|
106
|
+
'Features',
|
|
87
107
|
];
|
|
88
108
|
/**
|
|
89
109
|
* Provides a way to manage a locally authenticated Org.
|
|
@@ -597,6 +617,26 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
597
617
|
async retrieveOrganizationInformation() {
|
|
598
618
|
return this.getConnection().singleRecordQuery('SELECT Name, InstanceName, IsSandbox, TrialExpirationDate, NamespacePrefix FROM Organization');
|
|
599
619
|
}
|
|
620
|
+
async querySandboxInfo(by) {
|
|
621
|
+
if (by.id) {
|
|
622
|
+
// Validate that the ID is a valid Salesforce ID
|
|
623
|
+
if (!(0, sfdc_1.validateSalesforceId)(by.id)) {
|
|
624
|
+
throw new sfError_1.SfError(`Invalid Salesforce ID format: ${by.id}`, 'InvalidSalesforceId');
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
const whereClause = by.id ? `Id='${by.id}'` : `SandboxName='${by.name}'`;
|
|
628
|
+
const soql = `SELECT ${sandboxInfoFields.join(',')} FROM SandboxInfo WHERE ${whereClause} ORDER BY CreatedDate DESC`;
|
|
629
|
+
const result = (await this.connection.tooling.query(soql)).records.filter((item) => !item.IsDeleted);
|
|
630
|
+
if (result.length === 0) {
|
|
631
|
+
throw new sfError_1.SfError(`No record found for ${soql}`, connection_1.SingleRecordQueryErrors.NoRecords);
|
|
632
|
+
}
|
|
633
|
+
if (result.length > 1) {
|
|
634
|
+
const err = new sfError_1.SfError('The query returned more than 1 record', connection_1.SingleRecordQueryErrors.MultipleRecords);
|
|
635
|
+
err.data = result;
|
|
636
|
+
throw err;
|
|
637
|
+
}
|
|
638
|
+
return result[0];
|
|
639
|
+
}
|
|
600
640
|
/**
|
|
601
641
|
* Some organization information is locally cached, such as if the org name or if it is a scratch org.
|
|
602
642
|
* This method populates/updates the filesystem from information retrieved from the org.
|