@inkbox/sdk 0.1.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/README.md +369 -0
- package/dist/_http.d.ts +24 -0
- package/dist/_http.d.ts.map +1 -0
- package/dist/_http.js +90 -0
- package/dist/_http.js.map +1 -0
- package/dist/agent_identity.d.ts +184 -0
- package/dist/agent_identity.d.ts.map +1 -0
- package/dist/agent_identity.js +262 -0
- package/dist/agent_identity.js.map +1 -0
- package/dist/identities/resources/identities.d.ts +80 -0
- package/dist/identities/resources/identities.d.ts.map +1 -0
- package/dist/identities/resources/identities.js +103 -0
- package/dist/identities/resources/identities.js.map +1 -0
- package/dist/identities/types.d.ts +77 -0
- package/dist/identities/types.d.ts.map +1 -0
- package/dist/identities/types.js +44 -0
- package/dist/identities/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/inkbox.d.ts +92 -0
- package/dist/inkbox.d.ts.map +1 -0
- package/dist/inkbox.js +117 -0
- package/dist/inkbox.js.map +1 -0
- package/dist/mail/resources/mailboxes.d.ts +61 -0
- package/dist/mail/resources/mailboxes.d.ts.map +1 -0
- package/dist/mail/resources/mailboxes.js +83 -0
- package/dist/mail/resources/mailboxes.js.map +1 -0
- package/dist/mail/resources/messages.d.ts +100 -0
- package/dist/mail/resources/messages.d.ts.map +1 -0
- package/dist/mail/resources/messages.js +141 -0
- package/dist/mail/resources/messages.js.map +1 -0
- package/dist/mail/resources/threads.d.ts +36 -0
- package/dist/mail/resources/threads.d.ts.map +1 -0
- package/dist/mail/resources/threads.js +53 -0
- package/dist/mail/resources/threads.js.map +1 -0
- package/dist/mail/types.d.ts +113 -0
- package/dist/mail/types.d.ts.map +1 -0
- package/dist/mail/types.js +65 -0
- package/dist/mail/types.js.map +1 -0
- package/dist/phone/resources/calls.d.ts +45 -0
- package/dist/phone/resources/calls.d.ts.map +1 -0
- package/dist/phone/resources/calls.js +57 -0
- package/dist/phone/resources/calls.js.map +1 -0
- package/dist/phone/resources/numbers.d.ts +61 -0
- package/dist/phone/resources/numbers.d.ts.map +1 -0
- package/dist/phone/resources/numbers.js +85 -0
- package/dist/phone/resources/numbers.js.map +1 -0
- package/dist/phone/resources/transcripts.d.ts +19 -0
- package/dist/phone/resources/transcripts.d.ts.map +1 -0
- package/dist/phone/resources/transcripts.js +23 -0
- package/dist/phone/resources/transcripts.js.map +1 -0
- package/dist/phone/types.d.ts +108 -0
- package/dist/phone/types.d.ts.map +1 -0
- package/dist/phone/types.js +62 -0
- package/dist/phone/types.js.map +1 -0
- package/dist/signing_keys.d.ts +40 -0
- package/dist/signing_keys.d.ts.map +1 -0
- package/dist/signing_keys.js +59 -0
- package/dist/signing_keys.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../../src/mail/resources/threads.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAGL,MAAM,EACN,YAAY,EAGb,MAAM,aAAa,CAAC;AAIrB,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;;;;;;;;;OAWG;IACI,IAAI,CACT,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9B,cAAc,CAAC,MAAM,CAAC;IAiBzB;;;;;OAKG;IACG,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAOxE,uBAAuB;IACjB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-mail/resources/threads.ts
|
|
3
|
+
*
|
|
4
|
+
* Thread operations: list (auto-paginated), get with messages, delete.
|
|
5
|
+
*/
|
|
6
|
+
import { parseThread, parseThreadDetail, } from "../types.js";
|
|
7
|
+
const DEFAULT_PAGE_SIZE = 50;
|
|
8
|
+
export class ThreadsResource {
|
|
9
|
+
http;
|
|
10
|
+
constructor(http) {
|
|
11
|
+
this.http = http;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Async iterator over all threads in a mailbox, most recent activity first.
|
|
15
|
+
*
|
|
16
|
+
* Pagination is handled automatically — just iterate.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* for await (const thread of client.threads.list(emailAddress)) {
|
|
21
|
+
* console.log(thread.subject, thread.messageCount);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async *list(emailAddress, options) {
|
|
26
|
+
const limit = options?.pageSize ?? DEFAULT_PAGE_SIZE;
|
|
27
|
+
let cursor;
|
|
28
|
+
while (true) {
|
|
29
|
+
const page = await this.http.get(`/mailboxes/${emailAddress}/threads`, { limit, cursor });
|
|
30
|
+
for (const item of page.items) {
|
|
31
|
+
yield parseThread(item);
|
|
32
|
+
}
|
|
33
|
+
if (!page.has_more)
|
|
34
|
+
break;
|
|
35
|
+
cursor = page.next_cursor ?? undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get a thread with all its messages inlined.
|
|
40
|
+
*
|
|
41
|
+
* @param emailAddress - Full email address of the owning mailbox.
|
|
42
|
+
* @param threadId - UUID of the thread.
|
|
43
|
+
*/
|
|
44
|
+
async get(emailAddress, threadId) {
|
|
45
|
+
const data = await this.http.get(`/mailboxes/${emailAddress}/threads/${threadId}`);
|
|
46
|
+
return parseThreadDetail(data);
|
|
47
|
+
}
|
|
48
|
+
/** Delete a thread. */
|
|
49
|
+
async delete(emailAddress, threadId) {
|
|
50
|
+
await this.http.delete(`/mailboxes/${emailAddress}/threads/${threadId}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=threads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threads.js","sourceRoot":"","sources":["../../../src/mail/resources/threads.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAKL,WAAW,EACX,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,CAAC,IAAI,CACT,YAAoB,EACpB,OAA+B;QAE/B,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC;QACrD,IAAI,MAA0B,CAAC;QAE/B,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9B,cAAc,YAAY,UAAU,EACpC,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;YACF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC9B,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAAE,MAAM;YAC1B,MAAM,GAAG,IAAI,CAAC,WAAW,IAAI,SAAS,CAAC;QACzC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CAAC,YAAoB,EAAE,QAAgB;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9B,cAAc,YAAY,YAAY,QAAQ,EAAE,CACjD,CAAC;QACF,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,uBAAuB;IACvB,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,QAAgB;QACjD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,YAAY,YAAY,QAAQ,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-mail TypeScript SDK — public types.
|
|
3
|
+
*/
|
|
4
|
+
export interface Mailbox {
|
|
5
|
+
id: string;
|
|
6
|
+
emailAddress: string;
|
|
7
|
+
displayName: string | null;
|
|
8
|
+
webhookUrl: string | null;
|
|
9
|
+
/** "active" | "paused" | "deleted" */
|
|
10
|
+
status: string;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
export interface Message {
|
|
15
|
+
id: string;
|
|
16
|
+
mailboxId: string;
|
|
17
|
+
threadId: string | null;
|
|
18
|
+
/** RFC 5322 Message-ID header value */
|
|
19
|
+
messageId: string;
|
|
20
|
+
fromAddress: string;
|
|
21
|
+
toAddresses: string[];
|
|
22
|
+
ccAddresses: string[] | null;
|
|
23
|
+
subject: string | null;
|
|
24
|
+
/** First ~200 characters of the plain-text body */
|
|
25
|
+
snippet: string | null;
|
|
26
|
+
direction: "inbound" | "outbound";
|
|
27
|
+
status: string;
|
|
28
|
+
isRead: boolean;
|
|
29
|
+
isStarred: boolean;
|
|
30
|
+
hasAttachments: boolean;
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
}
|
|
33
|
+
export interface MessageDetail extends Message {
|
|
34
|
+
bodyText: string | null;
|
|
35
|
+
bodyHtml: string | null;
|
|
36
|
+
bccAddresses: string[] | null;
|
|
37
|
+
/** RFC 5322 In-Reply-To header value */
|
|
38
|
+
inReplyTo: string | null;
|
|
39
|
+
/** RFC 5322 References header values */
|
|
40
|
+
references: string[] | null;
|
|
41
|
+
attachmentMetadata: Record<string, unknown>[] | null;
|
|
42
|
+
sesMessageId: string | null;
|
|
43
|
+
updatedAt: Date;
|
|
44
|
+
}
|
|
45
|
+
export interface Thread {
|
|
46
|
+
id: string;
|
|
47
|
+
mailboxId: string;
|
|
48
|
+
subject: string | null;
|
|
49
|
+
/** "active" | "paused" | "deleted" */
|
|
50
|
+
status: string;
|
|
51
|
+
messageCount: number;
|
|
52
|
+
lastMessageAt: Date;
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
}
|
|
55
|
+
export interface ThreadDetail extends Thread {
|
|
56
|
+
/** All messages in the thread, oldest-first */
|
|
57
|
+
messages: Message[];
|
|
58
|
+
}
|
|
59
|
+
export interface RawMailbox {
|
|
60
|
+
id: string;
|
|
61
|
+
email_address: string;
|
|
62
|
+
display_name: string | null;
|
|
63
|
+
webhook_url: string | null;
|
|
64
|
+
status: string;
|
|
65
|
+
created_at: string;
|
|
66
|
+
updated_at: string;
|
|
67
|
+
}
|
|
68
|
+
export interface RawMessage {
|
|
69
|
+
id: string;
|
|
70
|
+
mailbox_id: string;
|
|
71
|
+
thread_id: string | null;
|
|
72
|
+
message_id: string;
|
|
73
|
+
from_address: string;
|
|
74
|
+
to_addresses: string[];
|
|
75
|
+
cc_addresses: string[] | null;
|
|
76
|
+
subject: string | null;
|
|
77
|
+
snippet: string | null;
|
|
78
|
+
direction: string;
|
|
79
|
+
status: string;
|
|
80
|
+
is_read: boolean;
|
|
81
|
+
is_starred: boolean;
|
|
82
|
+
has_attachments: boolean;
|
|
83
|
+
created_at: string;
|
|
84
|
+
body_text?: string | null;
|
|
85
|
+
body_html?: string | null;
|
|
86
|
+
bcc_addresses?: string[] | null;
|
|
87
|
+
in_reply_to?: string | null;
|
|
88
|
+
references?: string[] | null;
|
|
89
|
+
attachment_metadata?: Record<string, unknown>[] | null;
|
|
90
|
+
ses_message_id?: string | null;
|
|
91
|
+
updated_at?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface RawThread {
|
|
94
|
+
id: string;
|
|
95
|
+
mailbox_id: string;
|
|
96
|
+
subject: string | null;
|
|
97
|
+
status: string;
|
|
98
|
+
message_count: number;
|
|
99
|
+
last_message_at: string;
|
|
100
|
+
created_at: string;
|
|
101
|
+
messages?: RawMessage[];
|
|
102
|
+
}
|
|
103
|
+
export interface RawCursorPage<T> {
|
|
104
|
+
items: T[];
|
|
105
|
+
next_cursor: string | null;
|
|
106
|
+
has_more: boolean;
|
|
107
|
+
}
|
|
108
|
+
export declare function parseMailbox(r: RawMailbox): Mailbox;
|
|
109
|
+
export declare function parseMessage(r: RawMessage): Message;
|
|
110
|
+
export declare function parseMessageDetail(r: RawMessage): MessageDetail;
|
|
111
|
+
export declare function parseThread(r: RawThread): Thread;
|
|
112
|
+
export declare function parseThreadDetail(r: RawThread): ThreadDetail;
|
|
113
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mail/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC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IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAUnD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAkBnD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,UAAU,GAAG,aAAa,CAY/D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAUhD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,GAAG,YAAY,CAK5D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-mail TypeScript SDK — public types.
|
|
3
|
+
*/
|
|
4
|
+
// ---- parsers ----
|
|
5
|
+
export function parseMailbox(r) {
|
|
6
|
+
return {
|
|
7
|
+
id: r.id,
|
|
8
|
+
emailAddress: r.email_address,
|
|
9
|
+
displayName: r.display_name,
|
|
10
|
+
webhookUrl: r.webhook_url,
|
|
11
|
+
status: r.status,
|
|
12
|
+
createdAt: new Date(r.created_at),
|
|
13
|
+
updatedAt: new Date(r.updated_at),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function parseMessage(r) {
|
|
17
|
+
return {
|
|
18
|
+
id: r.id,
|
|
19
|
+
mailboxId: r.mailbox_id,
|
|
20
|
+
threadId: r.thread_id,
|
|
21
|
+
messageId: r.message_id,
|
|
22
|
+
fromAddress: r.from_address,
|
|
23
|
+
toAddresses: r.to_addresses,
|
|
24
|
+
ccAddresses: r.cc_addresses ?? null,
|
|
25
|
+
subject: r.subject,
|
|
26
|
+
snippet: r.snippet,
|
|
27
|
+
direction: r.direction,
|
|
28
|
+
status: r.status,
|
|
29
|
+
isRead: r.is_read,
|
|
30
|
+
isStarred: r.is_starred,
|
|
31
|
+
hasAttachments: r.has_attachments,
|
|
32
|
+
createdAt: new Date(r.created_at),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function parseMessageDetail(r) {
|
|
36
|
+
return {
|
|
37
|
+
...parseMessage(r),
|
|
38
|
+
bodyText: r.body_text ?? null,
|
|
39
|
+
bodyHtml: r.body_html ?? null,
|
|
40
|
+
bccAddresses: r.bcc_addresses ?? null,
|
|
41
|
+
inReplyTo: r.in_reply_to ?? null,
|
|
42
|
+
references: r.references ?? null,
|
|
43
|
+
attachmentMetadata: r.attachment_metadata ?? null,
|
|
44
|
+
sesMessageId: r.ses_message_id ?? null,
|
|
45
|
+
updatedAt: new Date(r.updated_at),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function parseThread(r) {
|
|
49
|
+
return {
|
|
50
|
+
id: r.id,
|
|
51
|
+
mailboxId: r.mailbox_id,
|
|
52
|
+
subject: r.subject,
|
|
53
|
+
status: r.status,
|
|
54
|
+
messageCount: r.message_count,
|
|
55
|
+
lastMessageAt: new Date(r.last_message_at),
|
|
56
|
+
createdAt: new Date(r.created_at),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function parseThreadDetail(r) {
|
|
60
|
+
return {
|
|
61
|
+
...parseThread(r),
|
|
62
|
+
messages: (r.messages ?? []).map(parseMessage),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mail/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsHH,oBAAoB;AAEpB,MAAM,UAAU,YAAY,CAAC,CA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SAAS,EAAE,CAAC,CAAC,WAAW,IAAI,IAAI;QAChC,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,IAAI;QAChC,kBAAkB,EAAE,CAAC,CAAC,mBAAmB,IAAI,IAAI;QACjD,YAAY,EAAE,CAAC,CAAC,cAAc,IAAI,IAAI;QACtC,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAW,CAAC;KACnC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAY;IACtC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,SAAS,EAAE,CAAC,CAAC,UAAU;QACvB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,YAAY,EAAE,CAAC,CAAC,aAAa;QAC7B,aAAa,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC;QAC1C,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,CAAY;IAC5C,OAAO;QACL,GAAG,WAAW,CAAC,CAAC,CAAC;QACjB,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;KAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-phone/resources/calls.ts
|
|
3
|
+
*
|
|
4
|
+
* Call operations: list, get, place.
|
|
5
|
+
*/
|
|
6
|
+
import { HttpTransport } from "../../_http.js";
|
|
7
|
+
import { PhoneCall, PhoneCallWithRateLimit } from "../types.js";
|
|
8
|
+
export declare class CallsResource {
|
|
9
|
+
private readonly http;
|
|
10
|
+
constructor(http: HttpTransport);
|
|
11
|
+
/**
|
|
12
|
+
* List calls for a phone number, newest first.
|
|
13
|
+
*
|
|
14
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
15
|
+
* @param options.limit - Max results (1–200). Defaults to 50.
|
|
16
|
+
* @param options.offset - Pagination offset. Defaults to 0.
|
|
17
|
+
*/
|
|
18
|
+
list(phoneNumberId: string, options?: {
|
|
19
|
+
limit?: number;
|
|
20
|
+
offset?: number;
|
|
21
|
+
}): Promise<PhoneCall[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a single call by ID.
|
|
24
|
+
*
|
|
25
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
26
|
+
* @param callId - UUID of the call.
|
|
27
|
+
*/
|
|
28
|
+
get(phoneNumberId: string, callId: string): Promise<PhoneCall>;
|
|
29
|
+
/**
|
|
30
|
+
* Place an outbound call.
|
|
31
|
+
*
|
|
32
|
+
* @param options.fromNumber - E.164 number to call from. Must belong to your org and be active.
|
|
33
|
+
* @param options.toNumber - E.164 number to call.
|
|
34
|
+
* @param options.clientWebsocketUrl - WebSocket URL (wss://) for audio bridging.
|
|
35
|
+
* @param options.webhookUrl - Custom webhook URL for call lifecycle events.
|
|
36
|
+
* @returns The created call record with current rate limit info.
|
|
37
|
+
*/
|
|
38
|
+
place(options: {
|
|
39
|
+
fromNumber: string;
|
|
40
|
+
toNumber: string;
|
|
41
|
+
clientWebsocketUrl?: string;
|
|
42
|
+
webhookUrl?: string;
|
|
43
|
+
}): Promise<PhoneCallWithRateLimit>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../src/phone/resources/calls.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,sBAAsB,EAKvB,MAAM,aAAa,CAAC;AAErB,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;;;;OAMG;IACG,IAAI,CACR,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5C,OAAO,CAAC,SAAS,EAAE,CAAC;IAQvB;;;;;OAKG;IACG,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAOpE;;;;;;;;OAQG;IACG,KAAK,CAAC,OAAO,EAAE;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAcpC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-phone/resources/calls.ts
|
|
3
|
+
*
|
|
4
|
+
* Call operations: list, get, place.
|
|
5
|
+
*/
|
|
6
|
+
import { parsePhoneCall, parsePhoneCallWithRateLimit, } from "../types.js";
|
|
7
|
+
export class CallsResource {
|
|
8
|
+
http;
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List calls for a phone number, newest first.
|
|
14
|
+
*
|
|
15
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
16
|
+
* @param options.limit - Max results (1–200). Defaults to 50.
|
|
17
|
+
* @param options.offset - Pagination offset. Defaults to 0.
|
|
18
|
+
*/
|
|
19
|
+
async list(phoneNumberId, options) {
|
|
20
|
+
const data = await this.http.get(`/numbers/${phoneNumberId}/calls`, { limit: options?.limit ?? 50, offset: options?.offset ?? 0 });
|
|
21
|
+
return data.map(parsePhoneCall);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get a single call by ID.
|
|
25
|
+
*
|
|
26
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
27
|
+
* @param callId - UUID of the call.
|
|
28
|
+
*/
|
|
29
|
+
async get(phoneNumberId, callId) {
|
|
30
|
+
const data = await this.http.get(`/numbers/${phoneNumberId}/calls/${callId}`);
|
|
31
|
+
return parsePhoneCall(data);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Place an outbound call.
|
|
35
|
+
*
|
|
36
|
+
* @param options.fromNumber - E.164 number to call from. Must belong to your org and be active.
|
|
37
|
+
* @param options.toNumber - E.164 number to call.
|
|
38
|
+
* @param options.clientWebsocketUrl - WebSocket URL (wss://) for audio bridging.
|
|
39
|
+
* @param options.webhookUrl - Custom webhook URL for call lifecycle events.
|
|
40
|
+
* @returns The created call record with current rate limit info.
|
|
41
|
+
*/
|
|
42
|
+
async place(options) {
|
|
43
|
+
const body = {
|
|
44
|
+
from_number: options.fromNumber,
|
|
45
|
+
to_number: options.toNumber,
|
|
46
|
+
};
|
|
47
|
+
if (options.clientWebsocketUrl !== undefined) {
|
|
48
|
+
body["client_websocket_url"] = options.clientWebsocketUrl;
|
|
49
|
+
}
|
|
50
|
+
if (options.webhookUrl !== undefined) {
|
|
51
|
+
body["webhook_url"] = options.webhookUrl;
|
|
52
|
+
}
|
|
53
|
+
const data = await this.http.post("/place-call", body);
|
|
54
|
+
return parsePhoneCallWithRateLimit(data);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.js","sourceRoot":"","sources":["../../../src/phone/resources/calls.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAKL,cAAc,EACd,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,aAAa;IACK;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,CAC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isioning, release, and transcript search.
|
|
5
|
+
*/
|
|
6
|
+
import { HttpTransport } from "../../_http.js";
|
|
7
|
+
import { PhoneNumber, PhoneTranscript } from "../types.js";
|
|
8
|
+
export declare class PhoneNumbersResource {
|
|
9
|
+
private readonly http;
|
|
10
|
+
constructor(http: HttpTransport);
|
|
11
|
+
/** List all phone numbers for your organisation. */
|
|
12
|
+
list(): Promise<PhoneNumber[]>;
|
|
13
|
+
/** Get a phone number by ID. */
|
|
14
|
+
get(phoneNumberId: string): Promise<PhoneNumber>;
|
|
15
|
+
/**
|
|
16
|
+
* Update phone number settings. Only provided fields are updated.
|
|
17
|
+
* Pass a field as `null` to clear it.
|
|
18
|
+
*
|
|
19
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
20
|
+
* @param options.incomingCallAction - `"auto_accept"`, `"auto_reject"`, or `"webhook"`.
|
|
21
|
+
* @param options.clientWebsocketUrl - WebSocket URL (wss://) for audio bridging.
|
|
22
|
+
* @param options.incomingCallWebhookUrl - Webhook URL called for incoming calls when action is `"webhook"`.
|
|
23
|
+
*/
|
|
24
|
+
update(phoneNumberId: string, options: {
|
|
25
|
+
incomingCallAction?: string;
|
|
26
|
+
clientWebsocketUrl?: string | null;
|
|
27
|
+
incomingCallWebhookUrl?: string | null;
|
|
28
|
+
}): Promise<PhoneNumber>;
|
|
29
|
+
/**
|
|
30
|
+
* Provision a new phone number and link it to an agent identity.
|
|
31
|
+
*
|
|
32
|
+
* @param options.agentHandle - Handle of the agent identity to assign this number to.
|
|
33
|
+
* @param options.type - `"toll_free"` or `"local"`. Defaults to `"toll_free"`.
|
|
34
|
+
* @param options.state - US state abbreviation (e.g. `"NY"`). Only valid for `local` numbers.
|
|
35
|
+
*/
|
|
36
|
+
provision(options: {
|
|
37
|
+
agentHandle: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
state?: string;
|
|
40
|
+
}): Promise<PhoneNumber>;
|
|
41
|
+
/**
|
|
42
|
+
* Release a phone number.
|
|
43
|
+
*
|
|
44
|
+
* @param phoneNumberId - UUID of the phone number to release.
|
|
45
|
+
*/
|
|
46
|
+
release(phoneNumberId: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Full-text search across transcripts for a phone number.
|
|
49
|
+
*
|
|
50
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
51
|
+
* @param options.q - Search query string.
|
|
52
|
+
* @param options.party - Filter by speaker: `"local"` or `"remote"`.
|
|
53
|
+
* @param options.limit - Maximum number of results (1–200). Defaults to 50.
|
|
54
|
+
*/
|
|
55
|
+
searchTranscripts(phoneNumberId: string, options: {
|
|
56
|
+
q: string;
|
|
57
|
+
party?: string;
|
|
58
|
+
limit?: number;
|
|
59
|
+
}): Promise<PhoneTranscript[]>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../../src/phone/resources/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,eAAe,EAKhB,MAAM,aAAa,CAAC;AAIrB,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD,oDAAoD;IAC9C,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAKpC,gCAAgC;IAC1B,GAAG,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAOtD;;;;;;;;OAQG;IACG,MAAM,CACV,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE;QACP,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACnC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxC,GACA,OAAO,CAAC,WAAW,CAAC;IAkBvB;;;;;;OAMG;IACG,SAAS,CAAC,OAAO,EAAE;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,WAAW,CAAC;IAYxB;;;;OAIG;IACG,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;;;;;;OAOG;IACG,iBAAiB,CACrB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GACrD,OAAO,CAAC,eAAe,EAAE,CAAC;CAO9B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-phone/resources/numbers.ts
|
|
3
|
+
*
|
|
4
|
+
* Phone number CRUD, provisioning, release, and transcript search.
|
|
5
|
+
*/
|
|
6
|
+
import { parsePhoneNumber, parsePhoneTranscript, } from "../types.js";
|
|
7
|
+
const BASE = "/numbers";
|
|
8
|
+
export class PhoneNumbersResource {
|
|
9
|
+
http;
|
|
10
|
+
constructor(http) {
|
|
11
|
+
this.http = http;
|
|
12
|
+
}
|
|
13
|
+
/** List all phone numbers for your organisation. */
|
|
14
|
+
async list() {
|
|
15
|
+
const data = await this.http.get(BASE);
|
|
16
|
+
return data.map(parsePhoneNumber);
|
|
17
|
+
}
|
|
18
|
+
/** Get a phone number by ID. */
|
|
19
|
+
async get(phoneNumberId) {
|
|
20
|
+
const data = await this.http.get(`${BASE}/${phoneNumberId}`);
|
|
21
|
+
return parsePhoneNumber(data);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Update phone number settings. Only provided fields are updated.
|
|
25
|
+
* Pass a field as `null` to clear it.
|
|
26
|
+
*
|
|
27
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
28
|
+
* @param options.incomingCallAction - `"auto_accept"`, `"auto_reject"`, or `"webhook"`.
|
|
29
|
+
* @param options.clientWebsocketUrl - WebSocket URL (wss://) for audio bridging.
|
|
30
|
+
* @param options.incomingCallWebhookUrl - Webhook URL called for incoming calls when action is `"webhook"`.
|
|
31
|
+
*/
|
|
32
|
+
async update(phoneNumberId, options) {
|
|
33
|
+
const body = {};
|
|
34
|
+
if (options.incomingCallAction !== undefined) {
|
|
35
|
+
body["incoming_call_action"] = options.incomingCallAction;
|
|
36
|
+
}
|
|
37
|
+
if ("clientWebsocketUrl" in options) {
|
|
38
|
+
body["client_websocket_url"] = options.clientWebsocketUrl;
|
|
39
|
+
}
|
|
40
|
+
if ("incomingCallWebhookUrl" in options) {
|
|
41
|
+
body["incoming_call_webhook_url"] = options.incomingCallWebhookUrl;
|
|
42
|
+
}
|
|
43
|
+
const data = await this.http.patch(`${BASE}/${phoneNumberId}`, body);
|
|
44
|
+
return parsePhoneNumber(data);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Provision a new phone number and link it to an agent identity.
|
|
48
|
+
*
|
|
49
|
+
* @param options.agentHandle - Handle of the agent identity to assign this number to.
|
|
50
|
+
* @param options.type - `"toll_free"` or `"local"`. Defaults to `"toll_free"`.
|
|
51
|
+
* @param options.state - US state abbreviation (e.g. `"NY"`). Only valid for `local` numbers.
|
|
52
|
+
*/
|
|
53
|
+
async provision(options) {
|
|
54
|
+
const body = {
|
|
55
|
+
agent_handle: options.agentHandle,
|
|
56
|
+
type: options.type ?? "toll_free",
|
|
57
|
+
};
|
|
58
|
+
if (options.state !== undefined) {
|
|
59
|
+
body["state"] = options.state;
|
|
60
|
+
}
|
|
61
|
+
const data = await this.http.post(BASE, body);
|
|
62
|
+
return parsePhoneNumber(data);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Release a phone number.
|
|
66
|
+
*
|
|
67
|
+
* @param phoneNumberId - UUID of the phone number to release.
|
|
68
|
+
*/
|
|
69
|
+
async release(phoneNumberId) {
|
|
70
|
+
await this.http.delete(`${BASE}/${phoneNumberId}`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Full-text search across transcripts for a phone number.
|
|
74
|
+
*
|
|
75
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
76
|
+
* @param options.q - Search query string.
|
|
77
|
+
* @param options.party - Filter by speaker: `"local"` or `"remote"`.
|
|
78
|
+
* @param options.limit - Maximum number of results (1–200). Defaults to 50.
|
|
79
|
+
*/
|
|
80
|
+
async searchTranscripts(phoneNumberId, options) {
|
|
81
|
+
const data = await this.http.get(`${BASE}/${phoneNumberId}/search`, { q: options.q, party: options.party, limit: options.limit ?? 50 });
|
|
82
|
+
return data.map(parsePhoneTranscript);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=numbers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../../src/phone/resources/numbers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAKL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,MAAM,IAAI,GAAG,UAAU,CAAC;AAExB,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,oDAAoD;IACpD,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmB,IAAI,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAED,gCAAgC;IAChC,KAAK,CAAC,GAAG,CAAC,aAAqB;QAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9B,GAAG,IAAI,IAAI,aAAa,EAAE,CAC3B,CAAC;QACF,OAAO,gBAA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MAAM,CAAC,GAAG,IAAI,IAAI,aAAa,EAAE,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CACrB,aAAqB,EACrB,OAAsD;QAEtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9B,GAAG,IAAI,IAAI,aAAa,SAAS,EACjC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,CACnE,CAAC;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-phone/resources/transcripts.ts
|
|
3
|
+
*
|
|
4
|
+
* Transcript retrieval.
|
|
5
|
+
*/
|
|
6
|
+
import { HttpTransport } from "../../_http.js";
|
|
7
|
+
import { PhoneTranscript } from "../types.js";
|
|
8
|
+
export declare class TranscriptsResource {
|
|
9
|
+
private readonly http;
|
|
10
|
+
constructor(http: HttpTransport);
|
|
11
|
+
/**
|
|
12
|
+
* List all transcript segments for a call, ordered by sequence number.
|
|
13
|
+
*
|
|
14
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
15
|
+
* @param callId - UUID of the call.
|
|
16
|
+
*/
|
|
17
|
+
list(phoneNumberId: string, callId: string): Promise<PhoneTranscript[]>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=transcripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcripts.d.ts","sourceRoot":"","sources":["../../../src/phone/resources/transcripts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,eAAe,EAGhB,MAAM,aAAa,CAAC;AAErB,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;;;OAKG;IACG,IAAI,CACR,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,EAAE,CAAC;CAM9B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-phone/resources/transcripts.ts
|
|
3
|
+
*
|
|
4
|
+
* Transcript retrieval.
|
|
5
|
+
*/
|
|
6
|
+
import { parsePhoneTranscript, } from "../types.js";
|
|
7
|
+
export class TranscriptsResource {
|
|
8
|
+
http;
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List all transcript segments for a call, ordered by sequence number.
|
|
14
|
+
*
|
|
15
|
+
* @param phoneNumberId - UUID of the phone number.
|
|
16
|
+
* @param callId - UUID of the call.
|
|
17
|
+
*/
|
|
18
|
+
async list(phoneNumberId, callId) {
|
|
19
|
+
const data = await this.http.get(`/numbers/${phoneNumberId}/calls/${callId}/transcripts`);
|
|
20
|
+
return data.map(parsePhoneTranscript);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=transcripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcripts.js","sourceRoot":"","sources":["../../../src/phone/resources/transcripts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAGL,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,mBAAmB;IACD;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACR,aAAqB,EACrB,MAAc;QAEd,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9B,YAAY,aAAa,UAAU,MAAM,cAAc,CACxD,CAAC;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;CACF"}
|