@digisglobal/omnivox-sdk 0.8.0 → 0.10.0
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/dist/index.cjs +201 -3
- package/dist/index.d.cts +317 -12
- package/dist/index.d.ts +317 -12
- package/dist/index.js +198 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -33,6 +33,169 @@ declare function createApiKeyTokenProvider(apiKey: string): TokenProvider;
|
|
|
33
33
|
*/
|
|
34
34
|
declare function createSessionTokenProvider(): TokenProvider;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Audit module — hand-written typed wrapper over the generated client.
|
|
38
|
+
*
|
|
39
|
+
* Exposes the F16 audit-log read surface:
|
|
40
|
+
* - list(opts) → GET /api/v1/audit-log (pageSize capped at 100)
|
|
41
|
+
*
|
|
42
|
+
* Filterable by resourceType, resourceId, actorId and a createdAt time range
|
|
43
|
+
* (from/to), paginated, newest first. Read requires the AuditEntry read
|
|
44
|
+
* ability (global ADMIN agent or api_key/system actor).
|
|
45
|
+
*
|
|
46
|
+
* Never re-exports symbols from _generated/.
|
|
47
|
+
* Contains no business logic — typed transport only.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/** Options to construct the audit module. */
|
|
51
|
+
interface AuditModuleOptions extends TokenProvider {
|
|
52
|
+
/** Base URL of the Omnivox API (e.g. "https://api.omnivox.io"). */
|
|
53
|
+
baseUrl: string;
|
|
54
|
+
}
|
|
55
|
+
/** One audit-trail entry returned by GET /api/v1/audit-log. */
|
|
56
|
+
interface AuditEntry {
|
|
57
|
+
id: string;
|
|
58
|
+
/** Actor kind that produced the entry (e.g. "agent" | "api_key" | "system"). */
|
|
59
|
+
actorType: string;
|
|
60
|
+
/** Acting identity id; null for system-originated entries. */
|
|
61
|
+
actorId: string | null;
|
|
62
|
+
/** The audited action (e.g. "contact.update"). */
|
|
63
|
+
action: string;
|
|
64
|
+
/** The audited resource kind (e.g. "Contact"). */
|
|
65
|
+
resourceType: string;
|
|
66
|
+
/** The audited resource id. */
|
|
67
|
+
resourceId: string;
|
|
68
|
+
/** JSON-Patch-array diff of the change (forward-compat shape). */
|
|
69
|
+
diff: unknown;
|
|
70
|
+
/** Correlation id linking related entries; null when absent. */
|
|
71
|
+
correlationId: string | null;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
/** Paginated list response. */
|
|
76
|
+
interface PagedList$7<T> {
|
|
77
|
+
data: T[];
|
|
78
|
+
meta: {
|
|
79
|
+
page: number;
|
|
80
|
+
pageSize: number;
|
|
81
|
+
total: number;
|
|
82
|
+
hasNextPage: boolean;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Filter + pagination options for audit.list(). */
|
|
86
|
+
interface AuditListOpts {
|
|
87
|
+
/** Filter to entries whose resourceType matches exactly. */
|
|
88
|
+
resourceType?: string;
|
|
89
|
+
/** Filter to entries whose resourceId matches exactly. */
|
|
90
|
+
resourceId?: string;
|
|
91
|
+
/** Filter to entries produced by this actor id. */
|
|
92
|
+
actorId?: string;
|
|
93
|
+
/** Inclusive lower bound on createdAt (ISO 8601 date-time). */
|
|
94
|
+
from?: string;
|
|
95
|
+
/** Inclusive upper bound on createdAt (ISO 8601 date-time). */
|
|
96
|
+
to?: string;
|
|
97
|
+
/** Page number (1-based, default 1). */
|
|
98
|
+
page?: number;
|
|
99
|
+
/** Entries per page (default 25, clamped to 100). */
|
|
100
|
+
pageSize?: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Creates the audit module — a thin typed wrapper over the generated client.
|
|
104
|
+
*/
|
|
105
|
+
declare function createAuditModule(options: AuditModuleOptions): {
|
|
106
|
+
/**
|
|
107
|
+
* List the tenant audit trail (newest first, paginated).
|
|
108
|
+
* pageSize is clamped to 100 per the API contract.
|
|
109
|
+
* Calls GET /api/v1/audit-log.
|
|
110
|
+
*/
|
|
111
|
+
list(opts?: AuditListOpts): Promise<PagedList$7<AuditEntry>>;
|
|
112
|
+
};
|
|
113
|
+
/** Return type of createAuditModule. */
|
|
114
|
+
type AuditModule = ReturnType<typeof createAuditModule>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Dashboard module — hand-written typed wrapper over the generated client.
|
|
118
|
+
*
|
|
119
|
+
* Exposes the F14 dashboard read surface:
|
|
120
|
+
* - stats() → GET /api/v1/dashboard/stats
|
|
121
|
+
* - recentActivity(opts) → GET /api/v1/dashboard/recent-activity (pageSize capped at 100)
|
|
122
|
+
*
|
|
123
|
+
* Never re-exports symbols from _generated/.
|
|
124
|
+
* Contains no business logic — typed transport only.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/** Options to construct the dashboard module. */
|
|
128
|
+
interface DashboardModuleOptions extends TokenProvider {
|
|
129
|
+
/** Base URL of the Omnivox API (e.g. "https://api.omnivox.io"). */
|
|
130
|
+
baseUrl: string;
|
|
131
|
+
}
|
|
132
|
+
/** Tenant dashboard KPIs returned by GET /api/v1/dashboard/stats. */
|
|
133
|
+
interface DashboardStats {
|
|
134
|
+
/** Conversations not yet CLOSED (PENDING | OPEN | ON_HOLD). */
|
|
135
|
+
activeConversationsCount: number;
|
|
136
|
+
/** All contacts for the tenant. */
|
|
137
|
+
contactsCount: number;
|
|
138
|
+
/** OPEN conversations grouped by the linked contact identity's channel type. */
|
|
139
|
+
openByChannel: {
|
|
140
|
+
WHATSAPP: number;
|
|
141
|
+
EMAIL: number;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* OPEN conversations where the authenticated agent is an ACTIVE OWNER
|
|
145
|
+
* participant. 0 for api_key/system actors (no acting agent identity).
|
|
146
|
+
*/
|
|
147
|
+
myOpenCount: number;
|
|
148
|
+
}
|
|
149
|
+
/** One item in the tenant recent-activity feed. */
|
|
150
|
+
interface RecentActivityItem {
|
|
151
|
+
/** The underlying Message row's id — stable per-item identity for the feed. */
|
|
152
|
+
id: string;
|
|
153
|
+
conversationId: string;
|
|
154
|
+
/** The parent conversation's CURRENT status (not the status at message time). */
|
|
155
|
+
conversationStatus: 'PENDING' | 'OPEN' | 'ON_HOLD' | 'CLOSED';
|
|
156
|
+
/** The linked contact identity's channel type — same values as `openByChannel`. */
|
|
157
|
+
channelType: 'WHATSAPP' | 'EMAIL';
|
|
158
|
+
direction: 'INBOUND' | 'OUTBOUND';
|
|
159
|
+
type: 'TEXT' | 'IMAGE' | 'DOCUMENT' | 'AUDIO' | 'VIDEO' | 'TEMPLATE';
|
|
160
|
+
status: 'QUEUED' | 'SENT' | 'DELIVERED' | 'READ' | 'FAILED';
|
|
161
|
+
content: unknown;
|
|
162
|
+
createdAt: string;
|
|
163
|
+
[key: string]: unknown;
|
|
164
|
+
}
|
|
165
|
+
/** Paginated list response. */
|
|
166
|
+
interface PagedList$6<T> {
|
|
167
|
+
data: T[];
|
|
168
|
+
meta: {
|
|
169
|
+
page: number;
|
|
170
|
+
pageSize: number;
|
|
171
|
+
total: number;
|
|
172
|
+
hasNextPage: boolean;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/** Pagination options for recentActivity(). */
|
|
176
|
+
interface RecentActivityListOpts {
|
|
177
|
+
page: number;
|
|
178
|
+
pageSize: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Creates the dashboard module — a thin typed wrapper over the generated client.
|
|
182
|
+
*/
|
|
183
|
+
declare function createDashboardModule(options: DashboardModuleOptions): {
|
|
184
|
+
/**
|
|
185
|
+
* Fetch the tenant dashboard KPIs.
|
|
186
|
+
* Calls GET /api/v1/dashboard/stats.
|
|
187
|
+
*/
|
|
188
|
+
stats(): Promise<DashboardStats>;
|
|
189
|
+
/**
|
|
190
|
+
* List the tenant's recent conversation/message activity feed
|
|
191
|
+
* (newest first, paginated). pageSize is clamped to 100 per the API
|
|
192
|
+
* contract. Calls GET /api/v1/dashboard/recent-activity.
|
|
193
|
+
*/
|
|
194
|
+
recentActivity(opts?: RecentActivityListOpts): Promise<PagedList$6<RecentActivityItem>>;
|
|
195
|
+
};
|
|
196
|
+
/** Return type of createDashboardModule. */
|
|
197
|
+
type DashboardModule = ReturnType<typeof createDashboardModule>;
|
|
198
|
+
|
|
36
199
|
/**
|
|
37
200
|
* Canned-responses module — hand-written typed wrapper over the generated client.
|
|
38
201
|
*
|
|
@@ -42,6 +205,7 @@ declare function createSessionTokenProvider(): TokenProvider;
|
|
|
42
205
|
* - create(input) → POST /api/v1/canned-responses
|
|
43
206
|
* - update(id, input) → PATCH /api/v1/canned-responses/:id
|
|
44
207
|
* - delete(id) → DELETE /api/v1/canned-responses/:id
|
|
208
|
+
* - duplicate(id) → POST /api/v1/canned-responses/:id/duplicate
|
|
45
209
|
*
|
|
46
210
|
* Never re-exports symbols from _generated/.
|
|
47
211
|
* Contains no business logic — typed transport only.
|
|
@@ -55,23 +219,29 @@ interface CannedResponsesModuleOptions extends TokenProvider {
|
|
|
55
219
|
/** Input for creating a canned response. */
|
|
56
220
|
interface CreateCannedResponseInput {
|
|
57
221
|
title: string;
|
|
222
|
+
shortcut: string;
|
|
58
223
|
body: string;
|
|
59
|
-
|
|
224
|
+
category?: string;
|
|
225
|
+
channel?: string;
|
|
60
226
|
[key: string]: unknown;
|
|
61
227
|
}
|
|
62
228
|
/** Input for partially updating a canned response. */
|
|
63
229
|
interface UpdateCannedResponseInput {
|
|
64
230
|
title?: string;
|
|
231
|
+
shortcut?: string;
|
|
65
232
|
body?: string;
|
|
66
|
-
|
|
233
|
+
category?: string;
|
|
234
|
+
channel?: string;
|
|
67
235
|
[key: string]: unknown;
|
|
68
236
|
}
|
|
69
237
|
/** Canned response resource shape returned by the API. */
|
|
70
238
|
interface CannedResponseItem {
|
|
71
239
|
id: string;
|
|
72
240
|
title: string;
|
|
241
|
+
shortcut: string;
|
|
242
|
+
category: string;
|
|
243
|
+
channel: string;
|
|
73
244
|
body: string;
|
|
74
|
-
keywords: string[];
|
|
75
245
|
[key: string]: unknown;
|
|
76
246
|
}
|
|
77
247
|
/** Paginated list response. */
|
|
@@ -88,6 +258,8 @@ interface PagedList$5<T> {
|
|
|
88
258
|
interface CannedResponseListOpts {
|
|
89
259
|
page: number;
|
|
90
260
|
pageSize: number;
|
|
261
|
+
category?: string;
|
|
262
|
+
channel?: string;
|
|
91
263
|
[key: string]: unknown;
|
|
92
264
|
}
|
|
93
265
|
/** Pagination + search options for search(). */
|
|
@@ -95,6 +267,8 @@ interface CannedResponseSearchOpts {
|
|
|
95
267
|
page: number;
|
|
96
268
|
pageSize: number;
|
|
97
269
|
q: string;
|
|
270
|
+
category?: string;
|
|
271
|
+
channel?: string;
|
|
98
272
|
[key: string]: unknown;
|
|
99
273
|
}
|
|
100
274
|
/**
|
|
@@ -119,7 +293,7 @@ declare function createCannedResponsesModule(options: CannedResponsesModuleOptio
|
|
|
119
293
|
*/
|
|
120
294
|
create(input: CreateCannedResponseInput): Promise<CannedResponseItem>;
|
|
121
295
|
/**
|
|
122
|
-
* Partially update a canned response — title,
|
|
296
|
+
* Partially update a canned response — title, shortcut, category, channel, and/or body.
|
|
123
297
|
* Calls PATCH /api/v1/canned-responses/:id.
|
|
124
298
|
*/
|
|
125
299
|
update(id: string, input: UpdateCannedResponseInput): Promise<CannedResponseItem>;
|
|
@@ -128,6 +302,11 @@ declare function createCannedResponsesModule(options: CannedResponsesModuleOptio
|
|
|
128
302
|
* Calls DELETE /api/v1/canned-responses/:id.
|
|
129
303
|
*/
|
|
130
304
|
delete(id: string): Promise<void>;
|
|
305
|
+
/**
|
|
306
|
+
* Duplicate a canned response. The server generates a unique title and
|
|
307
|
+
* shortcut. Calls POST /api/v1/canned-responses/:id/duplicate.
|
|
308
|
+
*/
|
|
309
|
+
duplicate(id: string): Promise<CannedResponseItem>;
|
|
131
310
|
};
|
|
132
311
|
/** Return type of createCannedResponsesModule. */
|
|
133
312
|
type CannedResponsesModule = ReturnType<typeof createCannedResponsesModule>;
|
|
@@ -566,12 +745,30 @@ interface PickupInput {
|
|
|
566
745
|
agentId: string;
|
|
567
746
|
[key: string]: unknown;
|
|
568
747
|
}
|
|
569
|
-
/**
|
|
748
|
+
/**
|
|
749
|
+
* Base conversation resource shape returned by the API. This is what
|
|
750
|
+
* reopenOrCreate/updateStatus/assign respond with — those routes mutate the
|
|
751
|
+
* conversation or its participants but do not re-derive ownerAgentIds, so it
|
|
752
|
+
* is intentionally absent here. Adding it as required on this type would be a
|
|
753
|
+
* false type guarantee for those three methods.
|
|
754
|
+
*/
|
|
570
755
|
interface ConversationItem {
|
|
571
756
|
id: string;
|
|
572
757
|
status: string;
|
|
573
758
|
[key: string]: unknown;
|
|
574
759
|
}
|
|
760
|
+
/**
|
|
761
|
+
* LIST/DETAIL conversation resource shape — the base item plus
|
|
762
|
+
* `ownerAgentIds`, the agentIds of the conversation's ACTIVE OWNER
|
|
763
|
+
* participants (role=OWNER, leftAt IS NULL), ordered by joinedAt then
|
|
764
|
+
* agentId. An empty array means the conversation is unassigned. Only the
|
|
765
|
+
* LIST (`list()`) and DETAIL (`get()`) responses populate this field (FF-A);
|
|
766
|
+
* ownership lives in ConversationParticipant after F10. Mirrors the API's own
|
|
767
|
+
* ConversationOwnershipResult split (apps/api/src/conversations/conversations.service.ts).
|
|
768
|
+
*/
|
|
769
|
+
interface ConversationListItem extends ConversationItem {
|
|
770
|
+
ownerAgentIds: string[];
|
|
771
|
+
}
|
|
575
772
|
/** Lobby entry resource shape returned by the API. */
|
|
576
773
|
interface LobbyEntry {
|
|
577
774
|
id: string;
|
|
@@ -632,7 +829,7 @@ declare function createConversationsModule(options: ConversationsModuleOptions):
|
|
|
632
829
|
* pageSize is clamped to 100 per the API contract.
|
|
633
830
|
* Calls GET /api/v1/conversations.
|
|
634
831
|
*/
|
|
635
|
-
list(opts?: ConversationListOpts): Promise<PagedList$3<
|
|
832
|
+
list(opts?: ConversationListOpts): Promise<PagedList$3<ConversationListItem>>;
|
|
636
833
|
/**
|
|
637
834
|
* Update a conversation status via the state machine.
|
|
638
835
|
* Calls PATCH /api/v1/conversations/:id/status.
|
|
@@ -653,7 +850,7 @@ declare function createConversationsModule(options: ConversationsModuleOptions):
|
|
|
653
850
|
* Get a single conversation by ID.
|
|
654
851
|
* Calls GET /api/v1/conversations/:id.
|
|
655
852
|
*/
|
|
656
|
-
get(id: string): Promise<
|
|
853
|
+
get(id: string): Promise<ConversationListItem>;
|
|
657
854
|
/**
|
|
658
855
|
* Pick up a lobby entry (atomic 4-step transaction).
|
|
659
856
|
* Returns the resulting conversation + entry ids.
|
|
@@ -1022,11 +1219,12 @@ declare function createTenantsModule(options: TenantsModuleOptions): {
|
|
|
1022
1219
|
type TenantsModule = ReturnType<typeof createTenantsModule>;
|
|
1023
1220
|
|
|
1024
1221
|
/**
|
|
1025
|
-
* WS-only event payload registry — single source of truth for the
|
|
1222
|
+
* WS-only event payload registry — single source of truth for the six
|
|
1026
1223
|
* WS-only events that have no REST/openapi counterpart and therefore no
|
|
1027
1224
|
* orval → _generated pipeline:
|
|
1028
1225
|
*
|
|
1029
|
-
* typing:indicator · message:read:update · participant:joined ·
|
|
1226
|
+
* typing:indicator · message:read:update · participant:joined ·
|
|
1227
|
+
* participant:left · participant:added · participant:removed
|
|
1030
1228
|
*
|
|
1031
1229
|
* The runtime constant {@link WS_EVENT_REGISTRY} must stay byte-identical with
|
|
1032
1230
|
* ws-event-shapes.fixture.json. Two contract tests enforce this:
|
|
@@ -1071,6 +1269,28 @@ interface ParticipantPayload {
|
|
|
1071
1269
|
actor: unknown;
|
|
1072
1270
|
[key: string]: unknown;
|
|
1073
1271
|
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Payload for the `participant:added` server → client event (F10/T08).
|
|
1274
|
+
* Emitted when an agent is added to a conversation's participant set — a
|
|
1275
|
+
* server-side membership mutation, distinct from the `participant:joined`
|
|
1276
|
+
* presence event.
|
|
1277
|
+
*/
|
|
1278
|
+
interface ParticipantAddedPayload {
|
|
1279
|
+
conversationId: string;
|
|
1280
|
+
agentId: string;
|
|
1281
|
+
role: string;
|
|
1282
|
+
[key: string]: unknown;
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Payload for the `participant:removed` server → client event (F10/T08).
|
|
1286
|
+
* Emitted when an agent is removed from a conversation's participant set; the
|
|
1287
|
+
* removed agent's sockets are also force-evicted from the room server-side.
|
|
1288
|
+
*/
|
|
1289
|
+
interface ParticipantRemovedPayload {
|
|
1290
|
+
conversationId: string;
|
|
1291
|
+
agentId: string;
|
|
1292
|
+
[key: string]: unknown;
|
|
1293
|
+
}
|
|
1074
1294
|
|
|
1075
1295
|
/**
|
|
1076
1296
|
* WebSocket client — hand-written typed wrapper over socket.io-client.
|
|
@@ -1144,6 +1364,8 @@ interface WsEventPayloads {
|
|
|
1144
1364
|
'message:read:update': MessageReadUpdatePayload;
|
|
1145
1365
|
'participant:joined': ParticipantPayload;
|
|
1146
1366
|
'participant:left': ParticipantPayload;
|
|
1367
|
+
'participant:added': ParticipantAddedPayload;
|
|
1368
|
+
'participant:removed': ParticipantRemovedPayload;
|
|
1147
1369
|
'typing:indicator': TypingIndicatorPayload;
|
|
1148
1370
|
}
|
|
1149
1371
|
/** The WebSocket client returned by {@link createWsClient}. */
|
|
@@ -1275,14 +1497,19 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1275
1497
|
};
|
|
1276
1498
|
conversations: {
|
|
1277
1499
|
reopenOrCreate(input: ReopenOrCreateInput): Promise<ConversationItem>;
|
|
1278
|
-
list(opts?: ConversationListOpts): Promise<PagedList$3<
|
|
1500
|
+
list(opts?: ConversationListOpts): Promise<PagedList$3<ConversationListItem>>;
|
|
1279
1501
|
updateStatus(id: string, input: UpdateStatusInput): Promise<ConversationItem>;
|
|
1280
1502
|
assign(id: string, input: AssignInput): Promise<ConversationItem>;
|
|
1281
1503
|
listLobby(opts?: LobbyListOpts): Promise<PagedList$3<LobbyEntry>>;
|
|
1282
|
-
get(id: string): Promise<
|
|
1504
|
+
get(id: string): Promise<ConversationListItem>;
|
|
1283
1505
|
pickup(entryId: string, input: PickupInput): Promise<PickupResult>;
|
|
1284
1506
|
whatsappRecoveryOptions(id: string): Promise<WhatsAppRecoveryOption[]>;
|
|
1285
1507
|
};
|
|
1508
|
+
participants: {
|
|
1509
|
+
add(conversationId: string, input: AddParticipantInput): Promise<ParticipantItem>;
|
|
1510
|
+
remove(conversationId: string, agentId: string): Promise<RemoveParticipantResult>;
|
|
1511
|
+
list(conversationId: string): Promise<ParticipantItem[]>;
|
|
1512
|
+
};
|
|
1286
1513
|
messages: {
|
|
1287
1514
|
send(input: SendMessageInput): Promise<MessageItem>;
|
|
1288
1515
|
list(opts: MessageListOpts): Promise<PagedList$4<MessageItem>>;
|
|
@@ -1314,6 +1541,7 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1314
1541
|
create(input: CreateCannedResponseInput): Promise<CannedResponseItem>;
|
|
1315
1542
|
update(id: string, input: UpdateCannedResponseInput): Promise<CannedResponseItem>;
|
|
1316
1543
|
delete(id: string): Promise<void>;
|
|
1544
|
+
duplicate(id: string): Promise<CannedResponseItem>;
|
|
1317
1545
|
};
|
|
1318
1546
|
attachments: {
|
|
1319
1547
|
upload(file: Blob | Uint8Array, _opts?: Record<string, unknown>): Promise<AttachmentUploadResult>;
|
|
@@ -1327,6 +1555,13 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1327
1555
|
name: string;
|
|
1328
1556
|
}): Promise<WhatsAppBusinessAccountItem>;
|
|
1329
1557
|
};
|
|
1558
|
+
dashboard: {
|
|
1559
|
+
stats(): Promise<DashboardStats>;
|
|
1560
|
+
recentActivity(opts?: RecentActivityListOpts): Promise<PagedList$6<RecentActivityItem>>;
|
|
1561
|
+
};
|
|
1562
|
+
audit: {
|
|
1563
|
+
list(opts?: AuditListOpts): Promise<PagedList$7<AuditEntry>>;
|
|
1564
|
+
};
|
|
1330
1565
|
/**
|
|
1331
1566
|
* Creates a WebSocket client connected to the `/ws/chat` namespace.
|
|
1332
1567
|
*
|
|
@@ -1622,6 +1857,76 @@ declare function createChannelsModule(options: ChannelsModuleOptions): {
|
|
|
1622
1857
|
/** Return type of createChannelsModule. */
|
|
1623
1858
|
type ChannelsModule = ReturnType<typeof createChannelsModule>;
|
|
1624
1859
|
|
|
1860
|
+
/**
|
|
1861
|
+
* Conversation participants module — hand-written typed wrapper over the
|
|
1862
|
+
* generated client (F10/T09).
|
|
1863
|
+
*
|
|
1864
|
+
* Exposes the participant-management surface for the conversations resource:
|
|
1865
|
+
* - add(conversationId, input) → POST /api/v1/conversations/:id/participants
|
|
1866
|
+
* - remove(conversationId, agentId) → DELETE /api/v1/conversations/:id/participants/:agentId
|
|
1867
|
+
* - list(conversationId) → GET /api/v1/conversations/:id/participants
|
|
1868
|
+
*
|
|
1869
|
+
* All three routes are guarded server-side by CASL abilities (grant for
|
|
1870
|
+
* add/remove, read for list) — a 403 surfaces as an {@link OmnivoxRequestError}
|
|
1871
|
+
* with `status === 403` like any other rejected request.
|
|
1872
|
+
*
|
|
1873
|
+
* Never re-exports symbols from _generated/.
|
|
1874
|
+
* Contains no business logic — typed transport only.
|
|
1875
|
+
*/
|
|
1876
|
+
|
|
1877
|
+
/** Options to construct the participants module. */
|
|
1878
|
+
interface ParticipantsModuleOptions extends TokenProvider {
|
|
1879
|
+
/** Base URL of the Omnivox API (e.g. "https://api.omnivox.io"). */
|
|
1880
|
+
baseUrl: string;
|
|
1881
|
+
}
|
|
1882
|
+
/** A conversation participant's per-conversation role. */
|
|
1883
|
+
type ParticipantRole = 'OWNER' | 'AGENT' | 'VIEWER';
|
|
1884
|
+
/** Input for adding (or re-adding) a participant. */
|
|
1885
|
+
interface AddParticipantInput {
|
|
1886
|
+
agentId: string;
|
|
1887
|
+
role: ParticipantRole;
|
|
1888
|
+
[key: string]: unknown;
|
|
1889
|
+
}
|
|
1890
|
+
/** Participant resource shape returned by the API (no tenantId leak). */
|
|
1891
|
+
interface ParticipantItem {
|
|
1892
|
+
id: string;
|
|
1893
|
+
conversationId: string;
|
|
1894
|
+
agentId: string;
|
|
1895
|
+
role: ParticipantRole;
|
|
1896
|
+
joinedAt: string;
|
|
1897
|
+
leftAt: string | null;
|
|
1898
|
+
[key: string]: unknown;
|
|
1899
|
+
}
|
|
1900
|
+
/** Result of removing a participant — the number of memberships ended (0 or 1). */
|
|
1901
|
+
interface RemoveParticipantResult {
|
|
1902
|
+
removed: number;
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Creates the participants module — a thin typed wrapper over the generated client.
|
|
1906
|
+
*/
|
|
1907
|
+
declare function createParticipantsModule(options: ParticipantsModuleOptions): {
|
|
1908
|
+
/**
|
|
1909
|
+
* Add (or re-add) an agent as a conversation participant with a role.
|
|
1910
|
+
* Idempotent per active membership — re-adding an active participant
|
|
1911
|
+
* updates its role; a second OWNER co-owns (no demotion of other owners).
|
|
1912
|
+
* Calls POST /api/v1/conversations/:id/participants.
|
|
1913
|
+
*/
|
|
1914
|
+
add(conversationId: string, input: AddParticipantInput): Promise<ParticipantItem>;
|
|
1915
|
+
/**
|
|
1916
|
+
* End an active membership for an agent. Idempotent — removing a
|
|
1917
|
+
* non-participant is a no-op ({ removed: 0 }).
|
|
1918
|
+
* Calls DELETE /api/v1/conversations/:id/participants/:agentId.
|
|
1919
|
+
*/
|
|
1920
|
+
remove(conversationId: string, agentId: string): Promise<RemoveParticipantResult>;
|
|
1921
|
+
/**
|
|
1922
|
+
* List the ACTIVE (leftAt IS NULL) participants of a conversation.
|
|
1923
|
+
* Calls GET /api/v1/conversations/:id/participants.
|
|
1924
|
+
*/
|
|
1925
|
+
list(conversationId: string): Promise<ParticipantItem[]>;
|
|
1926
|
+
};
|
|
1927
|
+
/** Return type of createParticipantsModule. */
|
|
1928
|
+
type ParticipantsModule = ReturnType<typeof createParticipantsModule>;
|
|
1929
|
+
|
|
1625
1930
|
/**
|
|
1626
1931
|
* Attachments module — hand-written typed wrapper over the generated client.
|
|
1627
1932
|
*
|
|
@@ -1790,4 +2095,4 @@ declare function createWhatsAppBusinessAccountsModule(options: WhatsAppBusinessA
|
|
|
1790
2095
|
/** Return type of createWhatsAppBusinessAccountsModule. */
|
|
1791
2096
|
type WhatsAppBusinessAccountsModule = ReturnType<typeof createWhatsAppBusinessAccountsModule>;
|
|
1792
2097
|
|
|
1793
|
-
export { type AddIdentityInput, type AgentItem, type AgentsModule, type AgentsModuleOptions, type ApiKeyItem, type AssignInput, type AttachmentUploadResult, type AttachmentUrlResult, type AttachmentsModule, type AttachmentsModuleOptions, type AuthMeAgent, type AuthMeModule, type AuthMeModuleOptions, type AuthMeResponse, type AuthMeTenant, type AuthorDraftInput, type BasicEmailChannelConfig, type BasicEmailChannelSecret, type CannedResponseItem, type CannedResponseListOpts, type CannedResponseSearchOpts, type CannedResponsesModule, type CannedResponsesModuleOptions, type Channel, type ChannelListItem, type ChannelStatus, type ChannelType, type ChannelsModule, type ChannelsModuleOptions, type ContactChannel, type ContactConversationSummary, type ContactFieldDefinition, type ContactFieldValue, type ContactFieldValueInput, type ContactIdentity, type ContactIdentityInput, type ContactItem, type ContactSearchOpts, type ContactTag, type ContactsMetadata, type ContactsModule, type ContactsModuleOptions, type ConversationItem, type ConversationListOpts, type ConversationsModule, type ConversationsModuleOptions, type CreateAgentInput, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCannedResponseInput, type CreateChannelBody, type CreateContactInput, type CreateEmailChannelBody, type CreateEmailTemplateInput, type CreateWhatsAppBusinessAccountBody, type CreateWhatsAppChannelBody, type CredentialsMode, type EmailChannelConfig, type EmailChannelSecret, type EmailImapConfig, type EmailSmtpConfig, type EmailTemplateItem, type EmailTemplateListOpts, type ImportApprovedResult, type ImportedTemplateResult, type LobbyEntry, type LobbyListOpts, type MessageItem, type MessageListOpts, type MessageReadUpdatePayload, type MessageStatusPayload, type MessagesModule, type MessagesModuleOptions, type OAuth2CertificateEmailChannelSecret, type OAuth2ClientSecretEmailChannelSecret, type OAuth2EmailChannelConfig, type OAuth2EmailChannelSecret, type OmnivoxClient, type OmnivoxClientOptions, OmnivoxRequestError, type PageOpts, type PageParams, type PagedResponse, type ParticipantPayload, type PatchContactInput, type PatchEmailTemplateInput, type PickupInput, type ReopenOrCreateInput, type RevokeApiKeyResponse, type SendMessageInput, type SendTemplateInput, type SubmitResult, type TemplatesModule, type TemplatesModuleOptions, type TenantsModule, type TenantsModuleOptions, type TokenProvider, type TypingIndicatorPayload, type UpdateCannedResponseInput, type UpdateChannelBody, type UpdateStatusInput, type UpdateWhatsAppTemplateInput, type WhatsAppBusinessAccountItem, type WhatsAppBusinessAccountsModule, type WhatsAppBusinessAccountsModuleOptions, type WhatsAppChannelConfig, type WhatsAppRecoveryOption, type WhatsAppTemplateDetail, type WhatsAppTemplateHistory, type WhatsAppTemplateHistoryEvent, type WhatsAppTemplateHistoryVersion, type WhatsAppTemplateItem, type WhatsAppTemplateListOpts, type WsAuth, type WsClient, type WsClientInstance, type WsClientOptions, type WsConnectionState, type WsEventPayloads, buildPageParams, createAgentsModule, createApiKeyTokenProvider, createAttachmentsModule, createAuthMeModule, createCannedResponsesModule, createChannelsModule, createContactsModule, createConversationsModule, createMessagesModule, createOmnivoxClient, createSessionTokenProvider, createTemplatesModule, createTenantsModule, createWhatsAppBusinessAccountsModule, createWsClient, iteratePages };
|
|
2098
|
+
export { type AddIdentityInput, type AddParticipantInput, type AgentItem, type AgentsModule, type AgentsModuleOptions, type ApiKeyItem, type AssignInput, type AttachmentUploadResult, type AttachmentUrlResult, type AttachmentsModule, type AttachmentsModuleOptions, type AuditEntry, type AuditListOpts, type AuditModule, type AuditModuleOptions, type AuthMeAgent, type AuthMeModule, type AuthMeModuleOptions, type AuthMeResponse, type AuthMeTenant, type AuthorDraftInput, type BasicEmailChannelConfig, type BasicEmailChannelSecret, type CannedResponseItem, type CannedResponseListOpts, type CannedResponseSearchOpts, type CannedResponsesModule, type CannedResponsesModuleOptions, type Channel, type ChannelListItem, type ChannelStatus, type ChannelType, type ChannelsModule, type ChannelsModuleOptions, type ContactChannel, type ContactConversationSummary, type ContactFieldDefinition, type ContactFieldValue, type ContactFieldValueInput, type ContactIdentity, type ContactIdentityInput, type ContactItem, type ContactSearchOpts, type ContactTag, type ContactsMetadata, type ContactsModule, type ContactsModuleOptions, type ConversationItem, type ConversationListItem, type ConversationListOpts, type ConversationsModule, type ConversationsModuleOptions, type CreateAgentInput, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCannedResponseInput, type CreateChannelBody, type CreateContactInput, type CreateEmailChannelBody, type CreateEmailTemplateInput, type CreateWhatsAppBusinessAccountBody, type CreateWhatsAppChannelBody, type CredentialsMode, type DashboardModule, type DashboardModuleOptions, type DashboardStats, type EmailChannelConfig, type EmailChannelSecret, type EmailImapConfig, type EmailSmtpConfig, type EmailTemplateItem, type EmailTemplateListOpts, type ImportApprovedResult, type ImportedTemplateResult, type LobbyEntry, type LobbyListOpts, type MessageItem, type MessageListOpts, type MessageReadUpdatePayload, type MessageStatusPayload, type MessagesModule, type MessagesModuleOptions, type OAuth2CertificateEmailChannelSecret, type OAuth2ClientSecretEmailChannelSecret, type OAuth2EmailChannelConfig, type OAuth2EmailChannelSecret, type OmnivoxClient, type OmnivoxClientOptions, OmnivoxRequestError, type PageOpts, type PageParams, type PagedResponse, type ParticipantAddedPayload, type ParticipantItem, type ParticipantPayload, type ParticipantRemovedPayload, type ParticipantRole, type ParticipantsModule, type ParticipantsModuleOptions, type PatchContactInput, type PatchEmailTemplateInput, type PickupInput, type RecentActivityItem, type RecentActivityListOpts, type RemoveParticipantResult, type ReopenOrCreateInput, type RevokeApiKeyResponse, type SendMessageInput, type SendTemplateInput, type SubmitResult, type TemplatesModule, type TemplatesModuleOptions, type TenantsModule, type TenantsModuleOptions, type TokenProvider, type TypingIndicatorPayload, type UpdateCannedResponseInput, type UpdateChannelBody, type UpdateStatusInput, type UpdateWhatsAppTemplateInput, type WhatsAppBusinessAccountItem, type WhatsAppBusinessAccountsModule, type WhatsAppBusinessAccountsModuleOptions, type WhatsAppChannelConfig, type WhatsAppRecoveryOption, type WhatsAppTemplateDetail, type WhatsAppTemplateHistory, type WhatsAppTemplateHistoryEvent, type WhatsAppTemplateHistoryVersion, type WhatsAppTemplateItem, type WhatsAppTemplateListOpts, type WsAuth, type WsClient, type WsClientInstance, type WsClientOptions, type WsConnectionState, type WsEventPayloads, buildPageParams, createAgentsModule, createApiKeyTokenProvider, createAttachmentsModule, createAuditModule, createAuthMeModule, createCannedResponsesModule, createChannelsModule, createContactsModule, createConversationsModule, createDashboardModule, createMessagesModule, createOmnivoxClient, createParticipantsModule, createSessionTokenProvider, createTemplatesModule, createTenantsModule, createWhatsAppBusinessAccountsModule, createWsClient, iteratePages };
|