@turinhub/tale-js-sdk 1.3.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +90 -13
  2. package/dist/acl/index.d.ts +62 -49
  3. package/dist/acl/index.js +262 -67
  4. package/dist/acl/types.d.ts +63 -98
  5. package/dist/app/index.d.ts +10 -0
  6. package/dist/app/index.js +198 -0
  7. package/dist/app/types.d.ts +101 -0
  8. package/dist/app/types.js +1 -0
  9. package/dist/app-token/index.d.ts +7 -0
  10. package/dist/app-token/index.js +58 -0
  11. package/dist/app-token/types.d.ts +25 -0
  12. package/dist/app-token/types.js +1 -0
  13. package/dist/attachment/index.d.ts +17 -0
  14. package/dist/attachment/index.js +247 -0
  15. package/dist/attachment/types.d.ts +82 -0
  16. package/dist/attachment/types.js +1 -0
  17. package/dist/attachment-type/index.d.ts +15 -0
  18. package/dist/attachment-type/index.js +203 -0
  19. package/dist/attachment-type/types.d.ts +60 -0
  20. package/dist/attachment-type/types.js +1 -0
  21. package/dist/auth/index.d.ts +21 -21
  22. package/dist/auth/index.js +66 -66
  23. package/dist/auth/types.d.ts +51 -51
  24. package/dist/cms/file.d.ts +88 -70
  25. package/dist/cms/file.js +228 -77
  26. package/dist/cms/folder.d.ts +9 -9
  27. package/dist/cms/folder.js +18 -18
  28. package/dist/cms/types.d.ts +58 -38
  29. package/dist/common/http.d.ts +17 -0
  30. package/dist/common/http.js +141 -0
  31. package/dist/common/types.d.ts +58 -63
  32. package/dist/index.d.ts +6 -1
  33. package/dist/index.js +4 -0
  34. package/dist/rbac/index.d.ts +37 -42
  35. package/dist/rbac/index.js +96 -98
  36. package/dist/rbac/types.d.ts +38 -40
  37. package/dist/status.d.ts +11 -11
  38. package/dist/status.js +30 -3
  39. package/dist/task/index.d.ts +15 -147
  40. package/dist/task/index.js +170 -161
  41. package/dist/task/types.d.ts +57 -81
  42. package/dist/task-type/index.d.ts +7 -7
  43. package/dist/task-type/index.js +12 -12
  44. package/dist/task-type/types.d.ts +18 -34
  45. package/dist/token.d.ts +3 -3
  46. package/dist/token.js +4 -4
  47. package/dist/user/index.d.ts +28 -29
  48. package/dist/user/index.js +69 -74
  49. package/dist/user/types.d.ts +32 -33
  50. package/dist/user-attribute/index.d.ts +4 -7
  51. package/dist/user-attribute/index.js +19 -22
  52. package/dist/user-attribute/types.d.ts +29 -29
  53. package/dist/user-group/index.d.ts +4 -223
  54. package/dist/user-group/index.js +61 -479
  55. package/dist/user-group/types.d.ts +1 -1
  56. package/package.json +1 -1
@@ -24,20 +24,10 @@ function getBaseUrl(options) {
24
24
  return String(base).replace(/\/+$/, "");
25
25
  }
26
26
  // ==================== UserTask CRUD Operations ====================
27
- /**
28
- * Creates a new user task.
29
- *
30
- * @param request - Task creation request
31
- * @param options - Optional configuration
32
- * @returns Promise resolving to created task
33
- * @throws {ConfigurationError} When required environment variables are missing
34
- * @throws {ApiError} When API request fails
35
- * @throws {NetworkError} When network request fails
36
- */
37
27
  export async function createUserTask(request, options) {
38
28
  const token = options?.appToken ?? (await getAppToken(options));
39
29
  const base = getBaseUrl(options);
40
- const url = new URL(base + "/user-task/v1/tasks");
30
+ const url = new URL(base + "/user-task/v2/tasks");
41
31
  let response;
42
32
  try {
43
33
  response = await globalThis.fetch(url.toString(), {
@@ -55,16 +45,6 @@ export async function createUserTask(request, options) {
55
45
  const json = await response.json();
56
46
  return parseApiResponse(json, "Failed to create user task", response.status);
57
47
  }
58
- /**
59
- * Batch creates user tasks.
60
- *
61
- * @param request - Batch creation request
62
- * @param options - Optional configuration
63
- * @returns Promise resolving to batch creation response
64
- * @throws {ConfigurationError} When required environment variables are missing
65
- * @throws {ApiError} When API request fails
66
- * @throws {NetworkError} When network request fails
67
- */
68
48
  export async function batchCreateUserTasks(request, options) {
69
49
  const token = options?.appToken ?? (await getAppToken(options));
70
50
  const base = getBaseUrl(options);
@@ -86,26 +66,16 @@ export async function batchCreateUserTasks(request, options) {
86
66
  const json = await response.json();
87
67
  return parseApiResponse(json, "Failed to batch create user tasks", response.status);
88
68
  }
89
- /**
90
- * Gets a user task by ID.
91
- *
92
- * @param taskId - Task ID
93
- * @param options - Optional configuration (include_attachments, include_sub_tasks)
94
- * @returns Promise resolving to task
95
- * @throws {ConfigurationError} When required environment variables are missing
96
- * @throws {ApiError} When API request fails
97
- * @throws {NetworkError} When network request fails
98
- */
99
69
  export async function getUserTask(taskId, options) {
100
70
  const token = options?.appToken ?? (await getAppToken(options));
101
71
  const base = getBaseUrl(options);
102
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}`);
72
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}`);
103
73
  const { appToken, baseUrl, ...queryParams } = options || {};
104
- if (queryParams.include_attachments !== undefined) {
105
- url.searchParams.append("include_attachments", String(queryParams.include_attachments));
74
+ if (queryParams.includeAttachments !== undefined) {
75
+ url.searchParams.append("includeAttachments", String(queryParams.includeAttachments));
106
76
  }
107
- if (queryParams.include_sub_tasks !== undefined) {
108
- url.searchParams.append("include_sub_tasks", String(queryParams.include_sub_tasks));
77
+ if (queryParams.includeSubTasks !== undefined) {
78
+ url.searchParams.append("includeSubTasks", String(queryParams.includeSubTasks));
109
79
  }
110
80
  let response;
111
81
  try {
@@ -123,20 +93,10 @@ export async function getUserTask(taskId, options) {
123
93
  const json = await response.json();
124
94
  return parseApiResponse(json, "Failed to get user task", response.status);
125
95
  }
126
- /**
127
- * Batch gets user tasks by IDs.
128
- *
129
- * @param request - Batch query request
130
- * @param options - Optional configuration
131
- * @returns Promise resolving to array of tasks
132
- * @throws {ConfigurationError} When required environment variables are missing
133
- * @throws {ApiError} When API request fails
134
- * @throws {NetworkError} When network request fails
135
- */
136
96
  export async function batchGetUserTasks(request, options) {
137
97
  const token = options?.appToken ?? (await getAppToken(options));
138
98
  const base = getBaseUrl(options);
139
- const url = new URL(base + "/user-task/v1/tasks/batch");
99
+ const url = new URL(base + "/user-task/v2/tasks/batch-get");
140
100
  let response;
141
101
  try {
142
102
  response = await globalThis.fetch(url.toString(), {
@@ -158,16 +118,6 @@ export async function batchGetUserTasks(request, options) {
158
118
  }
159
119
  return result;
160
120
  }
161
- /**
162
- * Lists user tasks with pagination and optional filtering.
163
- *
164
- * @param request - List request parameters
165
- * @param options - Optional configuration
166
- * @returns Promise resolving to paginated list of tasks
167
- * @throws {ConfigurationError} When required environment variables are missing
168
- * @throws {ApiError} When API request fails
169
- * @throws {NetworkError} When network request fails
170
- */
171
121
  export async function listUserTasks(request) {
172
122
  const token = request?.appToken ?? (await getAppToken(request));
173
123
  const base = getBaseUrl(request);
@@ -200,21 +150,10 @@ export async function listUserTasks(request) {
200
150
  const json = await response.json();
201
151
  return parseApiResponse(json, "Failed to list user tasks", response.status);
202
152
  }
203
- /**
204
- * Updates a user task.
205
- *
206
- * @param taskId - Task ID
207
- * @param request - Update request
208
- * @param options - Optional configuration
209
- * @returns Promise resolving to updated task
210
- * @throws {ConfigurationError} When required environment variables are missing
211
- * @throws {ApiError} When API request fails
212
- * @throws {NetworkError} When network request fails
213
- */
214
153
  export async function updateUserTask(taskId, request, options) {
215
154
  const token = options?.appToken ?? (await getAppToken(options));
216
155
  const base = getBaseUrl(options);
217
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}`);
156
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}`);
218
157
  let response;
219
158
  try {
220
159
  response = await globalThis.fetch(url.toString(), {
@@ -232,19 +171,10 @@ export async function updateUserTask(taskId, request, options) {
232
171
  const json = await response.json();
233
172
  return parseApiResponse(json, "Failed to update user task", response.status);
234
173
  }
235
- /**
236
- * Deletes a user task.
237
- *
238
- * @param taskId - Task ID
239
- * @param options - Optional configuration
240
- * @throws {ConfigurationError} When required environment variables are missing
241
- * @throws {ApiError} When API request fails
242
- * @throws {NetworkError} When network request fails
243
- */
244
174
  export async function deleteUserTask(taskId, options) {
245
175
  const token = options?.appToken ?? (await getAppToken(options));
246
176
  const base = getBaseUrl(options);
247
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}`);
177
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}`);
248
178
  let response;
249
179
  try {
250
180
  response = await globalThis.fetch(url.toString(), {
@@ -271,20 +201,10 @@ export async function deleteUserTask(taskId, options) {
271
201
  }
272
202
  }
273
203
  // ==================== Task Input/Output Operations ====================
274
- /**
275
- * Gets task input data.
276
- *
277
- * @param taskId - Task ID
278
- * @param options - Optional configuration
279
- * @returns Promise resolving to task input data
280
- * @throws {ConfigurationError} When required environment variables are missing
281
- * @throws {ApiError} When API request fails
282
- * @throws {NetworkError} When network request fails
283
- */
284
204
  export async function getTaskInput(taskId, options) {
285
205
  const token = options?.appToken ?? (await getAppToken(options));
286
206
  const base = getBaseUrl(options);
287
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}/input`);
207
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/input`);
288
208
  let response;
289
209
  try {
290
210
  response = await globalThis.fetch(url.toString(), {
@@ -301,20 +221,10 @@ export async function getTaskInput(taskId, options) {
301
221
  const json = await response.json();
302
222
  return parseApiResponse(json, "Failed to get task input", response.status);
303
223
  }
304
- /**
305
- * Gets task output data.
306
- *
307
- * @param taskId - Task ID
308
- * @param options - Optional configuration
309
- * @returns Promise resolving to task output data
310
- * @throws {ConfigurationError} When required environment variables are missing
311
- * @throws {ApiError} When API request fails
312
- * @throws {NetworkError} When network request fails
313
- */
314
224
  export async function getTaskOutput(taskId, options) {
315
225
  const token = options?.appToken ?? (await getAppToken(options));
316
226
  const base = getBaseUrl(options);
317
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}/output`);
227
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/output`);
318
228
  let response;
319
229
  try {
320
230
  response = await globalThis.fetch(url.toString(), {
@@ -331,21 +241,10 @@ export async function getTaskOutput(taskId, options) {
331
241
  const json = await response.json();
332
242
  return parseApiResponse(json, "Failed to get task output", response.status);
333
243
  }
334
- /**
335
- * Updates task input data.
336
- *
337
- * @param taskId - Task ID
338
- * @param taskInput - New task input data
339
- * @param options - Optional configuration
340
- * @returns Promise resolving to updated task
341
- * @throws {ConfigurationError} When required environment variables are missing
342
- * @throws {ApiError} When API request fails
343
- * @throws {NetworkError} When network request fails
344
- */
345
244
  export async function updateTaskInput(taskId, taskInput, options) {
346
245
  const token = options?.appToken ?? (await getAppToken(options));
347
246
  const base = getBaseUrl(options);
348
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}/input`);
247
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/input`);
349
248
  let response;
350
249
  try {
351
250
  response = await globalThis.fetch(url.toString(), {
@@ -363,21 +262,10 @@ export async function updateTaskInput(taskId, taskInput, options) {
363
262
  const json = await response.json();
364
263
  return parseApiResponse(json, "Failed to update task input", response.status);
365
264
  }
366
- /**
367
- * Updates task output data.
368
- *
369
- * @param taskId - Task ID
370
- * @param taskOutput - New task output data
371
- * @param options - Optional configuration
372
- * @returns Promise resolving to updated task
373
- * @throws {ConfigurationError} When required environment variables are missing
374
- * @throws {ApiError} When API request fails
375
- * @throws {NetworkError} When network request fails
376
- */
377
265
  export async function updateTaskOutput(taskId, taskOutput, options) {
378
266
  const token = options?.appToken ?? (await getAppToken(options));
379
267
  const base = getBaseUrl(options);
380
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}/output`);
268
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/output`);
381
269
  let response;
382
270
  try {
383
271
  response = await globalThis.fetch(url.toString(), {
@@ -396,20 +284,10 @@ export async function updateTaskOutput(taskId, taskOutput, options) {
396
284
  return parseApiResponse(json, "Failed to update task output", response.status);
397
285
  }
398
286
  // ==================== Task Status Operations ====================
399
- /**
400
- * Gets task status.
401
- *
402
- * @param taskId - Task ID
403
- * @param options - Optional configuration
404
- * @returns Promise resolving to task status
405
- * @throws {ConfigurationError} When required environment variables are missing
406
- * @throws {ApiError} When API request fails
407
- * @throws {NetworkError} When network request fails
408
- */
409
287
  export async function getTaskStatus(taskId, options) {
410
288
  const token = options?.appToken ?? (await getAppToken(options));
411
289
  const base = getBaseUrl(options);
412
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}/status`);
290
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/status`);
413
291
  let response;
414
292
  try {
415
293
  response = await globalThis.fetch(url.toString(), {
@@ -425,23 +303,12 @@ export async function getTaskStatus(taskId, options) {
425
303
  }
426
304
  const json = await response.json();
427
305
  const result = parseApiResponse(json, "Failed to get task status", response.status);
428
- return result.task_status;
306
+ return result.taskStatus;
429
307
  }
430
- /**
431
- * Updates task status.
432
- *
433
- * @param taskId - Task ID
434
- * @param request - Status update request
435
- * @param options - Optional configuration
436
- * @returns Promise resolving to updated task
437
- * @throws {ConfigurationError} When required environment variables are missing
438
- * @throws {ApiError} When API request fails
439
- * @throws {NetworkError} When network request fails
440
- */
441
308
  export async function updateTaskStatus(taskId, request, options) {
442
309
  const token = options?.appToken ?? (await getAppToken(options));
443
310
  const base = getBaseUrl(options);
444
- const url = new URL(base + `/user-task/v1/tasks/${encodeURIComponent(taskId)}/status`);
311
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/status`);
445
312
  let response;
446
313
  try {
447
314
  response = await globalThis.fetch(url.toString(), {
@@ -460,22 +327,12 @@ export async function updateTaskStatus(taskId, request, options) {
460
327
  return parseApiResponse(json, "Failed to update task status", response.status);
461
328
  }
462
329
  // ==================== Task Statistics ====================
463
- /**
464
- * Gets task statistics.
465
- *
466
- * @param userId - Optional user ID filter
467
- * @param options - Optional configuration
468
- * @returns Promise resolving to task statistics
469
- * @throws {ConfigurationError} When required environment variables are missing
470
- * @throws {ApiError} When API request fails
471
- * @throws {NetworkError} When network request fails
472
- */
473
330
  export async function getTaskStatistics(userId, options) {
474
331
  const token = options?.appToken ?? (await getAppToken(options));
475
332
  const base = getBaseUrl(options);
476
- const url = new URL(base + "/user-task/v1/tasks/statistics");
333
+ const url = new URL(base + "/user-task/v2/tasks/statistics");
477
334
  if (userId !== undefined) {
478
- url.searchParams.append("user_id", userId);
335
+ url.searchParams.append("userId", userId);
479
336
  }
480
337
  let response;
481
338
  try {
@@ -493,3 +350,155 @@ export async function getTaskStatistics(userId, options) {
493
350
  const json = await response.json();
494
351
  return parseApiResponse(json, "Failed to get task statistics", response.status);
495
352
  }
353
+ // ==================== Task Frozen Status ====================
354
+ export async function getTaskFrozenStatus(taskId, options) {
355
+ const token = options?.appToken ?? (await getAppToken(options));
356
+ const base = getBaseUrl(options);
357
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/frozen-status`);
358
+ let response;
359
+ try {
360
+ response = await globalThis.fetch(url.toString(), {
361
+ method: "GET",
362
+ headers: {
363
+ "Content-Type": "application/json",
364
+ "x-t-token": token,
365
+ },
366
+ });
367
+ }
368
+ catch (error) {
369
+ throw new NetworkError(`Failed to get task frozen status: ${error instanceof Error ? error.message : "Unknown error"}`);
370
+ }
371
+ const json = await response.json();
372
+ return parseApiResponse(json, "Failed to get task frozen status", response.status);
373
+ }
374
+ export async function updateTaskFrozenStatus(taskId, request, options) {
375
+ const token = options?.appToken ?? (await getAppToken(options));
376
+ const base = getBaseUrl(options);
377
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/frozen-status`);
378
+ let response;
379
+ try {
380
+ response = await globalThis.fetch(url.toString(), {
381
+ method: "PUT",
382
+ headers: {
383
+ "Content-Type": "application/json",
384
+ "x-t-token": token,
385
+ },
386
+ body: JSON.stringify(request),
387
+ });
388
+ }
389
+ catch (error) {
390
+ throw new NetworkError(`Failed to update task frozen status: ${error instanceof Error ? error.message : "Unknown error"}`);
391
+ }
392
+ const json = await response.json();
393
+ return parseApiResponse(json, "Failed to update task frozen status", response.status);
394
+ }
395
+ // ==================== Task Attachments ====================
396
+ export async function listTaskAttachments(taskId, options) {
397
+ const token = options?.appToken ?? (await getAppToken(options));
398
+ const base = getBaseUrl(options);
399
+ const url = new URL(base + `/user-task/v2/tasks/${encodeURIComponent(taskId)}/attachments`);
400
+ const { appToken, baseUrl, ...requestParams } = options || {};
401
+ const queryParams = {
402
+ page: 0,
403
+ size: 20,
404
+ ...requestParams,
405
+ };
406
+ Object.entries(queryParams).forEach(([key, value]) => {
407
+ if (value !== undefined) {
408
+ url.searchParams.append(key, String(value));
409
+ }
410
+ });
411
+ let response;
412
+ try {
413
+ response = await globalThis.fetch(url.toString(), {
414
+ method: "GET",
415
+ headers: {
416
+ "Content-Type": "application/json",
417
+ "x-t-token": token,
418
+ },
419
+ });
420
+ }
421
+ catch (error) {
422
+ throw new NetworkError(`Failed to list task attachments: ${error instanceof Error ? error.message : "Unknown error"}`);
423
+ }
424
+ const json = await response.json();
425
+ return parseApiResponse(json, "Failed to list task attachments", response.status);
426
+ }
427
+ export async function getTaskAttachment(taskId, attachmentId, options) {
428
+ const token = options?.appToken ?? (await getAppToken(options));
429
+ const base = getBaseUrl(options);
430
+ const url = new URL(base +
431
+ `/user-task/v2/tasks/${encodeURIComponent(taskId)}/attachments/${encodeURIComponent(attachmentId)}`);
432
+ let response;
433
+ try {
434
+ response = await globalThis.fetch(url.toString(), {
435
+ method: "GET",
436
+ headers: {
437
+ "Content-Type": "application/json",
438
+ "x-t-token": token,
439
+ },
440
+ });
441
+ }
442
+ catch (error) {
443
+ throw new NetworkError(`Failed to get task attachment: ${error instanceof Error ? error.message : "Unknown error"}`);
444
+ }
445
+ const json = await response.json();
446
+ return parseApiResponse(json, "Failed to get task attachment", response.status);
447
+ }
448
+ export async function uploadTaskAttachment(taskId, attachmentTypeId, file, remark, options) {
449
+ const token = options?.appToken ?? (await getAppToken(options));
450
+ const base = getBaseUrl(options);
451
+ const url = new URL(base +
452
+ `/user-task/v2/tasks/${encodeURIComponent(taskId)}/attachments/${encodeURIComponent(attachmentTypeId)}`);
453
+ const formData = new FormData();
454
+ if (typeof File !== "undefined" && file instanceof File) {
455
+ formData.append("file", file, file.name);
456
+ }
457
+ else {
458
+ formData.append("file", file);
459
+ }
460
+ if (remark) {
461
+ formData.append("remark", remark);
462
+ }
463
+ let response;
464
+ try {
465
+ response = await globalThis.fetch(url.toString(), {
466
+ method: "POST",
467
+ headers: {
468
+ "x-t-token": token,
469
+ },
470
+ body: formData,
471
+ });
472
+ }
473
+ catch (error) {
474
+ throw new NetworkError(`Failed to upload task attachment: ${error instanceof Error ? error.message : "Unknown error"}`);
475
+ }
476
+ const json = await response.json();
477
+ return parseApiResponse(json, "Failed to upload task attachment", response.status);
478
+ }
479
+ export async function deleteTaskAttachment(taskId, attachmentId, options) {
480
+ const token = options?.appToken ?? (await getAppToken(options));
481
+ const base = getBaseUrl(options);
482
+ const url = new URL(base +
483
+ `/user-task/v2/tasks/${encodeURIComponent(taskId)}/attachments/${encodeURIComponent(attachmentId)}`);
484
+ let response;
485
+ try {
486
+ response = await globalThis.fetch(url.toString(), {
487
+ method: "DELETE",
488
+ headers: {
489
+ "Content-Type": "application/json",
490
+ "x-t-token": token,
491
+ },
492
+ });
493
+ }
494
+ catch (error) {
495
+ throw new NetworkError(`Failed to delete task attachment: ${error instanceof Error ? error.message : "Unknown error"}`);
496
+ }
497
+ const json = (await response.json());
498
+ if (json.code !== 200) {
499
+ const errorMsg = typeof json.msg === "string"
500
+ ? json.msg
501
+ : "Failed to delete task attachment";
502
+ throw new ApiError(errorMsg, response.status, json.code);
503
+ }
504
+ }
@@ -1,116 +1,92 @@
1
- import type { CommonOptions, Attachment } from "../common/types.js";
2
- /**
3
- * UserTask entity (matches backend UserTaskVO)
4
- */
1
+ import type { CommonOptions } from "../common/types.js";
2
+ import type { Attachment } from "../attachment/types.js";
5
3
  export interface UserTask {
6
- task_id: string;
7
- app_id: string;
8
- user_id: string;
9
- task_title: string;
10
- task_input: Record<string, unknown>;
11
- task_output: Record<string, unknown>;
12
- task_type: string;
13
- task_status: string;
14
- parent_task_id?: string;
15
- created_at: string;
16
- updated_at: string;
4
+ taskId: string;
5
+ appId: string;
6
+ userId: string;
7
+ taskTitle: string;
8
+ taskInput: Record<string, unknown>;
9
+ taskOutput: Record<string, unknown>;
10
+ taskType: string;
11
+ taskStatus: string;
12
+ parentTaskId?: string;
13
+ isFrozen?: boolean;
14
+ createdAt: string;
15
+ updatedAt: string;
17
16
  attachments?: Attachment[];
18
- sub_tasks?: UserTask[];
17
+ subTasks?: UserTask[];
19
18
  }
20
- /**
21
- * Request for creating a user task
22
- */
23
19
  export interface CreateUserTaskRequest {
24
- user_id: string;
25
- task_title: string;
26
- task_input?: Record<string, unknown>;
27
- task_output?: Record<string, unknown>;
28
- task_type?: string;
29
- task_status?: string;
30
- parent_task_id?: string;
20
+ userId: string;
21
+ taskTitle: string;
22
+ taskInput?: Record<string, unknown>;
23
+ taskOutput?: Record<string, unknown>;
24
+ taskType?: string;
25
+ taskStatus?: string;
26
+ parentTaskId?: string;
31
27
  remark?: string;
32
28
  }
33
- /**
34
- * Request for updating a user task
35
- */
36
29
  export interface UpdateUserTaskRequest {
37
- task_title?: string;
38
- task_input?: Record<string, unknown>;
39
- task_output?: Record<string, unknown>;
40
- task_status?: string;
30
+ taskTitle?: string;
31
+ taskInput?: Record<string, unknown>;
32
+ taskOutput?: Record<string, unknown>;
33
+ taskStatus?: string;
41
34
  remark?: string;
42
35
  }
43
- /**
44
- * Request for batch creating user tasks
45
- */
46
36
  export interface BatchCreateUserTasksRequest {
47
37
  tasks: CreateUserTaskRequest[];
48
38
  }
49
- /**
50
- * Request for batch querying user tasks
51
- */
52
39
  export interface BatchQueryUserTasksRequest {
53
- task_ids: string[];
54
- user_ids?: string[];
55
- task_status?: string;
56
- include_attachments?: boolean;
57
- include_sub_tasks?: boolean;
40
+ taskIds: string[];
41
+ userIds?: string[];
42
+ taskStatus?: string;
43
+ includeAttachments?: boolean;
44
+ includeSubTasks?: boolean;
58
45
  }
59
- /**
60
- * Request for listing user tasks
61
- */
62
46
  export interface ListUserTasksRequest {
63
47
  page?: number;
64
48
  size?: number;
65
49
  sort?: string;
66
- user_ids?: string;
67
- task_status?: string;
68
- task_type?: string;
69
- include_attachments?: boolean;
70
- include_sub_tasks?: boolean;
50
+ userIds?: string;
51
+ taskStatus?: string;
52
+ taskType?: string;
53
+ includeAttachments?: boolean;
54
+ includeSubTasks?: boolean;
71
55
  }
72
- /**
73
- * Request for updating task status
74
- */
75
56
  export interface UpdateTaskStatusRequest {
76
- task_status: string;
57
+ taskStatus: string;
77
58
  }
78
- /**
79
- * Result of a single task creation in batch
80
- */
81
59
  export interface UserTaskCreateResult {
82
60
  index: number;
83
61
  success: boolean;
84
- task_id?: string;
62
+ taskId?: string;
85
63
  message?: string;
86
64
  }
87
- /**
88
- * Response for batch task creation
89
- */
90
65
  export interface BatchCreateUserTasksResponse {
91
- success_count: number;
92
- failure_count: number;
66
+ successCount: number;
67
+ failureCount: number;
93
68
  results: UserTaskCreateResult[];
94
69
  }
95
- /**
96
- * Task statistics response
97
- */
98
70
  export interface TaskStatistics {
99
- pending_count: number;
100
- running_count: number;
101
- completed_count: number;
102
- failed_count: number;
103
- cancelled_count: number;
104
- total_count: number;
71
+ pendingCount: number;
72
+ runningCount: number;
73
+ completedCount: number;
74
+ failedCount: number;
75
+ cancelledCount: number;
76
+ totalCount: number;
105
77
  }
106
- /**
107
- * Task status response
108
- */
109
78
  export interface TaskStatusResponse {
110
- task_status: string;
79
+ taskStatus: string;
80
+ }
81
+ export interface TaskFrozenStatusResponse {
82
+ taskId: string;
83
+ isFrozen: boolean;
84
+ frozenRemark?: string;
85
+ updatedAt?: string;
86
+ }
87
+ export interface UpdateTaskFrozenStatusRequest {
88
+ isFrozen: boolean;
89
+ remark?: string;
111
90
  }
112
- /**
113
- * Options for user task operations
114
- */
115
91
  export interface UserTaskOptions extends CommonOptions {
116
92
  }
@@ -14,11 +14,11 @@ export type { TaskType, CreateTaskTypeRequest, UpdateTaskTypeRequest, ListTaskTy
14
14
  * @example
15
15
  * ```typescript
16
16
  * const taskType = await createTaskType({
17
- * type_code: "daily_review",
18
- * type_name: "Daily Review",
17
+ * typeCode: "daily_review",
18
+ * typeName: "Daily Review",
19
19
  * description: "Daily review tasks",
20
- * allow_multiple: true,
21
- * is_enabled: true,
20
+ * allowMultiple: true,
21
+ * isEnabled: true,
22
22
  * });
23
23
  * ```
24
24
  */
@@ -71,9 +71,9 @@ export declare function getTaskType(typeId: string, options?: TaskTypeOptions):
71
71
  * const result = await listTaskTypes({
72
72
  * page: 0,
73
73
  * size: 20,
74
- * is_enabled: true,
75
- * sort_by: "createdAt",
76
- * sort_direction: "desc",
74
+ * isEnabled: true,
75
+ * sort: "createdAt",
76
+ * sortDirection: "desc",
77
77
  * });
78
78
  * console.log(result.content); // Array of task types
79
79
  * console.log(result.total); // Total count