@byted-apaas/server-sdk-node 0.0.2-beta.1
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/LICENSE.md +0 -0
- package/README.md +1 -0
- package/application/application.d.ts +27 -0
- package/application/application.js +3 -0
- package/application/application.js.map +1 -0
- package/application/application.ts +40 -0
- package/application/function/function.d.ts +14 -0
- package/application/function/function.js +22 -0
- package/application/function/function.js.map +1 -0
- package/application/function/function.ts +37 -0
- package/application/impl/common.d.ts +2 -0
- package/application/impl/common.js +51 -0
- package/application/impl/common.js.map +1 -0
- package/application/impl/common.ts +50 -0
- package/application/impl/impl.d.ts +16 -0
- package/application/impl/impl.js +39 -0
- package/application/impl/impl.js.map +1 -0
- package/application/impl/impl.ts +48 -0
- package/constants/constants.d.ts +10 -0
- package/constants/constants.js +14 -0
- package/constants/constants.js.map +1 -0
- package/constants/constants.ts +12 -0
- package/context/context.d.ts +74 -0
- package/context/context.js +24 -0
- package/context/context.js.map +1 -0
- package/context/context.ts +127 -0
- package/context/db/db.d.ts +73 -0
- package/context/db/db.js +3 -0
- package/context/db/db.js.map +1 -0
- package/context/db/db.ts +77 -0
- package/context/db/impl/IObject.d.ts +251 -0
- package/context/db/impl/IObject.js +4 -0
- package/context/db/impl/IObject.js.map +1 -0
- package/context/db/impl/IObject.ts +244 -0
- package/context/db/impl/db.d.ts +61 -0
- package/context/db/impl/db.js +87 -0
- package/context/db/impl/db.js.map +1 -0
- package/context/db/impl/db.ts +95 -0
- package/context/db/impl/object.d.ts +92 -0
- package/context/db/impl/object.js +523 -0
- package/context/db/impl/object.js.map +1 -0
- package/context/db/impl/object.ts +628 -0
- package/context/db/impl/oql/ioql.d.ts +6 -0
- package/context/db/impl/oql/ioql.js +3 -0
- package/context/db/impl/oql/ioql.js.map +1 -0
- package/context/db/impl/oql/ioql.ts +6 -0
- package/context/db/impl/oql/oql.d.ts +8 -0
- package/context/db/impl/oql/oql.js +20 -0
- package/context/db/impl/oql/oql.js.map +1 -0
- package/context/db/impl/oql/oql.ts +22 -0
- package/context/db/impl/order.d.ts +9 -0
- package/context/db/impl/order.js +14 -0
- package/context/db/impl/order.js.map +1 -0
- package/context/db/impl/order.ts +16 -0
- package/context/db/impl/propertiesStore.d.ts +8 -0
- package/context/db/impl/propertiesStore.js +28 -0
- package/context/db/impl/propertiesStore.js.map +1 -0
- package/context/db/impl/propertiesStore.ts +28 -0
- package/context/db/impl/queryBuilder.d.ts +29 -0
- package/context/db/impl/queryBuilder.js +77 -0
- package/context/db/impl/queryBuilder.js.map +1 -0
- package/context/db/impl/queryBuilder.ts +103 -0
- package/context/db/impl/transaction/index.d.ts +20 -0
- package/context/db/impl/transaction/index.js +276 -0
- package/context/db/impl/transaction/index.js.map +1 -0
- package/context/db/impl/transaction/index.ts +337 -0
- package/context/db/impl/transaction/operation.d.ts +27 -0
- package/context/db/impl/transaction/operation.js +70 -0
- package/context/db/impl/transaction/operation.js.map +1 -0
- package/context/db/impl/transaction/operation.ts +72 -0
- package/context/db/impl/transaction.d.ts +67 -0
- package/context/db/impl/transaction.js +3 -0
- package/context/db/impl/transaction.js.map +1 -0
- package/context/db/impl/transaction.ts +76 -0
- package/context/globalConfig/globalConfig.d.ts +7 -0
- package/context/globalConfig/globalConfig.js +15 -0
- package/context/globalConfig/globalConfig.js.map +1 -0
- package/context/globalConfig/globalConfig.ts +11 -0
- package/context/metadata/components/common.d.ts +6 -0
- package/context/metadata/components/common.js +16 -0
- package/context/metadata/components/common.js.map +1 -0
- package/context/metadata/components/common.ts +19 -0
- package/context/metadata/components/components.d.ts +12 -0
- package/context/metadata/components/components.js +18 -0
- package/context/metadata/components/components.js.map +1 -0
- package/context/metadata/components/components.ts +19 -0
- package/context/metadata/components/desktop/list.d.ts +16 -0
- package/context/metadata/components/desktop/list.js +403 -0
- package/context/metadata/components/desktop/list.js.map +1 -0
- package/context/metadata/components/desktop/list.ts +457 -0
- package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
- package/context/metadata/components/desktop/recordDetail.js +52 -0
- package/context/metadata/components/desktop/recordDetail.js.map +1 -0
- package/context/metadata/components/desktop/recordDetail.ts +64 -0
- package/context/metadata/components/mobile/list.d.ts +24 -0
- package/context/metadata/components/mobile/list.js +144 -0
- package/context/metadata/components/mobile/list.js.map +1 -0
- package/context/metadata/components/mobile/list.ts +176 -0
- package/context/metadata/metadata.d.ts +61 -0
- package/context/metadata/metadata.js +102 -0
- package/context/metadata/metadata.js.map +1 -0
- package/context/metadata/metadata.ts +175 -0
- package/context/metadata/objects/fields.d.ts +130 -0
- package/context/metadata/objects/fields.js +333 -0
- package/context/metadata/objects/fields.js.map +1 -0
- package/context/metadata/objects/fields.ts +454 -0
- package/context/metadata/objects/fields.util.d.ts +40 -0
- package/context/metadata/objects/fields.util.js +320 -0
- package/context/metadata/objects/fields.util.js.map +1 -0
- package/context/metadata/objects/fields.util.ts +360 -0
- package/context/metadata/objects/objects.d.ts +11 -0
- package/context/metadata/objects/objects.js +19 -0
- package/context/metadata/objects/objects.js.map +1 -0
- package/context/metadata/objects/objects.ts +27 -0
- package/context/metadata/types/common.d.ts +6 -0
- package/context/metadata/types/common.js +8 -0
- package/context/metadata/types/common.js.map +1 -0
- package/context/metadata/types/common.ts +10 -0
- package/context/metadata/types/components.d.ts +90 -0
- package/context/metadata/types/components.js +3 -0
- package/context/metadata/types/components.js.map +1 -0
- package/context/metadata/types/components.ts +105 -0
- package/context/metadata/types/objects.d.ts +226 -0
- package/context/metadata/types/objects.js +3 -0
- package/context/metadata/types/objects.js.map +1 -0
- package/context/metadata/types/objects.ts +251 -0
- package/context/msg/msg.d.ts +38 -0
- package/context/msg/msg.js +34 -0
- package/context/msg/msg.js.map +1 -0
- package/context/msg/msg.ts +49 -0
- package/context/resources/IResources.d.ts +66 -0
- package/context/resources/IResources.js +3 -0
- package/context/resources/IResources.js.map +1 -0
- package/context/resources/IResources.ts +73 -0
- package/context/resources/impl/resources.d.ts +42 -0
- package/context/resources/impl/resources.js +149 -0
- package/context/resources/impl/resources.js.map +1 -0
- package/context/resources/impl/resources.ts +170 -0
- package/context/tasks/tasks.d.ts +33 -0
- package/context/tasks/tasks.js +140 -0
- package/context/tasks/tasks.js.map +1 -0
- package/context/tasks/tasks.ts +159 -0
- package/data/index.d.ts +27 -0
- package/data/index.js +5 -0
- package/data/index.js.map +1 -0
- package/data/index.ts +30 -0
- package/hooks/api.d.ts +61 -0
- package/hooks/api.js +328 -0
- package/hooks/api.js.map +1 -0
- package/hooks/api.ts +341 -0
- package/hooks/hooks.d.ts +1 -0
- package/hooks/hooks.js +89 -0
- package/hooks/hooks.js.map +1 -0
- package/hooks/hooks.ts +100 -0
- package/kunlun/kunlun.d.ts +55 -0
- package/kunlun/kunlun.js +57 -0
- package/kunlun/kunlun.js.map +1 -0
- package/kunlun/kunlun.ts +69 -0
- package/kunlun/operator/IOperator.d.ts +158 -0
- package/kunlun/operator/IOperator.js +3 -0
- package/kunlun/operator/IOperator.js.map +1 -0
- package/kunlun/operator/IOperator.ts +163 -0
- package/kunlun/operator/impl/expression.d.ts +47 -0
- package/kunlun/operator/impl/expression.js +55 -0
- package/kunlun/operator/impl/expression.js.map +1 -0
- package/kunlun/operator/impl/expression.ts +71 -0
- package/kunlun/operator/impl/logic.d.ts +50 -0
- package/kunlun/operator/impl/logic.js +508 -0
- package/kunlun/operator/impl/logic.js.map +1 -0
- package/kunlun/operator/impl/logic.ts +595 -0
- package/kunlun/operator/impl/logicV2.d.ts +58 -0
- package/kunlun/operator/impl/logicV2.js +201 -0
- package/kunlun/operator/impl/logicV2.js.map +1 -0
- package/kunlun/operator/impl/logicV2.ts +254 -0
- package/kunlun/operator/impl/operator.d.ts +179 -0
- package/kunlun/operator/impl/operator.js +221 -0
- package/kunlun/operator/impl/operator.js.map +1 -0
- package/kunlun/operator/impl/operator.ts +255 -0
- package/kunlun/operator/impl/operatorV2.d.ts +180 -0
- package/kunlun/operator/impl/operatorV2.js +217 -0
- package/kunlun/operator/impl/operatorV2.js.map +1 -0
- package/kunlun/operator/impl/operatorV2.ts +249 -0
- package/lib/core.d.ts +4 -0
- package/lib/core.js +18 -0
- package/lib/core.js.map +1 -0
- package/lib/core.ts +4 -0
- package/package.json +50 -0
- package/request/common.d.ts +13 -0
- package/request/common.js +88 -0
- package/request/common.js.map +1 -0
- package/request/common.ts +91 -0
- package/request/constants.d.ts +10 -0
- package/request/constants.js +26 -0
- package/request/constants.js.map +1 -0
- package/request/constants.ts +25 -0
- package/request/faasinfra.d.ts +8 -0
- package/request/faasinfra.js +359 -0
- package/request/faasinfra.js.map +1 -0
- package/request/faasinfra.ts +393 -0
- package/request/innerapi.d.ts +67 -0
- package/request/innerapi.js +1411 -0
- package/request/innerapi.js.map +1 -0
- package/request/innerapi.ts +1645 -0
- package/request/interface.d.ts +95 -0
- package/request/interface.js +40 -0
- package/request/interface.js.map +1 -0
- package/request/interface.ts +166 -0
- package/request/openapi.d.ts +69 -0
- package/request/openapi.js +1013 -0
- package/request/openapi.js.map +1 -0
- package/request/openapi.ts +1220 -0
- package/types/types.d.ts +79 -0
- package/types/types.js +3 -0
- package/types/types.js.map +1 -0
- package/types/types.ts +105 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Criterion } from "../kunlun/operator/impl/logic";
|
|
4
|
+
import { Stream } from "stream";
|
|
5
|
+
import { ExecutionInfo, ExecutionResult, RevokeExecutionOptions } from "@byted-apaas/server-common-node/context/workflow/workflow";
|
|
6
|
+
import { AppCtx } from "../application/application";
|
|
7
|
+
import { Order } from "../context/db/impl/order";
|
|
8
|
+
export declare function GetInstance(): IInnerAPIRequest;
|
|
9
|
+
export declare function GetFaaSInfraInstance(): IFaaSInfraRequest;
|
|
10
|
+
export declare type UploadFileResp = {
|
|
11
|
+
id: string;
|
|
12
|
+
token: string;
|
|
13
|
+
size: bigint;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
export declare type OrderV2 = {
|
|
18
|
+
field: string;
|
|
19
|
+
direction: string;
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
export declare type OpenSDKGetRecordsReq = {
|
|
23
|
+
limit: number;
|
|
24
|
+
offset: number;
|
|
25
|
+
fields: string[];
|
|
26
|
+
quickSearch?: string;
|
|
27
|
+
filter: any[];
|
|
28
|
+
sort: OrderV2[];
|
|
29
|
+
count: boolean;
|
|
30
|
+
};
|
|
31
|
+
export interface IInnerAPIRequest extends IInnerAPIBaseRequest, IInnerAPIOpenSDKRequest {
|
|
32
|
+
}
|
|
33
|
+
export interface IInnerAPIBaseRequest {
|
|
34
|
+
createRecordBySync(objectApiName: string, record: object): any;
|
|
35
|
+
updateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
36
|
+
deleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
37
|
+
createRecordsByAsync(objectApiName: string, records: object[]): any;
|
|
38
|
+
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
39
|
+
deleteRecordsByAsync(objectApiName: string, recordIDs: number[]): any;
|
|
40
|
+
createRecordsBySync(objectApiName: string, records: object[]): any;
|
|
41
|
+
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
42
|
+
deleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
43
|
+
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean): any;
|
|
44
|
+
updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): Promise<void>;
|
|
45
|
+
uploadFile(data: Stream, expire: number): Promise<UploadFileResp>;
|
|
46
|
+
downloadFileByID(fileID: string, filePath?: string): Promise<Buffer | void>;
|
|
47
|
+
downloadFileByToken(fileToken: string, filePath?: string): Promise<Buffer | void>;
|
|
48
|
+
createMessage(msg: any): Promise<number>;
|
|
49
|
+
updateMessage(msgId: number, msg: any): Promise<void>;
|
|
50
|
+
getFields(objectApiName: string): Promise<any>;
|
|
51
|
+
getField(objectApiName: string, fieldApiName: string): Promise<any>;
|
|
52
|
+
terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): Promise<void>;
|
|
53
|
+
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[]): Promise<Map<string, number>>;
|
|
54
|
+
getGlobalConfigByKey<valueT>(key: string): Promise<valueT>;
|
|
55
|
+
oql(oql: string, args: any[], namedArgs: Record<string, any>): Promise<string | any[]>;
|
|
56
|
+
invokeFuncSync(idOrName: {
|
|
57
|
+
APIId?: string;
|
|
58
|
+
APIName?: string;
|
|
59
|
+
isInvokeByAPIName: boolean;
|
|
60
|
+
}, params: any): Promise<any>;
|
|
61
|
+
createAsyncTaskV1(idOrName: {
|
|
62
|
+
APIId?: string;
|
|
63
|
+
APIName?: string;
|
|
64
|
+
isInvokeByAPIName: boolean;
|
|
65
|
+
}, params: any): Promise<any>;
|
|
66
|
+
createAsyncTaskV2(name: string, params: any): Promise<any>;
|
|
67
|
+
getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
|
|
68
|
+
executeFlow(APIName: string, options: any): Promise<ExecutionResult>;
|
|
69
|
+
revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
|
|
70
|
+
getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
|
|
71
|
+
getTenantInfo(appCtx: AppCtx): Promise<any>;
|
|
72
|
+
}
|
|
73
|
+
export interface IInnerAPIOpenSDKRequest {
|
|
74
|
+
openSDKCreateRecordBySync(objectApiName: string, record: object): any;
|
|
75
|
+
openSDKUpdateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
76
|
+
openSDKDeleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
77
|
+
openSDKCreateRecordsBySync(objectApiName: string, records: object[]): any;
|
|
78
|
+
openSDKUpdateRecordsBySync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
79
|
+
openSDKDeleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
80
|
+
openSDKGetRecords(objectApiName: string, param: OpenSDKGetRecordsReq): any;
|
|
81
|
+
openSDKUploadFile(fileName: string, data: Buffer): any;
|
|
82
|
+
openSDKUploadAvatar(fileName: string, data: Buffer): any;
|
|
83
|
+
openSDKDownloadAvatar(imageID: string): any;
|
|
84
|
+
invokeFuncWithAuth(idOrName: {
|
|
85
|
+
APIId?: string;
|
|
86
|
+
APIName?: string;
|
|
87
|
+
isInvokeByAPIName: boolean;
|
|
88
|
+
}, params: any): Promise<any>;
|
|
89
|
+
}
|
|
90
|
+
export interface IFaaSInfraRequest {
|
|
91
|
+
createDistributeTaskV1(dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any): Promise<any>;
|
|
92
|
+
createDistributeTaskV2(dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any): Promise<any>;
|
|
93
|
+
invokeMicroserviceSync(apiName: string, path: string, method: string, body: any): Promise<any>;
|
|
94
|
+
invokeMicroserviceAsync(apiName: string, path: string, method: string, body: any): Promise<any>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetFaaSInfraInstance = exports.GetInstance = void 0;
|
|
4
|
+
const openapi_1 = require("./openapi");
|
|
5
|
+
const innerapi_1 = require("./innerapi");
|
|
6
|
+
const common = require("@byted-apaas/server-common-node");
|
|
7
|
+
const faasinfra_1 = require("./faasinfra");
|
|
8
|
+
const utils = common.utils;
|
|
9
|
+
const constants = common.constants;
|
|
10
|
+
const requestInstanceMap = {
|
|
11
|
+
"httpRequest": null,
|
|
12
|
+
"rpcRequest": null,
|
|
13
|
+
};
|
|
14
|
+
function GetHttpInstance() {
|
|
15
|
+
if (!requestInstanceMap["httpRequest"]) {
|
|
16
|
+
requestInstanceMap["httpRequest"] = new openapi_1.RequestHttp();
|
|
17
|
+
}
|
|
18
|
+
return requestInstanceMap["httpRequest"];
|
|
19
|
+
}
|
|
20
|
+
function GetRpcInstance() {
|
|
21
|
+
if (!requestInstanceMap["rpcRequest"]) {
|
|
22
|
+
requestInstanceMap["rpcRequest"] = new innerapi_1.RequestRpc();
|
|
23
|
+
}
|
|
24
|
+
return requestInstanceMap["rpcRequest"];
|
|
25
|
+
}
|
|
26
|
+
function GetInstance() {
|
|
27
|
+
// 内网版 && 非本地开发 使用 RPC 请求
|
|
28
|
+
if ((utils.getFaasType() === constants.faaSAccessType.InspirecloudIntranetAccessType ||
|
|
29
|
+
utils.getFaasType() === constants.faaSAccessType.ByteFaaSIntranetAccessType) && !utils.isLocalDebug()) {
|
|
30
|
+
return GetRpcInstance();
|
|
31
|
+
}
|
|
32
|
+
return GetHttpInstance();
|
|
33
|
+
}
|
|
34
|
+
exports.GetInstance = GetInstance;
|
|
35
|
+
function GetFaaSInfraInstance() {
|
|
36
|
+
return new faasinfra_1.FaaSInfraRequest();
|
|
37
|
+
}
|
|
38
|
+
exports.GetFaaSInfraInstance = GetFaaSInfraInstance;
|
|
39
|
+
;
|
|
40
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["interface.ts"],"names":[],"mappings":";;;AAEA,uCAAwC;AACxC,yCAAwC;AACxC,0DAA0D;AAC1D,2CAA+C;AAU/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAEnC,MAAM,kBAAkB,GAAqC;IACzD,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,IAAI;CACrB,CAAA;AAED,SAAS,eAAe;IACpB,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE;QACpC,kBAAkB,CAAC,aAAa,CAAC,GAAG,IAAI,qBAAW,EAAE,CAAC;KACzD;IACD,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,cAAc;IACnB,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,EAAE;QACnC,kBAAkB,CAAC,YAAY,CAAC,GAAG,IAAI,qBAAU,EAAE,CAAC;KACvD;IACD,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,WAAW;IACvB,yBAAyB;IACzB,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,cAAc,CAAC,8BAA8B;QAChF,KAAK,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,cAAc,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE;QACvG,OAAO,cAAc,EAAE,CAAC;KAC3B;IACD,OAAO,eAAe,EAAE,CAAC;AAC7B,CAAC;AAPD,kCAOC;AAED,SAAgB,oBAAoB;IAChC,OAAO,IAAI,4BAAgB,EAAE,CAAC;AAClC,CAAC;AAFD,oDAEC;AA+B0F,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Criterion } from "../kunlun/operator/impl/logic";
|
|
2
|
+
import { Stream } from "stream";
|
|
3
|
+
import { RequestHttp } from "./openapi";
|
|
4
|
+
import { RequestRpc } from "./innerapi";
|
|
5
|
+
import * as common from "@byted-apaas/server-common-node";
|
|
6
|
+
import { FaaSInfraRequest } from "./faasinfra";
|
|
7
|
+
import {
|
|
8
|
+
ExecutionInfo,
|
|
9
|
+
ExecutionResult,
|
|
10
|
+
FlowTaskInfo,
|
|
11
|
+
RevokeExecutionOptions
|
|
12
|
+
} from "@byted-apaas/server-common-node/context/workflow/workflow";
|
|
13
|
+
import { AppCtx } from "../application/application";
|
|
14
|
+
import { Order } from "../context/db/impl/order";
|
|
15
|
+
|
|
16
|
+
const utils = common.utils;
|
|
17
|
+
const constants = common.constants;
|
|
18
|
+
|
|
19
|
+
const requestInstanceMap: Record<string, IInnerAPIRequest> = {
|
|
20
|
+
"httpRequest": null,
|
|
21
|
+
"rpcRequest": null,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function GetHttpInstance(): IInnerAPIRequest {
|
|
25
|
+
if (!requestInstanceMap["httpRequest"]) {
|
|
26
|
+
requestInstanceMap["httpRequest"] = new RequestHttp();
|
|
27
|
+
}
|
|
28
|
+
return requestInstanceMap["httpRequest"];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function GetRpcInstance(): IInnerAPIRequest {
|
|
32
|
+
if (!requestInstanceMap["rpcRequest"]) {
|
|
33
|
+
requestInstanceMap["rpcRequest"] = new RequestRpc();
|
|
34
|
+
}
|
|
35
|
+
return requestInstanceMap["rpcRequest"];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function GetInstance(): IInnerAPIRequest {
|
|
39
|
+
// 内网版 && 非本地开发 使用 RPC 请求
|
|
40
|
+
if ((utils.getFaasType() === constants.faaSAccessType.InspirecloudIntranetAccessType ||
|
|
41
|
+
utils.getFaasType() === constants.faaSAccessType.ByteFaaSIntranetAccessType) && !utils.isLocalDebug()) {
|
|
42
|
+
return GetRpcInstance();
|
|
43
|
+
}
|
|
44
|
+
return GetHttpInstance();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function GetFaaSInfraInstance(): IFaaSInfraRequest {
|
|
48
|
+
return new FaaSInfraRequest();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type UploadFileResp = {
|
|
52
|
+
// ID, 文件的唯一标识
|
|
53
|
+
id: string
|
|
54
|
+
// Token, 文件的访问 token
|
|
55
|
+
token: string
|
|
56
|
+
// Size, 文件的大小
|
|
57
|
+
size: bigint
|
|
58
|
+
// MIME Type, 文件的 MIME 类型
|
|
59
|
+
mimeType: string
|
|
60
|
+
// Name, 文件的名称
|
|
61
|
+
name: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type OrderV2 = {
|
|
65
|
+
field: string;
|
|
66
|
+
direction: string;
|
|
67
|
+
type: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type OpenSDKGetRecordsReq = {
|
|
71
|
+
limit: number;
|
|
72
|
+
offset: number;
|
|
73
|
+
fields: string[];
|
|
74
|
+
quickSearch?: string;
|
|
75
|
+
filter: any[];
|
|
76
|
+
sort: OrderV2[];
|
|
77
|
+
count: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface IInnerAPIRequest extends IInnerAPIBaseRequest, IInnerAPIOpenSDKRequest { };
|
|
81
|
+
export interface IInnerAPIBaseRequest {
|
|
82
|
+
createRecordBySync(objectApiName: string, record: object): any;
|
|
83
|
+
|
|
84
|
+
updateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
85
|
+
|
|
86
|
+
deleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
87
|
+
|
|
88
|
+
createRecordsByAsync(objectApiName: string, records: object[]): any;
|
|
89
|
+
|
|
90
|
+
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
91
|
+
|
|
92
|
+
deleteRecordsByAsync(objectApiName: string, recordIDs: number[]): any;
|
|
93
|
+
|
|
94
|
+
createRecordsBySync(objectApiName: string, records: object[]): any;
|
|
95
|
+
|
|
96
|
+
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
97
|
+
|
|
98
|
+
deleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
99
|
+
|
|
100
|
+
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean): any;
|
|
101
|
+
|
|
102
|
+
updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): Promise<void>;
|
|
103
|
+
|
|
104
|
+
uploadFile(data: Stream, expire: number): Promise<UploadFileResp>;
|
|
105
|
+
|
|
106
|
+
downloadFileByID(fileID: string, filePath?: string): Promise<Buffer | void>;
|
|
107
|
+
|
|
108
|
+
downloadFileByToken(fileToken: string, filePath?: string): Promise<Buffer | void>;
|
|
109
|
+
|
|
110
|
+
createMessage(msg: any): Promise<number>
|
|
111
|
+
|
|
112
|
+
updateMessage(msgId: number, msg: any): Promise<void>
|
|
113
|
+
|
|
114
|
+
getFields(objectApiName: string): Promise<any>;
|
|
115
|
+
|
|
116
|
+
getField(objectApiName: string, fieldApiName: string): Promise<any>;
|
|
117
|
+
|
|
118
|
+
terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): Promise<void>;
|
|
119
|
+
|
|
120
|
+
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[]): Promise<Map<string, number>>;
|
|
121
|
+
|
|
122
|
+
getGlobalConfigByKey<valueT>(key: string): Promise<valueT>;
|
|
123
|
+
|
|
124
|
+
oql(oql: string, args: any[], namedArgs: Record<string, any>): Promise<string | any[]>;
|
|
125
|
+
|
|
126
|
+
invokeFuncSync(idOrName: { APIId?: string; APIName?: string, isInvokeByAPIName: boolean }, params: any): Promise<any>;
|
|
127
|
+
|
|
128
|
+
createAsyncTaskV1(idOrName: { APIId?: string; APIName?: string; isInvokeByAPIName: boolean }, params: any): Promise<any>;
|
|
129
|
+
|
|
130
|
+
createAsyncTaskV2(name: string, params: any): Promise<any>;
|
|
131
|
+
|
|
132
|
+
getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
|
|
133
|
+
|
|
134
|
+
executeFlow(APIName: string, options: any): Promise<ExecutionResult>;
|
|
135
|
+
|
|
136
|
+
revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
|
|
137
|
+
|
|
138
|
+
getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
|
|
139
|
+
|
|
140
|
+
getTenantInfo(appCtx: AppCtx): Promise<any>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface IInnerAPIOpenSDKRequest {
|
|
144
|
+
openSDKCreateRecordBySync(objectApiName: string, record: object): any;
|
|
145
|
+
openSDKUpdateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
146
|
+
openSDKDeleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
147
|
+
openSDKCreateRecordsBySync(objectApiName: string, records: object[]): any;
|
|
148
|
+
openSDKUpdateRecordsBySync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
149
|
+
openSDKDeleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
150
|
+
openSDKGetRecords(objectApiName: string, param: OpenSDKGetRecordsReq): any;
|
|
151
|
+
|
|
152
|
+
openSDKUploadFile(fileName: string, data: Buffer): any;
|
|
153
|
+
openSDKUploadAvatar(fileName: string, data: Buffer): any;
|
|
154
|
+
openSDKDownloadAvatar(imageID: string): any;
|
|
155
|
+
invokeFuncWithAuth(idOrName: { APIId?: string; APIName?: string; isInvokeByAPIName: boolean }, params: any): Promise<any>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface IFaaSInfraRequest {
|
|
159
|
+
createDistributeTaskV1(dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any): Promise<any>;
|
|
160
|
+
|
|
161
|
+
createDistributeTaskV2(dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any): Promise<any>;
|
|
162
|
+
|
|
163
|
+
invokeMicroserviceSync(apiName: string, path: string, method: string, body: any): Promise<any>;
|
|
164
|
+
|
|
165
|
+
invokeMicroserviceAsync(apiName: string, path: string, method: string, body: any): Promise<any>;
|
|
166
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Stream } from "stream";
|
|
4
|
+
import { Order } from "../context/db/impl/order";
|
|
5
|
+
import { Criterion } from "../kunlun/operator/impl/logic";
|
|
6
|
+
import { IInnerAPIRequest, OpenSDKGetRecordsReq, UploadFileResp } from "./interface";
|
|
7
|
+
import { ExecutionInfo, ExecutionResult, RevokeExecutionOptions } from "@byted-apaas/server-common-node/context/workflow/workflow";
|
|
8
|
+
import { AppCtx } from "../application/application";
|
|
9
|
+
export declare function updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): Promise<void>;
|
|
10
|
+
export declare class RequestHttp implements IInnerAPIRequest {
|
|
11
|
+
constructor();
|
|
12
|
+
updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): any;
|
|
13
|
+
createRecordBySync(objectApiName: string, record: object): any;
|
|
14
|
+
updateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
15
|
+
deleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
16
|
+
createRecordsByAsync(objectApiName: string, records: object[]): any;
|
|
17
|
+
updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
18
|
+
deleteRecordsByAsync(objectApiName: string, recordIDs: number[]): any;
|
|
19
|
+
createRecordsBySync(objectApiName: string, records: object[]): any;
|
|
20
|
+
updateRecordsBySync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
21
|
+
deleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
22
|
+
getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean): any;
|
|
23
|
+
uploadFile(data: Stream, expire: number): Promise<UploadFileResp>;
|
|
24
|
+
downloadFileByID(fileID: string, filePath?: string): Promise<void | Buffer>;
|
|
25
|
+
downloadFileByToken(fileToken: string, filePath?: string): Promise<Buffer | void>;
|
|
26
|
+
createMessage(msg: any): Promise<number>;
|
|
27
|
+
updateMessage(msgId: number, msg: any): Promise<void>;
|
|
28
|
+
getFields(objectApiName: string): any;
|
|
29
|
+
getField(objectApiName: string, fieldApiName: string): any;
|
|
30
|
+
terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): any;
|
|
31
|
+
modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[]): Promise<Map<string, number>>;
|
|
32
|
+
getGlobalConfigByKey<valueT>(key: string): Promise<valueT>;
|
|
33
|
+
oql(oql: string, args: any[], namedArgs: Record<string, any>): any;
|
|
34
|
+
invokeFuncSync(idOrName: {
|
|
35
|
+
APIId?: string;
|
|
36
|
+
APIName?: string;
|
|
37
|
+
isInvokeByAPIName: boolean;
|
|
38
|
+
}, params: any): Promise<any>;
|
|
39
|
+
invokeFuncWithAuth(idOrName: {
|
|
40
|
+
APIId?: string;
|
|
41
|
+
APIName?: string;
|
|
42
|
+
isInvokeByAPIName: boolean;
|
|
43
|
+
}, params: any): Promise<any>;
|
|
44
|
+
createAsyncTaskV1(idOrName: {
|
|
45
|
+
APIId?: string;
|
|
46
|
+
APIName?: string;
|
|
47
|
+
isInvokeByAPIName: boolean;
|
|
48
|
+
}, params: any): Promise<any>;
|
|
49
|
+
createAsyncTaskV2(name: string, params: any): Promise<any>;
|
|
50
|
+
getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
|
|
51
|
+
executeFlow(APIName: string, options: any): Promise<ExecutionResult>;
|
|
52
|
+
revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
|
|
53
|
+
getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
|
|
54
|
+
getTenantInfo(appCtx: AppCtx): Promise<any>;
|
|
55
|
+
openSDKCreateRecordBySync(objectApiName: string, record: object): any;
|
|
56
|
+
openSDKUpdateRecordBySync(objectApiName: string, recordID: number, record: object): any;
|
|
57
|
+
openSDKDeleteRecordBySync(objectApiName: string, recordID: number): any;
|
|
58
|
+
openSDKCreateRecordsBySync(objectApiName: string, records: object[]): any;
|
|
59
|
+
openSDKUpdateRecordsBySync(objectApiName: string, recordMap: Record<number, object>): any;
|
|
60
|
+
openSDKDeleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
|
|
61
|
+
openSDKGetRecords(objectApiName: string, param: OpenSDKGetRecordsReq): Promise<any | number>;
|
|
62
|
+
openSDKUploadFile(fileName: string, data: Buffer): any;
|
|
63
|
+
openSDKUploadAvatar(fileName: string, data: Buffer): any;
|
|
64
|
+
openSDKDownloadAvatar(imageID: string): Promise<Buffer>;
|
|
65
|
+
}
|
|
66
|
+
export declare function getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
|
|
67
|
+
export declare function executeFlow(APIName: string, option: any): Promise<ExecutionResult>;
|
|
68
|
+
export declare function revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
|
|
69
|
+
export declare function getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
|