@amaster.ai/client 1.1.3 → 1.1.4
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 +8 -11
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -19
- package/dist/index.d.ts +6 -19
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/types/__tests__/type-checks.test-d.ts +26 -8
- package/types/asr.d.ts +1 -1
- package/types/auth/code-auth.d.ts +21 -17
- package/types/auth/index.d.ts +53 -73
- package/types/auth/oauth.d.ts +137 -86
- package/types/auth/password-auth.d.ts +81 -51
- package/types/auth/permissions.d.ts +46 -0
- package/types/auth/profile.d.ts +17 -21
- package/types/auth/sessions.d.ts +83 -0
- package/types/auth/user.d.ts +65 -21
- package/types/bpm.d.ts +365 -2
- package/types/common.d.ts +23 -41
- package/types/entity.d.ts +7 -7
- package/types/function.d.ts +1 -1
- package/types/index.d.ts +59 -21
- package/types/s3.d.ts +3 -3
- package/types/workflow.d.ts +1 -1
package/types/index.d.ts
CHANGED
|
@@ -9,24 +9,23 @@
|
|
|
9
9
|
*
|
|
10
10
|
* ## Quick Start
|
|
11
11
|
* ```typescript
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* });
|
|
12
|
+
* import { createClient } from '@amaster.ai/client';
|
|
13
|
+
*
|
|
14
|
+
* const client = createClient({
|
|
15
|
+
* onUnauthorized: () => window.location.href = '/login'
|
|
16
|
+
* });
|
|
18
17
|
*
|
|
19
18
|
* // Login
|
|
20
19
|
* await client.auth.login({ email, password });
|
|
21
20
|
*
|
|
22
21
|
* // All subsequent requests automatically include auth token
|
|
23
22
|
* await client.entity.list('default', 'users');
|
|
24
|
-
* await client.bpm.startProcess('approval'
|
|
23
|
+
* await client.bpm.startProcess({ processKey: 'approval' });
|
|
25
24
|
* ```
|
|
26
25
|
*
|
|
27
26
|
* ## Module Documentation
|
|
28
27
|
* For detailed API documentation, see individual module type definitions:
|
|
29
|
-
* - **Authentication**: {@link ./auth/index.d.ts} (split into user, password-auth, code-auth, oauth, permissions, profile)
|
|
28
|
+
* - **Authentication**: {@link ./auth/index.d.ts} (split into user, password-auth, code-auth, oauth, permissions, profile, sessions)
|
|
30
29
|
* - **Entity Operations**: {@link ./entity.d.ts}
|
|
31
30
|
* - **BPM (Business Process)**: {@link ./bpm.d.ts}
|
|
32
31
|
* - **Workflow Execution**: {@link ./workflow.d.ts}
|
|
@@ -51,7 +50,7 @@ import type { WorkflowClientAPI } from "./workflow";
|
|
|
51
50
|
import type { ASRClientConfig, ASRClient, ASRHttpClientConfig, ASRHttpClient } from "./asr";
|
|
52
51
|
import type { CopilotClientAPI } from "./copilot";
|
|
53
52
|
import type { FunctionClientAPI } from "./function";
|
|
54
|
-
import type { TTSClientAPI } from "./tts";
|
|
53
|
+
import type { TTSClientAPI, TTSClientConfig } from "./tts";
|
|
55
54
|
import type { S3ClientAPI } from "./s3";
|
|
56
55
|
import type { HttpClient } from "./http";
|
|
57
56
|
|
|
@@ -123,6 +122,15 @@ export interface AmasterClientOptions {
|
|
|
123
122
|
* @default true
|
|
124
123
|
*/
|
|
125
124
|
autoHandleOAuthCallback?: boolean;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Automatically redirect to the current page's `?redirect=...` target after successful login
|
|
128
|
+
*
|
|
129
|
+
* Applies to password login, code login, Mini Program login, and OAuth callback handling.
|
|
130
|
+
*
|
|
131
|
+
* @default true
|
|
132
|
+
*/
|
|
133
|
+
autoRedirectAfterLogin?: boolean;
|
|
126
134
|
}
|
|
127
135
|
|
|
128
136
|
/**
|
|
@@ -229,7 +237,7 @@ export interface AmasterClient {
|
|
|
229
237
|
*
|
|
230
238
|
* For detailed documentation, see {@link ./tts.d.ts}
|
|
231
239
|
*/
|
|
232
|
-
tts: TTSClientAPI;
|
|
240
|
+
tts: (config: TTSClientConfig) => TTSClientAPI;
|
|
233
241
|
|
|
234
242
|
/**
|
|
235
243
|
* S3 Storage module
|
|
@@ -313,22 +321,52 @@ export interface AmasterClient {
|
|
|
313
321
|
* @returns A configured Amaster client instance
|
|
314
322
|
*
|
|
315
323
|
*/
|
|
316
|
-
export declare function createClient(options
|
|
324
|
+
export declare function createClient(options?: AmasterClientOptions): AmasterClient;
|
|
317
325
|
|
|
318
326
|
// Re-export shared common types
|
|
319
|
-
export type { ClientResult } from "./common";
|
|
327
|
+
export type { ClientError, ClientResult } from "./common";
|
|
320
328
|
|
|
321
329
|
// Re-export main client interfaces
|
|
322
|
-
export type { AuthClientAPI } from "./auth";
|
|
323
|
-
export type {
|
|
324
|
-
|
|
325
|
-
|
|
330
|
+
export type { AuthClientAPI, AuthClientAPI as AuthClient } from "./auth";
|
|
331
|
+
export type {
|
|
332
|
+
AuthEvent,
|
|
333
|
+
EventHandler,
|
|
334
|
+
LoginParams,
|
|
335
|
+
LoginResponse,
|
|
336
|
+
RegisterParams,
|
|
337
|
+
RegisterResponse,
|
|
338
|
+
RefreshTokenResponse,
|
|
339
|
+
SuccessResponse,
|
|
340
|
+
CodeLoginParams,
|
|
341
|
+
CodeLoginType,
|
|
342
|
+
SendCodeParams,
|
|
343
|
+
SendCodeType,
|
|
344
|
+
CaptchaResponse,
|
|
345
|
+
OAuthProvider,
|
|
346
|
+
OAuthBinding,
|
|
347
|
+
MiniProgramLoginParams,
|
|
348
|
+
MiniProgramPhoneParams,
|
|
349
|
+
MiniProgramPhoneResponse,
|
|
350
|
+
UpdateMeParams,
|
|
351
|
+
UpdateProfileParams,
|
|
352
|
+
PermissionCheck,
|
|
353
|
+
Session,
|
|
354
|
+
RevokeAllSessionsResponse,
|
|
355
|
+
User,
|
|
356
|
+
Role,
|
|
357
|
+
Permission,
|
|
358
|
+
RoleDetail,
|
|
359
|
+
PermissionDetail,
|
|
360
|
+
} from "./auth";
|
|
361
|
+
export type { EntityClientAPI, EntityQueryParams, EntityListResponse, FilterOperator, FilterItem, FilterGroup } from "./entity";
|
|
362
|
+
export type { BpmClientAPI, ProcessInstance, Task, TaskQueryParams, ProcessVariable, HistoryTask, HistoryProcessInstance, HistoryActivityInstance, ActivityInstanceTree, UserOperationLog, CamundaVariable, TaskFormSchema } from "./bpm";
|
|
363
|
+
export type { WorkflowClientAPI, WorkflowRunRequest, WorkflowRunResponse, WorkflowInputValue, WorkflowFile } from "./workflow";
|
|
326
364
|
export type { ASRClient, ASRClientConfig, ASRHttpClient, ASRHttpClientConfig, Recorder, RecorderOptions } from "./asr";
|
|
327
|
-
export type { CopilotClientAPI } from "./copilot";
|
|
328
|
-
export type { FunctionClientAPI } from "./function";
|
|
329
|
-
export type { TTSClientAPI } from "./tts";
|
|
330
|
-
export type { S3ClientAPI } from "./s3";
|
|
331
|
-
export type { HttpClient } from "./http";
|
|
365
|
+
export type { CopilotClientAPI, CopilotClientAPI as CopilotClient, MessageContent, TextContent, ImageContent, FileContent, ConversationController, ConversationControllerOptions, ConversationControllerSnapshot, Conversation, MessagesItem, TextMessage, ErrorMessage, ThoughtMessage, ToolMessage, UIRenderMessage, Role as CopilotRole } from "./copilot";
|
|
366
|
+
export type { FunctionClientAPI, FunctionClientAPI as FunctionClient } from "./function";
|
|
367
|
+
export type { TTSClientAPI, TTSClientAPI as TTSClient, TTSClientConfig } from "./tts";
|
|
368
|
+
export type { S3ClientAPI, UploadRes, S3Metadata, S3ClientAPI as S3Client } from "./s3";
|
|
369
|
+
export type { HttpClient, RequestConfig } from "./http";
|
|
332
370
|
|
|
333
371
|
// For detailed types, import directly from submodules:
|
|
334
372
|
// import type { LoginParams, User } from '@amaster.ai/client/auth'
|
package/types/s3.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface S3ClientAPI {
|
|
|
47
47
|
*
|
|
48
48
|
* @example
|
|
49
49
|
* const result = await client.s3.download('documents/report.pdf');
|
|
50
|
-
* if (result.
|
|
50
|
+
* if (result.data) {
|
|
51
51
|
* const blob = result.data;
|
|
52
52
|
* const url = URL.createObjectURL(blob);
|
|
53
53
|
* window.open(url);
|
|
@@ -65,7 +65,7 @@ export interface S3ClientAPI {
|
|
|
65
65
|
*
|
|
66
66
|
* @example
|
|
67
67
|
* const result = await client.s3.getMetadata('images/photo.jpg');
|
|
68
|
-
* if (result.
|
|
68
|
+
* if (result.data) {
|
|
69
69
|
* console.log('Size:', result.data.contentLength);
|
|
70
70
|
* console.log('Type:', result.data.contentType);
|
|
71
71
|
* }
|
|
@@ -85,7 +85,7 @@ export interface S3ClientAPI {
|
|
|
85
85
|
* const file = fileInput.files[0];
|
|
86
86
|
*
|
|
87
87
|
* const result = await client.s3.upload(file);
|
|
88
|
-
* if (result.
|
|
88
|
+
* if (result.data) {
|
|
89
89
|
* console.log('File uploaded:', result.data.url);
|
|
90
90
|
* console.log('File key:', result.data.key);
|
|
91
91
|
* }
|