@amaster.ai/client 1.1.50 → 1.1.52-beta.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/dist/index.cjs +283 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -3
- package/dist/index.d.ts +135 -3
- package/dist/index.js +283 -0
- package/dist/index.js.map +1 -1
- package/package.json +14 -11
- package/types/__tests__/type-checks.test-d.ts +37 -0
- package/types/bpm.d.ts +9 -1
- package/types/index.d.ts +36 -0
- package/types/knowledge.d.ts +160 -0
|
@@ -190,6 +190,17 @@ describe('Type Tests', () => {
|
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
describe('BPM Types', () => {
|
|
193
|
+
it('should accept businessKey when starting a process', () => {
|
|
194
|
+
type StartProcessInputs = Parameters<AmasterClient['bpm']['startProcess']>[1];
|
|
195
|
+
|
|
196
|
+
expectTypeOf<{
|
|
197
|
+
businessKey: string;
|
|
198
|
+
variables: {
|
|
199
|
+
expense_id: { value: string; type: 'String' };
|
|
200
|
+
};
|
|
201
|
+
}>().toMatchTypeOf<StartProcessInputs>();
|
|
202
|
+
});
|
|
203
|
+
|
|
193
204
|
it('should have correct Task structure', () => {
|
|
194
205
|
expectTypeOf<Task>().toMatchTypeOf<{
|
|
195
206
|
id: string;
|
|
@@ -206,5 +217,31 @@ describe('Type Tests', () => {
|
|
|
206
217
|
businessKey?: string;
|
|
207
218
|
}>();
|
|
208
219
|
});
|
|
220
|
+
|
|
221
|
+
it('should allow BPM variable submissions with business keys', () => {
|
|
222
|
+
expectTypeOf<Parameters<AmasterClient['bpm']['startProcess']>[1]>().toMatchTypeOf<{
|
|
223
|
+
businessKey?: string;
|
|
224
|
+
variables: {
|
|
225
|
+
recordId: {
|
|
226
|
+
value: string;
|
|
227
|
+
type: 'String';
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}>();
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('should not expose business keys on BPM task completion submissions', () => {
|
|
234
|
+
expectTypeOf<Parameters<AmasterClient['bpm']['completeTask']>[1]>().toMatchTypeOf<{
|
|
235
|
+
variables: {
|
|
236
|
+
approved: {
|
|
237
|
+
value: boolean;
|
|
238
|
+
type: 'Boolean';
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
}>();
|
|
242
|
+
expectTypeOf<Parameters<AmasterClient['bpm']['completeTask']>[1]>().not.toMatchTypeOf<{
|
|
243
|
+
businessKey?: string;
|
|
244
|
+
}>();
|
|
245
|
+
});
|
|
209
246
|
});
|
|
210
247
|
});
|
package/types/bpm.d.ts
CHANGED
|
@@ -79,6 +79,14 @@ export interface VariableSubmission {
|
|
|
79
79
|
variables: Record<string, CamundaVariable>;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Process start payload. `businessKey` is only valid when starting a process,
|
|
84
|
+
* not when completing a task.
|
|
85
|
+
*/
|
|
86
|
+
export interface ProcessStartSubmission extends VariableSubmission {
|
|
87
|
+
businessKey?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
82
90
|
// ==================== Process Types ====================
|
|
83
91
|
|
|
84
92
|
/**
|
|
@@ -392,7 +400,7 @@ export interface BpmClientAPI {
|
|
|
392
400
|
*/
|
|
393
401
|
startProcess(
|
|
394
402
|
processKey: string,
|
|
395
|
-
inputs?: Record<string, CamundaVariableValue> |
|
|
403
|
+
inputs?: Record<string, CamundaVariableValue> | ProcessStartSubmission
|
|
396
404
|
): Promise<ClientResult<ProcessInstance>>;
|
|
397
405
|
|
|
398
406
|
/**
|
package/types/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* - **Entity Operations**: {@link ./entity.d.ts}
|
|
31
31
|
* - **BPM (Business Process)**: {@link ./bpm.d.ts}
|
|
32
32
|
* - **Workflow Execution**: {@link ./workflow.d.ts}
|
|
33
|
+
* - **Knowledge Base**: {@link ./knowledge.d.ts}
|
|
33
34
|
*
|
|
34
35
|
* ## AI-Friendly Type Structure
|
|
35
36
|
* This package provides modular type definitions optimized for AI tools and large language models.
|
|
@@ -48,6 +49,7 @@ import type { AuthClientAPI } from "./auth/index";
|
|
|
48
49
|
import type { EntityClientAPI } from "./entity";
|
|
49
50
|
import type { BpmClientAPI } from "./bpm";
|
|
50
51
|
import type { WorkflowClientAPI } from "./workflow";
|
|
52
|
+
import type { KnowledgeClientAPI } from "./knowledge";
|
|
51
53
|
import type { ASRClientConfig, ASRClient, ASRHttpClientConfig, ASRHttpClient } from "./asr";
|
|
52
54
|
import type { CopilotClientAPI } from "./copilot";
|
|
53
55
|
import type { FunctionClientAPI } from "./function";
|
|
@@ -206,6 +208,16 @@ export interface AmasterClient {
|
|
|
206
208
|
*/
|
|
207
209
|
workflow: WorkflowClientAPI;
|
|
208
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Knowledge base document management module
|
|
213
|
+
*
|
|
214
|
+
* Provides methods for resolving the current organization knowledge base,
|
|
215
|
+
* listing documents, uploading documents, polling indexing status, and deleting documents.
|
|
216
|
+
*
|
|
217
|
+
* For detailed documentation, see {@link ./knowledge.d.ts}
|
|
218
|
+
*/
|
|
219
|
+
knowledge: KnowledgeClientAPI;
|
|
220
|
+
|
|
209
221
|
/**
|
|
210
222
|
* ASR (Automatic Speech Recognition) module
|
|
211
223
|
*
|
|
@@ -414,6 +426,30 @@ export type {
|
|
|
414
426
|
WorkflowInputValue,
|
|
415
427
|
WorkflowFile,
|
|
416
428
|
} from "./workflow";
|
|
429
|
+
export type {
|
|
430
|
+
KnowledgeClientAPI,
|
|
431
|
+
KnowledgeClientAPI as KnowledgeClient,
|
|
432
|
+
KnowledgeDatasetIdResponse,
|
|
433
|
+
KnowledgeDeleteDocumentOptions,
|
|
434
|
+
KnowledgeDocument,
|
|
435
|
+
KnowledgeDocumentListResponse,
|
|
436
|
+
KnowledgeDocumentListStatus,
|
|
437
|
+
KnowledgeDocumentStatus,
|
|
438
|
+
KnowledgeGetDatasetIdOptions,
|
|
439
|
+
KnowledgeIndexingStatus,
|
|
440
|
+
KnowledgeIndexingStatusOptions,
|
|
441
|
+
KnowledgeIndexingStatusResponse,
|
|
442
|
+
KnowledgeListDocumentsOptions,
|
|
443
|
+
KnowledgeMetadataField,
|
|
444
|
+
KnowledgeMetadataOperation,
|
|
445
|
+
KnowledgeMetadataUpdateRequest,
|
|
446
|
+
KnowledgeResolveOptions,
|
|
447
|
+
KnowledgeRoles,
|
|
448
|
+
KnowledgeUpdateDocumentsMetadataOptions,
|
|
449
|
+
KnowledgeUploadDocumentOptions,
|
|
450
|
+
KnowledgeUploadResponse,
|
|
451
|
+
KnowledgeWaitForIndexingOptions,
|
|
452
|
+
} from "./knowledge";
|
|
417
453
|
export type {
|
|
418
454
|
ASRClient,
|
|
419
455
|
ASRClientConfig,
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge base document management types.
|
|
3
|
+
*
|
|
4
|
+
* @module knowledge
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ClientResult } from "./common";
|
|
8
|
+
|
|
9
|
+
export type KnowledgeDocumentStatus = "completed" | "indexing" | "error" | "paused";
|
|
10
|
+
export type KnowledgeDocumentListStatus = KnowledgeDocumentStatus | "all";
|
|
11
|
+
export type KnowledgeRoles = string | string[];
|
|
12
|
+
|
|
13
|
+
export interface KnowledgeDatasetIdResponse {
|
|
14
|
+
dataset_id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface KnowledgeDocument {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
data_source_type?: string;
|
|
21
|
+
doc_type?: string | null;
|
|
22
|
+
doc_form?: string | null;
|
|
23
|
+
indexing_status?: string;
|
|
24
|
+
display_status?: string;
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
archived?: boolean;
|
|
27
|
+
word_count?: number;
|
|
28
|
+
hit_count?: number;
|
|
29
|
+
position?: number;
|
|
30
|
+
created_at?: number;
|
|
31
|
+
updated_at?: number;
|
|
32
|
+
completed_segments?: number;
|
|
33
|
+
total_segments?: number;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface KnowledgeDocumentListResponse {
|
|
38
|
+
data: KnowledgeDocument[];
|
|
39
|
+
total: number;
|
|
40
|
+
page: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
has_more: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface KnowledgeIndexingStatus {
|
|
46
|
+
id: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
indexing_status?: string;
|
|
49
|
+
processing_started_at?: number | null;
|
|
50
|
+
parsing_completed_at?: number | null;
|
|
51
|
+
cleaning_completed_at?: number | null;
|
|
52
|
+
splitting_completed_at?: number | null;
|
|
53
|
+
completed_at?: number | null;
|
|
54
|
+
paused_at?: number | null;
|
|
55
|
+
stopped_at?: number | null;
|
|
56
|
+
completed_segments?: number;
|
|
57
|
+
total_segments?: number;
|
|
58
|
+
error?: string | null;
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface KnowledgeIndexingStatusResponse {
|
|
63
|
+
data: KnowledgeIndexingStatus[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface KnowledgeUploadResponse {
|
|
67
|
+
document: KnowledgeDocument;
|
|
68
|
+
batch: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface KnowledgeMetadataField {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
type?: "string" | "number" | "time" | string;
|
|
75
|
+
value: unknown;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface KnowledgeMetadataOperation {
|
|
79
|
+
document_id: string;
|
|
80
|
+
metadata_list: KnowledgeMetadataField[];
|
|
81
|
+
partial_update?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface KnowledgeMetadataUpdateRequest {
|
|
85
|
+
operation_data: KnowledgeMetadataOperation[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type KnowledgeResolveOptions =
|
|
89
|
+
| {
|
|
90
|
+
datasetId: string;
|
|
91
|
+
orgCode?: string;
|
|
92
|
+
refresh?: boolean;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
datasetId?: string;
|
|
96
|
+
orgCode: string;
|
|
97
|
+
refresh?: boolean;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export interface KnowledgeGetDatasetIdOptions {
|
|
101
|
+
orgCode: string;
|
|
102
|
+
refresh?: boolean;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type KnowledgeListDocumentsOptions = KnowledgeResolveOptions & {
|
|
106
|
+
page?: number;
|
|
107
|
+
limit?: number;
|
|
108
|
+
keyword?: string;
|
|
109
|
+
status?: KnowledgeDocumentListStatus;
|
|
110
|
+
sort?: string;
|
|
111
|
+
fetch?: boolean | string;
|
|
112
|
+
appCode?: string;
|
|
113
|
+
roles?: KnowledgeRoles;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type KnowledgeUploadDocumentOptions = KnowledgeResolveOptions & {
|
|
117
|
+
file: File | Blob;
|
|
118
|
+
fileName?: string;
|
|
119
|
+
appCode?: string;
|
|
120
|
+
config?: Record<string, unknown>;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type KnowledgeIndexingStatusOptions = KnowledgeResolveOptions & {
|
|
124
|
+
batch: string;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type KnowledgeWaitForIndexingOptions = KnowledgeIndexingStatusOptions & {
|
|
128
|
+
intervalMs?: number;
|
|
129
|
+
timeoutMs?: number;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type KnowledgeDeleteDocumentOptions = KnowledgeResolveOptions & {
|
|
133
|
+
documentId: string;
|
|
134
|
+
appCode?: string;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type KnowledgeUpdateDocumentsMetadataOptions = KnowledgeResolveOptions &
|
|
138
|
+
KnowledgeMetadataUpdateRequest;
|
|
139
|
+
|
|
140
|
+
export interface KnowledgeClientAPI {
|
|
141
|
+
getDatasetId(
|
|
142
|
+
options: KnowledgeGetDatasetIdOptions
|
|
143
|
+
): Promise<ClientResult<KnowledgeDatasetIdResponse>>;
|
|
144
|
+
listDocuments(
|
|
145
|
+
options: KnowledgeListDocumentsOptions
|
|
146
|
+
): Promise<ClientResult<KnowledgeDocumentListResponse>>;
|
|
147
|
+
uploadDocument(
|
|
148
|
+
options: KnowledgeUploadDocumentOptions
|
|
149
|
+
): Promise<ClientResult<KnowledgeUploadResponse>>;
|
|
150
|
+
getIndexingStatus(
|
|
151
|
+
options: KnowledgeIndexingStatusOptions
|
|
152
|
+
): Promise<ClientResult<KnowledgeIndexingStatusResponse>>;
|
|
153
|
+
waitForIndexing(
|
|
154
|
+
options: KnowledgeWaitForIndexingOptions
|
|
155
|
+
): Promise<ClientResult<KnowledgeIndexingStatusResponse>>;
|
|
156
|
+
deleteDocument(options: KnowledgeDeleteDocumentOptions): Promise<ClientResult<null>>;
|
|
157
|
+
updateDocumentsMetadata(
|
|
158
|
+
options: KnowledgeUpdateDocumentsMetadataOptions
|
|
159
|
+
): Promise<ClientResult<{ result: string }>>;
|
|
160
|
+
}
|