tale-js-sdk 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -47,6 +47,10 @@ pnpm test # 对应 package.json 中的 "test": "jest"
47
47
 
48
48
  遵循语义化版本(SemVer)。发布与变更说明将按迭代在仓库中维护。
49
49
 
50
+ ## TODO
51
+
52
+ - [ ] 修改 User Group 等分页格式,统一为 PageResponse。
53
+
50
54
  ## 许可证
51
55
 
52
56
  本项目基于 MIT 许可证开源,详见 `LICENSE` 文件。版权归 Turinhub 团队所有。
@@ -1,4 +1,5 @@
1
1
  import type { AclRecord, CreateAclRecordRequest, UpdateAclRecordRequest, ListAclRecordsRequest, AclBatchCreateResponse, AclTemplate, CreateAclTemplateRequest, UpdateAclTemplateRequest, ListAclTemplatesRequest, AclOptions } from "./types.js";
2
+ import type { PageResponse } from "../common/types.js";
2
3
  export type { AclRecord, CreateAclRecordRequest, UpdateAclRecordRequest, ListAclRecordsRequest, AclBatchCreateResponse, AclTemplate, CreateAclTemplateRequest, UpdateAclTemplateRequest, ListAclTemplatesRequest, AclOptions, };
3
4
  /**
4
5
  * Gets an ACL record by ID.
@@ -42,16 +43,13 @@ export declare function getAclRecord(recordId: string, options?: AclOptions): Pr
42
43
  * size: 20,
43
44
  * resource_type: 'document'
44
45
  * });
45
- * console.log(`Found ${result.totalElements} records`);
46
+ * console.log(`Found ${result.total} records`);
46
47
  * } catch (error) {
47
48
  * console.error('Failed to list ACL records:', error.message);
48
49
  * }
49
50
  * ```
50
51
  */
51
- export declare function listAclRecords(options?: ListAclRecordsRequest & AclOptions): Promise<{
52
- content: AclRecord[];
53
- totalElements: number;
54
- }>;
52
+ export declare function listAclRecords(options?: ListAclRecordsRequest & AclOptions): Promise<PageResponse<AclRecord>>;
55
53
  /**
56
54
  * Creates a new ACL record.
57
55
  *
@@ -209,16 +207,13 @@ export declare function getAclTemplate(templateId: string, options?: AclOptions)
209
207
  * size: 20,
210
208
  * resource_type: 'document'
211
209
  * });
212
- * console.log(`Found ${result.totalElements} templates`);
210
+ * console.log(`Found ${result.total} templates`);
213
211
  * } catch (error) {
214
212
  * console.error('Failed to list ACL templates:', error.message);
215
213
  * }
216
214
  * ```
217
215
  */
218
- export declare function listAclTemplates(options?: ListAclTemplatesRequest & AclOptions): Promise<{
219
- content: AclTemplate[];
220
- totalElements: number;
221
- }>;
216
+ export declare function listAclTemplates(options?: ListAclTemplatesRequest & AclOptions): Promise<PageResponse<AclTemplate>>;
222
217
  /**
223
218
  * Creates a new ACL template.
224
219
  *
package/dist/acl/index.js CHANGED
@@ -5,7 +5,7 @@ import { ApiError, ConfigurationError, NetworkError } from "../errors.js";
5
5
  * Parses standard API response format: { code, msg, data }
6
6
  */
7
7
  function parseApiResponse(json, errorMessage, statusCode) {
8
- if (typeof json !== 'object' || json === null) {
8
+ if (typeof json !== "object" || json === null) {
9
9
  throw new ApiError(`Invalid response: ${errorMessage} - not an object`, statusCode);
10
10
  }
11
11
  const response = json;
@@ -88,7 +88,7 @@ export async function getAclRecord(recordId, options) {
88
88
  * size: 20,
89
89
  * resource_type: 'document'
90
90
  * });
91
- * console.log(`Found ${result.totalElements} records`);
91
+ * console.log(`Found ${result.total} records`);
92
92
  * } catch (error) {
93
93
  * console.error('Failed to list ACL records:', error.message);
94
94
  * }
@@ -107,6 +107,7 @@ export async function listAclRecords(options) {
107
107
  const queryParams = {
108
108
  page: 0,
109
109
  size: 20,
110
+ sort: "createdAt,desc",
110
111
  ...requestParams,
111
112
  };
112
113
  Object.entries(queryParams).forEach(([key, value]) => {
@@ -128,11 +129,7 @@ export async function listAclRecords(options) {
128
129
  throw new NetworkError(`Failed to list ACL records: ${error instanceof Error ? error.message : "Unknown error"}`);
129
130
  }
130
131
  const json = await response.json();
131
- const data = parseApiResponse(json, "Failed to list ACL records", response.status);
132
- if (!Array.isArray(data.content)) {
133
- throw new ApiError("Invalid ACL records response: content is not an array", response.status);
134
- }
135
- return data;
132
+ return parseApiResponse(json, "Failed to list ACL records", response.status);
136
133
  }
137
134
  /**
138
135
  * Creates a new ACL record.
@@ -363,12 +360,14 @@ export async function deleteAclRecord(recordId, options) {
363
360
  }
364
361
  const json = await response.json();
365
362
  // Delete response may not have data field, handle differently
366
- if (typeof json !== 'object' || json === null) {
363
+ if (typeof json !== "object" || json === null) {
367
364
  throw new ApiError("Invalid ACL record deletion response", response.status);
368
365
  }
369
366
  const apiResponse = json;
370
367
  if (apiResponse.code !== 200) {
371
- const errorMsg = typeof apiResponse.msg === "string" ? apiResponse.msg : "Failed to delete ACL record";
368
+ const errorMsg = typeof apiResponse.msg === "string"
369
+ ? apiResponse.msg
370
+ : "Failed to delete ACL record";
372
371
  throw new ApiError(errorMsg, response.status, apiResponse.code);
373
372
  }
374
373
  }
@@ -420,15 +419,8 @@ export async function getAclTemplate(templateId, options) {
420
419
  catch (error) {
421
420
  throw new NetworkError(`Failed to get ACL template: ${error instanceof Error ? error.message : "Unknown error"}`);
422
421
  }
423
- const json = (await response.json());
424
- if (json.code !== 200) {
425
- const errorMsg = typeof json.msg === "string" ? json.msg : "Failed to get ACL template";
426
- throw new ApiError(errorMsg, response.status, json.code);
427
- }
428
- if (!json.data) {
429
- throw new ApiError("Invalid ACL template response: missing data", response.status);
430
- }
431
- return json.data;
422
+ const json = await response.json();
423
+ return parseApiResponse(json, "Failed to get ACL template", response.status);
432
424
  }
433
425
  /**
434
426
  * Lists ACL templates with pagination and optional filtering.
@@ -449,7 +441,7 @@ export async function getAclTemplate(templateId, options) {
449
441
  * size: 20,
450
442
  * resource_type: 'document'
451
443
  * });
452
- * console.log(`Found ${result.totalElements} templates`);
444
+ * console.log(`Found ${result.total} templates`);
453
445
  * } catch (error) {
454
446
  * console.error('Failed to list ACL templates:', error.message);
455
447
  * }
@@ -462,19 +454,18 @@ export async function listAclTemplates(options) {
462
454
  if (!base) {
463
455
  throw new ConfigurationError("Missing required environment variable: TALE_BASE_URL");
464
456
  }
465
- const url = new URL(String(base).replace(/\/+$/, "") + "/acl/v1/templates");
457
+ const url = new URL(String(base).replace(/\/+$/, "") + "/acl/v2/templates");
466
458
  // 分离 AclOptions 字段,只保留请求参数
467
459
  const { appToken, baseUrl, ...requestParams } = options || {};
468
460
  const queryParams = {
469
461
  page: 0,
470
462
  size: 20,
471
- sort_by: "createdAt",
472
- sort_direction: "desc",
463
+ sort: "createdAt,desc",
473
464
  ...requestParams,
474
465
  };
475
466
  Object.entries(queryParams).forEach(([key, value]) => {
476
467
  if (value !== undefined) {
477
- url.searchParams.append(key === "sortBy" ? "sort_by" : key === "sortDirection" ? "sort_direction" : key, String(value));
468
+ url.searchParams.append(key, String(value));
478
469
  }
479
470
  });
480
471
  let response;
@@ -490,15 +481,8 @@ export async function listAclTemplates(options) {
490
481
  catch (error) {
491
482
  throw new NetworkError(`Failed to list ACL templates: ${error instanceof Error ? error.message : "Unknown error"}`);
492
483
  }
493
- const json = (await response.json());
494
- if (json.code !== 200) {
495
- const errorMsg = typeof json.msg === "string" ? json.msg : "Failed to list ACL templates";
496
- throw new ApiError(errorMsg, response.status, json.code);
497
- }
498
- if (!json.data || !Array.isArray(json.data.content)) {
499
- throw new ApiError("Invalid ACL templates response: missing data", response.status);
500
- }
501
- return json.data;
484
+ const json = await response.json();
485
+ return parseApiResponse(json, "Failed to list ACL templates", response.status);
502
486
  }
503
487
  /**
504
488
  * Creates a new ACL template.
@@ -556,15 +540,8 @@ export async function createAclTemplate(request, options) {
556
540
  catch (error) {
557
541
  throw new NetworkError(`Failed to create ACL template: ${error instanceof Error ? error.message : "Unknown error"}`);
558
542
  }
559
- const json = (await response.json());
560
- if (json.code !== 200) {
561
- const errorMsg = typeof json.msg === "string" ? json.msg : "Failed to create ACL template";
562
- throw new ApiError(errorMsg, response.status, json.code);
563
- }
564
- if (!json.data) {
565
- throw new ApiError("Invalid ACL template creation response: missing data", response.status);
566
- }
567
- return json.data;
543
+ const json = await response.json();
544
+ return parseApiResponse(json, "Failed to create ACL template", response.status);
568
545
  }
569
546
  /**
570
547
  * Updates an existing ACL template.
@@ -618,15 +595,8 @@ export async function updateAclTemplate(templateId, request, options) {
618
595
  catch (error) {
619
596
  throw new NetworkError(`Failed to update ACL template: ${error instanceof Error ? error.message : "Unknown error"}`);
620
597
  }
621
- const json = (await response.json());
622
- if (json.code !== 200) {
623
- const errorMsg = typeof json.msg === "string" ? json.msg : "Failed to update ACL template";
624
- throw new ApiError(errorMsg, response.status, json.code);
625
- }
626
- if (!json.data) {
627
- throw new ApiError("Invalid ACL template update response: missing data", response.status);
628
- }
629
- return json.data;
598
+ const json = await response.json();
599
+ return parseApiResponse(json, "Failed to update ACL template", response.status);
630
600
  }
631
601
  /**
632
602
  * Deletes an ACL template.
@@ -131,8 +131,7 @@ export interface UpdateAclTemplateRequest {
131
131
  export interface ListAclTemplatesRequest {
132
132
  page?: number;
133
133
  size?: number;
134
- sort_by?: string;
135
- sort_direction?: "asc" | "desc";
134
+ sort?: string;
136
135
  resource_type?: string;
137
136
  subject_type?: string;
138
137
  }
@@ -26,9 +26,34 @@ export type { LoginRequest, LoginOptions, LoginWithSmsOptions, VerifySmsOptions,
26
26
  * }
27
27
  * ```
28
28
  *
29
+ * @example
30
+ * ```typescript
31
+ * import { login } from '@tale/client';
32
+ *
33
+ * // Login with include parameters to control what data is returned
34
+ * const result = await login({
35
+ * username: 'johndoe',
36
+ * password: 'secure_password_123'
37
+ * }, {
38
+ * include_rbac: true, // Include roles and privileges (SDK default: false)
39
+ * include_user_groups: true, // Include user groups (SDK default: false)
40
+ * include_login_methods: true, // Include login methods (SDK default: false)
41
+ * include_attributes: true, // Include user attributes (SDK default: false)
42
+ * include_acl: true // Include ACL records (SDK default: false)
43
+ * });
44
+ * ```
45
+ *
29
46
  * @note The function requires the following environment variables:
30
47
  * - TALE_BASE_URL: Base URL for Tale backend services
31
48
  * - TALE_APP_KEY: Application key for authentication
49
+ * @note By default, all include parameters are set to false for better performance.
50
+ * Explicitly set them to true if you need the additional data.
51
+ *
52
+ * @param options.include_rbac Include roles and privileges; default false
53
+ * @param options.include_login_methods Include user login methods; default false
54
+ * @param options.include_user_groups Include user groups; default false
55
+ * @param options.include_attributes Include user attributes; default false
56
+ * @param options.include_acl Include ACL records; default false
32
57
  */
33
58
  export declare function login(credentials: LoginRequest, options?: LoginOptions): Promise<LoginResponse>;
34
59
  /**
@@ -26,9 +26,34 @@ import { ApiError, ConfigurationError, NetworkError } from "../errors.js";
26
26
  * }
27
27
  * ```
28
28
  *
29
+ * @example
30
+ * ```typescript
31
+ * import { login } from '@tale/client';
32
+ *
33
+ * // Login with include parameters to control what data is returned
34
+ * const result = await login({
35
+ * username: 'johndoe',
36
+ * password: 'secure_password_123'
37
+ * }, {
38
+ * include_rbac: true, // Include roles and privileges (SDK default: false)
39
+ * include_user_groups: true, // Include user groups (SDK default: false)
40
+ * include_login_methods: true, // Include login methods (SDK default: false)
41
+ * include_attributes: true, // Include user attributes (SDK default: false)
42
+ * include_acl: true // Include ACL records (SDK default: false)
43
+ * });
44
+ * ```
45
+ *
29
46
  * @note The function requires the following environment variables:
30
47
  * - TALE_BASE_URL: Base URL for Tale backend services
31
48
  * - TALE_APP_KEY: Application key for authentication
49
+ * @note By default, all include parameters are set to false for better performance.
50
+ * Explicitly set them to true if you need the additional data.
51
+ *
52
+ * @param options.include_rbac Include roles and privileges; default false
53
+ * @param options.include_login_methods Include user login methods; default false
54
+ * @param options.include_user_groups Include user groups; default false
55
+ * @param options.include_attributes Include user attributes; default false
56
+ * @param options.include_acl Include ACL records; default false
32
57
  */
33
58
  export async function login(credentials, options) {
34
59
  // Validate required fields
@@ -49,7 +74,14 @@ export async function login(credentials, options) {
49
74
  if (!appKey) {
50
75
  throw new ConfigurationError("Missing required environment variable: TALE_APP_KEY");
51
76
  }
52
- const url = String(base).replace(/\/+$/, "") + "/auth/v1/login/username-password";
77
+ // Build URL with query parameters
78
+ const url = new URL(String(base).replace(/\/+$/, "") + "/auth/v1/login/username-password");
79
+ // Add include parameters as query params (SDK defaults to false)
80
+ url.searchParams.set("include_rbac", String(options?.include_rbac ?? false));
81
+ url.searchParams.set("include_login_methods", String(options?.include_login_methods ?? false));
82
+ url.searchParams.set("include_user_groups", String(options?.include_user_groups ?? false));
83
+ url.searchParams.set("include_attributes", String(options?.include_attributes ?? false));
84
+ url.searchParams.set("include_acl", String(options?.include_acl ?? false));
53
85
  // Build request body
54
86
  const requestBody = {
55
87
  username: credentials.username.trim(),
@@ -61,7 +93,7 @@ export async function login(credentials, options) {
61
93
  };
62
94
  let response;
63
95
  try {
64
- response = await globalThis.fetch(url, {
96
+ response = await globalThis.fetch(url.toString(), {
65
97
  method: "POST",
66
98
  headers: {
67
99
  "Content-Type": "application/json",
@@ -54,6 +54,11 @@ export interface LoginOptions {
54
54
  device_name?: string;
55
55
  device_fingerprint?: string;
56
56
  scope?: string;
57
+ include_rbac?: boolean;
58
+ include_login_methods?: boolean;
59
+ include_user_groups?: boolean;
60
+ include_attributes?: boolean;
61
+ include_acl?: boolean;
57
62
  }
58
63
  export interface LoginResponse {
59
64
  app: AppInfo;
@@ -3,41 +3,31 @@ export interface CommonOptions {
3
3
  appToken?: string;
4
4
  }
5
5
  /**
6
- * Spring Boot Page serialization format
6
+ * Pagination response format used by Tale backend
7
7
  *
8
- * This matches the default JSON serialization format of Spring Data's Page object
9
- *
10
- * @see https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Page.html
8
+ * This matches the actual backend response format with simplified pagination metadata
11
9
  */
12
10
  export interface PageResponse<T> {
13
11
  /** Page content */
14
12
  content: T[];
13
+ /** Total number of elements across all pages */
14
+ total: number;
15
15
  /** Pagination information */
16
16
  pageable: {
17
+ /** Current page number (0-based) */
17
18
  pageNumber: number;
19
+ /** Page size */
18
20
  pageSize: number;
19
- sort: {
20
- sorted: boolean;
21
- unsorted: boolean;
22
- empty: boolean;
21
+ /** Sort information */
22
+ sort?: {
23
+ orders?: Array<{
24
+ direction: "ASC" | "DESC";
25
+ property: string;
26
+ ignoreCase: boolean;
27
+ nullHandling: string;
28
+ }>;
23
29
  };
24
30
  };
25
- /** Total number of pages */
26
- totalPages: number;
27
- /** Total number of elements */
28
- totalElements: number;
29
- /** Whether this is the last page */
30
- last: boolean;
31
- /** Whether this is the first page */
32
- first: boolean;
33
- /** Number of elements in current page */
34
- numberOfElements: number;
35
- /** Page size */
36
- size: number;
37
- /** Current page number */
38
- number: number;
39
- /** Whether the page is empty */
40
- empty: boolean;
41
31
  }
42
32
  export interface UserGroup {
43
33
  group_id: string;
@@ -83,3 +73,19 @@ export interface User {
83
73
  updated_at: string;
84
74
  remark?: string;
85
75
  }
76
+ /**
77
+ * Attachment data (common type used across modules)
78
+ */
79
+ export interface Attachment {
80
+ attachment_id: string;
81
+ app_id: string;
82
+ attachment_type_id: string;
83
+ ref_id: string;
84
+ file_name: string;
85
+ file_url: string;
86
+ file_size: number;
87
+ mime_type: string;
88
+ remark?: string;
89
+ created_at: string;
90
+ updated_at: string;
91
+ }
package/dist/index.d.ts CHANGED
@@ -6,5 +6,7 @@ export * from "./user-group/index.js";
6
6
  export * from "./rbac/index.js";
7
7
  export * from "./acl/index.js";
8
8
  export * from "./user-attribute/index.js";
9
+ export * from "./task-type/index.js";
10
+ export * from "./task/index.js";
9
11
  export * from "./errors.js";
10
- export type { CommonOptions, PageResponse, UserGroup, Role, Privilege, AppInfo, User } from "./common/types.js";
12
+ export type { CommonOptions, PageResponse, UserGroup, Role, Privilege, AppInfo, User, Attachment, } from "./common/types.js";
package/dist/index.js CHANGED
@@ -6,4 +6,6 @@ export * from "./user-group/index.js";
6
6
  export * from "./rbac/index.js";
7
7
  export * from "./acl/index.js";
8
8
  export * from "./user-attribute/index.js";
9
+ export * from "./task-type/index.js";
10
+ export * from "./task/index.js";
9
11
  export * from "./errors.js";
@@ -846,9 +846,7 @@ export async function getUserPrivileges(userId, options) {
846
846
  }
847
847
  const json = (await response.json());
848
848
  if (json.code !== 200) {
849
- const errorMsg = typeof json.msg === "string"
850
- ? json.msg
851
- : "Failed to get user privileges";
849
+ const errorMsg = typeof json.msg === "string" ? json.msg : "Failed to get user privileges";
852
850
  throw new ApiError(errorMsg, response.status, json.code);
853
851
  }
854
852
  if (!json.data || !Array.isArray(json.data)) {
@@ -0,0 +1,163 @@
1
+ import type { UserTask, CreateUserTaskRequest, UpdateUserTaskRequest, BatchCreateUserTasksRequest, BatchQueryUserTasksRequest, BatchCreateUserTasksResponse, ListUserTasksRequest, UpdateTaskStatusRequest, TaskStatistics, TaskStatusResponse, UserTaskOptions } from "./types.js";
2
+ import type { PageResponse } from "../common/types.js";
3
+ export type { UserTask, CreateUserTaskRequest, UpdateUserTaskRequest, BatchCreateUserTasksRequest, BatchQueryUserTasksRequest, BatchCreateUserTasksResponse, ListUserTasksRequest, UpdateTaskStatusRequest, TaskStatistics, TaskStatusResponse, UserTaskOptions, };
4
+ /**
5
+ * Creates a new user task.
6
+ *
7
+ * @param request - Task creation request
8
+ * @param options - Optional configuration
9
+ * @returns Promise resolving to created task
10
+ * @throws {ConfigurationError} When required environment variables are missing
11
+ * @throws {ApiError} When API request fails
12
+ * @throws {NetworkError} When network request fails
13
+ */
14
+ export declare function createUserTask(request: CreateUserTaskRequest, options?: UserTaskOptions): Promise<UserTask>;
15
+ /**
16
+ * Batch creates user tasks.
17
+ *
18
+ * @param request - Batch creation request
19
+ * @param options - Optional configuration
20
+ * @returns Promise resolving to batch creation response
21
+ * @throws {ConfigurationError} When required environment variables are missing
22
+ * @throws {ApiError} When API request fails
23
+ * @throws {NetworkError} When network request fails
24
+ */
25
+ export declare function batchCreateUserTasks(request: BatchCreateUserTasksRequest, options?: UserTaskOptions): Promise<BatchCreateUserTasksResponse>;
26
+ /**
27
+ * Gets a user task by ID.
28
+ *
29
+ * @param taskId - Task ID
30
+ * @param options - Optional configuration (include_attachments, include_sub_tasks)
31
+ * @returns Promise resolving to task
32
+ * @throws {ConfigurationError} When required environment variables are missing
33
+ * @throws {ApiError} When API request fails
34
+ * @throws {NetworkError} When network request fails
35
+ */
36
+ export declare function getUserTask(taskId: string, options?: UserTaskOptions & {
37
+ include_attachments?: boolean;
38
+ include_sub_tasks?: boolean;
39
+ }): Promise<UserTask>;
40
+ /**
41
+ * Batch gets user tasks by IDs.
42
+ *
43
+ * @param request - Batch query request
44
+ * @param options - Optional configuration
45
+ * @returns Promise resolving to array of tasks
46
+ * @throws {ConfigurationError} When required environment variables are missing
47
+ * @throws {ApiError} When API request fails
48
+ * @throws {NetworkError} When network request fails
49
+ */
50
+ export declare function batchGetUserTasks(request: BatchQueryUserTasksRequest, options?: UserTaskOptions): Promise<UserTask[]>;
51
+ /**
52
+ * Lists user tasks with pagination and optional filtering.
53
+ *
54
+ * @param request - List request parameters
55
+ * @param options - Optional configuration
56
+ * @returns Promise resolving to paginated list of tasks
57
+ * @throws {ConfigurationError} When required environment variables are missing
58
+ * @throws {ApiError} When API request fails
59
+ * @throws {NetworkError} When network request fails
60
+ */
61
+ export declare function listUserTasks(request?: ListUserTasksRequest & UserTaskOptions): Promise<PageResponse<UserTask>>;
62
+ /**
63
+ * Updates a user task.
64
+ *
65
+ * @param taskId - Task ID
66
+ * @param request - Update request
67
+ * @param options - Optional configuration
68
+ * @returns Promise resolving to updated task
69
+ * @throws {ConfigurationError} When required environment variables are missing
70
+ * @throws {ApiError} When API request fails
71
+ * @throws {NetworkError} When network request fails
72
+ */
73
+ export declare function updateUserTask(taskId: string, request: UpdateUserTaskRequest, options?: UserTaskOptions): Promise<UserTask>;
74
+ /**
75
+ * Deletes a user task.
76
+ *
77
+ * @param taskId - Task ID
78
+ * @param options - Optional configuration
79
+ * @throws {ConfigurationError} When required environment variables are missing
80
+ * @throws {ApiError} When API request fails
81
+ * @throws {NetworkError} When network request fails
82
+ */
83
+ export declare function deleteUserTask(taskId: string, options?: UserTaskOptions): Promise<void>;
84
+ /**
85
+ * Gets task input data.
86
+ *
87
+ * @param taskId - Task ID
88
+ * @param options - Optional configuration
89
+ * @returns Promise resolving to task input data
90
+ * @throws {ConfigurationError} When required environment variables are missing
91
+ * @throws {ApiError} When API request fails
92
+ * @throws {NetworkError} When network request fails
93
+ */
94
+ export declare function getTaskInput(taskId: string, options?: UserTaskOptions): Promise<Record<string, unknown>>;
95
+ /**
96
+ * Gets task output data.
97
+ *
98
+ * @param taskId - Task ID
99
+ * @param options - Optional configuration
100
+ * @returns Promise resolving to task output data
101
+ * @throws {ConfigurationError} When required environment variables are missing
102
+ * @throws {ApiError} When API request fails
103
+ * @throws {NetworkError} When network request fails
104
+ */
105
+ export declare function getTaskOutput(taskId: string, options?: UserTaskOptions): Promise<Record<string, unknown>>;
106
+ /**
107
+ * Updates task input data.
108
+ *
109
+ * @param taskId - Task ID
110
+ * @param taskInput - New task input data
111
+ * @param options - Optional configuration
112
+ * @returns Promise resolving to updated task
113
+ * @throws {ConfigurationError} When required environment variables are missing
114
+ * @throws {ApiError} When API request fails
115
+ * @throws {NetworkError} When network request fails
116
+ */
117
+ export declare function updateTaskInput(taskId: string, taskInput: Record<string, unknown>, options?: UserTaskOptions): Promise<UserTask>;
118
+ /**
119
+ * Updates task output data.
120
+ *
121
+ * @param taskId - Task ID
122
+ * @param taskOutput - New task output data
123
+ * @param options - Optional configuration
124
+ * @returns Promise resolving to updated task
125
+ * @throws {ConfigurationError} When required environment variables are missing
126
+ * @throws {ApiError} When API request fails
127
+ * @throws {NetworkError} When network request fails
128
+ */
129
+ export declare function updateTaskOutput(taskId: string, taskOutput: Record<string, unknown>, options?: UserTaskOptions): Promise<UserTask>;
130
+ /**
131
+ * Gets task status.
132
+ *
133
+ * @param taskId - Task ID
134
+ * @param options - Optional configuration
135
+ * @returns Promise resolving to task status
136
+ * @throws {ConfigurationError} When required environment variables are missing
137
+ * @throws {ApiError} When API request fails
138
+ * @throws {NetworkError} When network request fails
139
+ */
140
+ export declare function getTaskStatus(taskId: string, options?: UserTaskOptions): Promise<string>;
141
+ /**
142
+ * Updates task status.
143
+ *
144
+ * @param taskId - Task ID
145
+ * @param request - Status update request
146
+ * @param options - Optional configuration
147
+ * @returns Promise resolving to updated task
148
+ * @throws {ConfigurationError} When required environment variables are missing
149
+ * @throws {ApiError} When API request fails
150
+ * @throws {NetworkError} When network request fails
151
+ */
152
+ export declare function updateTaskStatus(taskId: string, request: UpdateTaskStatusRequest, options?: UserTaskOptions): Promise<UserTask>;
153
+ /**
154
+ * Gets task statistics.
155
+ *
156
+ * @param userId - Optional user ID filter
157
+ * @param options - Optional configuration
158
+ * @returns Promise resolving to task statistics
159
+ * @throws {ConfigurationError} When required environment variables are missing
160
+ * @throws {ApiError} When API request fails
161
+ * @throws {NetworkError} When network request fails
162
+ */
163
+ export declare function getTaskStatistics(userId?: string, options?: UserTaskOptions): Promise<TaskStatistics>;