@agentuity/core 1.0.21 → 1.0.23
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.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/services/email.d.ts +296 -0
- package/dist/services/email.d.ts.map +1 -0
- package/dist/services/email.js +308 -0
- package/dist/services/email.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/schedule.d.ts +88 -0
- package/dist/services/schedule.d.ts.map +1 -0
- package/dist/services/schedule.js +206 -0
- package/dist/services/schedule.js.map +1 -0
- package/dist/services/task.d.ts +100 -0
- package/dist/services/task.d.ts.map +1 -0
- package/dist/services/task.js +208 -0
- package/dist/services/task.js.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +37 -0
- package/src/services/email.ts +663 -0
- package/src/services/index.ts +3 -0
- package/src/services/schedule.ts +332 -0
- package/src/services/task.ts +366 -0
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export { type SessionEventProvider, SessionStartEventSchema, SessionCompleteEven
|
|
|
9
9
|
export { type CreateStreamProps, type ListStreamsParams, type StreamInfo, type ListStreamsResponse, type Stream, type StreamStorage, type StreamSortField, STREAM_MIN_TTL_SECONDS, STREAM_MAX_TTL_SECONDS, STREAM_DEFAULT_TTL_SECONDS, StreamStorageService, } from './services/stream.ts';
|
|
10
10
|
export { type VectorUpsertBase, type VectorUpsertEmbeddings, type VectorUpsertText, type VectorUpsertParams, type VectorSearchParams, type VectorSearchResult, type VectorSearchResultWithDocument, type VectorUpsertResult, type VectorResultFound, type VectorResultNotFound, type VectorResult, type VectorNamespaceStats, type VectorItemStats, type VectorNamespaceStatsWithSamples, type VectorGetAllStatsParams, type VectorStatsPaginated, type VectorStorage, type VectorSortField, VECTOR_MIN_TTL_SECONDS, VECTOR_MAX_TTL_SECONDS, VECTOR_DEFAULT_TTL_SECONDS, VectorStorageService, } from './services/vector.ts';
|
|
11
11
|
export { type QueueService, type QueuePublishParams, type QueuePublishResult, QueueStorageService, QueuePublishError, QueueNotFoundError, QueueValidationError, } from './services/queue.ts';
|
|
12
|
+
export { type EmailAddress, type EmailDestination, type EmailInbound, type EmailOutbound, type EmailAttachment, type EmailSendParams, type EmailService, EmailStorageService, } from './services/email.ts';
|
|
13
|
+
export { type Schedule, type ScheduleDestination, type ScheduleDelivery, type CreateScheduleParams, type CreateScheduleDestinationParams, type UpdateScheduleParams, type ScheduleListResult, type ScheduleGetResult, type ScheduleCreateResult, type ScheduleDeliveryListResult, ScheduleService, } from './services/schedule.ts';
|
|
14
|
+
export { type TaskPriority, type TaskType, type TaskStatus, type Task, type TaskChangelogEntry, type CreateTaskParams, type UpdateTaskParams, type ListTasksParams, type ListTasksResult, type TaskChangelogResult, type TaskStorage, TaskStorageService, } from './services/task.ts';
|
|
12
15
|
export { type EvalRunEventProvider, EvalRunStartEventSchema, EvalRunCompleteEventSchema, EvalRunStartEventDelayedSchema, EvalRunCompleteEventDelayedSchema, type EvalRunStartEvent, type EvalRunCompleteEvent, } from './services/evalrun.ts';
|
|
13
16
|
export { type SandboxResources, type SandboxStatus, type SandboxSortField, type SandboxRuntimeRequirements, type SandboxRuntime, type RuntimeSortField, type ExecutionStatus, type StreamReader, type SandboxStreamConfig, type SandboxCommand, type SandboxNetworkConfig, type SandboxTimeoutConfig, type SandboxCreateOptions, type Sandbox, type SandboxInfo, type SandboxRuntimeInfo, type SandboxSnapshotInfo, type SandboxSnapshotInfoPublic, type SandboxSnapshotInfoPrivate, type SandboxSnapshotUserInfo, type SandboxSnapshotOrgInfo, type SnapshotSortField, type SandboxUserInfo, type SandboxAgentInfo, type SandboxProjectInfo, type SandboxOrgInfo, type ListSandboxesParams, type ListSandboxesResponse, type ListRuntimesParams, type ListRuntimesResponse, type ExecuteOptions, type Execution, type SandboxRunOptions, type SandboxRunResult, type SandboxService, type FileToWrite, type SnapshotFileInfo, type SnapshotOrgInfo, type SnapshotUserInfo, type SnapshotInfo, type SnapshotCreateOptions, type SnapshotListParams, type SnapshotListResponse, type SnapshotService, SandboxError, } from './services/sandbox.ts';
|
|
14
17
|
export { buildUrl, toServiceException, toPayload, fromResponse } from './services/_util.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG3E,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGpD,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,IAAI,EACJ,UAAU,GACV,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACX,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,aAAa,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACN,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,iCAAiC,EACjC,KAAK,iBAAiB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B,EACzB,KAAK,eAAe,EACpB,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAG5F,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,eAAe,GACpB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACX,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,WAAW,GACX,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,9 @@ export { SessionStartEventSchema, SessionCompleteEventSchema, SessionStartEventD
|
|
|
8
8
|
export { STREAM_MIN_TTL_SECONDS, STREAM_MAX_TTL_SECONDS, STREAM_DEFAULT_TTL_SECONDS, StreamStorageService, } from "./services/stream.js";
|
|
9
9
|
export { VECTOR_MIN_TTL_SECONDS, VECTOR_MAX_TTL_SECONDS, VECTOR_DEFAULT_TTL_SECONDS, VectorStorageService, } from "./services/vector.js";
|
|
10
10
|
export { QueueStorageService, QueuePublishError, QueueNotFoundError, QueueValidationError, } from "./services/queue.js";
|
|
11
|
+
export { EmailStorageService, } from "./services/email.js";
|
|
12
|
+
export { ScheduleService, } from "./services/schedule.js";
|
|
13
|
+
export { TaskStorageService, } from "./services/task.js";
|
|
11
14
|
export { EvalRunStartEventSchema, EvalRunCompleteEventSchema, EvalRunStartEventDelayedSchema, EvalRunCompleteEventDelayedSchema, } from "./services/evalrun.js";
|
|
12
15
|
export { SandboxError, } from "./services/sandbox.js";
|
|
13
16
|
export { buildUrl, toServiceException, toPayload, fromResponse } from "./services/_util.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE3E,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAsB1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAYN,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,iCAAiC,GAGjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAQN,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAmBN,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIN,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,iCAAiC,GAGjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EA8CN,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAK5F,oBAAoB;AACpB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/B,OAAO,EA8CN,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAK5F,oBAAoB;AACpB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKxD,oBAAoB;AACpB,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,GAElB,MAAM,uBAAuB,CAAC;AAqB/B,4EAA4E"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { FetchAdapter } from './adapter.ts';
|
|
2
|
+
/**
|
|
3
|
+
* An email address registered with the Agentuity email service
|
|
4
|
+
*/
|
|
5
|
+
export interface EmailAddress {
|
|
6
|
+
id: string;
|
|
7
|
+
email: string;
|
|
8
|
+
project_id?: string;
|
|
9
|
+
provider?: string;
|
|
10
|
+
config?: Record<string, unknown>;
|
|
11
|
+
created_by?: string;
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A destination configuration for an email address
|
|
17
|
+
*/
|
|
18
|
+
export interface EmailDestination {
|
|
19
|
+
id: string;
|
|
20
|
+
type: string;
|
|
21
|
+
config?: Record<string, unknown>;
|
|
22
|
+
created_at: string;
|
|
23
|
+
updated_at?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An inbound email message
|
|
27
|
+
*/
|
|
28
|
+
export interface EmailInbound {
|
|
29
|
+
id: string;
|
|
30
|
+
from: string;
|
|
31
|
+
to: string;
|
|
32
|
+
subject?: string;
|
|
33
|
+
text?: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
received_at?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An outbound email message
|
|
39
|
+
*/
|
|
40
|
+
export interface EmailOutbound {
|
|
41
|
+
id: string;
|
|
42
|
+
from: string;
|
|
43
|
+
to: string;
|
|
44
|
+
subject?: string;
|
|
45
|
+
text?: string;
|
|
46
|
+
html?: string;
|
|
47
|
+
status?: string;
|
|
48
|
+
error?: string;
|
|
49
|
+
sent_at?: string;
|
|
50
|
+
created_at?: string;
|
|
51
|
+
updated_at?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* An email attachment
|
|
55
|
+
*/
|
|
56
|
+
export interface EmailAttachment {
|
|
57
|
+
/**
|
|
58
|
+
* The filename for the attachment
|
|
59
|
+
*/
|
|
60
|
+
filename: string;
|
|
61
|
+
/**
|
|
62
|
+
* The base64-encoded content of the attachment
|
|
63
|
+
*/
|
|
64
|
+
content: string;
|
|
65
|
+
/**
|
|
66
|
+
* The MIME content type of the attachment
|
|
67
|
+
*/
|
|
68
|
+
contentType?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Parameters for sending an email
|
|
72
|
+
*/
|
|
73
|
+
export interface EmailSendParams {
|
|
74
|
+
/**
|
|
75
|
+
* The sender email address (must be owned by the organization)
|
|
76
|
+
*/
|
|
77
|
+
from: string;
|
|
78
|
+
/**
|
|
79
|
+
* The recipient email addresses
|
|
80
|
+
*/
|
|
81
|
+
to: string[];
|
|
82
|
+
/**
|
|
83
|
+
* The email subject
|
|
84
|
+
*/
|
|
85
|
+
subject: string;
|
|
86
|
+
/**
|
|
87
|
+
* Plain text email body
|
|
88
|
+
*/
|
|
89
|
+
text?: string;
|
|
90
|
+
/**
|
|
91
|
+
* HTML email body
|
|
92
|
+
*/
|
|
93
|
+
html?: string;
|
|
94
|
+
/**
|
|
95
|
+
* File attachments
|
|
96
|
+
*/
|
|
97
|
+
attachments?: EmailAttachment[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Email service for managing email addresses, destinations, and sending/receiving emails
|
|
101
|
+
*/
|
|
102
|
+
export interface EmailService {
|
|
103
|
+
/**
|
|
104
|
+
* Create a new email address
|
|
105
|
+
*
|
|
106
|
+
* @param localPart - the local part of the email address (before the @)
|
|
107
|
+
* @returns the created email address
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const address = await email.createAddress('support');
|
|
112
|
+
* console.log('Created:', address.email);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
createAddress(localPart: string): Promise<EmailAddress>;
|
|
116
|
+
/**
|
|
117
|
+
* List all email addresses
|
|
118
|
+
*
|
|
119
|
+
* @returns array of email addresses
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const addresses = await email.listAddresses();
|
|
124
|
+
* for (const addr of addresses) {
|
|
125
|
+
* console.log(addr.email);
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
listAddresses(): Promise<EmailAddress[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Get an email address by ID
|
|
132
|
+
*
|
|
133
|
+
* @param id - the email address ID
|
|
134
|
+
* @returns the email address or null if not found
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const address = await email.getAddress('addr_123');
|
|
139
|
+
* if (address) {
|
|
140
|
+
* console.log('Found:', address.email);
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
getAddress(id: string): Promise<EmailAddress | null>;
|
|
145
|
+
/**
|
|
146
|
+
* Delete an email address
|
|
147
|
+
*
|
|
148
|
+
* @param id - the email address ID
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* await email.deleteAddress('addr_123');
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
deleteAddress(id: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Create a destination for an email address
|
|
158
|
+
*
|
|
159
|
+
* @param addressId - the email address ID
|
|
160
|
+
* @param type - the destination type (e.g., 'url', 'agent')
|
|
161
|
+
* @param config - the destination configuration
|
|
162
|
+
* @returns the created destination
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const dest = await email.createDestination('addr_123', 'url', {
|
|
167
|
+
* url: 'https://example.com/webhook',
|
|
168
|
+
* });
|
|
169
|
+
* console.log('Created destination:', dest.id);
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
createDestination(addressId: string, type: string, config: Record<string, unknown>): Promise<EmailDestination>;
|
|
173
|
+
/**
|
|
174
|
+
* List destinations for an email address
|
|
175
|
+
*
|
|
176
|
+
* @param addressId - the email address ID
|
|
177
|
+
* @returns array of destinations
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* const destinations = await email.listDestinations('addr_123');
|
|
182
|
+
* for (const dest of destinations) {
|
|
183
|
+
* console.log(`${dest.type}: ${dest.id}`);
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
listDestinations(addressId: string): Promise<EmailDestination[]>;
|
|
188
|
+
/**
|
|
189
|
+
* Delete a destination from an email address
|
|
190
|
+
*
|
|
191
|
+
* @param addressId - the email address ID
|
|
192
|
+
* @param destinationId - the destination ID
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* await email.deleteDestination('addr_123', 'dest_456');
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
deleteDestination(addressId: string, destinationId: string): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Send an email
|
|
202
|
+
*
|
|
203
|
+
* @param params - the send parameters
|
|
204
|
+
* @returns the outbound email record
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* const result = await email.send({
|
|
209
|
+
* from: 'support@myapp.agentuity.email',
|
|
210
|
+
* to: ['user@example.com'],
|
|
211
|
+
* subject: 'Welcome!',
|
|
212
|
+
* text: 'Welcome to our platform.',
|
|
213
|
+
* html: '<h1>Welcome!</h1><p>Welcome to our platform.</p>',
|
|
214
|
+
* });
|
|
215
|
+
* console.log('Sent:', result.id, 'Status:', result.status);
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
send(params: EmailSendParams): Promise<EmailOutbound>;
|
|
219
|
+
/**
|
|
220
|
+
* List inbound emails
|
|
221
|
+
*
|
|
222
|
+
* @param addressId - optional email address ID to filter by
|
|
223
|
+
* @returns array of inbound emails
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const inbound = await email.listInbound('addr_123');
|
|
228
|
+
* for (const msg of inbound) {
|
|
229
|
+
* console.log(`From: ${msg.from}, Subject: ${msg.subject}`);
|
|
230
|
+
* }
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
listInbound(addressId?: string): Promise<EmailInbound[]>;
|
|
234
|
+
/**
|
|
235
|
+
* Get an inbound email by ID
|
|
236
|
+
*
|
|
237
|
+
* @param id - the inbound email ID
|
|
238
|
+
* @returns the inbound email or null if not found
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const msg = await email.getInbound('inb_123');
|
|
243
|
+
* if (msg) {
|
|
244
|
+
* console.log('Subject:', msg.subject);
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
getInbound(id: string): Promise<EmailInbound | null>;
|
|
249
|
+
/**
|
|
250
|
+
* List outbound emails
|
|
251
|
+
*
|
|
252
|
+
* @param addressId - optional email address ID to filter by
|
|
253
|
+
* @returns array of outbound emails
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const outbound = await email.listOutbound('addr_123');
|
|
258
|
+
* for (const msg of outbound) {
|
|
259
|
+
* console.log(`To: ${msg.to}, Status: ${msg.status}`);
|
|
260
|
+
* }
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
listOutbound(addressId?: string): Promise<EmailOutbound[]>;
|
|
264
|
+
/**
|
|
265
|
+
* Get an outbound email by ID
|
|
266
|
+
*
|
|
267
|
+
* @param id - the outbound email ID
|
|
268
|
+
* @returns the outbound email or null if not found
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* const msg = await email.getOutbound('out_123');
|
|
273
|
+
* if (msg) {
|
|
274
|
+
* console.log('Status:', msg.status);
|
|
275
|
+
* }
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
getOutbound(id: string): Promise<EmailOutbound | null>;
|
|
279
|
+
}
|
|
280
|
+
export declare class EmailStorageService implements EmailService {
|
|
281
|
+
#private;
|
|
282
|
+
constructor(baseUrl: string, adapter: FetchAdapter);
|
|
283
|
+
createAddress(localPart: string): Promise<EmailAddress>;
|
|
284
|
+
listAddresses(): Promise<EmailAddress[]>;
|
|
285
|
+
getAddress(id: string): Promise<EmailAddress | null>;
|
|
286
|
+
deleteAddress(id: string): Promise<void>;
|
|
287
|
+
createDestination(addressId: string, type: string, config: Record<string, unknown>): Promise<EmailDestination>;
|
|
288
|
+
listDestinations(addressId: string): Promise<EmailDestination[]>;
|
|
289
|
+
deleteDestination(addressId: string, destinationId: string): Promise<void>;
|
|
290
|
+
send(params: EmailSendParams): Promise<EmailOutbound>;
|
|
291
|
+
listInbound(addressId?: string): Promise<EmailInbound[]>;
|
|
292
|
+
getInbound(id: string): Promise<EmailInbound | null>;
|
|
293
|
+
listOutbound(addressId?: string): Promise<EmailOutbound[]>;
|
|
294
|
+
getOutbound(id: string): Promise<EmailOutbound | null>;
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/services/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI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,OAAO,CAAC,gBAAgB,EAAE,CAAC;IA0BhE,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB1E,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IA2CrD,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IA+BxD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAyBpD,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA+B1D,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;CAwB5D"}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { buildUrl, toServiceException } from "./_util.js";
|
|
2
|
+
import { safeStringify } from "../json.js";
|
|
3
|
+
/**
|
|
4
|
+
* Unwrap a Catalyst API response payload.
|
|
5
|
+
* Handles both `{ key: data }` and `{ data: { key: data } }` response formats.
|
|
6
|
+
*/
|
|
7
|
+
function unwrap(payload, key) {
|
|
8
|
+
if (typeof payload === 'object' && payload !== null) {
|
|
9
|
+
const obj = payload;
|
|
10
|
+
if (key in obj) {
|
|
11
|
+
return obj[key];
|
|
12
|
+
}
|
|
13
|
+
if ('data' in obj && typeof obj.data === 'object' && obj.data !== null) {
|
|
14
|
+
const data = obj.data;
|
|
15
|
+
if (key in data) {
|
|
16
|
+
return data[key];
|
|
17
|
+
}
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return payload;
|
|
22
|
+
}
|
|
23
|
+
export class EmailStorageService {
|
|
24
|
+
#adapter;
|
|
25
|
+
#baseUrl;
|
|
26
|
+
constructor(baseUrl, adapter) {
|
|
27
|
+
this.#adapter = adapter;
|
|
28
|
+
this.#baseUrl = baseUrl;
|
|
29
|
+
}
|
|
30
|
+
async createAddress(localPart) {
|
|
31
|
+
const url = buildUrl(this.#baseUrl, '/email/2025-03-17/addresses');
|
|
32
|
+
const signal = AbortSignal.timeout(30_000);
|
|
33
|
+
const res = await this.#adapter.invoke(url, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
body: safeStringify({ local_part: localPart }),
|
|
36
|
+
contentType: 'application/json',
|
|
37
|
+
signal,
|
|
38
|
+
telemetry: {
|
|
39
|
+
name: 'agentuity.email.createAddress',
|
|
40
|
+
attributes: {
|
|
41
|
+
localPart,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
if (res.ok) {
|
|
46
|
+
return unwrap(res.data, 'address');
|
|
47
|
+
}
|
|
48
|
+
throw await toServiceException('POST', url, res.response);
|
|
49
|
+
}
|
|
50
|
+
async listAddresses() {
|
|
51
|
+
const url = buildUrl(this.#baseUrl, '/email/2025-03-17/addresses');
|
|
52
|
+
const signal = AbortSignal.timeout(30_000);
|
|
53
|
+
const res = await this.#adapter.invoke(url, {
|
|
54
|
+
method: 'GET',
|
|
55
|
+
signal,
|
|
56
|
+
telemetry: {
|
|
57
|
+
name: 'agentuity.email.listAddresses',
|
|
58
|
+
attributes: {},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
if (res.response.status === 404) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
if (res.ok) {
|
|
65
|
+
const items = unwrap(res.data, 'addresses');
|
|
66
|
+
return Array.isArray(items) ? items : [];
|
|
67
|
+
}
|
|
68
|
+
throw await toServiceException('GET', url, res.response);
|
|
69
|
+
}
|
|
70
|
+
async getAddress(id) {
|
|
71
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/addresses/${encodeURIComponent(id)}`);
|
|
72
|
+
const signal = AbortSignal.timeout(30_000);
|
|
73
|
+
const res = await this.#adapter.invoke(url, {
|
|
74
|
+
method: 'GET',
|
|
75
|
+
signal,
|
|
76
|
+
telemetry: {
|
|
77
|
+
name: 'agentuity.email.getAddress',
|
|
78
|
+
attributes: {
|
|
79
|
+
id,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
if (res.response.status === 404) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (res.ok) {
|
|
87
|
+
return unwrap(res.data, 'address');
|
|
88
|
+
}
|
|
89
|
+
throw await toServiceException('GET', url, res.response);
|
|
90
|
+
}
|
|
91
|
+
async deleteAddress(id) {
|
|
92
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/addresses/${encodeURIComponent(id)}`);
|
|
93
|
+
const signal = AbortSignal.timeout(30_000);
|
|
94
|
+
const res = await this.#adapter.invoke(url, {
|
|
95
|
+
method: 'DELETE',
|
|
96
|
+
signal,
|
|
97
|
+
telemetry: {
|
|
98
|
+
name: 'agentuity.email.deleteAddress',
|
|
99
|
+
attributes: {
|
|
100
|
+
id,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
if (res.ok || res.response.status === 404) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
108
|
+
}
|
|
109
|
+
async createDestination(addressId, type, config) {
|
|
110
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/addresses/${encodeURIComponent(addressId)}/destinations`);
|
|
111
|
+
const signal = AbortSignal.timeout(30_000);
|
|
112
|
+
const res = await this.#adapter.invoke(url, {
|
|
113
|
+
method: 'POST',
|
|
114
|
+
body: safeStringify({ type, config }),
|
|
115
|
+
contentType: 'application/json',
|
|
116
|
+
signal,
|
|
117
|
+
telemetry: {
|
|
118
|
+
name: 'agentuity.email.createDestination',
|
|
119
|
+
attributes: {
|
|
120
|
+
addressId,
|
|
121
|
+
type,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
if (res.ok) {
|
|
126
|
+
return unwrap(res.data, 'destination');
|
|
127
|
+
}
|
|
128
|
+
throw await toServiceException('POST', url, res.response);
|
|
129
|
+
}
|
|
130
|
+
async listDestinations(addressId) {
|
|
131
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/addresses/${encodeURIComponent(addressId)}/destinations`);
|
|
132
|
+
const signal = AbortSignal.timeout(30_000);
|
|
133
|
+
const res = await this.#adapter.invoke(url, {
|
|
134
|
+
method: 'GET',
|
|
135
|
+
signal,
|
|
136
|
+
telemetry: {
|
|
137
|
+
name: 'agentuity.email.listDestinations',
|
|
138
|
+
attributes: {
|
|
139
|
+
addressId,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
if (res.response.status === 404) {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
if (res.ok) {
|
|
147
|
+
const items = unwrap(res.data, 'destinations');
|
|
148
|
+
return Array.isArray(items) ? items : [];
|
|
149
|
+
}
|
|
150
|
+
throw await toServiceException('GET', url, res.response);
|
|
151
|
+
}
|
|
152
|
+
async deleteDestination(addressId, destinationId) {
|
|
153
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/addresses/${encodeURIComponent(addressId)}/destinations/${encodeURIComponent(destinationId)}`);
|
|
154
|
+
const signal = AbortSignal.timeout(30_000);
|
|
155
|
+
const res = await this.#adapter.invoke(url, {
|
|
156
|
+
method: 'DELETE',
|
|
157
|
+
signal,
|
|
158
|
+
telemetry: {
|
|
159
|
+
name: 'agentuity.email.deleteDestination',
|
|
160
|
+
attributes: {
|
|
161
|
+
addressId,
|
|
162
|
+
destinationId,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
if (res.ok || res.response.status === 404) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
170
|
+
}
|
|
171
|
+
async send(params) {
|
|
172
|
+
const url = buildUrl(this.#baseUrl, '/email/2025-03-17/outbound/send');
|
|
173
|
+
const signal = AbortSignal.timeout(30_000);
|
|
174
|
+
// Transform attachments to API format (snake_case)
|
|
175
|
+
const body = {
|
|
176
|
+
from: params.from,
|
|
177
|
+
to: params.to,
|
|
178
|
+
subject: params.subject,
|
|
179
|
+
};
|
|
180
|
+
if (params.text !== undefined) {
|
|
181
|
+
body.text = params.text;
|
|
182
|
+
}
|
|
183
|
+
if (params.html !== undefined) {
|
|
184
|
+
body.html = params.html;
|
|
185
|
+
}
|
|
186
|
+
if (params.attachments && params.attachments.length > 0) {
|
|
187
|
+
body.attachments = params.attachments.map((a) => ({
|
|
188
|
+
filename: a.filename,
|
|
189
|
+
content_base64: a.content,
|
|
190
|
+
...(a.contentType && { content_type: a.contentType }),
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
const res = await this.#adapter.invoke(url, {
|
|
194
|
+
method: 'POST',
|
|
195
|
+
body: safeStringify(body),
|
|
196
|
+
contentType: 'application/json',
|
|
197
|
+
signal,
|
|
198
|
+
telemetry: {
|
|
199
|
+
name: 'agentuity.email.send',
|
|
200
|
+
attributes: {
|
|
201
|
+
from: params.from,
|
|
202
|
+
toCount: String(params.to.length),
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
if (res.ok) {
|
|
207
|
+
return unwrap(res.data, 'outbound');
|
|
208
|
+
}
|
|
209
|
+
throw await toServiceException('POST', url, res.response);
|
|
210
|
+
}
|
|
211
|
+
async listInbound(addressId) {
|
|
212
|
+
const queryParams = new URLSearchParams();
|
|
213
|
+
if (addressId) {
|
|
214
|
+
queryParams.set('address_id', addressId);
|
|
215
|
+
}
|
|
216
|
+
const queryString = queryParams.toString();
|
|
217
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/inbound${queryString ? `?${queryString}` : ''}`);
|
|
218
|
+
const signal = AbortSignal.timeout(30_000);
|
|
219
|
+
const res = await this.#adapter.invoke(url, {
|
|
220
|
+
method: 'GET',
|
|
221
|
+
signal,
|
|
222
|
+
telemetry: {
|
|
223
|
+
name: 'agentuity.email.listInbound',
|
|
224
|
+
attributes: {
|
|
225
|
+
...(addressId && { addressId }),
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
if (res.response.status === 404) {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
if (res.ok) {
|
|
233
|
+
const items = unwrap(res.data, 'inbound');
|
|
234
|
+
return Array.isArray(items) ? items : [];
|
|
235
|
+
}
|
|
236
|
+
throw await toServiceException('GET', url, res.response);
|
|
237
|
+
}
|
|
238
|
+
async getInbound(id) {
|
|
239
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/inbound/${encodeURIComponent(id)}`);
|
|
240
|
+
const signal = AbortSignal.timeout(30_000);
|
|
241
|
+
const res = await this.#adapter.invoke(url, {
|
|
242
|
+
method: 'GET',
|
|
243
|
+
signal,
|
|
244
|
+
telemetry: {
|
|
245
|
+
name: 'agentuity.email.getInbound',
|
|
246
|
+
attributes: {
|
|
247
|
+
id,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
if (res.response.status === 404) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
if (res.ok) {
|
|
255
|
+
return unwrap(res.data, 'inbound');
|
|
256
|
+
}
|
|
257
|
+
throw await toServiceException('GET', url, res.response);
|
|
258
|
+
}
|
|
259
|
+
async listOutbound(addressId) {
|
|
260
|
+
const queryParams = new URLSearchParams();
|
|
261
|
+
if (addressId) {
|
|
262
|
+
queryParams.set('address_id', addressId);
|
|
263
|
+
}
|
|
264
|
+
const queryString = queryParams.toString();
|
|
265
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/outbound${queryString ? `?${queryString}` : ''}`);
|
|
266
|
+
const signal = AbortSignal.timeout(30_000);
|
|
267
|
+
const res = await this.#adapter.invoke(url, {
|
|
268
|
+
method: 'GET',
|
|
269
|
+
signal,
|
|
270
|
+
telemetry: {
|
|
271
|
+
name: 'agentuity.email.listOutbound',
|
|
272
|
+
attributes: {
|
|
273
|
+
...(addressId && { addressId }),
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
if (res.response.status === 404) {
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
if (res.ok) {
|
|
281
|
+
const items = unwrap(res.data, 'outbound');
|
|
282
|
+
return Array.isArray(items) ? items : [];
|
|
283
|
+
}
|
|
284
|
+
throw await toServiceException('GET', url, res.response);
|
|
285
|
+
}
|
|
286
|
+
async getOutbound(id) {
|
|
287
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/outbound/${encodeURIComponent(id)}`);
|
|
288
|
+
const signal = AbortSignal.timeout(30_000);
|
|
289
|
+
const res = await this.#adapter.invoke(url, {
|
|
290
|
+
method: 'GET',
|
|
291
|
+
signal,
|
|
292
|
+
telemetry: {
|
|
293
|
+
name: 'agentuity.email.getOutbound',
|
|
294
|
+
attributes: {
|
|
295
|
+
id,
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
if (res.response.status === 404) {
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
if (res.ok) {
|
|
303
|
+
return unwrap(res.data, 'outbound');
|
|
304
|
+
}
|
|
305
|
+
throw await toServiceException('GET', url, res.response);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=email.js.map
|