@byted-apaas/server-sdk-node 1.1.13-beta.6 → 1.1.13

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,4 +1,4 @@
1
- import { BaseFieldType, CriterionType, FieldType, FilterType, RegionFilterType, SortConditionType, SubOptionType } from '../types/objects';
1
+ import { BaseFieldType, FieldType, FilterType, SortConditionType, SubOptionType } from '../types/objects';
2
2
  import { I18ns } from '../types/common';
3
3
  declare class MetadataField {
4
4
  type: string;
@@ -36,18 +36,6 @@ declare class Number extends MetadataField {
36
36
  decimalPlacesNumber: number;
37
37
  constructor(field: FieldType);
38
38
  }
39
- declare class Bigint extends MetadataField {
40
- required: boolean;
41
- unique: boolean;
42
- constructor(field: FieldType);
43
- }
44
- declare class Decimal extends MetadataField {
45
- required: boolean;
46
- unique: boolean;
47
- displayAsPercentage: boolean;
48
- decimalPlacesNumber: number;
49
- constructor(field: FieldType);
50
- }
51
39
  declare class KDate extends MetadataField {
52
40
  required: boolean;
53
41
  constructor(field: FieldType);
@@ -112,22 +100,6 @@ declare class ReferenceField extends MetadataField {
112
100
  fieldApiName: string;
113
101
  constructor(field: FieldType);
114
102
  }
115
- declare class Rollup extends MetadataField {
116
- rollupType: string;
117
- rollupObjectApiName: string;
118
- rollupFieldApiName: string;
119
- rollupLookupFieldApiName: string;
120
- filter: CriterionType;
121
- constructor(field: FieldType);
122
- }
123
- declare class Region extends MetadataField {
124
- required: boolean;
125
- multiple: boolean;
126
- optionLevel: boolean;
127
- strictLevel: number;
128
- filter: RegionFilterType[];
129
- constructor(field: FieldType);
130
- }
131
103
  declare class File extends MetadataField {
132
104
  required: boolean;
133
105
  multiple: boolean;
@@ -155,4 +127,4 @@ declare class ExtractSingleRecord extends MetadataField {
155
127
  declare function parseFields(inputFields: Record<string, any>): BaseFieldType[];
156
128
  declare function parseField(field: FieldType): BaseFieldType;
157
129
  declare function getFieldClass(field: FieldType): any;
158
- export { KText as Text, Multilingual, Number, KDate as Date, DateTime, Option, Email, MobileNumber, Boolean, AvatarOrLogo, Lookup, Formula, AutoID, ReferenceField, File, BackLookup, CompositeType, ExtractSingleRecord, RichText, Bigint, Decimal, Region, Rollup, parseFields, parseField, getFieldClass, };
130
+ export { KText as Text, Multilingual, Number, KDate as Date, DateTime, Option, Email, MobileNumber, Boolean, AvatarOrLogo, Lookup, Formula, AutoID, ReferenceField, File, BackLookup, CompositeType, ExtractSingleRecord, RichText, parseFields, parseField, getFieldClass, };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2022 ByteDance Ltd. and/or its affiliates
3
3
  // SPDX-License-Identifier: MIT
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getFieldClass = exports.parseField = exports.parseFields = exports.Rollup = exports.Region = exports.Decimal = exports.Bigint = exports.RichText = exports.ExtractSingleRecord = exports.CompositeType = exports.BackLookup = exports.File = exports.ReferenceField = exports.AutoID = exports.Formula = exports.Lookup = exports.AvatarOrLogo = exports.Boolean = exports.MobileNumber = exports.Email = exports.Option = exports.DateTime = exports.Date = exports.Number = exports.Multilingual = exports.Text = void 0;
5
+ exports.getFieldClass = exports.parseField = exports.parseFields = exports.RichText = exports.ExtractSingleRecord = exports.CompositeType = exports.BackLookup = exports.File = exports.ReferenceField = exports.AutoID = exports.Formula = exports.Lookup = exports.AvatarOrLogo = exports.Boolean = exports.MobileNumber = exports.Email = exports.Option = exports.DateTime = exports.Date = exports.Number = exports.Multilingual = exports.Text = void 0;
6
6
  const fieldsUtil = require("./fields.util");
7
7
  class MetadataField {
8
8
  constructor(type, field) {
@@ -65,30 +65,6 @@ class Number extends MetadataField {
65
65
  }
66
66
  }
67
67
  exports.Number = Number;
68
- class Bigint extends MetadataField {
69
- constructor(field) {
70
- if (!field) {
71
- return;
72
- }
73
- super('bigint', field);
74
- this.required = field.required;
75
- this.unique = fieldsUtil.getUnique(field);
76
- }
77
- }
78
- exports.Bigint = Bigint;
79
- class Decimal extends MetadataField {
80
- constructor(field) {
81
- if (!field) {
82
- return;
83
- }
84
- super('decimal', field);
85
- this.required = field.required;
86
- this.unique = fieldsUtil.getUnique(field);
87
- this.displayAsPercentage = fieldsUtil.getDisplayAsPercentage(field);
88
- this.decimalPlacesNumber = fieldsUtil.getDecimalPlaces(field);
89
- }
90
- }
91
- exports.Decimal = Decimal;
92
68
  class KDate extends MetadataField {
93
69
  constructor(field) {
94
70
  if (!field) {
@@ -222,34 +198,6 @@ class ReferenceField extends MetadataField {
222
198
  }
223
199
  }
224
200
  exports.ReferenceField = ReferenceField;
225
- class Rollup extends MetadataField {
226
- constructor(field) {
227
- if (!field) {
228
- return;
229
- }
230
- super('rollup', field);
231
- this.rollupType = fieldsUtil.getRollupType(field);
232
- this.rollupObjectApiName = fieldsUtil.getRollupObjectApiName(field);
233
- this.rollupFieldApiName = fieldsUtil.getRollupFieldApiName(field);
234
- this.rollupLookupFieldApiName = fieldsUtil.getRollupLookupFieldApiName(field);
235
- this.filter = fieldsUtil.getRollupFilter(field);
236
- }
237
- }
238
- exports.Rollup = Rollup;
239
- class Region extends MetadataField {
240
- constructor(field) {
241
- if (!field) {
242
- return;
243
- }
244
- super('region', field);
245
- this.required = field.required;
246
- this.multiple = fieldsUtil.getSettingsMultiple(field);
247
- this.optionLevel = fieldsUtil.getRegionOptionLevel(field);
248
- this.strictLevel = fieldsUtil.getRegionStrictLeve(field);
249
- this.filter = fieldsUtil.getRegionSettingsFilter(field);
250
- }
251
- }
252
- exports.Region = Region;
253
201
  class File extends MetadataField {
254
202
  constructor(field) {
255
203
  if (!field) {
@@ -362,8 +310,25 @@ const type2fieldType = {
362
310
  'attachment': File,
363
311
  'back_lookup': BackLookup,
364
312
  'richText': RichText,
365
- 'bigint': Bigint,
366
- 'decimal': Decimal,
367
- 'rollup': Rollup,
368
- 'region': Region,
313
+ };
314
+ const fieldTypeMap = {
315
+ 'text': 'text',
316
+ 'multilingual': 'multilingual',
317
+ 'number': 'float',
318
+ 'date': 'date',
319
+ 'dateTime': 'datetime',
320
+ 'option': 'enum',
321
+ 'email': 'email',
322
+ 'mobileNumber': 'phone',
323
+ 'boolean': 'boolean',
324
+ 'avatarOrLogo': 'avatar',
325
+ 'lookup': 'lookup',
326
+ 'formula': 'formula',
327
+ 'autoId': 'auto_number',
328
+ 'referenceField': 'reference_field',
329
+ 'file': 'attachment',
330
+ 'backLookup': 'back_lookup',
331
+ 'compositeType': 'compositeType',
332
+ 'extractSingleRecord': 'compositeType',
333
+ 'richText': 'richText',
369
334
  };
@@ -1,4 +1,4 @@
1
- import { CriterionType, FieldType, FilterType, RegionFilterType, SortConditionType, SubOptionType } from '../types/objects';
1
+ import { FieldType, FilterType, SortConditionType, SubOptionType } from '../types/objects';
2
2
  import { I18ns } from '../types/common';
3
3
  declare function getUnique(field: FieldType): boolean;
4
4
  declare function getCaseSensitive(field: FieldType): boolean;
@@ -35,14 +35,6 @@ declare function getSettingsMultiple(field: FieldType): boolean;
35
35
  declare function getCompositeTypeApiName(field: FieldType): string;
36
36
  declare function getCompositeTypeSubFields(field: FieldType): object[];
37
37
  declare function getSettingsFilter(field: FieldType): FilterType[];
38
- export declare function getRegionSettingsFilter(field: FieldType): RegionFilterType[];
39
38
  declare function getSettingsSort(field: FieldType): SortConditionType[];
40
39
  declare function getRecordPosition(field: FieldType): number;
41
- export declare function getRollupType(field: FieldType): string;
42
- export declare function getRollupObjectApiName(field: FieldType): string;
43
- export declare function getRollupFieldApiName(field: FieldType): string;
44
- export declare function getRollupLookupFieldApiName(field: FieldType): string;
45
- export declare function getRegionOptionLevel(field: FieldType): boolean;
46
- export declare function getRegionStrictLeve(field: FieldType): number;
47
- export declare function getRollupFilter(field: FieldType): CriterionType;
48
40
  export { getUnique, getCaseSensitive, getMultiline, getMaxLength, getRegexpExpression, getRegexpErrMsg, getDisplayAsPercentage, getDecimalPlaces, getMultiple, getOptionSource, getGlobalOptionApiName, getOptionList, getDescriptionWhenTrue, getDescriptionWhenFalse, getDefaultValue, getDisplayStyle, getLookupRefObjectApiName, getLookupIsHierarchy, getLookupDisplayStyle, getReturnType, getFormula, getGenerateMethod, getDigitsNumber, getPrefix, getSuffix, getReferenceObjectApiName, getReferenceFieldApiName, getFileMultiple, getFileTypes, getBackLookupObjectApiName, getBackLookupFieldApiName, getSettingsMultiple, getCompositeTypeApiName, getCompositeTypeSubFields, getSettingsFilter, getSettingsSort, getRecordPosition, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRecordPosition = exports.getSettingsSort = exports.getSettingsFilter = exports.getCompositeTypeSubFields = exports.getCompositeTypeApiName = exports.getSettingsMultiple = exports.getBackLookupFieldApiName = exports.getBackLookupObjectApiName = exports.getFileTypes = exports.getFileMultiple = exports.getReferenceFieldApiName = exports.getReferenceObjectApiName = exports.getSuffix = exports.getPrefix = exports.getDigitsNumber = exports.getGenerateMethod = exports.getFormula = exports.getReturnType = exports.getLookupDisplayStyle = exports.getLookupIsHierarchy = exports.getLookupRefObjectApiName = exports.getDisplayStyle = exports.getDefaultValue = exports.getDescriptionWhenFalse = exports.getDescriptionWhenTrue = exports.getOptionList = exports.getGlobalOptionApiName = exports.getOptionSource = exports.getMultiple = exports.getDecimalPlaces = exports.getDisplayAsPercentage = exports.getRegexpErrMsg = exports.getRegexpExpression = exports.getMaxLength = exports.getMultiline = exports.getCaseSensitive = exports.getUnique = exports.getRollupFilter = exports.getRegionStrictLeve = exports.getRegionOptionLevel = exports.getRollupLookupFieldApiName = exports.getRollupFieldApiName = exports.getRollupObjectApiName = exports.getRollupType = exports.getRegionSettingsFilter = void 0;
3
+ exports.getRecordPosition = exports.getSettingsSort = exports.getSettingsFilter = exports.getCompositeTypeSubFields = exports.getCompositeTypeApiName = exports.getSettingsMultiple = exports.getBackLookupFieldApiName = exports.getBackLookupObjectApiName = exports.getFileTypes = exports.getFileMultiple = exports.getReferenceFieldApiName = exports.getReferenceObjectApiName = exports.getSuffix = exports.getPrefix = exports.getDigitsNumber = exports.getGenerateMethod = exports.getFormula = exports.getReturnType = exports.getLookupDisplayStyle = exports.getLookupIsHierarchy = exports.getLookupRefObjectApiName = exports.getDisplayStyle = exports.getDefaultValue = exports.getDescriptionWhenFalse = exports.getDescriptionWhenTrue = exports.getOptionList = exports.getGlobalOptionApiName = exports.getOptionSource = exports.getMultiple = exports.getDecimalPlaces = exports.getDisplayAsPercentage = exports.getRegexpErrMsg = exports.getRegexpExpression = exports.getMaxLength = exports.getMultiline = exports.getCaseSensitive = exports.getUnique = void 0;
4
4
  const common = require("@byted-apaas/server-common-node");
5
5
  const common_1 = require("../types/common");
6
6
  const commonConstants = common.constants;
@@ -283,13 +283,6 @@ function getSettingsFilter(field) {
283
283
  return [];
284
284
  }
285
285
  exports.getSettingsFilter = getSettingsFilter;
286
- function getRegionSettingsFilter(field) {
287
- if (field && field.type && field.type.settings && !(0, common_1.isNullOrUndefined)(field.type.settings.filter)) {
288
- return field.type.settings.filter;
289
- }
290
- return [];
291
- }
292
- exports.getRegionSettingsFilter = getRegionSettingsFilter;
293
286
  // TODO 结构转换
294
287
  function getSettingsSort(field) {
295
288
  let res = [];
@@ -324,55 +317,3 @@ function getRecordPosition(field) {
324
317
  return pos;
325
318
  }
326
319
  exports.getRecordPosition = getRecordPosition;
327
- function getRollupType(field) {
328
- if (field && field.type && field.type.settings && field.type.settings.rollup_function_type) {
329
- return field.type.settings.rollup_function_type;
330
- }
331
- return "";
332
- }
333
- exports.getRollupType = getRollupType;
334
- function getRollupObjectApiName(field) {
335
- if (field && field.type && field.type.settings && field.type.settings.rolluped_object && field.type.settings.rolluped_object.api_alias) {
336
- return field.type.settings.rolluped_object.api_alias;
337
- }
338
- return "";
339
- }
340
- exports.getRollupObjectApiName = getRollupObjectApiName;
341
- function getRollupFieldApiName(field) {
342
- if (field && field.type && field.type.settings && field.type.settings.rolluped_field && field.type.settings.rolluped_field.api_alias) {
343
- return field.type.settings.rolluped_field.api_alias;
344
- }
345
- return "";
346
- }
347
- exports.getRollupFieldApiName = getRollupFieldApiName;
348
- function getRollupLookupFieldApiName(field) {
349
- if (field && field.type && field.type.settings && field.type.settings.rolluped_lookup_field && field.type.settings.rolluped_lookup_field.api_alias) {
350
- return field.type.settings.rolluped_lookup_field.api_alias;
351
- }
352
- return "";
353
- }
354
- exports.getRollupLookupFieldApiName = getRollupLookupFieldApiName;
355
- function getRegionOptionLevel(field) {
356
- if (field && field.type && field.type.settings && field.type.settings.hasLevelStrict) {
357
- return field.type.settings.hasLevelStrict;
358
- }
359
- return undefined;
360
- }
361
- exports.getRegionOptionLevel = getRegionOptionLevel;
362
- function getRegionStrictLeve(field) {
363
- if (field && field.type && field.type.settings && field.type.settings.strictLevel) {
364
- return field.type.settings.strictLevel;
365
- }
366
- return undefined;
367
- }
368
- exports.getRegionStrictLeve = getRegionStrictLeve;
369
- function getRollupFilter(field) {
370
- if (field && field.type && field.type.settings && field.type.settings.rollup_range_filter) {
371
- return {
372
- conditions: field.type.settings.rollup_range_filter.conditions,
373
- logic: field.type.settings.rollup_range_filter.logic
374
- };
375
- }
376
- return undefined;
377
- }
378
- exports.getRollupFilter = getRollupFilter;
@@ -79,7 +79,7 @@ type ConditionType = {
79
79
  valueType: ('reference' | 'specified');
80
80
  right: (object | string);
81
81
  };
82
- export type CriterionType = {
82
+ type CriterionType = {
83
83
  conditions: ConditionType[];
84
84
  logic: string;
85
85
  };
@@ -90,13 +90,6 @@ export type FilterType = {
90
90
  criterion: CriterionType;
91
91
  errorMsg: I18ns;
92
92
  };
93
- export type RegionFilterType = {
94
- id: string;
95
- label: string;
96
- errorMessage: I18ns;
97
- recordFilter: CriterionType;
98
- precondition: object;
99
- };
100
93
  export interface Lookup extends BaseFieldType {
101
94
  required: boolean;
102
95
  multiple: boolean;
@@ -220,19 +213,6 @@ export type FieldType = {
220
213
  'type': string;
221
214
  };
222
215
  'is_extract': boolean;
223
- 'rollup_function_type': string;
224
- 'rolluped_object': {
225
- 'api_alias': string;
226
- };
227
- 'rolluped_field': {
228
- 'api_alias': string;
229
- };
230
- 'rolluped_lookup_field': {
231
- 'api_alias': string;
232
- };
233
- 'rollup_range_filter': CriterionType;
234
- 'hasLevelStrict': boolean;
235
- 'strictLevel': number;
236
216
  };
237
217
  };
238
218
  'unique_type': number;
@@ -1,5 +1,3 @@
1
- import { IApprovalInstance, IApprovalInstanceListOptions, IApprovalInstanceList, IGetApprovalInstanceOptions } from '../../../request/structs';
2
- export declare function NewFlow(): Flow;
3
1
  export interface Flow {
4
2
  /**
5
3
  * 获取流程实例人工任务详情列表
@@ -27,17 +25,6 @@ export interface Flow {
27
25
  * @constructor
28
26
  */
29
27
  getExecutionInfo: (executionId: number) => Promise<ExecutionInfo>;
30
- /**
31
- * 获取审批实例列表
32
- * @param options 请求参数,可选
33
- */
34
- getApprovalInstanceList: (options?: IApprovalInstanceListOptions) => Promise<IApprovalInstanceList>;
35
- /**
36
- * 获取审批实例详情
37
- * @param approvalInstanceId 实例ID
38
- * @param option 请求参数,可选
39
- */
40
- getApprovalInstance: (options: IGetApprovalInstanceOptions) => Promise<IApprovalInstance>;
41
28
  }
42
29
  export interface Execution {
43
30
  /**
@@ -1,8 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NewFlow = void 0;
4
- const flow_1 = require("./impl/flow");
5
- function NewFlow() {
6
- return new flow_1.Flow();
7
- }
8
- exports.NewFlow = NewFlow;
package/hooks/hooks.js CHANGED
@@ -10,7 +10,6 @@ const db_1 = require("../context/db/impl/db");
10
10
  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
- const flow_1 = require("../global/application/flow/flow");
14
13
  /**
15
14
  * 根据 key 获取对应的全局变量
16
15
  * @param key 全局变量的 key
@@ -95,7 +94,12 @@ function mountApplication(context) {
95
94
  }
96
95
  global.application.constants.metaType = metadataApi.metaType();
97
96
  // flow
98
- global.application.flow = (0, flow_1.NewFlow)();
97
+ global.application.flow = ({
98
+ getExecutionUserTaskInfo: api.mockGetExecutionUserTaskInfo(),
99
+ execute: api.mockExecuteFlow(),
100
+ revokeExecution: api.mockRevokeExecution(),
101
+ getExecutionInfo: api.mockGetExecutionInfo(),
102
+ });
99
103
  // operator
100
104
  global.application.operator = new operator_1.Operator();
101
105
  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.13-beta.6",
3
+ "version": "1.1.13",
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.1-beta.4",
16
+ "@byted-apaas/server-common-node": "^2.0.1",
17
17
  "@jorgeferrero/stream-to-buffer": "^2.0.6",
18
18
  "dayjs": "^1.9.6",
19
19
  "form-data": "^3.0.0",
@@ -24,12 +24,10 @@
24
24
  "@types/google-protobuf": "^3.15.6",
25
25
  "@types/mocha": "^9.0.0",
26
26
  "@types/node-fetch": "^2.6.2",
27
- "@types/sinon": "^17.0.2",
28
27
  "axios": "^0.21.0",
29
28
  "madge": "^3.12.0",
30
29
  "mocha": "^9.1.3",
31
- "node-cls": "^1.0.7",
32
- "sinon": "^17.0.1"
30
+ "node-cls": "^1.0.7"
33
31
  },
34
32
  "mocha": {
35
33
  "color": true,
@@ -41,4 +39,4 @@
41
39
  ],
42
40
  "timeout": 20000
43
41
  }
44
- }
42
+ }
@@ -7,6 +7,4 @@ export declare const openapiHttpPath: {
7
7
  executeFlow: PostHttpConfig;
8
8
  revokeExecution: PostHttpConfig;
9
9
  getExecutionInfo: GetHttpConfig;
10
- getApprovalInstanceList: GetHttpConfig;
11
- getApprovalInstance: GetHttpConfig;
12
10
  };
@@ -13,8 +13,6 @@ exports.metricsMethodKeys = {
13
13
  getExecutionInfo: 'openapi_getExecutionInfo',
14
14
  revokeExecution: 'openapi_revokeExecution',
15
15
  executeFlow: 'openapi_executeFlow',
16
- getApprovalInstanceList: 'openapi_getApprovalInstanceList',
17
- getApprovalInstance: 'openapi_getApprovalInstance',
18
16
  };
19
17
  exports.openapiHttpPath = {
20
18
  getBatchAttachmentToken: new config_1.PostHttpConfig(`/attachment/v1/getBatchAttachmentToken`, exports.metricsMethodKeys.getBatchAttachmentToken),
@@ -24,6 +22,4 @@ exports.openapiHttpPath = {
24
22
  executeFlow: new config_1.PostHttpConfig(`/api/flow/v1/namespaces/${constants_1.replaceKeys.namespace}/flows/${constants_1.replaceKeys.apiName}/execute`, exports.metricsMethodKeys.executeFlow),
25
23
  revokeExecution: new config_1.PostHttpConfig(`/api/flow/v1/namespaces/${constants_1.replaceKeys.namespace}/executions/${constants_1.replaceKeys.id}/revoke`, exports.metricsMethodKeys.revokeExecution),
26
24
  getExecutionInfo: new config_1.GetHttpConfig(`/api/flow/v1/namespaces/${constants_1.replaceKeys.namespace}/executions/${constants_1.replaceKeys.id}/detail`, exports.metricsMethodKeys.getExecutionInfo),
27
- getApprovalInstanceList: new config_1.GetHttpConfig(`/api/approval/v1/approval_instances/listids`, exports.metricsMethodKeys.getApprovalInstanceList),
28
- getApprovalInstance: new config_1.GetHttpConfig(`/api/approval/v1/approval_instances/${constants_1.replaceKeys.id}`, exports.metricsMethodKeys.getApprovalInstance),
29
25
  };
@@ -5,7 +5,6 @@ import { Stream } from 'stream';
5
5
  import { ExecutionInfo, ExecutionResult, RevokeExecutionOptions } from '@byted-apaas/server-common-node/context/workflow/workflow';
6
6
  import { AppCtx } from '../application/application';
7
7
  import { Order } from '../context/db/impl/order';
8
- import { IApprovalInstance, IApprovalInstanceList, IApprovalInstanceListOptions, IGetApprovalInstanceOptions } from "./structs";
9
8
  export declare function GetHttpInstance(): IInnerAPIRequest;
10
9
  export declare function GetInstance(): IInnerAPIRequest;
11
10
  export declare function GetFaaSInfraInstance(): IFaaSInfraRequest;
@@ -86,8 +85,6 @@ export interface IInnerAPIBaseRequest {
86
85
  getIntegrationTenantAccessToken: (apiName: string) => Promise<TenantAccessToken>;
87
86
  getDefaultIntegrationAppAccessToken: () => Promise<AppAccessToken>;
88
87
  getDefaultIntegrationTenantAccessToken: () => Promise<TenantAccessToken>;
89
- getApprovalInstanceList: (options?: IApprovalInstanceListOptions) => Promise<IApprovalInstanceList>;
90
- getApprovalInstance: (options: IGetApprovalInstanceOptions) => Promise<IApprovalInstance>;
91
88
  }
92
89
  export interface IInnerAPIOpenSDKRequest {
93
90
  openSDKCreateRecordBySync: (objectApiName: string, record: object) => any;
@@ -6,7 +6,6 @@ import { Criterion } from '../kunlun/operator/impl/logic';
6
6
  import { IInnerAPIRequest, OpenSDKGetRecordsReq, UploadFileResp } from './interface';
7
7
  import { ExecutionInfo, ExecutionResult, RevokeExecutionOptions } from '@byted-apaas/server-common-node/context/workflow/workflow';
8
8
  import { AppCtx } from '../application/application';
9
- import { IApprovalInstance, IApprovalInstanceListOptions, IApprovalInstanceList, IGetApprovalInstanceOptions } from "./structs";
10
9
  export declare function updateWorkflowVariables(ctx: any, instanceId: number, variables: object, variableTypes: object): Promise<void>;
11
10
  export declare class RequestHttp implements IInnerAPIRequest {
12
11
  constructor();
@@ -68,8 +67,6 @@ export declare class RequestHttp implements IInnerAPIRequest {
68
67
  openSDKUploadFile(fileName: string, data: Buffer): any;
69
68
  openSDKUploadAvatar(fileName: string, data: Buffer): any;
70
69
  openSDKDownloadAvatar(imageID: string): Promise<Buffer>;
71
- getApprovalInstanceList(params?: IApprovalInstanceListOptions): Promise<IApprovalInstanceList>;
72
- getApprovalInstance(params: IGetApprovalInstanceOptions): Promise<IApprovalInstance>;
73
70
  }
74
71
  export declare function getExecutionUserTaskInfo(executionId: bigint): Promise<any>;
75
72
  export declare function executeFlow(APIName: string, option: any): Promise<ExecutionResult>;
@@ -292,9 +292,6 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, fuzzySearc
292
292
  let options = commonHttp.getOptions(null, needCount ? openapiHttpPath.mGetCountByCriterionV2 : openapiHttpPath.mGetRecordByCriterionV2);
293
293
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
294
294
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
295
- if (needCount) {
296
- fieldApiNames = ['_id'];
297
- }
298
295
  // 3.请求
299
296
  options.json = {
300
297
  'criterion': JSON.parse(criterion),
@@ -832,10 +829,10 @@ class RequestHttp {
832
829
  createRecordsBySync(objectApiName, records, authType) {
833
830
  }
834
831
  updateRecordsBySync(objectApiName, recordMap, authType) {
835
- return new Promise(undefined);
832
+ return undefined;
836
833
  }
837
834
  deleteRecordsBySync(objectApiName, recordIDs, authType) {
838
- return new Promise(undefined);
835
+ return undefined;
839
836
  }
840
837
  getRecordsOrCountByCriterion(objectApiName, criterion, order, fuzzySearch, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
841
838
  }
@@ -862,8 +859,8 @@ class RequestHttp {
862
859
  }
863
860
  terminateWorkflowInstance(workflowInstanceId, operator, reason) {
864
861
  }
865
- async modifyRecordsWithTransaction(placeholders, operations, authType) {
866
- return new Promise(undefined);
862
+ modifyRecordsWithTransaction(placeholders, operations, authType) {
863
+ return null;
867
864
  }
868
865
  getGlobalConfigByKey(key) {
869
866
  return null;
@@ -945,95 +942,6 @@ class RequestHttp {
945
942
  return null;
946
943
  }
947
944
  ;
948
- async getApprovalInstanceList(params) {
949
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getApprovalInstanceList);
950
- let urlPath = options._reqPath;
951
- // 设置参数
952
- const searchParams = {};
953
- if (params && params.startTime && params.startTime > 0) {
954
- searchParams.start_time = params.startTime;
955
- }
956
- if (params && params.endTime && params.endTime > 0) {
957
- searchParams.end_time = params.endTime;
958
- }
959
- if (params && params.pageSize && params.pageSize > 0) {
960
- searchParams.page_size = params.pageSize;
961
- }
962
- if (params && params.pageToken) {
963
- searchParams.page_token = params.pageToken;
964
- }
965
- options.searchParams = searchParams;
966
- // 发起请求
967
- let resp = await openapi.doRequest(null, urlPath, options);
968
- // 应答
969
- return {
970
- approvalInstanceIds: resp.approval_instance_ids,
971
- pageToken: resp.page_token,
972
- count: resp.count,
973
- hasMore: resp.has_more,
974
- };
975
- }
976
- async getApprovalInstance(params) {
977
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getApprovalInstance);
978
- let urlPath = options._reqPath.replace(replaceKeys.id, String(params.approvalInstanceId));
979
- // 设置参数
980
- const searchParams = {
981
- includes: "",
982
- };
983
- const includes = [];
984
- if (params && params.includeContent) {
985
- includes.push('ApprovalComment_Content');
986
- }
987
- if (params && params.includeFormData) {
988
- includes.push('ApprovalTask_FormData');
989
- }
990
- searchParams.includes = includes.join(",");
991
- options.searchParams = searchParams;
992
- // 发起请求
993
- let resp = await openapi.doRequest(null, urlPath, options);
994
- if (!resp || !resp.approval_instance) {
995
- return undefined;
996
- }
997
- // 处理应答
998
- const approvalInstance = resp.approval_instance;
999
- const result = {
1000
- id: approvalInstance.id,
1001
- label: approvalInstance.label,
1002
- initiator: approvalInstance.initiator,
1003
- instanceStartTime: approvalInstance.instance_start_time,
1004
- status: approvalInstance.status,
1005
- tasks: [],
1006
- comments: [],
1007
- };
1008
- if (!approvalInstance.tasks && Array.isArray(approvalInstance.tasks)) {
1009
- for (let task of approvalInstance.tasks) {
1010
- result.tasks.push({
1011
- id: task.id,
1012
- taskType: task.task_type,
1013
- taskStatus: task.task_status,
1014
- taskStartTime: task.task_start_time,
1015
- taskEndTime: task.task_end_time,
1016
- formData: task.form_data,
1017
- approvalLogic: task.approval_logic,
1018
- approvers: task.approvers,
1019
- assigners: task.assigners,
1020
- taskURL: task.task_url,
1021
- });
1022
- }
1023
- }
1024
- if (!approvalInstance.comments && Array.isArray(approvalInstance.comments)) {
1025
- for (let comment of approvalInstance.comments) {
1026
- result.comments.push({
1027
- id: comment.id,
1028
- commenter: comment.commenter,
1029
- content: comment.content,
1030
- createAt: comment.create_at,
1031
- updateAt: comment.update_at,
1032
- });
1033
- }
1034
- }
1035
- return result;
1036
- }
1037
945
  }
1038
946
  exports.RequestHttp = RequestHttp;
1039
947
  async function invokeFuncWithAuth(idOrName, params) {
@@ -1,10 +0,0 @@
1
- import { Flow as IFlow, ExecuteOptions, ExecutionResult, ExecutionInfo, FlowTaskInfo, RevokeExecutionOptions } from '../flow';
2
- import { IApprovalInstance, IApprovalInstanceList, IApprovalInstanceListOptions, IGetApprovalInstanceOptions } from "../../../../request/structs";
3
- export declare class Flow implements IFlow {
4
- execute(APIName: string, options: ExecuteOptions | undefined): Promise<ExecutionResult>;
5
- getExecutionInfo(executionId: number): Promise<ExecutionInfo>;
6
- getExecutionUserTaskInfo(executionId: number): Promise<FlowTaskInfo[]>;
7
- revokeExecution(executionId: number, options: RevokeExecutionOptions): Promise<void>;
8
- getApprovalInstanceList(options?: IApprovalInstanceListOptions): Promise<IApprovalInstanceList>;
9
- getApprovalInstance(options: IGetApprovalInstanceOptions): Promise<IApprovalInstance>;
10
- }
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Flow = void 0;
4
- const exceptions_1 = require("@byted-apaas/server-common-node/utils/exceptions");
5
- const Request = require("../../../../request/interface");
6
- const server_common_node_1 = require("@byted-apaas/server-common-node");
7
- class Flow {
8
- async execute(APIName, options) {
9
- if (!APIName || typeof APIName !== 'string') {
10
- throw new exceptions_1.InvalidParamError(`param's type (${APIName}) need string, but is ${typeof APIName}`);
11
- }
12
- if (options && options.params && server_common_node_1.checkUtils.isNotObject(options.params)) {
13
- throw new exceptions_1.InvalidParamError(`options.params's type (${options}) need object, but is ${Array.isArray(options) ? 'array' : typeof options.params}`);
14
- }
15
- if (!options) {
16
- options = {};
17
- }
18
- return await Request.GetInstance().executeFlow(APIName, options);
19
- }
20
- async getExecutionInfo(executionId) {
21
- if (!executionId || typeof executionId !== 'number') {
22
- throw new exceptions_1.InvalidParamError(`param's type (${executionId}) is not matched to number, but is ${typeof executionId}`);
23
- }
24
- return await Request.GetInstance().getExecutionInfo(executionId);
25
- }
26
- async getExecutionUserTaskInfo(executionId) {
27
- if (!executionId || typeof executionId !== 'number') {
28
- throw new exceptions_1.InvalidParamError(`param's type (${executionId}) need number, but is ${typeof executionId}`);
29
- }
30
- return await Request.GetInstance().getExecutionUserTaskInfo(BigInt(executionId));
31
- }
32
- async revokeExecution(executionId, options) {
33
- if (!executionId || typeof executionId !== 'number') {
34
- throw new exceptions_1.InvalidParamError(`param's type (${executionId}) is need number, but is ${typeof executionId}`);
35
- }
36
- return await Request.GetInstance().revokeExecution(executionId, options);
37
- }
38
- async getApprovalInstanceList(options) {
39
- return await Request.GetInstance().getApprovalInstanceList(options);
40
- }
41
- async getApprovalInstance(options) {
42
- if (!options || !options.approvalInstanceId) {
43
- throw new exceptions_1.InvalidParamError(`required parameter approvalInstanceId is empty`);
44
- }
45
- if (typeof options.approvalInstanceId !== 'number') {
46
- throw new exceptions_1.InvalidParamError(`param's type (${options.approvalInstanceId}) is need number, but is ${typeof options.approvalInstanceId}`);
47
- }
48
- return await Request.GetInstance().getApprovalInstance(options);
49
- }
50
- }
51
- exports.Flow = Flow;
@@ -1,99 +0,0 @@
1
- export interface IApprovalInstanceListReq {
2
- start_time?: number;
3
- end_time?: number;
4
- page_size?: number;
5
- page_token?: string;
6
- }
7
- export interface IGetApprovalInstanceListResp {
8
- approval_instance_ids: number[];
9
- page_token: string;
10
- count: number;
11
- has_more: boolean;
12
- }
13
- export interface IGetApprovalInstanceResp {
14
- approval_instance: {
15
- id: number;
16
- label: Record<string, string>;
17
- initiator: number;
18
- instance_start_time: number;
19
- status: string;
20
- tasks: {
21
- id: number;
22
- task_type: string;
23
- task_status: string;
24
- task_start_time: number;
25
- task_end_time: number;
26
- form_data: string;
27
- approval_logic: string;
28
- approvers: number[];
29
- assigners: number[];
30
- task_url: string;
31
- }[];
32
- comments: {
33
- id: number;
34
- commenter: number;
35
- content: string;
36
- create_at: number;
37
- update_at: number;
38
- }[];
39
- };
40
- }
41
- export interface IApprovalInstanceReq {
42
- includes: string;
43
- }
44
- export interface IApprovalInstanceListOptions {
45
- startTime?: number;
46
- endTime?: number;
47
- pageSize?: number;
48
- pageToken?: string;
49
- }
50
- export interface IApprovalInstanceList {
51
- approvalInstanceIds: number[];
52
- pageToken: string;
53
- count: number;
54
- hasMore: boolean;
55
- }
56
- export declare enum ApprovalInstanceStatus {
57
- IN_PROCESS = "in_process",
58
- AGREED = "agreed",
59
- INPROCESS = "rejected",
60
- CANCELED = "canceled",
61
- FAILED = "failed",
62
- COMPLETED = "completed",
63
- UNSTARTED = "unstarted",
64
- AUTO_END = "auto_end",
65
- TERMINATED = "terminated"
66
- }
67
- export interface IApprovalInstance {
68
- id: number;
69
- label: Record<string, string>;
70
- initiator: number;
71
- instanceStartTime: number;
72
- status: string;
73
- tasks: IApprovalTask[];
74
- comments: IApprovalComment[];
75
- }
76
- export interface IApprovalComment {
77
- id: number;
78
- commenter: number;
79
- content: string;
80
- createAt: number;
81
- updateAt: number;
82
- }
83
- export interface IApprovalTask {
84
- id: number;
85
- taskType: string;
86
- taskStatus: string;
87
- taskStartTime: number;
88
- taskEndTime: number;
89
- formData: string;
90
- approvalLogic: string;
91
- approvers: number[];
92
- assigners: number[];
93
- taskURL: string;
94
- }
95
- export interface IGetApprovalInstanceOptions {
96
- approvalInstanceId: number;
97
- includeFormData?: boolean;
98
- includeContent?: boolean;
99
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApprovalInstanceStatus = void 0;
4
- var ApprovalInstanceStatus;
5
- (function (ApprovalInstanceStatus) {
6
- ApprovalInstanceStatus["IN_PROCESS"] = "in_process";
7
- ApprovalInstanceStatus["AGREED"] = "agreed";
8
- ApprovalInstanceStatus["INPROCESS"] = "rejected";
9
- ApprovalInstanceStatus["CANCELED"] = "canceled";
10
- ApprovalInstanceStatus["FAILED"] = "failed";
11
- ApprovalInstanceStatus["COMPLETED"] = "completed";
12
- ApprovalInstanceStatus["UNSTARTED"] = "unstarted";
13
- ApprovalInstanceStatus["AUTO_END"] = "auto_end";
14
- ApprovalInstanceStatus["TERMINATED"] = "terminated";
15
- })(ApprovalInstanceStatus = exports.ApprovalInstanceStatus || (exports.ApprovalInstanceStatus = {}));