@byted-apaas/server-sdk-node 0.0.2-beta.1

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 (215) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +1 -0
  3. package/application/application.d.ts +27 -0
  4. package/application/application.js +3 -0
  5. package/application/application.js.map +1 -0
  6. package/application/application.ts +40 -0
  7. package/application/function/function.d.ts +14 -0
  8. package/application/function/function.js +22 -0
  9. package/application/function/function.js.map +1 -0
  10. package/application/function/function.ts +37 -0
  11. package/application/impl/common.d.ts +2 -0
  12. package/application/impl/common.js +51 -0
  13. package/application/impl/common.js.map +1 -0
  14. package/application/impl/common.ts +50 -0
  15. package/application/impl/impl.d.ts +16 -0
  16. package/application/impl/impl.js +39 -0
  17. package/application/impl/impl.js.map +1 -0
  18. package/application/impl/impl.ts +48 -0
  19. package/constants/constants.d.ts +10 -0
  20. package/constants/constants.js +14 -0
  21. package/constants/constants.js.map +1 -0
  22. package/constants/constants.ts +12 -0
  23. package/context/context.d.ts +74 -0
  24. package/context/context.js +24 -0
  25. package/context/context.js.map +1 -0
  26. package/context/context.ts +127 -0
  27. package/context/db/db.d.ts +73 -0
  28. package/context/db/db.js +3 -0
  29. package/context/db/db.js.map +1 -0
  30. package/context/db/db.ts +77 -0
  31. package/context/db/impl/IObject.d.ts +251 -0
  32. package/context/db/impl/IObject.js +4 -0
  33. package/context/db/impl/IObject.js.map +1 -0
  34. package/context/db/impl/IObject.ts +244 -0
  35. package/context/db/impl/db.d.ts +61 -0
  36. package/context/db/impl/db.js +87 -0
  37. package/context/db/impl/db.js.map +1 -0
  38. package/context/db/impl/db.ts +95 -0
  39. package/context/db/impl/object.d.ts +92 -0
  40. package/context/db/impl/object.js +523 -0
  41. package/context/db/impl/object.js.map +1 -0
  42. package/context/db/impl/object.ts +628 -0
  43. package/context/db/impl/oql/ioql.d.ts +6 -0
  44. package/context/db/impl/oql/ioql.js +3 -0
  45. package/context/db/impl/oql/ioql.js.map +1 -0
  46. package/context/db/impl/oql/ioql.ts +6 -0
  47. package/context/db/impl/oql/oql.d.ts +8 -0
  48. package/context/db/impl/oql/oql.js +20 -0
  49. package/context/db/impl/oql/oql.js.map +1 -0
  50. package/context/db/impl/oql/oql.ts +22 -0
  51. package/context/db/impl/order.d.ts +9 -0
  52. package/context/db/impl/order.js +14 -0
  53. package/context/db/impl/order.js.map +1 -0
  54. package/context/db/impl/order.ts +16 -0
  55. package/context/db/impl/propertiesStore.d.ts +8 -0
  56. package/context/db/impl/propertiesStore.js +28 -0
  57. package/context/db/impl/propertiesStore.js.map +1 -0
  58. package/context/db/impl/propertiesStore.ts +28 -0
  59. package/context/db/impl/queryBuilder.d.ts +29 -0
  60. package/context/db/impl/queryBuilder.js +77 -0
  61. package/context/db/impl/queryBuilder.js.map +1 -0
  62. package/context/db/impl/queryBuilder.ts +103 -0
  63. package/context/db/impl/transaction/index.d.ts +20 -0
  64. package/context/db/impl/transaction/index.js +276 -0
  65. package/context/db/impl/transaction/index.js.map +1 -0
  66. package/context/db/impl/transaction/index.ts +337 -0
  67. package/context/db/impl/transaction/operation.d.ts +27 -0
  68. package/context/db/impl/transaction/operation.js +70 -0
  69. package/context/db/impl/transaction/operation.js.map +1 -0
  70. package/context/db/impl/transaction/operation.ts +72 -0
  71. package/context/db/impl/transaction.d.ts +67 -0
  72. package/context/db/impl/transaction.js +3 -0
  73. package/context/db/impl/transaction.js.map +1 -0
  74. package/context/db/impl/transaction.ts +76 -0
  75. package/context/globalConfig/globalConfig.d.ts +7 -0
  76. package/context/globalConfig/globalConfig.js +15 -0
  77. package/context/globalConfig/globalConfig.js.map +1 -0
  78. package/context/globalConfig/globalConfig.ts +11 -0
  79. package/context/metadata/components/common.d.ts +6 -0
  80. package/context/metadata/components/common.js +16 -0
  81. package/context/metadata/components/common.js.map +1 -0
  82. package/context/metadata/components/common.ts +19 -0
  83. package/context/metadata/components/components.d.ts +12 -0
  84. package/context/metadata/components/components.js +18 -0
  85. package/context/metadata/components/components.js.map +1 -0
  86. package/context/metadata/components/components.ts +19 -0
  87. package/context/metadata/components/desktop/list.d.ts +16 -0
  88. package/context/metadata/components/desktop/list.js +403 -0
  89. package/context/metadata/components/desktop/list.js.map +1 -0
  90. package/context/metadata/components/desktop/list.ts +457 -0
  91. package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
  92. package/context/metadata/components/desktop/recordDetail.js +52 -0
  93. package/context/metadata/components/desktop/recordDetail.js.map +1 -0
  94. package/context/metadata/components/desktop/recordDetail.ts +64 -0
  95. package/context/metadata/components/mobile/list.d.ts +24 -0
  96. package/context/metadata/components/mobile/list.js +144 -0
  97. package/context/metadata/components/mobile/list.js.map +1 -0
  98. package/context/metadata/components/mobile/list.ts +176 -0
  99. package/context/metadata/metadata.d.ts +61 -0
  100. package/context/metadata/metadata.js +102 -0
  101. package/context/metadata/metadata.js.map +1 -0
  102. package/context/metadata/metadata.ts +175 -0
  103. package/context/metadata/objects/fields.d.ts +130 -0
  104. package/context/metadata/objects/fields.js +333 -0
  105. package/context/metadata/objects/fields.js.map +1 -0
  106. package/context/metadata/objects/fields.ts +454 -0
  107. package/context/metadata/objects/fields.util.d.ts +40 -0
  108. package/context/metadata/objects/fields.util.js +320 -0
  109. package/context/metadata/objects/fields.util.js.map +1 -0
  110. package/context/metadata/objects/fields.util.ts +360 -0
  111. package/context/metadata/objects/objects.d.ts +11 -0
  112. package/context/metadata/objects/objects.js +19 -0
  113. package/context/metadata/objects/objects.js.map +1 -0
  114. package/context/metadata/objects/objects.ts +27 -0
  115. package/context/metadata/types/common.d.ts +6 -0
  116. package/context/metadata/types/common.js +8 -0
  117. package/context/metadata/types/common.js.map +1 -0
  118. package/context/metadata/types/common.ts +10 -0
  119. package/context/metadata/types/components.d.ts +90 -0
  120. package/context/metadata/types/components.js +3 -0
  121. package/context/metadata/types/components.js.map +1 -0
  122. package/context/metadata/types/components.ts +105 -0
  123. package/context/metadata/types/objects.d.ts +226 -0
  124. package/context/metadata/types/objects.js +3 -0
  125. package/context/metadata/types/objects.js.map +1 -0
  126. package/context/metadata/types/objects.ts +251 -0
  127. package/context/msg/msg.d.ts +38 -0
  128. package/context/msg/msg.js +34 -0
  129. package/context/msg/msg.js.map +1 -0
  130. package/context/msg/msg.ts +49 -0
  131. package/context/resources/IResources.d.ts +66 -0
  132. package/context/resources/IResources.js +3 -0
  133. package/context/resources/IResources.js.map +1 -0
  134. package/context/resources/IResources.ts +73 -0
  135. package/context/resources/impl/resources.d.ts +42 -0
  136. package/context/resources/impl/resources.js +149 -0
  137. package/context/resources/impl/resources.js.map +1 -0
  138. package/context/resources/impl/resources.ts +170 -0
  139. package/context/tasks/tasks.d.ts +33 -0
  140. package/context/tasks/tasks.js +140 -0
  141. package/context/tasks/tasks.js.map +1 -0
  142. package/context/tasks/tasks.ts +159 -0
  143. package/data/index.d.ts +27 -0
  144. package/data/index.js +5 -0
  145. package/data/index.js.map +1 -0
  146. package/data/index.ts +30 -0
  147. package/hooks/api.d.ts +61 -0
  148. package/hooks/api.js +328 -0
  149. package/hooks/api.js.map +1 -0
  150. package/hooks/api.ts +341 -0
  151. package/hooks/hooks.d.ts +1 -0
  152. package/hooks/hooks.js +89 -0
  153. package/hooks/hooks.js.map +1 -0
  154. package/hooks/hooks.ts +100 -0
  155. package/kunlun/kunlun.d.ts +55 -0
  156. package/kunlun/kunlun.js +57 -0
  157. package/kunlun/kunlun.js.map +1 -0
  158. package/kunlun/kunlun.ts +69 -0
  159. package/kunlun/operator/IOperator.d.ts +158 -0
  160. package/kunlun/operator/IOperator.js +3 -0
  161. package/kunlun/operator/IOperator.js.map +1 -0
  162. package/kunlun/operator/IOperator.ts +163 -0
  163. package/kunlun/operator/impl/expression.d.ts +47 -0
  164. package/kunlun/operator/impl/expression.js +55 -0
  165. package/kunlun/operator/impl/expression.js.map +1 -0
  166. package/kunlun/operator/impl/expression.ts +71 -0
  167. package/kunlun/operator/impl/logic.d.ts +50 -0
  168. package/kunlun/operator/impl/logic.js +508 -0
  169. package/kunlun/operator/impl/logic.js.map +1 -0
  170. package/kunlun/operator/impl/logic.ts +595 -0
  171. package/kunlun/operator/impl/logicV2.d.ts +58 -0
  172. package/kunlun/operator/impl/logicV2.js +201 -0
  173. package/kunlun/operator/impl/logicV2.js.map +1 -0
  174. package/kunlun/operator/impl/logicV2.ts +254 -0
  175. package/kunlun/operator/impl/operator.d.ts +179 -0
  176. package/kunlun/operator/impl/operator.js +221 -0
  177. package/kunlun/operator/impl/operator.js.map +1 -0
  178. package/kunlun/operator/impl/operator.ts +255 -0
  179. package/kunlun/operator/impl/operatorV2.d.ts +180 -0
  180. package/kunlun/operator/impl/operatorV2.js +217 -0
  181. package/kunlun/operator/impl/operatorV2.js.map +1 -0
  182. package/kunlun/operator/impl/operatorV2.ts +249 -0
  183. package/lib/core.d.ts +4 -0
  184. package/lib/core.js +18 -0
  185. package/lib/core.js.map +1 -0
  186. package/lib/core.ts +4 -0
  187. package/package.json +50 -0
  188. package/request/common.d.ts +13 -0
  189. package/request/common.js +88 -0
  190. package/request/common.js.map +1 -0
  191. package/request/common.ts +91 -0
  192. package/request/constants.d.ts +10 -0
  193. package/request/constants.js +26 -0
  194. package/request/constants.js.map +1 -0
  195. package/request/constants.ts +25 -0
  196. package/request/faasinfra.d.ts +8 -0
  197. package/request/faasinfra.js +359 -0
  198. package/request/faasinfra.js.map +1 -0
  199. package/request/faasinfra.ts +393 -0
  200. package/request/innerapi.d.ts +67 -0
  201. package/request/innerapi.js +1411 -0
  202. package/request/innerapi.js.map +1 -0
  203. package/request/innerapi.ts +1645 -0
  204. package/request/interface.d.ts +95 -0
  205. package/request/interface.js +40 -0
  206. package/request/interface.js.map +1 -0
  207. package/request/interface.ts +166 -0
  208. package/request/openapi.d.ts +69 -0
  209. package/request/openapi.js +1013 -0
  210. package/request/openapi.js.map +1 -0
  211. package/request/openapi.ts +1220 -0
  212. package/types/types.d.ts +79 -0
  213. package/types/types.js +3 -0
  214. package/types/types.js.map +1 -0
  215. package/types/types.ts +105 -0
@@ -0,0 +1,61 @@
1
+ import { _IKAllEndpoint, _IKSyncEndpoint, _IKQuery } from './IObject';
2
+ import { ITransactionGetter } from './transaction';
3
+ import { IDB, IDBSync, IDBWithCurrentObject } from '../db';
4
+ import { currentObjApiName, metadataMap } from '../../../data/index';
5
+ import { IOql } from "./oql/ioql";
6
+ import { AppCtx } from "../../../application/application";
7
+ export declare class DB<T, mt = metadataMap> implements IDB<T, mt> {
8
+ objectApiName: string;
9
+ constructor(objectApiName?: string);
10
+ /**
11
+ * 操作指定对象的记录数据
12
+ * @param objectApiName 指定对象的 ApiName
13
+ * @example
14
+ * ```
15
+ * context.db.object("_user").where({
16
+ * gender: "male"
17
+ * }).find()
18
+ * ```
19
+ */
20
+ object<K extends keyof mt>(objectApiName: K): _IKAllEndpoint<mt[K]> & _IKQuery<mt[K]>;
21
+ /**
22
+ * 创建一个新的空事务
23
+ * @example
24
+ * ```
25
+ * let tx = context.db.newTransaction();
26
+ * let user = tx.object("_user").registerCreate({
27
+ * _name: new kunlun.type.Multilingual({ zh: "用户1", en: "user1" }),
28
+ * });
29
+ * let contract = tx.object("contract").registerCreate({
30
+ * _name: new kunlun.type.Multilingual({ zh: "用户1的合同", en: "user1's contract" }),
31
+ * user: {id: user._id}
32
+ * });
33
+ * await tx.commit();
34
+ * ```
35
+ */
36
+ newTransaction(): ITransactionGetter<T, mt>;
37
+ /**
38
+ * OQL 操作
39
+ * @param oql 指定 OQL 语句
40
+ * @example
41
+ * ```
42
+ * let users = await context.db.oql("select _email from _user").execute();
43
+ * ```
44
+ */
45
+ oql(oql: string): IOql;
46
+ }
47
+ export declare class DBWithCurrentObject<T, mt = metadataMap> extends DB<T, mt> implements IDB<T, mt>, IDBWithCurrentObject<T, mt> {
48
+ /**
49
+ * 无需入参,操作当前对象的记录数据
50
+ */
51
+ currentObject(): _IKAllEndpoint<mt[currentObjApiName]> & _IKQuery<mt[currentObjApiName]>;
52
+ constructor(objectApiName: string);
53
+ }
54
+ /**
55
+ * ApplicationDB: 用于支持 OpenSDK 相关能力的 DB 相关类,目前仅实现 DB 同步操作接口
56
+ */
57
+ export declare class ApplicationDB implements IDBSync {
58
+ appCtx: AppCtx;
59
+ constructor(appCtx: AppCtx);
60
+ object(objectApiName: string): _IKSyncEndpoint<{}> & _IKQuery<{}>;
61
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationDB = exports.DBWithCurrentObject = exports.DB = void 0;
4
+ const object_1 = require("./object");
5
+ const server_common_node_1 = require("@byted-apaas/server-common-node");
6
+ const index_1 = require("./transaction/index");
7
+ const oql_1 = require("./oql/oql");
8
+ class DB {
9
+ constructor(objectApiName) {
10
+ this.objectApiName = objectApiName;
11
+ }
12
+ /**
13
+ * 操作指定对象的记录数据
14
+ * @param objectApiName 指定对象的 ApiName
15
+ * @example
16
+ * ```
17
+ * context.db.object("_user").where({
18
+ * gender: "male"
19
+ * }).find()
20
+ * ```
21
+ */
22
+ object(objectApiName) {
23
+ return new object_1._KObject(objectApiName);
24
+ }
25
+ ;
26
+ /**
27
+ * 创建一个新的空事务
28
+ * @example
29
+ * ```
30
+ * let tx = context.db.newTransaction();
31
+ * let user = tx.object("_user").registerCreate({
32
+ * _name: new kunlun.type.Multilingual({ zh: "用户1", en: "user1" }),
33
+ * });
34
+ * let contract = tx.object("contract").registerCreate({
35
+ * _name: new kunlun.type.Multilingual({ zh: "用户1的合同", en: "user1's contract" }),
36
+ * user: {id: user._id}
37
+ * });
38
+ * await tx.commit();
39
+ * ```
40
+ */
41
+ newTransaction() {
42
+ return new index_1.Transaction(this.objectApiName);
43
+ }
44
+ ;
45
+ /**
46
+ * OQL 操作
47
+ * @param oql 指定 OQL 语句
48
+ * @example
49
+ * ```
50
+ * let users = await context.db.oql("select _email from _user").execute();
51
+ * ```
52
+ */
53
+ oql(oql) {
54
+ return new oql_1.Oql(oql);
55
+ }
56
+ }
57
+ exports.DB = DB;
58
+ class DBWithCurrentObject extends DB {
59
+ /**
60
+ * 无需入参,操作当前对象的记录数据
61
+ */
62
+ // @ts-ignore
63
+ currentObject() {
64
+ if (!this.objectApiName) {
65
+ throw new server_common_node_1.exceptions.InternalError(`context.objectApiName is empty`);
66
+ }
67
+ return new object_1._KObject(this.objectApiName);
68
+ }
69
+ ;
70
+ constructor(objectApiName) {
71
+ super(objectApiName);
72
+ }
73
+ }
74
+ exports.DBWithCurrentObject = DBWithCurrentObject;
75
+ /**
76
+ * ApplicationDB: 用于支持 OpenSDK 相关能力的 DB 相关类,目前仅实现 DB 同步操作接口
77
+ */
78
+ class ApplicationDB {
79
+ constructor(appCtx) {
80
+ this.appCtx = appCtx;
81
+ }
82
+ object(objectApiName) {
83
+ return new object_1._KApplicationObject(objectApiName, this.appCtx);
84
+ }
85
+ }
86
+ exports.ApplicationDB = ApplicationDB;
87
+ //# sourceMappingURL=db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.js","sourceRoot":"","sources":["db.ts"],"names":[],"mappings":";;;AAAA,qCAAwD;AAKxD,wEAA4D;AAC5D,+CAAiD;AAEjD,mCAAgC;AAGhC,MAAa,EAAE;IAGX,YAAY,aAAsB;QAC9B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACtC,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAqB,aAAgB;QACvC,OAAO,IAAI,iBAAQ,CAAQ,aAAuB,CAAC,CAAA;IACvD,CAAC;IAAA,CAAC;IAEF;;;;;;;;;;;;;;OAcG;IACH,cAAc;QACV,OAAO,IAAI,mBAAW,CAAC,IAAI,CAAC,aAAa,CAAyC,CAAA;IACtF,CAAC;IAAA,CAAC;IAEF;;;;;;;OAOG;IACH,GAAG,CAAC,GAAW;QACX,OAAO,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CACJ;AAnDD,gBAmDC;AAED,MAAa,mBAAyC,SAAQ,EAAS;IACnE;;OAEG;IACH,aAAa;IACb,aAAa;QACT,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACrB,MAAM,IAAI,+BAAU,CAAC,aAAa,CAAC,gCAAgC,CAAC,CAAC;SACxE;QACD,OAAO,IAAI,iBAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5C,CAAC;IAAA,CAAC;IAEF,YAAY,aAAqB;QAC7B,KAAK,CAAC,aAAa,CAAC,CAAA;IACxB,CAAC;CACJ;AAfD,kDAeC;AAED;;GAEG;AACH,MAAa,aAAa;IAGtB,YAAY,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,MAAM,CAAC,aAAqB;QACxB,OAAO,IAAI,4BAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;CACJ;AAVD,sCAUC"}
@@ -0,0 +1,95 @@
1
+ import { _KObject, _KApplicationObject } from './object'
2
+ import { _IKAllEndpoint, _IKSyncEndpoint, _IKQuery } from './IObject'
3
+ import { ITransactionGetter } from './transaction'
4
+ import { IDB, IDBSync, IDBWithCurrentObject } from '../db'
5
+ import { currentObjApiName, metadataMap } from '../../../data/index'
6
+ import { exceptions } from '@byted-apaas/server-common-node'
7
+ import { Transaction } from './transaction/index'
8
+ import { IOql } from "./oql/ioql";
9
+ import { Oql } from "./oql/oql";
10
+ import { AppCtx } from "../../../application/application";
11
+
12
+ export class DB<T, mt = metadataMap> implements IDB<T, mt> {
13
+ objectApiName: string
14
+
15
+ constructor(objectApiName?: string) {
16
+ this.objectApiName = objectApiName
17
+ }
18
+
19
+ /**
20
+ * 操作指定对象的记录数据
21
+ * @param objectApiName 指定对象的 ApiName
22
+ * @example
23
+ * ```
24
+ * context.db.object("_user").where({
25
+ * gender: "male"
26
+ * }).find()
27
+ * ```
28
+ */
29
+ object<K extends keyof mt>(objectApiName: K): _IKAllEndpoint<mt[K]> & _IKQuery<mt[K]> {
30
+ return new _KObject<mt[K]>(objectApiName as string)
31
+ };
32
+
33
+ /**
34
+ * 创建一个新的空事务
35
+ * @example
36
+ * ```
37
+ * let tx = context.db.newTransaction();
38
+ * let user = tx.object("_user").registerCreate({
39
+ * _name: new kunlun.type.Multilingual({ zh: "用户1", en: "user1" }),
40
+ * });
41
+ * let contract = tx.object("contract").registerCreate({
42
+ * _name: new kunlun.type.Multilingual({ zh: "用户1的合同", en: "user1's contract" }),
43
+ * user: {id: user._id}
44
+ * });
45
+ * await tx.commit();
46
+ * ```
47
+ */
48
+ newTransaction(): ITransactionGetter<T, mt> {
49
+ return new Transaction(this.objectApiName) as unknown as ITransactionGetter<T, mt>
50
+ };
51
+
52
+ /**
53
+ * OQL 操作
54
+ * @param oql 指定 OQL 语句
55
+ * @example
56
+ * ```
57
+ * let users = await context.db.oql("select _email from _user").execute();
58
+ * ```
59
+ */
60
+ oql(oql: string): IOql {
61
+ return new Oql(oql);
62
+ }
63
+ }
64
+
65
+ export class DBWithCurrentObject<T, mt = metadataMap> extends DB<T, mt> implements IDB<T, mt>, IDBWithCurrentObject<T, mt> {
66
+ /**
67
+ * 无需入参,操作当前对象的记录数据
68
+ */
69
+ // @ts-ignore
70
+ currentObject(): _IKAllEndpoint<mt[currentObjApiName]> & _IKQuery<mt[currentObjApiName]> {
71
+ if (!this.objectApiName) {
72
+ throw new exceptions.InternalError(`context.objectApiName is empty`);
73
+ }
74
+ return new _KObject(this.objectApiName);
75
+ };
76
+
77
+ constructor(objectApiName: string) {
78
+ super(objectApiName)
79
+ }
80
+ }
81
+
82
+ /**
83
+ * ApplicationDB: 用于支持 OpenSDK 相关能力的 DB 相关类,目前仅实现 DB 同步操作接口
84
+ */
85
+ export class ApplicationDB implements IDBSync {
86
+ appCtx: AppCtx
87
+
88
+ constructor(appCtx: AppCtx) {
89
+ this.appCtx = appCtx
90
+ }
91
+
92
+ object(objectApiName: string): _IKSyncEndpoint<{}> & _IKQuery<{}> {
93
+ return new _KApplicationObject(objectApiName, this.appCtx);
94
+ }
95
+ }
@@ -0,0 +1,92 @@
1
+ import { _Cond, _Record, _WhereCond } from '../../../types/types';
2
+ import { _IKAsyncEndpoint, _IKQuery, _IKSyncEndpoint } from './IObject';
3
+ import { AppCtx } from '../../../application/application';
4
+ /**
5
+ * _KObject is kunlun object, every method new a _KQuery object to deal.
6
+ */
7
+ export interface _KObject<T> extends _KObjectSync<T>, _KObjectAsync<T>, _KObjectQuery<T> {
8
+ }
9
+ export declare class _KObject<T> {
10
+ apiName: string;
11
+ constructor(objectApiName: string);
12
+ }
13
+ /**
14
+ * _KApplicationObject is open sdk object implement.
15
+ */
16
+ export interface _KApplicationObject<T> extends _KObjectSync<T>, _KObjectQuery<T> {
17
+ }
18
+ export declare class _KApplicationObject<T> {
19
+ apiName: string;
20
+ appCtx: AppCtx;
21
+ constructor(objectApiName: string, appCtx: AppCtx);
22
+ }
23
+ declare class _KObjectSync<T> implements _IKSyncEndpoint<T> {
24
+ apiName: string;
25
+ appCtx: AppCtx;
26
+ create(recordMap: _Cond<T>): Promise<{
27
+ _id: number;
28
+ }>;
29
+ delete(recordID: number): Promise<void>;
30
+ delete(record: _Cond<T>): Promise<void>;
31
+ update(_id: number, recordMap: _Cond<T>): Promise<void>;
32
+ update(recordMap: _Cond<T>): Promise<void>;
33
+ batchCreate(recordMapList: _Cond<T>[]): Promise<number[]>;
34
+ batchDelete(recordIdList: number[]): Promise<void>;
35
+ batchDelete(recordList: _Cond<T>[]): Promise<void>;
36
+ batchUpdate(recordMapList: _Cond<T>[]): Promise<void>;
37
+ }
38
+ declare class _KObjectAsync<T> implements _IKAsyncEndpoint<T> {
39
+ apiName: string;
40
+ batchCreateAsync(recordMapList: _Cond<T>[]): Promise<{
41
+ taskID: number;
42
+ }>;
43
+ batchDeleteAsync(recordIDList: number[]): Promise<{
44
+ taskID: number;
45
+ }>;
46
+ batchDeleteAsync(recordList: _Cond<T>[]): Promise<{
47
+ taskID: number;
48
+ }>;
49
+ batchUpdateAsync(recordMapList: _Cond<T>[]): Promise<{
50
+ taskID: number;
51
+ }>;
52
+ }
53
+ declare class _KObjectQuery<T> implements _IKQuery<T> {
54
+ apiName: string;
55
+ appCtx: AppCtx;
56
+ find(): Promise<_Record<T>[]>;
57
+ findOne(): Promise<_Record<T>>;
58
+ findAll(): Promise<_Record<T>[]>;
59
+ orderBy<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
60
+ orderBy<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
61
+ orderByDesc<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
62
+ orderByDesc<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
63
+ select<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
64
+ select<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
65
+ where(conditionMap: _WhereCond<T>): _KQuery<T>;
66
+ where(): _KQuery<T>;
67
+ limit(limit: number): _KQuery<T>;
68
+ offset(offset: number): _KQuery<T>;
69
+ count(): Promise<number>;
70
+ }
71
+ /**
72
+ * _KQuery is kunlun query implement, implements ORM operations.
73
+ */
74
+ declare class _KQuery<T> implements _IKQuery<T> {
75
+ constructor(objectApiName: string, appCtx?: AppCtx);
76
+ find(): Promise<_Record<T>[]>;
77
+ findOne(): Promise<_Record<T>>;
78
+ findAll(): Promise<_Record<T>[]>;
79
+ private getRecordsByPage;
80
+ orderBy<K extends keyof T>(fieldApiNames: K[]): this;
81
+ orderBy<K extends keyof T>(...fieldApiNames: K[]): this;
82
+ orderByDesc<K extends keyof T>(fieldApiNames: K[]): this;
83
+ orderByDesc<K extends keyof T>(...fieldApiNames: K[]): this;
84
+ select<K extends keyof T>(fieldApiNames: K[]): this;
85
+ select<K extends keyof T>(...fieldApiNames: K[]): this;
86
+ where(conditionMap: _WhereCond<T>): this;
87
+ where(): this;
88
+ limit(limit: number): this;
89
+ offset(offset: number): this;
90
+ count(): Promise<number>;
91
+ }
92
+ export {};