@byted-apaas/server-sdk-node 0.0.1-beta.3

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.
Files changed (163) hide show
  1. package/LICENSE +7 -0
  2. package/NOTICE +3 -0
  3. package/README.md +1 -0
  4. package/application/application.d.ts +27 -0
  5. package/application/application.js +2 -0
  6. package/application/application.ts +40 -0
  7. package/application/function/function.d.ts +14 -0
  8. package/application/function/function.js +21 -0
  9. package/application/function/function.ts +37 -0
  10. package/application/impl/common.d.ts +2 -0
  11. package/application/impl/common.js +50 -0
  12. package/application/impl/common.ts +50 -0
  13. package/application/impl/impl.d.ts +16 -0
  14. package/application/impl/impl.js +38 -0
  15. package/application/impl/impl.ts +48 -0
  16. package/constants/constants.d.ts +10 -0
  17. package/constants/constants.js +15 -0
  18. package/constants/constants.ts +15 -0
  19. package/context/context.d.ts +74 -0
  20. package/context/context.js +25 -0
  21. package/context/context.ts +130 -0
  22. package/context/db/db.d.ts +73 -0
  23. package/context/db/db.js +4 -0
  24. package/context/db/db.ts +80 -0
  25. package/context/db/impl/IObject.d.ts +251 -0
  26. package/context/db/impl/IObject.js +5 -0
  27. package/context/db/impl/IObject.ts +247 -0
  28. package/context/db/impl/db.d.ts +61 -0
  29. package/context/db/impl/db.js +86 -0
  30. package/context/db/impl/db.ts +95 -0
  31. package/context/db/impl/object.d.ts +92 -0
  32. package/context/db/impl/object.js +524 -0
  33. package/context/db/impl/object.ts +631 -0
  34. package/context/db/impl/oql/ioql.d.ts +6 -0
  35. package/context/db/impl/oql/ioql.js +4 -0
  36. package/context/db/impl/oql/ioql.ts +9 -0
  37. package/context/db/impl/oql/oql.d.ts +8 -0
  38. package/context/db/impl/oql/oql.js +21 -0
  39. package/context/db/impl/oql/oql.ts +25 -0
  40. package/context/db/impl/order.d.ts +9 -0
  41. package/context/db/impl/order.js +15 -0
  42. package/context/db/impl/order.ts +19 -0
  43. package/context/db/impl/propertiesStore.d.ts +8 -0
  44. package/context/db/impl/propertiesStore.js +29 -0
  45. package/context/db/impl/propertiesStore.ts +31 -0
  46. package/context/db/impl/queryBuilder.d.ts +29 -0
  47. package/context/db/impl/queryBuilder.js +78 -0
  48. package/context/db/impl/queryBuilder.ts +106 -0
  49. package/context/db/impl/transaction/index.d.ts +20 -0
  50. package/context/db/impl/transaction/index.js +277 -0
  51. package/context/db/impl/transaction/index.ts +340 -0
  52. package/context/db/impl/transaction/operation.d.ts +27 -0
  53. package/context/db/impl/transaction/operation.js +69 -0
  54. package/context/db/impl/transaction/operation.ts +72 -0
  55. package/context/db/impl/transaction.d.ts +67 -0
  56. package/context/db/impl/transaction.js +4 -0
  57. package/context/db/impl/transaction.ts +79 -0
  58. package/context/globalConfig/globalConfig.d.ts +7 -0
  59. package/context/globalConfig/globalConfig.js +16 -0
  60. package/context/globalConfig/globalConfig.ts +14 -0
  61. package/context/metadata/components/common.d.ts +6 -0
  62. package/context/metadata/components/common.js +17 -0
  63. package/context/metadata/components/common.ts +22 -0
  64. package/context/metadata/components/components.d.ts +12 -0
  65. package/context/metadata/components/components.js +19 -0
  66. package/context/metadata/components/components.ts +22 -0
  67. package/context/metadata/components/desktop/list.d.ts +16 -0
  68. package/context/metadata/components/desktop/list.js +402 -0
  69. package/context/metadata/components/desktop/list.ts +457 -0
  70. package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
  71. package/context/metadata/components/desktop/recordDetail.js +53 -0
  72. package/context/metadata/components/desktop/recordDetail.ts +67 -0
  73. package/context/metadata/components/mobile/list.d.ts +24 -0
  74. package/context/metadata/components/mobile/list.js +145 -0
  75. package/context/metadata/components/mobile/list.ts +179 -0
  76. package/context/metadata/metadata.d.ts +61 -0
  77. package/context/metadata/metadata.js +103 -0
  78. package/context/metadata/metadata.ts +178 -0
  79. package/context/metadata/objects/fields.d.ts +130 -0
  80. package/context/metadata/objects/fields.js +334 -0
  81. package/context/metadata/objects/fields.ts +457 -0
  82. package/context/metadata/objects/fields.util.d.ts +40 -0
  83. package/context/metadata/objects/fields.util.js +319 -0
  84. package/context/metadata/objects/fields.util.ts +360 -0
  85. package/context/metadata/objects/objects.d.ts +11 -0
  86. package/context/metadata/objects/objects.js +20 -0
  87. package/context/metadata/objects/objects.ts +30 -0
  88. package/context/metadata/types/common.d.ts +6 -0
  89. package/context/metadata/types/common.js +9 -0
  90. package/context/metadata/types/common.ts +13 -0
  91. package/context/metadata/types/components.d.ts +90 -0
  92. package/context/metadata/types/components.js +4 -0
  93. package/context/metadata/types/components.ts +108 -0
  94. package/context/metadata/types/objects.d.ts +226 -0
  95. package/context/metadata/types/objects.js +4 -0
  96. package/context/metadata/types/objects.ts +254 -0
  97. package/context/msg/msg.d.ts +38 -0
  98. package/context/msg/msg.js +35 -0
  99. package/context/msg/msg.ts +52 -0
  100. package/context/resources/IResources.d.ts +66 -0
  101. package/context/resources/IResources.js +2 -0
  102. package/context/resources/IResources.ts +73 -0
  103. package/context/resources/impl/resources.d.ts +42 -0
  104. package/context/resources/impl/resources.js +150 -0
  105. package/context/resources/impl/resources.ts +173 -0
  106. package/context/tasks/tasks.d.ts +33 -0
  107. package/context/tasks/tasks.js +139 -0
  108. package/context/tasks/tasks.ts +159 -0
  109. package/data/index.d.ts +27 -0
  110. package/data/index.js +4 -0
  111. package/data/index.ts +30 -0
  112. package/hooks/api.d.ts +61 -0
  113. package/hooks/api.js +327 -0
  114. package/hooks/api.ts +341 -0
  115. package/hooks/hooks.d.ts +1 -0
  116. package/hooks/hooks.js +88 -0
  117. package/hooks/hooks.ts +100 -0
  118. package/kunlun/kunlun.d.ts +55 -0
  119. package/kunlun/kunlun.js +58 -0
  120. package/kunlun/kunlun.ts +72 -0
  121. package/kunlun/operator/IOperator.d.ts +158 -0
  122. package/kunlun/operator/IOperator.js +4 -0
  123. package/kunlun/operator/IOperator.ts +166 -0
  124. package/kunlun/operator/impl/expression.d.ts +47 -0
  125. package/kunlun/operator/impl/expression.js +56 -0
  126. package/kunlun/operator/impl/expression.ts +74 -0
  127. package/kunlun/operator/impl/logic.d.ts +50 -0
  128. package/kunlun/operator/impl/logic.js +509 -0
  129. package/kunlun/operator/impl/logic.ts +598 -0
  130. package/kunlun/operator/impl/logicV2.d.ts +58 -0
  131. package/kunlun/operator/impl/logicV2.js +200 -0
  132. package/kunlun/operator/impl/logicV2.ts +254 -0
  133. package/kunlun/operator/impl/operator.d.ts +179 -0
  134. package/kunlun/operator/impl/operator.js +222 -0
  135. package/kunlun/operator/impl/operator.ts +258 -0
  136. package/kunlun/operator/impl/operatorV2.d.ts +180 -0
  137. package/kunlun/operator/impl/operatorV2.js +216 -0
  138. package/kunlun/operator/impl/operatorV2.ts +249 -0
  139. package/lib/core.d.ts +4 -0
  140. package/lib/core.js +19 -0
  141. package/lib/core.ts +7 -0
  142. package/package.json +50 -0
  143. package/request/common.d.ts +13 -0
  144. package/request/common.js +87 -0
  145. package/request/common.ts +91 -0
  146. package/request/constants.d.ts +10 -0
  147. package/request/constants.js +25 -0
  148. package/request/constants.ts +25 -0
  149. package/request/faasinfra.d.ts +8 -0
  150. package/request/faasinfra.js +358 -0
  151. package/request/faasinfra.ts +393 -0
  152. package/request/innerapi.d.ts +67 -0
  153. package/request/innerapi.js +1412 -0
  154. package/request/innerapi.ts +1648 -0
  155. package/request/interface.d.ts +95 -0
  156. package/request/interface.js +41 -0
  157. package/request/interface.ts +169 -0
  158. package/request/openapi.d.ts +69 -0
  159. package/request/openapi.js +1014 -0
  160. package/request/openapi.ts +1223 -0
  161. package/types/types.d.ts +79 -0
  162. package/types/types.js +4 -0
  163. package/types/types.ts +108 -0
@@ -0,0 +1,79 @@
1
+ export declare type _BooleanCond<T> = {};
2
+ export declare type _LogicalCond<T> = {};
3
+ declare type _LookupCond = number | {
4
+ _id: number;
5
+ };
6
+ declare type _MultiLookupCond = _LookupCond[];
7
+ declare type PartialCompositeType<T> = Partial<{
8
+ [K in keyof T]: T[K] extends _LookupField[] ? _MultiLookupCond : T[K] extends _LookupField ? _LookupCond : Partial<T[K]>;
9
+ }>;
10
+ declare type _FieldCond<T> = T extends _LookupField[] ? _MultiLookupCond : T extends _LookupField ? _LookupCond : PartialCompositeType<T>;
11
+ declare type _FirstLevelFieldCond<T> = Partial<{
12
+ [K in keyof T]: T[K] extends _LookupField ? _FieldCond<T[K]> : T[K];
13
+ }>;
14
+ declare type _KCond<T> = Partial<{
15
+ [K in keyof T]: _FieldCond<T[K]> | _BooleanCond<T[K]> | _LogicalCond<T[K]>;
16
+ }>;
17
+ declare type _WhereKCond<T> = Partial<{
18
+ [K in keyof T]: _FirstLevelFieldCond<T[K]> | _BooleanCond<T[K]> | _LogicalCond<T[K]>;
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> = {
23
+ [K in keyof T]: T[K] extends _LookupField ? _LookupFieldRet : T[K];
24
+ };
25
+ export declare type _CondRequireID<T> = _Cond<T> & {
26
+ _id: number;
27
+ };
28
+ interface _LookupFieldRet {
29
+ /**
30
+ * 名称:_id
31
+ *
32
+ * 类型:数字 / Number
33
+ *
34
+ * 格式:number
35
+ */
36
+ _id: number;
37
+ /**
38
+ * 名称:角色名 / _name
39
+ *
40
+ * 类型:文本 / Text | 多语 / Multilingual
41
+ *
42
+ * 格式:string | {language_code: 1033|2052, text: string}[]
43
+ */
44
+ _name: string | {
45
+ language_code: 1033 | 2052;
46
+ text: string;
47
+ }[];
48
+ is_deleted: boolean;
49
+ }
50
+ interface _LookupField {
51
+ _id: number;
52
+ }
53
+ import { metadataMap, currentObjApiName } from '../data/index';
54
+ /**
55
+ * target record 被使用于 workflow 场景下
56
+ */
57
+ export interface TargetRecord {
58
+ /**
59
+ * workflow 被触发时,原始的记录信息
60
+ */
61
+ original: metadataMap[currentObjApiName];
62
+ /**
63
+ * workflow 运行到当前位置的记录信息
64
+ */
65
+ proposed: metadataMap[currentObjApiName];
66
+ }
67
+ export interface TriggerOld {
68
+ /**
69
+ * 更新前的记录数据
70
+ */
71
+ old: metadataMap[currentObjApiName];
72
+ }
73
+ export interface TriggerNew {
74
+ /**
75
+ * 创建或更新后的记录数据
76
+ */
77
+ new: metadataMap[currentObjApiName];
78
+ }
79
+ export {};
package/types/types.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
3
+ // SPDX-License-Identifier: MIT
4
+ Object.defineProperty(exports, "__esModule", { value: true });
package/types/types.ts ADDED
@@ -0,0 +1,108 @@
1
+ // Copyright 2022 ByteDance Ltd. and/or its affiliates
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ // Condition 部分,用于声明在查询、操作符等场景使用的 条件、逻辑条件、布尔条件 和 字段条件
5
+ // 布尔类型条件
6
+ export type _BooleanCond<T> = {}
7
+
8
+ // 逻辑类型条件
9
+ export type _LogicalCond<T> = {}
10
+
11
+ // lookup 类型的条件,被改写为 number 或 仅包含 _id 属性的 object
12
+ type _LookupCond = number | { _id: number }
13
+
14
+ // 多值 lookup 类型的条件,改写为 number 或 仅包含 id 属性的 object 的数组
15
+ type _MultiLookupCond = _LookupCond[]
16
+
17
+ // 展开底层类型对象结构,在 Composite Type 的情况下,需要进行二次展开判断是否有单值或多值 Lookup
18
+ type PartialCompositeType<T> = Partial<{
19
+ [K in keyof T]: T[K] extends _LookupField[] ? _MultiLookupCond : T[K] extends _LookupField ? _LookupCond : Partial<T[K]>;
20
+ }>
21
+
22
+ // 字段条件,如果字段为 lookup 类型,则改写为 lookup cond,否则返回 Partial
23
+ type _FieldCond<T> = T extends _LookupField[] ? _MultiLookupCond : T extends _LookupField ? _LookupCond : PartialCompositeType<T>
24
+
25
+ // 第一层字段:需要提示出第二层 LookUp 的对象结构
26
+ type _FirstLevelFieldCond<T> = Partial<{
27
+ [K in keyof T]: T[K] extends _LookupField ? _FieldCond<T[K]> : T[K]
28
+ }>
29
+
30
+ // kunlun 的对象筛选条件,对象的每个字段可以传入 字段条件、布尔条件或者逻辑条件
31
+ type _KCond<T> = Partial<{
32
+ [K in keyof T]: _FieldCond<T[K]> | _BooleanCond<T[K]> | _LogicalCond<T[K]>
33
+ }>
34
+
35
+ // kunlun 的对象筛选条件,对象的每个字段可以传入 字段条件、布尔条件或者逻辑条件
36
+ type _WhereKCond<T> = Partial<{
37
+ [K in keyof T]: _FirstLevelFieldCond<T[K]> | _BooleanCond<T[K]> | _LogicalCond<T[K]>
38
+ }>
39
+
40
+ // 条件,可以传入一个 kunlun 的对象筛选条件 或者 一个逻辑条件
41
+ export type _Cond<T> = _KCond<T> | _LogicalCond<Partial<T>>;
42
+
43
+ // 筛选条件
44
+ export type _WhereCond<T> = _WhereKCond<T> | _LogicalCond<Partial<T>>;
45
+
46
+ // 返回记录,主要为了将 lookup 字段类型特化为特化结构
47
+ export type _Record<T> = {
48
+ [K in keyof T]: T[K] extends _LookupField ? _LookupFieldRet : T[K]
49
+ }
50
+
51
+ // 用于 update 和 delete 场景
52
+ export type _CondRequireID<T> = _Cond<T> & { _id: number }
53
+
54
+ interface _LookupFieldRet {
55
+ /**
56
+ * 名称:_id
57
+ *
58
+ * 类型:数字 / Number
59
+ *
60
+ * 格式:number
61
+ */
62
+ _id: number,
63
+ /**
64
+ * 名称:角色名 / _name
65
+ *
66
+ * 类型:文本 / Text | 多语 / Multilingual
67
+ *
68
+ * 格式:string | {language_code: 1033|2052, text: string}[]
69
+ */
70
+ _name: string | { language_code: 1033 | 2052, text: string }[],
71
+ is_deleted: boolean,
72
+ }
73
+
74
+ // lookup 类型字段的特征
75
+ interface _LookupField {
76
+ _id: number
77
+ }
78
+
79
+ import { metadataMap, currentObjApiName } from '../data/index'
80
+
81
+ /**
82
+ * target record 被使用于 workflow 场景下
83
+ */
84
+ export interface TargetRecord {
85
+ /**
86
+ * workflow 被触发时,原始的记录信息
87
+ */
88
+ original: metadataMap[currentObjApiName];
89
+ /**
90
+ * workflow 运行到当前位置的记录信息
91
+ */
92
+ proposed: metadataMap[currentObjApiName];
93
+ }
94
+
95
+ // trigger old
96
+ export interface TriggerOld {
97
+ /**
98
+ * 更新前的记录数据
99
+ */
100
+ old: metadataMap[currentObjApiName];
101
+ }
102
+
103
+ export interface TriggerNew {
104
+ /**
105
+ * 创建或更新后的记录数据
106
+ */
107
+ new: metadataMap[currentObjApiName];
108
+ }