@byted-apaas/server-sdk-node 1.1.23 → 1.1.24

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 (131) hide show
  1. package/application/application.d.ts +33 -0
  2. package/application/application.js +2 -0
  3. package/application/function/function.d.ts +14 -0
  4. package/application/function/function.js +20 -0
  5. package/application/impl/common.d.ts +2 -0
  6. package/application/impl/common.js +52 -0
  7. package/application/impl/impl.d.ts +19 -0
  8. package/application/impl/impl.js +45 -0
  9. package/common/structs.d.ts +15 -0
  10. package/common/structs.js +21 -0
  11. package/constants/constants.d.ts +13 -0
  12. package/constants/constants.js +18 -0
  13. package/context/context.d.ts +44 -0
  14. package/context/context.js +25 -0
  15. package/context/db/db.d.ts +110 -0
  16. package/context/db/db.js +2 -0
  17. package/context/db/impl/IObject.d.ts +303 -0
  18. package/context/db/impl/IObject.js +5 -0
  19. package/context/db/impl/IObjectV3.d.ts +239 -0
  20. package/context/db/impl/IObjectV3.js +5 -0
  21. package/context/db/impl/db.d.ts +62 -0
  22. package/context/db/impl/db.js +84 -0
  23. package/context/db/impl/dbV3.d.ts +35 -0
  24. package/context/db/impl/dbV3.js +50 -0
  25. package/context/db/impl/object.d.ts +123 -0
  26. package/context/db/impl/object.js +1008 -0
  27. package/context/db/impl/oql/ioql.d.ts +14 -0
  28. package/context/db/impl/oql/ioql.js +4 -0
  29. package/context/db/impl/oql/oql.d.ts +14 -0
  30. package/context/db/impl/oql/oql.js +39 -0
  31. package/context/db/impl/order.d.ts +9 -0
  32. package/context/db/impl/order.js +15 -0
  33. package/context/db/impl/propertiesStore.d.ts +8 -0
  34. package/context/db/impl/propertiesStore.js +29 -0
  35. package/context/db/impl/queryBuilder.d.ts +33 -0
  36. package/context/db/impl/queryBuilder.js +72 -0
  37. package/context/db/impl/transaction/index.d.ts +25 -0
  38. package/context/db/impl/transaction/index.js +300 -0
  39. package/context/db/impl/transaction/operation.d.ts +27 -0
  40. package/context/db/impl/transaction/operation.js +69 -0
  41. package/context/db/impl/transaction.d.ts +70 -0
  42. package/context/db/impl/transaction.js +4 -0
  43. package/context/globalConfig/globalConfig.d.ts +7 -0
  44. package/context/globalConfig/globalConfig.js +16 -0
  45. package/context/integration/IIntegration.d.ts +30 -0
  46. package/context/integration/IIntegration.js +4 -0
  47. package/context/integration/impl/integration.d.ts +16 -0
  48. package/context/integration/impl/integration.js +62 -0
  49. package/context/metadata/components/common.d.ts +6 -0
  50. package/context/metadata/components/common.js +17 -0
  51. package/context/metadata/components/components.d.ts +12 -0
  52. package/context/metadata/components/components.js +19 -0
  53. package/context/metadata/components/desktop/list.d.ts +16 -0
  54. package/context/metadata/components/desktop/list.js +402 -0
  55. package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
  56. package/context/metadata/components/desktop/recordDetail.js +53 -0
  57. package/context/metadata/components/mobile/list.d.ts +24 -0
  58. package/context/metadata/components/mobile/list.js +145 -0
  59. package/context/metadata/metadata.d.ts +63 -0
  60. package/context/metadata/metadata.js +125 -0
  61. package/context/metadata/objects/fields.d.ts +158 -0
  62. package/context/metadata/objects/fields.js +369 -0
  63. package/context/metadata/objects/fields.util.d.ts +52 -0
  64. package/context/metadata/objects/fields.util.js +420 -0
  65. package/context/metadata/objects/fieldsV3.d.ts +159 -0
  66. package/context/metadata/objects/fieldsV3.js +369 -0
  67. package/context/metadata/objects/objects.d.ts +11 -0
  68. package/context/metadata/objects/objects.js +20 -0
  69. package/context/metadata/types/common.d.ts +11 -0
  70. package/context/metadata/types/common.js +33 -0
  71. package/context/metadata/types/components.d.ts +90 -0
  72. package/context/metadata/types/components.js +4 -0
  73. package/context/metadata/types/objects.d.ts +246 -0
  74. package/context/metadata/types/objects.js +4 -0
  75. package/context/metadata/types/objectsV3.d.ts +128 -0
  76. package/context/metadata/types/objectsV3.js +4 -0
  77. package/context/msg/msg.d.ts +38 -0
  78. package/context/msg/msg.js +35 -0
  79. package/context/resources/IResources.d.ts +68 -0
  80. package/context/resources/IResources.js +2 -0
  81. package/context/resources/impl/resources.d.ts +42 -0
  82. package/context/resources/impl/resources.js +161 -0
  83. package/context/tasks/tasks.d.ts +33 -0
  84. package/context/tasks/tasks.js +139 -0
  85. package/data/index.d.ts +27 -0
  86. package/data/index.js +4 -0
  87. package/global/application/flow/flow.d.ts +99 -0
  88. package/global/application/flow/flow.js +8 -0
  89. package/global/application/flow/impl/flow.d.ts +20 -0
  90. package/global/application/flow/impl/flow.js +56 -0
  91. package/global/application/globalVar/globalVar.d.ts +7 -0
  92. package/global/application/globalVar/globalVar.js +2 -0
  93. package/global/global.d.ts +70 -0
  94. package/global/global.js +3 -0
  95. package/hooks/api.d.ts +65 -0
  96. package/hooks/api.js +347 -0
  97. package/hooks/hooks.d.ts +1 -0
  98. package/hooks/hooks.js +107 -0
  99. package/kunlun/kunlun.d.ts +55 -0
  100. package/kunlun/kunlun.js +58 -0
  101. package/kunlun/operator/IOperator.d.ts +158 -0
  102. package/kunlun/operator/IOperator.js +4 -0
  103. package/kunlun/operator/impl/expression.d.ts +75 -0
  104. package/kunlun/operator/impl/expression.js +96 -0
  105. package/kunlun/operator/impl/logic.d.ts +68 -0
  106. package/kunlun/operator/impl/logic.js +573 -0
  107. package/kunlun/operator/impl/logicV2.d.ts +59 -0
  108. package/kunlun/operator/impl/logicV2.js +197 -0
  109. package/kunlun/operator/impl/operator.d.ts +179 -0
  110. package/kunlun/operator/impl/operator.js +222 -0
  111. package/kunlun/operator/impl/operatorV2.d.ts +180 -0
  112. package/kunlun/operator/impl/operatorV2.js +216 -0
  113. package/lib/core.d.ts +4 -0
  114. package/lib/core.js +19 -0
  115. package/package.json +1 -1
  116. package/request/common.d.ts +13 -0
  117. package/request/common.js +88 -0
  118. package/request/constants.d.ts +12 -0
  119. package/request/constants.js +29 -0
  120. package/request/faasinfra.d.ts +8 -0
  121. package/request/faasinfra.js +146 -0
  122. package/request/interface.d.ts +121 -0
  123. package/request/interface.js +30 -0
  124. package/request/openapi.d.ts +84 -0
  125. package/request/openapi.js +1529 -0
  126. package/request/structs.d.ts +99 -0
  127. package/request/structs.js +15 -0
  128. package/types/types.d.ts +79 -0
  129. package/types/types.js +4 -0
  130. package/version/version.d.ts +2 -0
  131. package/version/version.js +8 -0
@@ -0,0 +1,35 @@
1
+ import { ITransactionGetter } from './transaction';
2
+ import { IDBV3 } from '../db';
3
+ import { metadataMap } from '../../../data/index';
4
+ import { _IKAllEndpointV3, _IKQueryV3 } from './IObjectV3';
5
+ export declare class DBV3<T, mt = metadataMap> implements IDBV3<T, mt> {
6
+ objectApiName: string;
7
+ constructor(objectApiName?: string);
8
+ /**
9
+ * 操作指定对象的记录数据
10
+ * @param objectApiName 指定对象的 ApiName
11
+ * @example
12
+ * ```
13
+ * context.db.object('_user').where({
14
+ * gender: 'male'
15
+ * }).find()
16
+ * ```
17
+ */
18
+ object<K extends keyof mt>(objectApiName: K): _IKAllEndpointV3<mt[K]> & _IKQueryV3<mt[K]>;
19
+ /**
20
+ * 创建一个新的空事务
21
+ * @example
22
+ * ```
23
+ * let tx = context.db.newTransaction();
24
+ * let user = tx.object('_user').registerCreate({
25
+ * _name: new kunlun.type.Multilingual({ zh: '用户1', en: 'user1' }),
26
+ * });
27
+ * let contract = tx.object('contract').registerCreate({
28
+ * _name: new kunlun.type.Multilingual({ zh: '用户1的合同', en: 'user1's contract' }),
29
+ * user: {id: user._id}
30
+ * });
31
+ * await tx.commit();
32
+ * ```
33
+ */
34
+ newTransaction(): ITransactionGetter<T, mt>;
35
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DBV3 = void 0;
4
+ const object_1 = require("./object");
5
+ const index_1 = require("./transaction/index");
6
+ class DBV3 {
7
+ constructor(objectApiName) {
8
+ this.objectApiName = objectApiName;
9
+ }
10
+ /**
11
+ * 操作指定对象的记录数据
12
+ * @param objectApiName 指定对象的 ApiName
13
+ * @example
14
+ * ```
15
+ * context.db.object('_user').where({
16
+ * gender: 'male'
17
+ * }).find()
18
+ * ```
19
+ */
20
+ object(objectApiName) {
21
+ const appCtx = {
22
+ dataVersion: 'v3',
23
+ };
24
+ return new object_1._KObject(objectApiName, appCtx);
25
+ }
26
+ ;
27
+ /**
28
+ * 创建一个新的空事务
29
+ * @example
30
+ * ```
31
+ * let tx = context.db.newTransaction();
32
+ * let user = tx.object('_user').registerCreate({
33
+ * _name: new kunlun.type.Multilingual({ zh: '用户1', en: 'user1' }),
34
+ * });
35
+ * let contract = tx.object('contract').registerCreate({
36
+ * _name: new kunlun.type.Multilingual({ zh: '用户1的合同', en: 'user1's contract' }),
37
+ * user: {id: user._id}
38
+ * });
39
+ * await tx.commit();
40
+ * ```
41
+ */
42
+ newTransaction() {
43
+ const appCtx = {
44
+ dataVersion: 'v3',
45
+ };
46
+ return new index_1.Transaction(this.objectApiName, appCtx);
47
+ }
48
+ ;
49
+ }
50
+ exports.DBV3 = DBV3;
@@ -0,0 +1,123 @@
1
+ import { _Cond, _Record, _WhereCond } from '../../../types/types';
2
+ import { _IKAsyncEndpoint, _IKQuery, _IKSyncEndpoint } from './IObject';
3
+ import { AppCtx } from '../../../application/application';
4
+ import { BatchResult } from '../../../common/structs';
5
+ import { _IKQueryV3, _IKSyncEndpointV3 } from './IObjectV3';
6
+ /**
7
+ * _KObject is kunlun object, every method new a _KQuery object to deal.
8
+ */
9
+ export interface _KObject<T> extends _KObjectSync<T>, _KObjectAsync<T>, _KObjectQuery<T> {
10
+ }
11
+ export declare class _KObject<T> {
12
+ apiName: string;
13
+ constructor(objectApiName: string, appCtx?: AppCtx);
14
+ }
15
+ /**
16
+ * _KApplicationObject is open sdk object implement.
17
+ */
18
+ export interface _KApplicationObject<T> extends _KObjectSync<T>, _KObjectQuery<T> {
19
+ }
20
+ export declare class _KApplicationObject<T> {
21
+ apiName: string;
22
+ appCtx: AppCtx;
23
+ constructor(objectApiName: string, appCtx: AppCtx);
24
+ }
25
+ declare class _KObjectSync<T> implements _IKSyncEndpoint<T>, _IKSyncEndpointV3<T> {
26
+ apiName: string;
27
+ appCtx: AppCtx;
28
+ authType: string;
29
+ create(recordMap: _Cond<T>): Promise<{
30
+ _id: number | string;
31
+ }>;
32
+ delete(recordID: number | string): Promise<void>;
33
+ delete(record: _Cond<T>): Promise<void>;
34
+ private deleteV3;
35
+ update(_id: number | string, recordMap: _Cond<T>): Promise<void>;
36
+ update(recordMap: _Cond<T>): Promise<void>;
37
+ private updateV3;
38
+ batchCreate(recordMapList: _Cond<T>[]): Promise<number[] | string[]>;
39
+ private batchCreateV3;
40
+ batchDelete(recordIdList: string[]): Promise<BatchResult>;
41
+ batchDelete(recordIdList: number[]): Promise<BatchResult>;
42
+ batchDelete(recordList: _Cond<T>[]): Promise<BatchResult>;
43
+ private batchDeleteV3;
44
+ batchUpdate(recordMapList: _Cond<T>[]): Promise<BatchResult>;
45
+ private batchUpdateV3;
46
+ useUserAuth(): this;
47
+ useSystemAuth(): this;
48
+ }
49
+ declare class _KObjectAsync<T> implements _IKAsyncEndpoint<T> {
50
+ apiName: string;
51
+ authType: string;
52
+ batchCreateAsync(recordMapList: _Cond<T>[]): Promise<{
53
+ taskID: number;
54
+ }>;
55
+ batchDeleteAsync(recordIDList: number[]): Promise<{
56
+ taskID: number;
57
+ }>;
58
+ batchDeleteAsync(recordList: _Cond<T>[]): Promise<{
59
+ taskID: number;
60
+ }>;
61
+ batchUpdateAsync(recordMapList: _Cond<T>[]): Promise<{
62
+ taskID: number;
63
+ }>;
64
+ useUserAuth(): this;
65
+ useSystemAuth(): this;
66
+ }
67
+ declare class _KObjectQuery<T> implements _IKQuery<T>, _IKQueryV3<T> {
68
+ apiName: string;
69
+ appCtx: AppCtx;
70
+ authType: string;
71
+ find(): Promise<_Record<T>[]>;
72
+ findOne(): Promise<_Record<T>>;
73
+ findAll(): Promise<_Record<T>[]>;
74
+ findStream(handler: (records: object[]) => Promise<void>): Promise<void>;
75
+ orderBy<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
76
+ orderBy<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
77
+ orderByDesc<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
78
+ orderByDesc<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
79
+ select<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
80
+ select<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
81
+ where(conditionMap: _WhereCond<T>): _KQuery<T>;
82
+ where(): _KQuery<T>;
83
+ fuzzySearch(keyword: string, fieldAPINames: string[]): _KQuery<T>;
84
+ limit(limit: number): _KQuery<T>;
85
+ offset(offset: number): _KQuery<T>;
86
+ count(): Promise<number>;
87
+ useSystemAuth(): this;
88
+ useUserAuth(): this;
89
+ }
90
+ /**
91
+ * _KQuery is kunlun query implement, implements ORM operations.
92
+ */
93
+ declare class _KQuery<T> implements _IKQuery<T>, _IKQueryV3<T> {
94
+ private authType;
95
+ constructor(objectApiName: string, appCtx?: AppCtx, authType?: string);
96
+ find(): Promise<_Record<T>[]>;
97
+ findOne(): Promise<_Record<T>>;
98
+ /**
99
+ * @Deprecated Use FindStream instead.
100
+ */
101
+ findAll(): Promise<_Record<T>[]>;
102
+ findStream(handler: (records: object[]) => Promise<void>, pageLimit?: number): Promise<void>;
103
+ private walkRecordsByID;
104
+ private walkRecordsByLimitOffset;
105
+ private getRecordsByPage;
106
+ orderBy<K extends keyof T>(fieldApiNames: K[]): this;
107
+ orderBy<K extends keyof T>(...fieldApiNames: K[]): this;
108
+ orderByDesc<K extends keyof T>(fieldApiNames: K[]): this;
109
+ orderByDesc<K extends keyof T>(...fieldApiNames: K[]): this;
110
+ select<K extends keyof T>(fieldApiNames: K[]): this;
111
+ select<K extends keyof T>(...fieldApiNames: K[]): this;
112
+ where(conditionMap: _WhereCond<T>): this;
113
+ where(): this;
114
+ fuzzySearch(keyword: string, fieldAPINames: string[]): this;
115
+ limit(limit: number): this;
116
+ offset(offset: number): this;
117
+ count(): Promise<number>;
118
+ private findV3;
119
+ private findPreCheck;
120
+ useSystemAuth(): this;
121
+ useUserAuth(): this;
122
+ }
123
+ export {};