@lovrabet/sdk 1.5.3 → 1.5.4-beta.2
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 +117 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/src/auth/auth-manager.d.ts +2 -0
- package/dist/src/auth/auth-utils.d.ts +2 -1
- package/dist/src/auth/index.d.ts +2 -1
- package/dist/src/auth/openapi-auth.d.ts +7 -0
- package/dist/src/auth/token-generator.d.ts +24 -0
- package/dist/src/client/client.d.ts +5 -0
- package/dist/src/config/constants.d.ts +0 -6
- package/dist/src/config/endpoints.d.ts +3 -4
- package/dist/src/config/generated-region-endpoints.d.ts +19 -0
- package/dist/src/flow/flow-client.d.ts +46 -0
- package/dist/src/flow/index.d.ts +2 -0
- package/dist/src/flow/types.d.ts +203 -0
- package/dist/src/http/http-client.d.ts +5 -0
- package/dist/src/http/transport.d.ts +14 -0
- package/dist/src/types/index.d.ts +5 -1
- package/package.json +2 -1
- package/dist/src/http/traceparent.d.ts +0 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClientConfig, AuthHeaders } from '../types';
|
|
2
|
+
import { type OpenApiAuthContext } from './openapi-auth';
|
|
2
3
|
export declare class AuthManager {
|
|
3
4
|
private config;
|
|
4
5
|
private openApiAuth?;
|
|
@@ -7,6 +8,7 @@ export declare class AuthManager {
|
|
|
7
8
|
constructor(config: ClientConfig);
|
|
8
9
|
private initAuthMethods;
|
|
9
10
|
getAuthHeaders(appCode?: string, datasetCode?: string): Promise<AuthHeaders>;
|
|
11
|
+
getFlowAuthContext(appCode: string, operatorUserId: string): Promise<OpenApiAuthContext>;
|
|
10
12
|
validateAuth(): Promise<boolean>;
|
|
11
13
|
isCookieAuth(): boolean;
|
|
12
14
|
isClientAkAuth(): boolean;
|
package/dist/src/auth/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AuthManager } from './auth-manager';
|
|
2
2
|
export { OpenApiAuth } from './openapi-auth';
|
|
3
|
+
export type { OpenApiAuthContext } from './openapi-auth';
|
|
3
4
|
export { ClientAkAuth } from './client-ak-auth';
|
|
4
5
|
export type { AuthHeaders, OpenApiAuthConfig } from '../types';
|
|
5
|
-
export { generateOpenApiToken, TokenGenerator, isTokenExpiring, getTokenRemainingTime, type GenerateTokenParams, type TokenResult } from './token-generator';
|
|
6
|
+
export { generateOpenApiToken, generateFlowOpenApiToken, TokenGenerator, isTokenExpiring, getTokenRemainingTime, type GenerateTokenParams, type GenerateFlowTokenParams, type TokenResult } from './token-generator';
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { OpenApiAuthConfig, AuthHeaders } from '../types';
|
|
2
|
+
export interface OpenApiAuthContext {
|
|
3
|
+
timestamp: number;
|
|
4
|
+
token: string;
|
|
5
|
+
headers: AuthHeaders;
|
|
6
|
+
}
|
|
2
7
|
export declare class OpenApiAuth {
|
|
3
8
|
private config;
|
|
4
9
|
constructor(config: OpenApiAuthConfig);
|
|
5
10
|
getAuthHeaders(appCode: string, datasetCode: string): Promise<AuthHeaders>;
|
|
11
|
+
getFlowAuthContext(appCode: string, operatorUserId: string): Promise<OpenApiAuthContext>;
|
|
12
|
+
private createAuthContext;
|
|
6
13
|
}
|
|
@@ -22,6 +22,19 @@ export interface GenerateTokenParams {
|
|
|
22
22
|
/** 自定义时间戳(可选,默认为当前时间) */
|
|
23
23
|
timestamp?: number;
|
|
24
24
|
}
|
|
25
|
+
/** Flow OpenAPI Token 生成参数。 */
|
|
26
|
+
export interface GenerateFlowTokenParams {
|
|
27
|
+
/** 应用代码 */
|
|
28
|
+
appCode: string;
|
|
29
|
+
/** 本次 Flow 调用绑定的操作人用户 ID */
|
|
30
|
+
operatorUserId: string;
|
|
31
|
+
/** API 访问密钥 */
|
|
32
|
+
accessKey: string;
|
|
33
|
+
/** API 密钥(可选,有默认值) */
|
|
34
|
+
secretKey?: string;
|
|
35
|
+
/** 自定义时间戳(可选,默认为当前时间) */
|
|
36
|
+
timestamp?: number;
|
|
37
|
+
}
|
|
25
38
|
/**
|
|
26
39
|
* Token 生成结果
|
|
27
40
|
*/
|
|
@@ -65,6 +78,11 @@ export interface TokenResult {
|
|
|
65
78
|
* @returns Token 和配对的 timestamp
|
|
66
79
|
*/
|
|
67
80
|
export declare function generateOpenApiToken(params: GenerateTokenParams): Promise<TokenResult>;
|
|
81
|
+
/**
|
|
82
|
+
* 为浏览器或其他不保存 accessKey 的调用方生成 Flow OpenAPI Token。
|
|
83
|
+
* Token 与 appCode、operatorUserId、timestamp 绑定,三者必须原样用于请求。
|
|
84
|
+
*/
|
|
85
|
+
export declare function generateFlowOpenApiToken(params: GenerateFlowTokenParams): Promise<TokenResult>;
|
|
68
86
|
/**
|
|
69
87
|
* Token 生成器类(可选的面向对象接口)
|
|
70
88
|
*
|
|
@@ -96,6 +114,12 @@ export declare class TokenGenerator {
|
|
|
96
114
|
datasetCode: string;
|
|
97
115
|
timestamp?: number;
|
|
98
116
|
}): Promise<TokenResult>;
|
|
117
|
+
/** 为指定操作人生成 Flow OpenAPI Token。 */
|
|
118
|
+
generateFlow(params: {
|
|
119
|
+
appCode: string;
|
|
120
|
+
operatorUserId: string;
|
|
121
|
+
timestamp?: number;
|
|
122
|
+
}): Promise<TokenResult>;
|
|
99
123
|
/**
|
|
100
124
|
* 批量生成 Token(为多个数据集生成 token)
|
|
101
125
|
*/
|
|
@@ -7,6 +7,7 @@ import { BffClient } from '../api/bff-client';
|
|
|
7
7
|
import { ClientAkBffClient } from '../api/client-ak-bff-client';
|
|
8
8
|
import { UserClient } from '../api/user-client';
|
|
9
9
|
import { ServicesNamespace } from '../services';
|
|
10
|
+
import { LovrabetFlowClient } from '../flow';
|
|
10
11
|
import { PersonalNamespace } from '../personal';
|
|
11
12
|
/**
|
|
12
13
|
* Lovrabet SDK 核心客户端类
|
|
@@ -144,6 +145,10 @@ export declare class LovrabetClient implements ILovrabetClient {
|
|
|
144
145
|
* 检查当前是否为 OpenAPI 模式
|
|
145
146
|
*/
|
|
146
147
|
isOpenApiMode(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* 创建使用当前登录用户身份的独立流程自定义页面客户端。
|
|
150
|
+
*/
|
|
151
|
+
flow(): LovrabetFlowClient;
|
|
147
152
|
/**
|
|
148
153
|
* 解析鉴权模式。无 authMode → cookie;有则严格遵循。
|
|
149
154
|
*/
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SDK 配置常量定义
|
|
3
|
-
* 统一管理 SDK 中使用的各种常量值
|
|
4
|
-
*/
|
|
5
1
|
/**
|
|
6
2
|
* 默认配置名称常量
|
|
7
3
|
*/
|
|
@@ -32,9 +28,7 @@ export declare const ENVIRONMENTS: {
|
|
|
32
28
|
* Lovrabet official deployment regions.
|
|
33
29
|
*/
|
|
34
30
|
export declare const REGIONS: {
|
|
35
|
-
/** Mainland China node (default). */
|
|
36
31
|
readonly CN: "cn";
|
|
37
|
-
/** Indonesia node. */
|
|
38
32
|
readonly ID: "id";
|
|
39
33
|
};
|
|
40
34
|
/**
|
|
@@ -3,8 +3,8 @@ import type { Region } from '../types';
|
|
|
3
3
|
export declare const API_ENDPOINTS: {
|
|
4
4
|
readonly production: "https://runtime.lovrabet.com";
|
|
5
5
|
readonly online: "https://runtime.lovrabet.com";
|
|
6
|
-
readonly daily: "https://daily-runtime.lovrabet.com";
|
|
7
6
|
readonly development: "https://dev.lovrabet.com";
|
|
7
|
+
readonly daily: "https://daily-runtime.lovrabet.com";
|
|
8
8
|
};
|
|
9
9
|
export type Environment = keyof typeof API_ENDPOINTS;
|
|
10
10
|
/** Runtime endpoints selected by official region and environment. */
|
|
@@ -12,20 +12,19 @@ export declare const REGION_API_ENDPOINTS: {
|
|
|
12
12
|
readonly cn: {
|
|
13
13
|
readonly production: "https://runtime.lovrabet.com";
|
|
14
14
|
readonly online: "https://runtime.lovrabet.com";
|
|
15
|
-
readonly daily: "https://daily-runtime.lovrabet.com";
|
|
16
15
|
readonly development: "https://dev.lovrabet.com";
|
|
16
|
+
readonly daily: "https://daily-runtime.lovrabet.com";
|
|
17
17
|
};
|
|
18
18
|
readonly id: {
|
|
19
19
|
readonly production: "https://runtime.lovrabet.id";
|
|
20
20
|
readonly online: "https://runtime.lovrabet.id";
|
|
21
|
-
readonly daily: "https://daily-runtime.lovrabet.id";
|
|
22
21
|
readonly development: "https://dev.lovrabet.id";
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
26
25
|
* 获取指定环境的 API 端点(支持向下兼容)
|
|
27
26
|
* @param env - 环境名称(支持 "production", "online", "daily", "dev", "development")
|
|
28
|
-
* @param region -
|
|
27
|
+
* @param region - 官方节点;支持值来自生成的节点目录,省略时使用目录默认节点
|
|
29
28
|
* @returns API 端点 URL
|
|
30
29
|
*/
|
|
31
30
|
export declare function getApiEndpoint(env: Environment | string, region?: Region | string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const ROUTING_CATALOG_DIGEST: "8410411aea1931279b7de881e8b743f3385db7e669cd8408dde550d5cffb4a4c";
|
|
2
|
+
export declare const DEFAULT_REGION: "cn";
|
|
3
|
+
export declare const GENERATED_REGIONS: {
|
|
4
|
+
readonly CN: "cn";
|
|
5
|
+
readonly ID: "id";
|
|
6
|
+
};
|
|
7
|
+
export declare const GENERATED_REGION_API_ENDPOINTS: {
|
|
8
|
+
readonly cn: {
|
|
9
|
+
readonly production: "https://runtime.lovrabet.com";
|
|
10
|
+
readonly online: "https://runtime.lovrabet.com";
|
|
11
|
+
readonly development: "https://dev.lovrabet.com";
|
|
12
|
+
readonly daily: "https://daily-runtime.lovrabet.com";
|
|
13
|
+
};
|
|
14
|
+
readonly id: {
|
|
15
|
+
readonly production: "https://runtime.lovrabet.id";
|
|
16
|
+
readonly online: "https://runtime.lovrabet.id";
|
|
17
|
+
readonly development: "https://dev.lovrabet.id";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { HttpClient } from "../http/http-client";
|
|
2
|
+
import type { FlowBatchTaskActionRequest, FlowBatchTransferRequest, FlowCcQuery, FlowCcRequest, FlowCustomPageCcDetail, FlowDefinitionQuery, FlowCustomPageDefinition, FlowCustomPageStartResponse, FlowCustomPageSubmittedProcess, FlowCustomPageTaskDetail, FlowCustomPageTaskItem, FlowCustomPageTimeline, FlowPage, FlowProcessReasonRequest, FlowRecord, FlowResubmitRequest, FlowReturnRequest, FlowReturnTarget, FlowStartRequest, FlowSubmittedQuery, FlowTaskActionRequest, FlowTransferRequest, FlowUpdateVariablesRequest, FlowVariableQuery } from "./types";
|
|
3
|
+
/** 使用当前登录用户身份的独立流程自定义页面客户端。 */
|
|
4
|
+
export declare class LovrabetFlowClient {
|
|
5
|
+
private readonly httpClient;
|
|
6
|
+
private readonly appCode;
|
|
7
|
+
constructor(httpClient: HttpClient, appCode: string);
|
|
8
|
+
start<T = FlowCustomPageStartResponse>(request: FlowStartRequest): Promise<T>;
|
|
9
|
+
listTodo<T = FlowCustomPageTaskItem>(query?: FlowVariableQuery): Promise<FlowPage<T>>;
|
|
10
|
+
listAppTodo<T = FlowCustomPageTaskItem>(query?: FlowVariableQuery): Promise<FlowPage<T>>;
|
|
11
|
+
listDone<T = FlowCustomPageTaskItem>(query?: FlowVariableQuery): Promise<FlowPage<T>>;
|
|
12
|
+
listAppDone<T = FlowCustomPageTaskItem>(query?: FlowVariableQuery): Promise<FlowPage<T>>;
|
|
13
|
+
listSubmitted<T = FlowCustomPageSubmittedProcess>(query?: FlowSubmittedQuery): Promise<FlowPage<T>>;
|
|
14
|
+
listAppSubmitted<T = FlowCustomPageSubmittedProcess>(query?: FlowSubmittedQuery): Promise<FlowPage<T>>;
|
|
15
|
+
/** 列出 SDK 可发起的独立流程;服务端仅返回 CUSTOM_PAGE。 */
|
|
16
|
+
listIndependentFlows<T = FlowCustomPageDefinition>(query?: FlowDefinitionQuery): Promise<FlowPage<T>>;
|
|
17
|
+
getTaskDetail<T = FlowCustomPageTaskDetail>(taskId: string, variableKeys?: string[]): Promise<T>;
|
|
18
|
+
getProcessDetail<T = FlowCustomPageTaskDetail>(processInstanceId: string, variableKeys?: string[]): Promise<T>;
|
|
19
|
+
getCurrentTask<T = FlowCustomPageTaskDetail>(processInstanceId: string, variableKeys?: string[]): Promise<T>;
|
|
20
|
+
getTimeline<T = FlowCustomPageTimeline>(processInstanceId: string): Promise<T>;
|
|
21
|
+
getRecords<T = FlowRecord>(processInstanceId: string): Promise<T>;
|
|
22
|
+
updateVariables(request: FlowUpdateVariablesRequest): Promise<void>;
|
|
23
|
+
approve(request: FlowTaskActionRequest): Promise<void>;
|
|
24
|
+
reject(request: FlowTaskActionRequest): Promise<void>;
|
|
25
|
+
complete(request: FlowTaskActionRequest): Promise<void>;
|
|
26
|
+
batchApprove<T = FlowRecord>(request: FlowBatchTaskActionRequest): Promise<T>;
|
|
27
|
+
batchReject<T = FlowRecord>(request: FlowBatchTaskActionRequest): Promise<T>;
|
|
28
|
+
transfer(request: FlowTransferRequest): Promise<void>;
|
|
29
|
+
batchTransfer<T = FlowRecord>(request: FlowBatchTransferRequest): Promise<T>;
|
|
30
|
+
cancel(request: FlowProcessReasonRequest): Promise<void>;
|
|
31
|
+
withdraw(request: FlowProcessReasonRequest): Promise<void>;
|
|
32
|
+
resubmit(request: FlowResubmitRequest): Promise<void>;
|
|
33
|
+
getReturnTargets(taskId: string): Promise<FlowReturnTarget[]>;
|
|
34
|
+
returnTask(request: FlowReturnRequest): Promise<void>;
|
|
35
|
+
voidProcess(request: FlowProcessReasonRequest): Promise<void>;
|
|
36
|
+
ccProcess<T = FlowRecord>(request: FlowCcRequest): Promise<T[]>;
|
|
37
|
+
listCc<T = FlowRecord>(query?: FlowCcQuery): Promise<FlowPage<T>>;
|
|
38
|
+
getCcDetail<T = FlowCustomPageCcDetail>(ccRecordId: number | string): Promise<T>;
|
|
39
|
+
markCcRead(ccRecordId: number | string): Promise<void>;
|
|
40
|
+
private completeTask;
|
|
41
|
+
private completeTasks;
|
|
42
|
+
private processReason;
|
|
43
|
+
private executePage;
|
|
44
|
+
private executeCustomPage;
|
|
45
|
+
private post;
|
|
46
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { LovrabetFlowClient } from "./flow-client";
|
|
2
|
+
export type { FlowBatchTaskActionRequest, FlowBatchTransferRequest, FlowCcQuery, FlowCcRequest, FlowCustomPageCcDetail, FlowCustomPageDefinition, FlowCustomPageStartResponse, FlowCustomPageSubmittedProcess, FlowCustomPageTaskDetail, FlowCustomPageTaskItem, FlowCustomPageTimeline, FlowDefinitionQuery, FlowPage, FlowPageMode, FlowPageQuery, FlowProcessReasonRequest, FlowRecord, FlowResubmitRequest, FlowReturnRequest, FlowReturnTarget, FlowStartRequest, FlowSubmittedQuery, FlowTaskActionRequest, FlowTransferRequest, FlowUpdateVariablesRequest, FlowVariableProjectionQuery, FlowVariableQuery, } from "./types";
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
export type FlowRecord = Record<string, any>;
|
|
2
|
+
export type FlowPageMode = "CUSTOM_PAGE" | "PLATFORM_FORM";
|
|
3
|
+
/** SDK 可见的独立流程定义;服务端只返回业务自定义页面类型。 */
|
|
4
|
+
export interface FlowCustomPageDefinition {
|
|
5
|
+
flowCode: string;
|
|
6
|
+
flowName?: string;
|
|
7
|
+
flowDesc?: string;
|
|
8
|
+
version?: number;
|
|
9
|
+
pageMode: "CUSTOM_PAGE";
|
|
10
|
+
}
|
|
11
|
+
/** 业务自定义页面独立流程的发起结果。 */
|
|
12
|
+
export interface FlowCustomPageStartResponse {
|
|
13
|
+
flowCode: string;
|
|
14
|
+
processInstanceId: string;
|
|
15
|
+
idempotentReplay?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** 业务自定义页面独立流程的待办或已办列表项。 */
|
|
18
|
+
export interface FlowCustomPageTaskItem {
|
|
19
|
+
taskId: string;
|
|
20
|
+
taskName?: string;
|
|
21
|
+
taskDefinitionKey?: string;
|
|
22
|
+
taskMode?: string;
|
|
23
|
+
assignee?: string;
|
|
24
|
+
assigneeName?: string;
|
|
25
|
+
handleMode?: string;
|
|
26
|
+
transferCandidates?: FlowRecord[];
|
|
27
|
+
processInstanceId: string;
|
|
28
|
+
flowCode?: string;
|
|
29
|
+
flowName?: string;
|
|
30
|
+
initiatorUserId?: string;
|
|
31
|
+
initiatorUsername?: string;
|
|
32
|
+
taskStatus?: string;
|
|
33
|
+
processStatus?: string;
|
|
34
|
+
createTime?: number;
|
|
35
|
+
endTime?: number;
|
|
36
|
+
processStartTime?: number;
|
|
37
|
+
businessVariables?: FlowRecord;
|
|
38
|
+
}
|
|
39
|
+
/** 业务自定义页面独立流程的已发起列表项。 */
|
|
40
|
+
export interface FlowCustomPageSubmittedProcess {
|
|
41
|
+
processInstanceId: string;
|
|
42
|
+
flowCode?: string;
|
|
43
|
+
flowName?: string;
|
|
44
|
+
startTime?: number;
|
|
45
|
+
endTime?: number;
|
|
46
|
+
status?: string;
|
|
47
|
+
cancelReason?: string;
|
|
48
|
+
currentNodeNames?: string[];
|
|
49
|
+
currentNodes?: FlowRecord[];
|
|
50
|
+
nextNodes?: FlowRecord[];
|
|
51
|
+
businessVariables?: FlowRecord;
|
|
52
|
+
}
|
|
53
|
+
/** 不包含数据集、平台页面或业务数据主键的独立流程轨迹。 */
|
|
54
|
+
export interface FlowCustomPageTimeline {
|
|
55
|
+
processInstanceId: string;
|
|
56
|
+
flowCode?: string;
|
|
57
|
+
flowName?: string;
|
|
58
|
+
startUserId?: string;
|
|
59
|
+
startUserName?: string;
|
|
60
|
+
startTime?: number;
|
|
61
|
+
endTime?: number;
|
|
62
|
+
status?: string;
|
|
63
|
+
cancelReason?: string;
|
|
64
|
+
canCancel: boolean;
|
|
65
|
+
canWithdraw: boolean;
|
|
66
|
+
canResubmit: boolean;
|
|
67
|
+
canVoid: boolean;
|
|
68
|
+
approvalRound?: number;
|
|
69
|
+
steps?: FlowRecord[];
|
|
70
|
+
flowDiagram?: FlowRecord;
|
|
71
|
+
}
|
|
72
|
+
/** 业务自定义页面独立流程详情;保留 formData,不返回平台表单渲染配置。 */
|
|
73
|
+
export interface FlowCustomPageTaskDetail {
|
|
74
|
+
taskId?: string;
|
|
75
|
+
taskName?: string;
|
|
76
|
+
taskDefinitionKey?: string;
|
|
77
|
+
taskMode?: string;
|
|
78
|
+
assignee?: string;
|
|
79
|
+
assigneeName?: string;
|
|
80
|
+
processInstanceId: string;
|
|
81
|
+
flowCode?: string;
|
|
82
|
+
flowName?: string;
|
|
83
|
+
initiatorUserId?: string;
|
|
84
|
+
initiatorUsername?: string;
|
|
85
|
+
taskCreateTime?: number;
|
|
86
|
+
taskEndTime?: number;
|
|
87
|
+
processStartTime?: number;
|
|
88
|
+
processEndTime?: number;
|
|
89
|
+
taskStatus?: string;
|
|
90
|
+
processStatus?: string;
|
|
91
|
+
canHandle: boolean;
|
|
92
|
+
handleMode?: string;
|
|
93
|
+
canCancel: boolean;
|
|
94
|
+
canWithdraw: boolean;
|
|
95
|
+
canResubmit: boolean;
|
|
96
|
+
canVoid: boolean;
|
|
97
|
+
canReturn: boolean;
|
|
98
|
+
returnTargets?: FlowReturnTarget[];
|
|
99
|
+
approvalRound?: number;
|
|
100
|
+
transferCandidates?: FlowRecord[];
|
|
101
|
+
formData?: FlowRecord;
|
|
102
|
+
businessVariables?: FlowRecord;
|
|
103
|
+
timeline?: FlowCustomPageTimeline;
|
|
104
|
+
}
|
|
105
|
+
export interface FlowCustomPageCcDetail {
|
|
106
|
+
ccRecord: FlowRecord;
|
|
107
|
+
processDetail: FlowCustomPageTaskDetail;
|
|
108
|
+
approvalRecords: FlowRecord;
|
|
109
|
+
}
|
|
110
|
+
export interface FlowPage<T = FlowRecord> {
|
|
111
|
+
records: T[];
|
|
112
|
+
currentPage: number;
|
|
113
|
+
pageSize: number;
|
|
114
|
+
totalCount: number;
|
|
115
|
+
totalPages: number;
|
|
116
|
+
}
|
|
117
|
+
export interface FlowPageQuery {
|
|
118
|
+
currentPage?: number;
|
|
119
|
+
pageSize?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface FlowVariableProjectionQuery extends FlowPageQuery {
|
|
122
|
+
/** 指定响应 businessVariables 中需要返回的普通业务变量名。 */
|
|
123
|
+
variableKeys?: string[];
|
|
124
|
+
}
|
|
125
|
+
export interface FlowVariableQuery extends FlowVariableProjectionQuery {
|
|
126
|
+
/** 按流程变量精确匹配;服务端会屏蔽 sys 前缀变量。 */
|
|
127
|
+
variables?: FlowRecord;
|
|
128
|
+
}
|
|
129
|
+
export interface FlowSubmittedQuery extends FlowVariableProjectionQuery {
|
|
130
|
+
status?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface FlowDefinitionQuery extends FlowPageQuery {
|
|
133
|
+
flowName?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface FlowStartRequest {
|
|
136
|
+
flowCode: string;
|
|
137
|
+
formData?: FlowRecord;
|
|
138
|
+
variables?: FlowRecord;
|
|
139
|
+
/** 同一应用内相同幂等键返回首次创建的流程实例。 */
|
|
140
|
+
idempotencyKey?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface FlowUpdateVariablesRequest {
|
|
143
|
+
processInstanceId: string;
|
|
144
|
+
/** 可设置普通业务变量,也可包含 formData;系统变量不可修改。 */
|
|
145
|
+
set?: FlowRecord;
|
|
146
|
+
/** 仅允许删除普通业务变量。 */
|
|
147
|
+
remove?: string[];
|
|
148
|
+
}
|
|
149
|
+
export interface FlowTaskActionRequest {
|
|
150
|
+
taskId: string;
|
|
151
|
+
formPatch?: FlowRecord;
|
|
152
|
+
formDataVersion?: number;
|
|
153
|
+
variables?: FlowRecord;
|
|
154
|
+
comment?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface FlowBatchTaskActionRequest {
|
|
157
|
+
taskIds: string[];
|
|
158
|
+
comment?: string;
|
|
159
|
+
variables?: FlowRecord;
|
|
160
|
+
}
|
|
161
|
+
export interface FlowTransferRequest {
|
|
162
|
+
taskId: string;
|
|
163
|
+
targetUserId: string;
|
|
164
|
+
comment?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface FlowBatchTransferRequest {
|
|
167
|
+
taskIds: string[];
|
|
168
|
+
targetUserId: string;
|
|
169
|
+
comment?: string;
|
|
170
|
+
}
|
|
171
|
+
export interface FlowProcessReasonRequest {
|
|
172
|
+
processInstanceId: string;
|
|
173
|
+
reason?: string;
|
|
174
|
+
}
|
|
175
|
+
export interface FlowResubmitRequest {
|
|
176
|
+
processInstanceId: string;
|
|
177
|
+
formPatch?: FlowRecord;
|
|
178
|
+
/** 重新提交时同步更新的普通业务流程变量;系统变量仍由 Runtime 拒绝。 */
|
|
179
|
+
variables?: FlowRecord;
|
|
180
|
+
/** 动态表单流程必填;非动态表单或没有版本号的自定义页面流程可省略。 */
|
|
181
|
+
formDataVersion?: number;
|
|
182
|
+
comment?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface FlowReturnRequest {
|
|
185
|
+
taskId: string;
|
|
186
|
+
targetNodeId: string;
|
|
187
|
+
reason?: string;
|
|
188
|
+
}
|
|
189
|
+
export interface FlowCcRequest {
|
|
190
|
+
processInstanceId: string;
|
|
191
|
+
taskId?: string;
|
|
192
|
+
recipientUserIds: string[];
|
|
193
|
+
comment?: string;
|
|
194
|
+
/** 调用方幂等请求号。 */
|
|
195
|
+
requestId?: string;
|
|
196
|
+
}
|
|
197
|
+
export interface FlowCcQuery extends FlowPageQuery {
|
|
198
|
+
readStatus?: string;
|
|
199
|
+
}
|
|
200
|
+
export interface FlowReturnTarget {
|
|
201
|
+
nodeId: string;
|
|
202
|
+
nodeName: string;
|
|
203
|
+
}
|
|
@@ -27,6 +27,11 @@ export declare class HttpClient {
|
|
|
27
27
|
private makeRequest;
|
|
28
28
|
get<T = any>(url: string, params?: Record<string, any>, options?: RequestInit, datasetCode?: string): Promise<T>;
|
|
29
29
|
post<T = any>(url: string, data?: any, options?: RequestInit, datasetCode?: string): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* 调用绑定应用与操作人的 Flow OpenAPI。
|
|
32
|
+
* Flow 签名使用 operatorUserId,不使用 datasetCode;签名字段也必须随请求体发送。
|
|
33
|
+
*/
|
|
34
|
+
postFlow<T = any>(url: string, paramMap: Record<string, any>, appCode: string, operatorUserId: string, options?: RequestInit): Promise<T>;
|
|
30
35
|
postForm<T = any>(url: string, data: FormData, options?: RequestInit): Promise<T>;
|
|
31
36
|
put<T = any>(url: string, data?: any, options?: RequestInit, datasetCode?: string): Promise<T>;
|
|
32
37
|
delete<T = any>(url: string, options?: RequestInit, datasetCode?: string): Promise<T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared HTTP transport for the SDK.
|
|
3
|
+
*
|
|
4
|
+
* Routing and authentication stay in the SDK. The shared fetch package only
|
|
5
|
+
* owns request execution, serialization, tracing, redirects, and telemetry.
|
|
6
|
+
* All SDK callers pass an absolute URL, so routing remains an SDK concern.
|
|
7
|
+
*/
|
|
8
|
+
export declare const transportGet: <ResponseData>(url: string, params?: Record<string, any>, init?: RequestInit & {
|
|
9
|
+
reqHeaders?: HeadersInit;
|
|
10
|
+
}) => Promise<ResponseData>;
|
|
11
|
+
export declare const transportPost: <ResponseData>(url: string, body?: Record<string, any> | FormData, init?: RequestInit & {
|
|
12
|
+
reqHeaders?: HeadersInit;
|
|
13
|
+
}) => Promise<ResponseData>;
|
|
14
|
+
export declare const generateTransportTraceparent: (headers?: HeadersInit) => string;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export type Environment = "production" | "online" | "daily" | "development";
|
|
20
20
|
/** Official Lovrabet Runtime region. Mainland China is the default. */
|
|
21
|
-
export type Region =
|
|
21
|
+
export type Region = keyof typeof import("../config/generated-region-endpoints").GENERATED_REGION_API_ENDPOINTS;
|
|
22
22
|
/**
|
|
23
23
|
* 排序方向枚举
|
|
24
24
|
* @description 定义数据排序的方向
|
|
@@ -799,6 +799,8 @@ export interface AuthManager {
|
|
|
799
799
|
* @returns 包含认证信息的请求头对象
|
|
800
800
|
*/
|
|
801
801
|
getAuthHeaders(appCode?: string, datasetCode?: string): Promise<AuthHeaders>;
|
|
802
|
+
/** 为绑定应用和操作人的审批 Flow OpenAPI 生成签名上下文。 */
|
|
803
|
+
getFlowAuthContext(appCode: string, operatorUserId: string): Promise<import("../auth/openapi-auth").OpenApiAuthContext>;
|
|
802
804
|
/**
|
|
803
805
|
* 验证当前认证是否有效
|
|
804
806
|
* @returns 认证是否有效
|
|
@@ -844,6 +846,8 @@ export interface AuthManager {
|
|
|
844
846
|
export interface LovrabetClient {
|
|
845
847
|
/** 运行态通用服务,如文件与 OCR。 */
|
|
846
848
|
readonly services: import("../services/types").LovrabetServices;
|
|
849
|
+
/** 创建使用当前登录用户身份的独立流程自定义页面客户端。 */
|
|
850
|
+
flow(): import("../flow").LovrabetFlowClient;
|
|
847
851
|
/**
|
|
848
852
|
* 当前用户拥有的资源,如个人 BFF。
|
|
849
853
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovrabet/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4-beta.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"@lovrabet/fetch": "1.0.3-beta.5",
|
|
46
47
|
"@types/bun": "latest",
|
|
47
48
|
"@vitest/coverage-v8": "^2.1.9",
|
|
48
49
|
"@vitest/ui": "^2.1.8",
|