@byted-apaas/server-sdk-node 1.1.20-beta.8 → 1.1.20
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/context/context.d.ts +0 -7
- package/global/application/flow/flow.d.ts +3 -2
- package/global/application/flow/impl/flow.d.ts +1 -1
- package/global/application/flow/impl/flow.js +4 -4
- package/global/global.d.ts +0 -10
- package/hooks/api.d.ts +1 -1
- package/hooks/api.js +4 -4
- package/hooks/hooks.js +0 -6
- package/package.json +2 -2
- package/request/interface.d.ts +1 -7
- package/request/openapi.d.ts +2 -8
- package/request/openapi.js +10 -95
- package/context/push/pushCenter.d.ts +0 -46
- package/context/push/pushCenter.js +0 -51
- package/context/task/taskCenter.d.ts +0 -32
- package/context/task/taskCenter.js +0 -38
package/context/context.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { IDBGetter } from './db/db';
|
|
|
5
5
|
import { Context as CommonContext } from '@byted-apaas/server-common-node';
|
|
6
6
|
import { IMetaData } from './metadata/metadata';
|
|
7
7
|
import { _IIntegration } from './integration/IIntegration';
|
|
8
|
-
import { TaskCenter } from "./task/taskCenter";
|
|
9
|
-
import { PushCenter } from "./push/pushCenter";
|
|
10
8
|
export declare class Context<T, mt, cf, gv> extends CommonContext implements IContext<T, mt, cf, gv> {
|
|
11
9
|
/**
|
|
12
10
|
* 操作数据库中的记录数据
|
|
@@ -35,11 +33,6 @@ export declare class Context<T, mt, cf, gv> extends CommonContext implements ICo
|
|
|
35
33
|
* 向消息中心推送及更新消息
|
|
36
34
|
*/
|
|
37
35
|
msg: Message;
|
|
38
|
-
taskCenter: TaskCenter;
|
|
39
|
-
/**
|
|
40
|
-
* 推送中心
|
|
41
|
-
*/
|
|
42
|
-
pushCenter: PushCenter;
|
|
43
36
|
/**
|
|
44
37
|
* 根据 apiName 获取对应的全局变量
|
|
45
38
|
* @param apiName 全局变量的 API Name
|
|
@@ -8,12 +8,13 @@ export interface Flow {
|
|
|
8
8
|
getExecutionUserTaskInfo: (executionId: number) => Promise<FlowTaskInfo[]>;
|
|
9
9
|
/**
|
|
10
10
|
* 执行流程
|
|
11
|
-
* @param
|
|
11
|
+
* @param apiName 流程的 APIName
|
|
12
12
|
* @param options 流程执行选项
|
|
13
|
+
* @param async 是否异步执行
|
|
13
14
|
* - params 流程入参
|
|
14
15
|
* @constructor
|
|
15
16
|
*/
|
|
16
|
-
execute: (
|
|
17
|
+
execute: (apiName: string, options?: ExecuteOptions, async?: boolean) => Promise<ExecutionResult>;
|
|
17
18
|
/**
|
|
18
19
|
* 撤销流程实例 (仅支持撤销包含人工任务的流程实例)
|
|
19
20
|
* @param executionId 流程实例 Id
|
|
@@ -11,7 +11,7 @@ export declare class Flow implements IFlow {
|
|
|
11
11
|
*/
|
|
12
12
|
instanceId: number;
|
|
13
13
|
constructor(flowParams: any);
|
|
14
|
-
execute(
|
|
14
|
+
execute(apiName: string, options: ExecuteOptions | undefined, async?: boolean | undefined): Promise<ExecutionResult>;
|
|
15
15
|
getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
|
|
16
16
|
getExecutionUserTaskInfo(executionId: number): Promise<FlowTaskInfo[]>;
|
|
17
17
|
revokeExecution(executionId: number, options: RevokeExecutionOptions): Promise<void>;
|
|
@@ -10,9 +10,9 @@ class Flow {
|
|
|
10
10
|
this.apiName = flowParams?.apiName;
|
|
11
11
|
this.instanceId = flowParams?.instanceId;
|
|
12
12
|
}
|
|
13
|
-
async execute(
|
|
14
|
-
if (!
|
|
15
|
-
throw new exceptions_1.InvalidParamError(`param's type (${
|
|
13
|
+
async execute(apiName, options, async) {
|
|
14
|
+
if (!apiName || typeof apiName !== 'string') {
|
|
15
|
+
throw new exceptions_1.InvalidParamError(`param's type (${apiName}) need string, but is ${typeof apiName}`);
|
|
16
16
|
}
|
|
17
17
|
if (options && options.params && server_common_node_1.checkUtils.isNotObject(options.params)) {
|
|
18
18
|
throw new exceptions_1.InvalidParamError(`options.params's type (${options}) need object, but is ${Array.isArray(options) ? 'array' : typeof options.params}`);
|
|
@@ -20,7 +20,7 @@ class Flow {
|
|
|
20
20
|
if (!options) {
|
|
21
21
|
options = {};
|
|
22
22
|
}
|
|
23
|
-
return await Request.GetInstance().executeFlow(
|
|
23
|
+
return await Request.GetInstance().executeFlow(apiName, options, async);
|
|
24
24
|
}
|
|
25
25
|
async getExecutionInfo(executionId) {
|
|
26
26
|
if (!executionId || typeof executionId !== 'number') {
|
package/global/global.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ import { Flow } from './application/flow/flow';
|
|
|
6
6
|
import { _Resources } from '../context/resources/impl/resources';
|
|
7
7
|
import { Message } from '../context/msg/msg';
|
|
8
8
|
import { _IIntegration } from '../context/integration/IIntegration';
|
|
9
|
-
import { TaskCenter } from "../context/task/taskCenter";
|
|
10
|
-
import { PushCenter } from "../context/push/pushCenter";
|
|
11
9
|
declare global {
|
|
12
10
|
export namespace application {
|
|
13
11
|
/**
|
|
@@ -32,14 +30,6 @@ declare global {
|
|
|
32
30
|
/**
|
|
33
31
|
* metadataV3 接口
|
|
34
32
|
*/
|
|
35
|
-
/**
|
|
36
|
-
* 消息中心
|
|
37
|
-
*/
|
|
38
|
-
let taskCenter: TaskCenter;
|
|
39
|
-
/**
|
|
40
|
-
* 推送中心
|
|
41
|
-
*/
|
|
42
|
-
let pushCenter: PushCenter;
|
|
43
33
|
/**
|
|
44
34
|
* 常量
|
|
45
35
|
*/
|
package/hooks/api.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare function mountWorkflowFeature(context: any): void;
|
|
|
18
18
|
export declare function terminateWorkflow(): (workflowInstanceId: number, options: any) => Promise<void>;
|
|
19
19
|
export declare function mockFlowFeature(context: any): any;
|
|
20
20
|
export declare function mockGetExecutionUserTaskInfo(): (executionId: bigint) => Promise<FlowTaskInfo[]>;
|
|
21
|
-
export declare function mockExecuteFlow(): (
|
|
21
|
+
export declare function mockExecuteFlow(): (apiName: string, options?: ExecuteOptions) => Promise<ExecutionResult>;
|
|
22
22
|
export declare function mockRevokeExecution(): (executionId: number, options: RevokeExecutionOptions) => Promise<void>;
|
|
23
23
|
export declare function mockGetExecutionInfo(): (executionId: number) => Promise<ExecutionInfo>;
|
|
24
24
|
export declare function invokeMicroservice(): (apiName: string) => {
|
package/hooks/api.js
CHANGED
|
@@ -257,9 +257,9 @@ function mockGetExecutionUserTaskInfo() {
|
|
|
257
257
|
}
|
|
258
258
|
exports.mockGetExecutionUserTaskInfo = mockGetExecutionUserTaskInfo;
|
|
259
259
|
function mockExecuteFlow() {
|
|
260
|
-
return async (
|
|
261
|
-
if (!
|
|
262
|
-
throw new exceptions_1.InvalidParamError(`param's type (${
|
|
260
|
+
return async (apiName, options) => {
|
|
261
|
+
if (!apiName || typeof apiName !== 'string') {
|
|
262
|
+
throw new exceptions_1.InvalidParamError(`param's type (${apiName}) need string, but is ${typeof apiName}`);
|
|
263
263
|
}
|
|
264
264
|
if (options && options.params && checkUtils.isNotObject(options.params)) {
|
|
265
265
|
throw new exceptions_1.InvalidParamError(`options.params's type (${options}) need object, but is ${Array.isArray(options) ? 'array' : typeof options.params}`);
|
|
@@ -267,7 +267,7 @@ function mockExecuteFlow() {
|
|
|
267
267
|
if (!options) {
|
|
268
268
|
options = {};
|
|
269
269
|
}
|
|
270
|
-
return await Request.GetInstance().executeFlow(
|
|
270
|
+
return await Request.GetInstance().executeFlow(apiName, options, false);
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
273
|
exports.mockExecuteFlow = mockExecuteFlow;
|
package/hooks/hooks.js
CHANGED
|
@@ -11,8 +11,6 @@ const common_1 = require("../request/common");
|
|
|
11
11
|
const integration_1 = require("../context/integration/impl/integration");
|
|
12
12
|
const metadataApi = require("../context/metadata/metadata");
|
|
13
13
|
const flow_1 = require("../global/application/flow/flow");
|
|
14
|
-
const taskCenter_1 = require("../context/task/taskCenter");
|
|
15
|
-
const pushCenter_1 = require("../context/push/pushCenter");
|
|
16
14
|
/**
|
|
17
15
|
* 根据 key 获取对应的全局变量
|
|
18
16
|
* @param key 全局变量的 key
|
|
@@ -59,8 +57,6 @@ function mountContext(context, logger, requireFunc) {
|
|
|
59
57
|
context.function = api.getFunctionSync(context, logger);
|
|
60
58
|
context.tasks = new tasks_1.Tasks(context.function);
|
|
61
59
|
context.msg = new msg_1.Message();
|
|
62
|
-
context.taskCenter = new taskCenter_1.TaskCenter();
|
|
63
|
-
context.pushCenter = new pushCenter_1.PushCenter();
|
|
64
60
|
context.resources = new resources_1._Resources();
|
|
65
61
|
context.integration = new integration_1._Integration();
|
|
66
62
|
context.getVar = getVar;
|
|
@@ -87,8 +83,6 @@ function mountApplication(context) {
|
|
|
87
83
|
global.application.publicAPI.method = server_common_node_1.utils.getHttpMethod();
|
|
88
84
|
global.application.publicAPI.headers = server_common_node_1.utils.getHttpHeaders();
|
|
89
85
|
global.application.msg = new msg_1.Message();
|
|
90
|
-
global.application.taskCenter = new taskCenter_1.TaskCenter();
|
|
91
|
-
global.application.pushCenter = new pushCenter_1.PushCenter();
|
|
92
86
|
global.application.resources = new resources_1._Resources();
|
|
93
87
|
global.application.metadata = metadataApi.metadata(context);
|
|
94
88
|
// (global as any).application.metadataV3 = metadataApi.metadataV3(context);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byted-apaas/server-sdk-node",
|
|
3
|
-
"version": "1.1.20
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "aPaaS Server SDK",
|
|
5
5
|
"author": "zhouwexin <zhouwexin@bytedance.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"clean": "tsc --build --clean && rm -rf **/*.js.map"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@byted-apaas/server-common-node": "^2.0.
|
|
16
|
+
"@byted-apaas/server-common-node": "^2.0.13",
|
|
17
17
|
"@jorgeferrero/stream-to-buffer": "^2.0.6",
|
|
18
18
|
"dayjs": "^1.9.6",
|
|
19
19
|
"form-data": "^3.0.0",
|
package/request/interface.d.ts
CHANGED
|
@@ -66,12 +66,6 @@ export interface IInnerAPIBaseRequest {
|
|
|
66
66
|
downloadFileByToken: (fileToken: string, filePath?: string) => Promise<Buffer | undefined>;
|
|
67
67
|
createMessage: (msg: any) => Promise<number>;
|
|
68
68
|
updateMessage: (msgId: number, msg: any) => Promise<void>;
|
|
69
|
-
syncTasks: (tasks: any, cacheDuration: number) => Promise<number>;
|
|
70
|
-
getTaskDetail: (task: any) => Promise<any>;
|
|
71
|
-
refreshTasksCache: (tasks: any, cacheDuration: number) => Promise<number>;
|
|
72
|
-
sendMessageBatch: (receiverInfos: any, channelIDs: string[], template: string, msgType: string, batchNo: string, senderID: string, senderIDType: string, subBatchNo?: string, tags?: Map<string, string>, extra?: Map<string, string>) => Promise<string>;
|
|
73
|
-
getMessageBatchStatus: (batchNo: string, tags?: Map<string, string>) => Promise<any>;
|
|
74
|
-
getMessageStatus: (batchNo: string, receiverIDs?: string[], tags?: Map<string, string>, withFeedback?: boolean, offset?: number, limit?: number) => Promise<any>;
|
|
75
69
|
getFields: (objectApiName: string) => Promise<any>;
|
|
76
70
|
getField: (objectApiName: string, fieldApiName: string) => Promise<any>;
|
|
77
71
|
terminateWorkflowInstance: (workflowInstanceId: number, operator: number, reason: string) => Promise<void>;
|
|
@@ -90,7 +84,7 @@ export interface IInnerAPIBaseRequest {
|
|
|
90
84
|
}, params: any) => Promise<any>;
|
|
91
85
|
createAsyncTaskV2: (name: string, params: any) => Promise<any>;
|
|
92
86
|
getExecutionUserTaskInfo: (executionId: bigint) => Promise<any>;
|
|
93
|
-
executeFlow: (APIName: string, options: any) => Promise<ExecutionResult>;
|
|
87
|
+
executeFlow: (APIName: string, options: any, async: any) => Promise<ExecutionResult>;
|
|
94
88
|
revokeExecution: (executionId: number, revokeOptions: RevokeExecutionOptions) => Promise<void>;
|
|
95
89
|
getExecutionInfo: (executionId: number) => Promise<ExecutionInfo>;
|
|
96
90
|
getTenantInfo: (appCtx: AppCtx) => Promise<any>;
|
package/request/openapi.d.ts
CHANGED
|
@@ -33,12 +33,6 @@ export declare class RequestHttp implements IInnerAPIRequest {
|
|
|
33
33
|
downloadFileByToken(fileToken: string, filePath?: string): Promise<Buffer | undefined>;
|
|
34
34
|
createMessage(msg: any): Promise<number>;
|
|
35
35
|
updateMessage(msgId: number, msg: any): Promise<void>;
|
|
36
|
-
syncTasks(tasks: any, cacheDuration: number): Promise<any>;
|
|
37
|
-
getTaskDetail(task: any): Promise<any>;
|
|
38
|
-
sendMessageBatch(receiverInfos: any, channelIDs: string[], template: string, msgType: string, batchNo: string, senderID: string, senderIDType: string, subBatchNo?: string, tags?: Map<string, string>, extra?: Map<string, string>): Promise<string>;
|
|
39
|
-
getMessageBatchStatus(batchNo: string, tags?: Map<string, string>): Promise<any>;
|
|
40
|
-
getMessageStatus(batchNo: string, receiverIDs?: string[], tags?: Map<string, string>, withFeedback?: boolean, offset?: number, limit?: number): Promise<any>;
|
|
41
|
-
refreshTasksCache(cacheDuration: number, tasks: any): Promise<any>;
|
|
42
36
|
getFields(objectApiName: string): any;
|
|
43
37
|
getField(objectApiName: string, fieldApiName: string): any;
|
|
44
38
|
terminateWorkflowInstance(workflowInstanceId: number, operator: number, reason: string): any;
|
|
@@ -62,7 +56,7 @@ export declare class RequestHttp implements IInnerAPIRequest {
|
|
|
62
56
|
}, params: any): Promise<any>;
|
|
63
57
|
createAsyncTaskV2(name: string, params: any): Promise<any>;
|
|
64
58
|
getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
|
|
65
|
-
executeFlow(
|
|
59
|
+
executeFlow(apiName: string, options: any, async: any): Promise<ExecutionResult>;
|
|
66
60
|
revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
|
|
67
61
|
getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
|
|
68
62
|
getTenantInfo(appCtx: AppCtx): Promise<any>;
|
|
@@ -85,6 +79,6 @@ export declare class RequestHttp implements IInnerAPIRequest {
|
|
|
85
79
|
getApprovalInstance(params: IGetApprovalInstanceOptions): Promise<IApprovalInstance>;
|
|
86
80
|
}
|
|
87
81
|
export declare function getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
|
|
88
|
-
export declare function executeFlow(
|
|
82
|
+
export declare function executeFlow(apiName: string, option: any, async: any): Promise<ExecutionResult>;
|
|
89
83
|
export declare function revokeExecution(executionId: number, revokeOptions: RevokeExecutionOptions): Promise<void>;
|
|
90
84
|
export declare function getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
|
package/request/openapi.js
CHANGED
|
@@ -11,7 +11,8 @@ const constants_3 = require("@byted-apaas/server-common-node/constants/constants
|
|
|
11
11
|
const common_1 = require("./common");
|
|
12
12
|
const utils_1 = require("@byted-apaas/server-common-node/utils/utils");
|
|
13
13
|
const permissionUtils = require("@byted-apaas/server-common-node/utils/permissionUtils");
|
|
14
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
15
|
+
const { URLSearchParams } = require('url'); //nolint:byted_s_ts_no_require_imports
|
|
15
16
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
16
17
|
const nodeCls = require('node-cls'); //nolint:byted_s_ts_no_require_imports
|
|
17
18
|
const fs = require('fs');
|
|
@@ -1039,12 +1040,6 @@ class RequestHttp {
|
|
|
1039
1040
|
this.openSDKUploadFile = openSDKUploadFile;
|
|
1040
1041
|
this.openSDKUploadAvatar = openSDKUploadAvatar;
|
|
1041
1042
|
this.openSDKDownloadAvatar = openSDKDownloadAvatar;
|
|
1042
|
-
this.syncTasks = syncTasks;
|
|
1043
|
-
this.getTaskDetail = getTaskDetail;
|
|
1044
|
-
this.refreshTasksCache = refreshTasksCache;
|
|
1045
|
-
this.sendMessageBatch = sendMessageBatch;
|
|
1046
|
-
this.getMessageBatchStatus = getMessageBatchStatus;
|
|
1047
|
-
this.getMessageStatus = getMessageStatus;
|
|
1048
1043
|
}
|
|
1049
1044
|
updateWorkflowVariables(ctx, instanceId, variables, variableTypes) {
|
|
1050
1045
|
}
|
|
@@ -1103,24 +1098,6 @@ class RequestHttp {
|
|
|
1103
1098
|
updateMessage(msgId, msg) {
|
|
1104
1099
|
return null;
|
|
1105
1100
|
}
|
|
1106
|
-
syncTasks(tasks, cacheDuration) {
|
|
1107
|
-
return null;
|
|
1108
|
-
}
|
|
1109
|
-
getTaskDetail(task) {
|
|
1110
|
-
return null;
|
|
1111
|
-
}
|
|
1112
|
-
sendMessageBatch(receiverInfos, channelIDs, template, msgType, batchNo, senderID, senderIDType, subBatchNo, tags, extra) {
|
|
1113
|
-
return null;
|
|
1114
|
-
}
|
|
1115
|
-
getMessageBatchStatus(batchNo, tags) {
|
|
1116
|
-
return null;
|
|
1117
|
-
}
|
|
1118
|
-
getMessageStatus(batchNo, receiverIDs, tags, withFeedback, offset, limit) {
|
|
1119
|
-
return null;
|
|
1120
|
-
}
|
|
1121
|
-
refreshTasksCache(cacheDuration, tasks) {
|
|
1122
|
-
return null;
|
|
1123
|
-
}
|
|
1124
1101
|
getFields(objectApiName) {
|
|
1125
1102
|
}
|
|
1126
1103
|
getField(objectApiName, fieldApiName) {
|
|
@@ -1150,8 +1127,8 @@ class RequestHttp {
|
|
|
1150
1127
|
async getExecutionUserTaskInfo(executionId) {
|
|
1151
1128
|
return await getExecutionUserTaskInfo(executionId);
|
|
1152
1129
|
}
|
|
1153
|
-
async executeFlow(
|
|
1154
|
-
return await executeFlow(
|
|
1130
|
+
async executeFlow(apiName, options, async) {
|
|
1131
|
+
return await executeFlow(apiName, options, async);
|
|
1155
1132
|
}
|
|
1156
1133
|
async revokeExecution(executionId, revokeOptions) {
|
|
1157
1134
|
return await revokeExecution(executionId, revokeOptions);
|
|
@@ -1438,17 +1415,20 @@ async function getExecutionUserTaskInfo(executionId) {
|
|
|
1438
1415
|
return res.taskList;
|
|
1439
1416
|
}
|
|
1440
1417
|
exports.getExecutionUserTaskInfo = getExecutionUserTaskInfo;
|
|
1441
|
-
async function executeFlow(
|
|
1442
|
-
if (!
|
|
1418
|
+
async function executeFlow(apiName, option, async) {
|
|
1419
|
+
if (!apiName) {
|
|
1443
1420
|
throw new exceptions.InvalidParamError(`flow apiName is empty`);
|
|
1444
1421
|
}
|
|
1445
1422
|
let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.executeFlow);
|
|
1446
|
-
|
|
1423
|
+
const urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, apiName);
|
|
1447
1424
|
options.json = {
|
|
1448
1425
|
'operator': utils.getUserIDFromCtx(),
|
|
1449
1426
|
'variables': (0, common_1.transMapToFlowVariable)(option.params),
|
|
1450
1427
|
'loopMasks': utils.getLoopMasks(),
|
|
1451
1428
|
};
|
|
1429
|
+
if (async !== undefined) {
|
|
1430
|
+
options.json['async'] = async;
|
|
1431
|
+
}
|
|
1452
1432
|
let res = await openapi.doRequest(null, urlPath, options);
|
|
1453
1433
|
return {
|
|
1454
1434
|
executionId: res.executionId,
|
|
@@ -1546,68 +1526,3 @@ async function getDefaultIntegrationTenantAccessToken() {
|
|
|
1546
1526
|
appId: res.appId,
|
|
1547
1527
|
};
|
|
1548
1528
|
}
|
|
1549
|
-
async function syncTasks(tasks, cacheDuration) {
|
|
1550
|
-
let options = commonHttp.getOptions(null, openapiHttpPath.taskCenterSyncTasks);
|
|
1551
|
-
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
1552
|
-
options.json = {
|
|
1553
|
-
'tasks': tasks,
|
|
1554
|
-
'cache_duration': cacheDuration,
|
|
1555
|
-
};
|
|
1556
|
-
return await openapi.doRequest(null, urlPath, options);
|
|
1557
|
-
}
|
|
1558
|
-
async function getTaskDetail(task) {
|
|
1559
|
-
let options = commonHttp.getOptions(null, openapiHttpPath.taskCenterGetTaskDetail);
|
|
1560
|
-
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
1561
|
-
options.json = {
|
|
1562
|
-
'task': task,
|
|
1563
|
-
};
|
|
1564
|
-
return await openapi.doRequest(null, urlPath, options);
|
|
1565
|
-
}
|
|
1566
|
-
async function refreshTasksCache(tasks, cacheDuration) {
|
|
1567
|
-
let options = commonHttp.getOptions(null, openapiHttpPath.taskCenterRefreshTasksCache);
|
|
1568
|
-
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
1569
|
-
options.json = {
|
|
1570
|
-
'tasks': tasks,
|
|
1571
|
-
'cache_duration': cacheDuration,
|
|
1572
|
-
};
|
|
1573
|
-
return await openapi.doRequest(null, urlPath, options);
|
|
1574
|
-
}
|
|
1575
|
-
async function sendMessageBatch(receiverInfos, channelIDs, template, msgType, batchNo, senderID, senderIDType, subBatchNo, tags, extra) {
|
|
1576
|
-
let options = commonHttp.getOptions(null, openapiHttpPath.pushCenterSendMessageBatch);
|
|
1577
|
-
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
1578
|
-
options.json = {
|
|
1579
|
-
'receiver_infos': receiverInfos,
|
|
1580
|
-
'channel_ids': channelIDs,
|
|
1581
|
-
'template': template,
|
|
1582
|
-
'msg_type': msgType,
|
|
1583
|
-
'batch_no': batchNo,
|
|
1584
|
-
'sender_id': senderID,
|
|
1585
|
-
'sender_id_type': senderIDType,
|
|
1586
|
-
'sub_batch_no': subBatchNo,
|
|
1587
|
-
'tags': tags,
|
|
1588
|
-
'extra': extra,
|
|
1589
|
-
};
|
|
1590
|
-
return await openapi.doRequest(null, urlPath, options);
|
|
1591
|
-
}
|
|
1592
|
-
async function getMessageBatchStatus(batchNo, tags) {
|
|
1593
|
-
let options = commonHttp.getOptions(null, openapiHttpPath.pushCenterGetMessageBatchStatus);
|
|
1594
|
-
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
1595
|
-
options.json = {
|
|
1596
|
-
'batch_no': batchNo,
|
|
1597
|
-
'tags': tags,
|
|
1598
|
-
};
|
|
1599
|
-
return await openapi.doRequest(null, urlPath, options);
|
|
1600
|
-
}
|
|
1601
|
-
async function getMessageStatus(batchNo, receiverIDs, tags, withFeedback, offset, limit) {
|
|
1602
|
-
let options = commonHttp.getOptions(null, openapiHttpPath.pushCenterGetMessageStatus);
|
|
1603
|
-
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
1604
|
-
options.json = {
|
|
1605
|
-
'batch_no': batchNo,
|
|
1606
|
-
'receiver_ids': receiverIDs,
|
|
1607
|
-
'tags': tags,
|
|
1608
|
-
'with_feedback': withFeedback,
|
|
1609
|
-
'offset': offset,
|
|
1610
|
-
'limit': limit,
|
|
1611
|
-
};
|
|
1612
|
-
return await openapi.doRequest(null, urlPath, options);
|
|
1613
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export interface _ReceiverInfo {
|
|
2
|
-
receiver_id: string;
|
|
3
|
-
receiver_id_type?: string;
|
|
4
|
-
tags?: Map<string, string>;
|
|
5
|
-
variables?: _Variable[];
|
|
6
|
-
extra?: Map<string, string>;
|
|
7
|
-
}
|
|
8
|
-
export interface _Variable {
|
|
9
|
-
key: string;
|
|
10
|
-
value?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* 推送中心类
|
|
14
|
-
*/
|
|
15
|
-
export declare class PushCenter {
|
|
16
|
-
/**
|
|
17
|
-
* 批量发布消息
|
|
18
|
-
* @param receiverInfos 接收者信息
|
|
19
|
-
* @param channelIDs 管道ID
|
|
20
|
-
* @param template 模版
|
|
21
|
-
* @param msgType 消息类型
|
|
22
|
-
* @param batchNo 批量编号
|
|
23
|
-
* @param senderID 发送者ID
|
|
24
|
-
* @param senderIDType 发送者ID类型
|
|
25
|
-
* @param subBatchNo 批量子编号
|
|
26
|
-
* @param tags 标签信息
|
|
27
|
-
* @param extra 扩展信息
|
|
28
|
-
*/
|
|
29
|
-
sendMessageBatch(receiverInfos: _ReceiverInfo[], channelIDs: string[], template: string, msgType: string, batchNo: string, senderID: string, senderIDType: string, subBatchNo?: string, tags?: Map<string, string>, extra?: Map<string, string>): Promise<any>;
|
|
30
|
-
/**
|
|
31
|
-
* 批量获取消息状态
|
|
32
|
-
* @param batchNo 批量编号
|
|
33
|
-
* @param tags 标签列表
|
|
34
|
-
*/
|
|
35
|
-
getMessageBatchStatus(batchNo: string, tags?: Map<string, string>): Promise<any>;
|
|
36
|
-
/**
|
|
37
|
-
* 获取消息状态
|
|
38
|
-
* @param batchNo 批量编号
|
|
39
|
-
* @param receiverIDs 接收者ID列表
|
|
40
|
-
* @param tags 标签列表
|
|
41
|
-
* @param withFeedback 是否获取已读反馈
|
|
42
|
-
* @param offset 是否获取已读反馈
|
|
43
|
-
* @param limit 是否获取已读反馈
|
|
44
|
-
*/
|
|
45
|
-
getMessageStatus(batchNo: string, receiverIDs?: string[], tags?: Map<string, string>, withFeedback?: boolean, offset?: number, limit?: number): Promise<any>;
|
|
46
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
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.PushCenter = void 0;
|
|
6
|
-
const Request = require("../../request/interface");
|
|
7
|
-
/**
|
|
8
|
-
* 推送中心类
|
|
9
|
-
*/
|
|
10
|
-
class PushCenter {
|
|
11
|
-
/**
|
|
12
|
-
* 批量发布消息
|
|
13
|
-
* @param receiverInfos 接收者信息
|
|
14
|
-
* @param channelIDs 管道ID
|
|
15
|
-
* @param template 模版
|
|
16
|
-
* @param msgType 消息类型
|
|
17
|
-
* @param batchNo 批量编号
|
|
18
|
-
* @param senderID 发送者ID
|
|
19
|
-
* @param senderIDType 发送者ID类型
|
|
20
|
-
* @param subBatchNo 批量子编号
|
|
21
|
-
* @param tags 标签信息
|
|
22
|
-
* @param extra 扩展信息
|
|
23
|
-
*/
|
|
24
|
-
async sendMessageBatch(receiverInfos, channelIDs, template, msgType, batchNo, senderID, senderIDType, subBatchNo, tags, extra) {
|
|
25
|
-
return await Request.GetInstance().sendMessageBatch(receiverInfos, channelIDs, template, msgType, batchNo, senderID, senderIDType, subBatchNo, tags, extra);
|
|
26
|
-
}
|
|
27
|
-
;
|
|
28
|
-
/**
|
|
29
|
-
* 批量获取消息状态
|
|
30
|
-
* @param batchNo 批量编号
|
|
31
|
-
* @param tags 标签列表
|
|
32
|
-
*/
|
|
33
|
-
async getMessageBatchStatus(batchNo, tags) {
|
|
34
|
-
return await Request.GetInstance().getMessageBatchStatus(batchNo, tags);
|
|
35
|
-
}
|
|
36
|
-
;
|
|
37
|
-
/**
|
|
38
|
-
* 获取消息状态
|
|
39
|
-
* @param batchNo 批量编号
|
|
40
|
-
* @param receiverIDs 接收者ID列表
|
|
41
|
-
* @param tags 标签列表
|
|
42
|
-
* @param withFeedback 是否获取已读反馈
|
|
43
|
-
* @param offset 是否获取已读反馈
|
|
44
|
-
* @param limit 是否获取已读反馈
|
|
45
|
-
*/
|
|
46
|
-
async getMessageStatus(batchNo, receiverIDs, tags, withFeedback, offset, limit) {
|
|
47
|
-
return await Request.GetInstance().getMessageStatus(batchNo, receiverIDs, tags, withFeedback, offset, limit);
|
|
48
|
-
}
|
|
49
|
-
;
|
|
50
|
-
}
|
|
51
|
-
exports.PushCenter = PushCenter;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface _Task {
|
|
2
|
-
task_id?: string;
|
|
3
|
-
apaas_record?: _APaaSRecord;
|
|
4
|
-
}
|
|
5
|
-
export interface _APaaSRecord {
|
|
6
|
-
object_id?: string;
|
|
7
|
-
object_api_name?: string;
|
|
8
|
-
record_id?: string;
|
|
9
|
-
record_data?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 任务中心类
|
|
13
|
-
*/
|
|
14
|
-
export declare class TaskCenter {
|
|
15
|
-
/**
|
|
16
|
-
* 推送任务
|
|
17
|
-
* @param tasks 任务
|
|
18
|
-
* @param cacheDuration 缓存时长
|
|
19
|
-
*/
|
|
20
|
-
syncTasks(tasks?: _Task[], cacheDuration?: number): Promise<any>;
|
|
21
|
-
/**
|
|
22
|
-
* 查询任务详情(从缓存)
|
|
23
|
-
* @param task 任务
|
|
24
|
-
*/
|
|
25
|
-
getTaskDetail(task?: _Task): Promise<any>;
|
|
26
|
-
/**
|
|
27
|
-
* 刷新任务详情缓存
|
|
28
|
-
* @param tasks 任务
|
|
29
|
-
* @param cacheDuration 缓存时长
|
|
30
|
-
*/
|
|
31
|
-
refreshTasksCache(tasks?: _Task[], cacheDuration?: number): Promise<any>;
|
|
32
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
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.TaskCenter = void 0;
|
|
6
|
-
const Request = require("../../request/interface");
|
|
7
|
-
/**
|
|
8
|
-
* 任务中心类
|
|
9
|
-
*/
|
|
10
|
-
class TaskCenter {
|
|
11
|
-
/**
|
|
12
|
-
* 推送任务
|
|
13
|
-
* @param tasks 任务
|
|
14
|
-
* @param cacheDuration 缓存时长
|
|
15
|
-
*/
|
|
16
|
-
async syncTasks(tasks, cacheDuration) {
|
|
17
|
-
return await Request.GetInstance().syncTasks(tasks, cacheDuration);
|
|
18
|
-
}
|
|
19
|
-
;
|
|
20
|
-
/**
|
|
21
|
-
* 查询任务详情(从缓存)
|
|
22
|
-
* @param task 任务
|
|
23
|
-
*/
|
|
24
|
-
async getTaskDetail(task) {
|
|
25
|
-
return await Request.GetInstance().getTaskDetail(task);
|
|
26
|
-
}
|
|
27
|
-
;
|
|
28
|
-
/**
|
|
29
|
-
* 刷新任务详情缓存
|
|
30
|
-
* @param tasks 任务
|
|
31
|
-
* @param cacheDuration 缓存时长
|
|
32
|
-
*/
|
|
33
|
-
async refreshTasksCache(tasks, cacheDuration) {
|
|
34
|
-
return await Request.GetInstance().refreshTasksCache(tasks, cacheDuration);
|
|
35
|
-
}
|
|
36
|
-
;
|
|
37
|
-
}
|
|
38
|
-
exports.TaskCenter = TaskCenter;
|