@trii/types 2.10.709 → 2.10.711

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.
@@ -1,12 +1,101 @@
1
+ export interface CreateApiKeyResponseDto {
2
+ apiKey: ApiKey;
3
+ /**
4
+ * Credential returned only once, immediately after creation.
5
+ * It cannot be retrieved again later.
6
+ */
7
+ credential: string;
8
+ }
1
9
  export interface ApiKey {
2
10
  id: string;
3
11
  spaceId: string;
4
12
  name: string;
13
+ status: ApiKeyStatus;
5
14
  privileges: ApiPrivilege;
6
- createdBy: Date;
15
+ security?: ApiKeySecurityPolicy;
16
+ /**
17
+ * Prefix used to identify the API key without exposing the secret.
18
+ */
19
+ keyPrefix: string;
20
+ createdBy: string;
7
21
  createdAt: Date;
22
+ updatedBy?: string;
23
+ updatedAt?: Date;
24
+ lastUsedAt?: Date;
25
+ lastUsedIp?: string;
8
26
  }
27
+ export type ApiKeyStatus = "active" | "disabled" | "revoked";
9
28
  export interface ApiPrivilege {
10
- Messages: boolean;
11
- Contacts: boolean;
29
+ /** @deprecated Replaced by scopes. */
30
+ Messages?: boolean;
31
+ /** @deprecated Replaced by scopes. */
32
+ Contacts?: boolean;
33
+ /**
34
+ * Permissions granted to the API key.
35
+ *
36
+ * Examples:
37
+ * - contacts.read
38
+ * - contacts.write
39
+ * - messages.read
40
+ * - messages.send
41
+ */
42
+ scopes: ApiScope[];
43
+ /**
44
+ * Optional restrictions applied to this API key.
45
+ *
46
+ * Restrictions limit which resources can be accessed,
47
+ * independently of the granted scopes.
48
+ */
49
+ restrictions?: ApiResourceRestrictions;
50
+ }
51
+ export interface ApiKeySecurityPolicy {
52
+ /**
53
+ * Allowed IPv4/IPv6 addresses or CIDR ranges.
54
+ */
55
+ allowedIpAddresses?: string[];
56
+ /**
57
+ * Optional expiration date.
58
+ */
59
+ expiresAt?: Date;
60
+ }
61
+ export type ApiScope = (typeof API_SCOPES)[keyof typeof API_SCOPES];
62
+ export declare const API_SCOPES: {
63
+ readonly CONTACTS_READ: "contacts.read";
64
+ readonly CONTACTS_WRITE: "contacts.write";
65
+ readonly COMPANIES_READ: "companies.read";
66
+ readonly COMPANIES_WRITE: "companies.write";
67
+ readonly CONVERSATIONS_READ: "conversations.read";
68
+ readonly CONVERSATIONS_WRITE: "conversations.write";
69
+ readonly MESSAGES_READ: "messages.read";
70
+ readonly MESSAGES_SEND: "messages.send";
71
+ readonly TICKETS_READ: "tickets.read";
72
+ readonly TICKETS_WRITE: "tickets.write";
73
+ readonly TASKS_READ: "tasks.read";
74
+ readonly TASKS_WRITE: "tasks.write";
75
+ readonly CALENDAR_READ: "calendar.read";
76
+ readonly CALENDAR_WRITE: "calendar.write";
77
+ readonly FILES_READ: "files.read";
78
+ readonly FILES_WRITE: "files.write";
79
+ readonly CALLS_READ: "calls.read";
80
+ readonly CALLS_MAKE: "calls.make";
81
+ readonly WEBHOOKS_READ: "webhooks.read";
82
+ readonly WEBHOOKS_WRITE: "webhooks.write";
83
+ readonly USERS_READ: "users.read";
84
+ readonly FLOWS_READ: "flows.read";
85
+ readonly FLOWS_EXECUTE: "flows.execute";
86
+ readonly REPORTS_READ: "reports.read";
87
+ };
88
+ export interface ApiResourceRestrictions {
89
+ /**
90
+ * Restrict access to specific communication channels.
91
+ */
92
+ channelIds?: string[];
93
+ /**
94
+ * Restrict access to specific teams/groups.
95
+ */
96
+ teamIds?: string[];
97
+ /**
98
+ * Restrict access to specific users/agents.
99
+ */
100
+ userIds?: string[];
12
101
  }
@@ -1,2 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_SCOPES = void 0;
4
+ exports.API_SCOPES = {
5
+ CONTACTS_READ: "contacts.read",
6
+ CONTACTS_WRITE: "contacts.write",
7
+ COMPANIES_READ: "companies.read",
8
+ COMPANIES_WRITE: "companies.write",
9
+ CONVERSATIONS_READ: "conversations.read",
10
+ CONVERSATIONS_WRITE: "conversations.write",
11
+ MESSAGES_READ: "messages.read",
12
+ MESSAGES_SEND: "messages.send",
13
+ TICKETS_READ: "tickets.read",
14
+ TICKETS_WRITE: "tickets.write",
15
+ TASKS_READ: "tasks.read",
16
+ TASKS_WRITE: "tasks.write",
17
+ CALENDAR_READ: "calendar.read",
18
+ CALENDAR_WRITE: "calendar.write",
19
+ FILES_READ: "files.read",
20
+ FILES_WRITE: "files.write",
21
+ CALLS_READ: "calls.read",
22
+ CALLS_MAKE: "calls.make",
23
+ WEBHOOKS_READ: "webhooks.read",
24
+ WEBHOOKS_WRITE: "webhooks.write",
25
+ USERS_READ: "users.read",
26
+ FLOWS_READ: "flows.read",
27
+ FLOWS_EXECUTE: "flows.execute",
28
+ REPORTS_READ: "reports.read",
29
+ };
@@ -79,6 +79,57 @@ export interface IBusinessCalendar extends ITicketAuditedEntity {
79
79
  exceptions: IBusinessCalendarException[];
80
80
  enabled: boolean;
81
81
  }
82
+ export interface ICreateBusinessCalendarDto {
83
+ name: string;
84
+ timeZone: string;
85
+ schedule: IBusinessDaySchedule[];
86
+ exceptions: IBusinessCalendarException[];
87
+ enabled?: boolean;
88
+ }
89
+ export interface IUpdateBusinessCalendarDto {
90
+ name?: string;
91
+ timeZone?: string;
92
+ schedule?: IBusinessDaySchedule[];
93
+ exceptions?: IBusinessCalendarException[];
94
+ enabled?: boolean;
95
+ }
96
+ export interface IBusinessCalendarPreviewRequest {
97
+ businessCalendarId?: string;
98
+ calendar?: {
99
+ timeZone: string;
100
+ schedule: IBusinessDaySchedule[];
101
+ exceptions: IBusinessCalendarException[];
102
+ };
103
+ check: {
104
+ type: 'IS_WORKING_MOMENT';
105
+ at: string;
106
+ } | {
107
+ type: 'NEXT_WORKING_PERIOD';
108
+ from: string;
109
+ } | {
110
+ type: 'DEADLINE';
111
+ from: string;
112
+ durationMinutes: number;
113
+ };
114
+ }
115
+ export interface IBusinessCalendarPreviewResponse {
116
+ result: {
117
+ type: 'IS_WORKING_MOMENT';
118
+ isWorking: boolean;
119
+ matchedException?: {
120
+ date: string;
121
+ name?: string;
122
+ };
123
+ } | {
124
+ type: 'NEXT_WORKING_PERIOD';
125
+ startsAt: string;
126
+ endsAt: string;
127
+ } | {
128
+ type: 'DEADLINE';
129
+ dueAt: string;
130
+ businessMinutesConsumed: number;
131
+ };
132
+ }
82
133
  export interface ISlaEventMatcher {
83
134
  eventType: SlaEventType;
84
135
  statusId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trii/types",
3
- "version": "2.10.709",
3
+ "version": "2.10.711",
4
4
  "description": "Types definitions for Trii projects - ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",