@byted-apaas/server-sdk-node 1.1.15 → 1.1.16

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.
@@ -1,5 +1,5 @@
1
1
  import { IApprovalInstance, IApprovalInstanceListOptions, IApprovalInstanceList, IGetApprovalInstanceOptions } from '../../../request/structs';
2
- export declare function NewFlow(): Flow;
2
+ export declare function newFlow(context: any): Flow;
3
3
  export interface Flow {
4
4
  /**
5
5
  * 获取流程实例人工任务详情列表
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NewFlow = void 0;
3
+ exports.newFlow = void 0;
4
4
  const flow_1 = require("./impl/flow");
5
- function NewFlow() {
6
- return new flow_1.Flow();
5
+ function newFlow(context) {
6
+ return new flow_1.Flow(context?.flow);
7
7
  }
8
- exports.NewFlow = NewFlow;
8
+ exports.newFlow = newFlow;
@@ -1,6 +1,16 @@
1
- import { Flow as IFlow, ExecuteOptions, ExecutionResult, ExecutionInfo, FlowTaskInfo, RevokeExecutionOptions } from '../flow';
1
+ import { Flow as IFlow, ExecuteOptions, ExecutionResult, ExecutionInfo, FlowTaskInfo, RevokeExecutionOptions, Execution } from '../flow';
2
2
  import { IApprovalInstance, IApprovalInstanceList, IApprovalInstanceListOptions, IGetApprovalInstanceOptions } from "../../../../request/structs";
3
3
  export declare class Flow implements IFlow {
4
+ execution: Execution;
5
+ /**
6
+ * 工作流的 API name
7
+ */
8
+ apiName: string;
9
+ /**
10
+ * 工作流实例的 ID
11
+ */
12
+ instanceId: number;
13
+ constructor(flowParams: any);
4
14
  execute(APIName: string, options: ExecuteOptions | undefined): Promise<ExecutionResult>;
5
15
  getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
6
16
  getExecutionUserTaskInfo(executionId: number): Promise<FlowTaskInfo[]>;
@@ -5,6 +5,11 @@ const exceptions_1 = require("@byted-apaas/server-common-node/utils/exceptions")
5
5
  const Request = require("../../../../request/interface");
6
6
  const server_common_node_1 = require("@byted-apaas/server-common-node");
7
7
  class Flow {
8
+ constructor(flowParams) {
9
+ this.execution = flowParams?.execution;
10
+ this.apiName = flowParams?.apiName;
11
+ this.instanceId = flowParams?.instanceId;
12
+ }
8
13
  async execute(APIName, options) {
9
14
  if (!APIName || typeof APIName !== 'string') {
10
15
  throw new exceptions_1.InvalidParamError(`param's type (${APIName}) need string, but is ${typeof APIName}`);
package/hooks/hooks.js CHANGED
@@ -95,7 +95,7 @@ function mountApplication(context) {
95
95
  }
96
96
  global.application.constants.metaType = metadataApi.metaType();
97
97
  // flow
98
- global.application.flow = (0, flow_1.NewFlow)();
98
+ global.application.flow = (0, flow_1.newFlow)(context);
99
99
  // operator
100
100
  global.application.operator = new operator_1.Operator();
101
101
  global.application.integration = new integration_1._Integration();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
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.4",
16
+ "@byted-apaas/server-common-node": "^2.0.5",
17
17
  "@jorgeferrero/stream-to-buffer": "^2.0.6",
18
18
  "dayjs": "^1.9.6",
19
19
  "form-data": "^3.0.0",