@salesforce/core-bundle 8.14.1 → 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/index.d.ts CHANGED
@@ -3070,6 +3070,11 @@ declare module '@salesforce/core-bundle/org/org' {
3070
3070
  import { Connection } from '@salesforce/core-bundle/org/connection';
3071
3071
  import { AuthFields, AuthInfo } from '@salesforce/core-bundle/org/authInfo';
3072
3072
  import { ScratchOrgCreateOptions, ScratchOrgCreateResult } from '@salesforce/core-bundle/org/scratchOrgCreate';
3073
+ export type XOR<T, U> = (T & {
3074
+ [K in keyof U]?: never;
3075
+ }) | (U & {
3076
+ [K in keyof T]?: never;
3077
+ });
3073
3078
  export type OrganizationInformation = {
3074
3079
  Name: string;
3075
3080
  InstanceName: string;
@@ -3124,6 +3129,7 @@ declare module '@salesforce/core-bundle/org/org' {
3124
3129
  Description?: string;
3125
3130
  ApexClassId?: string;
3126
3131
  EndDate?: string;
3132
+ Features?: string[];
3127
3133
  };
3128
3134
  export type SandboxRequest = {
3129
3135
  SandboxName: string;
@@ -3133,6 +3139,7 @@ declare module '@salesforce/core-bundle/org/org' {
3133
3139
  Description?: string;
3134
3140
  ApexClassId?: string;
3135
3141
  ActivationUserGroupId?: string;
3142
+ Features?: string[];
3136
3143
  };
3137
3144
  export type ResumeSandboxRequest = {
3138
3145
  SandboxName?: string;
@@ -3156,6 +3163,7 @@ declare module '@salesforce/core-bundle/org/org' {
3156
3163
  SourceId?: string;
3157
3164
  ActivationUserGroupId?: string;
3158
3165
  CopyArchivedActivities?: boolean;
3166
+ Features?: string[];
3159
3167
  };
3160
3168
  export type ScratchOrgRequest = Omit<ScratchOrgCreateOptions, 'hubOrg'>;
3161
3169
  export type SandboxFields = {
@@ -3167,6 +3175,11 @@ declare module '@salesforce/core-bundle/org/org' {
3167
3175
  sandboxInfoId?: string;
3168
3176
  timestamp?: string;
3169
3177
  };
3178
+ export type SandboxInfoQueryFields = XOR<{
3179
+ name: string;
3180
+ }, {
3181
+ id: string;
3182
+ }>;
3170
3183
  /**
3171
3184
  * Provides a way to manage a locally authenticated Org.
3172
3185
  *
@@ -3378,6 +3391,7 @@ declare module '@salesforce/core-bundle/org/org' {
3378
3391
  * @returns org information
3379
3392
  */
3380
3393
  retrieveOrganizationInformation(): Promise<OrganizationInformation>;
3394
+ querySandboxInfo(by: SandboxInfoQueryFields): Promise<SandboxInfo>;
3381
3395
  /**
3382
3396
  * Some organization information is locally cached, such as if the org name or if it is a scratch org.
3383
3397
  * This method populates/updates the filesystem from information retrieved from the org.
package/lib/index.js CHANGED
@@ -12336,7 +12336,7 @@ var require_package2 = __commonJS({
12336
12336
  "package.json"(exports2, module2) {
12337
12337
  module2.exports = {
12338
12338
  name: "@salesforce/core-bundle",
12339
- version: "8.14.1",
12339
+ version: "8.15.0",
12340
12340
  description: "Core libraries to interact with SFDX projects, orgs, and APIs.",
12341
12341
  main: "lib/index",
12342
12342
  types: "lib/index.d.ts",
@@ -107779,7 +107779,27 @@ var require_org = __commonJS({
107779
107779
  "SandboxOrganization",
107780
107780
  "SourceId",
107781
107781
  "Description",
107782
- "EndDate"
107782
+ "EndDate",
107783
+ "Features"
107784
+ ];
107785
+ var sandboxInfoFields = [
107786
+ "Id",
107787
+ "IsDeleted",
107788
+ "CreatedDate",
107789
+ "CreatedById",
107790
+ "LastModifiedDate",
107791
+ "LastModifiedById",
107792
+ "SandboxName",
107793
+ "LicenseType",
107794
+ "TemplateId",
107795
+ "HistoryDays",
107796
+ "CopyChatter",
107797
+ "AutoActivate",
107798
+ "ApexClassId",
107799
+ "Description",
107800
+ "SourceId",
107801
+ "ActivationUserGroupId",
107802
+ "Features"
107783
107803
  ];
107784
107804
  var Org = class _Org extends kit_1.AsyncOptionalCreatable {
107785
107805
  status = _Org.Status.UNKNOWN;
@@ -108224,6 +108244,25 @@ var require_org = __commonJS({
108224
108244
  async retrieveOrganizationInformation() {
108225
108245
  return this.getConnection().singleRecordQuery("SELECT Name, InstanceName, IsSandbox, TrialExpirationDate, NamespacePrefix FROM Organization");
108226
108246
  }
108247
+ async querySandboxInfo(by) {
108248
+ if (by.id) {
108249
+ if (!(0, sfdc_1.validateSalesforceId)(by.id)) {
108250
+ throw new sfError_12.SfError(`Invalid Salesforce ID format: ${by.id}`, "InvalidSalesforceId");
108251
+ }
108252
+ }
108253
+ const whereClause = by.id ? `Id='${by.id}'` : `SandboxName='${by.name}'`;
108254
+ const soql = `SELECT ${sandboxInfoFields.join(",")} FROM SandboxInfo WHERE ${whereClause} ORDER BY CreatedDate DESC`;
108255
+ const result = (await this.connection.tooling.query(soql)).records.filter((item) => !item.IsDeleted);
108256
+ if (result.length === 0) {
108257
+ throw new sfError_12.SfError(`No record found for ${soql}`, connection_12.SingleRecordQueryErrors.NoRecords);
108258
+ }
108259
+ if (result.length > 1) {
108260
+ const err = new sfError_12.SfError("The query returned more than 1 record", connection_12.SingleRecordQueryErrors.MultipleRecords);
108261
+ err.data = result;
108262
+ throw err;
108263
+ }
108264
+ return result[0];
108265
+ }
108227
108266
  /**
108228
108267
  * Some organization information is locally cached, such as if the org name or if it is a scratch org.
108229
108268
  * This method populates/updates the filesystem from information retrieved from the org.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core-bundle",
3
- "version": "8.14.1",
3
+ "version": "8.15.0",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",