Skip to content

Commit 9a2348b

Browse files
committed
chore: type changes and var renames
1 parent 1040142 commit 9a2348b

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/commands/org/create/sandbox.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxCommandResp
180180
if (nameOrId) {
181181
const sourceFeatures = await this.getSandboxFeatures(nameOrId);
182182
if (sourceFeatures) {
183-
(sandboxReq as SandboxRequest & { Features?: string[] }).Features = sourceFeatures;
183+
sandboxReq.Features = sourceFeatures;
184184
}
185185
}
186186

@@ -195,25 +195,25 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxCommandResp
195195
};
196196
}
197197

198-
private async getSandboxFeatures(sandboxName: string): Promise<string[] | undefined> {
198+
private async getSandboxFeatures(sandboxNameOrId: string): Promise<string[] | undefined> {
199199
const prodOrg = this.flags['target-org'];
200200

201201
try {
202-
if (sandboxName?.startsWith('0GQ')) {
203-
const sbxId = await prodOrg.querySandboxInfo({ id: sandboxName, name: undefined });
204-
if (sbxId?.Features) {
205-
return sbxId.Features;
202+
if (sandboxNameOrId?.startsWith('0GQ')) {
203+
const sbxInfo = await prodOrg.querySandboxInfo({ id: sandboxNameOrId });
204+
if (sbxInfo?.Features) {
205+
return sbxInfo.Features;
206206
}
207207

208-
return (await prodOrg.querySandboxProcessBySandboxInfoId(sandboxName)).Features;
208+
return (await prodOrg.querySandboxProcessBySandboxInfoId(sandboxNameOrId)).Features;
209209
}
210210

211-
const sbxName = await prodOrg.querySandboxInfo({ id: undefined, name: sandboxName });
212-
if (sbxName?.Features) {
213-
return sbxName.Features;
211+
const sbxInfo = await prodOrg.querySandboxInfo({ name: sandboxNameOrId });
212+
if (sbxInfo?.Features) {
213+
return sbxInfo.Features;
214214
}
215215

216-
return (await prodOrg.querySandboxProcessBySandboxName(sandboxName)).Features;
216+
return (await prodOrg.querySandboxProcessBySandboxName(sandboxNameOrId)).Features;
217217
} catch (err) {
218218
if (err instanceof SfError && (err.name.includes('AUTH') ?? err.name.includes('CONNECTION'))) {
219219
this.warn(`Warning: Could not retrieve sandbox features due to ${err.name}.`);

src/shared/sandboxRequest.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ export async function createSandboxRequest(
8888

8989
const capitalizedVarArgs = properties ? lowerToUpper(properties) : {};
9090
// varargs override file input
91-
const sandboxReqWithName: (SandboxRequest & { Features?: string[] }) & {
91+
const sandboxReqWithName: SandboxRequest & {
9292
SourceSandboxName?: string;
93-
SourceId?: string;
9493
} = {
9594
...(sandboxDefFileContents as Record<string, unknown>),
9695
...capitalizedVarArgs,

0 commit comments

Comments
 (0)