@salesforce/plugin-devops-center 1.4.0 → 2.0.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/README.md +592 -55
- package/lib/commands/devops/pipeline/{activate.d.ts → get.d.ts} +3 -3
- package/lib/commands/devops/pipeline/get.js +81 -0
- package/lib/commands/devops/pipeline/get.js.map +1 -0
- package/lib/commands/devops/pipeline/list.d.ts +13 -0
- package/lib/commands/devops/pipeline/list.js +58 -0
- package/lib/commands/devops/pipeline/list.js.map +1 -0
- package/lib/commands/devops/pipeline/project/delete.d.ts +15 -0
- package/lib/commands/devops/pipeline/project/delete.js +71 -0
- package/lib/commands/devops/pipeline/project/delete.js.map +1 -0
- package/lib/commands/devops/pipeline/stage/delete.d.ts +15 -0
- package/lib/commands/devops/pipeline/stage/delete.js +69 -0
- package/lib/commands/devops/pipeline/stage/delete.js.map +1 -0
- package/lib/commands/devops/pipeline/update.d.ts +18 -0
- package/lib/commands/devops/pipeline/update.js +126 -0
- package/lib/commands/devops/pipeline/update.js.map +1 -0
- package/lib/commands/devops/project/update.d.ts +17 -0
- package/lib/commands/devops/project/update.js +86 -0
- package/lib/commands/devops/project/update.js.map +1 -0
- package/lib/commands/devops/promote.d.ts +24 -0
- package/lib/commands/devops/promote.js +148 -0
- package/lib/commands/devops/promote.js.map +1 -0
- package/lib/commands/devops/promotion/complete.d.ts +20 -0
- package/lib/commands/devops/promotion/complete.js +112 -0
- package/lib/commands/devops/promotion/complete.js.map +1 -0
- package/lib/commands/devops/request/status.d.ts +14 -0
- package/lib/commands/devops/request/status.js +71 -0
- package/lib/commands/devops/request/status.js.map +1 -0
- package/lib/commands/devops/{pull-request → review}/create.d.ts +1 -1
- package/lib/commands/devops/{pull-request → review}/create.js +3 -3
- package/lib/commands/devops/review/create.js.map +1 -0
- package/lib/commands/devops/stage/environment/add.js +2 -0
- package/lib/commands/devops/stage/environment/add.js.map +1 -1
- package/lib/commands/devops/stage/environment/delete.d.ts +15 -0
- package/lib/commands/devops/{pipeline/activate.js → stage/environment/delete.js} +18 -30
- package/lib/commands/devops/stage/environment/delete.js.map +1 -0
- package/lib/commands/devops/work-item/combine.d.ts +15 -0
- package/lib/commands/devops/work-item/combine.js +109 -0
- package/lib/commands/devops/work-item/combine.js.map +1 -0
- package/lib/commands/devops/work-item/prepare.d.ts +14 -0
- package/lib/commands/devops/work-item/prepare.js +98 -0
- package/lib/commands/devops/work-item/prepare.js.map +1 -0
- package/lib/common/flags/promote/promoteFlags.d.ts +1 -0
- package/lib/common/flags/promote/promoteFlags.js +5 -0
- package/lib/common/flags/promote/promoteFlags.js.map +1 -1
- package/lib/common/outputService/aorOutputService.js +4 -4
- package/lib/common/outputService/aorOutputService.js.map +1 -1
- package/lib/common/outputService/outputUtils.js +1 -2
- package/lib/common/outputService/outputUtils.js.map +1 -1
- package/lib/common/selectors/asyncOperationResultsSelector.js +3 -1
- package/lib/common/selectors/asyncOperationResultsSelector.js.map +1 -1
- package/lib/common/selectors/deployComponentsSelector.js +5 -6
- package/lib/common/selectors/deployComponentsSelector.js.map +1 -1
- package/lib/common/selectors/deployProgressSummarySelector.js +3 -1
- package/lib/common/selectors/deployProgressSummarySelector.js.map +1 -1
- package/lib/common/selectors/deploymentResultsSelector.js +10 -6
- package/lib/common/selectors/deploymentResultsSelector.js.map +1 -1
- package/lib/common/selectors/environmentSelector.js +4 -2
- package/lib/common/selectors/environmentSelector.js.map +1 -1
- package/lib/common/selectors/namedCredentialSelector.js +2 -1
- package/lib/common/selectors/namedCredentialSelector.js.map +1 -1
- package/lib/common/selectors/pipelineStageSelector.js +5 -3
- package/lib/common/selectors/pipelineStageSelector.js.map +1 -1
- package/lib/common/selectors/validateDeploySelector.js +3 -1
- package/lib/common/selectors/validateDeploySelector.js.map +1 -1
- package/lib/common/selectors/workItemSelector.js +4 -1
- package/lib/common/selectors/workItemSelector.js.map +1 -1
- package/lib/utils/activatePipeline.d.ts +13 -4
- package/lib/utils/activatePipeline.js +7 -6
- package/lib/utils/activatePipeline.js.map +1 -1
- package/lib/utils/attachProject.js +2 -0
- package/lib/utils/attachProject.js.map +1 -1
- package/lib/utils/combineWorkItems.d.ts +20 -0
- package/lib/utils/combineWorkItems.js +42 -0
- package/lib/utils/combineWorkItems.js.map +1 -0
- package/lib/utils/createPullRequest.js +2 -1
- package/lib/utils/createPullRequest.js.map +1 -1
- package/lib/utils/deletePipelineStage.d.ts +12 -0
- package/lib/utils/deletePipelineStage.js +41 -0
- package/lib/utils/deletePipelineStage.js.map +1 -0
- package/lib/utils/deleteStageEnvironment.d.ts +8 -0
- package/lib/utils/deleteStageEnvironment.js +33 -0
- package/lib/utils/deleteStageEnvironment.js.map +1 -0
- package/lib/utils/deployStage.d.ts +29 -0
- package/lib/utils/deployStage.js +68 -0
- package/lib/utils/deployStage.js.map +1 -0
- package/lib/utils/detachProject.d.ts +8 -0
- package/lib/utils/detachProject.js +37 -0
- package/lib/utils/detachProject.js.map +1 -0
- package/lib/utils/getPipeline.d.ts +27 -0
- package/lib/utils/getPipeline.js +66 -0
- package/lib/utils/getPipeline.js.map +1 -0
- package/lib/utils/getRequestStatus.d.ts +10 -0
- package/lib/utils/getRequestStatus.js +32 -0
- package/lib/utils/getRequestStatus.js.map +1 -0
- package/lib/utils/listPipelines.d.ts +11 -0
- package/lib/utils/listPipelines.js +20 -0
- package/lib/utils/listPipelines.js.map +1 -0
- package/lib/utils/pipelineUtils.js +3 -0
- package/lib/utils/pipelineUtils.js.map +1 -1
- package/lib/utils/prepareWorkItem.d.ts +25 -0
- package/lib/utils/prepareWorkItem.js +55 -0
- package/lib/utils/prepareWorkItem.js.map +1 -0
- package/lib/utils/promoteStage.d.ts +21 -0
- package/lib/utils/promoteStage.js +46 -0
- package/lib/utils/promoteStage.js.map +1 -0
- package/lib/utils/soqlUtils.d.ts +23 -0
- package/lib/utils/soqlUtils.js +63 -0
- package/lib/utils/soqlUtils.js.map +1 -0
- package/lib/utils/updateProject.d.ts +17 -0
- package/lib/utils/updateProject.js +41 -0
- package/lib/utils/updateProject.js.map +1 -0
- package/lib/utils/updateWorkItem.js +3 -1
- package/lib/utils/updateWorkItem.js.map +1 -1
- package/lib/utils/workItems.js +2 -0
- package/lib/utils/workItems.js.map +1 -1
- package/messages/devops.pipeline.get.md +17 -0
- package/messages/devops.pipeline.list.md +13 -0
- package/messages/devops.pipeline.project.delete.md +25 -0
- package/messages/devops.pipeline.stage.delete.md +25 -0
- package/messages/devops.pipeline.update.md +47 -0
- package/messages/devops.project.update.md +45 -0
- package/messages/devops.promote.md +61 -0
- package/messages/devops.promotion.complete.md +47 -0
- package/messages/devops.request.status.md +21 -0
- package/messages/devops.stage.environment.delete.md +29 -0
- package/messages/devops.work-item.combine.md +39 -0
- package/messages/devops.work-item.prepare.md +27 -0
- package/npm-shrinkwrap.json +290 -272
- package/oclif.lock +81 -24
- package/oclif.manifest.json +1176 -242
- package/package.json +23 -11
- package/schemas/devops-pipeline-get.json +98 -0
- package/schemas/devops-pipeline-list.json +38 -0
- package/schemas/devops-pipeline-project-delete.json +25 -0
- package/schemas/devops-pipeline-stage-delete.json +25 -0
- package/schemas/{devops-pipeline-activate.json → devops-pipeline-update.json} +5 -2
- package/schemas/devops-project-update.json +31 -0
- package/schemas/devops-promote.json +28 -0
- package/schemas/devops-promotion-complete.json +34 -0
- package/schemas/devops-request-status.json +31 -0
- package/schemas/devops-stage-environment-delete.json +25 -0
- package/schemas/devops-work__item-combine.json +25 -0
- package/schemas/devops-work__item-prepare.json +25 -0
- package/lib/commands/devops/pipeline/activate.js.map +0 -1
- package/lib/commands/devops/pull-request/create.js.map +0 -1
- package/messages/devops.pipeline.activate.md +0 -29
- /package/messages/{devops.pull-request.create.md → devops.review.create.md} +0 -0
- /package/schemas/{devops-pull__request-create.json → devops-review-create.json} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Org } from '@salesforce/core';
|
|
2
2
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
-
import {
|
|
4
|
-
export default class
|
|
3
|
+
import { PipelineGetResult } from '../../../utils/getPipeline.js';
|
|
4
|
+
export default class DevopsPipelineGet extends SfCommand<PipelineGetResult> {
|
|
5
5
|
static readonly summary: string;
|
|
6
6
|
static readonly description: string;
|
|
7
7
|
static readonly examples: string[];
|
|
@@ -10,5 +10,5 @@ export default class DevopsPipelineActivate extends SfCommand<ActivatePipelineRe
|
|
|
10
10
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
|
-
run(): Promise<
|
|
13
|
+
run(): Promise<PipelineGetResult>;
|
|
14
14
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { getPipeline } from '../../../utils/getPipeline.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.get');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsPipelineGet extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
'pipeline-id': Flags.salesforceId({
|
|
30
|
+
summary: messages.getMessage('flags.pipeline-id.summary'),
|
|
31
|
+
char: 'i',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
async run() {
|
|
36
|
+
const { flags } = await this.parse(DevopsPipelineGet);
|
|
37
|
+
const org = flags['target-org'];
|
|
38
|
+
const connection = org.getConnection(flags['api-version']);
|
|
39
|
+
let result;
|
|
40
|
+
try {
|
|
41
|
+
result = await getPipeline(connection, flags['pipeline-id']);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
45
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
46
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
this.styledHeader(`Pipeline: ${result.name}`);
|
|
51
|
+
this.log(` ID: ${result.id}`);
|
|
52
|
+
this.log(` Description: ${result.description ?? ''}`);
|
|
53
|
+
this.log(` Active: ${result.isActive}`);
|
|
54
|
+
if (result.stages.length > 0) {
|
|
55
|
+
this.log('');
|
|
56
|
+
this.styledHeader('Stages');
|
|
57
|
+
this.table({
|
|
58
|
+
data: result.stages.map((s) => ({
|
|
59
|
+
ID: s.id,
|
|
60
|
+
Name: s.name ?? '',
|
|
61
|
+
'Next Stage ID': s.nextStageId ?? '',
|
|
62
|
+
Branch: s.branchName ?? '',
|
|
63
|
+
Repository: s.repositoryOwner && s.repositoryName ? `${s.repositoryOwner}/${s.repositoryName}` : s.repositoryName ?? '',
|
|
64
|
+
Environment: s.environment?.name ?? '',
|
|
65
|
+
'Environment ID': s.environment?.id ?? '',
|
|
66
|
+
})),
|
|
67
|
+
columns: ['ID', 'Name', 'Next Stage ID', 'Branch', 'Repository', 'Environment', 'Environment ID'],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (result.connectedProjects.length > 0) {
|
|
71
|
+
this.log('');
|
|
72
|
+
this.styledHeader('Connected Projects');
|
|
73
|
+
this.table({
|
|
74
|
+
data: result.connectedProjects.map((p) => ({ ID: p.id, Name: p.name ?? '' })),
|
|
75
|
+
columns: ['ID', 'Name'],
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/devops/pipeline/get.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAqB,MAAM,+BAA+B,CAAC;AAE/E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,qBAAqB,CAAC,CAAC;AAClG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAA4B;IAClE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD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C;QAED,IAAI,MAAM,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC;gBACT,IAAI,EAAE,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC7E,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC;aACxB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { PipelineListResult } from '../../../utils/listPipelines.js';
|
|
4
|
+
export default class DevopsPipelineList extends SfCommand<PipelineListResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<PipelineListResult>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { listPipelines } from '../../../utils/listPipelines.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.list');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsPipelineList extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { flags } = await this.parse(DevopsPipelineList);
|
|
32
|
+
const org = flags['target-org'];
|
|
33
|
+
const connection = org.getConnection(flags['api-version']);
|
|
34
|
+
let result;
|
|
35
|
+
try {
|
|
36
|
+
result = await listPipelines(connection);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
41
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
if (result.pipelines.length === 0) {
|
|
46
|
+
this.log('No DevOps Center pipelines found in this org.');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.styledHeader('DevOps Center Pipelines');
|
|
50
|
+
this.table({
|
|
51
|
+
data: result.pipelines,
|
|
52
|
+
columns: ['Id', 'Name', 'Description', 'IsActive'],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/devops/pipeline/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAsB,MAAM,iCAAiC,CAAC;AAEpF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,sBAAsB,CAAC,CAAC;AACnG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,SAA6B;IACpE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,EAAE,KAAK,CAAC,aAAa,E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
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { DetachProjectResult } from '../../../../utils/detachProject.js';
|
|
4
|
+
export default class DevopsPipelineProjectDelete extends SfCommand<DetachProjectResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'project-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<DetachProjectResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { detachProject } from '../../../../utils/detachProject.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.project.delete');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsPipelineProjectDelete extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
'pipeline-id': Flags.salesforceId({
|
|
30
|
+
summary: messages.getMessage('flags.pipeline-id.summary'),
|
|
31
|
+
required: true,
|
|
32
|
+
char: undefined,
|
|
33
|
+
}),
|
|
34
|
+
'project-id': Flags.salesforceId({
|
|
35
|
+
summary: messages.getMessage('flags.project-id.summary'),
|
|
36
|
+
required: true,
|
|
37
|
+
char: undefined,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
async run() {
|
|
41
|
+
const { flags } = await this.parse(DevopsPipelineProjectDelete);
|
|
42
|
+
const org = flags['target-org'];
|
|
43
|
+
const connection = org.getConnection(flags['api-version']);
|
|
44
|
+
const projectId = flags['project-id'];
|
|
45
|
+
const pipelineId = flags['pipeline-id'];
|
|
46
|
+
let result;
|
|
47
|
+
try {
|
|
48
|
+
result = await detachProject(connection, projectId, pipelineId);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
52
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
53
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
54
|
+
}
|
|
55
|
+
if (errMsg.startsWith('ProjectNotAttached:') || errMsg.includes('entity is deleted')) {
|
|
56
|
+
this.error(messages.getMessage('error.ProjectNotAttached', [projectId, pipelineId]));
|
|
57
|
+
}
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
if (result.success) {
|
|
61
|
+
this.log('Successfully removed project from pipeline.');
|
|
62
|
+
this.log(` Project ID: ${projectId}`);
|
|
63
|
+
this.log(` Pipeline ID: ${pipelineId}`);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.error(`Failed to remove project from pipeline: ${result.error ?? ''}`);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/devops/pipeline/project/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAuB,MAAM,oCAAoC,CAAC;AAExF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,gCAAgC,CAAC,CAAC;AAC7G,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,SAA8B;IAC9E,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CA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7E,CAAC;YACD,IAAI,MAAM,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBACrF,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;YACvF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;YACxD,IAAI,CAAC,GAAG,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,kBAAkB,UAAU,EAAE,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,2CAA2C,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { DeletePipelineStageResult } from '../../../../utils/deletePipelineStage.js';
|
|
4
|
+
export default class DevopsPipelineStageDelete extends SfCommand<DeletePipelineStageResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'stage-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<DeletePipelineStageResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { deletePipelineStage } from '../../../../utils/deletePipelineStage.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.stage.delete');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsPipelineStageDelete extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
'pipeline-id': Flags.salesforceId({
|
|
30
|
+
summary: messages.getMessage('flags.pipeline-id.summary'),
|
|
31
|
+
required: true,
|
|
32
|
+
char: undefined,
|
|
33
|
+
}),
|
|
34
|
+
'stage-id': Flags.salesforceId({
|
|
35
|
+
summary: messages.getMessage('flags.stage-id.summary'),
|
|
36
|
+
required: true,
|
|
37
|
+
char: undefined,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
async run() {
|
|
41
|
+
const { flags } = await this.parse(DevopsPipelineStageDelete);
|
|
42
|
+
const org = flags['target-org'];
|
|
43
|
+
const connection = org.getConnection(flags['api-version']);
|
|
44
|
+
const pipelineId = flags['pipeline-id'];
|
|
45
|
+
const stageId = flags['stage-id'];
|
|
46
|
+
let result;
|
|
47
|
+
try {
|
|
48
|
+
result = await deletePipelineStage(connection, pipelineId, stageId);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
52
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
53
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
54
|
+
}
|
|
55
|
+
if (errMsg.startsWith('Stage not found:') || errMsg.includes('entity is deleted')) {
|
|
56
|
+
this.error(messages.getMessage('error.StageNotFound', [stageId, pipelineId]));
|
|
57
|
+
}
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
if (result.success) {
|
|
61
|
+
this.log(`Successfully deleted stage ${stageId} from pipeline ${pipelineId}.`);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.error(`Failed to delete stage: ${result.error ?? ''}`);
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/devops/pipeline/stage/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,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CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { PipelineUpdateResult } from '../../../utils/activatePipeline.js';
|
|
4
|
+
export default class DevopsPipelineUpdate extends SfCommand<PipelineUpdateResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
private static getPipelineState;
|
|
16
|
+
run(): Promise<PipelineUpdateResult>;
|
|
17
|
+
private applyUpdates;
|
|
18
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { activatePipeline, updatePipelineRecord } from '../../../utils/activatePipeline.js';
|
|
19
|
+
import { fetchPipelineStages } from '../../../utils/pipelineUtils.js';
|
|
20
|
+
import { validateSalesforceId } from '../../../utils/soqlUtils.js';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.update');
|
|
23
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
24
|
+
export default class DevopsPipelineUpdate extends SfCommand {
|
|
25
|
+
static summary = messages.getMessage('summary');
|
|
26
|
+
static description = messages.getMessage('description');
|
|
27
|
+
static examples = messages.getMessages('examples');
|
|
28
|
+
static flags = {
|
|
29
|
+
'target-org': Flags.requiredOrg(),
|
|
30
|
+
'api-version': Flags.orgApiVersion(),
|
|
31
|
+
'pipeline-id': Flags.salesforceId({
|
|
32
|
+
summary: messages.getMessage('flags.pipeline-id.summary'),
|
|
33
|
+
required: true,
|
|
34
|
+
char: undefined,
|
|
35
|
+
}),
|
|
36
|
+
active: Flags.boolean({
|
|
37
|
+
summary: messages.getMessage('flags.active.summary'),
|
|
38
|
+
required: false,
|
|
39
|
+
allowNo: true,
|
|
40
|
+
}),
|
|
41
|
+
name: Flags.string({
|
|
42
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
43
|
+
required: false,
|
|
44
|
+
char: 'n',
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
static async getPipelineState(connection, pipelineId) {
|
|
48
|
+
validateSalesforceId(pipelineId, 'pipeline');
|
|
49
|
+
const result = await connection.query(`SELECT IsActive, Name FROM DevopsPipeline WHERE Id = '${pipelineId}' LIMIT 1`);
|
|
50
|
+
const record = result.records[0];
|
|
51
|
+
if (!record) {
|
|
52
|
+
throw new Error(`Pipeline ${pipelineId} not found.`);
|
|
53
|
+
}
|
|
54
|
+
return record;
|
|
55
|
+
}
|
|
56
|
+
async run() {
|
|
57
|
+
const { flags } = await this.parse(DevopsPipelineUpdate);
|
|
58
|
+
const org = flags['target-org'];
|
|
59
|
+
const connection = org.getConnection(flags['api-version']);
|
|
60
|
+
const pipelineId = flags['pipeline-id'];
|
|
61
|
+
const activateFlag = flags.active;
|
|
62
|
+
const newName = flags.name;
|
|
63
|
+
if (activateFlag === undefined && newName === undefined) {
|
|
64
|
+
this.error(messages.getMessage('error.NoFlags'));
|
|
65
|
+
}
|
|
66
|
+
let stages = [];
|
|
67
|
+
try {
|
|
68
|
+
stages = await fetchPipelineStages(connection, pipelineId);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
72
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
73
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
74
|
+
}
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
const pipeline = await DevopsPipelineUpdate.getPipelineState(connection, pipelineId);
|
|
78
|
+
if (activateFlag === true && pipeline.IsActive) {
|
|
79
|
+
this.error(messages.getMessage('error.AlreadyActive', [pipelineId]));
|
|
80
|
+
}
|
|
81
|
+
if (activateFlag === false && !pipeline.IsActive) {
|
|
82
|
+
this.error(messages.getMessage('error.AlreadyInactive', [pipelineId]));
|
|
83
|
+
}
|
|
84
|
+
if (activateFlag === true && stages.length === 0) {
|
|
85
|
+
this.error(messages.getMessage('error.NoStages', [pipelineId]));
|
|
86
|
+
}
|
|
87
|
+
const result = await this.applyUpdates(connection, pipelineId, activateFlag, newName, stages.length);
|
|
88
|
+
this.log(` Pipeline ID: ${pipelineId}`);
|
|
89
|
+
if (result.name !== undefined)
|
|
90
|
+
this.log(` Name: ${result.name}`);
|
|
91
|
+
if (result.status !== undefined)
|
|
92
|
+
this.log(` Status: ${result.status}`);
|
|
93
|
+
if (activateFlag === true)
|
|
94
|
+
this.log(` Stages: ${result.stageCount ?? stages.length}`);
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
async applyUpdates(connection, pipelineId, activateFlag, newName, stageCount) {
|
|
98
|
+
const result = { success: true, pipelineId };
|
|
99
|
+
// Activate via Connect API
|
|
100
|
+
if (activateFlag === true) {
|
|
101
|
+
const activateResult = await activatePipeline({ connection, pipelineId });
|
|
102
|
+
result.status = activateResult.status;
|
|
103
|
+
result.stageCount = stageCount;
|
|
104
|
+
this.log('Successfully activated the pipeline.');
|
|
105
|
+
}
|
|
106
|
+
// Deactivate and/or rename via Record API
|
|
107
|
+
const recordFields = {};
|
|
108
|
+
if (activateFlag === false)
|
|
109
|
+
recordFields.IsActive = false;
|
|
110
|
+
if (newName !== undefined)
|
|
111
|
+
recordFields.Name = newName;
|
|
112
|
+
if (Object.keys(recordFields).length > 0) {
|
|
113
|
+
await updatePipelineRecord(connection, pipelineId, recordFields);
|
|
114
|
+
if (activateFlag === false) {
|
|
115
|
+
result.status = 'Inactive';
|
|
116
|
+
this.log('Successfully deactivated the pipeline.');
|
|
117
|
+
}
|
|
118
|
+
if (newName !== undefined) {
|
|
119
|
+
result.name = newName;
|
|
120
|
+
this.log(`Successfully renamed the pipeline to "${newName}".`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/devops/pipeline/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAc,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,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AAM,CAAC,MAAM,GAAG,UAAU,CAAC;gBAC3B,IAAI,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;YACrD,CAAC;YACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;gBACtB,IAAI,CAAC,GAAG,CAAC,yCAAyC,OAAO,IAAI,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { UpdateProjectResult } from '../../../utils/updateProject.js';
|
|
4
|
+
export default class DevopsProjectUpdate extends SfCommand<UpdateProjectResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'project-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'is-active': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<UpdateProjectResult>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { updateProject } from '../../../utils/updateProject.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.project.update');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsProjectUpdate extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
'project-id': Flags.salesforceId({
|
|
30
|
+
summary: messages.getMessage('flags.project-id.summary'),
|
|
31
|
+
char: 'i',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
name: Flags.string({
|
|
35
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
36
|
+
char: 'n',
|
|
37
|
+
}),
|
|
38
|
+
description: Flags.string({
|
|
39
|
+
summary: messages.getMessage('flags.description.summary'),
|
|
40
|
+
char: 'd',
|
|
41
|
+
}),
|
|
42
|
+
'is-active': Flags.boolean({
|
|
43
|
+
summary: messages.getMessage('flags.is-active.summary'),
|
|
44
|
+
allowNo: true,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
async run() {
|
|
48
|
+
const { flags } = await this.parse(DevopsProjectUpdate);
|
|
49
|
+
if (flags['name'] === undefined && flags['description'] === undefined && flags['is-active'] === undefined) {
|
|
50
|
+
this.error(messages.getMessage('error.NoFieldsProvided'));
|
|
51
|
+
}
|
|
52
|
+
const org = flags['target-org'];
|
|
53
|
+
const connection = org.getConnection(flags['api-version']);
|
|
54
|
+
let result;
|
|
55
|
+
try {
|
|
56
|
+
result = await updateProject({
|
|
57
|
+
connection,
|
|
58
|
+
projectId: flags['project-id'],
|
|
59
|
+
name: flags['name'],
|
|
60
|
+
description: flags['description'],
|
|
61
|
+
isActive: flags['is-active'],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
66
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
67
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
if (result.success) {
|
|
72
|
+
this.log(`Successfully updated project: ${flags['project-id']}`);
|
|
73
|
+
if (result.name !== undefined)
|
|
74
|
+
this.log(` Name: ${result.name}`);
|
|
75
|
+
if (result.description !== undefined)
|
|
76
|
+
this.log(` Description: ${result.description}`);
|
|
77
|
+
if (result.isActive !== undefined)
|
|
78
|
+
this.log(` IsActive: ${result.isActive}`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.error(`Failed to update project: ${result.error ?? ''}`);
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=update.js.map
|