@byted-apaas/server-sdk-node 1.1.23 → 1.1.24

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.
Files changed (131) hide show
  1. package/application/application.d.ts +33 -0
  2. package/application/application.js +2 -0
  3. package/application/function/function.d.ts +14 -0
  4. package/application/function/function.js +20 -0
  5. package/application/impl/common.d.ts +2 -0
  6. package/application/impl/common.js +52 -0
  7. package/application/impl/impl.d.ts +19 -0
  8. package/application/impl/impl.js +45 -0
  9. package/common/structs.d.ts +15 -0
  10. package/common/structs.js +21 -0
  11. package/constants/constants.d.ts +13 -0
  12. package/constants/constants.js +18 -0
  13. package/context/context.d.ts +44 -0
  14. package/context/context.js +25 -0
  15. package/context/db/db.d.ts +110 -0
  16. package/context/db/db.js +2 -0
  17. package/context/db/impl/IObject.d.ts +303 -0
  18. package/context/db/impl/IObject.js +5 -0
  19. package/context/db/impl/IObjectV3.d.ts +239 -0
  20. package/context/db/impl/IObjectV3.js +5 -0
  21. package/context/db/impl/db.d.ts +62 -0
  22. package/context/db/impl/db.js +84 -0
  23. package/context/db/impl/dbV3.d.ts +35 -0
  24. package/context/db/impl/dbV3.js +50 -0
  25. package/context/db/impl/object.d.ts +123 -0
  26. package/context/db/impl/object.js +1008 -0
  27. package/context/db/impl/oql/ioql.d.ts +14 -0
  28. package/context/db/impl/oql/ioql.js +4 -0
  29. package/context/db/impl/oql/oql.d.ts +14 -0
  30. package/context/db/impl/oql/oql.js +39 -0
  31. package/context/db/impl/order.d.ts +9 -0
  32. package/context/db/impl/order.js +15 -0
  33. package/context/db/impl/propertiesStore.d.ts +8 -0
  34. package/context/db/impl/propertiesStore.js +29 -0
  35. package/context/db/impl/queryBuilder.d.ts +33 -0
  36. package/context/db/impl/queryBuilder.js +72 -0
  37. package/context/db/impl/transaction/index.d.ts +25 -0
  38. package/context/db/impl/transaction/index.js +300 -0
  39. package/context/db/impl/transaction/operation.d.ts +27 -0
  40. package/context/db/impl/transaction/operation.js +69 -0
  41. package/context/db/impl/transaction.d.ts +70 -0
  42. package/context/db/impl/transaction.js +4 -0
  43. package/context/globalConfig/globalConfig.d.ts +7 -0
  44. package/context/globalConfig/globalConfig.js +16 -0
  45. package/context/integration/IIntegration.d.ts +30 -0
  46. package/context/integration/IIntegration.js +4 -0
  47. package/context/integration/impl/integration.d.ts +16 -0
  48. package/context/integration/impl/integration.js +62 -0
  49. package/context/metadata/components/common.d.ts +6 -0
  50. package/context/metadata/components/common.js +17 -0
  51. package/context/metadata/components/components.d.ts +12 -0
  52. package/context/metadata/components/components.js +19 -0
  53. package/context/metadata/components/desktop/list.d.ts +16 -0
  54. package/context/metadata/components/desktop/list.js +402 -0
  55. package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
  56. package/context/metadata/components/desktop/recordDetail.js +53 -0
  57. package/context/metadata/components/mobile/list.d.ts +24 -0
  58. package/context/metadata/components/mobile/list.js +145 -0
  59. package/context/metadata/metadata.d.ts +63 -0
  60. package/context/metadata/metadata.js +125 -0
  61. package/context/metadata/objects/fields.d.ts +158 -0
  62. package/context/metadata/objects/fields.js +369 -0
  63. package/context/metadata/objects/fields.util.d.ts +52 -0
  64. package/context/metadata/objects/fields.util.js +420 -0
  65. package/context/metadata/objects/fieldsV3.d.ts +159 -0
  66. package/context/metadata/objects/fieldsV3.js +369 -0
  67. package/context/metadata/objects/objects.d.ts +11 -0
  68. package/context/metadata/objects/objects.js +20 -0
  69. package/context/metadata/types/common.d.ts +11 -0
  70. package/context/metadata/types/common.js +33 -0
  71. package/context/metadata/types/components.d.ts +90 -0
  72. package/context/metadata/types/components.js +4 -0
  73. package/context/metadata/types/objects.d.ts +246 -0
  74. package/context/metadata/types/objects.js +4 -0
  75. package/context/metadata/types/objectsV3.d.ts +128 -0
  76. package/context/metadata/types/objectsV3.js +4 -0
  77. package/context/msg/msg.d.ts +38 -0
  78. package/context/msg/msg.js +35 -0
  79. package/context/resources/IResources.d.ts +68 -0
  80. package/context/resources/IResources.js +2 -0
  81. package/context/resources/impl/resources.d.ts +42 -0
  82. package/context/resources/impl/resources.js +161 -0
  83. package/context/tasks/tasks.d.ts +33 -0
  84. package/context/tasks/tasks.js +139 -0
  85. package/data/index.d.ts +27 -0
  86. package/data/index.js +4 -0
  87. package/global/application/flow/flow.d.ts +99 -0
  88. package/global/application/flow/flow.js +8 -0
  89. package/global/application/flow/impl/flow.d.ts +20 -0
  90. package/global/application/flow/impl/flow.js +56 -0
  91. package/global/application/globalVar/globalVar.d.ts +7 -0
  92. package/global/application/globalVar/globalVar.js +2 -0
  93. package/global/global.d.ts +70 -0
  94. package/global/global.js +3 -0
  95. package/hooks/api.d.ts +65 -0
  96. package/hooks/api.js +347 -0
  97. package/hooks/hooks.d.ts +1 -0
  98. package/hooks/hooks.js +107 -0
  99. package/kunlun/kunlun.d.ts +55 -0
  100. package/kunlun/kunlun.js +58 -0
  101. package/kunlun/operator/IOperator.d.ts +158 -0
  102. package/kunlun/operator/IOperator.js +4 -0
  103. package/kunlun/operator/impl/expression.d.ts +75 -0
  104. package/kunlun/operator/impl/expression.js +96 -0
  105. package/kunlun/operator/impl/logic.d.ts +68 -0
  106. package/kunlun/operator/impl/logic.js +573 -0
  107. package/kunlun/operator/impl/logicV2.d.ts +59 -0
  108. package/kunlun/operator/impl/logicV2.js +197 -0
  109. package/kunlun/operator/impl/operator.d.ts +179 -0
  110. package/kunlun/operator/impl/operator.js +222 -0
  111. package/kunlun/operator/impl/operatorV2.d.ts +180 -0
  112. package/kunlun/operator/impl/operatorV2.js +216 -0
  113. package/lib/core.d.ts +4 -0
  114. package/lib/core.js +19 -0
  115. package/package.json +1 -1
  116. package/request/common.d.ts +13 -0
  117. package/request/common.js +88 -0
  118. package/request/constants.d.ts +12 -0
  119. package/request/constants.js +29 -0
  120. package/request/faasinfra.d.ts +8 -0
  121. package/request/faasinfra.js +146 -0
  122. package/request/interface.d.ts +121 -0
  123. package/request/interface.js +30 -0
  124. package/request/openapi.d.ts +84 -0
  125. package/request/openapi.js +1529 -0
  126. package/request/structs.d.ts +99 -0
  127. package/request/structs.js +15 -0
  128. package/types/types.d.ts +79 -0
  129. package/types/types.js +4 -0
  130. package/version/version.d.ts +2 -0
  131. package/version/version.js +8 -0
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FaaSInfraRequest = void 0;
4
+ const common = require("@byted-apaas/server-common-node");
5
+ const headers = common.constants.headers;
6
+ const commonHttp = common.http;
7
+ const faasinfra = common.http.faasinfra;
8
+ const faasinfraHttpPath = common.http.faasinfraHttpPath;
9
+ const replaceKeys = common.http.replaceKeys;
10
+ const exceptions = common.exceptions;
11
+ const utils = common.utils;
12
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
13
+ const nodeCls = require('node-cls'); //nolint:byted_s_ts_no_require_imports
14
+ const loopMasksKey = headers.loopMasksKey;
15
+ const loopCtxKey = headers.loopCtxKey;
16
+ const url_1 = require("url");
17
+ const exceptions_1 = require("@byted-apaas/server-common-node/utils/exceptions");
18
+ class FaaSInfraRequest {
19
+ constructor() {
20
+ }
21
+ async createDistributeTaskV1(dataset, handlerFunc, progressCallbackFunc, completedCallbackFunc, options) {
22
+ // 1.获取 options
23
+ let config = commonHttp.getOptions(null, faasinfraHttpPath.createDistributedTask);
24
+ // 2.构造url
25
+ let urlPath = config._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
26
+ // 3.请求
27
+ config.json = {
28
+ 'domainName': utils.getTenantNameFromCtx(),
29
+ 'namespace': utils.getNamespaceFromCtx(),
30
+ 'userId': utils.getUserIDFromCtx(),
31
+ dataset,
32
+ handlerFunc,
33
+ progressCallbackFunc,
34
+ completedCallbackFunc,
35
+ options,
36
+ };
37
+ let task_id = utils.getTriggerTaskID();
38
+ if (task_id) {
39
+ config.json[headers.triggerTaskId] = task_id;
40
+ }
41
+ let loopCtx = nodeCls.get(loopCtxKey);
42
+ if (checkLoopCtx(loopCtx)) {
43
+ config.json[loopMasksKey] = loopCtx.loopMasks;
44
+ if (!utils.isMicroservice() && (handlerFunc !== '' && config.json[loopMasksKey].includes(utils.handleFuncName({}, handlerFunc))) ||
45
+ (progressCallbackFunc !== '' && config.json[loopMasksKey].includes(utils.handleFuncName({}, progressCallbackFunc))) ||
46
+ (completedCallbackFunc !== '' && config.json[loopMasksKey].includes(utils.handleFuncName({}, completedCallbackFunc)))) {
47
+ throw new exceptions.InvalidParamError('Task execution forms a loop.');
48
+ }
49
+ }
50
+ return await faasinfra.doRequest(null, urlPath, config);
51
+ }
52
+ async createDistributeTaskV2(dataset, handlerFunc, progressCallbackFunc, completedCallbackFunc, options) {
53
+ // 1.获取 options
54
+ let config = commonHttp.getOptions(null, faasinfraHttpPath.createDistributedTaskV2);
55
+ // 2.构造url
56
+ let urlPath = config._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
57
+ // 3.请求
58
+ config.json = {
59
+ 'domainName': utils.getTenantNameFromCtx(),
60
+ 'namespace': utils.getNamespaceFromCtx(),
61
+ 'userId': utils.getUserIDFromCtx(),
62
+ dataset,
63
+ handlerFunc,
64
+ progressCallbackFunc,
65
+ completedCallbackFunc,
66
+ options,
67
+ 'extra': getDebugExtraInfo(),
68
+ };
69
+ let task_id = utils.getTriggerTaskID();
70
+ if (task_id) {
71
+ config.json[headers.triggerTaskId] = task_id;
72
+ }
73
+ let loopCtx = nodeCls.get(loopCtxKey);
74
+ if (checkLoopCtx(loopCtx)) {
75
+ config.json[loopMasksKey] = loopCtx.loopMasks;
76
+ if ((handlerFunc !== '' && config.json[loopMasksKey].includes(handlerFunc)) ||
77
+ (progressCallbackFunc !== '' && config.json[loopMasksKey].includes(progressCallbackFunc)) ||
78
+ (completedCallbackFunc !== '' && config.json[loopMasksKey].includes(completedCallbackFunc))) {
79
+ throw new exceptions.InvalidParamError(`Task execution forms a loop.`);
80
+ }
81
+ }
82
+ return await faasinfra.doRequest(null, urlPath, config);
83
+ }
84
+ async invokeMicroserviceSync(apiName, path, method, body) {
85
+ let reqPath = faasinfraHttpPath.invokeMicroserviceSync;
86
+ let options = commonHttp.getOptions(null, reqPath);
87
+ let urlPath = options._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
88
+ options.json = {
89
+ 'microserviceId': apiName,
90
+ path,
91
+ method,
92
+ 'query': parseQueryParams(path),
93
+ };
94
+ // 处理 body 参数
95
+ if (method.toUpperCase() !== 'GET') {
96
+ options.json.body = JSON.stringify(body);
97
+ }
98
+ return await faasinfra.doRequest(null, urlPath, options);
99
+ }
100
+ async invokeMicroserviceAsync(apiName, path, method, body) {
101
+ let reqPath = faasinfraHttpPath.invokeMicroserviceAsync;
102
+ let options = commonHttp.getOptions(null, reqPath);
103
+ let urlPath = options._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
104
+ options.json = {
105
+ 'microserviceId': apiName,
106
+ path,
107
+ method,
108
+ 'query': parseQueryParams(path),
109
+ };
110
+ // 处理 body 参数
111
+ if (method.toUpperCase() !== 'GET') {
112
+ options.json.body = JSON.stringify(body);
113
+ }
114
+ return await faasinfra.doRequest(null, urlPath, options);
115
+ }
116
+ }
117
+ exports.FaaSInfraRequest = FaaSInfraRequest;
118
+ function getDebugExtraInfo() {
119
+ let extra = {
120
+ 'FunctionFrameVersion': 'FunctionFrameV2',
121
+ };
122
+ if (utils.isDebug()) {
123
+ extra.DebugInfo = utils.getDebugCode();
124
+ }
125
+ return extra;
126
+ }
127
+ function checkLoopCtx(reqCtx) {
128
+ return reqCtx && reqCtx.loopMasks && Array.isArray(reqCtx.loopMasks);
129
+ }
130
+ function parseQueryParams(path) {
131
+ let params = {};
132
+ const url = new url_1.URL(path, 'https://aa.bb.cc');
133
+ for (let [k, v] of url.searchParams.entries()) {
134
+ if (typeof (k) !== 'string') {
135
+ throw new exceptions_1.InternalError(`The type of k should be string, but ${typeof (k)}`);
136
+ }
137
+ if (typeof (v) !== 'string') {
138
+ throw new exceptions_1.InternalError(`The type of v should be string, but ${typeof (v)}`);
139
+ }
140
+ params[k] = v.split(',');
141
+ }
142
+ if (Object.keys(params).length === 0) {
143
+ return undefined;
144
+ }
145
+ return params;
146
+ }
@@ -0,0 +1,121 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Criterion, CriterionV3 } 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
+ import { IApprovalInstance, IApprovalInstanceList, IApprovalInstanceListOptions, IGetApprovalInstanceOptions } from "./structs";
9
+ export declare function GetHttpInstance(): IInnerAPIRequest;
10
+ export declare function GetInstance(): IInnerAPIRequest;
11
+ export declare function GetFaaSInfraInstance(): IFaaSInfraRequest;
12
+ export type UploadFileResp = {
13
+ id: string;
14
+ token: string;
15
+ size: bigint;
16
+ mime_type: string;
17
+ name: string;
18
+ };
19
+ export type OrderV2 = {
20
+ field: string;
21
+ direction: string;
22
+ type: string;
23
+ };
24
+ export type OpenSDKGetRecordsReq = {
25
+ limit: number;
26
+ offset: number;
27
+ fields: string[];
28
+ quickSearch?: string;
29
+ filter: any[];
30
+ sort: OrderV2[];
31
+ count: boolean;
32
+ };
33
+ export type AppAccessToken = {
34
+ expire: number;
35
+ appAccessToken: string;
36
+ appId: string;
37
+ };
38
+ export type TenantAccessToken = {
39
+ expire: number;
40
+ tenantAccessToken: string;
41
+ appId: string;
42
+ };
43
+ export interface IInnerAPIRequest extends IInnerAPIBaseRequest, IInnerAPIOpenSDKRequest {
44
+ }
45
+ export interface IInnerAPIBaseRequest {
46
+ createRecordBySync: (objectApiName: string, record: object, authType: string) => any;
47
+ createRecordBySyncV3: (objectApiName: string, record: object, authType: string) => any;
48
+ updateRecordBySync: (objectApiName: string, recordID: number, record: object, authType: string) => any;
49
+ updateRecordBySyncV3: (objectApiName: string, recordID: string, record: object, authType: string) => any;
50
+ deleteRecordBySync: (objectApiName: string, recordID: number, authType: string) => any;
51
+ deleteRecordBySyncV3: (objectApiName: string, recordID: string, authType: string) => any;
52
+ createRecordsByAsync: (objectApiName: string, records: object[], authType: string) => any;
53
+ updateRecordsByAsync: (objectApiName: string, recordMap: Record<number, object>, authType: string) => any;
54
+ deleteRecordsByAsync: (objectApiName: string, recordIDs: number[], authType: string) => any;
55
+ createRecordsBySync: (objectApiName: string, records: object[], authType: string) => any;
56
+ createRecordsBySyncV3: (objectApiName: string, records: object[], authType: string) => any;
57
+ updateRecordsBySync: (objectApiName: string, recordMap: Record<number, object>, authType: string) => Promise<Record<number, string>>;
58
+ updateRecordsBySyncV3: (objectApiName: string, recordMap: object[], authType: string) => Promise<Record<string, string>>;
59
+ deleteRecordsBySync: (objectApiName: string, recordIDs: number[], authType: string) => Promise<Record<number, string>>;
60
+ deleteRecordsBySyncV3: (objectApiName: string, recordIDs: string[], authType: string) => Promise<Record<string, string>>;
61
+ getRecordsOrCountByCriterion: (objectApiName: string, criterion: string | Criterion, fuzzySearch: any, order: Order[], ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean, authType: string) => any;
62
+ getRecordsV3OrCounByCriterion: (objectApiName: string, criterion: string | CriterionV3, quickQuery: string, quickQueryFields: string[], order: Order[], fieldApiNames: string[], offset: number, limit: number, needCount: boolean, authType: string) => any;
63
+ updateWorkflowVariables: (ctx: any, instanceId: number, variables: object, variableTypes: object) => Promise<void>;
64
+ uploadFile: (data: Stream, expire: number, fileName?: string) => Promise<UploadFileResp>;
65
+ downloadFileByID: (fileID: string, filePath?: string) => Promise<Buffer | undefined>;
66
+ downloadFileByToken: (fileToken: string, filePath?: string) => Promise<Buffer | undefined>;
67
+ createMessage: (msg: any) => Promise<number>;
68
+ updateMessage: (msgId: number, msg: any) => Promise<void>;
69
+ getFields: (objectApiName: string) => Promise<any>;
70
+ getField: (objectApiName: string, fieldApiName: string) => Promise<any>;
71
+ terminateWorkflowInstance: (workflowInstanceId: number, operator: number, reason: string) => Promise<void>;
72
+ modifyRecordsWithTransaction: (placeholders: Record<string, number>, operations: object[], authType: string, version: string) => Promise<Map<string, number>>;
73
+ getGlobalConfigByKey: <valueT>(key: string) => Promise<valueT>;
74
+ oql: (oql: string, args: any[], namedArgs: Record<string, any>, authType: string) => Promise<string | any[]>;
75
+ invokeFuncSync: (idOrName: {
76
+ APIId?: string;
77
+ APIName?: string;
78
+ isInvokeByAPIName: boolean;
79
+ }, params: any) => Promise<any>;
80
+ createAsyncTaskV1: (idOrName: {
81
+ APIId?: string;
82
+ APIName?: string;
83
+ isInvokeByAPIName: boolean;
84
+ }, params: any) => Promise<any>;
85
+ createAsyncTaskV2: (name: string, params: any) => Promise<any>;
86
+ getExecutionUserTaskInfo: (executionId: bigint) => Promise<any>;
87
+ executeFlow: (APIName: string, options: any, async: any) => Promise<ExecutionResult>;
88
+ revokeExecution: (executionId: number, revokeOptions: RevokeExecutionOptions) => Promise<void>;
89
+ getExecutionInfo: (executionId: number) => Promise<ExecutionInfo>;
90
+ getTenantInfo: (appCtx: AppCtx) => Promise<any>;
91
+ mGetFileToken: (ids: string[]) => Promise<string>;
92
+ getIntegrationAppAccessToken: (apiName: string) => Promise<AppAccessToken>;
93
+ getIntegrationTenantAccessToken: (apiName: string) => Promise<TenantAccessToken>;
94
+ getDefaultIntegrationAppAccessToken: () => Promise<AppAccessToken>;
95
+ getDefaultIntegrationTenantAccessToken: () => Promise<TenantAccessToken>;
96
+ getApprovalInstanceList: (options?: IApprovalInstanceListOptions) => Promise<IApprovalInstanceList>;
97
+ getApprovalInstance: (options: IGetApprovalInstanceOptions) => Promise<IApprovalInstance>;
98
+ }
99
+ export interface IInnerAPIOpenSDKRequest {
100
+ openSDKCreateRecordBySync: (objectApiName: string, record: object) => any;
101
+ openSDKUpdateRecordBySync: (objectApiName: string, recordID: number, record: object) => any;
102
+ openSDKDeleteRecordBySync: (objectApiName: string, recordID: number) => any;
103
+ openSDKCreateRecordsBySync: (objectApiName: string, records: object[]) => any;
104
+ openSDKUpdateRecordsBySync: (objectApiName: string, recordMap: Record<number, object>) => any;
105
+ openSDKDeleteRecordsBySync: (objectApiName: string, recordIDs: number[]) => any;
106
+ openSDKGetRecords: (objectApiName: string, param: OpenSDKGetRecordsReq) => any;
107
+ openSDKUploadFile: (fileName: string, data: Buffer) => any;
108
+ openSDKUploadAvatar: (fileName: string, data: Buffer) => any;
109
+ openSDKDownloadAvatar: (imageID: string) => any;
110
+ invokeFuncWithAuth: (idOrName: {
111
+ APIId?: string;
112
+ APIName?: string;
113
+ isInvokeByAPIName: boolean;
114
+ }, params: any) => Promise<any>;
115
+ }
116
+ export interface IFaaSInfraRequest {
117
+ createDistributeTaskV1: (dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any) => Promise<any>;
118
+ createDistributeTaskV2: (dataset: any, handlerFunc: string, progressCallbackFunc: string, completedCallbackFunc: string, options: any) => Promise<any>;
119
+ invokeMicroserviceSync: (apiName: string, path: string, method: string, body: any) => Promise<any>;
120
+ invokeMicroserviceAsync: (apiName: string, path: string, method: string, body: any) => Promise<any>;
121
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
3
+ // SPDX-License-Identifier: MIT
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.GetFaaSInfraInstance = exports.GetInstance = exports.GetHttpInstance = void 0;
6
+ const openapi_1 = require("./openapi");
7
+ const faasinfra_1 = require("./faasinfra");
8
+ const version_1 = require("../version/version");
9
+ const server_common_node_1 = require("@byted-apaas/server-common-node");
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
+ // 设置 SDK 版本信息到请求上下文,用于埋点上报
18
+ server_common_node_1.utils.setSDKInfo(version_1.SDKName, version_1.SDKVersion);
19
+ }
20
+ return requestInstanceMap.httpRequest;
21
+ }
22
+ exports.GetHttpInstance = GetHttpInstance;
23
+ function GetInstance() {
24
+ return GetHttpInstance();
25
+ }
26
+ exports.GetInstance = GetInstance;
27
+ function GetFaaSInfraInstance() {
28
+ return new faasinfra_1.FaaSInfraRequest();
29
+ }
30
+ exports.GetFaaSInfraInstance = GetFaaSInfraInstance;
@@ -0,0 +1,84 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Stream } from 'stream';
4
+ import { Order } from '../context/db/impl/order';
5
+ import { Criterion, CriterionV3 } 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
+ import { IApprovalInstance, IApprovalInstanceListOptions, IApprovalInstanceList, IGetApprovalInstanceOptions } from "./structs";
10
+ export declare function updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): Promise<void>;
11
+ export declare class RequestHttp implements IInnerAPIRequest {
12
+ constructor();
13
+ updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): any;
14
+ createRecordBySync(objectApiName: string, record: object, authType: string): any;
15
+ createRecordBySyncV3(objectApiName: string, record: object, authType: string): any;
16
+ updateRecordBySync(objectApiName: string, recordID: number, record: object, authType: string): any;
17
+ updateRecordBySyncV3(objectApiName: string, recordID: string, record: object, authType: string): any;
18
+ deleteRecordBySync(objectApiName: string, recordID: number, authType: string): any;
19
+ deleteRecordBySyncV3(objectApiName: string, recordID: string, authType: string): any;
20
+ createRecordsByAsync(objectApiName: string, records: object[], authType: string): any;
21
+ updateRecordsByAsync(objectApiName: string, recordMap: Record<number, object>, authType: string): any;
22
+ deleteRecordsByAsync(objectApiName: string, recordIDs: number[], authType: string): any;
23
+ createRecordsBySync(objectApiName: string, records: object[], authType: string): any;
24
+ createRecordsBySyncV3(objectApiName: string, records: object[], authType: string): any;
25
+ updateRecordsBySync(objectApiName: string, recordMap: Record<number, object>, authType: string): Promise<Record<number, string>>;
26
+ updateRecordsBySyncV3(objectApiName: string, records: object[], authType: string): Promise<Record<string, string>>;
27
+ deleteRecordsBySync(objectApiName: string, recordIDs: number[], authType: string): Promise<Record<number, string>>;
28
+ deleteRecordsBySyncV3(objectApiName: string, recordIDs: string[], authType: string): Promise<Record<string, string>>;
29
+ getRecordsOrCountByCriterion(objectApiName: string, criterion: string | Criterion, order: Order[], fuzzySearch: any, ignoreBackLookupField: boolean, fieldApiNames: string[], offset: number, limit: number, needCount: boolean, authType: string): any;
30
+ getRecordsV3OrCounByCriterion(objectApiName: string, criterion: string | CriterionV3, quickQuery: string, quickQueryFields: string[], order: Order[], fieldApiNames: string[], offset: number, limit: number, needCount: boolean, authType: string): any;
31
+ uploadFile(data: Stream, expire: number, fileName?: string): Promise<UploadFileResp>;
32
+ downloadFileByID(fileID: string, filePath?: string): Promise<undefined | Buffer>;
33
+ downloadFileByToken(fileToken: string, filePath?: string): Promise<Buffer | undefined>;
34
+ createMessage(msg: any): Promise<number>;
35
+ updateMessage(msgId: number, msg: any): Promise<void>;
36
+ getFields(objectApiName: string): any;
37
+ getField(objectApiName: string, fieldApiName: string): any;
38
+ terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): any;
39
+ modifyRecordsWithTransaction(placeholders: Record<string, number>, operations: object[], authType: string, version: string): Promise<Map<string, number>>;
40
+ getGlobalConfigByKey<valueT>(key: string): Promise<valueT>;
41
+ oql(oql: string, args: any[], namedArgs: Record<string, any>, authType: string): any;
42
+ invokeFuncSync(idOrName: {
43
+ APIId?: string;
44
+ APIName?: string;
45
+ isInvokeByAPIName: boolean;
46
+ }, params: any): Promise<any>;
47
+ invokeFuncWithAuth(idOrName: {
48
+ APIId?: string;
49
+ APIName?: string;
50
+ isInvokeByAPIName: boolean;
51
+ }, params: any): Promise<any>;
52
+ createAsyncTaskV1(idOrName: {
53
+ APIId?: string;
54
+ APIName?: string;
55
+ isInvokeByAPIName: boolean;
56
+ }, params: any): Promise<any>;
57
+ createAsyncTaskV2(name: string, params: any): Promise<any>;
58
+ getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
59
+ executeFlow(apiName: string, options: any, async: any): Promise<ExecutionResult>;
60
+ revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
61
+ getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
62
+ getTenantInfo(appCtx: AppCtx): Promise<any>;
63
+ mGetFileToken(ids: string[]): Promise<string>;
64
+ getIntegrationAppAccessToken(apiName: string): Promise<any>;
65
+ getIntegrationTenantAccessToken(apiName: string): Promise<any>;
66
+ getDefaultIntegrationAppAccessToken(): Promise<any>;
67
+ getDefaultIntegrationTenantAccessToken(): Promise<any>;
68
+ openSDKCreateRecordBySync(objectApiName: string, record: object): any;
69
+ openSDKUpdateRecordBySync(objectApiName: string, recordID: number, record: object): any;
70
+ openSDKDeleteRecordBySync(objectApiName: string, recordID: number): any;
71
+ openSDKCreateRecordsBySync(objectApiName: string, records: object[]): any;
72
+ openSDKUpdateRecordsBySync(objectApiName: string, recordMap: Record<number, object>): any;
73
+ openSDKDeleteRecordsBySync(objectApiName: string, recordIDs: number[]): any;
74
+ openSDKGetRecords(objectApiName: string, param: OpenSDKGetRecordsReq): Promise<any | number>;
75
+ openSDKUploadFile(fileName: string, data: Buffer): any;
76
+ openSDKUploadAvatar(fileName: string, data: Buffer): any;
77
+ openSDKDownloadAvatar(imageID: string): Promise<Buffer>;
78
+ getApprovalInstanceList(params?: IApprovalInstanceListOptions): Promise<IApprovalInstanceList>;
79
+ getApprovalInstance(params: IGetApprovalInstanceOptions): Promise<IApprovalInstance>;
80
+ }
81
+ export declare function getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
82
+ export declare function executeFlow(apiName: string, option: any, async: any): Promise<ExecutionResult>;
83
+ export declare function revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
84
+ export declare function getExecutionInfo(executionId: number): Promise<ExecutionInfo>;