@trii/types 2.10.813 → 2.10.815

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.
@@ -62,6 +62,7 @@ export interface PersonalInboxItem {
62
62
  channelType: string;
63
63
  channelName: string | null;
64
64
  status: ConversationStatus;
65
+ spam?: boolean;
65
66
  priority: IConversation['priority'];
66
67
  lastMessagePreview: string;
67
68
  lastMessageId: ID | null;
@@ -29,8 +29,14 @@ export interface ITicketFilter {
29
29
  priorities?: TicketPriority[];
30
30
  origins?: TicketCreationMethod[];
31
31
  contactIds?: string[];
32
+ /**
33
+ * User ids, plus two tokens tickets-api resolves per request: "@me" (the requester) and
34
+ * "@unassigned" (tickets without an assignee). Entries are ORed.
35
+ */
32
36
  assigneeIds?: string[];
33
37
  assignedGroupIds?: string[];
38
+ /** Work queues the tickets were routed to (the ticket's routing queue). */
39
+ queueIds?: string[];
34
40
  categoryIds?: string[];
35
41
  requestTypeIds?: string[];
36
42
  tagIds?: string[];
@@ -39,6 +45,16 @@ export interface ITicketFilter {
39
45
  dueFrom?: Date;
40
46
  dueTo?: Date;
41
47
  includeDeleted?: boolean;
48
+ /**
49
+ * "My tickets": assigned to the requester, or waiting in a manual-pull queue they can pull
50
+ * from. Resolved per request from the authenticated user.
51
+ */
52
+ mine?: boolean;
53
+ /**
54
+ * "To approve": tickets with a pending approval the requester may decide. Resolved per
55
+ * request from the authenticated user.
56
+ */
57
+ pendingMyApproval?: boolean;
42
58
  fields?: ITicketFieldFilter[];
43
59
  }
44
60
  export interface ITicketQuery extends ITicketCursorRequest {
@@ -1,122 +1,150 @@
1
- import { ITicketAuditedEntity } from "./Common";
2
- export declare enum TicketApprovalMode {
3
- SEQUENTIAL = "SEQUENTIAL",
4
- PARALLEL = "PARALLEL"
5
- }
1
+ /** Status of an approval process. */
6
2
  export declare enum TicketApprovalStatus {
7
3
  PENDING = "PENDING",
8
- IN_PROGRESS = "IN_PROGRESS",
9
4
  APPROVED = "APPROVED",
10
- REJECTED = "REJECTED",
11
- CANCELLED = "CANCELLED",
12
- EXPIRED = "EXPIRED"
5
+ REJECTED = "REJECTED"
13
6
  }
7
+ /** The decision an approver takes. */
14
8
  export declare enum TicketApprovalDecisionType {
15
9
  APPROVE = "APPROVE",
16
- REJECT = "REJECT",
17
- ABSTAIN = "ABSTAIN"
18
- }
19
- export declare enum TicketApprovalQuorumType {
20
- ALL = "ALL",
21
- ANY = "ANY",
22
- COUNT = "COUNT",
23
- PERCENTAGE = "PERCENTAGE"
24
- }
25
- export interface ITicketApprovalQuorum {
26
- type: TicketApprovalQuorumType;
27
- requiredCount?: number;
28
- requiredPercentage?: number;
29
- rejectOnAnyRejection?: boolean;
30
- }
31
- export type ITicketApprover = {
32
- type: "USER";
33
- userId: string;
34
- } | {
35
- type: "ROLE";
36
- roleId: string;
37
- };
38
- export interface ITicketApprovalStepDefinition {
10
+ REJECT = "REJECT"
11
+ }
12
+ /** What a process gates: CLOSE = a transition into a CLOSED-stage status; RESOLVE = a /resolve request, only on processes started before closes were gated. */
13
+ export declare enum TicketApprovalAction {
14
+ RESOLVE = "RESOLVE",
15
+ CLOSE = "CLOSE"
16
+ }
17
+ /** What the replay of the approved action did; the *_FAILED values leave the process APPROVED. */
18
+ export declare enum TicketApprovalOutcome {
19
+ RESOLVED = "RESOLVED",
20
+ RESOLVE_FAILED = "RESOLVE_FAILED",
21
+ CLOSED = "CLOSED",
22
+ CLOSE_FAILED = "CLOSE_FAILED"
23
+ }
24
+ /** Why the caller cannot decide a process right now. */
25
+ export declare enum TicketApprovalViewerBlockedReason {
26
+ ASSIGNEE = "ASSIGNEE",
27
+ REQUESTER = "REQUESTER",
28
+ NOT_MEMBER = "NOT_MEMBER",
29
+ NOT_PENDING = "NOT_PENDING"
30
+ }
31
+ /** Top-level `code` of the approval runtime errors (409 APPROVAL_PENDING / APPROVAL_NOT_PENDING, 403 APPROVAL_SELF_DECISION / APPROVAL_NOT_ELIGIBLE). */
32
+ export declare enum TicketApprovalErrorCode {
33
+ APPROVAL_PENDING = "APPROVAL_PENDING",
34
+ APPROVAL_NOT_PENDING = "APPROVAL_NOT_PENDING",
35
+ APPROVAL_SELF_DECISION = "APPROVAL_SELF_DECISION",
36
+ APPROVAL_NOT_ELIGIBLE = "APPROVAL_NOT_ELIGIBLE"
37
+ }
38
+ /** `details[].code` of a rejected approval request (422 unless noted). */
39
+ export declare enum TicketApprovalErrorDetailCode {
40
+ REQUIRED = "REQUIRED",
41
+ APPROVERS_REQUIRED = "APPROVERS_REQUIRED",
42
+ INVALID_CATEGORY = "INVALID_CATEGORY",
43
+ /** 409. */
44
+ NAME_CONFLICT = "NAME_CONFLICT",
45
+ /** 409; the detail carries `categoryId` and `definitionId`. */
46
+ CATEGORY_HAS_APPROVAL = "CATEGORY_HAS_APPROVAL",
47
+ /** 422 of POST /tickets/{id}/transition: nobody but the ticket's assignee is listed as approver. */
48
+ APPROVAL_NO_ELIGIBLE_APPROVER = "APPROVAL_NO_ELIGIBLE_APPROVER"
49
+ }
50
+ /** `ITicketApiError.details` entry of an approval error, plus the ids that locate the offending category. */
51
+ export interface ITicketApprovalErrorDetail {
52
+ fieldName: string;
53
+ code: string;
54
+ message: string;
55
+ categoryId?: string;
56
+ definitionId?: string;
57
+ }
58
+ /** Body of GET /approval-definitions/{id} (and items of GET /approval-definitions?includeDisabled=true). */
59
+ export interface ITicketApprovalDefinition {
39
60
  id: string;
40
- name: string;
41
- order: number;
42
- approvers: ITicketApprover[];
43
- quorum: ITicketApprovalQuorum;
44
- expiresAfterMinutes?: number;
45
- allowDelegation: boolean;
46
- escalationPolicyId?: string;
47
- }
48
- export interface ITicketApprovalProcessDefinition extends ITicketAuditedEntity {
49
61
  name: string;
50
62
  description?: string;
51
63
  categoryIds?: string[];
52
- mode: TicketApprovalMode;
53
- steps: ITicketApprovalStepDefinition[];
64
+ /** Users allowed to approve; at least one while the definition is enabled. */
65
+ approverUserIds: string[];
54
66
  enabled: boolean;
67
+ createdAt: Date;
68
+ createdBy: string;
69
+ updatedAt?: Date;
70
+ updatedBy?: string;
55
71
  }
56
- export interface ICreateTicketApprovalProcessDefinitionDto {
72
+ /** Body of POST /approval-definitions. Unknown keys are rejected with 422. */
73
+ export interface ICreateTicketApprovalDefinitionDto {
57
74
  name: string;
58
75
  description?: string;
59
76
  categoryIds?: string[];
60
- mode: TicketApprovalMode;
61
- steps: ITicketApprovalStepDefinition[];
62
- enabled: boolean;
77
+ /** Defaults to []; deduplicated case-insensitively, first-seen order kept. */
78
+ approverUserIds?: string[];
79
+ /** Defaults to false: a new definition starts as a draft. */
80
+ enabled?: boolean;
63
81
  }
64
- export interface IUpdateTicketApprovalProcessDefinitionDto {
82
+ /** Body of PATCH /approval-definitions/{id}. Unknown keys are rejected with 422. */
83
+ export interface IUpdateTicketApprovalDefinitionDto {
65
84
  name?: string;
66
85
  description?: string | null;
67
86
  categoryIds?: string[] | null;
68
- mode?: TicketApprovalMode;
69
- steps?: ITicketApprovalStepDefinition[];
87
+ approverUserIds?: string[];
70
88
  enabled?: boolean;
71
89
  }
72
- export interface ITicketApprovalStep extends ITicketApprovalStepDefinition {
73
- status: TicketApprovalStatus;
74
- startedAt?: Date;
75
- expiresAt?: Date;
76
- completedAt?: Date;
90
+ /** The decision that ended a process (absent while it is PENDING). */
91
+ export interface ITicketApprovalDecision {
92
+ decision: TicketApprovalDecisionType;
93
+ decidedBy: string;
94
+ /** ISO 8601. */
95
+ decidedAt: string;
96
+ comment?: string;
97
+ }
98
+ /** Whether the caller can decide the process now. */
99
+ export interface ITicketApprovalViewer {
100
+ canDecide: boolean;
101
+ blockedReason?: TicketApprovalViewerBlockedReason;
77
102
  }
103
+ /** Body of GET /approvals/{processId} and POST /approvals/{processId}/decisions; item of GET /tickets/{id}/approvals. */
78
104
  export interface ITicketApprovalProcess {
79
105
  id: string;
80
- spaceId: string;
81
106
  ticketId: string;
82
- definitionId?: string;
83
- definitionVersion?: number;
84
- name: string;
85
- mode: TicketApprovalMode;
107
+ definitionId: string;
108
+ definitionName: string;
109
+ action: TicketApprovalAction;
86
110
  status: TicketApprovalStatus;
87
- steps: ITicketApprovalStep[];
88
- currentStepId?: string;
89
- requestedAt: Date;
111
+ /** The definition's approvers when the process started; later edits of the definition do not apply. */
112
+ approverUserIds: string[];
113
+ /** The approvers that may decide it now: `approverUserIds` without the ticket's current assignee and the requester. */
114
+ eligibleApproverUserIds: string[];
115
+ decision?: ITicketApprovalDecision;
90
116
  requestedBy: string;
91
- completedAt?: Date;
92
- cancelledAt?: Date;
93
- }
94
- export interface ITicketApprovalDecision {
95
- id: string;
96
- spaceId: string;
97
- ticketId: string;
98
- processId: string;
99
- stepId: string;
100
- approverId: string;
117
+ /** ISO 8601. */
118
+ requestedAt: string;
119
+ /** ISO 8601. */
120
+ completedAt?: string;
121
+ outcome?: TicketApprovalOutcome;
122
+ outcomeError?: string;
123
+ version: number;
124
+ viewer: ITicketApprovalViewer;
125
+ }
126
+ /** Body of GET /tickets/{id}/approvals, newest first. */
127
+ export interface ITicketApprovalProcessList {
128
+ items: ITicketApprovalProcess[];
129
+ }
130
+ /** Body of POST /approvals/{processId}/decisions. A REJECT needs a non-blank comment. */
131
+ export interface IDecideTicketApprovalDto {
132
+ expectedVersion: number;
101
133
  decision: TicketApprovalDecisionType;
102
134
  comment?: string;
103
- attachmentIds?: string[];
104
- decidedAt: Date;
105
- delegatedFromUserId?: string;
106
135
  }
107
- export interface ITicketApprovalDelegation {
108
- id: string;
109
- spaceId: string;
110
- ticketId: string;
111
- processId: string;
112
- stepId: string;
113
- fromUserId: string;
114
- toUserId: string;
115
- reason?: string;
116
- delegatedAt: Date;
117
- expiresAt?: Date;
118
- revokedAt?: Date;
136
+ /** 202 body of POST /tickets/{id}/transition when a close needs an approval first: the ticket is not closed, a process was started. */
137
+ export interface ITicketApprovalRequiredResponse {
138
+ approvalRequired: true;
139
+ approval: ITicketApprovalProcess;
140
+ }
141
+ /** Body of GET /approvals/pending/count. */
142
+ export interface ITicketPendingApprovalCount {
143
+ total: number;
119
144
  }
145
+ /**
146
+ * @deprecated tickets-api never emits `ITicket.approvalSummary`; read GET /tickets/{id}/approvals instead.
147
+ */
120
148
  export interface ITicketApprovalSummary {
121
149
  pending: number;
122
150
  approved: number;
@@ -124,29 +152,3 @@ export interface ITicketApprovalSummary {
124
152
  expired: number;
125
153
  currentProcessId?: string;
126
154
  }
127
- export interface IStartTicketApprovalDto {
128
- expectedVersion: number;
129
- definitionId: string;
130
- comment?: string;
131
- }
132
- export interface IDecideTicketApprovalDto {
133
- expectedVersion: number;
134
- processId: string;
135
- stepId: string;
136
- decision: TicketApprovalDecisionType;
137
- comment?: string;
138
- attachmentIds?: string[];
139
- }
140
- export interface IDelegateTicketApprovalDto {
141
- expectedVersion: number;
142
- processId: string;
143
- stepId: string;
144
- toUserId: string;
145
- reason?: string;
146
- expiresAt?: Date;
147
- }
148
- export interface ICancelTicketApprovalDto {
149
- expectedVersion: number;
150
- processId: string;
151
- reason: string;
152
- }
@@ -1,30 +1,63 @@
1
1
  "use strict";
2
+ // Approvals (S18 model): a definition is bound to categories and lists the users who may approve.
3
+ // Closing a ticket of one of those categories starts a process that ends with ONE decision by any
4
+ // listed approver except the ticket's current assignee and the requester. No steps, queues, mode
5
+ // or quorum.
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TicketApprovalQuorumType = exports.TicketApprovalDecisionType = exports.TicketApprovalStatus = exports.TicketApprovalMode = void 0;
4
- var TicketApprovalMode;
5
- (function (TicketApprovalMode) {
6
- TicketApprovalMode["SEQUENTIAL"] = "SEQUENTIAL";
7
- TicketApprovalMode["PARALLEL"] = "PARALLEL";
8
- })(TicketApprovalMode || (exports.TicketApprovalMode = TicketApprovalMode = {}));
7
+ exports.TicketApprovalErrorDetailCode = exports.TicketApprovalErrorCode = exports.TicketApprovalViewerBlockedReason = exports.TicketApprovalOutcome = exports.TicketApprovalAction = exports.TicketApprovalDecisionType = exports.TicketApprovalStatus = void 0;
8
+ /** Status of an approval process. */
9
9
  var TicketApprovalStatus;
10
10
  (function (TicketApprovalStatus) {
11
11
  TicketApprovalStatus["PENDING"] = "PENDING";
12
- TicketApprovalStatus["IN_PROGRESS"] = "IN_PROGRESS";
13
12
  TicketApprovalStatus["APPROVED"] = "APPROVED";
14
13
  TicketApprovalStatus["REJECTED"] = "REJECTED";
15
- TicketApprovalStatus["CANCELLED"] = "CANCELLED";
16
- TicketApprovalStatus["EXPIRED"] = "EXPIRED";
17
14
  })(TicketApprovalStatus || (exports.TicketApprovalStatus = TicketApprovalStatus = {}));
15
+ /** The decision an approver takes. */
18
16
  var TicketApprovalDecisionType;
19
17
  (function (TicketApprovalDecisionType) {
20
18
  TicketApprovalDecisionType["APPROVE"] = "APPROVE";
21
19
  TicketApprovalDecisionType["REJECT"] = "REJECT";
22
- TicketApprovalDecisionType["ABSTAIN"] = "ABSTAIN";
23
20
  })(TicketApprovalDecisionType || (exports.TicketApprovalDecisionType = TicketApprovalDecisionType = {}));
24
- var TicketApprovalQuorumType;
25
- (function (TicketApprovalQuorumType) {
26
- TicketApprovalQuorumType["ALL"] = "ALL";
27
- TicketApprovalQuorumType["ANY"] = "ANY";
28
- TicketApprovalQuorumType["COUNT"] = "COUNT";
29
- TicketApprovalQuorumType["PERCENTAGE"] = "PERCENTAGE";
30
- })(TicketApprovalQuorumType || (exports.TicketApprovalQuorumType = TicketApprovalQuorumType = {}));
21
+ /** What a process gates: CLOSE = a transition into a CLOSED-stage status; RESOLVE = a /resolve request, only on processes started before closes were gated. */
22
+ var TicketApprovalAction;
23
+ (function (TicketApprovalAction) {
24
+ TicketApprovalAction["RESOLVE"] = "RESOLVE";
25
+ TicketApprovalAction["CLOSE"] = "CLOSE";
26
+ })(TicketApprovalAction || (exports.TicketApprovalAction = TicketApprovalAction = {}));
27
+ /** What the replay of the approved action did; the *_FAILED values leave the process APPROVED. */
28
+ var TicketApprovalOutcome;
29
+ (function (TicketApprovalOutcome) {
30
+ TicketApprovalOutcome["RESOLVED"] = "RESOLVED";
31
+ TicketApprovalOutcome["RESOLVE_FAILED"] = "RESOLVE_FAILED";
32
+ TicketApprovalOutcome["CLOSED"] = "CLOSED";
33
+ TicketApprovalOutcome["CLOSE_FAILED"] = "CLOSE_FAILED";
34
+ })(TicketApprovalOutcome || (exports.TicketApprovalOutcome = TicketApprovalOutcome = {}));
35
+ /** Why the caller cannot decide a process right now. */
36
+ var TicketApprovalViewerBlockedReason;
37
+ (function (TicketApprovalViewerBlockedReason) {
38
+ TicketApprovalViewerBlockedReason["ASSIGNEE"] = "ASSIGNEE";
39
+ TicketApprovalViewerBlockedReason["REQUESTER"] = "REQUESTER";
40
+ TicketApprovalViewerBlockedReason["NOT_MEMBER"] = "NOT_MEMBER";
41
+ TicketApprovalViewerBlockedReason["NOT_PENDING"] = "NOT_PENDING";
42
+ })(TicketApprovalViewerBlockedReason || (exports.TicketApprovalViewerBlockedReason = TicketApprovalViewerBlockedReason = {}));
43
+ /** Top-level `code` of the approval runtime errors (409 APPROVAL_PENDING / APPROVAL_NOT_PENDING, 403 APPROVAL_SELF_DECISION / APPROVAL_NOT_ELIGIBLE). */
44
+ var TicketApprovalErrorCode;
45
+ (function (TicketApprovalErrorCode) {
46
+ TicketApprovalErrorCode["APPROVAL_PENDING"] = "APPROVAL_PENDING";
47
+ TicketApprovalErrorCode["APPROVAL_NOT_PENDING"] = "APPROVAL_NOT_PENDING";
48
+ TicketApprovalErrorCode["APPROVAL_SELF_DECISION"] = "APPROVAL_SELF_DECISION";
49
+ TicketApprovalErrorCode["APPROVAL_NOT_ELIGIBLE"] = "APPROVAL_NOT_ELIGIBLE";
50
+ })(TicketApprovalErrorCode || (exports.TicketApprovalErrorCode = TicketApprovalErrorCode = {}));
51
+ /** `details[].code` of a rejected approval request (422 unless noted). */
52
+ var TicketApprovalErrorDetailCode;
53
+ (function (TicketApprovalErrorDetailCode) {
54
+ TicketApprovalErrorDetailCode["REQUIRED"] = "REQUIRED";
55
+ TicketApprovalErrorDetailCode["APPROVERS_REQUIRED"] = "APPROVERS_REQUIRED";
56
+ TicketApprovalErrorDetailCode["INVALID_CATEGORY"] = "INVALID_CATEGORY";
57
+ /** 409. */
58
+ TicketApprovalErrorDetailCode["NAME_CONFLICT"] = "NAME_CONFLICT";
59
+ /** 409; the detail carries `categoryId` and `definitionId`. */
60
+ TicketApprovalErrorDetailCode["CATEGORY_HAS_APPROVAL"] = "CATEGORY_HAS_APPROVAL";
61
+ /** 422 of POST /tickets/{id}/transition: nobody but the ticket's assignee is listed as approver. */
62
+ TicketApprovalErrorDetailCode["APPROVAL_NO_ELIGIBLE_APPROVER"] = "APPROVAL_NO_ELIGIBLE_APPROVER";
63
+ })(TicketApprovalErrorDetailCode || (exports.TicketApprovalErrorDetailCode = TicketApprovalErrorDetailCode = {}));
@@ -18,6 +18,12 @@ export interface ITicketCategory extends ITicketAuditedEntity {
18
18
  formRequirements?: ITicketFormRequirement[];
19
19
  fieldDefinitionIds?: string[];
20
20
  layoutIds?: string[];
21
+ /**
22
+ * Archived sits between disabled and soft-deleted: a disabled category hidden from the
23
+ * default settings list, recoverable via "show archived".
24
+ */
25
+ archivedAt?: Date;
26
+ archivedBy?: string;
21
27
  }
22
28
  export interface ITicketResolutionType extends ITicketAuditedEntity {
23
29
  name: string;
@@ -55,6 +61,8 @@ export interface IUpdateTicketCategoryDto {
55
61
  formRequirements?: ITicketFormRequirement[] | null;
56
62
  fieldDefinitionIds?: string[] | null;
57
63
  layoutIds?: string[] | null;
64
+ /** `true` archives the category (it must be disabled); `false` restores it. */
65
+ archived?: boolean;
58
66
  }
59
67
  export interface ICreateTicketResolutionTypeDto {
60
68
  name: string;
@@ -121,11 +121,23 @@ export interface ITicketMessageReference {
121
121
  conversationId: string;
122
122
  messageId: string;
123
123
  }
124
+ /** Current state of a ticket note, carried by the timeline entry that represents it. */
125
+ export interface ITicketTimelineNoteProjection {
126
+ id: string;
127
+ version: number;
128
+ isPublic: boolean;
129
+ text: string;
130
+ }
124
131
  export type ITicketTimelineEntry = {
125
132
  id: string;
126
133
  type: TicketTimelineEntryType.ACTIVITY;
127
134
  occurredAt: Date;
128
135
  activity: ITicketActivity;
136
+ /**
137
+ * Present only on the entry of a ticket note (activity `ticketEventType` NOTE_CREATED):
138
+ * the note as it is now, while `activity.comment` keeps the text it was created with.
139
+ */
140
+ note?: ITicketTimelineNoteProjection;
129
141
  } | {
130
142
  id: string;
131
143
  type: TicketTimelineEntryType.MESSAGE;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Internal ticket roles (RBAC), owned by tickets-api: /roles, /role-assignments,
3
+ * /actors/{userId}/access, /me/permissions and /permissions/catalog. They are
4
+ * local to the tickets module and do not touch the space profiles.
5
+ */
6
+ /**
7
+ * Closed permission catalog of the ticket roles (GET /permissions/catalog).
8
+ * There is no permission to see every ticket: that is the visibility scope `all`.
9
+ */
10
+ export type TicketPermission = "tickets.assign_others" | "tickets.delete" | "tickets.bulk_actions" | "views.share" | "views.manage" | "reports.view" | "settings.manage";
11
+ /**
12
+ * Which tickets a role lets its holder see, narrowest to widest:
13
+ * `own` (assigned to the user, plus QUEUED tickets of the queues of the user's
14
+ * groups) and `all` (every ticket of the space).
15
+ */
16
+ export type TicketVisibilityScope = "own" | "all";
17
+ /** Who holds a role assignment: a user or a ticket group. */
18
+ export type TicketRoleSubjectType = "user" | "group";
19
+ /** Number of users and groups holding a role. */
20
+ export interface ITicketRoleAssignmentCounts {
21
+ users: number;
22
+ groups: number;
23
+ }
24
+ /** Item of GET /roles and response of GET|POST|PATCH /roles/{roleId}. */
25
+ export interface ITicketRole {
26
+ id: string;
27
+ name: string;
28
+ description: string | null;
29
+ visibilityScope: TicketVisibilityScope;
30
+ permissions: TicketPermission[];
31
+ isDefault: boolean;
32
+ /** The seeded "Administrador" role: renamable, never reduced nor deleted. */
33
+ isSystem: boolean;
34
+ createdAt: Date;
35
+ createdBy: string;
36
+ updatedAt?: Date;
37
+ updatedBy?: string;
38
+ /** Only on GET /roles. */
39
+ assignmentCounts?: ITicketRoleAssignmentCounts;
40
+ }
41
+ /** Item of GET /roles/{roleId}/assignments and response of POST /roles/{roleId}/assignments. */
42
+ export interface ITicketRoleAssignment {
43
+ id: string;
44
+ roleId: string;
45
+ subjectType: TicketRoleSubjectType;
46
+ /** User id ('user') or ticket group id ('group'). */
47
+ subjectId: string;
48
+ createdAt: Date;
49
+ createdBy: string;
50
+ }
51
+ /** Item of GET /role-assignments: a direct assignment with the role it grants. */
52
+ export interface ITicketSubjectRoleAssignment extends ITicketRoleAssignment {
53
+ roleName: string;
54
+ isSystem: boolean;
55
+ isDefault: boolean;
56
+ }
57
+ /** Body of POST /roles. */
58
+ export interface ICreateTicketRoleDto {
59
+ name: string;
60
+ description?: string | null;
61
+ visibilityScope: TicketVisibilityScope;
62
+ permissions: TicketPermission[];
63
+ isDefault?: boolean;
64
+ }
65
+ /** Body of PATCH /roles/{roleId}. At least one field; `isSystem` is not editable. */
66
+ export type IUpdateTicketRoleDto = Partial<ICreateTicketRoleDto>;
67
+ /** Body of POST /roles/{roleId}/assignments. */
68
+ export interface ICreateTicketRoleAssignmentDto {
69
+ subjectType: TicketRoleSubjectType;
70
+ subjectId: string;
71
+ }
72
+ /**
73
+ * Response of GET /actors/{userId}/access and GET /me/permissions: the
74
+ * effective access of a user (roles assigned directly, via groups, or the default).
75
+ */
76
+ export interface ITicketActorAccess {
77
+ userId: string;
78
+ /** Live groups the user belongs to. */
79
+ groupIds: string[];
80
+ /** Effective roles: assigned directly or through a group, else the default role. */
81
+ roleIds: string[];
82
+ scope: TicketVisibilityScope;
83
+ permissions: TicketPermission[];
84
+ /** Holds the system "Administrador" role. */
85
+ isAdministrador: boolean;
86
+ }
87
+ /** Response of GET /permissions/catalog. */
88
+ export interface ITicketPermissionCatalog {
89
+ permissions: TicketPermission[];
90
+ scopes: TicketVisibilityScope[];
91
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Internal ticket roles (RBAC), owned by tickets-api: /roles, /role-assignments,
4
+ * /actors/{userId}/access, /me/permissions and /permissions/catalog. They are
5
+ * local to the tickets module and do not touch the space profiles.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -391,6 +391,16 @@ export interface ICreateAgentChannelCapacityDto {
391
391
  reservedCapacity?: number;
392
392
  }
393
393
  export type IUpdateAgentChannelCapacityDto = Partial<Omit<ICreateAgentChannelCapacityDto, "userId" | "channelType">>;
394
+ /** Mirror of TicketSkillWarningCode for agent channel capacity. */
395
+ export declare enum AgentCapacityWarningCode {
396
+ /** The agent holds a skill a queue requires but has no capacity row configured. */
397
+ NO_CAPACITY_CONFIGURED = "NO_CAPACITY_CONFIGURED"
398
+ }
399
+ /** Item of GET /routing/agent-capacities/warnings (the body is a bare array). */
400
+ export interface IAgentCapacityWarning {
401
+ userId: string;
402
+ warning: AgentCapacityWarningCode;
403
+ }
394
404
  export interface IEscalationPolicyUsageRef {
395
405
  id: string;
396
406
  name: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EscalationPolicyWarningCode = exports.TicketSkillWarningCode = exports.TicketAssignmentEndReason = exports.TicketEscalationActionType = exports.TicketEscalationTrigger = exports.TicketSkillRelaxationMode = exports.TicketQueueOrderDirection = exports.TicketQueueOrderCriterion = exports.TicketRoutingConditionGroupOperator = exports.AgentAvailabilityStatus = exports.TicketRoutingStatus = exports.TicketQueueSystemKey = exports.TicketRoutingStrategy = void 0;
3
+ exports.EscalationPolicyWarningCode = exports.AgentCapacityWarningCode = exports.TicketSkillWarningCode = exports.TicketAssignmentEndReason = exports.TicketEscalationActionType = exports.TicketEscalationTrigger = exports.TicketSkillRelaxationMode = exports.TicketQueueOrderDirection = exports.TicketQueueOrderCriterion = exports.TicketRoutingConditionGroupOperator = exports.AgentAvailabilityStatus = exports.TicketRoutingStatus = exports.TicketQueueSystemKey = exports.TicketRoutingStrategy = void 0;
4
4
  var TicketRoutingStrategy;
5
5
  (function (TicketRoutingStrategy) {
6
6
  TicketRoutingStrategy["ROUND_ROBIN"] = "ROUND_ROBIN";
@@ -109,6 +109,12 @@ var TicketSkillWarningCode;
109
109
  TicketSkillWarningCode["DISABLED_BUT_REFERENCED"] = "DISABLED_BUT_REFERENCED";
110
110
  TicketSkillWarningCode["REQUIRED_BY_QUEUE_BUT_UNMET"] = "REQUIRED_BY_QUEUE_BUT_UNMET";
111
111
  })(TicketSkillWarningCode || (exports.TicketSkillWarningCode = TicketSkillWarningCode = {}));
112
+ /** Mirror of TicketSkillWarningCode for agent channel capacity. */
113
+ var AgentCapacityWarningCode;
114
+ (function (AgentCapacityWarningCode) {
115
+ /** The agent holds a skill a queue requires but has no capacity row configured. */
116
+ AgentCapacityWarningCode["NO_CAPACITY_CONFIGURED"] = "NO_CAPACITY_CONFIGURED";
117
+ })(AgentCapacityWarningCode || (exports.AgentCapacityWarningCode = AgentCapacityWarningCode = {}));
112
118
  /** Mirror of TicketSkillWarningCode; only one member is needed today. */
113
119
  var EscalationPolicyWarningCode;
114
120
  (function (EscalationPolicyWarningCode) {
@@ -258,6 +258,14 @@ export interface ITicketRetentionPolicy extends ITicketAuditedEntity {
258
258
  enabled: boolean;
259
259
  version: number;
260
260
  }
261
+ /**
262
+ * Row of GET /security/retention-policies: the policy plus its estimated reach
263
+ * (the same number the preview reports as `alreadyReachedCount`). Optional
264
+ * because the write endpoints return the bare policy without the count.
265
+ */
266
+ export interface ITicketRetentionPolicyListEntry extends ITicketRetentionPolicy {
267
+ estimatedAffectedCount?: number;
268
+ }
261
269
  export interface ICreateTicketRetentionPolicyDto {
262
270
  name: string;
263
271
  description?: string;
@@ -323,6 +331,19 @@ export interface ITicketRetentionValidationEntry {
323
331
  export interface IValidateTicketRetentionResponse {
324
332
  policies: ITicketRetentionValidationEntry[];
325
333
  }
334
+ /**
335
+ * Body of POST /security/retention-policies/preview. At least one field is
336
+ * required: `policyId` previews a stored policy, `policy` an unsaved draft, and
337
+ * both together a draft that replaces that policy.
338
+ */
339
+ export interface IPreviewTicketRetentionDto {
340
+ policyId?: string;
341
+ policy?: ICreateTicketRetentionPolicyDto;
342
+ }
343
+ /** Body of POST /security/retention-policies/validate. Omit `policyId` to validate every policy in the space. */
344
+ export interface IValidateTicketRetentionDto {
345
+ policyId?: string;
346
+ }
326
347
  export interface ITicketFieldSecurityValidationIssue {
327
348
  code: string;
328
349
  severity: 'ERROR' | 'WARNING';
@@ -553,9 +574,22 @@ export interface ITicketLegalHoldsResponse {
553
574
  holds: ITicketLegalHold[];
554
575
  suspendedPolicies: ITicketSuspendedRetentionPolicy[];
555
576
  }
577
+ /** Row of GET /security/legal-holds. */
556
578
  export interface ITicketLegalHoldListEntry extends ITicketLegalHold {
557
579
  ticketNumber: number;
558
580
  ticketTitle: string;
581
+ /** Retention policies the held ticket would otherwise be subject to; shared by every hold on the same ticket. */
582
+ suspendedPolicies: ITicketSuspendedRetentionPolicy[];
583
+ }
584
+ /**
585
+ * Response of POST /tickets/{id}/legal-holds/{holdId}/release. Releasing one of
586
+ * several holds keeps the ticket protected: `stillOnHold` is then true and
587
+ * `resumedPolicies` is empty.
588
+ */
589
+ export interface IReleaseTicketLegalHoldResponse {
590
+ hold: ITicketLegalHold;
591
+ stillOnHold: boolean;
592
+ resumedPolicies: ITicketSuspendedRetentionPolicy[];
559
593
  }
560
594
  export interface ICreateTicketDelegatedAccessDto {
561
595
  delegateId: string;
@@ -343,6 +343,23 @@ export interface ICreateTicketPublicStatusMappingDto {
343
343
  }
344
344
  export interface IUpdateTicketPublicStatusMappingDto extends Partial<ICreateTicketPublicStatusMappingDto> {
345
345
  }
346
+ /**
347
+ * How a scheme references a public status: by mapping internal statuses onto it
348
+ * (`MAPPING`) or by using it as its fallback (`SCHEME_DEFAULT`).
349
+ */
350
+ export type PublicStatusUsageKind = "MAPPING" | "SCHEME_DEFAULT";
351
+ export interface IPublicStatusUsage {
352
+ schemeId: string;
353
+ schemeName: string;
354
+ as: PublicStatusUsageKind;
355
+ }
356
+ /**
357
+ * Body of GET /public-statuses/{id}/usages. A non-empty list blocks DELETE
358
+ * (409, same entries as `details`).
359
+ */
360
+ export interface IPublicStatusUsages {
361
+ usages: IPublicStatusUsage[];
362
+ }
346
363
  /** Customer-facing projection of ITicketPublicStatus: no audit or tenant fields. */
347
364
  export interface ICustomerPublicStatusView {
348
365
  id: string;
@@ -1,11 +1,11 @@
1
1
  import { ChannelType } from "../Common/Channels/ChannelType";
2
2
  import { ITicketAttachment, ITicketContactProjection, ITicketExternalReference, ITicketProperty, ITicketTagInfo, TicketCreationMethod, TicketOriginChannel, TicketPriority, TicketStage } from "./Common";
3
- import { ITicketFormSubmissionReference } from "./Workflow";
3
+ import { ITicketFormSubmissionReference, TicketActivityType } from "./Workflow";
4
4
  import { ITicketSlaState } from "./Sla";
5
5
  import { ITicketSecurityState } from "./Security";
6
6
  import { ITicketApprovalSummary } from "./Approval";
7
7
  import { ITicketTaskSummary } from "./Task";
8
- import { ITicketConversationReference } from "./Conversation";
8
+ import { ITicketConversationReference, TicketMessageActorType } from "./Conversation";
9
9
  import { ITicketRoutingState } from "./Routing";
10
10
  import { ITicketAISummary } from "./AI";
11
11
  export interface ITicketResolution {
@@ -15,6 +15,17 @@ export interface ITicketResolution {
15
15
  resolvedAt: Date;
16
16
  resolvedBy: string;
17
17
  }
18
+ /**
19
+ * What happened last on a ticket. `CUSTOMER_MESSAGE` / `AGENT_MESSAGE` are not activity rows:
20
+ * they come from a cited message whose direction says who wrote it.
21
+ */
22
+ export type TicketLastActivityType = TicketActivityType | "CUSTOMER_MESSAGE" | "AGENT_MESSAGE";
23
+ export interface ITicketLastActivity {
24
+ type: TicketLastActivityType;
25
+ actorType?: TicketMessageActorType;
26
+ /** ISO 8601. */
27
+ at: string;
28
+ }
18
29
  export interface ITicket {
19
30
  id: string;
20
31
  spaceId: string;
@@ -64,6 +75,15 @@ export interface ITicket {
64
75
  reopenedAt?: Date;
65
76
  reopenedBy?: string;
66
77
  reopenCount: number;
78
+ /** When the ticket entered its current status. */
79
+ statusChangedAt?: Date;
80
+ /** What happened last on the ticket; null when nothing was recorded yet. */
81
+ lastActivity?: ITicketLastActivity | null;
82
+ /**
83
+ * Set when the latest decided close approval was rejected; absent once a new
84
+ * approval is approved. Re-requesting an approval keeps it.
85
+ */
86
+ approvalRejectedAt?: Date;
67
87
  createdAt: Date;
68
88
  createdBy: string;
69
89
  updatedAt?: Date;
@@ -133,7 +153,8 @@ export interface IUpdateTicketDto {
133
153
  export interface IResolveTicketDto {
134
154
  expectedVersion: number;
135
155
  toStatusId: string;
136
- resolutionTypeId: string;
156
+ /** Optional: a ticket can be resolved without a resolution type. */
157
+ resolutionTypeId?: string;
137
158
  description?: string;
138
159
  comment?: string;
139
160
  attachmentIds?: string[];
@@ -11,6 +11,12 @@ export interface ITicketStatus extends ITicketAuditedEntity {
11
11
  order: number;
12
12
  isInitial: boolean;
13
13
  isFinal: boolean;
14
+ /**
15
+ * Only meaningful when `isFinal` is true: how many days a ticket stays visible in list/kanban
16
+ * search after entering this status. `undefined`/`null` means no expiry; on update, `null`
17
+ * clears a previous value.
18
+ */
19
+ visibleDays?: number | null;
14
20
  enabled: boolean;
15
21
  version: number;
16
22
  }
@@ -79,6 +85,43 @@ export interface IUpdateTicketTransitionDTO extends Partial<Omit<ITicketTransiti
79
85
  id: string;
80
86
  expectedVersion: number;
81
87
  }
88
+ /** A transition condition that is not met, as reported by POST /transitions/{id}/validate. */
89
+ export interface ITicketTransitionBlockedCondition {
90
+ conditionId: string;
91
+ conditionType: string;
92
+ /** Ready to show: the API surfaces it verbatim as the detail message. */
93
+ reason: string;
94
+ }
95
+ /** Body of POST /transitions/{id}/validate. */
96
+ export interface IValidateTicketTransitionResponse {
97
+ allowed: boolean;
98
+ /** Ids only, kept for existing consumers; `blocked` carries the explanation. */
99
+ blockedConditions: string[];
100
+ blocked: ITicketTransitionBlockedCondition[];
101
+ }
102
+ /**
103
+ * What stops working if a transition is disabled (GET /transitions/{id}/disable-impact).
104
+ * Informational: disabling is still allowed. Everything recovers as soon as a path is restored.
105
+ */
106
+ export interface ITransitionDisableImpact {
107
+ /** The origin status, when this transition is its only enabled way out. */
108
+ strandedStatus: {
109
+ statusId: string;
110
+ statusName: string;
111
+ /** Tickets currently in that status, which would have no way to move. */
112
+ ticketCount: number;
113
+ } | null;
114
+ /** SLA metric definitions whose completion stops being reachable from their start. */
115
+ slaMetricDefinitions: {
116
+ id: string;
117
+ name: string;
118
+ }[];
119
+ /** Macros that move tickets to the transition's target; they fail for tickets in the origin. */
120
+ macros: {
121
+ id: string;
122
+ name: string;
123
+ }[];
124
+ }
82
125
  export declare enum TicketActivityType {
83
126
  CREATED = "CREATED",
84
127
  UPDATED = "UPDATED",
@@ -88,7 +131,11 @@ export declare enum TicketActivityType {
88
131
  ATTACHMENT_ADDED = "ATTACHMENT_ADDED",
89
132
  ATTACHMENT_DELETED = "ATTACHMENT_DELETED",
90
133
  FORM_SUBMITTED = "FORM_SUBMITTED",
134
+ APPROVAL_REQUESTED = "APPROVAL_REQUESTED",
91
135
  APPROVAL_COMPLETED = "APPROVAL_COMPLETED",
136
+ APPROVAL_REJECTED = "APPROVAL_REJECTED",
137
+ /** @deprecated No longer written (one decision per approval, no steps); older rows still carry it. */
138
+ APPROVAL_STEP_APPROVED = "APPROVAL_STEP_APPROVED",
92
139
  TASK_COMPLETED = "TASK_COMPLETED",
93
140
  ALL_REQUIRED_TASKS_COMPLETED = "ALL_REQUIRED_TASKS_COMPLETED",
94
141
  CHECKLIST_COMPLETED = "CHECKLIST_COMPLETED",
@@ -36,7 +36,11 @@ var TicketActivityType;
36
36
  TicketActivityType["ATTACHMENT_ADDED"] = "ATTACHMENT_ADDED";
37
37
  TicketActivityType["ATTACHMENT_DELETED"] = "ATTACHMENT_DELETED";
38
38
  TicketActivityType["FORM_SUBMITTED"] = "FORM_SUBMITTED";
39
+ TicketActivityType["APPROVAL_REQUESTED"] = "APPROVAL_REQUESTED";
39
40
  TicketActivityType["APPROVAL_COMPLETED"] = "APPROVAL_COMPLETED";
41
+ TicketActivityType["APPROVAL_REJECTED"] = "APPROVAL_REJECTED";
42
+ /** @deprecated No longer written (one decision per approval, no steps); older rows still carry it. */
43
+ TicketActivityType["APPROVAL_STEP_APPROVED"] = "APPROVAL_STEP_APPROVED";
40
44
  TicketActivityType["TASK_COMPLETED"] = "TASK_COMPLETED";
41
45
  TicketActivityType["ALL_REQUIRED_TASKS_COMPLETED"] = "ALL_REQUIRED_TASKS_COMPLETED";
42
46
  TicketActivityType["CHECKLIST_COMPLETED"] = "CHECKLIST_COMPLETED";
@@ -22,3 +22,4 @@ export * from './Layouts';
22
22
  export * from './Views';
23
23
  export * from './AI';
24
24
  export * from './Group';
25
+ export * from './Roles';
@@ -38,3 +38,4 @@ __exportStar(require("./Layouts"), exports);
38
38
  __exportStar(require("./Views"), exports);
39
39
  __exportStar(require("./AI"), exports);
40
40
  __exportStar(require("./Group"), exports);
41
+ __exportStar(require("./Roles"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trii/types",
3
- "version": "2.10.813",
3
+ "version": "2.10.815",
4
4
  "description": "Types definitions for Trii projects - ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",