@agentuity/core 1.0.22 → 1.0.24
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/_util.d.ts.map +1 -1
- package/dist/services/_util.js +26 -1
- package/dist/services/_util.js.map +1 -1
- package/dist/services/email.d.ts +298 -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/_util.ts +27 -1
- package/src/services/email.ts +665 -0
- package/src/services/index.ts +3 -0
- package/src/services/schedule.ts +332 -0
- package/src/services/task.ts +366 -0
|
@@ -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: 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/services/email.ts"],"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C,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAU,GAAG,EAAE;YACpD,MAAM,EAAE,KAAK;YACb,MAAM;YACN,SAAS,EAAE;gBACV,IAAI,EAAE,6BAA6B;gBACnC,UAAU,EAAE;oBACX,EAAE;iBACF;aACD;SACD,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,OAAO,MAAM,CAAgB,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,MAAM,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;CACD"}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -4,8 +4,11 @@ export * from './exception.ts';
|
|
|
4
4
|
export * from './keyvalue.ts';
|
|
5
5
|
export * from './pagination.ts';
|
|
6
6
|
export * from './sandbox.ts';
|
|
7
|
+
export * from './schedule.ts';
|
|
7
8
|
export * from './session.ts';
|
|
8
9
|
export * from './stream.ts';
|
|
10
|
+
export * from './task.ts';
|
|
9
11
|
export * from './vector.ts';
|
|
12
|
+
export * from './email.ts';
|
|
10
13
|
export { buildUrl, toServiceException, toPayload, fromResponse } from './_util.ts';
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/services/index.js
CHANGED
|
@@ -4,8 +4,11 @@ export * from "./exception.js";
|
|
|
4
4
|
export * from "./keyvalue.js";
|
|
5
5
|
export * from "./pagination.js";
|
|
6
6
|
export * from "./sandbox.js";
|
|
7
|
+
export * from "./schedule.js";
|
|
7
8
|
export * from "./session.js";
|
|
8
9
|
export * from "./stream.js";
|
|
10
|
+
export * from "./task.js";
|
|
9
11
|
export * from "./vector.js";
|
|
12
|
+
export * from "./email.js";
|
|
10
13
|
export { buildUrl, toServiceException, toPayload, fromResponse } from "./_util.js";
|
|
11
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { FetchAdapter } from './adapter.ts';
|
|
2
|
+
export interface Schedule {
|
|
3
|
+
id: string;
|
|
4
|
+
created_at: string;
|
|
5
|
+
updated_at: string;
|
|
6
|
+
created_by: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string | null;
|
|
9
|
+
expression: string;
|
|
10
|
+
due_date: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ScheduleDestination {
|
|
13
|
+
id: string;
|
|
14
|
+
schedule_id: string;
|
|
15
|
+
created_at: string;
|
|
16
|
+
updated_at: string;
|
|
17
|
+
created_by: string;
|
|
18
|
+
type: 'url' | 'sandbox';
|
|
19
|
+
config: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface ScheduleDelivery {
|
|
22
|
+
id: string;
|
|
23
|
+
date: string;
|
|
24
|
+
schedule_id: string;
|
|
25
|
+
schedule_destination_id: string;
|
|
26
|
+
status: 'pending' | 'success' | 'failed';
|
|
27
|
+
retries: number;
|
|
28
|
+
error: string | null;
|
|
29
|
+
response: Record<string, unknown> | null;
|
|
30
|
+
}
|
|
31
|
+
export interface CreateScheduleParams {
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
expression: string;
|
|
35
|
+
destinations?: CreateScheduleDestinationParams[];
|
|
36
|
+
}
|
|
37
|
+
export interface CreateScheduleDestinationParams {
|
|
38
|
+
type: 'url' | 'sandbox';
|
|
39
|
+
config: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export interface UpdateScheduleParams {
|
|
42
|
+
name?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
expression?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ScheduleListResult {
|
|
47
|
+
schedules: Schedule[];
|
|
48
|
+
total: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ScheduleGetResult {
|
|
51
|
+
schedule: Schedule;
|
|
52
|
+
destinations: ScheduleDestination[];
|
|
53
|
+
}
|
|
54
|
+
export interface ScheduleCreateResult {
|
|
55
|
+
schedule: Schedule;
|
|
56
|
+
destinations: ScheduleDestination[];
|
|
57
|
+
}
|
|
58
|
+
export interface ScheduleDeliveryListResult {
|
|
59
|
+
deliveries: ScheduleDelivery[];
|
|
60
|
+
}
|
|
61
|
+
export declare class ScheduleService {
|
|
62
|
+
#private;
|
|
63
|
+
constructor(baseUrl: string, adapter: FetchAdapter);
|
|
64
|
+
create(params: CreateScheduleParams): Promise<ScheduleCreateResult>;
|
|
65
|
+
list(params?: {
|
|
66
|
+
limit?: number;
|
|
67
|
+
offset?: number;
|
|
68
|
+
}): Promise<ScheduleListResult>;
|
|
69
|
+
get(scheduleId: string): Promise<ScheduleGetResult>;
|
|
70
|
+
update(scheduleId: string, params: UpdateScheduleParams): Promise<{
|
|
71
|
+
schedule: Schedule;
|
|
72
|
+
}>;
|
|
73
|
+
delete(scheduleId: string): Promise<void>;
|
|
74
|
+
createDestination(scheduleId: string, params: CreateScheduleDestinationParams): Promise<{
|
|
75
|
+
destination: ScheduleDestination;
|
|
76
|
+
}>;
|
|
77
|
+
deleteDestination(destinationId: string): Promise<void>;
|
|
78
|
+
listDeliveries(scheduleId: string, params?: {
|
|
79
|
+
limit?: number;
|
|
80
|
+
offset?: number;
|
|
81
|
+
}): Promise<ScheduleDeliveryListResult>;
|
|
82
|
+
getDestination(scheduleId: string, destinationId: string): Promise<ScheduleDestination>;
|
|
83
|
+
getDelivery(scheduleId: string, deliveryId: string, params?: {
|
|
84
|
+
limit?: number;
|
|
85
|
+
offset?: number;
|
|
86
|
+
}): Promise<ScheduleDelivery>;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=schedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../src/services/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAChC,EAAE,EAAE,M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apter;
|
|
4
|
+
#baseUrl;
|
|
5
|
+
constructor(baseUrl, adapter) {
|
|
6
|
+
this.#adapter = adapter;
|
|
7
|
+
this.#baseUrl = baseUrl;
|
|
8
|
+
}
|
|
9
|
+
async create(params) {
|
|
10
|
+
const url = buildUrl(this.#baseUrl, '/schedule/create/2026-02-24');
|
|
11
|
+
const signal = AbortSignal.timeout(30_000);
|
|
12
|
+
const res = await this.#adapter.invoke(url, {
|
|
13
|
+
method: 'POST',
|
|
14
|
+
signal,
|
|
15
|
+
body: JSON.stringify(params),
|
|
16
|
+
contentType: 'application/json',
|
|
17
|
+
telemetry: {
|
|
18
|
+
name: 'agentuity.schedule.create',
|
|
19
|
+
attributes: {
|
|
20
|
+
destinationCount: String(params.destinations?.length ?? 0),
|
|
21
|
+
name: params.name,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
if (res.ok) {
|
|
26
|
+
return res.data;
|
|
27
|
+
}
|
|
28
|
+
throw await toServiceException('POST', url, res.response);
|
|
29
|
+
}
|
|
30
|
+
async list(params) {
|
|
31
|
+
const qs = new URLSearchParams();
|
|
32
|
+
if (params?.limit !== undefined) {
|
|
33
|
+
qs.set('limit', String(params.limit));
|
|
34
|
+
}
|
|
35
|
+
if (params?.offset !== undefined) {
|
|
36
|
+
qs.set('offset', String(params.offset));
|
|
37
|
+
}
|
|
38
|
+
const path = qs.toString()
|
|
39
|
+
? `/schedule/list/2026-02-24?${qs.toString()}`
|
|
40
|
+
: '/schedule/list/2026-02-24';
|
|
41
|
+
const url = buildUrl(this.#baseUrl, path);
|
|
42
|
+
const signal = AbortSignal.timeout(30_000);
|
|
43
|
+
const res = await this.#adapter.invoke(url, {
|
|
44
|
+
method: 'GET',
|
|
45
|
+
signal,
|
|
46
|
+
telemetry: {
|
|
47
|
+
name: 'agentuity.schedule.list',
|
|
48
|
+
attributes: {
|
|
49
|
+
limit: String(params?.limit ?? ''),
|
|
50
|
+
offset: String(params?.offset ?? ''),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
if (res.ok) {
|
|
55
|
+
return res.data;
|
|
56
|
+
}
|
|
57
|
+
throw await toServiceException('GET', url, res.response);
|
|
58
|
+
}
|
|
59
|
+
async get(scheduleId) {
|
|
60
|
+
const url = buildUrl(this.#baseUrl, `/schedule/get/2026-02-24/${encodeURIComponent(scheduleId)}`);
|
|
61
|
+
const signal = AbortSignal.timeout(30_000);
|
|
62
|
+
const res = await this.#adapter.invoke(url, {
|
|
63
|
+
method: 'GET',
|
|
64
|
+
signal,
|
|
65
|
+
telemetry: {
|
|
66
|
+
name: 'agentuity.schedule.get',
|
|
67
|
+
attributes: {
|
|
68
|
+
scheduleId,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
if (res.ok) {
|
|
73
|
+
return res.data;
|
|
74
|
+
}
|
|
75
|
+
if (res.response.status === 404) {
|
|
76
|
+
throw await toServiceException('GET', url, res.response);
|
|
77
|
+
}
|
|
78
|
+
throw await toServiceException('GET', url, res.response);
|
|
79
|
+
}
|
|
80
|
+
async update(scheduleId, params) {
|
|
81
|
+
const url = buildUrl(this.#baseUrl, `/schedule/update/2026-02-24/${encodeURIComponent(scheduleId)}`);
|
|
82
|
+
const signal = AbortSignal.timeout(30_000);
|
|
83
|
+
const res = await this.#adapter.invoke(url, {
|
|
84
|
+
method: 'PUT',
|
|
85
|
+
signal,
|
|
86
|
+
body: JSON.stringify(params),
|
|
87
|
+
contentType: 'application/json',
|
|
88
|
+
telemetry: {
|
|
89
|
+
name: 'agentuity.schedule.update',
|
|
90
|
+
attributes: {
|
|
91
|
+
scheduleId,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
if (res.ok) {
|
|
96
|
+
return res.data;
|
|
97
|
+
}
|
|
98
|
+
throw await toServiceException('PUT', url, res.response);
|
|
99
|
+
}
|
|
100
|
+
async delete(scheduleId) {
|
|
101
|
+
const url = buildUrl(this.#baseUrl, `/schedule/delete/2026-02-24/${encodeURIComponent(scheduleId)}`);
|
|
102
|
+
const signal = AbortSignal.timeout(30_000);
|
|
103
|
+
const res = await this.#adapter.invoke(url, {
|
|
104
|
+
method: 'DELETE',
|
|
105
|
+
signal,
|
|
106
|
+
telemetry: {
|
|
107
|
+
name: 'agentuity.schedule.delete',
|
|
108
|
+
attributes: {
|
|
109
|
+
scheduleId,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
if (res.ok) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
117
|
+
}
|
|
118
|
+
async createDestination(scheduleId, params) {
|
|
119
|
+
const url = buildUrl(this.#baseUrl, `/schedule/destinations/create/2026-02-24/${encodeURIComponent(scheduleId)}`);
|
|
120
|
+
const signal = AbortSignal.timeout(30_000);
|
|
121
|
+
const res = await this.#adapter.invoke(url, {
|
|
122
|
+
method: 'POST',
|
|
123
|
+
signal,
|
|
124
|
+
body: JSON.stringify(params),
|
|
125
|
+
contentType: 'application/json',
|
|
126
|
+
telemetry: {
|
|
127
|
+
name: 'agentuity.schedule.createDestination',
|
|
128
|
+
attributes: {
|
|
129
|
+
scheduleId,
|
|
130
|
+
type: params.type,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
if (res.ok) {
|
|
135
|
+
return res.data;
|
|
136
|
+
}
|
|
137
|
+
throw await toServiceException('POST', url, res.response);
|
|
138
|
+
}
|
|
139
|
+
async deleteDestination(destinationId) {
|
|
140
|
+
const url = buildUrl(this.#baseUrl, `/schedule/destinations/delete/2026-02-24/${encodeURIComponent(destinationId)}`);
|
|
141
|
+
const signal = AbortSignal.timeout(30_000);
|
|
142
|
+
const res = await this.#adapter.invoke(url, {
|
|
143
|
+
method: 'DELETE',
|
|
144
|
+
signal,
|
|
145
|
+
telemetry: {
|
|
146
|
+
name: 'agentuity.schedule.deleteDestination',
|
|
147
|
+
attributes: {
|
|
148
|
+
destinationId,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
if (res.ok) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
156
|
+
}
|
|
157
|
+
async listDeliveries(scheduleId, params) {
|
|
158
|
+
const qs = new URLSearchParams();
|
|
159
|
+
if (params?.limit !== undefined) {
|
|
160
|
+
qs.set('limit', String(params.limit));
|
|
161
|
+
}
|
|
162
|
+
if (params?.offset !== undefined) {
|
|
163
|
+
qs.set('offset', String(params.offset));
|
|
164
|
+
}
|
|
165
|
+
const basePath = `/schedule/deliveries/2026-02-24/${encodeURIComponent(scheduleId)}`;
|
|
166
|
+
const path = qs.toString() ? `${basePath}?${qs.toString()}` : basePath;
|
|
167
|
+
const url = buildUrl(this.#baseUrl, path);
|
|
168
|
+
const signal = AbortSignal.timeout(30_000);
|
|
169
|
+
const res = await this.#adapter.invoke(url, {
|
|
170
|
+
method: 'GET',
|
|
171
|
+
signal,
|
|
172
|
+
telemetry: {
|
|
173
|
+
name: 'agentuity.schedule.listDeliveries',
|
|
174
|
+
attributes: {
|
|
175
|
+
scheduleId,
|
|
176
|
+
limit: String(params?.limit ?? ''),
|
|
177
|
+
offset: String(params?.offset ?? ''),
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
if (res.ok) {
|
|
182
|
+
return res.data;
|
|
183
|
+
}
|
|
184
|
+
if (res.response.status === 404) {
|
|
185
|
+
throw await toServiceException('GET', url, res.response);
|
|
186
|
+
}
|
|
187
|
+
throw await toServiceException('GET', url, res.response);
|
|
188
|
+
}
|
|
189
|
+
async getDestination(scheduleId, destinationId) {
|
|
190
|
+
const result = await this.get(scheduleId);
|
|
191
|
+
const destination = result.destinations.find((d) => d.id === destinationId);
|
|
192
|
+
if (!destination) {
|
|
193
|
+
throw new Error(`Destination not found: ${destinationId}`);
|
|
194
|
+
}
|
|
195
|
+
return destination;
|
|
196
|
+
}
|
|
197
|
+
async getDelivery(scheduleId, deliveryId, params) {
|
|
198
|
+
const result = await this.listDeliveries(scheduleId, params);
|
|
199
|
+
const delivery = result.deliveries.find((d) => d.id === deliveryId);
|
|
200
|
+
if (!delivery) {
|
|
201
|
+
throw new Error(`Delivery not found: ${deliveryId}`);
|
|
202
|
+
}
|
|
203
|
+
return delivery;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=schedule.js.map
|