@amaster.ai/client 1.1.2 → 1.1.3

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/types/bpm.d.ts CHANGED
@@ -534,7 +534,7 @@ export interface BpmClientAPI {
534
534
  *
535
535
  * @example
536
536
  * const result = await client.bpm.getTask('task-123');
537
- * if (result.data) {
537
+ * if (result.success) {
538
538
  * console.log('Task:', result.data.name);
539
539
  * }
540
540
  *
@@ -640,137 +640,12 @@ export interface BpmClientAPI {
640
640
  params?: HistoryProcessInstanceQueryParams
641
641
  ): Promise<ClientResult<{ count: number }>>;
642
642
 
643
- /**
644
- * Get a single historical process instance by ID
645
- */
646
- getHistoryProcessInstance(
647
- processInstanceId: string
648
- ): Promise<ClientResult<HistoryProcessInstance>>;
649
-
650
- /**
651
- * Query process variables by process instance
652
- */
653
- getProcessVariables(params: {
654
- processInstanceId: string;
655
- variableName?: string;
656
- }): Promise<ClientResult<ProcessVariable[]>>;
657
-
658
- /**
659
- * Get process definition list
660
- */
661
- getProcessDefinitions(
662
- params?: ProcessDefinitionQueryParams
663
- ): Promise<ClientResult<ProcessDefinitionFull[]>>;
664
-
665
- /**
666
- * Get BPMN XML for a process definition key
667
- */
668
- getProcessXml(processKey: string): Promise<ClientResult<ProcessXmlResponse>>;
669
-
670
- /**
671
- * Get the runtime activity instance tree for a process instance
672
- */
673
- getActivityInstanceTree(
674
- processInstanceId: string
675
- ): Promise<ClientResult<ActivityInstanceTree>>;
676
-
677
- /**
678
- * Get runtime variables for a process instance
679
- */
680
- getRuntimeVariables(
681
- processInstanceId: string
682
- ): Promise<ClientResult<Record<string, { value: CamundaVariableValue; type: string }>>>;
683
-
684
- /**
685
- * Delegate a task to another user
686
- */
687
- delegateTask(taskId: string, userId: string): Promise<ClientResult<null>>;
688
-
689
- /**
690
- * Get task form metadata
691
- */
692
- getTaskForm(taskId: string): Promise<ClientResult<TaskFormData>>;
693
-
694
- /**
695
- * Get rendered task form HTML
696
- */
697
- getTaskRenderedForm(taskId: string): Promise<ClientResult<string>>;
698
-
699
643
  /**
700
644
  * Get deployed Camunda form definition for a task
701
645
  */
702
646
  getTaskDeployedForm(
703
647
  taskId: string
704
648
  ): Promise<ClientResult<CamundaFormDefinition>>;
705
-
706
- /**
707
- * Get start form metadata
708
- */
709
- getStartFormInfo(processKey: string): Promise<ClientResult<StartFormInfo>>;
710
-
711
- /**
712
- * Get start form variables
713
- */
714
- getStartFormVariables(processKey: string): Promise<ClientResult<TaskFormVariables>>;
715
-
716
- /**
717
- * Get deployed start form definition
718
- */
719
- getDeployedStartForm(processKey: string): Promise<ClientResult<CamundaFormDefinition>>;
720
-
721
- /**
722
- * Query historical activity instances
723
- */
724
- getHistoryActivityInstances(
725
- params?: HistoryActivityQueryParams
726
- ): Promise<ClientResult<HistoryActivityInstance[]>>;
727
-
728
- /**
729
- * Query historical variable instances
730
- */
731
- getHistoryVariableInstances(
732
- params?: HistoryVariableQueryParams
733
- ): Promise<ClientResult<HistoryVariableInstance[]>>;
734
-
735
- /**
736
- * Query user operation logs
737
- */
738
- getUserOperationLogs(
739
- params?: UserOperationLogQueryParams
740
- ): Promise<ClientResult<UserOperationLog[]>>;
741
-
742
- /**
743
- * Delete a historical process instance
744
- */
745
- deleteHistoryProcessInstance(processInstanceId: string): Promise<ClientResult<null>>;
746
-
747
- /**
748
- * Suspend a running process instance
749
- */
750
- suspendProcessInstance(processInstanceId: string): Promise<ClientResult<null>>;
751
-
752
- /**
753
- * Activate a suspended process instance
754
- */
755
- activateProcessInstance(processInstanceId: string): Promise<ClientResult<null>>;
756
-
757
- /**
758
- * Modify a process instance for jump/cancel/start operations
759
- */
760
- modifyProcessInstance(
761
- processInstanceId: string,
762
- modification: ProcessInstanceModification
763
- ): Promise<ClientResult<null>>;
764
-
765
- /**
766
- * Get available roles in the current tenant
767
- */
768
- getRoles(): Promise<ClientResult<Role[]>>;
769
-
770
- /**
771
- * Get roles assigned to a user
772
- */
773
- getUserRoles(userId: string): Promise<ClientResult<Role[]>>;
774
649
  }
775
650
 
776
651
  /**
@@ -807,12 +682,8 @@ export interface HistoryProcessInstanceQueryParams {
807
682
  startedBy?: string;
808
683
  /** Filter finished/unfinished processes */
809
684
  finished?: boolean;
810
- /** Filter unfinished processes */
811
- unfinished?: boolean;
812
685
  /** Filter by process definition key */
813
686
  processDefinitionKey?: string;
814
- /** Access scope: strict "my initiated" view */
815
- scope?: "initiated";
816
687
  /** Sort field */
817
688
  sortBy?: string;
818
689
  /** Sort order */
@@ -835,8 +706,6 @@ export interface HistoryTaskQueryParams {
835
706
  finished?: boolean;
836
707
  /** Filter unfinished tasks */
837
708
  unfinished?: boolean;
838
- /** Access scope: strict "my handled" view */
839
- scope?: "handled";
840
709
  /** Pagination: first result index */
841
710
  firstResult?: number;
842
711
  /** Pagination: max results to return */
@@ -873,235 +742,3 @@ export interface CamundaFormComponent {
873
742
  values?: Array<{ label: string; value: string }>;
874
743
  properties?: Record<string, unknown>;
875
744
  }
876
-
877
- /**
878
- * Full process definition information
879
- */
880
- export interface ProcessDefinitionFull {
881
- id: string;
882
- key: string;
883
- name: string;
884
- version: number;
885
- deploymentId: string;
886
- resourceName: string;
887
- category?: string;
888
- description?: string;
889
- diagram?: string;
890
- suspended: boolean;
891
- tenantId?: string;
892
- versionTag?: string;
893
- historyTimeToLive?: number;
894
- startableInTasklist: boolean;
895
- }
896
-
897
- /**
898
- * Process definition query parameters
899
- */
900
- export interface ProcessDefinitionQueryParams {
901
- key?: string;
902
- name?: string;
903
- latestVersion?: boolean;
904
- active?: boolean;
905
- suspended?: boolean;
906
- sortBy?: string;
907
- sortOrder?: 'asc' | 'desc';
908
- [key: string]: string | number | boolean | undefined;
909
- }
910
-
911
- /**
912
- * BPMN XML response
913
- */
914
- export interface ProcessXmlResponse {
915
- bpmn20Xml: string;
916
- processDefinitionId: string;
917
- }
918
-
919
- /**
920
- * Runtime activity instance tree
921
- */
922
- export interface ActivityInstanceTree {
923
- id: string;
924
- activityId: string;
925
- activityName: string;
926
- activityType: string;
927
- processInstanceId: string;
928
- processDefinitionId: string;
929
- childActivityInstances: ActivityInstanceTree[];
930
- childTransitionInstances: TransitionInstance[];
931
- executionIds: string[];
932
- incidentIds: string[];
933
- }
934
-
935
- /**
936
- * Runtime transition instance
937
- */
938
- export interface TransitionInstance {
939
- id: string;
940
- activityId: string;
941
- activityName: string;
942
- activityType: string;
943
- processInstanceId: string;
944
- processDefinitionId: string;
945
- executionId: string;
946
- incidentIds: string[];
947
- }
948
-
949
- /**
950
- * Historical activity instance
951
- */
952
- export interface HistoryActivityInstance {
953
- id: string;
954
- activityId: string;
955
- activityName: string;
956
- activityType: string;
957
- processDefinitionId: string;
958
- processDefinitionKey: string;
959
- processInstanceId: string;
960
- executionId: string;
961
- taskId?: string;
962
- assignee?: string;
963
- calledProcessInstanceId?: string;
964
- calledCaseInstanceId?: string;
965
- startTime: string;
966
- endTime?: string;
967
- durationInMillis?: number;
968
- canceled: boolean;
969
- completeScope: boolean;
970
- tenantId?: string;
971
- removalTime?: string;
972
- rootProcessInstanceId: string;
973
- }
974
-
975
- /**
976
- * Historical activity query parameters
977
- */
978
- export interface HistoryActivityQueryParams {
979
- processInstanceId?: string;
980
- activityId?: string;
981
- activityType?: string;
982
- finished?: boolean;
983
- sortBy?: string;
984
- sortOrder?: 'asc' | 'desc';
985
- [key: string]: string | number | boolean | undefined;
986
- }
987
-
988
- /**
989
- * Historical variable instance
990
- */
991
- export interface HistoryVariableInstance {
992
- id: string;
993
- name: string;
994
- type: string;
995
- value: CamundaVariableValue;
996
- valueInfo?: Record<string, unknown>;
997
- processDefinitionKey: string;
998
- processDefinitionId: string;
999
- processInstanceId: string;
1000
- executionId: string;
1001
- activityInstanceId?: string;
1002
- taskId?: string;
1003
- tenantId?: string;
1004
- errorMessage?: string;
1005
- state: string;
1006
- createTime: string;
1007
- removalTime?: string;
1008
- rootProcessInstanceId: string;
1009
- }
1010
-
1011
- /**
1012
- * Historical variable query parameters
1013
- */
1014
- export interface HistoryVariableQueryParams {
1015
- processInstanceId?: string;
1016
- variableName?: string;
1017
- deserializeValues?: boolean;
1018
- [key: string]: string | number | boolean | undefined;
1019
- }
1020
-
1021
- /**
1022
- * Task form metadata
1023
- */
1024
- export interface TaskFormData {
1025
- key?: string;
1026
- contextPath?: string;
1027
- camundaFormRef?: {
1028
- key: string;
1029
- binding: string;
1030
- version?: number;
1031
- };
1032
- }
1033
-
1034
- /**
1035
- * Start form metadata
1036
- */
1037
- export interface StartFormInfo {
1038
- key?: string;
1039
- contextPath?: string;
1040
- camundaFormRef?: {
1041
- key: string;
1042
- binding: string;
1043
- version?: number;
1044
- };
1045
- }
1046
-
1047
- /**
1048
- * User operation log entry
1049
- */
1050
- export interface UserOperationLog {
1051
- id: string;
1052
- processDefinitionId?: string;
1053
- processDefinitionKey?: string;
1054
- processInstanceId?: string;
1055
- executionId?: string;
1056
- taskId?: string;
1057
- userId: string;
1058
- timestamp: string;
1059
- operationId: string;
1060
- operationType: string;
1061
- entityType: string;
1062
- property?: string;
1063
- orgValue?: string;
1064
- newValue?: string;
1065
- tenantId?: string;
1066
- }
1067
-
1068
- /**
1069
- * User operation log query parameters
1070
- */
1071
- export interface UserOperationLogQueryParams {
1072
- processInstanceId?: string;
1073
- taskId?: string;
1074
- userId?: string;
1075
- operationType?: string;
1076
- sortBy?: string;
1077
- sortOrder?: 'asc' | 'desc';
1078
- firstResult?: number;
1079
- maxResults?: number;
1080
- [key: string]: string | number | boolean | undefined;
1081
- }
1082
-
1083
- /**
1084
- * Process instance modification request
1085
- */
1086
- export interface ProcessInstanceModification {
1087
- instructions: Array<{
1088
- type: 'cancel' | 'startBeforeActivity' | 'startAfterActivity' | 'startTransition';
1089
- activityId?: string;
1090
- transitionId?: string;
1091
- activityInstanceId?: string;
1092
- transitionInstanceId?: string;
1093
- ancestorActivityInstanceId?: string;
1094
- variables?: Record<string, { value: CamundaVariableValue; type?: string }>;
1095
- }>;
1096
- skipCustomListeners?: boolean;
1097
- skipIoMappings?: boolean;
1098
- }
1099
-
1100
- /**
1101
- * BPM role information
1102
- */
1103
- export interface Role {
1104
- code: string;
1105
- name: string;
1106
- description?: string;
1107
- }
package/types/common.d.ts CHANGED
@@ -1,53 +1,62 @@
1
1
  /**
2
2
  * Error information structure
3
- *
3
+ *
4
4
  * @since 1.1.0
5
5
  */
6
6
  export interface ClientError {
7
7
  /**
8
- * Error message
8
+ * HTTP status code
9
9
  */
10
- message: string;
11
-
10
+ status: number;
11
+
12
12
  /**
13
- * HTTP status code
13
+ * Error message
14
14
  */
15
- status?: number;
16
-
15
+ message: string;
16
+
17
17
  /**
18
18
  * Application-specific error code (e.g., 'INVALID_TOKEN', 'PERMISSION_DENIED')
19
+ *
20
+ * @since 1.1.0
19
21
  */
20
22
  code?: string;
21
-
23
+
22
24
  /**
23
25
  * Additional error details (optional)
24
26
  */
25
27
  details?: unknown;
28
+
29
+ /**
30
+ * Error timestamp (ISO 8601 format)
31
+ *
32
+ * @since 1.1.0
33
+ */
34
+ timestamp?: string;
26
35
  }
27
36
 
28
37
  /**
29
38
  * Standard API response wrapper
30
- *
39
+ *
31
40
  * All Amaster API methods return results wrapped in this structure for
32
41
  * consistent error handling and type safety.
33
- *
42
+ *
34
43
  * @template T - The type of the successful response data
35
- *
44
+ *
36
45
  * @example
37
46
  * // Success case
38
47
  * const result = await client.entity.list('default', 'users');
39
- * if (result.data) {
48
+ * if (result.success) {
40
49
  * console.log('Data:', result.data);
41
50
  * }
42
- *
51
+ *
43
52
  * @example
44
53
  * // Error case
45
54
  * const result = await client.auth.login({ email, password });
46
- * if (result.error) {
55
+ * if (!result.success) {
47
56
  * console.error('Error:', result.error.message);
48
57
  * console.error('Code:', result.error.code);
49
58
  * }
50
- *
59
+ *
51
60
  * @since 1.0.0
52
61
  */
53
62
  export interface ClientResult<T> {
@@ -55,16 +64,25 @@ export interface ClientResult<T> {
55
64
  * Response data (null if error occurred)
56
65
  */
57
66
  data: T | null;
58
-
67
+
59
68
  /**
60
69
  * Error information (null if successful)
61
70
  */
62
71
  error: ClientError | null;
63
-
72
+
64
73
  /**
65
74
  * HTTP response status code
66
75
  */
67
76
  status: number;
77
+
78
+ /**
79
+ * Convenience flag for checking if request was successful
80
+ *
81
+ * Equivalent to `error === null`
82
+ *
83
+ * @since 1.1.0
84
+ */
85
+ success: boolean;
68
86
  }
69
87
 
70
88
  /**
@@ -81,7 +99,7 @@ export interface PaginationParams {
81
99
  * @default 1
82
100
  */
83
101
  page?: number;
84
-
102
+
85
103
  /**
86
104
  * Number of items per page
87
105
  * @default 20
@@ -91,7 +109,7 @@ export interface PaginationParams {
91
109
 
92
110
  /**
93
111
  * Paginated response structure
94
- *
112
+ *
95
113
  * @template T - The type of items in the list
96
114
  */
97
115
  export interface PaginatedResult<T> {
@@ -99,22 +117,22 @@ export interface PaginatedResult<T> {
99
117
  * Array of items for current page
100
118
  */
101
119
  items: T[];
102
-
120
+
103
121
  /**
104
122
  * Total number of items across all pages
105
123
  */
106
124
  total: number;
107
-
125
+
108
126
  /**
109
127
  * Current page number (1-based)
110
128
  */
111
129
  page: number;
112
-
130
+
113
131
  /**
114
132
  * Number of items per page
115
133
  */
116
134
  perPage: number;
117
-
135
+
118
136
  /**
119
137
  * Total number of pages
120
138
  */
package/types/entity.d.ts CHANGED
@@ -241,7 +241,7 @@ export interface EntityClientAPI {
241
241
  * // With type safety
242
242
  * type User = { id: number; name: string; email: string };
243
243
  * const result = await client.entity.list<User>('default', 'users');
244
- * if (result.data) {
244
+ * if (result.success) {
245
245
  * result.data.items.forEach(user => {
246
246
  * console.log(user.name); // Type-safe
247
247
  * });
@@ -266,7 +266,7 @@ export interface EntityClientAPI {
266
266
  *
267
267
  * @example
268
268
  * const result = await client.entity.get('default', 'users', 123);
269
- * if (result.data) {
269
+ * if (result.success) {
270
270
  * console.log('User:', result.data);
271
271
  * }
272
272
  *
@@ -299,7 +299,7 @@ export interface EntityClientAPI {
299
299
  * status: 'active'
300
300
  * });
301
301
  *
302
- * if (result.data) {
302
+ * if (result.success) {
303
303
  * console.log('Created user with ID:', result.data.id);
304
304
  * }
305
305
  *
@@ -327,7 +327,7 @@ export interface EntityClientAPI {
327
327
  * status: 'inactive'
328
328
  * });
329
329
  *
330
- * if (result.data) {
330
+ * if (result.success) {
331
331
  * console.log('Updated:', result.data);
332
332
  * }
333
333
  *
@@ -350,7 +350,7 @@ export interface EntityClientAPI {
350
350
  *
351
351
  * @example
352
352
  * const result = await client.entity.delete('default', 'users', 123);
353
- * if (!result.error) {
353
+ * if (result.success) {
354
354
  * console.log('User deleted');
355
355
  * }
356
356
  *
@@ -373,7 +373,7 @@ export interface EntityClientAPI {
373
373
  *
374
374
  * @example
375
375
  * const result = await client.entity.options('default', 'users', ['id', 'name']);
376
- * if (result.data) {
376
+ * if (result.success) {
377
377
  * result.data.forEach(opt => console.log(opt.name));
378
378
  * }
379
379
  *
@@ -419,7 +419,7 @@ export interface EntityClientAPI {
419
419
  *
420
420
  * @example
421
421
  * const result = await client.entity.bulkDelete('default', 'users', [1, 2, 3]);
422
- * if (!result.error) {
422
+ * if (result.success) {
423
423
  * console.log('3 users deleted');
424
424
  * }
425
425
  *
@@ -28,7 +28,7 @@ export interface FunctionClientAPI {
28
28
  * body: 'Welcome!'
29
29
  * });
30
30
  *
31
- * if (result.data) {
31
+ * if (result.success) {
32
32
  * console.log(result.data.message);
33
33
  * }
34
34
  *