@bpmsoftwaresolutions/ai-engine-client 1.1.15 → 1.1.16
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/package.json +1 -1
- package/src/index.js +39 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1164,9 +1164,40 @@ export class AIEngineClient {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
1166
|
async updateImplementationItemStatus(implementationItemId, body) {
|
|
1167
|
-
|
|
1167
|
+
const result = await this._request(`/api/governed-implementation/items/${implementationItemId}/status`, {
|
|
1168
1168
|
method: 'PATCH', body,
|
|
1169
1169
|
});
|
|
1170
|
+
const expectedStatus = cleanText(body?.status);
|
|
1171
|
+
const authoritativeItem = isPlainObject(result?.implementation_item) ? result.implementation_item : null;
|
|
1172
|
+
const actualStatus = cleanText(authoritativeItem?.status);
|
|
1173
|
+
if (expectedStatus && !authoritativeItem) {
|
|
1174
|
+
throw buildVerificationError(
|
|
1175
|
+
`updateImplementationItemStatus did not return authoritative item state for ${implementationItemId}.`,
|
|
1176
|
+
{
|
|
1177
|
+
mutation_name: 'updateImplementationItemStatus',
|
|
1178
|
+
mutation_attempted: true,
|
|
1179
|
+
authoritative_read_performed: false,
|
|
1180
|
+
post_condition_verified: false,
|
|
1181
|
+
expected_state: { status: expectedStatus },
|
|
1182
|
+
mutation_result: result ?? null,
|
|
1183
|
+
},
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1186
|
+
if (expectedStatus && actualStatus !== expectedStatus) {
|
|
1187
|
+
throw buildVerificationError(
|
|
1188
|
+
`updateImplementationItemStatus returned ${actualStatus ?? 'unknown'} instead of ${expectedStatus}.`,
|
|
1189
|
+
{
|
|
1190
|
+
mutation_name: 'updateImplementationItemStatus',
|
|
1191
|
+
mutation_attempted: true,
|
|
1192
|
+
authoritative_read_performed: true,
|
|
1193
|
+
post_condition_verified: false,
|
|
1194
|
+
expected_state: { status: expectedStatus },
|
|
1195
|
+
verified_current_state: authoritativeItem ?? result ?? null,
|
|
1196
|
+
mutation_result: result ?? null,
|
|
1197
|
+
},
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
return result;
|
|
1170
1201
|
}
|
|
1171
1202
|
|
|
1172
1203
|
async addImplementationItemEvidence(implementationItemId, body) {
|
|
@@ -1316,15 +1347,17 @@ export class AIEngineClient {
|
|
|
1316
1347
|
}
|
|
1317
1348
|
|
|
1318
1349
|
async updateImplementationItemStatusVerified(implementationItemId, status, body = {}) {
|
|
1319
|
-
const workflowId = cleanText(body.workflowId) || cleanText(body.workflow_id);
|
|
1320
|
-
if (!workflowId) {
|
|
1321
|
-
throw new Error('workflowId is required to verify implementation item status.');
|
|
1322
|
-
}
|
|
1323
1350
|
return this.executeVerifiedMutation({
|
|
1324
1351
|
mutationName: 'updateImplementationItemStatus',
|
|
1325
1352
|
evidenceLabel: `implementation-item-status:${implementationItemId}`,
|
|
1326
1353
|
mutationFn: () => this.updateImplementationItemStatus(implementationItemId, { ...body, status }),
|
|
1327
|
-
verificationFn: async () => {
|
|
1354
|
+
verificationFn: async (mutationResult) => {
|
|
1355
|
+
const workflowId = cleanText(body.workflowId)
|
|
1356
|
+
|| cleanText(body.workflow_id)
|
|
1357
|
+
|| cleanText(mutationResult?.workflow_id);
|
|
1358
|
+
if (!workflowId) {
|
|
1359
|
+
throw new Error('workflowId is required to verify implementation item status.');
|
|
1360
|
+
}
|
|
1328
1361
|
const roadmap = await this.getWorkflowImplementationRoadmap(workflowId);
|
|
1329
1362
|
const items = Array.isArray(roadmap?.items) ? roadmap.items : [];
|
|
1330
1363
|
const matchedItem = items.find((item) => item?.implementation_item_id === implementationItemId) || null;
|