@byted-apaas/server-sdk-node 1.1.15-beta.16 → 1.1.15-beta.18

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
- console.log('walkRecordsByLimitOffset_start', JSON.stringify(criterion), server_common_node_1.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
- console.log('walkRecordsByLimitOffset_err', err, server_common_node_1.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
  * 获取流程实例人工任务详情列表
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
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();
@@ -35,9 +35,7 @@ class Condition {
35
35
  right = new expression_1.ConstantExpressionField(this.right);
36
36
  op = this.op;
37
37
  }
38
- let newExpression = new expression_1.Expression(left, op, right, index);
39
- console.log('Condition_toExpression', objectApiName, fieldApiName, index, JSON.stringify(newExpression), server_common_node_1.utils.getLogID());
40
- return newExpression;
38
+ return new expression_1.Expression(left, op, right, index);
41
39
  }
42
40
  constructor(left, right, op = operator_1.operates.EQ) {
43
41
  this.left = left;
@@ -65,7 +63,6 @@ function buildCriterion(logic, objectApiName, maxId = -1) {
65
63
  let index = 0;
66
64
  let logics = [];
67
65
  let expressions = [];
68
- console.log('buildCriterion_log', 0, logic, logic.expressions, server_common_node_1.utils.getLogID());
69
66
  // check type of logic
70
67
  function f(logic, value = 'and') {
71
68
  // 1.如果是逻辑表达式
@@ -87,10 +84,8 @@ function buildCriterion(logic, objectApiName, maxId = -1) {
87
84
  // 2.否则是算法表达式
88
85
  let exps = logic;
89
86
  let logs = [];
90
- console.log('buildCriterion_log', 111, exps, server_common_node_1.utils.getLogID());
91
87
  for (let left of Object.keys(exps)) {
92
88
  let right = logic[left];
93
- console.log('buildCriterion_log', 222, JSON.stringify(right), right instanceof Condition, server_common_node_1.utils.getLogID());
94
89
  let copy = right;
95
90
  if (server_common_node_1.utils.isObject(right) && !(right instanceof Condition) && !isKunlunTypeOrSerializedObject(right)) {
96
91
  for (let leftInner of Object.keys(right)) {
@@ -350,7 +345,6 @@ async function handleCriterion(criterion) {
350
345
  if (!criterion || !criterion.conditions || !(criterion.conditions instanceof Array)) {
351
346
  return criterion;
352
347
  }
353
- console.log('handleCriterion_in', JSON.stringify(criterion), server_common_node_1.utils.getLogID());
354
348
  let fieldRes = await handleLookupCondition(criterion.conditions);
355
349
  for (let condition of criterion.conditions) {
356
350
  if (fieldRes && fieldRes.lookupMap) {
@@ -361,7 +355,6 @@ async function handleCriterion(criterion) {
361
355
  }
362
356
  await handleCondition(condition, fieldRes);
363
357
  }
364
- console.log('handleCriterion_out', JSON.stringify(criterion), server_common_node_1.utils.getLogID());
365
358
  return JSON.stringify(criterion);
366
359
  }
367
360
  exports.handleCriterion = handleCriterion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.1.15-beta.16",
3
+ "version": "1.1.15-beta.18",
4
4
  "description": "aPaaS Server SDK",
5
5
  "author": "zhouwexin <zhouwexin@bytedance.com>",
6
6
  "homepage": "",
@@ -10,10 +10,11 @@
10
10
  "compile": "tsc -d",
11
11
  "compile.local": "tsc -d --sourceMap",
12
12
  "pre-build": "rm -rf build && tsc",
13
- "clean": "tsc --build --clean && rm -rf **/*.js.map"
13
+ "clean": "tsc --build --clean && rm -rf **/*.js.map",
14
+ "test": "mocha --require ts-node 'test/**/*.ts'"
14
15
  },
15
16
  "dependencies": {
16
- "@byted-apaas/server-common-node": "^2.0.4",
17
+ "@byted-apaas/server-common-node": "2.0.4-beta.17",
17
18
  "@jorgeferrero/stream-to-buffer": "^2.0.6",
18
19
  "dayjs": "^1.9.6",
19
20
  "form-data": "^3.0.0",
@@ -29,7 +30,8 @@
29
30
  "madge": "^3.12.0",
30
31
  "mocha": "^9.1.3",
31
32
  "node-cls": "^1.0.7",
32
- "sinon": "^17.0.1"
33
+ "sinon": "^17.0.1",
34
+ "ts-node": "^10.9.2"
33
35
  },
34
36
  "mocha": {
35
37
  "color": true,