@hahnpro/hpc-api 2026.10.7 → 2026.10.8
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/lib/interfaces/ai.interface.d.ts +3 -0
- package/src/lib/interfaces/ai.interface.js +3 -0
- package/src/lib/interfaces/crm-autonomy.interface.d.ts +155 -5
- package/src/lib/interfaces/crm-autonomy.interface.js +15 -0
- package/src/lib/mock/crm.mock.service.d.ts +7 -3
- package/src/lib/mock/crm.mock.service.js +19 -2
- package/src/lib/services/crm.service.d.ts +8 -2
- package/src/lib/services/crm.service.js +17 -3
package/package.json
CHANGED
|
@@ -122,10 +122,13 @@ export declare enum ToolName {
|
|
|
122
122
|
EXECUTE_CRM_IMPORT_PLAN = "crmExecuteImportPlan",
|
|
123
123
|
IMPORT_CRM_ATTACHMENT = "crmImportAttachment",
|
|
124
124
|
LIST_CRM_OPERATIONS = "crmListOperations",
|
|
125
|
+
FIND_CRM_UNDOABLE_OPERATIONS = "crmFindUndoableOperations",
|
|
125
126
|
GET_CRM_OPERATION = "crmGetOperation",
|
|
126
127
|
LIST_CRM_REVIEWS = "crmListReviews",
|
|
127
128
|
RESOLVE_CRM_REVIEW = "crmResolveReview",
|
|
128
129
|
UNDO_CRM_OPERATION = "crmUndoOperation",
|
|
130
|
+
UNDO_CRM_IMPORT = "crmUndoImport",
|
|
131
|
+
RESOLVE_CRM_UNDO_CONFLICT = "crmResolveUndoConflict",
|
|
129
132
|
WEB_SEARCH = "web_search",
|
|
130
133
|
USE_SKILL = "useSkill",
|
|
131
134
|
READ_SKILL_FILE = "readSkillFile",
|
|
@@ -133,10 +133,13 @@ var ToolName;
|
|
|
133
133
|
ToolName["EXECUTE_CRM_IMPORT_PLAN"] = "crmExecuteImportPlan";
|
|
134
134
|
ToolName["IMPORT_CRM_ATTACHMENT"] = "crmImportAttachment";
|
|
135
135
|
ToolName["LIST_CRM_OPERATIONS"] = "crmListOperations";
|
|
136
|
+
ToolName["FIND_CRM_UNDOABLE_OPERATIONS"] = "crmFindUndoableOperations";
|
|
136
137
|
ToolName["GET_CRM_OPERATION"] = "crmGetOperation";
|
|
137
138
|
ToolName["LIST_CRM_REVIEWS"] = "crmListReviews";
|
|
138
139
|
ToolName["RESOLVE_CRM_REVIEW"] = "crmResolveReview";
|
|
139
140
|
ToolName["UNDO_CRM_OPERATION"] = "crmUndoOperation";
|
|
141
|
+
ToolName["UNDO_CRM_IMPORT"] = "crmUndoImport";
|
|
142
|
+
ToolName["RESOLVE_CRM_UNDO_CONFLICT"] = "crmResolveUndoConflict";
|
|
140
143
|
ToolName["WEB_SEARCH"] = "web_search";
|
|
141
144
|
ToolName["USE_SKILL"] = "useSkill";
|
|
142
145
|
ToolName["READ_SKILL_FILE"] = "readSkillFile";
|
|
@@ -75,6 +75,16 @@ export interface CrmAutonomyMergeAudit {
|
|
|
75
75
|
mergedAssetIds: string[];
|
|
76
76
|
undoable: false;
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* How the latest recorded undo attempt ended. `undo_conflict` means an asset had changed and is
|
|
80
|
+
* the only value conflict resolution accepts; `undo_failed` is a technical failure with nothing
|
|
81
|
+
* applied.
|
|
82
|
+
*/
|
|
83
|
+
export type CrmAutonomyUndoResult = 'undone' | 'undo_conflict' | 'partially_undone' | 'undo_failed';
|
|
84
|
+
/** Per-asset undo progress values recorded while holding the undo lease. */
|
|
85
|
+
export type CrmAutonomyUndoProgressValue = 'delete-ready' | 'restore-ready' | 'deleted' | 'restored';
|
|
86
|
+
/** `approved` is recorded before the mutation; `completed`/`failed` record its outcome, `superseded` a later decision that overtook it. */
|
|
87
|
+
export type CrmAutonomyUndoResolutionState = 'approved' | 'completed' | 'failed' | 'superseded';
|
|
78
88
|
export interface CrmAutonomyOperationSummary {
|
|
79
89
|
id: string;
|
|
80
90
|
ownerId: string;
|
|
@@ -96,8 +106,18 @@ export interface CrmAutonomyOperationSummary {
|
|
|
96
106
|
error?: string;
|
|
97
107
|
failureCode?: string;
|
|
98
108
|
failureMessage?: string;
|
|
99
|
-
undoResult?:
|
|
100
|
-
undoProgress?: Record<string,
|
|
109
|
+
undoResult?: CrmAutonomyUndoResult;
|
|
110
|
+
undoProgress?: Record<string, CrmAutonomyUndoProgressValue>;
|
|
111
|
+
/** Requester from the latest recorded attempt; a refused attempt records nothing. */
|
|
112
|
+
undoRequestedBy?: CrmAutonomyTriggeredBy;
|
|
113
|
+
/** When the undo completed. */
|
|
114
|
+
undoneAt?: string;
|
|
115
|
+
/** When the latest recorded attempt reached a final state. */
|
|
116
|
+
lastUndoAttemptAt?: string;
|
|
117
|
+
/** Failure code of the latest recorded failed attempt, cleared by a later recorded outcome that records no failure. */
|
|
118
|
+
undoFailureCode?: string;
|
|
119
|
+
/** When the current undo lease was last taken or refreshed. Present while `status` is `undoing`; once the lease is older than the claim window the next undo request reclaims it and resumes from the recorded progress. */
|
|
120
|
+
undoClaimedAt?: string;
|
|
101
121
|
}
|
|
102
122
|
export interface CrmAutonomyOperationDetail extends CrmAutonomyOperationSummary {
|
|
103
123
|
candidates: CrmAutonomyCandidate[];
|
|
@@ -105,7 +125,13 @@ export interface CrmAutonomyOperationDetail extends CrmAutonomyOperationSummary
|
|
|
105
125
|
afterState?: Record<string, unknown>;
|
|
106
126
|
beforeRevision?: Record<string, number>;
|
|
107
127
|
afterRevision?: Record<string, number>;
|
|
128
|
+
undoConflictResolutions?: CrmAutonomyUndoConflictResolution[];
|
|
129
|
+
/** The approved decision authorizing each created-asset deletion, keyed by asset id. */
|
|
130
|
+
undoAppliedResolutionIds?: Record<string, string>;
|
|
108
131
|
reviewItems?: CrmAutonomyReviewItemSummary[];
|
|
132
|
+
/** Every distinct asset this operation's undo restores or deletes: the count a caller must
|
|
133
|
+
* confirm when undoing from an id it already holds. */
|
|
134
|
+
undoScope?: CrmAutonomyUndoScope;
|
|
109
135
|
}
|
|
110
136
|
export interface CrmAutonomyReviewItemSummary {
|
|
111
137
|
id: string;
|
|
@@ -158,13 +184,44 @@ export interface CrmAutonomyReconcileContactGovernanceResponse {
|
|
|
158
184
|
pendingReasonCodes: Record<string, number>;
|
|
159
185
|
}
|
|
160
186
|
export interface CrmAutonomyOperationQuery {
|
|
161
|
-
status
|
|
187
|
+
/** One status or several; a single value and a comma-separated list are both accepted. */
|
|
188
|
+
status?: CrmAutonomyOperationStatus | CrmAutonomyOperationStatus[];
|
|
189
|
+
/** Case-insensitive match against the recorded candidate names. */
|
|
190
|
+
candidateQuery?: string;
|
|
191
|
+
/** Explicit cap on returned operations; results stay bounded by the search window. */
|
|
192
|
+
limit?: number;
|
|
162
193
|
}
|
|
163
194
|
export interface CrmAutonomyReviewQuery {
|
|
164
195
|
status?: CrmAutonomyReviewStatus;
|
|
165
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Why `undo()` would refuse an operation now. `undo_in_progress` is also reported while a
|
|
199
|
+
* recovery holds the lease, so a running undo is found rather than skipped.
|
|
200
|
+
*/
|
|
201
|
+
export type CrmAutonomyUndoBlocker = 'operation_not_executed' | 'undo_in_progress' | 'pending_review' | 'operation_not_fully_undoable';
|
|
202
|
+
/** An operation-wide undo touches every asset of the operation, not only the named one. */
|
|
203
|
+
export interface CrmAutonomyUndoScope {
|
|
204
|
+
/** Distinct assets the undo would touch whose recorded candidate name matched the query. */
|
|
205
|
+
matchedUndoableAssetCount: number;
|
|
206
|
+
/** Every distinct asset this operation's undo restores or deletes. */
|
|
207
|
+
totalAffectedAssetCount: number;
|
|
208
|
+
}
|
|
166
209
|
export interface CrmAutonomyListOperationsResponse {
|
|
167
210
|
items: CrmAutonomyOperationSummary[];
|
|
211
|
+
/** Executed, undo-eligible candidates that matched `candidateQuery`, keyed by operation id; only present for name lookups. */
|
|
212
|
+
matchedCandidates?: Record<string, Array<Pick<CrmAutonomyCandidate, 'candidateId' | 'entityType' | 'name'>>>;
|
|
213
|
+
/** Undo scope per returned operation; always present, so an id from any surface carries the count to confirm. */
|
|
214
|
+
undoScopes?: Record<string, CrmAutonomyUndoScope>;
|
|
215
|
+
/** Operations that currently fail undo()'s eligibility rules; only present for name lookups, blocked operations only. */
|
|
216
|
+
undoBlockers?: Record<string, CrmAutonomyUndoBlocker>;
|
|
217
|
+
/** The lookup deliberately considers only recent operations. */
|
|
218
|
+
searchLimit: number;
|
|
219
|
+
/** Older operations exist but were intentionally not searched. */
|
|
220
|
+
hasMoreOperations: boolean;
|
|
221
|
+
/** Operations matched by the query inside the search window, before `limit` truncated `items`. */
|
|
222
|
+
matchedOperationCount: number;
|
|
223
|
+
/** More operations matched inside the search window than `limit` returned. */
|
|
224
|
+
hasMoreMatches: boolean;
|
|
168
225
|
}
|
|
169
226
|
export interface CrmAutonomyListReviewsResponse {
|
|
170
227
|
items: CrmAutonomyReviewItemSummary[];
|
|
@@ -178,8 +235,101 @@ export interface CrmAutonomyRejectReviewResponse {
|
|
|
178
235
|
operation: CrmAutonomyOperationSummary;
|
|
179
236
|
reviewItems: CrmAutonomyReviewItemSummary[];
|
|
180
237
|
}
|
|
181
|
-
|
|
182
|
-
|
|
238
|
+
/** Discriminated on `undone`, so a completed undo cannot also carry a reason or conflicts. */
|
|
239
|
+
export type CrmAutonomyUndoResponse = {
|
|
240
|
+
undone: true;
|
|
241
|
+
reason?: undefined;
|
|
242
|
+
conflicts?: undefined;
|
|
243
|
+
operation: CrmAutonomyOperationSummary;
|
|
244
|
+
} | {
|
|
245
|
+
undone: false;
|
|
183
246
|
reason?: string;
|
|
247
|
+
conflicts?: CrmAutonomyUndoConflict[];
|
|
184
248
|
operation: CrmAutonomyOperationSummary;
|
|
249
|
+
};
|
|
250
|
+
export interface CrmAutonomyUndoImportResponse {
|
|
251
|
+
undone: boolean;
|
|
252
|
+
anchorOperationId: string;
|
|
253
|
+
/** All operations created by the same assistant request, scoped to one owner and thread. */
|
|
254
|
+
sourceId: string;
|
|
255
|
+
totalOperationCount: number;
|
|
256
|
+
completedOperationCount: number;
|
|
257
|
+
remainingOperationCount: number;
|
|
258
|
+
/** The most recent result entries, bounded to keep assistant responses small. */
|
|
259
|
+
results: Array<{
|
|
260
|
+
operationId: string;
|
|
261
|
+
undone: boolean;
|
|
262
|
+
status?: CrmAutonomyOperationStatus;
|
|
263
|
+
reason?: string;
|
|
264
|
+
conflicts?: CrmAutonomyUndoConflict[];
|
|
265
|
+
entities: Array<{
|
|
266
|
+
entityType: CrmAutonomyEntityType;
|
|
267
|
+
name?: string;
|
|
268
|
+
}>;
|
|
269
|
+
omittedEntityCount: number;
|
|
270
|
+
}>;
|
|
271
|
+
omittedResultCount: number;
|
|
272
|
+
/** First remaining operation IDs, including the failure, bounded for response size. */
|
|
273
|
+
remainingOperationIds: string[];
|
|
274
|
+
omittedRemainingOperationCount: number;
|
|
275
|
+
}
|
|
276
|
+
export interface CrmAutonomyUndoConflict {
|
|
277
|
+
assetId: string;
|
|
278
|
+
currentRevision: number;
|
|
279
|
+
changedFields: string[];
|
|
280
|
+
referencesChanged: boolean;
|
|
281
|
+
createdAsset: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* The only choices this conflict accepts: `delete_created` when the undo ends in a deletion
|
|
284
|
+
* (assets the operation created or restored from trash), otherwise the two restores. The agent
|
|
285
|
+
* offers exactly these — `createdAsset` alone cannot express the soft-delete case.
|
|
286
|
+
*/
|
|
287
|
+
availableChoices: CrmAutonomyUndoConflictChoice[];
|
|
288
|
+
/** Changed-field values only; large values are returned as truncated previews. */
|
|
289
|
+
currentValues: Record<string, unknown>;
|
|
290
|
+
restoreValues: Record<string, unknown> | null;
|
|
291
|
+
}
|
|
292
|
+
/** The resolution choices an undo conflict accepts; shared by the API, the DTO and the tools. */
|
|
293
|
+
export declare const CRM_AUTONOMY_UNDO_CONFLICT_CHOICES: readonly ["restore_all", "keep_selected", "delete_created"];
|
|
294
|
+
export type CrmAutonomyUndoConflictChoice = (typeof CRM_AUTONOMY_UNDO_CONFLICT_CHOICES)[number];
|
|
295
|
+
/**
|
|
296
|
+
* The asset fields a `keep_selected` resolution may preserve; `data` is kept or restored as one
|
|
297
|
+
* whole field. `attachments` is deliberately absent: undo never restores them (attachment undo is
|
|
298
|
+
* a tracked follow-up), so offering the field would promise a revert that cannot happen.
|
|
299
|
+
*/
|
|
300
|
+
export declare const CRM_AUTONOMY_UNDO_KEEP_CURRENT_FIELDS: readonly ["name", "parent", "data", "tags"];
|
|
301
|
+
/**
|
|
302
|
+
* Stable error code of the grouped-undo purpose guard: the anchor is not an assistant attachment
|
|
303
|
+
* import, so no import group can resolve from it. Both sides share the constant; the assistant
|
|
304
|
+
* tool maps it to an individual-undo next action instead of a generic failure.
|
|
305
|
+
*/
|
|
306
|
+
export declare const CRM_IMPORT_UNDO_GROUP_UNSUPPORTED = "CRM_IMPORT_UNDO_GROUP_UNSUPPORTED";
|
|
307
|
+
export interface CrmAutonomyUndoConflictResolutionRequest {
|
|
308
|
+
assetId: string;
|
|
309
|
+
expectedRevision: number;
|
|
310
|
+
choice: CrmAutonomyUndoConflictChoice;
|
|
311
|
+
keepCurrentFields?: string[];
|
|
312
|
+
keepCurrentReferences?: boolean;
|
|
313
|
+
}
|
|
314
|
+
export interface CrmAutonomyUndoConflictResolution {
|
|
315
|
+
/**
|
|
316
|
+
* Identifies one user decision, so repeated decisions for the same asset stay separate. Absent
|
|
317
|
+
* on records written before conflict decisions were identified.
|
|
318
|
+
*/
|
|
319
|
+
resolutionId?: string;
|
|
320
|
+
assetId: string;
|
|
321
|
+
/** Optional for records written before explicit conflict choices were introduced. */
|
|
322
|
+
choice?: CrmAutonomyUndoConflictChoice;
|
|
323
|
+
keepCurrentFields: string[];
|
|
324
|
+
keepCurrentReferences: boolean;
|
|
325
|
+
requester: CrmAutonomyTriggeredBy;
|
|
326
|
+
resolvedAt: string;
|
|
327
|
+
/** The asset revision the user saw when they made the decision. */
|
|
328
|
+
expectedRevision?: number;
|
|
329
|
+
/** No state on older records means `completed`: they were only written after success. */
|
|
330
|
+
state?: CrmAutonomyUndoResolutionState;
|
|
331
|
+
/** When the record reached its terminal state (`completed`, `failed` or `superseded`). */
|
|
332
|
+
completedAt?: string;
|
|
333
|
+
/** The decision that replaced this one when it was closed as `superseded`. */
|
|
334
|
+
supersededBy?: string;
|
|
185
335
|
}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CRM_IMPORT_UNDO_GROUP_UNSUPPORTED = exports.CRM_AUTONOMY_UNDO_KEEP_CURRENT_FIELDS = exports.CRM_AUTONOMY_UNDO_CONFLICT_CHOICES = void 0;
|
|
4
|
+
/** The resolution choices an undo conflict accepts; shared by the API, the DTO and the tools. */
|
|
5
|
+
exports.CRM_AUTONOMY_UNDO_CONFLICT_CHOICES = ['restore_all', 'keep_selected', 'delete_created'];
|
|
6
|
+
/**
|
|
7
|
+
* The asset fields a `keep_selected` resolution may preserve; `data` is kept or restored as one
|
|
8
|
+
* whole field. `attachments` is deliberately absent: undo never restores them (attachment undo is
|
|
9
|
+
* a tracked follow-up), so offering the field would promise a revert that cannot happen.
|
|
10
|
+
*/
|
|
11
|
+
exports.CRM_AUTONOMY_UNDO_KEEP_CURRENT_FIELDS = ['name', 'parent', 'data', 'tags'];
|
|
12
|
+
/**
|
|
13
|
+
* Stable error code of the grouped-undo purpose guard: the anchor is not an assistant attachment
|
|
14
|
+
* import, so no import group can resolve from it. Both sides share the constant; the assistant
|
|
15
|
+
* tool maps it to an individual-undo next action instead of a generic failure.
|
|
16
|
+
*/
|
|
17
|
+
exports.CRM_IMPORT_UNDO_GROUP_UNSUPPORTED = 'CRM_IMPORT_UNDO_GROUP_UNSUPPORTED';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, CrmAutonomyApproveReviewResponse, CrmAutonomyCandidateSubmissionRequest, CrmAutonomyListOperationsResponse, CrmAutonomyListReviewsResponse, CrmAutonomyOperationDetail, CrmAutonomyReconcileContactGovernanceRequest, CrmAutonomyReconcileContactGovernanceResponse, CrmAutonomyRejectReviewResponse, CrmAutonomyReviewActionRequest, CrmAutonomySubmitCandidatesResponse, CrmAutonomyUndoResponse, CrmDealReminderDeliveryResult, CrmGetDuplicatesQuery, CrmGetDuplicatesResponse, CrmImportParser, CrmImportResponse, CrmMergeContactDuplicatesRequest, CrmMergeContactDuplicatesResponse, SendDealReminderPayload, TokenOption } from '../interfaces';
|
|
1
|
+
import { Config, CrmAutonomyApproveReviewResponse, CrmAutonomyCandidateSubmissionRequest, CrmAutonomyListOperationsResponse, CrmAutonomyListReviewsResponse, CrmAutonomyOperationDetail, CrmAutonomyOperationQuery, CrmAutonomyReconcileContactGovernanceRequest, CrmAutonomyReconcileContactGovernanceResponse, CrmAutonomyRejectReviewResponse, CrmAutonomyReviewActionRequest, CrmAutonomySubmitCandidatesResponse, CrmAutonomyUndoConflictResolutionRequest, CrmAutonomyUndoImportResponse, CrmAutonomyUndoResponse, CrmDealReminderDeliveryResult, CrmGetDuplicatesQuery, CrmGetDuplicatesResponse, CrmImportParser, CrmImportResponse, CrmMergeContactDuplicatesRequest, CrmMergeContactDuplicatesResponse, SendDealReminderPayload, TokenOption } from '../interfaces';
|
|
2
2
|
import { CrmService } from '../services';
|
|
3
3
|
import { CrossPlatformFormData } from '../utils';
|
|
4
4
|
export declare class CrmMockService extends CrmService {
|
|
@@ -9,13 +9,17 @@ export declare class CrmMockService extends CrmService {
|
|
|
9
9
|
mergeDuplicates(dto: CrmMergeContactDuplicatesRequest, _options?: TokenOption): Promise<CrmMergeContactDuplicatesResponse>;
|
|
10
10
|
sendDealReminder(_payload: SendDealReminderPayload, _options?: TokenOption): Promise<CrmDealReminderDeliveryResult>;
|
|
11
11
|
submitAutonomyCandidates(request: CrmAutonomyCandidateSubmissionRequest, _options?: TokenOption): Promise<CrmAutonomySubmitCandidatesResponse>;
|
|
12
|
-
listAutonomyOperations(_query?:
|
|
12
|
+
listAutonomyOperations(_query?: CrmAutonomyOperationQuery, _options?: TokenOption): Promise<CrmAutonomyListOperationsResponse>;
|
|
13
13
|
getAutonomyOperation(operationId: string, _options?: TokenOption): Promise<CrmAutonomyOperationDetail>;
|
|
14
14
|
listAutonomyReviews(_query?: {}, _options?: TokenOption): Promise<CrmAutonomyListReviewsResponse>;
|
|
15
15
|
approveAutonomyReview(_reviewId: string, _action?: CrmAutonomyReviewActionRequest, _options?: TokenOption): Promise<CrmAutonomyApproveReviewResponse>;
|
|
16
16
|
rejectAutonomyReview(reviewId: string, _action?: Pick<CrmAutonomyReviewActionRequest, 'note'>, _options?: TokenOption): Promise<CrmAutonomyRejectReviewResponse>;
|
|
17
17
|
reconcileContactGovernance(_request: CrmAutonomyReconcileContactGovernanceRequest, _options?: TokenOption): Promise<CrmAutonomyReconcileContactGovernanceResponse>;
|
|
18
|
-
undoAutonomyOperation(operationId: string, _options
|
|
18
|
+
undoAutonomyOperation(operationId: string, _options: TokenOption & {
|
|
19
|
+
expectedAffectedAssetCount: number;
|
|
20
|
+
}): Promise<CrmAutonomyUndoResponse>;
|
|
21
|
+
undoAutonomyImport(operationId: string, _options?: TokenOption): Promise<CrmAutonomyUndoImportResponse>;
|
|
22
|
+
resolveAutonomyUndoConflict(operationId: string, _request: CrmAutonomyUndoConflictResolutionRequest, _options?: TokenOption): Promise<CrmAutonomyUndoResponse>;
|
|
19
23
|
private createAutonomyOperation;
|
|
20
24
|
private createAutonomyReview;
|
|
21
25
|
}
|
|
@@ -71,7 +71,7 @@ class CrmMockService extends services_1.CrmService {
|
|
|
71
71
|
return { operation: this.createAutonomyOperation(request), reviewItems: [] };
|
|
72
72
|
}
|
|
73
73
|
async listAutonomyOperations(_query = {}, _options = {}) {
|
|
74
|
-
return { items: [] };
|
|
74
|
+
return { items: [], searchLimit: 100, hasMoreOperations: false, matchedOperationCount: 0, hasMoreMatches: false };
|
|
75
75
|
}
|
|
76
76
|
async getAutonomyOperation(operationId, _options = {}) {
|
|
77
77
|
return { ...this.createAutonomyOperation(), id: operationId, candidates: [] };
|
|
@@ -88,7 +88,24 @@ class CrmMockService extends services_1.CrmService {
|
|
|
88
88
|
async reconcileContactGovernance(_request, _options = {}) {
|
|
89
89
|
return { resolvedCount: 0, pendingCount: 0, pendingReasonCodes: {} };
|
|
90
90
|
}
|
|
91
|
-
async undoAutonomyOperation(operationId, _options
|
|
91
|
+
async undoAutonomyOperation(operationId, _options) {
|
|
92
|
+
return { undone: true, operation: { ...this.createAutonomyOperation(), id: operationId, status: 'undone' } };
|
|
93
|
+
}
|
|
94
|
+
async undoAutonomyImport(operationId, _options = {}) {
|
|
95
|
+
return {
|
|
96
|
+
undone: true,
|
|
97
|
+
anchorOperationId: operationId,
|
|
98
|
+
sourceId: 'mock-source',
|
|
99
|
+
totalOperationCount: 1,
|
|
100
|
+
completedOperationCount: 1,
|
|
101
|
+
remainingOperationCount: 0,
|
|
102
|
+
results: [],
|
|
103
|
+
omittedResultCount: 0,
|
|
104
|
+
remainingOperationIds: [],
|
|
105
|
+
omittedRemainingOperationCount: 0,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async resolveAutonomyUndoConflict(operationId, _request, _options = {}) {
|
|
92
109
|
return { undone: true, operation: { ...this.createAutonomyOperation(), id: operationId, status: 'undone' } };
|
|
93
110
|
}
|
|
94
111
|
createAutonomyOperation(request) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIBase } from '../api-base';
|
|
2
2
|
import { Config, TokenOption } from '../interfaces';
|
|
3
|
-
import { CrmAutonomyApproveReviewResponse, CrmAutonomyCandidateSubmissionRequest, CrmAutonomyListOperationsResponse, CrmAutonomyListReviewsResponse, CrmAutonomyOperationDetail, CrmAutonomyOperationQuery, CrmAutonomyReconcileContactGovernanceRequest, CrmAutonomyReconcileContactGovernanceResponse, CrmAutonomyRejectReviewResponse, CrmAutonomyReviewActionRequest, CrmAutonomyReviewItemDetail, CrmAutonomyReviewQuery, CrmAutonomySubmitCandidatesResponse, CrmAutonomyUndoResponse } from '../interfaces/crm-autonomy.interface';
|
|
3
|
+
import { CrmAutonomyApproveReviewResponse, CrmAutonomyCandidateSubmissionRequest, CrmAutonomyListOperationsResponse, CrmAutonomyListReviewsResponse, CrmAutonomyOperationDetail, CrmAutonomyOperationQuery, CrmAutonomyReconcileContactGovernanceRequest, CrmAutonomyReconcileContactGovernanceResponse, CrmAutonomyRejectReviewResponse, CrmAutonomyReviewActionRequest, CrmAutonomyReviewItemDetail, CrmAutonomyReviewQuery, CrmAutonomySubmitCandidatesResponse, CrmAutonomyUndoConflictResolutionRequest, CrmAutonomyUndoImportResponse, CrmAutonomyUndoResponse } from '../interfaces/crm-autonomy.interface';
|
|
4
4
|
import { CrmDealReminderDeliveryResult, CrmGetDuplicatesQuery, CrmGetDuplicatesResponse, CrmImportParser, CrmImportResponse, CrmMergeContactDuplicatesRequest, CrmMergeContactDuplicatesResponse, SendDealReminderPayload } from '../interfaces/crm.interface';
|
|
5
5
|
import { CrossPlatformFormData } from '../utils';
|
|
6
6
|
import { HttpClientService } from './http-client.service';
|
|
@@ -19,5 +19,11 @@ export declare class CrmService extends APIBase {
|
|
|
19
19
|
approveAutonomyReview(reviewId: string, action?: CrmAutonomyReviewActionRequest, options?: TokenOption): Promise<CrmAutonomyApproveReviewResponse>;
|
|
20
20
|
rejectAutonomyReview(reviewId: string, action?: Pick<CrmAutonomyReviewActionRequest, 'note'>, options?: TokenOption): Promise<CrmAutonomyRejectReviewResponse>;
|
|
21
21
|
reconcileContactGovernance(request: CrmAutonomyReconcileContactGovernanceRequest, options?: TokenOption): Promise<CrmAutonomyReconcileContactGovernanceResponse>;
|
|
22
|
-
|
|
22
|
+
/** Scope-confirmed undo: the count rides inside `options` so the released positional signature
|
|
23
|
+
* `(operationId, options)` stays compatible; the backend refuses any drift from that count. */
|
|
24
|
+
undoAutonomyOperation(operationId: string, options: TokenOption & {
|
|
25
|
+
expectedAffectedAssetCount: number;
|
|
26
|
+
}): Promise<CrmAutonomyUndoResponse>;
|
|
27
|
+
undoAutonomyImport(operationId: string, options?: TokenOption): Promise<CrmAutonomyUndoImportResponse>;
|
|
28
|
+
resolveAutonomyUndoConflict(operationId: string, request: CrmAutonomyUndoConflictResolutionRequest, options?: TokenOption): Promise<CrmAutonomyUndoResponse>;
|
|
23
29
|
}
|
|
@@ -33,7 +33,12 @@ class CrmService extends api_base_1.APIBase {
|
|
|
33
33
|
return this.httpClient.post(`${this.basePath}/autonomy/candidates`, request, options);
|
|
34
34
|
}
|
|
35
35
|
listAutonomyOperations(query = {}, options = {}) {
|
|
36
|
-
|
|
36
|
+
const { status, ...rest } = query;
|
|
37
|
+
const statusFilter = Array.isArray(status) ? status.filter(Boolean).join(',') : status;
|
|
38
|
+
return this.httpClient.get(`${this.basePath}/autonomy/operations`, {
|
|
39
|
+
...options,
|
|
40
|
+
params: { ...rest, ...(statusFilter ? { status: statusFilter } : {}) },
|
|
41
|
+
});
|
|
37
42
|
}
|
|
38
43
|
getAutonomyOperation(operationId, options = {}) {
|
|
39
44
|
return this.httpClient.get(`${this.basePath}/autonomy/operations/${operationId}`, options);
|
|
@@ -53,8 +58,17 @@ class CrmService extends api_base_1.APIBase {
|
|
|
53
58
|
reconcileContactGovernance(request, options = {}) {
|
|
54
59
|
return this.httpClient.post(`${this.basePath}/autonomy/reviews/reconcile-contact-governance`, request, options);
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
/** Scope-confirmed undo: the count rides inside `options` so the released positional signature
|
|
62
|
+
* `(operationId, options)` stays compatible; the backend refuses any drift from that count. */
|
|
63
|
+
undoAutonomyOperation(operationId, options) {
|
|
64
|
+
const { expectedAffectedAssetCount, ...requestOptions } = options;
|
|
65
|
+
return this.httpClient.post(`${this.basePath}/autonomy/operations/${operationId}/undo`, { expectedAffectedAssetCount }, requestOptions);
|
|
66
|
+
}
|
|
67
|
+
undoAutonomyImport(operationId, options = {}) {
|
|
68
|
+
return this.httpClient.post(`${this.basePath}/autonomy/operations/${operationId}/undo-import`, {}, options);
|
|
69
|
+
}
|
|
70
|
+
resolveAutonomyUndoConflict(operationId, request, options = {}) {
|
|
71
|
+
return this.httpClient.post(`${this.basePath}/autonomy/operations/${operationId}/undo-conflicts`, request, options);
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
74
|
exports.CrmService = CrmService;
|