@salesforce/plugin-devops-center 2.1.1 → 2.3.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 +53 -37
- package/lib/commands/devops/pipeline/create.d.ts +1 -0
- package/lib/commands/devops/pipeline/create.js +20 -3
- package/lib/commands/devops/pipeline/create.js.map +1 -1
- package/lib/commands/devops/promote.d.ts +8 -0
- package/lib/commands/devops/promote.js +31 -1
- package/lib/commands/devops/promote.js.map +1 -1
- package/lib/commands/devops/promotion/validate.js +16 -3
- package/lib/commands/devops/promotion/validate.js.map +1 -1
- package/lib/commands/devops/stage/branch/add.d.ts +15 -0
- package/lib/commands/devops/stage/branch/add.js +48 -1
- package/lib/commands/devops/stage/branch/add.js.map +1 -1
- package/lib/commands/devops/stage/environment/add.d.ts +15 -0
- package/lib/commands/devops/stage/environment/add.js +51 -1
- package/lib/commands/devops/stage/environment/add.js.map +1 -1
- package/lib/commands/devops/work-item/create.js +1 -0
- package/lib/commands/devops/work-item/create.js.map +1 -1
- package/lib/commands/devops/work-item/list.js +2 -1
- package/lib/commands/devops/work-item/list.js.map +1 -1
- package/lib/utils/addStageBranch.d.ts +20 -0
- package/lib/utils/addStageBranch.js +33 -0
- package/lib/utils/addStageBranch.js.map +1 -1
- package/lib/utils/addStageEnvironment.d.ts +21 -0
- package/lib/utils/addStageEnvironment.js +34 -0
- package/lib/utils/addStageEnvironment.js.map +1 -1
- package/lib/utils/createPipeline.d.ts +6 -0
- package/lib/utils/createPipeline.js +41 -1
- package/lib/utils/createPipeline.js.map +1 -1
- package/lib/utils/createWorkItem.js +22 -18
- package/lib/utils/createWorkItem.js.map +1 -1
- package/lib/utils/promoteStage.d.ts +20 -0
- package/lib/utils/promoteStage.js +25 -0
- package/lib/utils/promoteStage.js.map +1 -1
- package/lib/utils/updateWorkItem.d.ts +22 -2
- package/lib/utils/updateWorkItem.js +98 -20
- package/lib/utils/updateWorkItem.js.map +1 -1
- package/lib/utils/workItems.js +7 -4
- package/lib/utils/workItems.js.map +1 -1
- package/messages/devops.pipeline.create.md +8 -0
- package/messages/devops.promote.md +12 -0
- package/messages/devops.stage.branch.add.md +17 -1
- package/messages/devops.stage.environment.add.md +16 -0
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +29 -3
- package/package.json +3 -3
- package/schemas/devops-pipeline-create.json +19 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPipeline.js","sourceRoot":"","sources":["../../src/utils/createPipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"createPipeline.js","sourceRoot":"","sources":["../../src/utils/createPipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AA0C9E,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACpC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,OAAO,QAAQ,CAAC;IAClD,IAAI,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;QAAE,OAAO,WAAW,CAAC;IACxD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAAa,EAAE,KAAc,EAAE,UAAwB,KAAK;IACpG,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,uFAAuF;QACvF,IAAI,CAA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|
33
33
|
success: true,
|
|
34
|
-
workItemId: (data.id ?? data.Id),
|
|
35
|
-
workItemName: (data.name ?? data.Name),
|
|
34
|
+
workItemId: (data.workItemId ?? data.id ?? data.Id),
|
|
35
|
+
workItemName: (data.workItemName ?? data.name ?? data.Name),
|
|
36
36
|
subject: (data.subject ?? data.Subject ?? subject),
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
catch (error) {
|
|
40
|
-
|
|
41
|
-
const data = (err.response?.data ?? err.body ?? err);
|
|
42
|
-
const message = (typeof data === 'object' &&
|
|
43
|
-
data !== null &&
|
|
44
|
-
(data.message ??
|
|
45
|
-
data.error ??
|
|
46
|
-
data.errorDescription)) ||
|
|
47
|
-
err.message ||
|
|
48
|
-
'Unknown error';
|
|
49
|
-
const details = typeof data === 'object' && data !== null && Array.isArray(data.body)
|
|
50
|
-
? data.body.join('; ')
|
|
51
|
-
: undefined;
|
|
52
|
-
return {
|
|
53
|
-
success: false,
|
|
54
|
-
error: details ? `${String(message)}: ${details}` : String(message),
|
|
55
|
-
};
|
|
40
|
+
return { success: false, error: parseErrorMessage(error) };
|
|
56
41
|
}
|
|
57
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Extracts a human-readable error message from a failed work item request,
|
|
45
|
+
* unwrapping the various shapes the Connect API and jsforce may return.
|
|
46
|
+
*/
|
|
47
|
+
function parseErrorMessage(error) {
|
|
48
|
+
const err = error;
|
|
49
|
+
const data = (err.response?.data ?? err.body ?? err);
|
|
50
|
+
const message = (typeof data === 'object' &&
|
|
51
|
+
data !== null &&
|
|
52
|
+
(data.message ??
|
|
53
|
+
data.error ??
|
|
54
|
+
data.errorDescription)) ||
|
|
55
|
+
err.message ||
|
|
56
|
+
'Unknown error';
|
|
57
|
+
const details = typeof data === 'object' && data !== null && Array.isArray(data.body)
|
|
58
|
+
? data.body.join('; ')
|
|
59
|
+
: undefined;
|
|
60
|
+
return details ? `${String(message)}: ${details}` : String(message);
|
|
61
|
+
}
|
|
58
62
|
//# sourceMappingURL=createWorkItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWorkItem.js","sourceRoot":"","sources":["../../src/utils/createWorkItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmBH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAA4B;IAC/D,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAE/D,MAAM,IAAI,GAAG,mBAAmB,UAAU,CAAC,aAAa,EAAE,4BAA4B,SAAS,WAAW,CAAC;IAC3G,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,IAAI,EAAE,EAAE,CAAC,CAAC;IAEzE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACxC,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,IAAI;YACT,IAAI;YACJ,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAChD,CAAC,CAAC;QACH,MAAM,IAAI,GAAI,QAAoC,IAAI,EAAE,CAAC;QACzD,OAAO;YACL,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAuB;
|
|
1
|
+
{"version":3,"file":"createWorkItem.js","sourceRoot":"","sources":["../../src/utils/createWorkItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmBH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAA4B;IAC/D,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAE/D,MAAM,IAAI,GAAG,mBAAmB,UAAU,CAAC,aAAa,EAAE,4BAA4B,SAAS,WAAW,CAAC;IAC3G,MAAM,IAAI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AC;IAClB,MAAM,OAAO,GACX,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAE,IAAgC,CAAC,IAAI,CAAC;QAChG,CAAC,CAAG,IAAkC,CAAC,IAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;QACnE,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -19,3 +19,23 @@ export type PromoteStageResult = {
|
|
|
19
19
|
* POST /services/data/v{version}/connect/devops/pipelines/{pipelineId}/promote
|
|
20
20
|
*/
|
|
21
21
|
export declare function promoteStage(params: PromoteStageParams): Promise<PromoteStageResult>;
|
|
22
|
+
/**
|
|
23
|
+
* DevopsPipelnStgProm.Status values that indicate a promotion has been submitted
|
|
24
|
+
* but has not yet finished (i.e. is still in flight).
|
|
25
|
+
*/
|
|
26
|
+
export declare const IN_FLIGHT_PROMOTION_STATUSES: readonly ["NEW", "IN_PROGRESS", "FINALIZING"];
|
|
27
|
+
export type InFlightPromotion = {
|
|
28
|
+
id: string;
|
|
29
|
+
requestToken: string;
|
|
30
|
+
status: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Returns any in-flight promotions targeting the given pipeline stage.
|
|
34
|
+
*
|
|
35
|
+
* DevopsPipelnStgProm (Pipeline Stage Promotion) records the target stage of a promotion
|
|
36
|
+
* (PipelineStageId) and links to its DevopsRequestInfo, so the check is scoped to the
|
|
37
|
+
* specific target stage — and therefore its pipeline — rather than the whole org. Used to
|
|
38
|
+
* block a duplicate promotion to the same stage while one is already running, without
|
|
39
|
+
* affecting promotions in other stages or pipelines.
|
|
40
|
+
*/
|
|
41
|
+
export declare function findInFlightPromotions(connection: Connection, targetStageId: string): Promise<InFlightPromotion[]>;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { validateSalesforceId } from './soqlUtils.js';
|
|
16
17
|
/**
|
|
17
18
|
* Promotes work items to a target pipeline stage via the Connect API.
|
|
18
19
|
* POST /services/data/v{version}/connect/devops/pipelines/{pipelineId}/promote
|
|
@@ -43,4 +44,28 @@ export async function promoteStage(params) {
|
|
|
43
44
|
promotedWorkitemIds: response.promotedWorkitemIds ?? [],
|
|
44
45
|
};
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* DevopsPipelnStgProm.Status values that indicate a promotion has been submitted
|
|
49
|
+
* but has not yet finished (i.e. is still in flight).
|
|
50
|
+
*/
|
|
51
|
+
export const IN_FLIGHT_PROMOTION_STATUSES = ['NEW', 'IN_PROGRESS', 'FINALIZING'];
|
|
52
|
+
/**
|
|
53
|
+
* Returns any in-flight promotions targeting the given pipeline stage.
|
|
54
|
+
*
|
|
55
|
+
* DevopsPipelnStgProm (Pipeline Stage Promotion) records the target stage of a promotion
|
|
56
|
+
* (PipelineStageId) and links to its DevopsRequestInfo, so the check is scoped to the
|
|
57
|
+
* specific target stage — and therefore its pipeline — rather than the whole org. Used to
|
|
58
|
+
* block a duplicate promotion to the same stage while one is already running, without
|
|
59
|
+
* affecting promotions in other stages or pipelines.
|
|
60
|
+
*/
|
|
61
|
+
export async function findInFlightPromotions(connection, targetStageId) {
|
|
62
|
+
validateSalesforceId(targetStageId, 'target stage');
|
|
63
|
+
const statusList = IN_FLIGHT_PROMOTION_STATUSES.join("', '");
|
|
64
|
+
const result = await connection.query(`SELECT Id, Status, RequestInfoId, RequestInfo.RequestToken FROM DevopsPipelnStgProm WHERE PipelineStageId = '${targetStageId}' AND Status IN ('${statusList}') LIMIT 10`);
|
|
65
|
+
return (result.records ?? []).map((r) => ({
|
|
66
|
+
id: r.Id,
|
|
67
|
+
requestToken: r.RequestInfo?.RequestToken ?? r.RequestInfoId ?? '',
|
|
68
|
+
status: r.Status,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
46
71
|
//# sourceMappingURL=promoteStage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promoteStage.js","sourceRoot":"","sources":["../../src/utils/promoteStage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"promoteStage.js","sourceRoot":"","sources":["../../src/utils/promoteStage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AA0BtD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAA0B;IAC3D,MAAM,EACJ,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,SAAS,EACrB,QAAQ,GACT,GAAG,MAAM,CAAC;IAEX,MAAM,IAAI,GAAG,mBAAmB,UAAU,CAAC,aAAa,EAAE,6BAA6B,UAAU,UAAU,CAAC;IAE5G,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAuB;QAC9D,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,WAAW,EAAE,WAAW;YACxB,aAAa;YACb,mBAAmB,EAAE,KAAK;YAC1B,aAAa,EAAE,KAAK;YACpB,aAAa,EAAE;gBACb,SAAS;gBACT,YAAY,EAAE,UAAU;gBACxB,QAAQ,EAAE,QAAQ,IAAI,EAAE;aACzB;SACF,CAAC;QACF,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAC;IAEH,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE;QACnC,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,EAAE;QAC7B,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,EAAE;QAC/B,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,IAAI,EAAE;KACxD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AAe1F;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAsB,EACtB,aAAqB;IAErB,oBAAoB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,4BAA4B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CACnC,gHAAgH,aAAa,qBAAqB,UAAU,aAAa,CAC1K,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxC,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,WAAW,EAAE,YAAY,IAAI,CAAC,CAAC,aAAa,IAAI,EAAE;QAClE,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -23,10 +23,30 @@ export type UpdateWorkItemResult = {
|
|
|
23
23
|
export declare const ALLOWED_STATUSES: readonly ["In Progress", "Ready to Promote"];
|
|
24
24
|
export type AllowedStatus = (typeof ALLOWED_STATUSES)[number];
|
|
25
25
|
export declare function toApiStatus(status: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Allowed current statuses for each target status a user can set. A work item may only move
|
|
28
|
+
* to IN_PROGRESS while it is NEW, and to READY_TO_PROMOTE while it is IN_REVIEW. Target statuses
|
|
29
|
+
* absent from this map have no precondition.
|
|
30
|
+
*/
|
|
31
|
+
export declare const STATUS_TRANSITION_PRECONDITIONS: Record<string, readonly string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Verifies that the work item's current status permits the requested transition. Throws with a
|
|
34
|
+
* descriptive error when it does not. Only runs a query when the target status has a precondition,
|
|
35
|
+
* so subject/description-only updates are unaffected.
|
|
36
|
+
*/
|
|
37
|
+
export declare function assertStatusTransitionAllowed(connection: Connection, workItemId: string, targetApiStatus: string): Promise<void>;
|
|
26
38
|
export declare function resolveWorkItemByName(connection: Connection, workItemName: string): Promise<WorkItemContext>;
|
|
27
39
|
export declare function resolveProjectIdForWorkItem(connection: Connection, workItemId: string): Promise<string>;
|
|
28
40
|
/**
|
|
29
|
-
* Updates
|
|
30
|
-
*
|
|
41
|
+
* Updates a DevOps Center work item.
|
|
42
|
+
*
|
|
43
|
+
* Subject and description are plain WorkItem sObject fields — the DevOps Center connect work item
|
|
44
|
+
* endpoint does not accept them — so they are written via the sObject API. Status changes go
|
|
45
|
+
* through the connect endpoint (PATCH /connect/devops/projects/{projectId}/workitem/{workItemId}),
|
|
46
|
+
* which is the only field that endpoint accepts, so platform-side status handling runs.
|
|
47
|
+
*
|
|
48
|
+
* The two writes hit different APIs with no shared transaction. Subject/description are committed
|
|
49
|
+
* first; if the status call then fails, this returns `{ success: false }` with an error that names
|
|
50
|
+
* the fields that did persist, rather than throwing and leaving the committed changes unreported.
|
|
31
51
|
*/
|
|
32
52
|
export declare function updateWorkItem(params: UpdateWorkItemParams): Promise<UpdateWorkItemResult>;
|
|
@@ -26,6 +26,36 @@ export function toApiStatus(status) {
|
|
|
26
26
|
}
|
|
27
27
|
return apiStatus;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Allowed current statuses for each target status a user can set. A work item may only move
|
|
31
|
+
* to IN_PROGRESS while it is NEW, and to READY_TO_PROMOTE while it is IN_REVIEW. Target statuses
|
|
32
|
+
* absent from this map have no precondition.
|
|
33
|
+
*/
|
|
34
|
+
export const STATUS_TRANSITION_PRECONDITIONS = {
|
|
35
|
+
IN_PROGRESS: ['NEW'],
|
|
36
|
+
READY_TO_PROMOTE: ['IN_REVIEW'],
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Verifies that the work item's current status permits the requested transition. Throws with a
|
|
40
|
+
* descriptive error when it does not. Only runs a query when the target status has a precondition,
|
|
41
|
+
* so subject/description-only updates are unaffected.
|
|
42
|
+
*/
|
|
43
|
+
export async function assertStatusTransitionAllowed(connection, workItemId, targetApiStatus) {
|
|
44
|
+
const allowedFrom = STATUS_TRANSITION_PRECONDITIONS[targetApiStatus];
|
|
45
|
+
if (!allowedFrom) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
validateSalesforceId(workItemId, 'work item');
|
|
49
|
+
const result = await connection.query(`SELECT Status FROM WorkItem WHERE Id = '${workItemId}' LIMIT 1`);
|
|
50
|
+
const current = result.records?.[0]?.Status;
|
|
51
|
+
if (!current) {
|
|
52
|
+
throw new Error(`Work item with ID '${workItemId}' not found.`);
|
|
53
|
+
}
|
|
54
|
+
if (!allowedFrom.includes(current)) {
|
|
55
|
+
const allowed = allowedFrom.join(', ');
|
|
56
|
+
throw new Error(`Cannot change status to ${targetApiStatus}: the work item is currently ${current}, but this transition is only allowed from ${allowed}.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
29
59
|
export async function resolveWorkItemByName(connection, workItemName) {
|
|
30
60
|
const result = await connection.query(`SELECT Id, DevopsProjectId FROM WorkItem WHERE Name = '${escapeSOQL(workItemName)}' LIMIT 1`);
|
|
31
61
|
const record = (result.records ?? [])[0];
|
|
@@ -44,32 +74,80 @@ export async function resolveProjectIdForWorkItem(connection, workItemId) {
|
|
|
44
74
|
return record.DevopsProjectId;
|
|
45
75
|
}
|
|
46
76
|
/**
|
|
47
|
-
* Updates
|
|
48
|
-
*
|
|
77
|
+
* Updates a DevOps Center work item.
|
|
78
|
+
*
|
|
79
|
+
* Subject and description are plain WorkItem sObject fields — the DevOps Center connect work item
|
|
80
|
+
* endpoint does not accept them — so they are written via the sObject API. Status changes go
|
|
81
|
+
* through the connect endpoint (PATCH /connect/devops/projects/{projectId}/workitem/{workItemId}),
|
|
82
|
+
* which is the only field that endpoint accepts, so platform-side status handling runs.
|
|
83
|
+
*
|
|
84
|
+
* The two writes hit different APIs with no shared transaction. Subject/description are committed
|
|
85
|
+
* first; if the status call then fails, this returns `{ success: false }` with an error that names
|
|
86
|
+
* the fields that did persist, rather than throwing and leaving the committed changes unreported.
|
|
49
87
|
*/
|
|
50
88
|
export async function updateWorkItem(params) {
|
|
51
89
|
const { connection, workItemId, projectId, status, subject, description } = params;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
90
|
+
// Validate the status transition before writing any field. This guard is read-only, so running it
|
|
91
|
+
// first avoids persisting subject/description when the status change would be rejected — otherwise
|
|
92
|
+
// a combined --subject/--status call could silently keep the subject change after throwing.
|
|
93
|
+
let apiStatus;
|
|
94
|
+
if (status !== undefined) {
|
|
95
|
+
apiStatus = toApiStatus(status);
|
|
96
|
+
await assertStatusTransitionAllowed(connection, workItemId, apiStatus);
|
|
97
|
+
}
|
|
98
|
+
if (subject !== undefined || description !== undefined) {
|
|
99
|
+
const fields = { Id: workItemId };
|
|
100
|
+
if (subject !== undefined)
|
|
101
|
+
fields.Subject = subject;
|
|
102
|
+
if (description !== undefined)
|
|
103
|
+
fields.Description = description;
|
|
104
|
+
const saveResult = await connection.sobject('WorkItem').update(fields);
|
|
105
|
+
if (!saveResult.success) {
|
|
106
|
+
const errorMsg = saveResult.errors
|
|
107
|
+
.map((e) => (typeof e === 'string' ? e : e.message))
|
|
108
|
+
.filter(Boolean)
|
|
109
|
+
.join('; ');
|
|
110
|
+
return { success: false, workItemId, error: errorMsg || 'Failed to update work item fields.' };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (apiStatus) {
|
|
114
|
+
const path = `/services/data/v${connection.getApiVersion()}/connect/devops/projects/${projectId}/workitem/${workItemId}`;
|
|
115
|
+
try {
|
|
116
|
+
await connection.request({
|
|
117
|
+
method: 'PATCH',
|
|
118
|
+
url: path,
|
|
119
|
+
body: JSON.stringify({ status: apiStatus }),
|
|
120
|
+
headers: { 'Content-Type': 'application/json' },
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
// The subject/description sObject write above has already committed. The two writes go to
|
|
125
|
+
// different APIs with no shared transaction, so a status failure here can't roll them back.
|
|
126
|
+
// Report a partial success instead of throwing, so the caller can tell the user exactly which
|
|
127
|
+
// fields persisted rather than surfacing a bare error that hides the committed changes.
|
|
128
|
+
const statusError = error instanceof Error ? error.message : String(error);
|
|
129
|
+
const persisted = [
|
|
130
|
+
subject !== undefined ? 'subject' : undefined,
|
|
131
|
+
description !== undefined ? 'description' : undefined,
|
|
132
|
+
].filter(Boolean);
|
|
133
|
+
const persistedNote = persisted.length > 0
|
|
134
|
+
? ` The ${persisted.join(' and ')} ${persisted.length > 1 ? 'changes were' : 'change was'} already saved.`
|
|
135
|
+
: '';
|
|
136
|
+
return {
|
|
137
|
+
success: false,
|
|
138
|
+
workItemId,
|
|
139
|
+
subject,
|
|
140
|
+
description,
|
|
141
|
+
error: `Failed to update work item status: ${statusError}.${persistedNote}`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
67
145
|
return {
|
|
68
146
|
success: true,
|
|
69
147
|
workItemId,
|
|
70
|
-
status:
|
|
71
|
-
subject
|
|
72
|
-
description
|
|
148
|
+
status: apiStatus,
|
|
149
|
+
subject,
|
|
150
|
+
description,
|
|
73
151
|
};
|
|
74
152
|
}
|
|
75
153
|
//# sourceMappingURL=updateWorkItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateWorkItem.js","sourceRoot":"","sources":["../../src/utils/updateWork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AAQ,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,iBAAiB;gBAC1G,CAAC,CAAC,EAAE,CAAC;YACT,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,UAAU;gBACV,OAAO;gBACP,WAAW;gBACX,KAAK,EAAE,sCAAsC,WAAW,IAAI,aAAa,EAAE;aAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,UAAU;QACV,MAAM,EAAE,SAAS;QACjB,OAAO;QACP,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
package/lib/utils/workItems.js
CHANGED
|
@@ -147,10 +147,13 @@ function mapRawItemToWorkItem(item, ctx, providerOwnerMap) {
|
|
|
147
147
|
PipelineId: ctx?.pipelineId,
|
|
148
148
|
};
|
|
149
149
|
if (ctx) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
// A work item's changes are promoted into the branch of its *next* pipeline stage. Only fall
|
|
151
|
+
// back to the first stage when the work item hasn't entered the pipeline yet (no current stage);
|
|
152
|
+
// a work item already on the final stage has no next stage, so it has no target branch (e.g. a
|
|
153
|
+
// closed work item that reached the last stage), and the branch is left blank.
|
|
154
|
+
const targetStageId = mapped.PipelineStageId
|
|
155
|
+
? resolveTargetStageId(mapped.PipelineStageId, ctx.stages)
|
|
156
|
+
: ctx.firstStageId;
|
|
154
157
|
const targetStage = findStageById(ctx.stages, targetStageId);
|
|
155
158
|
mapped.TargetBranch = getBranchNameFromStage(targetStage);
|
|
156
159
|
mapped.TargetStageId = targetStageId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workItems.js","sourceRoot":"","sources":["../../src/utils/workItems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,mBAAmB,EACnB,mBAAm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MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAAsB,EAAE,SAAiB;IAC5E,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG;;;;;;;;;;;;+BAYe,SAAS;GACrC,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAsB,KAAK,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAuC,CAAC;IAC1E,MAAM,GAAG,GAAG,MAAM,mBAAmB,CAAC,UAAU,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAC;IACjF,MAAM,gBAAgB,GAAG,MAAM,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAE7E,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAY,EAAE,CAAC,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -42,6 +42,10 @@ Bitbucket project key to associate with the repository. Optional when creating a
|
|
|
42
42
|
|
|
43
43
|
Name of a pipeline stage, in promotion order. Repeat the flag for each stage. Defaults to Integration, UAT, Staging, and Production.
|
|
44
44
|
|
|
45
|
+
# flags.project-id.summary
|
|
46
|
+
|
|
47
|
+
ID of a project to associate with the pipeline. Repeat the flag to associate multiple projects.
|
|
48
|
+
|
|
45
49
|
# examples
|
|
46
50
|
|
|
47
51
|
- Create a pipeline and associate it with an existing GitHub repository:
|
|
@@ -64,6 +68,10 @@ Name of a pipeline stage, in promotion order. Repeat the flag for each stage. De
|
|
|
64
68
|
|
|
65
69
|
<%= config.bin %> <%= command.id %> --target-org my-devops-org --name "Release Pipeline" --repo https://github.com/myorg/myrepo --stage Dev --stage QA --stage Prod
|
|
66
70
|
|
|
71
|
+
- Create a pipeline and associate one or more projects with it:
|
|
72
|
+
|
|
73
|
+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --name "Release Pipeline" --repo https://github.com/myorg/myrepo --project-id 0Hn000000000001 --project-id 0Hn000000000002
|
|
74
|
+
|
|
67
75
|
# error.RepoTypeRequired
|
|
68
76
|
|
|
69
77
|
The --repo-type flag is required when using --create-repo. Specify --repo-type github or --repo-type bitbucket.
|
|
@@ -52,6 +52,18 @@ ID of the source pipeline stage whose approved work items will be promoted. Mutu
|
|
|
52
52
|
|
|
53
53
|
Skip pre-promote validation. By default, promotion is validated before proceeding to prevent promoting work items without an associated PR. Use this flag to bypass validation.
|
|
54
54
|
|
|
55
|
+
# flags.force.summary
|
|
56
|
+
|
|
57
|
+
Submit the promotion even if another promotion to the same target stage is already in progress. By default, the command blocks to avoid creating duplicate promotions.
|
|
58
|
+
|
|
59
|
+
# error.PromotionInFlight
|
|
60
|
+
|
|
61
|
+
A promotion to this stage is already in progress (request token%s: %s). Submitting now can create a duplicate promotion. Wait for it to finish (check with "%s devops request status --request-token <token>"), or pass --force to promote anyway.
|
|
62
|
+
|
|
63
|
+
# warn.InFlightCheckSkipped
|
|
64
|
+
|
|
65
|
+
Couldn't check for in-flight promotions to this stage, so a duplicate promotion may not be blocked: %s
|
|
66
|
+
|
|
55
67
|
# error.NoModeFlag
|
|
56
68
|
|
|
57
69
|
Provide either --work-item-id to promote specific work items or --stage-id to promote all approved work items from a stage.
|
|
@@ -5,7 +5,7 @@ Add a source code repository branch to a pipeline stage.
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
7
|
By default, the branch must exist in the repository. Use --create-vcs-branch to create a branch if it doesn't exist.
|
|
8
|
-
Each pipeline stage supports only one branch.
|
|
8
|
+
Each pipeline stage supports only one branch. If the stage already has a branch, the command blocks so the existing branch isn't orphaned; pass --force to replace it.
|
|
9
9
|
|
|
10
10
|
# flags.pipeline-id.summary
|
|
11
11
|
|
|
@@ -23,6 +23,10 @@ Name of the repository branch to assign to the stage.
|
|
|
23
23
|
|
|
24
24
|
Create the branch in the remote repository if it doesn't already exist.
|
|
25
25
|
|
|
26
|
+
# flags.force.summary
|
|
27
|
+
|
|
28
|
+
Replace the stage's existing branch. By default, the command blocks if the stage already has a branch to avoid orphaning it. With this flag, the new branch is associated and the previous branch record is removed if no other stage references it.
|
|
29
|
+
|
|
26
30
|
# examples
|
|
27
31
|
|
|
28
32
|
- Add an existing branch to a stage:
|
|
@@ -44,3 +48,15 @@ You must set up a branch on stage "%s" before configuring stage "%s". Branches m
|
|
|
44
48
|
# error.BranchAttachFailed
|
|
45
49
|
|
|
46
50
|
Failed to associate branch with stage: %s
|
|
51
|
+
|
|
52
|
+
# error.BranchAlreadyExists
|
|
53
|
+
|
|
54
|
+
Stage "%s" already has a branch ("%s"). Adding another would leave the existing one orphaned. Remove it first with "%s devops stage branch delete", or pass --force to replace it.
|
|
55
|
+
|
|
56
|
+
# info.ReplacedBranchRemoved
|
|
57
|
+
|
|
58
|
+
Removed the stage's previous branch "%s".
|
|
59
|
+
|
|
60
|
+
# warn.ReplacedBranchCleanupFailed
|
|
61
|
+
|
|
62
|
+
Associated the new branch, but couldn't remove the previous branch record (%s). Remove it manually if it's no longer needed.
|
|
@@ -26,6 +26,10 @@ Type of the Salesforce org. Valid values: Production, Sandbox.
|
|
|
26
26
|
|
|
27
27
|
Don't auto-open the browser for OAuth authentication. The redirect URL is printed for manual use.
|
|
28
28
|
|
|
29
|
+
# flags.force.summary
|
|
30
|
+
|
|
31
|
+
Replace the stage's existing environment. By default, the command blocks if the stage already has an environment to avoid orphaning it. With this flag, the new environment is added first and the previous one is removed only after the new environment is associated successfully.
|
|
32
|
+
|
|
29
33
|
# examples
|
|
30
34
|
|
|
31
35
|
- Add a production environment to a stage using its ID:
|
|
@@ -60,6 +64,18 @@ Pipeline stage "%s" doesn't exist in pipeline "%s". Check the stage ID and try a
|
|
|
60
64
|
|
|
61
65
|
Failed to create environment for stage: %s
|
|
62
66
|
|
|
67
|
+
# error.EnvironmentAlreadyExists
|
|
68
|
+
|
|
69
|
+
Stage "%s" already has an environment ("%s", %s). Adding another would leave the existing one orphaned. Remove it first with "%s devops stage environment delete", or pass --force to replace it.
|
|
70
|
+
|
|
71
|
+
# info.ReplacedEnvironmentRemoved
|
|
72
|
+
|
|
73
|
+
Removed the stage's previous environment "%s".
|
|
74
|
+
|
|
75
|
+
# warn.ReplacedEnvironmentCleanupFailed
|
|
76
|
+
|
|
77
|
+
Associated the new environment, but couldn't remove the previous environment record (%s). Remove it manually if it's no longer needed.
|
|
78
|
+
|
|
63
79
|
# error.AuthTimeout
|
|
64
80
|
|
|
65
81
|
Authentication timed out. The environment was created but not yet authenticated. Re-run the command or authenticate manually via the org's DevOps Center setup.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-devops-center",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@salesforce/plugin-devops-center",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.3.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@jsforce/jsforce-node": "^3",
|
package/oclif.manifest.json
CHANGED
|
@@ -113,6 +113,12 @@
|
|
|
113
113
|
"summary": "Skip pre-promote validation. By default, promotion is validated before proceeding to prevent promoting work items without an associated PR. Use this flag to bypass validation.",
|
|
114
114
|
"allowNo": false,
|
|
115
115
|
"type": "boolean"
|
|
116
|
+
},
|
|
117
|
+
"force": {
|
|
118
|
+
"name": "force",
|
|
119
|
+
"summary": "Submit the promotion even if another promotion to the same target stage is already in progress. By default, the command blocks to avoid creating duplicate promotions.",
|
|
120
|
+
"allowNo": false,
|
|
121
|
+
"type": "boolean"
|
|
116
122
|
}
|
|
117
123
|
},
|
|
118
124
|
"hasDynamicHelp": true,
|
|
@@ -141,7 +147,8 @@
|
|
|
141
147
|
"Create a pipeline and associate it with a new GitHub repository:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --name \"Release Pipeline\" --repo my-new-repo --repo-type github --repo-owner myorg --create-repo",
|
|
142
148
|
"Create a pipeline and create a new Bitbucket repository:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --name \"Release Pipeline\" --repo my-new-repo --repo-type bitbucket --bitbucket-workspace myworkspace --bitbucket-project-key PROJ --create-repo",
|
|
143
149
|
"Create a pipeline and associate it with an existing Bitbucket repository:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --name \"Release Pipeline\" --repo https://bitbucket.org/myworkspace/myrepo",
|
|
144
|
-
"Create a pipeline with custom stage names instead of the default stages:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --name \"Release Pipeline\" --repo https://github.com/myorg/myrepo --stage Dev --stage QA --stage Prod"
|
|
150
|
+
"Create a pipeline with custom stage names instead of the default stages:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --name \"Release Pipeline\" --repo https://github.com/myorg/myrepo --stage Dev --stage QA --stage Prod",
|
|
151
|
+
"Create a pipeline and associate one or more projects with it:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --name \"Release Pipeline\" --repo https://github.com/myorg/myrepo --project-id 0Hn000000000001 --project-id 0Hn000000000002"
|
|
145
152
|
],
|
|
146
153
|
"flags": {
|
|
147
154
|
"json": {
|
|
@@ -239,6 +246,13 @@
|
|
|
239
246
|
"hasDynamicHelp": false,
|
|
240
247
|
"multiple": true,
|
|
241
248
|
"type": "option"
|
|
249
|
+
},
|
|
250
|
+
"project-id": {
|
|
251
|
+
"name": "project-id",
|
|
252
|
+
"summary": "ID of a project to associate with the pipeline. Repeat the flag to associate multiple projects.",
|
|
253
|
+
"hasDynamicHelp": false,
|
|
254
|
+
"multiple": true,
|
|
255
|
+
"type": "option"
|
|
242
256
|
}
|
|
243
257
|
},
|
|
244
258
|
"hasDynamicHelp": true,
|
|
@@ -1861,7 +1875,7 @@
|
|
|
1861
1875
|
"devops:stage:branch:add": {
|
|
1862
1876
|
"aliases": [],
|
|
1863
1877
|
"args": {},
|
|
1864
|
-
"description": "By default, the branch must exist in the repository. Use --create-vcs-branch to create a branch if it doesn't exist.\nEach pipeline stage supports only one branch.
|
|
1878
|
+
"description": "By default, the branch must exist in the repository. Use --create-vcs-branch to create a branch if it doesn't exist.\nEach pipeline stage supports only one branch. If the stage already has a branch, the command blocks so the existing branch isn't orphaned; pass --force to replace it.",
|
|
1865
1879
|
"examples": [
|
|
1866
1880
|
"Add an existing branch to a stage:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --pipeline-id 0Xo000000000001 --stage-id 0Xp000000000001 --branch-name main",
|
|
1867
1881
|
"Create and add a branch to a pipeline stage:\n<%= config.bin %> <%= command.id %> --target-org my-devops-org --pipeline-id 0Xo000000000001 --stage-id 0Xp000000000002 --branch-name integration --create-vcs-branch"
|
|
@@ -1929,6 +1943,12 @@
|
|
|
1929
1943
|
"summary": "Create the branch in the remote repository if it doesn't already exist.",
|
|
1930
1944
|
"allowNo": false,
|
|
1931
1945
|
"type": "boolean"
|
|
1946
|
+
},
|
|
1947
|
+
"force": {
|
|
1948
|
+
"name": "force",
|
|
1949
|
+
"summary": "Replace the stage's existing branch. By default, the command blocks if the stage already has a branch to avoid orphaning it. With this flag, the new branch is associated and the previous branch record is removed if no other stage references it.",
|
|
1950
|
+
"allowNo": false,
|
|
1951
|
+
"type": "boolean"
|
|
1932
1952
|
}
|
|
1933
1953
|
},
|
|
1934
1954
|
"hasDynamicHelp": true,
|
|
@@ -2108,6 +2128,12 @@
|
|
|
2108
2128
|
"summary": "Don't auto-open the browser for OAuth authentication. The redirect URL is printed for manual use.",
|
|
2109
2129
|
"allowNo": false,
|
|
2110
2130
|
"type": "boolean"
|
|
2131
|
+
},
|
|
2132
|
+
"force": {
|
|
2133
|
+
"name": "force",
|
|
2134
|
+
"summary": "Replace the stage's existing environment. By default, the command blocks if the stage already has an environment to avoid orphaning it. With this flag, the new environment is added first and the previous one is removed only after the new environment is associated successfully.",
|
|
2135
|
+
"allowNo": false,
|
|
2136
|
+
"type": "boolean"
|
|
2111
2137
|
}
|
|
2112
2138
|
},
|
|
2113
2139
|
"hasDynamicHelp": true,
|
|
@@ -2783,5 +2809,5 @@
|
|
|
2783
2809
|
]
|
|
2784
2810
|
}
|
|
2785
2811
|
},
|
|
2786
|
-
"version": "2.
|
|
2812
|
+
"version": "2.3.0"
|
|
2787
2813
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-devops-center",
|
|
3
3
|
"description": "The DevOps Center CLI plugin provides a command-line alternative to performing equivalent actions in the DevOps Center graphical UI",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Salesforce",
|
|
7
7
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
}
|
|
257
257
|
},
|
|
258
258
|
"sfdx": {
|
|
259
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-devops-center/2.
|
|
260
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-devops-center/2.
|
|
259
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-devops-center/2.3.0.crt",
|
|
260
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-devops-center/2.3.0.sig"
|
|
261
261
|
}
|
|
262
262
|
}
|