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

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,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> {
@@ -112,7 +112,7 @@ function getOptionList(field) {
112
112
  apiName: option.api_name,
113
113
  description: option.description,
114
114
  color: commonUtils.getColorNameById(option.color_id),
115
- active: !!option.active,
115
+ active: Number(option.active) === 1,
116
116
  });
117
117
  }
118
118
  return options;
@@ -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
  };
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 { IFuCtx } 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<IFuCtx, 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>;
@@ -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.5-beta.6",
3
+ "version": "1.0.5-beta.9",
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.7-beta.6",
15
+ "@byted-apaas/server-common-node": "^1.0.7-beta.17",
16
16
  "@jorgeferrero/stream-to-buffer": "^2.0.6",
17
17
  "dayjs": "^1.9.6",
18
18
  "form-data": "^3.0.0",
@@ -37,5 +37,6 @@
37
37
  "ts-node/register"
38
38
  ],
39
39
  "timeout": 20000
40
- }
40
+ },
41
+ "gitHead": "034c3de194201277e2db2d962a3480fbd893f5fb"
41
42
  }
@@ -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[];
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 {