@agentuity/core 1.0.29 → 1.0.31
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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/services/email.d.ts +507 -8
- package/dist/services/email.d.ts.map +1 -1
- package/dist/services/email.js +325 -1
- package/dist/services/email.js.map +1 -1
- package/dist/services/keyvalue.d.ts +5 -2
- package/dist/services/keyvalue.d.ts.map +1 -1
- package/dist/services/keyvalue.js +44 -1
- package/dist/services/keyvalue.js.map +1 -1
- package/dist/services/queue.d.ts +98 -0
- package/dist/services/queue.d.ts.map +1 -1
- package/dist/services/queue.js +100 -0
- package/dist/services/queue.js.map +1 -1
- package/dist/services/schedule.d.ts +413 -0
- package/dist/services/schedule.d.ts.map +1 -1
- package/dist/services/schedule.js +221 -0
- package/dist/services/schedule.js.map +1 -1
- package/dist/services/task.d.ts +1103 -11
- package/dist/services/task.d.ts.map +1 -1
- package/dist/services/task.js +589 -1
- package/dist/services/task.js.map +1 -1
- package/dist/services/webhook.d.ts +352 -0
- package/dist/services/webhook.d.ts.map +1 -1
- package/dist/services/webhook.js +254 -0
- package/dist/services/webhook.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +8 -0
- package/src/services/email.ts +560 -9
- package/src/services/keyvalue.ts +51 -3
- package/src/services/queue.ts +215 -0
- package/src/services/schedule.ts +442 -0
- package/src/services/task.ts +1329 -23
- package/src/services/webhook.ts +412 -0
package/dist/services/task.d.ts
CHANGED
|
@@ -1,245 +1,1337 @@
|
|
|
1
1
|
import { FetchAdapter } from './adapter.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Priority level for a task, from highest (`'high'`) to no priority (`'none'`).
|
|
4
|
+
*/
|
|
2
5
|
export type TaskPriority = 'high' | 'medium' | 'low' | 'none';
|
|
6
|
+
/**
|
|
7
|
+
* The classification of a task.
|
|
8
|
+
*
|
|
9
|
+
* - `'epic'` — Large initiatives that span multiple features or tasks.
|
|
10
|
+
* - `'feature'` — New capabilities to be built.
|
|
11
|
+
* - `'enhancement'` — Improvements to existing features.
|
|
12
|
+
* - `'bug'` — Defects to be fixed.
|
|
13
|
+
* - `'task'` — General work items.
|
|
14
|
+
*/
|
|
3
15
|
export type TaskType = 'epic' | 'feature' | 'enhancement' | 'bug' | 'task';
|
|
16
|
+
/**
|
|
17
|
+
* The lifecycle status of a task.
|
|
18
|
+
*
|
|
19
|
+
* - `'open'` — Created, not yet started.
|
|
20
|
+
* - `'in_progress'` — Actively being worked on.
|
|
21
|
+
* - `'done'` — Work completed.
|
|
22
|
+
* - `'closed'` — Resolved and closed.
|
|
23
|
+
* - `'cancelled'` — Abandoned.
|
|
24
|
+
*/
|
|
4
25
|
export type TaskStatus = 'open' | 'in_progress' | 'closed' | 'done' | 'cancelled';
|
|
26
|
+
/**
|
|
27
|
+
* A lightweight reference to a user or project entity, containing just the ID
|
|
28
|
+
* and display name. Used for creator, assignee, closer, and project associations.
|
|
29
|
+
*/
|
|
5
30
|
export interface EntityRef {
|
|
31
|
+
/** Unique identifier of the referenced entity. */
|
|
6
32
|
id: string;
|
|
33
|
+
/** Human-readable display name of the entity. */
|
|
7
34
|
name: string;
|
|
8
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The type of user entity.
|
|
38
|
+
*
|
|
39
|
+
* - `'human'` — A human user.
|
|
40
|
+
* - `'agent'` — An AI agent.
|
|
41
|
+
*/
|
|
42
|
+
export type UserType = 'human' | 'agent';
|
|
43
|
+
/**
|
|
44
|
+
* A reference to a user entity with type discrimination.
|
|
45
|
+
* Extends {@link EntityRef} with a {@link UserEntityRef.type | type} field
|
|
46
|
+
* to distinguish between human users and AI agents.
|
|
47
|
+
*/
|
|
48
|
+
export interface UserEntityRef extends EntityRef {
|
|
49
|
+
/**
|
|
50
|
+
* The type of user. Defaults to `'human'` if not specified.
|
|
51
|
+
*
|
|
52
|
+
* @default 'human'
|
|
53
|
+
*/
|
|
54
|
+
type?: UserType;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A work item in the task management system.
|
|
58
|
+
*
|
|
59
|
+
* Tasks can represent epics, features, bugs, enhancements, or generic tasks.
|
|
60
|
+
* They support hierarchical organization via {@link Task.parent_id | parent_id},
|
|
61
|
+
* assignment tracking, and lifecycle management through status transitions.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Status transitions are tracked automatically — when a task moves to a new status,
|
|
65
|
+
* the corresponding date field (e.g., {@link Task.open_date | open_date},
|
|
66
|
+
* {@link Task.in_progress_date | in_progress_date}) is set by the server.
|
|
67
|
+
*/
|
|
9
68
|
export interface Task {
|
|
69
|
+
/** Unique identifier for the task. */
|
|
10
70
|
id: string;
|
|
71
|
+
/** ISO 8601 timestamp when the task was created. */
|
|
11
72
|
created_at: string;
|
|
73
|
+
/** ISO 8601 timestamp when the task was last modified. */
|
|
12
74
|
updated_at: string;
|
|
75
|
+
/**
|
|
76
|
+
* The task title.
|
|
77
|
+
*
|
|
78
|
+
* @remarks Must be non-empty and at most 1024 characters.
|
|
79
|
+
*/
|
|
13
80
|
title: string;
|
|
81
|
+
/**
|
|
82
|
+
* Detailed description of the task.
|
|
83
|
+
*
|
|
84
|
+
* @remarks Maximum 65,536 characters.
|
|
85
|
+
*/
|
|
14
86
|
description?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Arbitrary key-value metadata attached to the task.
|
|
89
|
+
* Can be used for custom fields, integrations, or filtering.
|
|
90
|
+
*/
|
|
15
91
|
metadata?: Record<string, unknown>;
|
|
92
|
+
/** The priority level of the task. */
|
|
16
93
|
priority: TaskPriority;
|
|
94
|
+
/**
|
|
95
|
+
* ID of the parent task, enabling hierarchical task organization
|
|
96
|
+
* (e.g., an epic containing features).
|
|
97
|
+
*/
|
|
17
98
|
parent_id?: string;
|
|
99
|
+
/** The classification of this task. */
|
|
18
100
|
type: TaskType;
|
|
101
|
+
/** The current lifecycle status of the task. */
|
|
19
102
|
status: TaskStatus;
|
|
103
|
+
/** ISO 8601 timestamp when the task was moved to `'open'` status. */
|
|
20
104
|
open_date?: string;
|
|
105
|
+
/** ISO 8601 timestamp when the task was moved to `'in_progress'` status. */
|
|
21
106
|
in_progress_date?: string;
|
|
107
|
+
/** ISO 8601 timestamp when the task was closed. */
|
|
22
108
|
closed_date?: string;
|
|
109
|
+
/**
|
|
110
|
+
* ID of the user who created the task.
|
|
111
|
+
*
|
|
112
|
+
* @remarks Legacy field; prefer {@link Task.creator | creator}.
|
|
113
|
+
*/
|
|
23
114
|
created_id: string;
|
|
115
|
+
/**
|
|
116
|
+
* ID of the user the task is assigned to.
|
|
117
|
+
*
|
|
118
|
+
* @remarks Legacy field; prefer {@link Task.assignee | assignee}.
|
|
119
|
+
*/
|
|
24
120
|
assigned_id?: string;
|
|
121
|
+
/**
|
|
122
|
+
* ID of the user who closed the task.
|
|
123
|
+
*
|
|
124
|
+
* @remarks Legacy field; prefer {@link Task.closer | closer}.
|
|
125
|
+
*/
|
|
25
126
|
closed_id?: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
127
|
+
/** Reference to the user who created the task. */
|
|
128
|
+
creator?: UserEntityRef;
|
|
129
|
+
/** Reference to the user the task is assigned to. */
|
|
130
|
+
assignee?: UserEntityRef;
|
|
131
|
+
/** Reference to the user who closed the task. */
|
|
132
|
+
closer?: UserEntityRef;
|
|
133
|
+
/** Reference to the project this task belongs to. */
|
|
29
134
|
project?: EntityRef;
|
|
135
|
+
/** ISO 8601 timestamp when the task was cancelled. */
|
|
30
136
|
cancelled_date?: string;
|
|
31
|
-
|
|
137
|
+
/** Array of tags associated with this task. */
|
|
32
138
|
tags?: Tag[];
|
|
139
|
+
/** Array of comments on this task. */
|
|
33
140
|
comments?: Comment[];
|
|
34
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* A comment on a task, supporting threaded discussion.
|
|
144
|
+
*/
|
|
35
145
|
export interface Comment {
|
|
146
|
+
/** Unique identifier for the comment. */
|
|
36
147
|
id: string;
|
|
148
|
+
/** ISO 8601 timestamp when the comment was created. */
|
|
37
149
|
created_at: string;
|
|
150
|
+
/** ISO 8601 timestamp when the comment was last edited. */
|
|
38
151
|
updated_at: string;
|
|
152
|
+
/** ID of the task this comment belongs to. */
|
|
39
153
|
task_id: string;
|
|
154
|
+
/** ID of the user who authored the comment. */
|
|
40
155
|
user_id: string;
|
|
41
|
-
author
|
|
156
|
+
/** Reference to the comment author with display name. */
|
|
157
|
+
author?: UserEntityRef;
|
|
158
|
+
/**
|
|
159
|
+
* The comment text content.
|
|
160
|
+
*
|
|
161
|
+
* @remarks Must be non-empty.
|
|
162
|
+
*/
|
|
42
163
|
body: string;
|
|
43
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* A label that can be applied to tasks for categorization and filtering.
|
|
167
|
+
*/
|
|
44
168
|
export interface Tag {
|
|
169
|
+
/** Unique identifier for the tag. */
|
|
45
170
|
id: string;
|
|
171
|
+
/** ISO 8601 timestamp when the tag was created. */
|
|
46
172
|
created_at: string;
|
|
173
|
+
/** Display name of the tag. */
|
|
47
174
|
name: string;
|
|
175
|
+
/**
|
|
176
|
+
* Optional hex color code for the tag.
|
|
177
|
+
*
|
|
178
|
+
* @example '#ff0000'
|
|
179
|
+
*/
|
|
48
180
|
color?: string;
|
|
49
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* A record of a single field change on a task, providing an audit trail.
|
|
184
|
+
*/
|
|
50
185
|
export interface TaskChangelogEntry {
|
|
186
|
+
/** Unique identifier for the changelog entry. */
|
|
51
187
|
id: string;
|
|
188
|
+
/** ISO 8601 timestamp when the change occurred. */
|
|
52
189
|
created_at: string;
|
|
190
|
+
/** ID of the task that was changed. */
|
|
53
191
|
task_id: string;
|
|
192
|
+
/**
|
|
193
|
+
* Name of the field that was changed.
|
|
194
|
+
*
|
|
195
|
+
* @example 'status'
|
|
196
|
+
* @example 'priority'
|
|
197
|
+
* @example 'assigned_id'
|
|
198
|
+
*/
|
|
54
199
|
field: string;
|
|
200
|
+
/** The previous value of the field (as a string), or `undefined` if the field was newly set. */
|
|
55
201
|
old_value?: string;
|
|
202
|
+
/** The new value of the field (as a string), or `undefined` if the field was cleared. */
|
|
56
203
|
new_value?: string;
|
|
57
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Parameters for creating a new task.
|
|
207
|
+
*/
|
|
58
208
|
export interface CreateTaskParams {
|
|
209
|
+
/**
|
|
210
|
+
* The task title (required).
|
|
211
|
+
*
|
|
212
|
+
* @remarks Must be non-empty and at most 1024 characters.
|
|
213
|
+
*/
|
|
59
214
|
title: string;
|
|
215
|
+
/**
|
|
216
|
+
* Detailed description of the task.
|
|
217
|
+
*
|
|
218
|
+
* @remarks Maximum 65,536 characters.
|
|
219
|
+
*/
|
|
60
220
|
description?: string;
|
|
221
|
+
/** Arbitrary key-value metadata. */
|
|
61
222
|
metadata?: Record<string, unknown>;
|
|
223
|
+
/**
|
|
224
|
+
* Priority level. Defaults to `'none'` if not provided.
|
|
225
|
+
*
|
|
226
|
+
* @default 'none'
|
|
227
|
+
*/
|
|
62
228
|
priority?: TaskPriority;
|
|
229
|
+
/** ID of the parent task for hierarchical organization. */
|
|
63
230
|
parent_id?: string;
|
|
231
|
+
/** The task classification (required). */
|
|
64
232
|
type: TaskType;
|
|
233
|
+
/**
|
|
234
|
+
* Initial status. Defaults to `'open'` if not provided.
|
|
235
|
+
*
|
|
236
|
+
* @default 'open'
|
|
237
|
+
*/
|
|
65
238
|
status?: TaskStatus;
|
|
239
|
+
/**
|
|
240
|
+
* ID of the creator.
|
|
241
|
+
*
|
|
242
|
+
* @remarks Legacy field; prefer {@link CreateTaskParams.creator | creator}.
|
|
243
|
+
*/
|
|
66
244
|
created_id: string;
|
|
245
|
+
/**
|
|
246
|
+
* ID of the assigned user.
|
|
247
|
+
*
|
|
248
|
+
* @remarks Legacy field; prefer {@link CreateTaskParams.assignee | assignee}.
|
|
249
|
+
*/
|
|
67
250
|
assigned_id?: string;
|
|
68
|
-
|
|
69
|
-
|
|
251
|
+
/** Reference to the user creating the task (id, name, and optional type). */
|
|
252
|
+
creator?: UserEntityRef;
|
|
253
|
+
/** Reference to the user being assigned the task. */
|
|
254
|
+
assignee?: UserEntityRef;
|
|
255
|
+
/** Reference to the project this task belongs to. */
|
|
70
256
|
project?: EntityRef;
|
|
257
|
+
/** Array of tag IDs to associate with the task at creation. */
|
|
71
258
|
tag_ids?: string[];
|
|
72
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Parameters for partially updating an existing task.
|
|
262
|
+
*
|
|
263
|
+
* @remarks Only provided fields are modified; omitted fields remain unchanged.
|
|
264
|
+
*/
|
|
73
265
|
export interface UpdateTaskParams {
|
|
266
|
+
/**
|
|
267
|
+
* Updated task title.
|
|
268
|
+
*
|
|
269
|
+
* @remarks Must be non-empty and at most 1024 characters if provided.
|
|
270
|
+
*/
|
|
74
271
|
title?: string;
|
|
272
|
+
/**
|
|
273
|
+
* Updated description.
|
|
274
|
+
*
|
|
275
|
+
* @remarks Maximum 65,536 characters.
|
|
276
|
+
*/
|
|
75
277
|
description?: string;
|
|
278
|
+
/** Updated key-value metadata. */
|
|
76
279
|
metadata?: Record<string, unknown>;
|
|
280
|
+
/** Updated priority level. */
|
|
77
281
|
priority?: TaskPriority;
|
|
282
|
+
/** Updated parent task ID. */
|
|
78
283
|
parent_id?: string;
|
|
284
|
+
/** Updated task classification. */
|
|
79
285
|
type?: TaskType;
|
|
286
|
+
/** Updated lifecycle status. */
|
|
80
287
|
status?: TaskStatus;
|
|
288
|
+
/**
|
|
289
|
+
* Updated assigned user ID.
|
|
290
|
+
*
|
|
291
|
+
* @remarks Legacy field; prefer {@link UpdateTaskParams.assignee | assignee}.
|
|
292
|
+
*/
|
|
81
293
|
assigned_id?: string;
|
|
294
|
+
/**
|
|
295
|
+
* ID of the user closing the task.
|
|
296
|
+
*
|
|
297
|
+
* @remarks Legacy field; prefer {@link UpdateTaskParams.closer | closer}.
|
|
298
|
+
*/
|
|
82
299
|
closed_id?: string;
|
|
83
|
-
|
|
84
|
-
|
|
300
|
+
/** Reference to the user being assigned the task. */
|
|
301
|
+
assignee?: UserEntityRef;
|
|
302
|
+
/** Reference to the user closing the task. */
|
|
303
|
+
closer?: UserEntityRef;
|
|
304
|
+
/** Reference to the project this task belongs to. */
|
|
85
305
|
project?: EntityRef;
|
|
86
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Parameters for filtering and paginating the task list.
|
|
309
|
+
*/
|
|
87
310
|
export interface ListTasksParams {
|
|
311
|
+
/** Filter by task status. */
|
|
88
312
|
status?: TaskStatus;
|
|
313
|
+
/** Filter by task type. */
|
|
89
314
|
type?: TaskType;
|
|
315
|
+
/** Filter by priority level. */
|
|
90
316
|
priority?: TaskPriority;
|
|
317
|
+
/** Filter by assigned user ID. */
|
|
91
318
|
assigned_id?: string;
|
|
319
|
+
/** Filter by parent task ID (get subtasks). */
|
|
92
320
|
parent_id?: string;
|
|
321
|
+
/** Filter by project ID. */
|
|
93
322
|
project_id?: string;
|
|
323
|
+
/** Filter by tag ID. */
|
|
94
324
|
tag_id?: string;
|
|
325
|
+
/**
|
|
326
|
+
* Filter for soft-deleted tasks.
|
|
327
|
+
*
|
|
328
|
+
* @default false
|
|
329
|
+
*/
|
|
95
330
|
deleted?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Sort field. Prefix with `-` for descending order.
|
|
333
|
+
*
|
|
334
|
+
* @remarks Supported values: `'created_at'`, `'updated_at'`, `'priority'`.
|
|
335
|
+
* Prefix with `-` for descending (e.g., `'-created_at'`).
|
|
336
|
+
*/
|
|
96
337
|
sort?: string;
|
|
338
|
+
/** Sort direction: `'asc'` or `'desc'`. */
|
|
97
339
|
order?: 'asc' | 'desc';
|
|
340
|
+
/** Maximum number of results to return. */
|
|
98
341
|
limit?: number;
|
|
342
|
+
/** Number of results to skip for pagination. */
|
|
99
343
|
offset?: number;
|
|
100
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Paginated list of tasks with total count.
|
|
347
|
+
*/
|
|
101
348
|
export interface ListTasksResult {
|
|
349
|
+
/** Array of tasks matching the query. */
|
|
102
350
|
tasks: Task[];
|
|
351
|
+
/** Total number of tasks matching the filters (before pagination). */
|
|
103
352
|
total: number;
|
|
353
|
+
/** The limit that was applied. */
|
|
104
354
|
limit: number;
|
|
355
|
+
/** The offset that was applied. */
|
|
105
356
|
offset: number;
|
|
106
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Parameters for batch-deleting tasks by filter.
|
|
360
|
+
* At least one filter must be provided.
|
|
361
|
+
*/
|
|
362
|
+
export interface BatchDeleteTasksParams {
|
|
363
|
+
/** Filter by task status. */
|
|
364
|
+
status?: TaskStatus;
|
|
365
|
+
/** Filter by task type. */
|
|
366
|
+
type?: TaskType;
|
|
367
|
+
/** Filter by priority level. */
|
|
368
|
+
priority?: TaskPriority;
|
|
369
|
+
/** Filter by parent task ID (delete subtasks). */
|
|
370
|
+
parent_id?: string;
|
|
371
|
+
/** Filter by creator ID. */
|
|
372
|
+
created_id?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Delete tasks older than this duration.
|
|
375
|
+
* Accepts Go-style duration strings: `'30m'`, `'24h'`, `'7d'`, `'2w'`.
|
|
376
|
+
*/
|
|
377
|
+
older_than?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Maximum number of tasks to delete.
|
|
380
|
+
* @default 50
|
|
381
|
+
* @maximum 200
|
|
382
|
+
*/
|
|
383
|
+
limit?: number;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* A single task that was deleted in a batch operation.
|
|
387
|
+
*/
|
|
388
|
+
export interface BatchDeletedTask {
|
|
389
|
+
/** The ID of the deleted task. */
|
|
390
|
+
id: string;
|
|
391
|
+
/** The title of the deleted task. */
|
|
392
|
+
title: string;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Result of a batch delete operation.
|
|
396
|
+
*/
|
|
397
|
+
export interface BatchDeleteTasksResult {
|
|
398
|
+
/** Array of tasks that were deleted. */
|
|
399
|
+
deleted: BatchDeletedTask[];
|
|
400
|
+
/** Total number of tasks deleted. */
|
|
401
|
+
count: number;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Paginated list of changelog entries for a task.
|
|
405
|
+
*/
|
|
107
406
|
export interface TaskChangelogResult {
|
|
407
|
+
/** Array of change records. */
|
|
108
408
|
changelog: TaskChangelogEntry[];
|
|
409
|
+
/** Total number of changelog entries. */
|
|
109
410
|
total: number;
|
|
411
|
+
/** Applied limit. */
|
|
110
412
|
limit: number;
|
|
413
|
+
/** Applied offset. */
|
|
111
414
|
offset: number;
|
|
112
415
|
}
|
|
416
|
+
/**
|
|
417
|
+
* Paginated list of comments on a task.
|
|
418
|
+
*/
|
|
113
419
|
export interface ListCommentsResult {
|
|
420
|
+
/** Array of comments. */
|
|
114
421
|
comments: Comment[];
|
|
422
|
+
/** Total number of comments. */
|
|
115
423
|
total: number;
|
|
424
|
+
/** Applied limit. */
|
|
116
425
|
limit: number;
|
|
426
|
+
/** Applied offset. */
|
|
117
427
|
offset: number;
|
|
118
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* List of all tags in the organization.
|
|
431
|
+
*/
|
|
119
432
|
export interface ListTagsResult {
|
|
433
|
+
/** Array of tags. */
|
|
120
434
|
tags: Tag[];
|
|
121
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* A file attachment on a task. Attachments are stored in S3 and accessed via presigned URLs.
|
|
438
|
+
*/
|
|
122
439
|
export interface Attachment {
|
|
440
|
+
/** Unique identifier for the attachment. */
|
|
123
441
|
id: string;
|
|
442
|
+
/** ISO 8601 timestamp when the attachment was uploaded. */
|
|
124
443
|
created_at: string;
|
|
444
|
+
/** ID of the task this attachment belongs to. */
|
|
125
445
|
task_id: string;
|
|
446
|
+
/** ID of the user who uploaded the attachment. */
|
|
126
447
|
user_id: string;
|
|
127
|
-
|
|
448
|
+
/** Reference to the uploader with display name. */
|
|
449
|
+
author?: UserEntityRef;
|
|
450
|
+
/** Original filename of the uploaded file. */
|
|
128
451
|
filename: string;
|
|
452
|
+
/**
|
|
453
|
+
* MIME type of the file.
|
|
454
|
+
*
|
|
455
|
+
* @example 'application/pdf'
|
|
456
|
+
*/
|
|
129
457
|
content_type?: string;
|
|
458
|
+
/** File size in bytes. */
|
|
130
459
|
size?: number;
|
|
131
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* Parameters for initiating a file upload to a task.
|
|
463
|
+
*/
|
|
132
464
|
export interface CreateAttachmentParams {
|
|
465
|
+
/** The filename for the attachment (required). */
|
|
133
466
|
filename: string;
|
|
467
|
+
/** MIME type of the file. */
|
|
134
468
|
content_type?: string;
|
|
469
|
+
/** File size in bytes. */
|
|
135
470
|
size?: number;
|
|
136
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Response from initiating an attachment upload. Contains a presigned S3 URL for direct upload.
|
|
474
|
+
*/
|
|
137
475
|
export interface PresignUploadResponse {
|
|
476
|
+
/** The created attachment record. */
|
|
138
477
|
attachment: Attachment;
|
|
478
|
+
/** A presigned S3 URL to upload the file content via HTTP PUT. */
|
|
139
479
|
presigned_url: string;
|
|
480
|
+
/** Number of seconds until the presigned URL expires. */
|
|
140
481
|
expiry_seconds: number;
|
|
141
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* Response containing a presigned S3 URL for downloading an attachment.
|
|
485
|
+
*/
|
|
142
486
|
export interface PresignDownloadResponse {
|
|
487
|
+
/** A presigned S3 URL to download the file via HTTP GET. */
|
|
143
488
|
presigned_url: string;
|
|
489
|
+
/** Number of seconds until the presigned URL expires. */
|
|
144
490
|
expiry_seconds: number;
|
|
145
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* List of attachments on a task.
|
|
494
|
+
*/
|
|
146
495
|
export interface ListAttachmentsResult {
|
|
496
|
+
/** Array of attachment records. */
|
|
147
497
|
attachments: Attachment[];
|
|
498
|
+
/** Total number of attachments. */
|
|
148
499
|
total: number;
|
|
149
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* List of all users who have been referenced in tasks (as creators, assignees, or closers).
|
|
503
|
+
*/
|
|
150
504
|
export interface ListUsersResult {
|
|
151
|
-
|
|
505
|
+
/** Array of user entity references with type information. */
|
|
506
|
+
users: UserEntityRef[];
|
|
152
507
|
}
|
|
508
|
+
/**
|
|
509
|
+
* List of all projects that have been referenced in tasks.
|
|
510
|
+
*/
|
|
153
511
|
export interface ListProjectsResult {
|
|
512
|
+
/** Array of project entity references. */
|
|
154
513
|
projects: EntityRef[];
|
|
155
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* Parameters for querying task activity time-series data.
|
|
517
|
+
*/
|
|
156
518
|
export interface TaskActivityParams {
|
|
519
|
+
/**
|
|
520
|
+
* Number of days of activity to retrieve.
|
|
521
|
+
*
|
|
522
|
+
* @remarks Minimum 7, maximum 365.
|
|
523
|
+
* @default 90
|
|
524
|
+
*/
|
|
157
525
|
days?: number;
|
|
158
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* A single day's snapshot of task counts by status.
|
|
529
|
+
*/
|
|
159
530
|
export interface TaskActivityDataPoint {
|
|
531
|
+
/**
|
|
532
|
+
* The date in `YYYY-MM-DD` format.
|
|
533
|
+
*
|
|
534
|
+
* @example '2026-02-28'
|
|
535
|
+
*/
|
|
160
536
|
date: string;
|
|
537
|
+
/** Number of tasks in `'open'` status on this date. */
|
|
161
538
|
open: number;
|
|
539
|
+
/** Number of tasks in `'in_progress'` status on this date. */
|
|
162
540
|
inProgress: number;
|
|
541
|
+
/** Number of tasks in `'done'` status on this date. */
|
|
163
542
|
done: number;
|
|
543
|
+
/** Number of tasks in `'closed'` status on this date. */
|
|
164
544
|
closed: number;
|
|
545
|
+
/** Number of tasks in `'cancelled'` status on this date. */
|
|
165
546
|
cancelled: number;
|
|
166
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* Task activity time-series data.
|
|
550
|
+
*/
|
|
167
551
|
export interface TaskActivityResult {
|
|
552
|
+
/** Array of daily activity snapshots, ordered chronologically. */
|
|
168
553
|
activity: TaskActivityDataPoint[];
|
|
554
|
+
/** The number of days of data returned. */
|
|
169
555
|
days: number;
|
|
170
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Interface defining the contract for task storage operations.
|
|
559
|
+
*
|
|
560
|
+
* Implemented by {@link TaskStorageService}.
|
|
561
|
+
*/
|
|
171
562
|
export interface TaskStorage {
|
|
563
|
+
/**
|
|
564
|
+
* Create a new task.
|
|
565
|
+
*
|
|
566
|
+
* @param params - The task creation parameters
|
|
567
|
+
* @returns The newly created task
|
|
568
|
+
*/
|
|
172
569
|
create(params: CreateTaskParams): Promise<Task>;
|
|
570
|
+
/**
|
|
571
|
+
* Get a task by its ID.
|
|
572
|
+
*
|
|
573
|
+
* @param id - The unique task identifier
|
|
574
|
+
* @returns The task if found, or `null` if not found
|
|
575
|
+
*/
|
|
173
576
|
get(id: string): Promise<Task | null>;
|
|
577
|
+
/**
|
|
578
|
+
* List tasks with optional filtering and pagination.
|
|
579
|
+
*
|
|
580
|
+
* @param params - Optional filter and pagination parameters
|
|
581
|
+
* @returns Paginated list of matching tasks
|
|
582
|
+
*/
|
|
174
583
|
list(params?: ListTasksParams): Promise<ListTasksResult>;
|
|
584
|
+
/**
|
|
585
|
+
* Partially update an existing task.
|
|
586
|
+
*
|
|
587
|
+
* @param id - The unique task identifier
|
|
588
|
+
* @param params - Fields to update (only provided fields are changed)
|
|
589
|
+
* @returns The updated task
|
|
590
|
+
*/
|
|
175
591
|
update(id: string, params: UpdateTaskParams): Promise<Task>;
|
|
592
|
+
/**
|
|
593
|
+
* Close a task by setting its status to closed.
|
|
594
|
+
*
|
|
595
|
+
* @param id - The unique task identifier
|
|
596
|
+
* @returns The closed task
|
|
597
|
+
*/
|
|
176
598
|
close(id: string): Promise<Task>;
|
|
599
|
+
/**
|
|
600
|
+
* Soft-delete a task, marking it as deleted without permanent removal.
|
|
601
|
+
*
|
|
602
|
+
* @param id - The unique task identifier
|
|
603
|
+
* @returns The soft-deleted task
|
|
604
|
+
*/
|
|
177
605
|
softDelete(id: string): Promise<Task>;
|
|
606
|
+
/**
|
|
607
|
+
* Batch soft-delete tasks matching the given filters.
|
|
608
|
+
* At least one filter must be provided.
|
|
609
|
+
*
|
|
610
|
+
* @param params - Filters to select which tasks to delete
|
|
611
|
+
* @returns The list of deleted tasks and count
|
|
612
|
+
*/
|
|
613
|
+
batchDelete(params: BatchDeleteTasksParams): Promise<BatchDeleteTasksResult>;
|
|
614
|
+
/**
|
|
615
|
+
* Get the changelog (audit trail) for a task.
|
|
616
|
+
*
|
|
617
|
+
* @param id - The unique task identifier
|
|
618
|
+
* @param params - Optional pagination parameters
|
|
619
|
+
* @returns Paginated list of changelog entries
|
|
620
|
+
*/
|
|
178
621
|
changelog(id: string, params?: {
|
|
179
622
|
limit?: number;
|
|
180
623
|
offset?: number;
|
|
181
624
|
}): Promise<TaskChangelogResult>;
|
|
625
|
+
/**
|
|
626
|
+
* Create a comment on a task.
|
|
627
|
+
*
|
|
628
|
+
* @param taskId - The ID of the task to comment on
|
|
629
|
+
* @param body - The comment text content
|
|
630
|
+
* @param userId - The ID of the user authoring the comment
|
|
631
|
+
* @param author - Optional entity reference with display name
|
|
632
|
+
* @returns The newly created comment
|
|
633
|
+
*/
|
|
182
634
|
createComment(taskId: string, body: string, userId: string, author?: EntityRef): Promise<Comment>;
|
|
635
|
+
/**
|
|
636
|
+
* Get a comment by its ID.
|
|
637
|
+
*
|
|
638
|
+
* @param commentId - The unique comment identifier
|
|
639
|
+
* @returns The comment
|
|
640
|
+
*/
|
|
183
641
|
getComment(commentId: string): Promise<Comment>;
|
|
642
|
+
/**
|
|
643
|
+
* Update a comment's body text.
|
|
644
|
+
*
|
|
645
|
+
* @param commentId - The unique comment identifier
|
|
646
|
+
* @param body - The new comment text
|
|
647
|
+
* @returns The updated comment
|
|
648
|
+
*/
|
|
184
649
|
updateComment(commentId: string, body: string): Promise<Comment>;
|
|
650
|
+
/**
|
|
651
|
+
* Delete a comment.
|
|
652
|
+
*
|
|
653
|
+
* @param commentId - The unique comment identifier
|
|
654
|
+
*/
|
|
185
655
|
deleteComment(commentId: string): Promise<void>;
|
|
656
|
+
/**
|
|
657
|
+
* List comments on a task with optional pagination.
|
|
658
|
+
*
|
|
659
|
+
* @param taskId - The ID of the task
|
|
660
|
+
* @param params - Optional pagination parameters
|
|
661
|
+
* @returns Paginated list of comments
|
|
662
|
+
*/
|
|
186
663
|
listComments(taskId: string, params?: {
|
|
187
664
|
limit?: number;
|
|
188
665
|
offset?: number;
|
|
189
666
|
}): Promise<ListCommentsResult>;
|
|
667
|
+
/**
|
|
668
|
+
* Create a new tag.
|
|
669
|
+
*
|
|
670
|
+
* @param name - The tag display name
|
|
671
|
+
* @param color - Optional hex color code (e.g., `'#ff0000'`)
|
|
672
|
+
* @returns The newly created tag
|
|
673
|
+
*/
|
|
190
674
|
createTag(name: string, color?: string): Promise<Tag>;
|
|
675
|
+
/**
|
|
676
|
+
* Get a tag by its ID.
|
|
677
|
+
*
|
|
678
|
+
* @param tagId - The unique tag identifier
|
|
679
|
+
* @returns The tag
|
|
680
|
+
*/
|
|
191
681
|
getTag(tagId: string): Promise<Tag>;
|
|
682
|
+
/**
|
|
683
|
+
* Update a tag's name and optionally its color.
|
|
684
|
+
*
|
|
685
|
+
* @param tagId - The unique tag identifier
|
|
686
|
+
* @param name - The new tag name
|
|
687
|
+
* @param color - Optional new hex color code
|
|
688
|
+
* @returns The updated tag
|
|
689
|
+
*/
|
|
192
690
|
updateTag(tagId: string, name: string, color?: string): Promise<Tag>;
|
|
691
|
+
/**
|
|
692
|
+
* Delete a tag.
|
|
693
|
+
*
|
|
694
|
+
* @param tagId - The unique tag identifier
|
|
695
|
+
*/
|
|
193
696
|
deleteTag(tagId: string): Promise<void>;
|
|
697
|
+
/**
|
|
698
|
+
* List all tags in the organization.
|
|
699
|
+
*
|
|
700
|
+
* @returns List of all tags
|
|
701
|
+
*/
|
|
194
702
|
listTags(): Promise<ListTagsResult>;
|
|
703
|
+
/**
|
|
704
|
+
* Associate a tag with a task.
|
|
705
|
+
*
|
|
706
|
+
* @param taskId - The ID of the task
|
|
707
|
+
* @param tagId - The ID of the tag to add
|
|
708
|
+
*/
|
|
195
709
|
addTagToTask(taskId: string, tagId: string): Promise<void>;
|
|
710
|
+
/**
|
|
711
|
+
* Remove a tag association from a task.
|
|
712
|
+
*
|
|
713
|
+
* @param taskId - The ID of the task
|
|
714
|
+
* @param tagId - The ID of the tag to remove
|
|
715
|
+
*/
|
|
196
716
|
removeTagFromTask(taskId: string, tagId: string): Promise<void>;
|
|
717
|
+
/**
|
|
718
|
+
* List all tags associated with a specific task.
|
|
719
|
+
*
|
|
720
|
+
* @param taskId - The ID of the task
|
|
721
|
+
* @returns Array of tags on the task
|
|
722
|
+
*/
|
|
197
723
|
listTagsForTask(taskId: string): Promise<Tag[]>;
|
|
724
|
+
/**
|
|
725
|
+
* Initiate a file upload to a task. Returns a presigned S3 URL for direct upload.
|
|
726
|
+
*
|
|
727
|
+
* @param taskId - The ID of the task to attach the file to
|
|
728
|
+
* @param params - Attachment metadata (filename, content type, size)
|
|
729
|
+
* @returns The attachment record and a presigned upload URL
|
|
730
|
+
*/
|
|
198
731
|
uploadAttachment(taskId: string, params: CreateAttachmentParams): Promise<PresignUploadResponse>;
|
|
732
|
+
/**
|
|
733
|
+
* Confirm that a file upload has completed successfully.
|
|
734
|
+
*
|
|
735
|
+
* @param attachmentId - The unique attachment identifier
|
|
736
|
+
* @returns The confirmed attachment record
|
|
737
|
+
*/
|
|
199
738
|
confirmAttachment(attachmentId: string): Promise<Attachment>;
|
|
739
|
+
/**
|
|
740
|
+
* Get a presigned S3 URL for downloading an attachment.
|
|
741
|
+
*
|
|
742
|
+
* @param attachmentId - The unique attachment identifier
|
|
743
|
+
* @returns A presigned download URL
|
|
744
|
+
*/
|
|
200
745
|
downloadAttachment(attachmentId: string): Promise<PresignDownloadResponse>;
|
|
746
|
+
/**
|
|
747
|
+
* List all attachments on a task.
|
|
748
|
+
*
|
|
749
|
+
* @param taskId - The ID of the task
|
|
750
|
+
* @returns List of attachments with total count
|
|
751
|
+
*/
|
|
201
752
|
listAttachments(taskId: string): Promise<ListAttachmentsResult>;
|
|
753
|
+
/**
|
|
754
|
+
* Delete an attachment.
|
|
755
|
+
*
|
|
756
|
+
* @param attachmentId - The unique attachment identifier
|
|
757
|
+
*/
|
|
202
758
|
deleteAttachment(attachmentId: string): Promise<void>;
|
|
759
|
+
/**
|
|
760
|
+
* List all users who have been referenced in tasks.
|
|
761
|
+
*
|
|
762
|
+
* @returns List of user entity references
|
|
763
|
+
*/
|
|
203
764
|
listUsers(): Promise<ListUsersResult>;
|
|
765
|
+
/**
|
|
766
|
+
* List all projects that have been referenced in tasks.
|
|
767
|
+
*
|
|
768
|
+
* @returns List of project entity references
|
|
769
|
+
*/
|
|
204
770
|
listProjects(): Promise<ListProjectsResult>;
|
|
771
|
+
/**
|
|
772
|
+
* Get task activity time-series data showing daily status counts.
|
|
773
|
+
*
|
|
774
|
+
* @param params - Optional parameters controlling the number of days to retrieve
|
|
775
|
+
* @returns Time-series activity data
|
|
776
|
+
*/
|
|
205
777
|
getActivity(params?: TaskActivityParams): Promise<TaskActivityResult>;
|
|
206
778
|
}
|
|
779
|
+
/**
|
|
780
|
+
* Client for the Agentuity Task management service.
|
|
781
|
+
*
|
|
782
|
+
* Provides a full-featured project management API including task CRUD, hierarchical
|
|
783
|
+
* organization (epics → features → tasks), comments, tags, file attachments via
|
|
784
|
+
* presigned S3 URLs, changelog tracking, and activity analytics.
|
|
785
|
+
*
|
|
786
|
+
* Tasks support lifecycle management through status transitions (`open` → `in_progress`
|
|
787
|
+
* → `done`/`closed`/`cancelled`) with automatic date tracking for each transition.
|
|
788
|
+
*
|
|
789
|
+
* All methods validate inputs client-side and throw structured errors for invalid
|
|
790
|
+
* parameters. API errors throw {@link ServiceException}.
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* ```typescript
|
|
794
|
+
* const tasks = new TaskStorageService(baseUrl, adapter);
|
|
795
|
+
*
|
|
796
|
+
* // Create a task
|
|
797
|
+
* const task = await tasks.create({
|
|
798
|
+
* title: 'Implement login flow',
|
|
799
|
+
* type: 'feature',
|
|
800
|
+
* created_id: 'user_123',
|
|
801
|
+
* creator: { id: 'user_123', name: 'Alice' },
|
|
802
|
+
* priority: 'high',
|
|
803
|
+
* });
|
|
804
|
+
*
|
|
805
|
+
* // Add a comment
|
|
806
|
+
* await tasks.createComment(task.id, 'Started working on this', 'user_123');
|
|
807
|
+
*
|
|
808
|
+
* // List open tasks
|
|
809
|
+
* const { tasks: openTasks } = await tasks.list({ status: 'open' });
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
207
812
|
export declare class TaskStorageService implements TaskStorage {
|
|
208
813
|
#private;
|
|
814
|
+
/**
|
|
815
|
+
* Creates a new TaskStorageService instance.
|
|
816
|
+
*
|
|
817
|
+
* @param baseUrl - The base URL of the task management API
|
|
818
|
+
* @param adapter - The HTTP fetch adapter used for making API requests
|
|
819
|
+
*/
|
|
209
820
|
constructor(baseUrl: string, adapter: FetchAdapter);
|
|
821
|
+
/**
|
|
822
|
+
* Create a new task.
|
|
823
|
+
*
|
|
824
|
+
* @param params - The task creation parameters including title, type, and optional fields
|
|
825
|
+
* @returns The newly created task
|
|
826
|
+
* @throws {@link TaskTitleRequiredError} if the title is empty or not a string
|
|
827
|
+
* @throws {@link ServiceException} if the API request fails
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* ```typescript
|
|
831
|
+
* const task = await tasks.create({
|
|
832
|
+
* title: 'Fix login bug',
|
|
833
|
+
* type: 'bug',
|
|
834
|
+
* created_id: 'user_123',
|
|
835
|
+
* priority: 'high',
|
|
836
|
+
* creator: { id: 'user_123', name: 'Alice' },
|
|
837
|
+
* project: { id: 'proj_456', name: 'Auth Service' },
|
|
838
|
+
* });
|
|
839
|
+
* console.log('Created:', task.id);
|
|
840
|
+
* ```
|
|
841
|
+
*/
|
|
210
842
|
create(params: CreateTaskParams): Promise<Task>;
|
|
843
|
+
/**
|
|
844
|
+
* Get a task by its ID.
|
|
845
|
+
*
|
|
846
|
+
* @param id - The unique task identifier
|
|
847
|
+
* @returns The task if found, or `null` if the task does not exist
|
|
848
|
+
* @throws {@link TaskIdRequiredError} if the ID is empty or not a string
|
|
849
|
+
* @throws {@link ServiceException} if the API request fails
|
|
850
|
+
*
|
|
851
|
+
* @example
|
|
852
|
+
* ```typescript
|
|
853
|
+
* const task = await tasks.get('task_abc123');
|
|
854
|
+
* if (task) {
|
|
855
|
+
* console.log(task.title, task.status);
|
|
856
|
+
* } else {
|
|
857
|
+
* console.log('Task not found');
|
|
858
|
+
* }
|
|
859
|
+
* ```
|
|
860
|
+
*/
|
|
211
861
|
get(id: string): Promise<Task | null>;
|
|
862
|
+
/**
|
|
863
|
+
* List tasks with optional filtering and pagination.
|
|
864
|
+
*
|
|
865
|
+
* @param params - Optional filter and pagination parameters
|
|
866
|
+
* @returns Paginated list of tasks matching the filters
|
|
867
|
+
* @throws {@link ServiceException} if the API request fails
|
|
868
|
+
*
|
|
869
|
+
* @example
|
|
870
|
+
* ```typescript
|
|
871
|
+
* // List all open high-priority bugs
|
|
872
|
+
* const result = await tasks.list({
|
|
873
|
+
* status: 'open',
|
|
874
|
+
* type: 'bug',
|
|
875
|
+
* priority: 'high',
|
|
876
|
+
* sort: '-created_at',
|
|
877
|
+
* limit: 20,
|
|
878
|
+
* });
|
|
879
|
+
* console.log(`Found ${result.total} bugs, showing ${result.tasks.length}`);
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
212
882
|
list(params?: ListTasksParams): Promise<ListTasksResult>;
|
|
883
|
+
/**
|
|
884
|
+
* Partially update an existing task.
|
|
885
|
+
*
|
|
886
|
+
* @param id - The unique task identifier
|
|
887
|
+
* @param params - Fields to update; only provided fields are changed
|
|
888
|
+
* @returns The updated task
|
|
889
|
+
* @throws {@link TaskIdRequiredError} if the ID is empty or not a string
|
|
890
|
+
* @throws {@link TaskTitleRequiredError} if a title is provided but is empty
|
|
891
|
+
* @throws {@link ServiceException} if the API request fails
|
|
892
|
+
*
|
|
893
|
+
* @example
|
|
894
|
+
* ```typescript
|
|
895
|
+
* const updated = await tasks.update('task_abc123', {
|
|
896
|
+
* status: 'in_progress',
|
|
897
|
+
* priority: 'high',
|
|
898
|
+
* assignee: { id: 'user_456', name: 'Bob' },
|
|
899
|
+
* });
|
|
900
|
+
* console.log('Updated status:', updated.status);
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
213
903
|
update(id: string, params: UpdateTaskParams): Promise<Task>;
|
|
904
|
+
/**
|
|
905
|
+
* Close a task by setting its status to closed.
|
|
906
|
+
*
|
|
907
|
+
* @param id - The unique task identifier
|
|
908
|
+
* @returns The closed task with updated `closed_date`
|
|
909
|
+
* @throws {@link TaskIdRequiredError} if the ID is empty or not a string
|
|
910
|
+
* @throws {@link ServiceException} if the API request fails
|
|
911
|
+
*
|
|
912
|
+
* @example
|
|
913
|
+
* ```typescript
|
|
914
|
+
* const closed = await tasks.close('task_abc123');
|
|
915
|
+
* console.log('Closed at:', closed.closed_date);
|
|
916
|
+
* ```
|
|
917
|
+
*/
|
|
214
918
|
close(id: string): Promise<Task>;
|
|
919
|
+
/**
|
|
920
|
+
* Get the changelog (audit trail) for a task, showing all field changes over time.
|
|
921
|
+
*
|
|
922
|
+
* @param id - The unique task identifier
|
|
923
|
+
* @param params - Optional pagination parameters
|
|
924
|
+
* @returns Paginated list of changelog entries ordered by most recent first
|
|
925
|
+
* @throws {@link TaskIdRequiredError} if the ID is empty or not a string
|
|
926
|
+
* @throws {@link ServiceException} if the API request fails
|
|
927
|
+
*
|
|
928
|
+
* @example
|
|
929
|
+
* ```typescript
|
|
930
|
+
* const { changelog, total } = await tasks.changelog('task_abc123', {
|
|
931
|
+
* limit: 10,
|
|
932
|
+
* offset: 0,
|
|
933
|
+
* });
|
|
934
|
+
* for (const entry of changelog) {
|
|
935
|
+
* console.log(`${entry.field}: ${entry.old_value} → ${entry.new_value}`);
|
|
936
|
+
* }
|
|
937
|
+
* ```
|
|
938
|
+
*/
|
|
215
939
|
changelog(id: string, params?: {
|
|
216
940
|
limit?: number;
|
|
217
941
|
offset?: number;
|
|
218
942
|
}): Promise<TaskChangelogResult>;
|
|
943
|
+
/**
|
|
944
|
+
* Soft-delete a task, marking it as deleted without permanent removal.
|
|
945
|
+
*
|
|
946
|
+
* @param id - The unique task identifier
|
|
947
|
+
* @returns The soft-deleted task
|
|
948
|
+
* @throws {@link TaskIdRequiredError} if the ID is empty or not a string
|
|
949
|
+
* @throws {@link ServiceException} if the API request fails
|
|
950
|
+
*
|
|
951
|
+
* @example
|
|
952
|
+
* ```typescript
|
|
953
|
+
* const deleted = await tasks.softDelete('task_abc123');
|
|
954
|
+
* console.log('Soft-deleted task:', deleted.id);
|
|
955
|
+
* ```
|
|
956
|
+
*/
|
|
219
957
|
softDelete(id: string): Promise<Task>;
|
|
958
|
+
/**
|
|
959
|
+
* Batch soft-delete tasks matching the given filters.
|
|
960
|
+
* At least one filter must be provided. The server caps the limit at 200.
|
|
961
|
+
*
|
|
962
|
+
* @param params - Filters to select which tasks to delete
|
|
963
|
+
* @returns The list of deleted tasks and count
|
|
964
|
+
* @throws {@link ServiceException} if the API request fails
|
|
965
|
+
*
|
|
966
|
+
* @example
|
|
967
|
+
* ```typescript
|
|
968
|
+
* const result = await tasks.batchDelete({ status: 'closed', older_than: '7d', limit: 50 });
|
|
969
|
+
* console.log(`Deleted ${result.count} tasks`);
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
batchDelete(params: BatchDeleteTasksParams): Promise<BatchDeleteTasksResult>;
|
|
973
|
+
/**
|
|
974
|
+
* Create a comment on a task.
|
|
975
|
+
*
|
|
976
|
+
* @param taskId - The ID of the task to comment on
|
|
977
|
+
* @param body - The comment text content (must be non-empty)
|
|
978
|
+
* @param userId - The ID of the user authoring the comment
|
|
979
|
+
* @param author - Optional entity reference with the author's display name
|
|
980
|
+
* @returns The newly created comment
|
|
981
|
+
* @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
|
|
982
|
+
* @throws {@link CommentBodyRequiredError} if the body is empty or not a string
|
|
983
|
+
* @throws {@link UserIdRequiredError} if the user ID is empty or not a string
|
|
984
|
+
* @throws {@link ServiceException} if the API request fails
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```typescript
|
|
988
|
+
* const comment = await tasks.createComment(
|
|
989
|
+
* 'task_abc123',
|
|
990
|
+
* 'This is ready for review.',
|
|
991
|
+
* 'user_456',
|
|
992
|
+
* { id: 'user_456', name: 'Bob' },
|
|
993
|
+
* );
|
|
994
|
+
* console.log('Comment created:', comment.id);
|
|
995
|
+
* ```
|
|
996
|
+
*/
|
|
220
997
|
createComment(taskId: string, body: string, userId: string, author?: EntityRef): Promise<Comment>;
|
|
998
|
+
/**
|
|
999
|
+
* Get a comment by its ID.
|
|
1000
|
+
*
|
|
1001
|
+
* @param commentId - The unique comment identifier
|
|
1002
|
+
* @returns The comment
|
|
1003
|
+
* @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
|
|
1004
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1005
|
+
*
|
|
1006
|
+
* @example
|
|
1007
|
+
* ```typescript
|
|
1008
|
+
* const comment = await tasks.getComment('comment_xyz789');
|
|
1009
|
+
* console.log(`${comment.author?.name}: ${comment.body}`);
|
|
1010
|
+
* ```
|
|
1011
|
+
*/
|
|
221
1012
|
getComment(commentId: string): Promise<Comment>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Update a comment's body text.
|
|
1015
|
+
*
|
|
1016
|
+
* @param commentId - The unique comment identifier
|
|
1017
|
+
* @param body - The new comment text (must be non-empty)
|
|
1018
|
+
* @returns The updated comment
|
|
1019
|
+
* @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
|
|
1020
|
+
* @throws {@link CommentBodyRequiredError} if the body is empty or not a string
|
|
1021
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```typescript
|
|
1025
|
+
* const updated = await tasks.updateComment(
|
|
1026
|
+
* 'comment_xyz789',
|
|
1027
|
+
* 'Updated: This is now ready for final review.',
|
|
1028
|
+
* );
|
|
1029
|
+
* console.log('Updated at:', updated.updated_at);
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
222
1032
|
updateComment(commentId: string, body: string): Promise<Comment>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Delete a comment permanently.
|
|
1035
|
+
*
|
|
1036
|
+
* @param commentId - The unique comment identifier
|
|
1037
|
+
* @throws {@link CommentIdRequiredError} if the comment ID is empty or not a string
|
|
1038
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* ```typescript
|
|
1042
|
+
* await tasks.deleteComment('comment_xyz789');
|
|
1043
|
+
* console.log('Comment deleted');
|
|
1044
|
+
* ```
|
|
1045
|
+
*/
|
|
223
1046
|
deleteComment(commentId: string): Promise<void>;
|
|
1047
|
+
/**
|
|
1048
|
+
* List comments on a task with optional pagination.
|
|
1049
|
+
*
|
|
1050
|
+
* @param taskId - The ID of the task whose comments to list
|
|
1051
|
+
* @param params - Optional pagination parameters
|
|
1052
|
+
* @returns Paginated list of comments
|
|
1053
|
+
* @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
|
|
1054
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1055
|
+
*
|
|
1056
|
+
* @example
|
|
1057
|
+
* ```typescript
|
|
1058
|
+
* const { comments, total } = await tasks.listComments('task_abc123', {
|
|
1059
|
+
* limit: 25,
|
|
1060
|
+
* offset: 0,
|
|
1061
|
+
* });
|
|
1062
|
+
* for (const c of comments) {
|
|
1063
|
+
* console.log(`${c.author?.name}: ${c.body}`);
|
|
1064
|
+
* }
|
|
1065
|
+
* ```
|
|
1066
|
+
*/
|
|
224
1067
|
listComments(taskId: string, params?: {
|
|
225
1068
|
limit?: number;
|
|
226
1069
|
offset?: number;
|
|
227
1070
|
}): Promise<ListCommentsResult>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Create a new tag for categorizing tasks.
|
|
1073
|
+
*
|
|
1074
|
+
* @param name - The tag display name (must be non-empty)
|
|
1075
|
+
* @param color - Optional hex color code (e.g., `'#ff0000'`)
|
|
1076
|
+
* @returns The newly created tag
|
|
1077
|
+
* @throws {@link TagNameRequiredError} if the name is empty or not a string
|
|
1078
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1079
|
+
*
|
|
1080
|
+
* @example
|
|
1081
|
+
* ```typescript
|
|
1082
|
+
* const tag = await tasks.createTag('urgent', '#ff0000');
|
|
1083
|
+
* console.log('Created tag:', tag.id, tag.name);
|
|
1084
|
+
* ```
|
|
1085
|
+
*/
|
|
228
1086
|
createTag(name: string, color?: string): Promise<Tag>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Get a tag by its ID.
|
|
1089
|
+
*
|
|
1090
|
+
* @param tagId - The unique tag identifier
|
|
1091
|
+
* @returns The tag
|
|
1092
|
+
* @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
|
|
1093
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* ```typescript
|
|
1097
|
+
* const tag = await tasks.getTag('tag_def456');
|
|
1098
|
+
* console.log(`${tag.name} (${tag.color})`);
|
|
1099
|
+
* ```
|
|
1100
|
+
*/
|
|
229
1101
|
getTag(tagId: string): Promise<Tag>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Update a tag's name and optionally its color.
|
|
1104
|
+
*
|
|
1105
|
+
* @param tagId - The unique tag identifier
|
|
1106
|
+
* @param name - The new tag name (must be non-empty)
|
|
1107
|
+
* @param color - Optional new hex color code
|
|
1108
|
+
* @returns The updated tag
|
|
1109
|
+
* @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
|
|
1110
|
+
* @throws {@link TagNameRequiredError} if the name is empty or not a string
|
|
1111
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* ```typescript
|
|
1115
|
+
* const updated = await tasks.updateTag('tag_def456', 'critical', '#cc0000');
|
|
1116
|
+
* console.log('Updated:', updated.name);
|
|
1117
|
+
* ```
|
|
1118
|
+
*/
|
|
230
1119
|
updateTag(tagId: string, name: string, color?: string): Promise<Tag>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Delete a tag permanently.
|
|
1122
|
+
*
|
|
1123
|
+
* @param tagId - The unique tag identifier
|
|
1124
|
+
* @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
|
|
1125
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1126
|
+
*
|
|
1127
|
+
* @example
|
|
1128
|
+
* ```typescript
|
|
1129
|
+
* await tasks.deleteTag('tag_def456');
|
|
1130
|
+
* console.log('Tag deleted');
|
|
1131
|
+
* ```
|
|
1132
|
+
*/
|
|
231
1133
|
deleteTag(tagId: string): Promise<void>;
|
|
1134
|
+
/**
|
|
1135
|
+
* List all tags in the organization.
|
|
1136
|
+
*
|
|
1137
|
+
* @returns List of all tags
|
|
1138
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1139
|
+
*
|
|
1140
|
+
* @example
|
|
1141
|
+
* ```typescript
|
|
1142
|
+
* const { tags } = await tasks.listTags();
|
|
1143
|
+
* for (const tag of tags) {
|
|
1144
|
+
* console.log(`${tag.name} (${tag.color ?? 'no color'})`);
|
|
1145
|
+
* }
|
|
1146
|
+
* ```
|
|
1147
|
+
*/
|
|
232
1148
|
listTags(): Promise<ListTagsResult>;
|
|
1149
|
+
/**
|
|
1150
|
+
* Associate a tag with a task.
|
|
1151
|
+
*
|
|
1152
|
+
* @param taskId - The ID of the task
|
|
1153
|
+
* @param tagId - The ID of the tag to add
|
|
1154
|
+
* @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
|
|
1155
|
+
* @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
|
|
1156
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1157
|
+
*
|
|
1158
|
+
* @example
|
|
1159
|
+
* ```typescript
|
|
1160
|
+
* await tasks.addTagToTask('task_abc123', 'tag_def456');
|
|
1161
|
+
* console.log('Tag added to task');
|
|
1162
|
+
* ```
|
|
1163
|
+
*/
|
|
233
1164
|
addTagToTask(taskId: string, tagId: string): Promise<void>;
|
|
1165
|
+
/**
|
|
1166
|
+
* Remove a tag association from a task.
|
|
1167
|
+
*
|
|
1168
|
+
* @param taskId - The ID of the task
|
|
1169
|
+
* @param tagId - The ID of the tag to remove
|
|
1170
|
+
* @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
|
|
1171
|
+
* @throws {@link TagIdRequiredError} if the tag ID is empty or not a string
|
|
1172
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1173
|
+
*
|
|
1174
|
+
* @example
|
|
1175
|
+
* ```typescript
|
|
1176
|
+
* await tasks.removeTagFromTask('task_abc123', 'tag_def456');
|
|
1177
|
+
* console.log('Tag removed from task');
|
|
1178
|
+
* ```
|
|
1179
|
+
*/
|
|
234
1180
|
removeTagFromTask(taskId: string, tagId: string): Promise<void>;
|
|
1181
|
+
/**
|
|
1182
|
+
* List all tags associated with a specific task.
|
|
1183
|
+
*
|
|
1184
|
+
* @param taskId - The ID of the task
|
|
1185
|
+
* @returns Array of tags on the task
|
|
1186
|
+
* @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
|
|
1187
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1188
|
+
*
|
|
1189
|
+
* @example
|
|
1190
|
+
* ```typescript
|
|
1191
|
+
* const tags = await tasks.listTagsForTask('task_abc123');
|
|
1192
|
+
* console.log('Tags:', tags.map((t) => t.name).join(', '));
|
|
1193
|
+
* ```
|
|
1194
|
+
*/
|
|
235
1195
|
listTagsForTask(taskId: string): Promise<Tag[]>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Initiate a file upload to a task. Returns a presigned S3 URL for direct upload.
|
|
1198
|
+
*
|
|
1199
|
+
* @remarks
|
|
1200
|
+
* After receiving the presigned URL, upload the file content via HTTP PUT to that URL.
|
|
1201
|
+
* Then call {@link TaskStorageService.confirmAttachment | confirmAttachment} to finalize.
|
|
1202
|
+
*
|
|
1203
|
+
* @param taskId - The ID of the task to attach the file to
|
|
1204
|
+
* @param params - Attachment metadata including filename, content type, and size
|
|
1205
|
+
* @returns The created attachment record and a presigned upload URL
|
|
1206
|
+
* @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
|
|
1207
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```typescript
|
|
1211
|
+
* const { attachment, presigned_url } = await tasks.uploadAttachment(
|
|
1212
|
+
* 'task_abc123',
|
|
1213
|
+
* { filename: 'report.pdf', content_type: 'application/pdf', size: 102400 },
|
|
1214
|
+
* );
|
|
1215
|
+
*
|
|
1216
|
+
* // Upload the file to S3
|
|
1217
|
+
* await fetch(presigned_url, { method: 'PUT', body: fileContent });
|
|
1218
|
+
*
|
|
1219
|
+
* // Confirm the upload
|
|
1220
|
+
* await tasks.confirmAttachment(attachment.id);
|
|
1221
|
+
* ```
|
|
1222
|
+
*/
|
|
236
1223
|
uploadAttachment(taskId: string, params: CreateAttachmentParams): Promise<PresignUploadResponse>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Confirm that a file upload has completed successfully.
|
|
1226
|
+
*
|
|
1227
|
+
* @remarks
|
|
1228
|
+
* Call this after successfully uploading the file to the presigned URL
|
|
1229
|
+
* returned by {@link TaskStorageService.uploadAttachment | uploadAttachment}.
|
|
1230
|
+
*
|
|
1231
|
+
* @param attachmentId - The unique attachment identifier
|
|
1232
|
+
* @returns The confirmed attachment record
|
|
1233
|
+
* @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
|
|
1234
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1235
|
+
*
|
|
1236
|
+
* @example
|
|
1237
|
+
* ```typescript
|
|
1238
|
+
* const confirmed = await tasks.confirmAttachment('att_ghi789');
|
|
1239
|
+
* console.log('Confirmed:', confirmed.filename);
|
|
1240
|
+
* ```
|
|
1241
|
+
*/
|
|
237
1242
|
confirmAttachment(attachmentId: string): Promise<Attachment>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Get a presigned S3 URL for downloading an attachment.
|
|
1245
|
+
*
|
|
1246
|
+
* @param attachmentId - The unique attachment identifier
|
|
1247
|
+
* @returns A presigned download URL with expiry information
|
|
1248
|
+
* @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
|
|
1249
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1250
|
+
*
|
|
1251
|
+
* @example
|
|
1252
|
+
* ```typescript
|
|
1253
|
+
* const { presigned_url, expiry_seconds } = await tasks.downloadAttachment('att_ghi789');
|
|
1254
|
+
* console.log(`Download URL (expires in ${expiry_seconds}s):`, presigned_url);
|
|
1255
|
+
* ```
|
|
1256
|
+
*/
|
|
238
1257
|
downloadAttachment(attachmentId: string): Promise<PresignDownloadResponse>;
|
|
1258
|
+
/**
|
|
1259
|
+
* List all attachments on a task.
|
|
1260
|
+
*
|
|
1261
|
+
* @param taskId - The ID of the task
|
|
1262
|
+
* @returns List of attachments with total count
|
|
1263
|
+
* @throws {@link TaskIdRequiredError} if the task ID is empty or not a string
|
|
1264
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1265
|
+
*
|
|
1266
|
+
* @example
|
|
1267
|
+
* ```typescript
|
|
1268
|
+
* const { attachments, total } = await tasks.listAttachments('task_abc123');
|
|
1269
|
+
* for (const att of attachments) {
|
|
1270
|
+
* console.log(`${att.filename} (${att.content_type}, ${att.size} bytes)`);
|
|
1271
|
+
* }
|
|
1272
|
+
* ```
|
|
1273
|
+
*/
|
|
239
1274
|
listAttachments(taskId: string): Promise<ListAttachmentsResult>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Delete an attachment permanently.
|
|
1277
|
+
*
|
|
1278
|
+
* @param attachmentId - The unique attachment identifier
|
|
1279
|
+
* @throws {@link AttachmentIdRequiredError} if the attachment ID is empty or not a string
|
|
1280
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1281
|
+
*
|
|
1282
|
+
* @example
|
|
1283
|
+
* ```typescript
|
|
1284
|
+
* await tasks.deleteAttachment('att_ghi789');
|
|
1285
|
+
* console.log('Attachment deleted');
|
|
1286
|
+
* ```
|
|
1287
|
+
*/
|
|
240
1288
|
deleteAttachment(attachmentId: string): Promise<void>;
|
|
1289
|
+
/**
|
|
1290
|
+
* List all users who have been referenced in tasks (as creators, assignees, or closers).
|
|
1291
|
+
*
|
|
1292
|
+
* @returns List of user entity references
|
|
1293
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1294
|
+
*
|
|
1295
|
+
* @example
|
|
1296
|
+
* ```typescript
|
|
1297
|
+
* const { users } = await tasks.listUsers();
|
|
1298
|
+
* for (const user of users) {
|
|
1299
|
+
* console.log(`${user.name} (${user.id})`);
|
|
1300
|
+
* }
|
|
1301
|
+
* ```
|
|
1302
|
+
*/
|
|
241
1303
|
listUsers(): Promise<ListUsersResult>;
|
|
1304
|
+
/**
|
|
1305
|
+
* List all projects that have been referenced in tasks.
|
|
1306
|
+
*
|
|
1307
|
+
* @returns List of project entity references
|
|
1308
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1309
|
+
*
|
|
1310
|
+
* @example
|
|
1311
|
+
* ```typescript
|
|
1312
|
+
* const { projects } = await tasks.listProjects();
|
|
1313
|
+
* for (const project of projects) {
|
|
1314
|
+
* console.log(`${project.name} (${project.id})`);
|
|
1315
|
+
* }
|
|
1316
|
+
* ```
|
|
1317
|
+
*/
|
|
242
1318
|
listProjects(): Promise<ListProjectsResult>;
|
|
1319
|
+
/**
|
|
1320
|
+
* Get task activity time-series data showing daily task counts by status.
|
|
1321
|
+
*
|
|
1322
|
+
* @param params - Optional parameters controlling the number of days to retrieve
|
|
1323
|
+
* @returns Time-series activity data with daily snapshots
|
|
1324
|
+
* @throws {@link ServiceException} if the API request fails
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* const { activity, days } = await tasks.getActivity({ days: 30 });
|
|
1329
|
+
* console.log(`Activity over ${days} days:`);
|
|
1330
|
+
* for (const point of activity) {
|
|
1331
|
+
* console.log(`${point.date}: ${point.open} open, ${point.inProgress} in progress`);
|
|
1332
|
+
* }
|
|
1333
|
+
* ```
|
|
1334
|
+
*/
|
|
243
1335
|
getActivity(params?: TaskActivityParams): Promise<TaskActivityResult>;
|
|
244
1336
|
}
|
|
245
1337
|
//# sourceMappingURL=task.d.ts.map
|