@bpmsoftwaresolutions/ai-engine-client 1.1.41 → 1.1.42

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +15 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmsoftwaresolutions/ai-engine-client",
3
- "version": "1.1.41",
3
+ "version": "1.1.42",
4
4
  "description": "Thin npm client for the AI Engine operator and retrieval APIs",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const DEFAULT_TIMEOUT_MS = 30000;
2
- export const AI_ENGINE_CLIENT_VERSION = '1.1.41';
2
+ export const AI_ENGINE_CLIENT_VERSION = '1.1.42';
3
3
  export const GOVERNED_MUTATION_REQUIRED_CAPABILITIES = [
4
4
  'executeVerifiedMutation',
5
5
  'post_mutation_verification',
@@ -1587,23 +1587,26 @@ export class AIEngineClient {
1587
1587
  }
1588
1588
  }
1589
1589
 
1590
- if (!resolvedWorkflowId) {
1590
+ if (resolvedRuns.length > 0 && !resolvedWorkflowId) {
1591
1591
  throw new Error('workflowId could not be resolved for project cleanup.');
1592
1592
  }
1593
- if (resolvedRuns.length === 0) {
1594
- throw new Error('workflowRunIds could not be resolved for project cleanup.');
1593
+
1594
+ const cleanupPayload = {
1595
+ project_id: normalizedProjectId,
1596
+ reason: normalizedReason,
1597
+ operator_identity: normalizedOperatorIdentity,
1598
+ run_terminal_status: cleanText(runTerminalStatus) || 'failed',
1599
+ };
1600
+ if (resolvedWorkflowId) {
1601
+ cleanupPayload.workflow_id = resolvedWorkflowId;
1602
+ }
1603
+ if (resolvedRuns.length > 0) {
1604
+ cleanupPayload.workflow_run_ids = resolvedRuns;
1595
1605
  }
1596
1606
 
1597
1607
  return this._request('/api/operator/cleanup', {
1598
1608
  method: 'POST',
1599
- body: {
1600
- project_id: normalizedProjectId,
1601
- workflow_id: resolvedWorkflowId,
1602
- workflow_run_ids: resolvedRuns,
1603
- reason: normalizedReason,
1604
- operator_identity: normalizedOperatorIdentity,
1605
- run_terminal_status: cleanText(runTerminalStatus) || 'failed',
1606
- },
1609
+ body: cleanupPayload,
1607
1610
  });
1608
1611
  }
1609
1612