@kivel.io/sdk 0.10.1 → 0.11.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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +15 -3
- package/dist/types.d.ts +38 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
|
-
import type { Authenticator, AuthenticatorInput, TotpCode, EmailAttachmentLink, OAuthProviderInput, OAuthProvider, CreatedOAuthProvider, AgentLogin, AgentToken, AgentTrial, Approval, ApprovalInput, EmailInbox, EmailMessage, EmailContent, EmailThread, EmailThreadsPage, EmailDraft, EmailRules, MemoryEntry, Monitor, MonitorInput
|
|
2
|
+
import type { Authenticator, AuthenticatorInput, TotpCode, EmailAttachmentLink, OAuthProviderInput, OAuthProvider, CreatedOAuthProvider, AgentLogin, AgentToken, AgentTrial, Approval, ApprovalInput, EmailInbox, EmailMessage, EmailSearchOptions, EmailWaitOptions, EmailContent, EmailThread, EmailThreadsPage, EmailDraft, EmailRules, MemoryEntry, Monitor, MonitorInput } from './types.js';
|
|
3
3
|
export interface ClientOptions {
|
|
4
4
|
baseUrl?: string | undefined;
|
|
5
5
|
apiKey?: string | undefined;
|
|
@@ -257,14 +257,22 @@ export declare class Kivel {
|
|
|
257
257
|
}>;
|
|
258
258
|
emailForwarding(id: string, url: string | null, token?: string): Promise<{
|
|
259
259
|
forwardingUrl: string | null;
|
|
260
|
+
signingSecret?: string;
|
|
261
|
+
}>;
|
|
262
|
+
emailDeliveries(id: string): Promise<{
|
|
263
|
+
deliveries: import('./types.js').EmailDelivery[];
|
|
260
264
|
}>;
|
|
261
265
|
emailInbox(id: string, token?: string): Promise<EmailInbox>;
|
|
262
|
-
emails(id: string,
|
|
266
|
+
emails(id: string, tokenOrOptions?: string | EmailSearchOptions): Promise<{
|
|
263
267
|
messages: EmailMessage[];
|
|
268
|
+
nextCursor?: string | null;
|
|
264
269
|
}>;
|
|
265
|
-
|
|
270
|
+
emailMessage(id: string, messageId: string, token?: string): Promise<EmailMessage>;
|
|
271
|
+
updateEmailMessage(id: string, messageId: string, update: import('./types.js').EmailMessageUpdate): Promise<EmailMessage>;
|
|
272
|
+
waitForEmail(id: string, options?: EmailWaitOptions): Promise<{
|
|
266
273
|
timedOut: boolean;
|
|
267
274
|
messages: EmailMessage[];
|
|
275
|
+
nextCursor?: string;
|
|
268
276
|
}>;
|
|
269
277
|
memorySet<T>(namespace: string, key: string, value: T, ttlSeconds?: number): Promise<Omit<MemoryEntry<T>, "value">>;
|
|
270
278
|
memoryGet<T = unknown>(namespace: string, key: string): Promise<MemoryEntry<T>>;
|
package/dist/index.js
CHANGED
|
@@ -371,14 +371,26 @@ export class Kivel {
|
|
|
371
371
|
emailForwarding(id, url, token) {
|
|
372
372
|
return this.request('PUT', `/api/email-inboxes/${encodeURIComponent(id)}/forwarding`, { url }, token);
|
|
373
373
|
}
|
|
374
|
+
emailDeliveries(id) {
|
|
375
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/deliveries`);
|
|
376
|
+
}
|
|
374
377
|
emailInbox(id, token) {
|
|
375
378
|
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}`, undefined, token);
|
|
376
379
|
}
|
|
377
|
-
emails(id,
|
|
378
|
-
|
|
380
|
+
emails(id, tokenOrOptions) {
|
|
381
|
+
const settings = typeof tokenOrOptions === 'string' ? { token: tokenOrOptions } : (tokenOrOptions ?? {});
|
|
382
|
+
const { token, ...filters } = settings;
|
|
383
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/messages${query(filters)}`, undefined, token);
|
|
384
|
+
}
|
|
385
|
+
emailMessage(id, messageId, token) {
|
|
386
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/messages/${encodeURIComponent(messageId)}`, undefined, token);
|
|
387
|
+
}
|
|
388
|
+
updateEmailMessage(id, messageId, update) {
|
|
389
|
+
return this.request('PATCH', `/api/email-inboxes/${encodeURIComponent(id)}/messages/${encodeURIComponent(messageId)}`, update);
|
|
379
390
|
}
|
|
380
391
|
waitForEmail(id, options = {}) {
|
|
381
|
-
|
|
392
|
+
const { token, ...filters } = options;
|
|
393
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/wait${query({ ...filters, timeoutSeconds: this.waitTimeout(options.timeoutSeconds) })}`, undefined, token);
|
|
382
394
|
}
|
|
383
395
|
memorySet(namespace, key, value, ttlSeconds) {
|
|
384
396
|
return this.request('PUT', memoryPath(namespace, key), {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
export interface EmailFilters {
|
|
2
|
+
from?: string | undefined;
|
|
3
|
+
mailFrom?: string | undefined;
|
|
4
|
+
subject?: string | undefined;
|
|
5
|
+
text?: string | undefined;
|
|
6
|
+
hasCode?: boolean | undefined;
|
|
7
|
+
hasLink?: boolean | undefined;
|
|
8
|
+
hasAttachment?: boolean | undefined;
|
|
9
|
+
read?: boolean | undefined;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface EmailSearchOptions extends EmailFilters {
|
|
13
|
+
token?: string | undefined;
|
|
14
|
+
cursor?: string | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface EmailWaitOptions extends WaitOptions, EmailFilters {
|
|
18
|
+
cursor?: string | undefined;
|
|
19
|
+
limit?: number | undefined;
|
|
20
|
+
checkpoint?: boolean | undefined;
|
|
21
|
+
}
|
|
1
22
|
export interface WaitOptions {
|
|
2
23
|
token?: string;
|
|
3
24
|
after?: string;
|
|
@@ -35,6 +56,15 @@ export interface AgentTrial {
|
|
|
35
56
|
};
|
|
36
57
|
instructions: string;
|
|
37
58
|
}
|
|
59
|
+
export interface EmailDelivery {
|
|
60
|
+
messageId: string;
|
|
61
|
+
pending: boolean;
|
|
62
|
+
attempts: {
|
|
63
|
+
at: string;
|
|
64
|
+
status?: number;
|
|
65
|
+
error?: string;
|
|
66
|
+
}[];
|
|
67
|
+
}
|
|
38
68
|
export interface EmailInbox {
|
|
39
69
|
id: string;
|
|
40
70
|
address: string;
|
|
@@ -95,10 +125,13 @@ export interface EmailMessage {
|
|
|
95
125
|
}[];
|
|
96
126
|
direction?: 'inbound' | 'outbound';
|
|
97
127
|
deliveryStatus?: 'pending' | 'sent';
|
|
128
|
+
read?: boolean;
|
|
129
|
+
labels?: string[];
|
|
98
130
|
messageId?: string;
|
|
99
131
|
inReplyTo?: string;
|
|
100
132
|
references?: string[];
|
|
101
133
|
}
|
|
134
|
+
export type EmailMessageUpdate = Pick<EmailMessage, 'read' | 'labels'>;
|
|
102
135
|
export interface EmailContent {
|
|
103
136
|
to: string[];
|
|
104
137
|
cc?: string[];
|
|
@@ -117,6 +150,11 @@ export interface EmailThreadSummary {
|
|
|
117
150
|
lastAt: string;
|
|
118
151
|
from: string;
|
|
119
152
|
messageCount: number;
|
|
153
|
+
unread?: boolean;
|
|
154
|
+
hasCode?: boolean;
|
|
155
|
+
hasLink?: boolean;
|
|
156
|
+
hasAttachment?: boolean;
|
|
157
|
+
labels?: string[];
|
|
120
158
|
}
|
|
121
159
|
export interface EmailThread extends EmailThreadSummary {
|
|
122
160
|
messages: EmailMessage[];
|