@salesforce/core 8.31.1 → 8.31.3-dev.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.
Files changed (2) hide show
  1. package/lib/org/org.js +22 -2
  2. package/package.json +2 -2
package/lib/org/org.js CHANGED
@@ -746,8 +746,28 @@ class Org extends kit_1.AsyncOptionalCreatable {
746
746
  }
747
747
  }
748
748
  const whereClause = by.id ? `Id='${by.id}'` : `SandboxName='${by.name ?? '<undefined>'}'`;
749
- const soql = `SELECT ${sandboxInfoFields.join(',')} FROM SandboxInfo WHERE ${whereClause} ORDER BY CreatedDate DESC`;
750
- const result = (await this.connection.tooling.query(soql)).records.filter((item) => !item.IsDeleted);
749
+ const buildSoql = (fields) => `SELECT ${fields.join(',')} FROM SandboxInfo WHERE ${whereClause} ORDER BY CreatedDate DESC`;
750
+ let soql = buildSoql(sandboxInfoFields);
751
+ let records;
752
+ try {
753
+ records = (await this.connection.tooling.query(soql)).records;
754
+ }
755
+ catch (err) {
756
+ // PostCopyConfig is only available on orgs running a release that exposes the field on
757
+ // the Tooling API. Older orgs reject the SOQL with INVALID_FIELD ("No such column ...").
758
+ // Retry once without PostCopyConfig so existing customers aren't broken.
759
+ const message = err instanceof Error ? err.message : String(err);
760
+ const isInvalidField = (err instanceof Error && err.name === 'INVALID_FIELD') || message.includes('No such column');
761
+ if (isInvalidField && message.includes('PostCopyConfig')) {
762
+ this.logger.debug('PostCopyConfig not supported on this org; retrying SandboxInfo query without it');
763
+ soql = buildSoql(sandboxInfoFields.filter((f) => f !== 'PostCopyConfig'));
764
+ records = (await this.connection.tooling.query(soql)).records;
765
+ }
766
+ else {
767
+ throw err;
768
+ }
769
+ }
770
+ const result = records.filter((item) => !item.IsDeleted);
751
771
  if (result.length === 0) {
752
772
  throw new sfError_1.SfError(`No record found for ${soql}`, connection_1.SingleRecordQueryErrors.NoRecords);
753
773
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.31.1",
3
+ "version": "8.31.3-dev.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",
@@ -61,7 +61,7 @@
61
61
  "messageTransformer/messageTransformer.ts"
62
62
  ],
63
63
  "dependencies": {
64
- "@jsforce/jsforce-node": "^3.10.13",
64
+ "@jsforce/jsforce-node": "^3.10.16-dev.0",
65
65
  "@salesforce/kit": "^3.2.4",
66
66
  "@salesforce/ts-types": "^2.0.12",
67
67
  "ajv": "^8.18.0",