@salesforce/plugin-devops-center 1.0.0-beta.1 → 1.0.0-beta.3
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/README.md +3 -1
- package/lib/commands/project/deploy/pipeline/quick.d.ts +23 -0
- package/lib/commands/project/deploy/pipeline/quick.js +45 -0
- package/lib/commands/project/deploy/pipeline/quick.js.map +1 -0
- package/lib/commands/project/deploy/pipeline/resume.d.ts +3 -2
- package/lib/commands/project/deploy/pipeline/resume.js +1 -0
- package/lib/commands/project/deploy/pipeline/resume.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/start.d.ts +4 -2
- package/lib/commands/project/deploy/pipeline/start.js +1 -0
- package/lib/commands/project/deploy/pipeline/start.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/validate.d.ts +19 -0
- package/lib/commands/project/deploy/pipeline/validate.js +37 -0
- package/lib/commands/project/deploy/pipeline/validate.js.map +1 -0
- package/lib/common/base/abstractAsyncOperation.d.ts +42 -0
- package/lib/common/base/abstractAsyncOperation.js +94 -0
- package/lib/common/base/abstractAsyncOperation.js.map +1 -0
- package/lib/common/base/abstractPromote.d.ts +8 -16
- package/lib/common/base/abstractPromote.js +19 -69
- package/lib/common/base/abstractPromote.js.map +1 -1
- package/lib/common/base/abstractQuick.d.ts +59 -0
- package/lib/common/base/abstractQuick.js +111 -0
- package/lib/common/base/abstractQuick.js.map +1 -0
- package/lib/common/base/abstractResume.d.ts +7 -12
- package/lib/common/base/abstractResume.js +9 -35
- package/lib/common/base/abstractResume.js.map +1 -1
- package/lib/common/constants.d.ts +2 -1
- package/lib/common/constants.js +1 -0
- package/lib/common/constants.js.map +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/outputColumns.d.ts +1 -0
- package/lib/common/outputColumns.js +1 -0
- package/lib/common/outputColumns.js.map +1 -1
- package/lib/common/outputService/aorOutputService.js +12 -6
- package/lib/common/outputService/aorOutputService.js.map +1 -1
- package/lib/common/outputService/deployCommandOutputService.d.ts +1 -1
- package/lib/common/outputService/deployCommandOutputService.js +2 -2
- package/lib/common/outputService/deployCommandOutputService.js.map +1 -1
- package/lib/common/outputService/deploySummaryBuilder.d.ts +12 -0
- package/lib/common/outputService/deploySummaryBuilder.js +59 -5
- package/lib/common/outputService/deploySummaryBuilder.js.map +1 -1
- package/lib/common/outputService/outputServiceFactory.d.ts +11 -5
- package/lib/common/outputService/outputServiceFactory.js +8 -2
- package/lib/common/outputService/outputServiceFactory.js.map +1 -1
- package/lib/common/outputService/promoteOutputService.d.ts +0 -6
- package/lib/common/outputService/promoteOutputService.js +0 -11
- package/lib/common/outputService/promoteOutputService.js.map +1 -1
- package/lib/common/outputService/resumeCommandOutputService.d.ts +7 -4
- package/lib/common/outputService/resumeCommandOutputService.js +8 -4
- package/lib/common/outputService/resumeCommandOutputService.js.map +1 -1
- package/lib/common/outputService/resumeOutputService.d.ts +7 -0
- package/lib/common/outputService/resumeOutputService.js +14 -0
- package/lib/common/outputService/resumeOutputService.js.map +1 -1
- package/lib/common/selectors/deployComponentsSelector.d.ts +1 -0
- package/lib/common/selectors/deployComponentsSelector.js +9 -1
- package/lib/common/selectors/deployComponentsSelector.js.map +1 -1
- package/lib/common/selectors/deploymentResultsSelector.d.ts +19 -1
- package/lib/common/selectors/deploymentResultsSelector.js +29 -1
- package/lib/common/selectors/deploymentResultsSelector.js.map +1 -1
- package/lib/common/selectors/pipelineStageSelector.d.ts +5 -0
- package/lib/common/selectors/pipelineStageSelector.js +13 -1
- package/lib/common/selectors/pipelineStageSelector.js.map +1 -1
- package/lib/common/selectors/validateDeploySelector.d.ts +6 -0
- package/lib/common/selectors/validateDeploySelector.js +22 -0
- package/lib/common/selectors/validateDeploySelector.js.map +1 -0
- package/lib/common/types.d.ts +10 -5
- package/lib/common/types.js +0 -6
- package/lib/common/types.js.map +1 -1
- package/lib/common/utils.d.ts +7 -1
- package/lib/common/utils.js +16 -3
- package/lib/common/utils.js.map +1 -1
- package/lib/streamer/processors/asyncOpStream.js +2 -1
- package/lib/streamer/processors/asyncOpStream.js.map +1 -1
- package/messages/commonFlags.md +2 -2
- package/messages/config.md +1 -1
- package/messages/deploy.output.md +18 -2
- package/messages/project.deploy.pipeline.quick.md +45 -0
- package/messages/project.deploy.pipeline.report.md +3 -3
- package/messages/project.deploy.pipeline.resume.md +1 -1
- package/messages/project.deploy.pipeline.start.md +5 -1
- package/messages/project.deploy.pipeline.validate.md +17 -0
- package/messages/promoteFlags.md +3 -3
- package/oclif.manifest.json +238 -9
- package/package.json +221 -115
- package/schemas/project-deploy-pipeline-quick.json +25 -0
- package/schemas/project-deploy-pipeline-resume.json +3 -3
- package/schemas/project-deploy-pipeline-start.json +3 -3
- package/schemas/project-deploy-pipeline-validate.json +25 -0
package/README.md
CHANGED
|
@@ -199,13 +199,15 @@ Resume watching a pipeline deploy operation.
|
|
|
199
199
|
|
|
200
200
|
```
|
|
201
201
|
USAGE
|
|
202
|
-
$ sf project deploy pipeline resume [--json] [-c <value>] [-i <value>] [-r] [-w <value>]
|
|
202
|
+
$ sf project deploy pipeline resume [--json] [-c <value>] [-i <value>] [-r] [-w <value>] [--concise | --verbose]
|
|
203
203
|
|
|
204
204
|
FLAGS
|
|
205
205
|
-c, --devops-center-username=<value> Username or alias of the DevOps Center org.
|
|
206
206
|
-i, --job-id=<value> Job ID of the pipeline deploy operation you want to resume.
|
|
207
207
|
-r, --use-most-recent Use the job ID of the most recent deploy operation.
|
|
208
208
|
-w, --wait=<minutes> Number of minutes to wait for command to complete and display results.
|
|
209
|
+
--concise Show concise output of the deploy result.
|
|
210
|
+
--verbose Show verbose output of the deploy result.
|
|
209
211
|
|
|
210
212
|
GLOBAL FLAGS
|
|
211
213
|
--json Format output as json.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import QuickPromotionCommand from '../../../../common/base/abstractQuick';
|
|
3
|
+
import { AsyncOperationResultJson, PromoteOptions } from '../../../../common';
|
|
4
|
+
export default class DeployPipelineQuick extends QuickPromotionCommand<typeof SfCommand> {
|
|
5
|
+
static readonly description: string;
|
|
6
|
+
static readonly summary: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly state = "beta";
|
|
9
|
+
protected baseCommand: string;
|
|
10
|
+
private readonly isUndeployedOnly;
|
|
11
|
+
run(): Promise<AsyncOperationResultJson>;
|
|
12
|
+
/**
|
|
13
|
+
* Computes the source stage Id for quick promotions. Quick promotions are allowed only
|
|
14
|
+
* in versioned promotions so source stage is previous stage.
|
|
15
|
+
*
|
|
16
|
+
* @returns: string. It is the source stage Id.
|
|
17
|
+
*/
|
|
18
|
+
protected getSourceStageId(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the promote option necessary to performs an undeployed only promotion.
|
|
21
|
+
*/
|
|
22
|
+
protected getPromoteOptions(): Partial<PromoteOptions>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
* Licensed under the BSD 3-Clause license.
|
|
7
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
const core_1 = require("@salesforce/core");
|
|
10
|
+
const abstractQuick_1 = require("../../../../common/base/abstractQuick");
|
|
11
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
12
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center', 'project.deploy.pipeline.quick');
|
|
13
|
+
class DeployPipelineQuick extends abstractQuick_1.default {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.baseCommand = 'project deploy pipeline';
|
|
17
|
+
this.isUndeployedOnly = true;
|
|
18
|
+
}
|
|
19
|
+
async run() {
|
|
20
|
+
return this.executeQuickPromotion();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Computes the source stage Id for quick promotions. Quick promotions are allowed only
|
|
24
|
+
* in versioned promotions so source stage is previous stage.
|
|
25
|
+
*
|
|
26
|
+
* @returns: string. It is the source stage Id.
|
|
27
|
+
*/
|
|
28
|
+
getSourceStageId() {
|
|
29
|
+
// for versioned promotions we always have a previous stage
|
|
30
|
+
const prevStages = this.getTargetStage().sf_devops__Pipeline_Stages__r;
|
|
31
|
+
return prevStages.records[0].Id;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the promote option necessary to performs an undeployed only promotion.
|
|
35
|
+
*/
|
|
36
|
+
getPromoteOptions() {
|
|
37
|
+
return { undeployedOnly: this.isUndeployedOnly };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = DeployPipelineQuick;
|
|
41
|
+
DeployPipelineQuick.description = messages.getMessage('description');
|
|
42
|
+
DeployPipelineQuick.summary = messages.getMessage('summary');
|
|
43
|
+
DeployPipelineQuick.examples = messages.getMessages('examples');
|
|
44
|
+
DeployPipelineQuick.state = 'beta';
|
|
45
|
+
//# sourceMappingURL=quick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quick.js","sourceRoot":"","sources":["../../../../../src/commands/project/deploy/pipeline/quick.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2CAA4C;AAE5C,yEAA0E;AAI1E,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,+BAA+B,CAAC,CAAC;AAE5G,MAAqB,mBAAoB,SAAQ,uBAAuC;IAAxF;;QAMY,gBAAW,GAAG,yBAAyB,CAAC;QACjC,qBAAgB,GAAG,IAAI,CAAC;IAwB3C,CAAC;IAtBQ,KAAK,CAAC,GAAG;QACd,OAAO,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACO,gBAAgB;QACxB,2DAA2D;QAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,6BAAuD,CAAC;QACjG,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACO,iBAAiB;QACzB,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnD,CAAC;;AA9BH,sCA+BC;AA9BwB,+BAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,2BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,4BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,yBAAK,GAAG,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import {
|
|
2
|
+
import { AsyncOperationResultJson } from '../../../../common';
|
|
3
3
|
import { ResumeCommand } from '../../../../common/base/abstractResume';
|
|
4
4
|
export default class DeployPipelineResume extends ResumeCommand<typeof SfCommand> {
|
|
5
5
|
static readonly summary: string;
|
|
@@ -7,5 +7,6 @@ export default class DeployPipelineResume extends ResumeCommand<typeof SfCommand
|
|
|
7
7
|
static readonly examples: string[];
|
|
8
8
|
static readonly state = "beta";
|
|
9
9
|
protected operationType: string;
|
|
10
|
-
|
|
10
|
+
protected baseCommand: string;
|
|
11
|
+
run(): Promise<AsyncOperationResultJson>;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../../src/commands/project/deploy/pipeline/resume.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA4C;AAG5C,2EAAuE;AAEvE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,gCAAgC,CAAC,CAAC;AAE7G,MAAqB,oBAAqB,SAAQ,8BAA+B;IAAjF;;QAMY,kBAAa,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../../src/commands/project/deploy/pipeline/resume.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA4C;AAG5C,2EAAuE;AAEvE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,gCAAgC,CAAC,CAAC;AAE7G,MAAqB,oBAAqB,SAAQ,8BAA+B;IAAjF;;QAMY,kBAAa,GAAG,YAAY,CAAC;QAC7B,gBAAW,GAAG,yBAAyB,CAAC;IAKpD,CAAC;IAHQ,KAAK,CAAC,GAAG;QACd,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;;AAXH,uCAYC;AAXwB,4BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,gCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,6BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,0BAAK,GAAG,MAAM,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { PromoteCommand } from '../../../../common/base/abstractPromote';
|
|
3
|
-
import { PromoteOptions
|
|
3
|
+
import { PromoteOptions } from '../../../../common';
|
|
4
|
+
import { AsyncOperationResultJson } from '../../../../common/types';
|
|
4
5
|
/**
|
|
5
6
|
* Contains the logic to execute the sf project deploy pipeline start command.
|
|
6
7
|
*/
|
|
@@ -9,8 +10,9 @@ export default class DeployPipeline extends PromoteCommand<typeof SfCommand> {
|
|
|
9
10
|
static readonly description: string;
|
|
10
11
|
static readonly examples: string[];
|
|
11
12
|
static readonly state = "beta";
|
|
13
|
+
protected baseCommand: string;
|
|
12
14
|
private readonly isUndeployedOnly;
|
|
13
|
-
run(): Promise<
|
|
15
|
+
run(): Promise<AsyncOperationResultJson>;
|
|
14
16
|
/**
|
|
15
17
|
* Computes the source stage Id for deployOnly promotions. If the given stage has a previous stage
|
|
16
18
|
* then the source stage is the previous stage. If not the it means this is the
|
|
@@ -17,6 +17,7 @@ const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center'
|
|
|
17
17
|
class DeployPipeline extends abstractPromote_1.PromoteCommand {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
|
+
this.baseCommand = 'project deploy pipeline';
|
|
20
21
|
this.isUndeployedOnly = true;
|
|
21
22
|
}
|
|
22
23
|
async run() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../../src/commands/project/deploy/pipeline/start.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA4C;AAE5C,6EAAyE;AAEzE,4DAAwD;
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../../src/commands/project/deploy/pipeline/start.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA4C;AAE5C,6EAAyE;AAEzE,4DAAwD;AAGxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,+BAA+B,CAAC,CAAC;AAE5G;;GAEG;AACH,MAAqB,cAAe,SAAQ,gCAAgC;IAA5E;;QAKY,gBAAW,GAAG,yBAAyB,CAAC;QACjC,qBAAgB,GAAG,IAAI,CAAC;IA0B3C,CAAC;IAxBQ,KAAK,CAAC,GAAG;QACd,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACO,gBAAgB;QACxB,MAAM,WAAW,GAAkB,IAAI,CAAC,cAAc,EAAE,CAAC;QACzD,OAAO,WAAW,CAAC,6BAA6B;YAC9C,CAAC,CAAC,WAAW,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;YACzD,CAAC,CAAC,oBAAQ,CAAC;IACf,CAAC;IAED;;OAEG;IACO,iBAAiB;QACzB,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnD,CAAC;;AA/BH,iCAgCC;AA/BwB,sBAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,0BAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,uBAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,oBAAK,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PromoteOptions } from '../../../../common';
|
|
2
|
+
import { AsyncOperationResultJson } from '../../../../common/types';
|
|
3
|
+
import DeployPipeline from './start';
|
|
4
|
+
/**
|
|
5
|
+
* Contains the logic to execute the sf project deploy pipeline validate command.
|
|
6
|
+
*/
|
|
7
|
+
export default class ValidateDeployPipeline extends DeployPipeline {
|
|
8
|
+
static readonly summary: string;
|
|
9
|
+
static readonly description: string;
|
|
10
|
+
static readonly examples: string[];
|
|
11
|
+
static readonly state = "beta";
|
|
12
|
+
protected baseCommand: string;
|
|
13
|
+
private readonly isCheckDeploy;
|
|
14
|
+
run(): Promise<AsyncOperationResultJson>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the promote option necessary to perform a validate deploy
|
|
17
|
+
*/
|
|
18
|
+
protected getPromoteOptions(): Partial<PromoteOptions>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const core_1 = require("@salesforce/core");
|
|
10
|
+
const start_1 = require("./start");
|
|
11
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
12
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center', 'project.deploy.pipeline.validate');
|
|
13
|
+
/**
|
|
14
|
+
* Contains the logic to execute the sf project deploy pipeline validate command.
|
|
15
|
+
*/
|
|
16
|
+
class ValidateDeployPipeline extends start_1.default {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.baseCommand = 'project deploy pipeline';
|
|
20
|
+
this.isCheckDeploy = true;
|
|
21
|
+
}
|
|
22
|
+
async run() {
|
|
23
|
+
return this.executePromotion();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the promote option necessary to perform a validate deploy
|
|
27
|
+
*/
|
|
28
|
+
getPromoteOptions() {
|
|
29
|
+
return { ...super.getPromoteOptions(), checkDeploy: this.isCheckDeploy };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = ValidateDeployPipeline;
|
|
33
|
+
ValidateDeployPipeline.summary = messages.getMessage('summary');
|
|
34
|
+
ValidateDeployPipeline.description = messages.getMessage('description');
|
|
35
|
+
ValidateDeployPipeline.examples = messages.getMessages('examples');
|
|
36
|
+
ValidateDeployPipeline.state = 'beta';
|
|
37
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../src/commands/project/deploy/pipeline/validate.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA4C;AAG5C,mCAAqC;AAErC,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,kCAAkC,CAAC,CAAC;AAE/G;;GAEG;AACH,MAAqB,sBAAuB,SAAQ,eAAc;IAAlE;;QAKY,gBAAW,GAAG,yBAAyB,CAAC;QACjC,kBAAa,GAAG,IAAI,CAAC;IAYxC,CAAC;IAVQ,KAAK,CAAC,GAAG;QACd,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB;QACzB,OAAO,EAAE,GAAG,KAAK,CAAC,iBAAiB,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;IAC3E,CAAC;;AAjBH,yCAkBC;AAjBwB,8BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,kCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,+BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,4BAAK,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Org, SfError } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { Duration } from '@salesforce/kit';
|
|
4
|
+
import { AsyncOperationResultJson } from '../types';
|
|
5
|
+
import { PromoteOutputService } from '../outputService';
|
|
6
|
+
export declare abstract class AsyncCommand extends SfCommand<AsyncOperationResultJson> {
|
|
7
|
+
protected targetOrg: Org;
|
|
8
|
+
private asyncOperationId;
|
|
9
|
+
private outputService;
|
|
10
|
+
protected abstract baseCommand: string;
|
|
11
|
+
protected setAsyncOperationId(aorId: string): void;
|
|
12
|
+
protected setOutputService(service: PromoteOutputService): void;
|
|
13
|
+
/**
|
|
14
|
+
* Method to handle an in progress async operation. It stores the AOR in cache,
|
|
15
|
+
* then monitors the state of it and print messages if needed. Finally returns the
|
|
16
|
+
* final state of the operation.
|
|
17
|
+
*/
|
|
18
|
+
protected monitorOperation(isAsync: boolean, wait: Duration): Promise<AsyncOperationResultJson>;
|
|
19
|
+
/**
|
|
20
|
+
* Default function for catching commands errors.
|
|
21
|
+
*
|
|
22
|
+
* @param error
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
protected catch(error: Error | SfError): Promise<SfCommand.Error>;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* Stores the AOR Id in cache.
|
|
29
|
+
*/
|
|
30
|
+
protected cacheOperation(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* Executes a query to get the state of the AOR record.
|
|
34
|
+
*/
|
|
35
|
+
private getOperationState;
|
|
36
|
+
/**
|
|
37
|
+
* Watch changes in the state of the AOR.
|
|
38
|
+
*
|
|
39
|
+
* @param wait
|
|
40
|
+
*/
|
|
41
|
+
private startMonitoring;
|
|
42
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncCommand = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
* Licensed under the BSD 3-Clause license.
|
|
8
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
+
*/
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
+
const deployPipelineCache_1 = require("../deployPipelineCache");
|
|
13
|
+
const types_1 = require("../types");
|
|
14
|
+
const common_1 = require("../../common");
|
|
15
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
17
|
+
class AsyncCommand extends sf_plugins_core_1.SfCommand {
|
|
18
|
+
setAsyncOperationId(aorId) {
|
|
19
|
+
this.asyncOperationId = aorId;
|
|
20
|
+
}
|
|
21
|
+
setOutputService(service) {
|
|
22
|
+
this.outputService = service;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Method to handle an in progress async operation. It stores the AOR in cache,
|
|
26
|
+
* then monitors the state of it and print messages if needed. Finally returns the
|
|
27
|
+
* final state of the operation.
|
|
28
|
+
*/
|
|
29
|
+
async monitorOperation(isAsync, wait) {
|
|
30
|
+
await this.cacheOperation();
|
|
31
|
+
this.outputService.setAorId(this.asyncOperationId);
|
|
32
|
+
this.outputService.printAorId();
|
|
33
|
+
this.outputService.printOpSummary();
|
|
34
|
+
if (isAsync) {
|
|
35
|
+
return this.getOperationState();
|
|
36
|
+
}
|
|
37
|
+
await this.startMonitoring(wait);
|
|
38
|
+
if (this.outputService.getStatus() === types_1.AsyncOperationStatus.Completed) {
|
|
39
|
+
this.outputService.displayEndResults();
|
|
40
|
+
}
|
|
41
|
+
return this.getOperationState();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Default function for catching commands errors.
|
|
45
|
+
*
|
|
46
|
+
* @param error
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
catch(error) {
|
|
50
|
+
if (error.name.includes('GenericTimeoutError')) {
|
|
51
|
+
const err = messages.createError('error.ClientTimeout', [this.config.bin, this.baseCommand]);
|
|
52
|
+
return super.catch({ ...error, name: err.name, message: err.message, code: err.code });
|
|
53
|
+
}
|
|
54
|
+
return super.catch(error);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* Stores the AOR Id in cache.
|
|
59
|
+
*/
|
|
60
|
+
async cacheOperation() {
|
|
61
|
+
await deployPipelineCache_1.DeployPipelineCache.set(this.asyncOperationId, {});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* Executes a query to get the state of the AOR record.
|
|
66
|
+
*/
|
|
67
|
+
async getOperationState() {
|
|
68
|
+
const asyncJob = await (0, common_1.fetchAsyncOperationResult)(this.targetOrg.getConnection(), this.asyncOperationId);
|
|
69
|
+
return {
|
|
70
|
+
jobId: this.asyncOperationId,
|
|
71
|
+
status: asyncJob.sf_devops__Status__c,
|
|
72
|
+
message: asyncJob.sf_devops__Message__c,
|
|
73
|
+
errorDetails: asyncJob.sf_devops__Error_Details__c,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Watch changes in the state of the AOR.
|
|
78
|
+
*
|
|
79
|
+
* @param wait
|
|
80
|
+
*/
|
|
81
|
+
async startMonitoring(wait) {
|
|
82
|
+
const asyncJob = await (0, common_1.fetchAsyncOperationResult)(this.targetOrg.getConnection(), this.asyncOperationId);
|
|
83
|
+
if (asyncJob.sf_devops__Status__c === undefined ||
|
|
84
|
+
asyncJob.sf_devops__Status__c === types_1.AsyncOperationStatus.InProgress) {
|
|
85
|
+
const streamer = (0, common_1.getAsyncOperationStreamer)(this.targetOrg, wait, this.asyncOperationId, this.outputService);
|
|
86
|
+
await streamer.monitor();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.outputService.printAorStatus(asyncJob);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.AsyncCommand = AsyncCommand;
|
|
94
|
+
//# sourceMappingURL=abstractAsyncOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstractAsyncOperation.js","sourceRoot":"","sources":["../../../src/common/base/abstractAsyncOperation.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAA0D;AAC1D,iEAAwD;AAExD,gEAA6D;AAE7D,oCAAgG;AAChG,yCAAoF;AAGpF,eAAQ,CAAC,uB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;IACH,CAAC;CACF;AArGD,oCAqGC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Org
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
2
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
3
|
import { Interfaces } from '@oclif/core';
|
|
4
|
-
import { PipelineStage, PromoteOptions
|
|
4
|
+
import { PipelineStage, PromoteOptions } from '..';
|
|
5
|
+
import { AsyncOperationResultJson } from '../../common';
|
|
6
|
+
import { AsyncCommand } from './abstractAsyncOperation';
|
|
5
7
|
export type Flags<T extends typeof SfCommand> = Interfaces.InferredFlags<(typeof PromoteCommand)['baseFlags'] & T['flags']>;
|
|
6
|
-
export declare abstract class PromoteCommand<T extends typeof SfCommand> extends
|
|
8
|
+
export declare abstract class PromoteCommand<T extends typeof SfCommand> extends AsyncCommand {
|
|
7
9
|
static baseFlags: {
|
|
8
10
|
'branch-name': Interfaces.OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
11
|
'bundle-version-name': Interfaces.OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
@@ -22,36 +24,26 @@ export declare abstract class PromoteCommand<T extends typeof SfCommand> extends
|
|
|
22
24
|
private sourceStageId;
|
|
23
25
|
private deployOptions;
|
|
24
26
|
private numRetries409;
|
|
25
|
-
private outputService;
|
|
26
27
|
init(): Promise<void>;
|
|
27
|
-
protected executePromotion(): Promise<
|
|
28
|
+
protected executePromotion(): Promise<AsyncOperationResultJson>;
|
|
28
29
|
/**
|
|
29
30
|
*
|
|
30
31
|
* Sends an Http request to the target org to initiate a promotion.
|
|
31
32
|
*
|
|
32
|
-
* @param doceOrg target org.
|
|
33
33
|
* @returns Aor Id of promote operation.
|
|
34
34
|
*/
|
|
35
|
-
protected requestPromotionFlow(
|
|
35
|
+
protected requestPromotionFlow(): Promise<string>;
|
|
36
36
|
/**
|
|
37
37
|
*
|
|
38
38
|
* Sends an Http request to the target org to initiate a promotion.
|
|
39
39
|
* If it gets a 409/Conflict it will retry till the request successes,
|
|
40
40
|
* gets a differenct error or run out of retry attempts.
|
|
41
41
|
*
|
|
42
|
-
* @param doceOrg target org.
|
|
43
42
|
* @param numRetries Amount of remaining retry attempts.
|
|
44
43
|
* @returns Aor Id of promote operation
|
|
45
44
|
*/
|
|
46
|
-
protected retryRequestPromotion(
|
|
45
|
+
protected retryRequestPromotion(numRetries: number): Promise<string>;
|
|
47
46
|
protected getTargetStage(): PipelineStage;
|
|
48
|
-
/**
|
|
49
|
-
* Default function for catching commands errors.
|
|
50
|
-
*
|
|
51
|
-
* @param error
|
|
52
|
-
* @returns
|
|
53
|
-
*/
|
|
54
|
-
protected catch(error: Error | SfError): Promise<SfCommand.Error>;
|
|
55
47
|
private requestPromotion;
|
|
56
48
|
private buildPromoteOptions;
|
|
57
49
|
/**
|
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PromoteCommand = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright (c) 2023, salesforce.com, inc.
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
* Licensed under the BSD 3-Clause license.
|
|
8
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
-
*/
|
|
10
|
-
const core_1 = require("@salesforce/core");
|
|
11
|
-
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
-
const deployPipelineCache_1 = require("../deployPipelineCache");
|
|
13
|
-
const asyncOpStream_1 = require("../../streamer/processors/asyncOpStream");
|
|
14
4
|
const __1 = require("..");
|
|
15
5
|
const flags_1 = require("../flags/flags");
|
|
16
6
|
const promoteFlags_1 = require("../flags/promote/promoteFlags");
|
|
17
7
|
const constants_1 = require("../constants");
|
|
18
|
-
const types_1 = require("../types");
|
|
19
|
-
const utils_1 = require("../utils");
|
|
20
8
|
const outputService_1 = require("../outputService");
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
class PromoteCommand extends
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const abstractAsyncOperation_1 = require("./abstractAsyncOperation");
|
|
11
|
+
class PromoteCommand extends abstractAsyncOperation_1.AsyncCommand {
|
|
24
12
|
constructor() {
|
|
25
13
|
super(...arguments);
|
|
26
14
|
this.numRetries409 = 50; // this is the number of times we retry if we get a http-409-Conflict response
|
|
@@ -34,50 +22,26 @@ class PromoteCommand extends sf_plugins_core_1.SfCommand {
|
|
|
34
22
|
});
|
|
35
23
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
36
24
|
this.flags = flags;
|
|
37
|
-
this.
|
|
25
|
+
this.targetOrg = this.flags['devops-center-username'];
|
|
26
|
+
this.setOutputService(new outputService_1.OutputServiceFactory().forDeployment(this.flags, this.targetOrg.getConnection()));
|
|
38
27
|
}
|
|
39
28
|
async executePromotion() {
|
|
40
29
|
(0, __1.validateTestFlags)(this.flags['test-level'], this.flags.tests);
|
|
41
|
-
|
|
42
|
-
this.targetStage = await (0, __1.fetchAndValidatePipelineStage)(doceOrg, this.flags['devops-center-project-name'], this.flags['branch-name']);
|
|
30
|
+
this.targetStage = await (0, __1.fetchAndValidatePipelineStage)(this.targetOrg, this.flags['devops-center-project-name'], this.flags['branch-name']);
|
|
43
31
|
this.sourceStageId = this.getSourceStageId();
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
this.outputService.printAorId();
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/await-thenable
|
|
48
|
-
await this.outputService.printOpSummary();
|
|
49
|
-
await deployPipelineCache_1.DeployPipelineCache.set(asyncOperationId, {});
|
|
50
|
-
if (this.flags.async) {
|
|
51
|
-
return {
|
|
52
|
-
jobId: asyncOperationId,
|
|
53
|
-
status: types_1.AsyncOperationStatus.InProgress,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const doceMonitor = new asyncOpStream_1.default(doceOrg, this.flags.wait, asyncOperationId, this.outputService);
|
|
57
|
-
await doceMonitor.monitor();
|
|
58
|
-
if (this.outputService.getStatus() === types_1.AsyncOperationStatus.Completed) {
|
|
59
|
-
await this.outputService.displayEndResults();
|
|
60
|
-
}
|
|
61
|
-
// get final state of the async job
|
|
62
|
-
const asyncJob = await (0, utils_1.fetchAsyncOperationResult)(doceOrg.getConnection(), asyncOperationId);
|
|
63
|
-
return {
|
|
64
|
-
jobId: asyncOperationId,
|
|
65
|
-
status: asyncJob.sf_devops__Status__c,
|
|
66
|
-
message: asyncJob.sf_devops__Message__c,
|
|
67
|
-
errorDetails: asyncJob.sf_devops__Error_Details__c,
|
|
68
|
-
};
|
|
32
|
+
this.setAsyncOperationId(await this.requestPromotionFlow());
|
|
33
|
+
return this.monitorOperation(this.flags.async, this.flags.wait);
|
|
69
34
|
}
|
|
70
35
|
/**
|
|
71
36
|
*
|
|
72
37
|
* Sends an Http request to the target org to initiate a promotion.
|
|
73
38
|
*
|
|
74
|
-
* @param doceOrg target org.
|
|
75
39
|
* @returns Aor Id of promote operation.
|
|
76
40
|
*/
|
|
77
|
-
async requestPromotionFlow(
|
|
41
|
+
async requestPromotionFlow() {
|
|
78
42
|
let spinnerStarted = false;
|
|
79
43
|
try {
|
|
80
|
-
return await this.requestPromotion(
|
|
44
|
+
return await this.requestPromotion();
|
|
81
45
|
}
|
|
82
46
|
catch (error) {
|
|
83
47
|
const err = error;
|
|
@@ -85,7 +49,7 @@ class PromoteCommand extends sf_plugins_core_1.SfCommand {
|
|
|
85
49
|
if (err.errorCode === constants_1.HTTP_CONFLICT_CODE) {
|
|
86
50
|
this.spinner.start('Synchronization of source control system events in progress');
|
|
87
51
|
spinnerStarted = true;
|
|
88
|
-
return await this.retryRequestPromotion(
|
|
52
|
+
return await this.retryRequestPromotion(this.numRetries409);
|
|
89
53
|
}
|
|
90
54
|
throw error;
|
|
91
55
|
}
|
|
@@ -100,19 +64,20 @@ class PromoteCommand extends sf_plugins_core_1.SfCommand {
|
|
|
100
64
|
* If it gets a 409/Conflict it will retry till the request successes,
|
|
101
65
|
* gets a differenct error or run out of retry attempts.
|
|
102
66
|
*
|
|
103
|
-
* @param doceOrg target org.
|
|
104
67
|
* @param numRetries Amount of remaining retry attempts.
|
|
105
68
|
* @returns Aor Id of promote operation
|
|
106
69
|
*/
|
|
107
|
-
async retryRequestPromotion(
|
|
70
|
+
async retryRequestPromotion(numRetries) {
|
|
108
71
|
try {
|
|
109
|
-
|
|
72
|
+
// Sleep 2 seconds before requesting promotion again.
|
|
73
|
+
await (0, utils_1.sleep)(2000);
|
|
74
|
+
return await this.requestPromotion();
|
|
110
75
|
}
|
|
111
76
|
catch (error) {
|
|
112
77
|
const err = error;
|
|
113
78
|
// if we still get a 409 error and haven't run out of retry attempts then retry again
|
|
114
79
|
if (err.errorCode === constants_1.HTTP_CONFLICT_CODE && numRetries > 1) {
|
|
115
|
-
return this.retryRequestPromotion(
|
|
80
|
+
return this.retryRequestPromotion(numRetries - 1);
|
|
116
81
|
}
|
|
117
82
|
throw error;
|
|
118
83
|
}
|
|
@@ -120,23 +85,7 @@ class PromoteCommand extends sf_plugins_core_1.SfCommand {
|
|
|
120
85
|
getTargetStage() {
|
|
121
86
|
return this.targetStage;
|
|
122
87
|
}
|
|
123
|
-
|
|
124
|
-
* Default function for catching commands errors.
|
|
125
|
-
*
|
|
126
|
-
* @param error
|
|
127
|
-
* @returns
|
|
128
|
-
*/
|
|
129
|
-
catch(error) {
|
|
130
|
-
if (error.name?.includes('GenericTimeoutError')) {
|
|
131
|
-
const err = messages.createError('error.ClientTimeout', [
|
|
132
|
-
this.config.bin,
|
|
133
|
-
this.id?.split(':').slice(0, -1).join(' '),
|
|
134
|
-
]);
|
|
135
|
-
return super.catch({ ...error, name: err.name, message: err.message, code: err.code });
|
|
136
|
-
}
|
|
137
|
-
return super.catch(error);
|
|
138
|
-
}
|
|
139
|
-
async requestPromotion(targetOrg) {
|
|
88
|
+
async requestPromotion() {
|
|
140
89
|
this.buildPromoteOptions();
|
|
141
90
|
const req = {
|
|
142
91
|
method: 'POST',
|
|
@@ -146,7 +95,8 @@ class PromoteCommand extends sf_plugins_core_1.SfCommand {
|
|
|
146
95
|
promoteOptions: this.deployOptions,
|
|
147
96
|
}),
|
|
148
97
|
};
|
|
149
|
-
|
|
98
|
+
const response = await this.targetOrg.getConnection().request(req);
|
|
99
|
+
return response.jobId;
|
|
150
100
|
}
|
|
151
101
|
buildPromoteOptions() {
|
|
152
102
|
this.deployOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractPromote.js","sourceRoot":"","sources":["../../../src/common/base/abstractPromote.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"abstractPromote.js","sourceRoot":"","sources":["../../../src/common/base/abstractPromote.ts"],"names":[],"mappings":";;;AAUA,0BAAqG;AACrG,0CAAsG;AACtG,gEAOuC;AACvC,4CAAyE;AAEzE,oDAAwD;AACxD,oCAAiC;AACjC,qEAAwD;AAMxD,MAAsB,cAA2C,SAAQ,qCAAY;IAArF;;QAoBU,kBAAa,GAAG,EAAE,CAAC,CAAC,8EAA8E;IAuH5G,CAAC;IArHQ,KAAK,CAAC,IAAI;QACf,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,mEAAmE;QACnE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC;YACjC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACtB,SAAS,EAAG,KAAK,CAAC,IAA8B,CAAC,SAAS;SAC3D,CAAC,CAAC;QACH,mEAAmE;QACnE,IAAI,CAAC,KAAK,GAAG,KAAiB,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAQ,CAAC;QAC7D,IAAI,CAAC,gBAAgB,CAAC,IAAI,oCAAoB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAA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