@byted-apaas/server-sdk-node 1.0.4 → 1.0.5-beta.8

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.
@@ -19,7 +19,7 @@ export interface IApplication {
19
19
  localDebugMode(): IApplication;
20
20
  setLaneName(laneName: string): IApplication;
21
21
  }
22
- export declare type AppMode = 'openSDK' | 'faasSDK';
22
+ export type AppMode = 'openSDK' | 'faasSDK';
23
23
  export interface AppCtx {
24
24
  mode: AppMode;
25
25
  env?: PlatformEnvType;
@@ -8,3 +8,6 @@ export declare const httpHeaderKeys: {
8
8
  export declare const httpStatusCodes: {
9
9
  redirect: number;
10
10
  };
11
+ export declare const triggerType: {
12
+ defaultTrigger: string;
13
+ };
@@ -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.httpStatusCodes = exports.httpHeaderKeys = exports.notifyModel = void 0;
5
+ exports.triggerType = exports.httpStatusCodes = exports.httpHeaderKeys = exports.notifyModel = void 0;
6
6
  exports.notifyModel = {
7
7
  key: "ee.kunlun.cloudfunction.faas_buildin",
8
8
  };
@@ -13,3 +13,6 @@ exports.httpHeaderKeys = {
13
13
  exports.httpStatusCodes = {
14
14
  redirect: 302,
15
15
  };
16
+ exports.triggerType = {
17
+ defaultTrigger: "default-trigger"
18
+ };
@@ -4,7 +4,7 @@ import { Message } from "./msg/msg";
4
4
  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
- export declare class Context<T, mt, cf, gv> extends CommonContext<T> implements IContext<T, mt, cf, gv> {
7
+ export declare class Context<T, mt, cf, gv> extends CommonContext implements IContext<T, mt, cf, gv> {
8
8
  /**
9
9
  * 操作数据库中的记录数据
10
10
  */
@@ -8,7 +8,7 @@ import { IOql } from './impl/oql/ioql';
8
8
  * - 目前 IDBGetter 支持的是 currentObject 方法的动态声明,使用泛型实现,期望传入的 T 是 Context 结构。
9
9
  * - 如果 Context 有 objectApiName 属性,则拥有 .db.currentObject 和 .db.transaction.currentObject
10
10
  */
11
- export declare type IDBGetter<T, mt> = T extends {
11
+ export type IDBGetter<T, mt> = T extends {
12
12
  'objectApiName': string;
13
13
  } ? IDB<T, mt> & IDBWithCurrentObject<{}, mt> : IDB<{}, mt>;
14
14
  /**
@@ -1,6 +1,6 @@
1
1
  export declare const ASC = "asc";
2
2
  export declare const DESC = "desc";
3
- export declare type OrderType = 'asc' | 'desc';
3
+ export type OrderType = 'asc' | 'desc';
4
4
  export declare class Order {
5
5
  field: string;
6
6
  type: string;
@@ -1,10 +1,10 @@
1
1
  import { ITransaction, ITransactionWithCurrentObject, TransactionObject } from "../transaction";
2
2
  import { TransactionOperation } from './operation';
3
3
  import { currentObjApiName } from '../../../../data';
4
- declare type uuidOrRecordIDResult = {
4
+ type uuidOrRecordIDResult = {
5
5
  _id: uuidOrRecordID;
6
6
  };
7
- declare type uuidOrRecordID = number | string;
7
+ type uuidOrRecordID = number | string;
8
8
  export declare class Transaction<T, mt> implements ITransaction<mt>, ITransactionWithCurrentObject<mt> {
9
9
  objectApiName: string;
10
10
  placeholders: Record<string, number>;
@@ -1,6 +1,6 @@
1
1
  import { _Cond } from '../../../types/types';
2
2
  import { currentObjApiName } from "../../../data/index";
3
- export declare type ITransactionGetter<T, mt> = T extends {
3
+ export type ITransactionGetter<T, mt> = T extends {
4
4
  'objectApiName': string;
5
5
  } ? ITransaction<mt> : ITransaction<mt> & ITransactionWithCurrentObject<mt>;
6
6
  export interface ITransaction<mt> {
@@ -1,6 +1,6 @@
1
- export declare type I18n = {
1
+ export type I18n = {
2
2
  language_code: number;
3
3
  text: string;
4
4
  };
5
- export declare type I18ns = I18n[];
5
+ export type I18ns = I18n[];
6
6
  export declare function isNullOrUndefined(param: any): boolean;
@@ -1,11 +1,11 @@
1
1
  import { I18ns } from "./common";
2
- export declare type SelectFieldType = {
2
+ export type SelectFieldType = {
3
3
  fieldPath: {
4
4
  objectApiName: string;
5
5
  fieldApiName: string;
6
6
  }[];
7
7
  };
8
- export declare type FieldApiType = {
8
+ export type FieldApiType = {
9
9
  type?: string;
10
10
  fieldApiName: string;
11
11
  alias?: I18ns;
@@ -15,18 +15,18 @@ export declare type FieldApiType = {
15
15
  };
16
16
  color?: string;
17
17
  };
18
- export declare type UIMetaFilterType = {
18
+ export type UIMetaFilterType = {
19
19
  conditions: Object[];
20
20
  logic: string;
21
21
  };
22
- export declare type UIMetaSortConditionsType = {
22
+ export type UIMetaSortConditionsType = {
23
23
  fieldApiName: string;
24
24
  sort: string;
25
25
  };
26
- export declare type DeskListTitleField = {
26
+ export type DeskListTitleField = {
27
27
  fieldApiName: string;
28
28
  };
29
- export declare type DeskListSubtitleField = {
29
+ export type DeskListSubtitleField = {
30
30
  type?: ("field" | "concatText");
31
31
  fieldApiName: string;
32
32
  alias: I18ns;
@@ -35,11 +35,11 @@ export declare type DeskListSubtitleField = {
35
35
  en_US: ConcatTextType[];
36
36
  };
37
37
  };
38
- export declare type DeskListDetailField = {
38
+ export type DeskListDetailField = {
39
39
  fieldApiName: string;
40
40
  alias: I18ns;
41
41
  };
42
- export declare type UIMetaDesktopType = {
42
+ export type UIMetaDesktopType = {
43
43
  isCompositeType: boolean;
44
44
  titleAreaText: I18ns;
45
45
  objectApiName: string;
@@ -49,17 +49,17 @@ export declare type UIMetaDesktopType = {
49
49
  filter: UIMetaFilterType;
50
50
  sortConditions: UIMetaSortConditionsType[];
51
51
  };
52
- export declare type UIMetaLangType = {
52
+ export type UIMetaLangType = {
53
53
  dataType: string;
54
54
  fieldApiName: string;
55
55
  text: string;
56
56
  };
57
- export declare type ConcatTextType = {
57
+ export type ConcatTextType = {
58
58
  dataType: "fieldApiName" | "text";
59
59
  fieldApiName: string;
60
60
  text: string;
61
61
  };
62
- export declare type UIMetaMobileType = {
62
+ export type UIMetaMobileType = {
63
63
  pageType?: ("app" | "record_page");
64
64
  pageApiName: string;
65
65
  componentName: string;
@@ -69,11 +69,11 @@ export declare type UIMetaMobileType = {
69
69
  filter: UIMetaFilterType;
70
70
  sortConditions: UIMetaSortConditionsType[];
71
71
  };
72
- export declare type MobileListField = {
72
+ export type MobileListField = {
73
73
  fieldApiName: string;
74
74
  hiddenWhenEmpty?: boolean;
75
75
  };
76
- export declare type MobileListItem = {
76
+ export type MobileListItem = {
77
77
  avatar: {
78
78
  active: boolean;
79
79
  fieldApiName: string;
@@ -36,7 +36,7 @@ export interface KDateType extends BaseFieldType {
36
36
  export interface DateTimeType extends BaseFieldType {
37
37
  required: boolean;
38
38
  }
39
- export declare type SubOptionType = {
39
+ export type SubOptionType = {
40
40
  label: I18ns;
41
41
  apiName: string;
42
42
  description: I18ns;
@@ -70,7 +70,7 @@ export interface SortConditionType {
70
70
  fieldApiName: string;
71
71
  sort: ("asc" | "desc");
72
72
  }
73
- declare type ConditionType = {
73
+ type ConditionType = {
74
74
  left: {
75
75
  objectApiName: string;
76
76
  fieldApiName: string;
@@ -79,11 +79,11 @@ declare type ConditionType = {
79
79
  valueType: ("reference" | "specified");
80
80
  right: (object | string);
81
81
  };
82
- declare type CriterionType = {
82
+ type CriterionType = {
83
83
  conditions: ConditionType[];
84
84
  logic: string;
85
85
  };
86
- export declare type FilterType = {
86
+ export type FilterType = {
87
87
  label: string;
88
88
  needTriggerCriterion: boolean;
89
89
  triggerCriterion: CriterionType;
@@ -135,7 +135,7 @@ export interface ExtractSingleRecordType extends BaseFieldType {
135
135
  sortConditions: SortConditionType[];
136
136
  recordPosition: number;
137
137
  }
138
- export declare type FieldType = {
138
+ export type FieldType = {
139
139
  "allow_search": boolean;
140
140
  "api_name": string;
141
141
  "calculated": boolean;
@@ -1,6 +1,6 @@
1
1
  import * as common from "@byted-apaas/server-common-node";
2
2
  import Multilingual = common.fieldType.Multilingual;
3
- export declare type _IconType = "success" | "error" | "progress" | "info";
3
+ export type _IconType = "success" | "error" | "progress" | "info";
4
4
  export declare class _NotifyCenter {
5
5
  /**
6
6
  * 消息中心推送消息
@@ -41,13 +41,13 @@ export interface _IKunlunFile {
41
41
  */
42
42
  download(fileInfo: _FileInfo, filePath: string): Promise<void>;
43
43
  }
44
- export declare type FileUploadResult = {
44
+ export type FileUploadResult = {
45
45
  fileId: string;
46
46
  type: string;
47
47
  name: string;
48
48
  size: number;
49
49
  };
50
- export declare type UploadAvatarResult = {
50
+ export type UploadAvatarResult = {
51
51
  ImageId: string;
52
52
  PreviewImageId: string;
53
53
  };
@@ -23,7 +23,7 @@ class Tasks {
23
23
  async createAsyncTask(apiName, params) {
24
24
  if (apiName && params) {
25
25
  // low_code 1.0
26
- if (utils.isOnlineDev()) { // TODO 区分 4.0 vs 5.0
26
+ if (utils.isOnlineDev()) {
27
27
  // 1.debug模式
28
28
  if (utils.isDebug()) {
29
29
  return await this.f(apiName).invoke(params);
package/data/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export interface workflowVariables {
2
2
  }
3
- export declare type globalFuncNames = "a" | "b";
3
+ export type globalFuncNames = "a" | "b";
4
4
  export interface globalVariablesMap {
5
5
  a: string;
6
6
  b: string;
7
7
  }
8
- export declare type globalVariables = keyof globalVariablesMap;
8
+ export type globalVariables = keyof globalVariablesMap;
9
9
  export interface metadataMap {
10
10
  /**
11
11
  * @description 用户
@@ -13,7 +13,7 @@ export interface metadataMap {
13
13
  _user: User;
14
14
  _department: Department;
15
15
  }
16
- export declare type currentObjApiName = "_user";
16
+ export type currentObjApiName = "_user";
17
17
  interface User {
18
18
  _name: string;
19
19
  _id: number;
package/hooks/api.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import * as common from "@byted-apaas/server-common-node";
2
- import { IGfCtx } from "@byted-apaas/server-common-node/context/IContext";
3
2
  import { Tasks } from "../context/tasks/tasks";
4
3
  import { DB } from "../context/db/impl/db";
5
4
  import { _Resources } from "../context/resources/impl/resources";
6
5
  import { Message } from "../context/msg/msg";
7
6
  import { IMetaData } from "../context/metadata/metadata";
8
- declare type invokeGlobalFuncT = (funcNames: string) => {
7
+ type invokeGlobalFuncT = (funcNames: string) => {
9
8
  invoke: (params?: any) => Promise<any>;
10
9
  };
11
10
  export declare function getFunctionSync(context?: any, logger?: common.Logger): invokeGlobalFuncT;
@@ -33,7 +32,7 @@ export declare function invokeMicroservice(): (apiName: string) => {
33
32
  */
34
33
  invokeAsync: (path: string, method?: string, params?: any) => Promise<any>;
35
34
  };
36
- export declare const db: DB<IGfCtx, import("../data").metadataMap>;
35
+ export declare const db: DB<import("@byted-apaas/server-common-node/context/IContext").IContext, import("../data").metadataMap>;
37
36
  export declare const resources: _Resources;
38
37
  export declare const msg: Message;
39
38
  export declare const tasks: Tasks<unknown>;
package/hooks/api.js CHANGED
@@ -11,14 +11,12 @@ const resources_1 = require("../context/resources/impl/resources");
11
11
  const msg_1 = require("../context/msg/msg");
12
12
  const Request = require("../request/interface");
13
13
  const constants = require("../constants/constants");
14
- const utils_1 = require("@byted-apaas/server-common-node/utils/utils");
15
14
  const metadata_1 = require("../context/metadata/metadata");
16
15
  const nodeCls = require("node-cls");
17
16
  const nodeClsCtx = common.nodeClsCtx;
18
17
  const exceptions = common.exceptions;
19
18
  const utils = common.utils;
20
19
  const checkUtils = common.checkUtils;
21
- const functionSources = common.constants.functionSources;
22
20
  // 同步调用云函数
23
21
  function getFunctionSync(context, logger) {
24
22
  return (funcName) => {
@@ -79,7 +77,6 @@ function getFunctionSync(context, logger) {
79
77
  ctx.loopMasks = loopMasks;
80
78
  return await ctx.run(async () => {
81
79
  const dynCtx = nodeClsCtx.getDynCtx();
82
- dynCtx.source = functionSources.globalFunction;
83
80
  return await dynCtx.run(async () => {
84
81
  return await common.hooks.invoke(func, params, context, logger);
85
82
  });
@@ -89,29 +86,12 @@ function getFunctionSync(context, logger) {
89
86
  };
90
87
  }
91
88
  return {
89
+ // 多语言函数开发, 走远端
92
90
  invoke: async (params) => {
93
- let func = (0, utils_1.getRequireFunc)()(funcName);
94
- if (!func) {
95
- throw new exceptions.InvalidParamError(`The function (${funcName}) does not exist.`);
96
- }
97
- let loopMasks = [funcName];
98
- let reqCtx = nodeCls.get("loopCtx");
99
- if (reqCtx && reqCtx.loopMasks && Array.isArray(reqCtx.loopMasks)) {
100
- if (reqCtx.loopMasks.includes(funcName)) {
101
- throw new exceptions.InvalidParamError(`Task execution forms a loop.`);
102
- }
103
- loopMasks.push(...reqCtx.loopMasks);
104
- }
105
- // 修改 source 全局函数
106
- let ctx = nodeCls.create("loopCtx");
107
- ctx.loopMasks = loopMasks;
108
- return await ctx.run(async () => {
109
- const dynCtx = nodeClsCtx.getDynCtx();
110
- dynCtx.source = functionSources.globalFunction;
111
- return await dynCtx.run(async () => {
112
- return await common.hooks.invoke(func, params, context, logger);
113
- });
114
- });
91
+ return await Request.GetInstance().invokeFuncSync({
92
+ APIName: funcName,
93
+ isInvokeByAPIName: true
94
+ }, params);
115
95
  }
116
96
  };
117
97
  };
package/hooks/hooks.js CHANGED
@@ -6,7 +6,6 @@ const msg_1 = require("../context/msg/msg");
6
6
  const server_common_node_1 = require("@byted-apaas/server-common-node");
7
7
  const api = require("./api");
8
8
  const operator_1 = require("../kunlun/operator/impl/operator");
9
- const constants_1 = require("@byted-apaas/server-common-node/constants/constants");
10
9
  const db_1 = require("../context/db/impl/db");
11
10
  const common_1 = require("../request/common");
12
11
  /**
@@ -38,31 +37,12 @@ function pre(params, context, logger, requireFunc) {
38
37
  * @param requireFunc
39
38
  */
40
39
  function mountContext(context, logger, requireFunc) {
41
- const source = server_common_node_1.utils.getSource();
42
- // 1. 根据不同调用场景差异化初始化内容
43
- // - db 是否包含 currentObject,transaction 是否包含 currentObject
44
- // - global function 场景需要初始化 setRespHeader 和 RedirectLocation 方法,以及 method 属性
45
- switch (source) {
46
- case constants_1.functionSources.workflow:
47
- context.db = new db_1.DBWithCurrentObject(context.objectApiName);
48
- break;
49
- case constants_1.functionSources.globalFunction:
50
- context.db = new db_1.DBWithCurrentObject(null);
51
- // set response headers
52
- context.setResponseHeader = api.setRespHeader();
53
- context.setRedirectLocation = api.setRedirectLocation(context);
54
- // 暴露context.method属性
55
- context.method = server_common_node_1.utils.getHttpMethod();
56
- break;
57
- case constants_1.functionSources.recordAutomation:
58
- context.db = new db_1.DBWithCurrentObject(context.objectApiName);
59
- break;
60
- case constants_1.functionSources.scheduleAutomation:
61
- context.db = new db_1.DBWithCurrentObject(null);
62
- break;
63
- default:
64
- throw new server_common_node_1.exceptions.InvalidParamError(`This npm package does not contain this source ${source}`);
65
- }
40
+ // 1. 全量挂载
41
+ context.db = new db_1.DBWithCurrentObject(context.objectApiName);
42
+ // set response headers
43
+ context.setResponseHeader = api.setRespHeader();
44
+ context.setRedirectLocation = api.setRedirectLocation(context);
45
+ context.method = server_common_node_1.utils.getHttpMethod();
66
46
  // 2. 初始化 core 包中需要初始化的内容,因此强转为 IContext 类型
67
47
  // - function
68
48
  // - tasks
@@ -1,4 +1,4 @@
1
- export declare type UserDataType = null | string | boolean | number | Date | object;
1
+ export type UserDataType = null | string | boolean | number | Date | object;
2
2
  export declare class Expression {
3
3
  index: number;
4
4
  left: ExpressionField;
@@ -6,11 +6,11 @@ export declare class Expression {
6
6
  right: ExpressionField;
7
7
  constructor(left: ExpressionField, operator: string, right: ExpressionField, index: number);
8
8
  }
9
- declare type SettingType = {
9
+ type SettingType = {
10
10
  data?: UserDataType;
11
11
  fieldPath?: PathType[];
12
12
  };
13
- export declare type PathType = {
13
+ export type PathType = {
14
14
  objectApiName: string;
15
15
  fieldApiName: string;
16
16
  extendLogicTags: string[];
@@ -13,7 +13,7 @@ export declare class Condition {
13
13
  toExpression(objectApiName: string, fieldApiName: string, index: number): Expression;
14
14
  constructor(left: string, right: Condition | UserDataType, op?: string);
15
15
  }
16
- export declare type Criterion = {
16
+ export type Criterion = {
17
17
  conditions: Expression[];
18
18
  logic: string;
19
19
  };
@@ -12,13 +12,6 @@ var fieldType = common.fieldType;
12
12
  const dayjs = require("dayjs");
13
13
  // 条件操作
14
14
  class Condition {
15
- constructor(left, right, op = operator_1.operates.EQ) {
16
- this.left = left;
17
- this.right = right;
18
- if (op) {
19
- this.op = op;
20
- }
21
- }
22
15
  /**
23
16
  *
24
17
  * @param objectApiName 对象的ApiName
@@ -44,6 +37,13 @@ class Condition {
44
37
  }
45
38
  return new expression_1.Expression(left, op, right, index);
46
39
  }
40
+ constructor(left, right, op = operator_1.operates.EQ) {
41
+ this.left = left;
42
+ this.right = right;
43
+ if (op) {
44
+ this.op = op;
45
+ }
46
+ }
47
47
  }
48
48
  exports.Condition = Condition;
49
49
  // param type should be spercific
@@ -1,21 +1,21 @@
1
1
  import { OrderV2 } from "../../../request/interface";
2
2
  import { UserDataType } from "./expression";
3
- export declare type FieldPath = {
3
+ export type FieldPath = {
4
4
  objectApiName: string;
5
5
  fieldApiName: string;
6
6
  extendLogicTags: string[];
7
7
  };
8
- export declare type SettingType = {
8
+ export type SettingType = {
9
9
  data?: any;
10
10
  fieldPath?: FieldPath[];
11
11
  };
12
- export declare type Expression = {
12
+ export type Expression = {
13
13
  type: string;
14
14
  settings: SettingType;
15
15
  };
16
16
  export declare function NewMetadataExpressionField(objectApiName: string, fieldApiName: string): Expression;
17
17
  export declare function NewConstantExpressionField(data: UserDataType): Expression;
18
- export declare type ExpressionV2 = {
18
+ export type ExpressionV2 = {
19
19
  leftValue: string;
20
20
  operator: string;
21
21
  rightValue: any;
@@ -49,10 +49,10 @@ export declare class QueryV2 {
49
49
  select(fieldApiNames: string[]): QueryV2;
50
50
  constructor(objectApiName: string);
51
51
  }
52
- export declare type logicalRet = {
52
+ export type logicalRet = {
53
53
  logicalExps: LogicalExpression[];
54
54
  arithmeticExps: ArithmeticExpression[];
55
55
  };
56
56
  export declare function logical(exps: (LogicalExpression | Record<string, ArithmeticExpression>)[]): logicalRet;
57
- export declare type CriterionV2 = (Record<string, CriterionV2> | ExpressionV2)[];
57
+ export type CriterionV2 = (Record<string, CriterionV2> | ExpressionV2)[];
58
58
  export declare function buildCriterionV2(filter: LogicalExpression): CriterionV2;
@@ -73,18 +73,6 @@ class LogicalExpression {
73
73
  }
74
74
  exports.LogicalExpression = LogicalExpression;
75
75
  class QueryV2 {
76
- constructor(objectApiName) {
77
- this.objectApiName = objectApiName;
78
- this._limit = 200;
79
- this._offset = 0;
80
- this.fields = [];
81
- this._order = [];
82
- this.filter = {
83
- type: "and",
84
- arithmeticExpressions: [],
85
- logicalExpressions: [],
86
- };
87
- }
88
76
  buildCriterion(filter) {
89
77
  if (!filter || filter.arithmeticExpressions.length == 0 && filter.logicalExpressions.length == 0) {
90
78
  return null;
@@ -154,6 +142,18 @@ class QueryV2 {
154
142
  });
155
143
  return this;
156
144
  }
145
+ constructor(objectApiName) {
146
+ this.objectApiName = objectApiName;
147
+ this._limit = 200;
148
+ this._offset = 0;
149
+ this.fields = [];
150
+ this._order = [];
151
+ this.filter = {
152
+ type: "and",
153
+ arithmeticExpressions: [],
154
+ logicalExpressions: [],
155
+ };
156
+ }
157
157
  }
158
158
  exports.QueryV2 = QueryV2;
159
159
  function logical(exps) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.0.4",
3
+ "version": "1.0.5-beta.8",
4
4
  "description": "aPaaS Server SDK",
5
5
  "author": "zhouwexin <zhouwexin@bytedance.com>",
6
6
  "homepage": "",
@@ -12,7 +12,7 @@
12
12
  "pre-build": "rm -rf build && tsc"
13
13
  },
14
14
  "dependencies": {
15
- "@byted-apaas/server-common-node": "^1.0.4",
15
+ "@byted-apaas/server-common-node": "^1.0.7-beta.15",
16
16
  "@jorgeferrero/stream-to-buffer": "^2.0.6",
17
17
  "dayjs": "^1.9.6",
18
18
  "form-data": "^3.0.0",
@@ -38,5 +38,5 @@
38
38
  ],
39
39
  "timeout": 20000
40
40
  },
41
- "gitHead": "e2274551684797a45a4fa5e2168f1c54a7559c7e"
41
+ "gitHead": "265483f5aeb63092eb719f2db49bf22070329227"
42
42
  }
@@ -1345,7 +1345,7 @@ async function invokeFuncSync(idOrName, params) {
1345
1345
  }
1346
1346
  param.Params = JSON.stringify(params);
1347
1347
  param.Context = JSON.stringify((0, common_1.getTriggerCtx)());
1348
- param.TriggerType = utils.getTriggerType();
1348
+ param.TriggerType = constants_1.triggerType.defaultTrigger;
1349
1349
  let resp;
1350
1350
  try {
1351
1351
  resp = await rpc.getInnerAPICli().InvokeFuncSync(ctx, param);
@@ -1380,7 +1380,7 @@ async function createAsyncTaskV1(idOrName, params) {
1380
1380
  }
1381
1381
  param.Params = JSON.stringify(params);
1382
1382
  param.Context = JSON.stringify((0, common_1.getTriggerCtx)());
1383
- param.TriggerType = utils.getTriggerType();
1383
+ param.TriggerType = constants_1.triggerType.defaultTrigger;
1384
1384
  let resp;
1385
1385
  try {
1386
1386
  resp = await rpc.getInnerAPICli().CreateAsyncTaskOld(ctx, param);
@@ -1399,7 +1399,7 @@ async function createAsyncTaskV2(APIName, params) {
1399
1399
  param.APIAlias = APIName;
1400
1400
  param.Params = JSON.stringify(params);
1401
1401
  param.Context = JSON.stringify((0, common_1.getTriggerCtx)());
1402
- param.TriggerType = utils.getTriggerType();
1402
+ param.TriggerType = constants_1.triggerType.defaultTrigger;
1403
1403
  param.Extra = (0, common_1.getDebugExtraInfo)();
1404
1404
  let resp;
1405
1405
  try {
@@ -7,19 +7,19 @@ import { AppCtx } from "../application/application";
7
7
  import { Order } from "../context/db/impl/order";
8
8
  export declare function GetInstance(): IInnerAPIRequest;
9
9
  export declare function GetFaaSInfraInstance(): IFaaSInfraRequest;
10
- export declare type UploadFileResp = {
10
+ export type UploadFileResp = {
11
11
  id: string;
12
12
  token: string;
13
13
  size: bigint;
14
14
  mimeType: string;
15
15
  name: string;
16
16
  };
17
- export declare type OrderV2 = {
17
+ export type OrderV2 = {
18
18
  field: string;
19
19
  direction: string;
20
20
  type: string;
21
21
  };
22
- export declare type OpenSDKGetRecordsReq = {
22
+ export type OpenSDKGetRecordsReq = {
23
23
  limit: number;
24
24
  offset: number;
25
25
  fields: string[];
@@ -852,7 +852,7 @@ async function invokeFuncSync(idOrName, params) {
852
852
  options.json = {
853
853
  "params": JSON.stringify(params),
854
854
  "context": JSON.stringify(getTriggerCtx()),
855
- "triggerType": utils.getTriggerType(),
855
+ "triggerType": constants_1.triggerType.defaultTrigger,
856
856
  };
857
857
  // 相等时,表示是新版本函数的场景
858
858
  if (idOrName.isInvokeByAPIName) {
@@ -877,7 +877,7 @@ async function createAsyncTaskV1(idOrName, params) {
877
877
  options.json = {
878
878
  "params": JSON.stringify(params),
879
879
  "context": JSON.stringify(getTriggerCtx()),
880
- "triggerType": utils.getTriggerType(),
880
+ "triggerType": constants_1.triggerType.defaultTrigger,
881
881
  };
882
882
  // 相等时,表示是新版本函数的场景
883
883
  if (idOrName.isInvokeByAPIName) {
@@ -914,7 +914,7 @@ async function createAsyncTaskV2(APIName, params) {
914
914
  "apiAlias": APIName,
915
915
  "params": JSON.stringify(params),
916
916
  "context": JSON.stringify(getTriggerCtx()),
917
- "triggerType": utils.getTriggerType(),
917
+ "triggerType": constants_1.triggerType.defaultTrigger,
918
918
  "extra": (0, common_1.getDebugExtraInfo)()
919
919
  };
920
920
  let res = await openapi.doRequest(null, urlPath, options);
package/types/types.d.ts CHANGED
@@ -1,28 +1,28 @@
1
- export declare type _BooleanCond<T> = {};
2
- export declare type _LogicalCond<T> = {};
3
- declare type _LookupCond = number | {
1
+ export type _BooleanCond<T> = {};
2
+ export type _LogicalCond<T> = {};
3
+ type _LookupCond = number | {
4
4
  _id: number;
5
5
  };
6
- declare type _MultiLookupCond = _LookupCond[];
7
- declare type PartialCompositeType<T> = Partial<{
6
+ type _MultiLookupCond = _LookupCond[];
7
+ type PartialCompositeType<T> = Partial<{
8
8
  [K in keyof T]: T[K] extends _LookupField[] ? _MultiLookupCond : T[K] extends _LookupField ? _LookupCond : Partial<T[K]>;
9
9
  }>;
10
- declare type _FieldCond<T> = T extends _LookupField[] ? _MultiLookupCond : T extends _LookupField ? _LookupCond : PartialCompositeType<T>;
11
- declare type _FirstLevelFieldCond<T> = Partial<{
10
+ type _FieldCond<T> = T extends _LookupField[] ? _MultiLookupCond : T extends _LookupField ? _LookupCond : PartialCompositeType<T>;
11
+ type _FirstLevelFieldCond<T> = Partial<{
12
12
  [K in keyof T]: T[K] extends _LookupField ? _FieldCond<T[K]> : T[K];
13
13
  }>;
14
- declare type _KCond<T> = Partial<{
14
+ type _KCond<T> = Partial<{
15
15
  [K in keyof T]: _FieldCond<T[K]> | _BooleanCond<T[K]> | _LogicalCond<T[K]>;
16
16
  }>;
17
- declare type _WhereKCond<T> = Partial<{
17
+ type _WhereKCond<T> = Partial<{
18
18
  [K in keyof T]: _FirstLevelFieldCond<T[K]> | _BooleanCond<T[K]> | _LogicalCond<T[K]>;
19
19
  }>;
20
- export declare type _Cond<T> = _KCond<T> | _LogicalCond<Partial<T>>;
21
- export declare type _WhereCond<T> = _WhereKCond<T> | _LogicalCond<Partial<T>>;
22
- export declare type _Record<T> = {
20
+ export type _Cond<T> = _KCond<T> | _LogicalCond<Partial<T>>;
21
+ export type _WhereCond<T> = _WhereKCond<T> | _LogicalCond<Partial<T>>;
22
+ export type _Record<T> = {
23
23
  [K in keyof T]: T[K] extends _LookupField ? _LookupFieldRet : T[K];
24
24
  };
25
- export declare type _CondRequireID<T> = _Cond<T> & {
25
+ export type _CondRequireID<T> = _Cond<T> & {
26
26
  _id: number;
27
27
  };
28
28
  interface _LookupFieldRet {