@salesforce/plugin-devops-center 1.2.27 → 1.2.28
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/LICENSE.txt +200 -6
- package/README.md +430 -19
- package/bin/dev.js +15 -0
- package/bin/run.js +5 -0
- package/lib/commands/devops/pipeline/activate.d.ts +14 -0
- package/lib/commands/devops/pipeline/activate.js +82 -0
- package/lib/commands/devops/pipeline/activate.js.map +1 -0
- package/lib/commands/devops/pipeline/attach-project.d.ts +15 -0
- package/lib/commands/devops/pipeline/attach-project.js +82 -0
- package/lib/commands/devops/pipeline/attach-project.js.map +1 -0
- package/lib/commands/devops/pipeline/create.d.ts +23 -0
- package/lib/commands/devops/pipeline/create.js +136 -0
- package/lib/commands/devops/pipeline/create.js.map +1 -0
- package/lib/commands/devops/pipeline/stage/add.d.ts +16 -0
- package/lib/commands/devops/pipeline/stage/add.js +94 -0
- package/lib/commands/devops/pipeline/stage/add.js.map +1 -0
- package/lib/commands/devops/project/create.d.ts +15 -0
- package/lib/commands/devops/project/create.js +72 -0
- package/lib/commands/devops/project/create.js.map +1 -0
- package/lib/commands/devops/project/list.d.ts +20 -0
- package/lib/commands/devops/project/list.js +59 -0
- package/lib/commands/devops/project/list.js.map +1 -0
- package/lib/commands/devops/pull-request/create.d.ts +17 -0
- package/lib/commands/devops/pull-request/create.js +104 -0
- package/lib/commands/devops/pull-request/create.js.map +1 -0
- package/lib/commands/devops/work-item/create.d.ts +16 -0
- package/lib/commands/devops/work-item/create.js +76 -0
- package/lib/commands/devops/work-item/create.js.map +1 -0
- package/lib/commands/devops/work-item/list.d.ts +17 -0
- package/lib/commands/devops/work-item/list.js +72 -0
- package/lib/commands/devops/work-item/list.js.map +1 -0
- package/lib/commands/devops/work-item/status/update.d.ts +16 -0
- package/lib/commands/devops/work-item/status/update.js +90 -0
- package/lib/commands/devops/work-item/status/update.js.map +1 -0
- package/lib/commands/project/deploy/pipeline/quick.d.ts +2 -2
- package/lib/commands/project/deploy/pipeline/quick.js +24 -21
- package/lib/commands/project/deploy/pipeline/quick.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/report.d.ts +4 -4
- package/lib/commands/project/deploy/pipeline/report.js +38 -35
- package/lib/commands/project/deploy/pipeline/report.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/resume.d.ts +2 -2
- package/lib/commands/project/deploy/pipeline/resume.js +24 -21
- package/lib/commands/project/deploy/pipeline/resume.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/start.d.ts +3 -3
- package/lib/commands/project/deploy/pipeline/start.js +26 -23
- package/lib/commands/project/deploy/pipeline/start.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/validate.d.ts +3 -3
- package/lib/commands/project/deploy/pipeline/validate.js +24 -21
- package/lib/commands/project/deploy/pipeline/validate.js.map +1 -1
- package/lib/common/base/abstractAsyncOperation.d.ts +3 -3
- package/lib/common/base/abstractAsyncOperation.js +31 -23
- package/lib/common/base/abstractAsyncOperation.js.map +1 -1
- package/lib/common/base/abstractPromote.d.ts +5 -4
- package/lib/common/base/abstractPromote.js +52 -38
- package/lib/common/base/abstractPromote.js.map +1 -1
- package/lib/common/base/abstractQuick.d.ts +4 -3
- package/lib/common/base/abstractQuick.js +44 -43
- package/lib/common/base/abstractQuick.js.map +1 -1
- package/lib/common/base/abstractReportOnPromote.d.ts +2 -1
- package/lib/common/base/abstractReportOnPromote.js +31 -24
- package/lib/common/base/abstractReportOnPromote.js.map +1 -1
- package/lib/common/base/abstractResume.d.ts +3 -2
- package/lib/common/base/abstractResume.js +40 -33
- package/lib/common/base/abstractResume.js.map +1 -1
- package/lib/common/constants.js +19 -13
- package/lib/common/constants.js.map +1 -1
- package/lib/common/deployPipelineCache.js +20 -15
- package/lib/common/deployPipelineCache.js.map +1 -1
- package/lib/common/flags/flags.d.ts +2 -2
- package/lib/common/flags/flags.js +34 -29
- package/lib/common/flags/flags.js.map +1 -1
- package/lib/common/flags/promote/promoteFlags.d.ts +3 -3
- package/lib/common/flags/promote/promoteFlags.js +26 -20
- package/lib/common/flags/promote/promoteFlags.js.map +1 -1
- package/lib/common/index.d.ts +3 -2
- package/lib/common/index.js +2 -17
- package/lib/common/index.js.map +1 -1
- package/lib/common/outputColumns.d.ts +3 -13
- package/lib/common/outputColumns.js +23 -19
- package/lib/common/outputColumns.js.map +1 -1
- package/lib/common/outputService/aorOutputService.d.ts +4 -4
- package/lib/common/outputService/aorOutputService.js +27 -20
- package/lib/common/outputService/aorOutputService.js.map +1 -1
- package/lib/common/outputService/deployCommandOutputService.d.ts +2 -2
- package/lib/common/outputService/deployCommandOutputService.js +17 -12
- package/lib/common/outputService/deployCommandOutputService.js.map +1 -1
- package/lib/common/outputService/deploySummaryBuilder.d.ts +1 -1
- package/lib/common/outputService/deploySummaryBuilder.js +45 -31
- package/lib/common/outputService/deploySummaryBuilder.js.map +1 -1
- package/lib/common/outputService/deploymentResultOutputService.d.ts +4 -4
- package/lib/common/outputService/deploymentResultOutputService.js +16 -10
- package/lib/common/outputService/deploymentResultOutputService.js.map +1 -1
- package/lib/common/outputService/index.d.ts +8 -6
- package/lib/common/outputService/index.js +5 -19
- package/lib/common/outputService/index.js.map +1 -1
- package/lib/common/outputService/outputService.d.ts +6 -4
- package/lib/common/outputService/outputService.js +20 -14
- package/lib/common/outputService/outputService.js.map +1 -1
- package/lib/common/outputService/outputServiceFactory.d.ts +8 -8
- package/lib/common/outputService/outputServiceFactory.js +21 -16
- package/lib/common/outputService/outputServiceFactory.js.map +1 -1
- package/lib/common/outputService/outputUtils.d.ts +1 -1
- package/lib/common/outputService/outputUtils.js +24 -19
- package/lib/common/outputService/outputUtils.js.map +1 -1
- package/lib/common/outputService/promoteOutputService.d.ts +4 -5
- package/lib/common/outputService/promoteOutputService.js +19 -13
- package/lib/common/outputService/promoteOutputService.js.map +1 -1
- package/lib/common/outputService/reportOutputService.d.ts +5 -6
- package/lib/common/outputService/reportOutputService.js +32 -27
- package/lib/common/outputService/reportOutputService.js.map +1 -1
- package/lib/common/outputService/resumeCommandOutputService.d.ts +3 -3
- package/lib/common/outputService/resumeCommandOutputService.js +19 -13
- package/lib/common/outputService/resumeCommandOutputService.js.map +1 -1
- package/lib/common/outputService/resumeOutputService.d.ts +3 -3
- package/lib/common/outputService/resumeOutputService.js +23 -17
- package/lib/common/outputService/resumeOutputService.js.map +1 -1
- package/lib/common/selectors/asyncOperationResultsSelector.d.ts +1 -1
- package/lib/common/selectors/asyncOperationResultsSelector.js +16 -10
- package/lib/common/selectors/asyncOperationResultsSelector.js.map +1 -1
- package/lib/common/selectors/deployComponentsSelector.d.ts +1 -1
- package/lib/common/selectors/deployComponentsSelector.js +18 -13
- package/lib/common/selectors/deployComponentsSelector.js.map +1 -1
- package/lib/common/selectors/deployProgressSummarySelector.d.ts +2 -2
- package/lib/common/selectors/deployProgressSummarySelector.js +16 -10
- package/lib/common/selectors/deployProgressSummarySelector.js.map +1 -1
- package/lib/common/selectors/deploymentResultsSelector.d.ts +2 -2
- package/lib/common/selectors/deploymentResultsSelector.js +20 -16
- package/lib/common/selectors/deploymentResultsSelector.js.map +1 -1
- package/lib/common/selectors/environmentSelector.d.ts +2 -2
- package/lib/common/selectors/environmentSelector.js +16 -10
- package/lib/common/selectors/environmentSelector.js.map +1 -1
- package/lib/common/selectors/namedCredentialSelector.d.ts +1 -1
- package/lib/common/selectors/namedCredentialSelector.js +16 -10
- package/lib/common/selectors/namedCredentialSelector.js.map +1 -1
- package/lib/common/selectors/pipelineStageSelector.d.ts +1 -1
- package/lib/common/selectors/pipelineStageSelector.js +18 -13
- package/lib/common/selectors/pipelineStageSelector.js.map +1 -1
- package/lib/common/selectors/selectorUtils.d.ts +1 -1
- package/lib/common/selectors/selectorUtils.js +17 -11
- package/lib/common/selectors/selectorUtils.js.map +1 -1
- package/lib/common/selectors/validateDeploySelector.d.ts +1 -1
- package/lib/common/selectors/validateDeploySelector.js +16 -10
- package/lib/common/selectors/validateDeploySelector.js.map +1 -1
- package/lib/common/selectors/workItemSelector.d.ts +2 -2
- package/lib/common/selectors/workItemSelector.js +16 -10
- package/lib/common/selectors/workItemSelector.js.map +1 -1
- package/lib/common/types.d.ts +4 -4
- package/lib/common/types.js +4 -7
- package/lib/common/types.js.map +1 -1
- package/lib/common/utils.d.ts +4 -4
- package/lib/common/utils.js +42 -43
- package/lib/common/utils.js.map +1 -1
- package/lib/configMeta.js +21 -15
- package/lib/configMeta.js.map +1 -1
- package/lib/streamer/doceMonitor.d.ts +3 -2
- package/lib/streamer/doceMonitor.js +14 -6
- package/lib/streamer/doceMonitor.js.map +1 -1
- package/lib/streamer/doceStream.d.ts +1 -1
- package/lib/streamer/doceStream.js +19 -11
- package/lib/streamer/doceStream.js.map +1 -1
- package/lib/streamer/processors/asyncOpStream.d.ts +2 -2
- package/lib/streamer/processors/asyncOpStream.js +22 -15
- package/lib/streamer/processors/asyncOpStream.js.map +1 -1
- package/lib/streamer/sObjectStream.d.ts +1 -1
- package/lib/streamer/sObjectStream.js +9 -10
- package/lib/streamer/sObjectStream.js.map +1 -1
- package/lib/utils/activatePipeline.d.ts +17 -0
- package/lib/utils/activatePipeline.js +35 -0
- package/lib/utils/activatePipeline.js.map +1 -0
- package/lib/utils/addPipelineStage.d.ts +20 -0
- package/lib/utils/addPipelineStage.js +43 -0
- package/lib/utils/addPipelineStage.js.map +1 -0
- package/lib/utils/attachProject.d.ts +21 -0
- package/lib/utils/attachProject.js +44 -0
- package/lib/utils/attachProject.js.map +1 -0
- package/lib/utils/createPipeline.d.ts +34 -0
- package/lib/utils/createPipeline.js +77 -0
- package/lib/utils/createPipeline.js.map +1 -0
- package/lib/utils/createProject.d.ts +17 -0
- package/lib/utils/createProject.js +39 -0
- package/lib/utils/createProject.js.map +1 -0
- package/lib/utils/createPullRequest.d.ts +49 -0
- package/lib/utils/createPullRequest.js +204 -0
- package/lib/utils/createPullRequest.js.map +1 -0
- package/lib/utils/createWorkItem.d.ts +19 -0
- package/lib/utils/createWorkItem.js +58 -0
- package/lib/utils/createWorkItem.js.map +1 -0
- package/lib/utils/pipelineUtils.d.ts +8 -0
- package/lib/utils/pipelineUtils.js +51 -0
- package/lib/utils/pipelineUtils.js.map +1 -0
- package/lib/utils/types.d.ts +57 -0
- package/lib/utils/types.js +17 -0
- package/lib/utils/types.js.map +1 -0
- package/lib/utils/updateWorkItemStatus.d.ts +34 -0
- package/lib/utils/updateWorkItemStatus.js +71 -0
- package/lib/utils/updateWorkItemStatus.js.map +1 -0
- package/lib/utils/workItems.d.ts +3 -0
- package/lib/utils/workItems.js +181 -0
- package/lib/utils/workItems.js.map +1 -0
- package/messages/commonErrors.md +5 -1
- package/messages/devops.pipeline.activate.md +29 -0
- package/messages/devops.pipeline.attach-project.md +29 -0
- package/messages/devops.pipeline.create.md +81 -0
- package/messages/devops.pipeline.stage.add.md +37 -0
- package/messages/devops.project.create.md +29 -0
- package/messages/devops.project.list.md +17 -0
- package/messages/devops.pull-request.create.md +57 -0
- package/messages/devops.work-item.create.md +29 -0
- package/messages/devops.work-item.list.md +21 -0
- package/messages/devops.work-item.status.update.md +29 -0
- package/npm-shrinkwrap.json +4196 -4470
- package/oclif.lock +3380 -3272
- package/oclif.manifest.json +863 -11
- package/package.json +53 -23
- package/schemas/devops-pipeline-activate.json +28 -0
- package/schemas/devops-pipeline-attach__project.json +25 -0
- package/schemas/devops-pipeline-create.json +50 -0
- package/schemas/devops-pipeline-stage-add.json +31 -0
- package/schemas/devops-project-create.json +28 -0
- package/schemas/devops-project-list.json +35 -0
- package/schemas/devops-pull__request-create.json +34 -0
- package/schemas/devops-work__item-create.json +28 -0
- package/schemas/devops-work__item-list.json +75 -0
- package/schemas/devops-work__item-status-update.json +28 -0
- package/schemas/project-deploy-pipeline-report.json +2 -2
package/lib/configMeta.js
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the
|
|
6
|
-
*
|
|
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.
|
|
7
15
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center', 'config');
|
|
14
|
-
var ConfigVars;
|
|
16
|
+
import childProcess from 'node:child_process';
|
|
17
|
+
import { Messages } from '@salesforce/core';
|
|
18
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
19
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'config');
|
|
20
|
+
export var ConfigVars;
|
|
15
21
|
(function (ConfigVars) {
|
|
16
22
|
ConfigVars["TARGET_DEVOPS_CENTER"] = "target-devops-center";
|
|
17
|
-
})(ConfigVars || (
|
|
23
|
+
})(ConfigVars || (ConfigVars = {}));
|
|
18
24
|
/**
|
|
19
25
|
* Creates a configuration variable called --target-devops-center.
|
|
20
26
|
* Once set, it acts as the default target devops center org for the commands in this plugin.
|
|
21
27
|
*/
|
|
22
|
-
|
|
28
|
+
export default [
|
|
23
29
|
{
|
|
24
30
|
key: ConfigVars.TARGET_DEVOPS_CENTER,
|
|
25
31
|
description: messages.getMessage(ConfigVars.TARGET_DEVOPS_CENTER),
|
|
26
32
|
hidden: false,
|
|
27
33
|
input: {
|
|
28
34
|
validator: (value) => {
|
|
29
|
-
const result =
|
|
35
|
+
const result = childProcess.spawnSync('sf', ['force:org:display', '-u', value]);
|
|
30
36
|
return result.status === 0;
|
|
31
37
|
},
|
|
32
38
|
failedMessage: (value) => messages.getMessage('error.OrgNotAuthenticated', [value]),
|
package/lib/configMeta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configMeta.js","sourceRoot":"","sources":["../src/configMeta.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"configMeta.js","sourceRoot":"","sources":["../src/configMeta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAe,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEzD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;AAErF,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,2DAA6C,CAAA;AAC/C,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB;AAED;;;GAGG;AACH,eAAe;IACb;QACE,GAAG,EAAE,UAAU,CAAC,oBAAoB;QACpC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,oBAAoB,CAAC;QACjE,MAAM,EAAE,KAAK;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC,KAAkB,EAAW,EAAE;gBACzC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,mBAAmB,EAAE,IAAI,EAAE,KAAe,CAAC,CAAC,CAAC;gBAC1F,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;YAC7B,CAAC;YACD,aAAa,EAAE,CAAC,KAAkB,EAAU,EAAE,CAC5C,QAAQ,CAAC,UAAU,CAAC,2BAA2B,EAAE,CAAC,KAAe,CAAC,CAAC;SACtE;KACF;CACF,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { AnyJson } from '@salesforce/ts-types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Common interface used to monitor the progress of something in the DevOps Center.
|
|
4
4
|
**/
|
|
5
|
-
|
|
5
|
+
type DoceMonitor = {
|
|
6
6
|
monitor(): Promise<void | AnyJson>;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export default DoceMonitor;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the
|
|
6
|
-
*
|
|
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.
|
|
7
15
|
*/
|
|
8
|
-
|
|
16
|
+
export {};
|
|
9
17
|
//# sourceMappingURL=doceMonitor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doceMonitor.js","sourceRoot":"","sources":["../../src/streamer/doceMonitor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doceMonitor.js","sourceRoot":"","sources":["../../src/streamer/doceMonitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Org, StatusResult } from '@salesforce/core';
|
|
2
2
|
import { AnyJson, JsonMap } from '@salesforce/ts-types';
|
|
3
3
|
import { Duration } from '@salesforce/kit';
|
|
4
|
-
import DoceMonitor from './doceMonitor';
|
|
4
|
+
import DoceMonitor from './doceMonitor.js';
|
|
5
5
|
/**
|
|
6
6
|
* Common base class for DOCe monitor that use the streaming api to listen to a streaming channel (CDC).
|
|
7
7
|
*/
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
|
-
* Copyright
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the
|
|
7
|
-
*
|
|
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.
|
|
8
15
|
*/
|
|
9
|
-
|
|
16
|
+
import { StreamingClient } from '@salesforce/core';
|
|
10
17
|
/**
|
|
11
18
|
* Common base class for DOCe monitor that use the streaming api to listen to a streaming channel (CDC).
|
|
12
19
|
*/
|
|
13
|
-
class DOCeStreaming {
|
|
20
|
+
export default class DOCeStreaming {
|
|
21
|
+
doceOrg;
|
|
22
|
+
wait;
|
|
14
23
|
constructor(org, wait) {
|
|
15
24
|
this.doceOrg = org;
|
|
16
25
|
this.wait = wait;
|
|
@@ -22,12 +31,11 @@ class DOCeStreaming {
|
|
|
22
31
|
* @param processor The specific processor we want to use for the event
|
|
23
32
|
*/
|
|
24
33
|
async startStream(channel, processor) {
|
|
25
|
-
const options = new
|
|
34
|
+
const options = new StreamingClient.DefaultOptions(this.doceOrg, channel, processor);
|
|
26
35
|
options.setSubscribeTimeout(this.wait);
|
|
27
|
-
const streamClient = await
|
|
36
|
+
const streamClient = await StreamingClient.create(options);
|
|
28
37
|
await streamClient.handshake();
|
|
29
38
|
await streamClient.subscribe();
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
|
-
exports.default = DOCeStreaming;
|
|
33
41
|
//# sourceMappingURL=doceStream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doceStream.js","sourceRoot":"","sources":["../../src/streamer/doceStream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doceStream.js","sourceRoot":"","sources":["../../src/streamer/doceStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAO,eAAe,EAAgB,MAAM,kBAAkB,CAAC;AAKtE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAgB,aAAa;IACjC,OAAO,CAAM;IACb,IAAI,CAAW;IAEvB,YAAmB,GAAQ,EAAE,IAAc;QACzC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,SAA6C;QACxF,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACrF,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvC,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3D,MAAM,YAAY,CAAC,SAAS,EAAE,CAAC;QAC/B,MAAM,YAAY,CAAC,SAAS,EAAE,CAAC;IACjC,CAAC;CAGF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Org, StatusResult } from '@salesforce/core';
|
|
2
2
|
import { Duration } from '@salesforce/kit';
|
|
3
3
|
import { AnyJson, JsonMap } from '@salesforce/ts-types';
|
|
4
|
-
import SObjectStreaming from '../sObjectStream';
|
|
5
|
-
import { AorOutputService } from '../../common/outputService';
|
|
4
|
+
import SObjectStreaming from '../sObjectStream.js';
|
|
5
|
+
import type { AorOutputService } from '../../common/outputService/index.js';
|
|
6
6
|
export default class AsyncOpStreaming extends SObjectStreaming {
|
|
7
7
|
private outputService;
|
|
8
8
|
constructor(org: Org, wait: Duration, idToInspect: string, outputService: AorOutputService);
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the
|
|
6
|
-
*
|
|
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.
|
|
7
15
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
import { ensureJsonMap } from '@salesforce/ts-types';
|
|
17
|
+
import SObjectStreaming from '../sObjectStream.js';
|
|
18
|
+
import { ASYNC_OPERATION_CDC } from '../../common/constants.js';
|
|
19
|
+
import { AsyncOperationStatus } from '../../common/types.js';
|
|
20
|
+
export default class AsyncOpStreaming extends SObjectStreaming {
|
|
21
|
+
outputService;
|
|
14
22
|
constructor(org, wait, idToInspect, outputService) {
|
|
15
|
-
super(org, wait, new Array(idToInspect),
|
|
23
|
+
super(org, wait, new Array(idToInspect), ASYNC_OPERATION_CDC);
|
|
16
24
|
this.outputService = outputService;
|
|
17
25
|
}
|
|
18
26
|
/**
|
|
@@ -30,13 +38,13 @@ class AsyncOpStreaming extends sObjectStream_1.default {
|
|
|
30
38
|
*/
|
|
31
39
|
// eslint-disable-next-line class-methods-use-this
|
|
32
40
|
asyncOpStreamProcessor(payload) {
|
|
33
|
-
const jsonPayload =
|
|
41
|
+
const jsonPayload = ensureJsonMap(payload);
|
|
34
42
|
// We build an aor given the payload
|
|
35
43
|
const asyncOpResult = jsonPayload;
|
|
36
44
|
// Print the aor status
|
|
37
45
|
this.outputService.printAorStatus(asyncOpResult);
|
|
38
46
|
// In a future we want to test !Is_Completed__c instead of Status != In Progress
|
|
39
|
-
if (asyncOpResult.sf_devops__Status__c && asyncOpResult.sf_devops__Status__c !==
|
|
47
|
+
if (asyncOpResult.sf_devops__Status__c && asyncOpResult.sf_devops__Status__c !== AsyncOperationStatus.InProgress) {
|
|
40
48
|
return {
|
|
41
49
|
completed: true,
|
|
42
50
|
payload: jsonPayload,
|
|
@@ -45,5 +53,4 @@ class AsyncOpStreaming extends sObjectStream_1.default {
|
|
|
45
53
|
return { completed: false };
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
|
-
exports.default = AsyncOpStreaming;
|
|
49
56
|
//# sourceMappingURL=asyncOpStream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncOpStream.js","sourceRoot":"","sources":["../../../src/streamer/processors/asyncOpStream.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"asyncOpStream.js","sourceRoot":"","sources":["../../../src/streamer/processors/asyncOpStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAA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, JsonMap } from '@salesforce/ts-types';
|
|
4
|
-
import DOCeStreaming from './doceStream';
|
|
4
|
+
import DOCeStreaming from './doceStream.js';
|
|
5
5
|
export default abstract class SObjectStreaming extends DOCeStreaming {
|
|
6
6
|
private idsToInspect;
|
|
7
7
|
private channelName;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ensureJsonMap } from '@salesforce/ts-types';
|
|
2
|
+
import { containsSfId } from '../common/utils.js';
|
|
3
|
+
import DOCeStreaming from './doceStream.js';
|
|
4
|
+
export default class SObjectStreaming extends DOCeStreaming {
|
|
5
|
+
idsToInspect;
|
|
6
|
+
channelName;
|
|
7
7
|
constructor(org, wait, idsToInspect, channelName) {
|
|
8
8
|
super(org, wait);
|
|
9
9
|
this.idsToInspect = idsToInspect;
|
|
@@ -25,10 +25,10 @@ class SObjectStreaming extends doceStream_1.default {
|
|
|
25
25
|
* @returns If the event is valid, the matchProcessor will handle the response. If it's not valid, we continue listening.
|
|
26
26
|
*/
|
|
27
27
|
matchingProcessor(event, matchProcessor) {
|
|
28
|
-
const jsonPayload =
|
|
29
|
-
const changeEventHeader =
|
|
28
|
+
const jsonPayload = ensureJsonMap(event.payload);
|
|
29
|
+
const changeEventHeader = ensureJsonMap(jsonPayload.ChangeEventHeader);
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
31
|
-
if (changeEventHeader.recordIds != null &&
|
|
31
|
+
if (changeEventHeader.recordIds != null && containsSfId(this.idsToInspect, changeEventHeader.recordIds[0])) {
|
|
32
32
|
return matchProcessor(jsonPayload);
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
@@ -36,5 +36,4 @@ class SObjectStreaming extends doceStream_1.default {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
exports.default = SObjectStreaming;
|
|
40
39
|
//# sourceMappingURL=sObjectStream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sObjectStream.js","sourceRoot":"","sources":["../../src/streamer/sObjectStream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sObjectStream.js","sourceRoot":"","sources":["../../src/streamer/sObjectStream.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAgB,gBAAiB,SAAQ,aAAa;IAC1D,YAAY,CAAW;IACvB,WAAW,CAAS;IAE5B,YAAsB,GAAQ,EAAE,IAAc,EAAE,YAAsB,EAAE,WAAmB;QACzF,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,eAAe,CAAC,cAAkD;QAChF,iEAAiE;QACjE,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;IAC/G,CAAC;IAED;;;;;OAKG;IACO,iBAAiB,CAAC,KAAc,EAAE,cAAkD;QAC5F,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,iBAAiB,GAAG,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAEvE,iEAAiE;QACjE,IAAI,iBAAiB,CAAC,SAAS,IAAI,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3G,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
export type ActivatePipelineParams = {
|
|
3
|
+
connection: Connection;
|
|
4
|
+
pipelineId: string;
|
|
5
|
+
};
|
|
6
|
+
export type ActivatePipelineResult = {
|
|
7
|
+
success: boolean;
|
|
8
|
+
pipelineId: string;
|
|
9
|
+
status?: string;
|
|
10
|
+
stageCount?: number;
|
|
11
|
+
error?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Activates a DevOps Center pipeline via the Connect API.
|
|
15
|
+
* POST /services/data/v{version}/connect/devops/pipelines/{pipelineId}/activate
|
|
16
|
+
*/
|
|
17
|
+
export declare function activatePipeline(params: ActivatePipelineParams): Promise<ActivatePipelineResult>;
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Activates a DevOps Center pipeline via the Connect API.
|
|
18
|
+
* POST /services/data/v{version}/connect/devops/pipelines/{pipelineId}/activate
|
|
19
|
+
*/
|
|
20
|
+
export async function activatePipeline(params) {
|
|
21
|
+
const { connection, pipelineId } = params;
|
|
22
|
+
const path = `/services/data/v${connection.getApiVersion()}/connect/devops/pipelines/${pipelineId}/activate`;
|
|
23
|
+
const data = await connection.request({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
url: path,
|
|
26
|
+
body: '{}',
|
|
27
|
+
headers: { 'Content-Type': 'application/json' },
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
success: true,
|
|
31
|
+
pipelineId,
|
|
32
|
+
status: data.status ?? 'Active',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=activatePipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activatePipeline.js","sourceRoot":"","sources":["../../src/utils/activatePipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmBH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAA8B;IACnE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAE1C,MAAM,IAAI,GAAG,mBAAmB,UAAU,CAAC,aAAa,EAAE,6BAA6B,UAAU,WAAW,CAAC;IAE7G,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,OAAO,CAAmB;QACtD,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI;QACb,UAAU;QACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,QAAQ;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
export type AddPipelineStageParams = {
|
|
3
|
+
connection: Connection;
|
|
4
|
+
pipelineId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
nextStageId: string;
|
|
7
|
+
};
|
|
8
|
+
export type AddPipelineStageResult = {
|
|
9
|
+
success: boolean;
|
|
10
|
+
stageId?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
nextStageId?: string;
|
|
13
|
+
pipelineId?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Adds a stage to a DevOps Center pipeline via sObject create.
|
|
18
|
+
* POST /services/data/v{version}/sobjects/DevopsPipelineStage
|
|
19
|
+
*/
|
|
20
|
+
export declare function addPipelineStage(params: AddPipelineStageParams): Promise<AddPipelineStageResult>;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Adds a stage to a DevOps Center pipeline via sObject create.
|
|
18
|
+
* POST /services/data/v{version}/sobjects/DevopsPipelineStage
|
|
19
|
+
*/
|
|
20
|
+
export async function addPipelineStage(params) {
|
|
21
|
+
const { connection, pipelineId, name, nextStageId } = params;
|
|
22
|
+
const result = await connection.sobject('DevopsPipelineStage').create({
|
|
23
|
+
Name: name,
|
|
24
|
+
DevopsPipelineId: pipelineId,
|
|
25
|
+
NextStageId: nextStageId,
|
|
26
|
+
});
|
|
27
|
+
const createResult = result;
|
|
28
|
+
if (!createResult.success) {
|
|
29
|
+
const errorMsg = createResult.errors?.map((e) => e.message).join('; ') ?? 'Unknown error';
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
error: errorMsg,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
success: true,
|
|
37
|
+
stageId: createResult.id,
|
|
38
|
+
name,
|
|
39
|
+
nextStageId,
|
|
40
|
+
pipelineId,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=addPipelineStage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addPipelineStage.js","sourceRoot":"","sources":["../../src/utils/addPipelineStage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0BH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAA8B;IACnE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAE7D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC;QACpE,IAAI,EAAE,IAAI;QACV,gBAAgB,EAAE,UAAU;QAC5B,WAAW,EAAE,WAAW;KACzB,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAwC,CAAC;IAE9D,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC;QAC1F,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,YAAY,CAAC,EAAE;QACxB,IAAI;QACJ,WAAW;QACX,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
export type AttachProjectParams = {
|
|
3
|
+
connection: Connection;
|
|
4
|
+
projectId: string;
|
|
5
|
+
pipelineId: string;
|
|
6
|
+
};
|
|
7
|
+
export type AttachProjectResult = {
|
|
8
|
+
success: boolean;
|
|
9
|
+
projectId: string;
|
|
10
|
+
pipelineId: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Checks if a project is already attached to a pipeline.
|
|
15
|
+
* Returns the existing pipeline ID if found, undefined otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare function findExistingAttachment(connection: Connection, projectId: string): Promise<string | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Attaches a DevOps Center project to a pipeline by creating a DevopsProjectPipeline junction record.
|
|
20
|
+
*/
|
|
21
|
+
export declare function attachProject(params: AttachProjectParams): Promise<AttachProjectResult>;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Checks if a project is already attached to a pipeline.
|
|
18
|
+
* Returns the existing pipeline ID if found, undefined otherwise.
|
|
19
|
+
*/
|
|
20
|
+
export async function findExistingAttachment(connection, projectId) {
|
|
21
|
+
const result = await connection.query(`SELECT DevopsPipelineId FROM DevopsProjectPipeline WHERE DevopsProjectId = '${projectId}' LIMIT 1`);
|
|
22
|
+
return (result.records ?? [])[0]?.DevopsPipelineId;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Attaches a DevOps Center project to a pipeline by creating a DevopsProjectPipeline junction record.
|
|
26
|
+
*/
|
|
27
|
+
export async function attachProject(params) {
|
|
28
|
+
const { connection, projectId, pipelineId } = params;
|
|
29
|
+
const result = await connection.sobject('DevopsProjectPipeline').create({
|
|
30
|
+
DevopsProjectId: projectId,
|
|
31
|
+
DevopsPipelineId: pipelineId,
|
|
32
|
+
});
|
|
33
|
+
if (result.success) {
|
|
34
|
+
return { success: true, projectId, pipelineId };
|
|
35
|
+
}
|
|
36
|
+
const errorMessages = result.errors?.map((e) => (typeof e === 'string' ? e : JSON.stringify(e))).join('; ');
|
|
37
|
+
return {
|
|
38
|
+
success: false,
|
|
39
|
+
projectId,
|
|
40
|
+
pipelineId,
|
|
41
|
+
error: errorMessages ?? 'Unknown error',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=attachProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachProject.js","sourceRoot":"","sources":["../../src/utils/attachProject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,UAAsB,EAAE,SAAiB;IACpF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CACnC,+EAA+E,SAAS,WAAW,CACpG,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAA2B;IAC7D,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAErD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC;QACtE,eAAe,EAAE,SAAS;QAC1B,gBAAgB,EAAE,UAAU;KAC7B,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5G,OAAO;QACL,OAAO,EAAE,KAAK;QACd,SAAS;QACT,UAAU;QACV,KAAK,EAAE,aAAa,IAAI,eAAe;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
export type RepoInfo = {
|
|
3
|
+
repoUrl: string;
|
|
4
|
+
repoType: string;
|
|
5
|
+
created: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type CreatePipelineParams = {
|
|
8
|
+
connection: Connection;
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
repo: string;
|
|
12
|
+
repoType: string;
|
|
13
|
+
createRepo?: boolean;
|
|
14
|
+
repoOwner?: string;
|
|
15
|
+
bitbucketProject?: string;
|
|
16
|
+
};
|
|
17
|
+
export type CreatePipelineResult = {
|
|
18
|
+
success: boolean;
|
|
19
|
+
pipelineId?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
status?: string;
|
|
23
|
+
repository?: RepoInfo;
|
|
24
|
+
error?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Detects repo type from a URL. Returns 'github' or 'bitbucket', or undefined.
|
|
28
|
+
*/
|
|
29
|
+
export declare function detectRepoType(repoUrl: string): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new DevOps Center pipeline via the Connect API.
|
|
32
|
+
* POST /services/data/v{version}/connect/devops/pipelines
|
|
33
|
+
*/
|
|
34
|
+
export declare function createPipeline(params: CreatePipelineParams): Promise<CreatePipelineResult>;
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
const DEFAULT_STAGES = [{ name: 'Integration' }, { name: 'UAT' }, { name: 'Staging' }, { name: 'Production' }];
|
|
17
|
+
/**
|
|
18
|
+
* Detects repo type from a URL. Returns 'github' or 'bitbucket', or undefined.
|
|
19
|
+
*/
|
|
20
|
+
export function detectRepoType(repoUrl) {
|
|
21
|
+
const lower = repoUrl.toLowerCase();
|
|
22
|
+
if (lower.includes('github.com'))
|
|
23
|
+
return 'github';
|
|
24
|
+
if (lower.includes('bitbucket.org'))
|
|
25
|
+
return 'bitbucket';
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new DevOps Center pipeline via the Connect API.
|
|
30
|
+
* POST /services/data/v{version}/connect/devops/pipelines
|
|
31
|
+
*/
|
|
32
|
+
export async function createPipeline(params) {
|
|
33
|
+
const { connection, name, description, repo, repoType, createRepo, repoOwner, bitbucketProject } = params;
|
|
34
|
+
const path = `/services/data/v${connection.getApiVersion()}/connect/devops/pipelines`;
|
|
35
|
+
const payload = {
|
|
36
|
+
name,
|
|
37
|
+
vcsType: repoType,
|
|
38
|
+
stages: DEFAULT_STAGES,
|
|
39
|
+
};
|
|
40
|
+
if (createRepo) {
|
|
41
|
+
payload.createVcsRepo = true;
|
|
42
|
+
payload.vcsRepoName = repo;
|
|
43
|
+
payload.vcsRepoOwner = repoOwner;
|
|
44
|
+
if (repoType === 'bitbucket' && repoOwner) {
|
|
45
|
+
const providerInfo = { bitbucketWorkspace: repoOwner };
|
|
46
|
+
if (bitbucketProject) {
|
|
47
|
+
providerInfo.bitbucketProject = bitbucketProject;
|
|
48
|
+
}
|
|
49
|
+
payload.repoProviderInfo = JSON.stringify(providerInfo);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
payload.vcsRepoUrl = repo;
|
|
54
|
+
}
|
|
55
|
+
if (description) {
|
|
56
|
+
payload.description = description;
|
|
57
|
+
}
|
|
58
|
+
const data = await connection.request({
|
|
59
|
+
method: 'POST',
|
|
60
|
+
url: path,
|
|
61
|
+
body: JSON.stringify(payload),
|
|
62
|
+
headers: { 'Content-Type': 'application/json' },
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
success: true,
|
|
66
|
+
pipelineId: data.id,
|
|
67
|
+
name,
|
|
68
|
+
description,
|
|
69
|
+
status: data.status ?? 'Inactive',
|
|
70
|
+
repository: {
|
|
71
|
+
repoUrl: repo,
|
|
72
|
+
repoType,
|
|
73
|
+
created: createRepo ?? false,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=createPipeline.js.map
|
|
@@ -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