@byted-apaas/server-sdk-node 1.1.15-beta.9 → 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.
@@ -571,7 +571,6 @@ class _KQuery {
571
571
  }
572
572
  else {
573
573
  let criterion = (0, logic_1.buildCriterion)(queryBuilder.getLogic(), apiName, maxId);
574
- // utils.printInfoLog(`walkRecordsByLimitOffset start, criterion: ${JSON.stringify(criterion)}, logID: ${utils.getLogID()}`);
575
574
  rs = await Request.GetInstance().getRecordsOrCountByCriterion(apiName, await (0, logic_1.handleCriterion)(criterion), queryBuilder.fuzzySearch, orders, false, selectFields, i, newLimit, false, this.authType);
576
575
  }
577
576
  queryCount += rs.length;
@@ -581,7 +580,6 @@ class _KQuery {
581
580
  }
582
581
  }
583
582
  catch (err) {
584
- // utils.printInfoLog(`walkRecordsByLimitOffset err, rs: ${JSON.stringify(rs)}, err: ${JSON.stringify(err)}, logID: ${utils.getLogID()}`);
585
583
  throw err;
586
584
  }
587
585
  if (rs.length < queryBuilder_1.defaultLimit) {
@@ -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();
@@ -63,8 +63,6 @@ function buildCriterion(logic, objectApiName, maxId = -1) {
63
63
  let index = 0;
64
64
  let logics = [];
65
65
  let expressions = [];
66
- server_common_node_1.utils.printErrorLog(`buildCriterion_l, logic: ${logic}`);
67
- console.log('buildCriterion_log', 0, logic, logic.expressions);
68
66
  // check type of logic
69
67
  function f(logic, value = 'and') {
70
68
  // 1.如果是逻辑表达式
@@ -86,10 +84,8 @@ function buildCriterion(logic, objectApiName, maxId = -1) {
86
84
  // 2.否则是算法表达式
87
85
  let exps = logic;
88
86
  let logs = [];
89
- console.log('buildCriterion_log', 111, exps);
90
87
  for (let left of Object.keys(exps)) {
91
88
  let right = logic[left];
92
- console.log('buildCriterion_log', 222, JSON.stringify(right), right instanceof Condition);
93
89
  let copy = right;
94
90
  if (server_common_node_1.utils.isObject(right) && !(right instanceof Condition) && !isKunlunTypeOrSerializedObject(right)) {
95
91
  for (let leftInner of Object.keys(right)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.1.15-beta.9",
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",
@@ -318,7 +318,6 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, fuzzySearc
318
318
  if (authType) {
319
319
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
320
320
  }
321
- // utils.printInfoLog(`getRecordsOrCountByCriterion start, options: ${options}, urlPath: ${urlPath}, logID: ${utils.getLogID()}`);
322
321
  let data = await openapi.doRequest(null, urlPath, options);
323
322
  return handleResponse(objectApiName, data, needCount);
324
323
  }