diff --git a/src/org/org.ts b/src/org/org.ts index 5c9149056a..da3211aaf8 100644 --- a/src/org/org.ts +++ b/src/org/org.ts @@ -124,6 +124,7 @@ export type SandboxProcessObject = { export type SandboxRequest = { SandboxName: string; LicenseType?: string; + /** Should match a SandboxInfoId, not a SandboxProcessId */ SourceId?: string; Description?: string; }; @@ -236,16 +237,16 @@ export class Org extends AsyncOptionalCreatable { /** * * @param sandboxReq SandboxRequest options to create the sandbox with - * @param sandboxName + * @param sourceSandboxName the name of the sandbox that your new sandbox will be based on * @param options Wait: The amount of time to wait before timing out, defaults to 0, Interval: The time interval between polling defaults to 30 seconds * @returns {SandboxProcessObject} the newly created sandbox process object */ public async cloneSandbox( sandboxReq: SandboxRequest, - sandboxName: string, + sourceSandboxName: string, options: { wait?: Duration; interval?: Duration } ): Promise { - sandboxReq.SourceId = (await this.querySandboxProcessBySandboxName(sandboxName)).Id; + sandboxReq.SourceId = (await this.querySandboxProcessBySandboxName(sourceSandboxName)).SandboxInfoId; this.logger.debug('Clone sandbox sourceId %s', sandboxReq.SourceId); return this.createSandbox(sandboxReq, options); } @@ -368,7 +369,7 @@ export class Org extends AsyncOptionalCreatable { * @ignore */ public async retrieveOrgUsersConfig(): Promise { - return await OrgUsersConfig.create(OrgUsersConfig.getOptions(this.getOrgId())); + return OrgUsersConfig.create(OrgUsersConfig.getOptions(this.getOrgId())); } /** @@ -397,7 +398,7 @@ export class Org extends AsyncOptionalCreatable { * */ public async isSandbox(): Promise { - return await (await StateAggregator.getInstance()).sandboxes.hasFile(this.getOrgId()); + return (await StateAggregator.getInstance()).sandboxes.hasFile(this.getOrgId()); } /** * Check that this org is a scratch org by asking the dev hub if it knows about it. @@ -803,7 +804,7 @@ export class Org extends AsyncOptionalCreatable { * results in a warning. */ public async retrieveMaxApiVersion(): Promise { - return await this.getConnection().retrieveMaxApiVersion(); + return this.getConnection().retrieveMaxApiVersion(); } /** @@ -881,7 +882,7 @@ export class Org extends AsyncOptionalCreatable { * @private */ public async querySandboxProcessBySandboxName(name: string): Promise { - return await this.querySandboxProcess(`SandboxName='${name}'`); + return this.querySandboxProcess(`SandboxName='${name}'`); } /** @@ -891,7 +892,7 @@ export class Org extends AsyncOptionalCreatable { * @private */ public async querySandboxProcessBySandboxInfoId(id: string): Promise { - return await this.querySandboxProcess(`SandboxInfoId='${id}'`); + return this.querySandboxProcess(`SandboxInfoId='${id}'`); } /** @@ -901,7 +902,7 @@ export class Org extends AsyncOptionalCreatable { * @private */ public async querySandboxProcessById(id: string): Promise { - return await this.querySandboxProcess(`Id='${id}'`); + return this.querySandboxProcess(`Id='${id}'`); } /** @@ -1347,7 +1348,7 @@ export class Org extends AsyncOptionalCreatable { */ private async querySandboxProcess(where: string): Promise { const queryStr = `SELECT Id, Status, SandboxName, SandboxInfoId, LicenseType, CreatedDate, CopyProgress, SandboxOrganization, SourceId, Description, EndDate FROM SandboxProcess WHERE ${where} AND Status != 'D'`; - return await this.connection.singleRecordQuery(queryStr, { + return this.connection.singleRecordQuery(queryStr, { tooling: true, }); }