@byted-apaas/server-sdk-node 0.0.2-beta.1 → 0.0.2-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.
- package/LICENSE +7 -0
- package/NOTICE +3 -0
- package/application/application.js +0 -1
- package/application/function/function.js +0 -1
- package/application/impl/common.js +0 -1
- package/application/impl/impl.js +2 -2
- package/constants/constants.js +2 -1
- package/context/context.js +2 -1
- package/context/db/db.js +2 -1
- package/context/db/impl/IObject.js +2 -1
- package/context/db/impl/db.js +0 -1
- package/context/db/impl/object.js +2 -1
- package/context/db/impl/oql/ioql.js +2 -1
- package/context/db/impl/oql/oql.js +2 -1
- package/context/db/impl/order.js +2 -1
- package/context/db/impl/propertiesStore.js +2 -1
- package/context/db/impl/queryBuilder.js +2 -1
- package/context/db/impl/transaction/index.js +2 -1
- package/context/db/impl/transaction/operation.js +0 -1
- package/context/db/impl/transaction.js +2 -1
- package/context/globalConfig/globalConfig.js +2 -1
- package/context/metadata/components/common.js +2 -1
- package/context/metadata/components/components.js +2 -1
- package/context/metadata/components/desktop/list.js +0 -1
- package/context/metadata/components/desktop/recordDetail.js +2 -1
- package/context/metadata/components/mobile/list.js +2 -1
- package/context/metadata/metadata.js +2 -1
- package/context/metadata/objects/fields.js +2 -1
- package/context/metadata/objects/fields.util.js +0 -1
- package/context/metadata/objects/objects.js +2 -1
- package/context/metadata/types/common.js +2 -1
- package/context/metadata/types/components.js +2 -1
- package/context/metadata/types/objects.js +2 -1
- package/context/msg/msg.js +2 -1
- package/context/resources/IResources.js +0 -1
- package/context/resources/impl/resources.js +2 -1
- package/context/tasks/tasks.js +0 -1
- package/data/index.js +0 -1
- package/hooks/api.js +0 -1
- package/hooks/hooks.js +0 -1
- package/kunlun/kunlun.js +2 -1
- package/kunlun/operator/IOperator.js +2 -1
- package/kunlun/operator/impl/expression.js +2 -1
- package/kunlun/operator/impl/logic.js +2 -1
- package/kunlun/operator/impl/logicV2.js +0 -1
- package/kunlun/operator/impl/operator.js +2 -1
- package/kunlun/operator/impl/operatorV2.js +0 -1
- package/lib/core.js +2 -1
- package/package.json +2 -13
- package/request/common.js +0 -1
- package/request/constants.js +0 -1
- package/request/faasinfra.js +0 -1
- package/request/innerapi.js +2 -1
- package/request/interface.js +2 -1
- package/request/openapi.js +2 -1
- package/types/types.js +2 -1
- package/LICENSE.md +0 -0
- package/application/application.js.map +0 -1
- package/application/application.ts +0 -40
- package/application/function/function.js.map +0 -1
- package/application/function/function.ts +0 -37
- package/application/impl/common.js.map +0 -1
- package/application/impl/common.ts +0 -50
- package/application/impl/impl.js.map +0 -1
- package/application/impl/impl.ts +0 -48
- package/constants/constants.js.map +0 -1
- package/constants/constants.ts +0 -12
- package/context/context.js.map +0 -1
- package/context/context.ts +0 -127
- package/context/db/db.js.map +0 -1
- package/context/db/db.ts +0 -77
- package/context/db/impl/IObject.js.map +0 -1
- package/context/db/impl/IObject.ts +0 -244
- package/context/db/impl/db.js.map +0 -1
- package/context/db/impl/db.ts +0 -95
- package/context/db/impl/object.js.map +0 -1
- package/context/db/impl/object.ts +0 -628
- package/context/db/impl/oql/ioql.js.map +0 -1
- package/context/db/impl/oql/ioql.ts +0 -6
- package/context/db/impl/oql/oql.js.map +0 -1
- package/context/db/impl/oql/oql.ts +0 -22
- package/context/db/impl/order.js.map +0 -1
- package/context/db/impl/order.ts +0 -16
- package/context/db/impl/propertiesStore.js.map +0 -1
- package/context/db/impl/propertiesStore.ts +0 -28
- package/context/db/impl/queryBuilder.js.map +0 -1
- package/context/db/impl/queryBuilder.ts +0 -103
- package/context/db/impl/transaction/index.js.map +0 -1
- package/context/db/impl/transaction/index.ts +0 -337
- package/context/db/impl/transaction/operation.js.map +0 -1
- package/context/db/impl/transaction/operation.ts +0 -72
- package/context/db/impl/transaction.js.map +0 -1
- package/context/db/impl/transaction.ts +0 -76
- package/context/globalConfig/globalConfig.js.map +0 -1
- package/context/globalConfig/globalConfig.ts +0 -11
- package/context/metadata/components/common.js.map +0 -1
- package/context/metadata/components/common.ts +0 -19
- package/context/metadata/components/components.js.map +0 -1
- package/context/metadata/components/components.ts +0 -19
- package/context/metadata/components/desktop/list.js.map +0 -1
- package/context/metadata/components/desktop/list.ts +0 -457
- package/context/metadata/components/desktop/recordDetail.js.map +0 -1
- package/context/metadata/components/desktop/recordDetail.ts +0 -64
- package/context/metadata/components/mobile/list.js.map +0 -1
- package/context/metadata/components/mobile/list.ts +0 -176
- package/context/metadata/metadata.js.map +0 -1
- package/context/metadata/metadata.ts +0 -175
- package/context/metadata/objects/fields.js.map +0 -1
- package/context/metadata/objects/fields.ts +0 -454
- package/context/metadata/objects/fields.util.js.map +0 -1
- package/context/metadata/objects/fields.util.ts +0 -360
- package/context/metadata/objects/objects.js.map +0 -1
- package/context/metadata/objects/objects.ts +0 -27
- package/context/metadata/types/common.js.map +0 -1
- package/context/metadata/types/common.ts +0 -10
- package/context/metadata/types/components.js.map +0 -1
- package/context/metadata/types/components.ts +0 -105
- package/context/metadata/types/objects.js.map +0 -1
- package/context/metadata/types/objects.ts +0 -251
- package/context/msg/msg.js.map +0 -1
- package/context/msg/msg.ts +0 -49
- package/context/resources/IResources.js.map +0 -1
- package/context/resources/IResources.ts +0 -73
- package/context/resources/impl/resources.js.map +0 -1
- package/context/resources/impl/resources.ts +0 -170
- package/context/tasks/tasks.js.map +0 -1
- package/context/tasks/tasks.ts +0 -159
- package/data/index.js.map +0 -1
- package/data/index.ts +0 -30
- package/hooks/api.js.map +0 -1
- package/hooks/api.ts +0 -341
- package/hooks/hooks.js.map +0 -1
- package/hooks/hooks.ts +0 -100
- package/kunlun/kunlun.js.map +0 -1
- package/kunlun/kunlun.ts +0 -69
- package/kunlun/operator/IOperator.js.map +0 -1
- package/kunlun/operator/IOperator.ts +0 -163
- package/kunlun/operator/impl/expression.js.map +0 -1
- package/kunlun/operator/impl/expression.ts +0 -71
- package/kunlun/operator/impl/logic.js.map +0 -1
- package/kunlun/operator/impl/logic.ts +0 -595
- package/kunlun/operator/impl/logicV2.js.map +0 -1
- package/kunlun/operator/impl/logicV2.ts +0 -254
- package/kunlun/operator/impl/operator.js.map +0 -1
- package/kunlun/operator/impl/operator.ts +0 -255
- package/kunlun/operator/impl/operatorV2.js.map +0 -1
- package/kunlun/operator/impl/operatorV2.ts +0 -249
- package/lib/core.js.map +0 -1
- package/lib/core.ts +0 -4
- package/request/common.js.map +0 -1
- package/request/common.ts +0 -91
- package/request/constants.js.map +0 -1
- package/request/constants.ts +0 -25
- package/request/faasinfra.js.map +0 -1
- package/request/faasinfra.ts +0 -393
- package/request/innerapi.js.map +0 -1
- package/request/innerapi.ts +0 -1645
- package/request/interface.js.map +0 -1
- package/request/interface.ts +0 -166
- package/request/openapi.js.map +0 -1
- package/request/openapi.ts +0 -1220
- package/types/types.js.map +0 -1
- package/types/types.ts +0 -105
|
@@ -1,628 +0,0 @@
|
|
|
1
|
-
import { _Cond, _CondRequireID, _Record, _WhereCond } from '../../../types/types'
|
|
2
|
-
import { QueryBuilder, maxLimit } from './queryBuilder'
|
|
3
|
-
import { ASC, DESC, Order } from './order'
|
|
4
|
-
import * as Request from '../../../request/interface'
|
|
5
|
-
import { buildCriterion, buildLogic, handleCriterion, Criterion, Logic } from '../../../kunlun/operator/impl/logic'
|
|
6
|
-
import { utils, exceptions, checkUtils } from '@byted-apaas/server-common-node'
|
|
7
|
-
import PropertiesStore from './propertiesStore'
|
|
8
|
-
import { _IKAllEndpoint, _IKAsyncEndpoint, _IKQuery, _IKSyncEndpoint } from './IObject'
|
|
9
|
-
import { AppCtx } from '../../../application/application'
|
|
10
|
-
import { runCtxForOpenSDK } from "../../../application/impl/common";
|
|
11
|
-
import { buildCriterionV2, CriterionV2, QueryV2 } from '../../../kunlun/operator/impl/logicV2'
|
|
12
|
-
import { operates } from '../../../kunlun/operator/impl/operator'
|
|
13
|
-
|
|
14
|
-
const queryPropertiesStore = new PropertiesStore<_KQueryProps>();
|
|
15
|
-
|
|
16
|
-
interface _KQueryProps {
|
|
17
|
-
apiName: string
|
|
18
|
-
appCtx: AppCtx
|
|
19
|
-
queryBuilder: QueryBuilder
|
|
20
|
-
queryV2?: QueryV2
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* _KObject is kunlun object, every method new a _KQuery object to deal.
|
|
25
|
-
*/
|
|
26
|
-
export interface _KObject<T> extends _KObjectSync<T>, _KObjectAsync<T>, _KObjectQuery<T> {
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// _KObject will be Mixin with [_KObjectSync, _KObjectAsync, _KObjectQuery]
|
|
30
|
-
export class _KObject<T> {
|
|
31
|
-
apiName: string = '';
|
|
32
|
-
|
|
33
|
-
constructor(objectApiName: string) {
|
|
34
|
-
if (!objectApiName) {
|
|
35
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
36
|
-
}
|
|
37
|
-
this.apiName = objectApiName
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* _KApplicationObject is open sdk object implement.
|
|
43
|
-
*/
|
|
44
|
-
export interface _KApplicationObject<T> extends _KObjectSync<T>, _KObjectQuery<T> {
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export class _KApplicationObject<T> {
|
|
48
|
-
apiName: string = '';
|
|
49
|
-
appCtx: AppCtx = null;
|
|
50
|
-
|
|
51
|
-
constructor(objectApiName: string, appCtx: AppCtx) {
|
|
52
|
-
this.apiName = objectApiName;
|
|
53
|
-
this.appCtx = appCtx;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
class _KObjectSync<T> implements _IKSyncEndpoint<T> {
|
|
58
|
-
apiName: string = '';
|
|
59
|
-
appCtx: AppCtx = null;
|
|
60
|
-
|
|
61
|
-
// create, update, delete
|
|
62
|
-
public async create(recordMap: _Cond<T>): Promise<{ _id: number }> {
|
|
63
|
-
if (!recordMap) {
|
|
64
|
-
throw new exceptions.InvalidParamError("record is empty");
|
|
65
|
-
}
|
|
66
|
-
if (checkUtils.isNotObject(recordMap)) {
|
|
67
|
-
throw new exceptions.InvalidParamError("record is not object");
|
|
68
|
-
}
|
|
69
|
-
if (this.appCtx && this.appCtx.mode == 'openSDK') {
|
|
70
|
-
// request from OpenSDK
|
|
71
|
-
return await runCtxForOpenSDK(this.appCtx, async () => {
|
|
72
|
-
return await Request.GetInstance().openSDKCreateRecordBySync(this.apiName, recordMap);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return await Request.GetInstance().createRecordBySync(this.apiName, recordMap);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
public async delete(recordID: number): Promise<void>;
|
|
79
|
-
public async delete(record: _Cond<T>): Promise<void>;
|
|
80
|
-
public async delete(recordOrRecordID: number | _Cond<T>): Promise<void> {
|
|
81
|
-
// 用户直接传入 record id 来进行删除的情况
|
|
82
|
-
if (typeof recordOrRecordID === "number") {
|
|
83
|
-
return await Request.GetInstance().deleteRecordBySync(this.apiName, recordOrRecordID);
|
|
84
|
-
}
|
|
85
|
-
// 用户传入 object 结构来进行删除的情况
|
|
86
|
-
let record = recordOrRecordID as _CondRequireID<T>
|
|
87
|
-
if (checkUtils.isObject(record)) {
|
|
88
|
-
// 如果用户没有传入包含 id 的 record,则报错
|
|
89
|
-
if (!record._id) {
|
|
90
|
-
throw new exceptions.InvalidParamError("record._id is empty");
|
|
91
|
-
}
|
|
92
|
-
if (this.appCtx && this.appCtx.mode == 'openSDK') {
|
|
93
|
-
// request from OpenSDK
|
|
94
|
-
return await runCtxForOpenSDK(this.appCtx, async () => {
|
|
95
|
-
return await Request.GetInstance().openSDKDeleteRecordBySync(this.apiName, record._id);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return await Request.GetInstance().deleteRecordBySync(this.apiName, record._id);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
throw new exceptions.InvalidParamError("record must be number or object");
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
public async update(_id: number, recordMap: _Cond<T>): Promise<void>;
|
|
105
|
-
public async update(recordMap: _Cond<T>): Promise<void>;
|
|
106
|
-
public async update(_idOrRecordMap: number | _Cond<T>, recordMap?: _Cond<T>): Promise<void> {
|
|
107
|
-
// record 必须包含 _id
|
|
108
|
-
let record: _CondRequireID<T>;
|
|
109
|
-
|
|
110
|
-
// 用户显式传入 id 的情况
|
|
111
|
-
if (recordMap && typeof _idOrRecordMap === "number") {
|
|
112
|
-
record = recordMap as _CondRequireID<T>
|
|
113
|
-
record['_id'] = _idOrRecordMap
|
|
114
|
-
} else {
|
|
115
|
-
// 用户隐式传入 id 的情况
|
|
116
|
-
record = _idOrRecordMap as _CondRequireID<T>
|
|
117
|
-
if (!record._id) {
|
|
118
|
-
throw new exceptions.InvalidParamError("record._id is empty")
|
|
119
|
-
}
|
|
120
|
-
if (typeof record._id !== "number") {
|
|
121
|
-
throw new exceptions.InvalidParamError("the type of record._id is not number");
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (!record) {
|
|
126
|
-
throw new exceptions.InvalidParamError("param is empty");
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
let recordID: number = record['_id']
|
|
130
|
-
if (recordID <= 0) {
|
|
131
|
-
throw new exceptions.InvalidParamError("record._id must greater than 0")
|
|
132
|
-
}
|
|
133
|
-
if (this.appCtx && this.appCtx.mode == 'openSDK') {
|
|
134
|
-
// request from OpenSDK
|
|
135
|
-
return await runCtxForOpenSDK(this.appCtx, async () => {
|
|
136
|
-
return await Request.GetInstance().openSDKUpdateRecordBySync(this.apiName, recordID, record);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return await Request.GetInstance().updateRecordBySync(this.apiName, recordID, record)
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// batch sync
|
|
143
|
-
public async batchCreate(recordMapList: _Cond<T>[]): Promise<number[]> {
|
|
144
|
-
// 参数校验
|
|
145
|
-
if (!this.apiName) {
|
|
146
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (!(recordMapList instanceof Array) || recordMapList.length === 0) {
|
|
150
|
-
throw new exceptions.InvalidParamError("param records is not an array or an empty array");
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
for (let record of recordMapList) {
|
|
154
|
-
if (checkUtils.isNotObject(record)) {
|
|
155
|
-
throw new exceptions.InvalidParamError("record is not object");
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
let data: number[] | {
|
|
160
|
-
record_ids: number[]
|
|
161
|
-
} = (this.appCtx && this.appCtx.mode == 'openSDK') ?
|
|
162
|
-
await runCtxForOpenSDK(this.appCtx, async () => {
|
|
163
|
-
return await Request.GetInstance().openSDKCreateRecordsBySync(this.apiName, recordMapList);
|
|
164
|
-
}) : await Request.GetInstance().createRecordsBySync(this.apiName, recordMapList);
|
|
165
|
-
|
|
166
|
-
// todo: 确定函数返回值
|
|
167
|
-
if (!(data instanceof Array) && data["record_ids"]) {
|
|
168
|
-
return data["record_ids"];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return data as number[];
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
public async batchDelete(recordIdList: number[]): Promise<void>;
|
|
175
|
-
public async batchDelete(recordList: _Cond<T>[]): Promise<void>;
|
|
176
|
-
public async batchDelete(idOrRecordList: number[] | _Cond<T>[]): Promise<void> {
|
|
177
|
-
// 参数校验、组装
|
|
178
|
-
if (!this.apiName) {
|
|
179
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (!(idOrRecordList instanceof Array) || idOrRecordList.length === 0) {
|
|
183
|
-
throw new exceptions.InvalidParamError("param records is not an array or an empty array");
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
let recordIDs: number[] = [];
|
|
187
|
-
for (let record of (idOrRecordList as (number | _CondRequireID<T>)[])) {
|
|
188
|
-
if (typeof (record) === 'number') {
|
|
189
|
-
recordIDs.push(record);
|
|
190
|
-
} else if (checkUtils.isObject(record) && record._id && typeof (record._id) === 'number') {
|
|
191
|
-
recordIDs.push(record._id);
|
|
192
|
-
} else {
|
|
193
|
-
throw new exceptions.InvalidParamError("record must be number or object");
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (this.appCtx && this.appCtx.mode == 'openSDK') {
|
|
198
|
-
// request from OpenSDK
|
|
199
|
-
return await runCtxForOpenSDK(this.appCtx, async () => {
|
|
200
|
-
return await Request.GetInstance().openSDKDeleteRecordsBySync(this.apiName, recordIDs);
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
await Request.GetInstance().deleteRecordsBySync(this.apiName, recordIDs);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
public async batchUpdate(recordMapList: _Cond<T>[]): Promise<void> {
|
|
209
|
-
// 参数校验、组装
|
|
210
|
-
if (!this.apiName) {
|
|
211
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (!(recordMapList instanceof Array) || recordMapList.length === 0) {
|
|
215
|
-
throw new exceptions.InvalidParamError("param records is not an array or an empty array");
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
let recordMap: Record<number, _CondRequireID<T>> = {};
|
|
219
|
-
for (let record of recordMapList as _CondRequireID<T>[]) {
|
|
220
|
-
let recordID: number = record['_id'];
|
|
221
|
-
if ((typeof recordID !== "number") || recordID <= 0) {
|
|
222
|
-
throw new exceptions.InvalidParamError("record._id is empty");
|
|
223
|
-
}
|
|
224
|
-
recordMap[recordID] = record;
|
|
225
|
-
}
|
|
226
|
-
if (this.appCtx && this.appCtx.mode == 'openSDK') {
|
|
227
|
-
// request from OpenSDK
|
|
228
|
-
await runCtxForOpenSDK(this.appCtx, async () => {
|
|
229
|
-
return await Request.GetInstance().openSDKUpdateRecordsBySync(this.apiName, recordMap);
|
|
230
|
-
});
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
await Request.GetInstance().updateRecordsBySync(this.apiName, recordMap);
|
|
234
|
-
return;
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
class _KObjectAsync<T> implements _IKAsyncEndpoint<T> {
|
|
239
|
-
apiName: string = '';
|
|
240
|
-
|
|
241
|
-
// batch async
|
|
242
|
-
public async batchCreateAsync(recordMapList: _Cond<T>[]): Promise<{ taskID: number }> {
|
|
243
|
-
// 参数校验
|
|
244
|
-
if (!this.apiName) {
|
|
245
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (!(recordMapList instanceof Array) || recordMapList.length === 0) {
|
|
249
|
-
throw new exceptions.InvalidParamError("param records is not an array or an empty array");
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (recordMapList.length > 1000) {
|
|
253
|
-
throw new exceptions.InvalidParamError("more than 1000 records in one operation");
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
for (let record of recordMapList) {
|
|
257
|
-
if (checkUtils.isNotObject(record)) {
|
|
258
|
-
throw new exceptions.InvalidParamError("record is not object");
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (utils.stringify(recordMapList).length > 50 * 1024 * 1024) {
|
|
263
|
-
throw new exceptions.InvalidParamError("parameter records size exceeds 50MB");
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return await Request.GetInstance().createRecordsByAsync(this.apiName, recordMapList);
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
public async batchDeleteAsync(recordIDList: number[]): Promise<{ taskID: number }>;
|
|
270
|
-
public async batchDeleteAsync(recordList: _Cond<T>[]): Promise<{ taskID: number }>;
|
|
271
|
-
public async batchDeleteAsync(recordOrIDList: number[] | _Cond<T>[]): Promise<{ taskID: number }> {
|
|
272
|
-
// 参数校验、组装
|
|
273
|
-
if (!this.apiName) {
|
|
274
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (!(recordOrIDList instanceof Array) || recordOrIDList.length === 0) {
|
|
278
|
-
throw new exceptions.InvalidParamError("param records is not an array or an empty array");
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (recordOrIDList.length > 1000) {
|
|
282
|
-
throw new exceptions.InvalidParamError("more than 1000 records in one operation");
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
let recordIDs: number[] = [];
|
|
286
|
-
for (let record of (recordOrIDList as (number | _CondRequireID<T>)[])) {
|
|
287
|
-
if (typeof (record) === 'number') {
|
|
288
|
-
recordIDs.push(record as number);
|
|
289
|
-
} else if (checkUtils.isObject(record) && record._id && typeof (record._id) === 'number') {
|
|
290
|
-
recordIDs.push(record._id);
|
|
291
|
-
} else {
|
|
292
|
-
throw new exceptions.InvalidParamError("record must be number or object");
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (utils.stringify(recordIDs).length > 50 * 1024 * 1024) {
|
|
297
|
-
throw new exceptions.InvalidParamError("parameter records size exceeds 50MB");
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return await Request.GetInstance().deleteRecordsByAsync(this.apiName, recordIDs);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
public async batchUpdateAsync(recordMapList: _Cond<T>[]): Promise<{ taskID: number }> {
|
|
304
|
-
// 参数校验、组装
|
|
305
|
-
if (!this.apiName) {
|
|
306
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (!(recordMapList instanceof Array) || recordMapList.length === 0) {
|
|
310
|
-
throw new exceptions.InvalidParamError("param records is not an array or an empty array");
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (recordMapList.length > 1000) {
|
|
314
|
-
throw new exceptions.InvalidParamError("more than 1000 records in one operation");
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
let recordMap: Record<number, _CondRequireID<T>> = {};
|
|
318
|
-
for (let record of recordMapList as _CondRequireID<T>[]) {
|
|
319
|
-
let recordID: number = record['_id'];
|
|
320
|
-
if (recordID === undefined || recordID === null) {
|
|
321
|
-
throw new exceptions.InvalidParamError("record._id is empty")
|
|
322
|
-
}
|
|
323
|
-
if (typeof recordID !== "number") {
|
|
324
|
-
throw new exceptions.InvalidParamError("the type of record._id is not number")
|
|
325
|
-
}
|
|
326
|
-
if (recordID <= 0) {
|
|
327
|
-
throw new exceptions.InvalidParamError("record._id must greater than 0")
|
|
328
|
-
}
|
|
329
|
-
recordMap[recordID] = record;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (utils.stringify(recordMap).length > 50 * 1024 * 1024) {
|
|
333
|
-
throw new exceptions.InvalidParamError("parameter records size exceeds 50MB");
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return await Request.GetInstance().updateRecordsByAsync(this.apiName, recordMap);
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
class _KObjectQuery<T> implements _IKQuery<T> {
|
|
341
|
-
apiName: string;
|
|
342
|
-
appCtx: AppCtx = null;
|
|
343
|
-
|
|
344
|
-
// find, findOne
|
|
345
|
-
public async find(): Promise<_Record<T>[]> {
|
|
346
|
-
return new _KQuery<T>(this.apiName, this.appCtx).find()
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
public async findOne(): Promise<_Record<T>> {
|
|
350
|
-
return new _KQuery<T>(this.apiName, this.appCtx).findOne()
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
public async findAll(): Promise<_Record<T>[]> {
|
|
354
|
-
return new _KQuery<T>(this.apiName, this.appCtx).findAll()
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
// orderBy, orderByDesc
|
|
358
|
-
public orderBy<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
|
|
359
|
-
public orderBy<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
|
|
360
|
-
public orderBy<K extends keyof T>(fieldApiNames?: K | K[], ...restFieldApiNames: K[]): _KQuery<T> {
|
|
361
|
-
fieldApiNames = !fieldApiNames ? [] : fieldApiNames;
|
|
362
|
-
return new _KQuery<T>(this.apiName, this.appCtx).orderBy(utils.argsToList(fieldApiNames, restFieldApiNames))
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
public orderByDesc<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
|
|
366
|
-
public orderByDesc<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
|
|
367
|
-
public orderByDesc<K extends keyof T>(fieldApiNames?: K | K[], ...restFieldApiNames: K[]): _KQuery<T> {
|
|
368
|
-
fieldApiNames = !fieldApiNames ? [] : fieldApiNames;
|
|
369
|
-
return new _KQuery<T>(this.apiName, this.appCtx).orderByDesc(utils.argsToList(fieldApiNames, restFieldApiNames))
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// select, where
|
|
373
|
-
public select<K extends keyof T>(fieldApiNames: K[]): _KQuery<T>;
|
|
374
|
-
public select<K extends keyof T>(...fieldApiNames: K[]): _KQuery<T>;
|
|
375
|
-
public select<K extends keyof T>(fieldApiNames?: K | K[], ...restFieldApiNames: K[]): _KQuery<T> {
|
|
376
|
-
fieldApiNames = !fieldApiNames ? [] : fieldApiNames;
|
|
377
|
-
return new _KQuery<T>(this.apiName, this.appCtx).select(utils.argsToList(fieldApiNames, restFieldApiNames))
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
public where(conditionMap: _WhereCond<T>): _KQuery<T>;
|
|
381
|
-
public where(): _KQuery<T>;
|
|
382
|
-
public where(conditionMap?: _WhereCond<T>): _KQuery<T> {
|
|
383
|
-
if (!conditionMap) {
|
|
384
|
-
return new _KQuery<T>(this.apiName, this.appCtx).where()
|
|
385
|
-
}
|
|
386
|
-
return new _KQuery<T>(this.apiName, this.appCtx).where(conditionMap)
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// limit, offset, count
|
|
390
|
-
public limit(limit: number): _KQuery<T> {
|
|
391
|
-
return new _KQuery<T>(this.apiName, this.appCtx).limit(limit)
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
public offset(offset: number): _KQuery<T> {
|
|
395
|
-
return new _KQuery<T>(this.apiName, this.appCtx).offset(offset)
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
public async count(): Promise<number> {
|
|
399
|
-
return new _KQuery<T>(this.apiName, this.appCtx).count()
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* _KQuery is kunlun query implement, implements ORM operations.
|
|
405
|
-
*/
|
|
406
|
-
class _KQuery<T> implements _IKQuery<T> {
|
|
407
|
-
|
|
408
|
-
// 使用请求上下文和对象 Api Name 进行初始化
|
|
409
|
-
constructor(objectApiName: string, appCtx: AppCtx = null) {
|
|
410
|
-
if (!objectApiName) {
|
|
411
|
-
throw new exceptions.InvalidParamError("objectApiName is empty");
|
|
412
|
-
}
|
|
413
|
-
queryPropertiesStore.set(this, {
|
|
414
|
-
apiName: objectApiName,
|
|
415
|
-
appCtx: appCtx,
|
|
416
|
-
queryBuilder: new QueryBuilder(objectApiName),
|
|
417
|
-
queryV2: appCtx ? new QueryV2(objectApiName) : null,
|
|
418
|
-
})
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
public async find(): Promise<_Record<T>[]> {
|
|
422
|
-
const { apiName, appCtx, queryBuilder, queryV2 } = queryPropertiesStore.get(this)
|
|
423
|
-
|
|
424
|
-
if (appCtx) {
|
|
425
|
-
const param: Request.OpenSDKGetRecordsReq = {
|
|
426
|
-
limit: queryV2._limit,
|
|
427
|
-
offset: queryV2._offset,
|
|
428
|
-
sort: queryV2._order,
|
|
429
|
-
fields: queryV2.fields,
|
|
430
|
-
count: false,
|
|
431
|
-
filter: buildCriterionV2(queryV2.filter),
|
|
432
|
-
};
|
|
433
|
-
return await runCtxForOpenSDK(appCtx, async () => {
|
|
434
|
-
return await Request.GetInstance().openSDKGetRecords(apiName, param);
|
|
435
|
-
});
|
|
436
|
-
} else {
|
|
437
|
-
const criterion = buildCriterion(queryBuilder.getLogic(), apiName);
|
|
438
|
-
return await Request.GetInstance().getRecordsOrCountByCriterion(apiName, await handleCriterion(criterion),
|
|
439
|
-
queryBuilder.getOrder(), false, queryBuilder.getSelect(),
|
|
440
|
-
queryBuilder.getOffset(), queryBuilder.getLimit(), false) as _Record<T>[];
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
public async findOne(): Promise<_Record<T>> {
|
|
445
|
-
// 限制 limit 为 1
|
|
446
|
-
this.limit(1);
|
|
447
|
-
|
|
448
|
-
const records = await this.find();
|
|
449
|
-
return records instanceof Array ? (records.length > 0 ? records[0] : null) : null
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
public async findAll(): Promise<_Record<T>[]> {
|
|
453
|
-
const { queryBuilder, queryV2 } = queryPropertiesStore.get(this);
|
|
454
|
-
|
|
455
|
-
if (queryBuilder.getOrder().length > 0) {
|
|
456
|
-
throw new exceptions.InvalidParamError("findAll does not support orderBy and orderByDesc");
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
if (queryV2 && queryV2._order.length > 0) {
|
|
460
|
-
throw new exceptions.InvalidParamError("findAll does not support orderBy and orderByDesc");
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
return await this.getRecordsByPage();
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
private async getRecordsByPage(): Promise<_Record<T>[]> {
|
|
467
|
-
const { apiName, appCtx, queryBuilder, queryV2 } = queryPropertiesStore.get(this);
|
|
468
|
-
|
|
469
|
-
let maxId = 0, records: any[] = [];
|
|
470
|
-
while (true) {
|
|
471
|
-
let rs: any;
|
|
472
|
-
if (appCtx) {
|
|
473
|
-
let criterion: CriterionV2 = buildCriterionV2(queryV2.filter);
|
|
474
|
-
criterion.push({ leftValue: '_id', operator: operates.GT, rightValue: maxId });
|
|
475
|
-
const param: Request.OpenSDKGetRecordsReq = {
|
|
476
|
-
limit: 200,
|
|
477
|
-
offset: 0,
|
|
478
|
-
sort: [{ field: '_id', direction: 'asc', type: '' }],
|
|
479
|
-
fields: queryV2.fields,
|
|
480
|
-
count: false,
|
|
481
|
-
filter: criterion,
|
|
482
|
-
};
|
|
483
|
-
rs = await runCtxForOpenSDK(appCtx, async () => {
|
|
484
|
-
return await Request.GetInstance().openSDKGetRecords(apiName, param);
|
|
485
|
-
});
|
|
486
|
-
} else {
|
|
487
|
-
let criterion = buildCriterion(queryBuilder.getLogic(), apiName, maxId);
|
|
488
|
-
rs = await Request.GetInstance().getRecordsOrCountByCriterion(apiName, await handleCriterion(criterion),
|
|
489
|
-
[new Order("_id", "asc")], false, queryBuilder.getSelect(),
|
|
490
|
-
0, maxLimit, false);
|
|
491
|
-
}
|
|
492
|
-
rs.forEach((r: any) => {
|
|
493
|
-
maxId = r._id > maxId ? r._id : maxId;
|
|
494
|
-
});
|
|
495
|
-
records.push(...rs);
|
|
496
|
-
|
|
497
|
-
if (rs.length < maxLimit) {
|
|
498
|
-
break;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
return records;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
public orderBy<K extends keyof T>(fieldApiNames: K[]): this;
|
|
506
|
-
public orderBy<K extends keyof T>(...fieldApiNames: K[]): this;
|
|
507
|
-
public orderBy<K extends keyof T>(fieldApiNames?: K | K[], ...restFieldApiNames: K[]): this {
|
|
508
|
-
fieldApiNames = !fieldApiNames ? [] : fieldApiNames;
|
|
509
|
-
let fields: string[] = utils.argsToList(fieldApiNames, restFieldApiNames)
|
|
510
|
-
const { queryBuilder, queryV2 } = queryPropertiesStore.get(this)
|
|
511
|
-
if (queryV2) {
|
|
512
|
-
queryV2.orderBy(fields);
|
|
513
|
-
} else {
|
|
514
|
-
queryBuilder.addOrders(fields, ASC);
|
|
515
|
-
}
|
|
516
|
-
return this
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
public orderByDesc<K extends keyof T>(fieldApiNames: K[]): this;
|
|
520
|
-
public orderByDesc<K extends keyof T>(...fieldApiNames: K[]): this;
|
|
521
|
-
public orderByDesc<K extends keyof T>(fieldApiNames?: K | K[], ...restFieldApiNames: K[]): this {
|
|
522
|
-
fieldApiNames = !fieldApiNames ? [] : fieldApiNames;
|
|
523
|
-
let fields: string[] = utils.argsToList(fieldApiNames, restFieldApiNames)
|
|
524
|
-
const { queryBuilder, queryV2 } = queryPropertiesStore.get(this)
|
|
525
|
-
if (queryV2) {
|
|
526
|
-
queryV2.orderByDesc(fields);
|
|
527
|
-
} else {
|
|
528
|
-
queryBuilder.addOrders(fields, DESC)
|
|
529
|
-
}
|
|
530
|
-
return this
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
public select<K extends keyof T>(fieldApiNames: K[]): this;
|
|
534
|
-
public select<K extends keyof T>(...fieldApiNames: K[]): this;
|
|
535
|
-
public select<K extends keyof T>(fieldApiNames?: K | K[], ...restFieldApiNames: K[]): this {
|
|
536
|
-
fieldApiNames = !fieldApiNames ? [] : fieldApiNames;
|
|
537
|
-
let fields: string[] = utils.argsToList(fieldApiNames, restFieldApiNames)
|
|
538
|
-
const { queryBuilder, queryV2 } = queryPropertiesStore.get(this)
|
|
539
|
-
if (queryV2) {
|
|
540
|
-
queryV2.select(fields);
|
|
541
|
-
} else {
|
|
542
|
-
queryBuilder.addSelects(fields);
|
|
543
|
-
}
|
|
544
|
-
return this
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
public where(conditionMap: _WhereCond<T>): this;
|
|
548
|
-
public where(): this;
|
|
549
|
-
public where(conditionMap?: _WhereCond<T>): this {
|
|
550
|
-
// 如果 where 内是空,直接返回
|
|
551
|
-
if (!conditionMap || Object.keys(conditionMap).length === 0) {
|
|
552
|
-
return this
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
const { queryBuilder, queryV2 } = queryPropertiesStore.get(this);
|
|
556
|
-
if (queryV2) {
|
|
557
|
-
queryV2.where(conditionMap as any);
|
|
558
|
-
} else {
|
|
559
|
-
let logic: Logic
|
|
560
|
-
// 如果 conditionMap 不是 Logic,需要构建为 Logic
|
|
561
|
-
if (!(conditionMap instanceof Logic)) {
|
|
562
|
-
logic = buildLogic([conditionMap])
|
|
563
|
-
} else {
|
|
564
|
-
logic = conditionMap
|
|
565
|
-
}
|
|
566
|
-
queryBuilder.addLogic(logic)
|
|
567
|
-
}
|
|
568
|
-
return this
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
public limit(limit: number): this {
|
|
572
|
-
const { queryBuilder } = queryPropertiesStore.get(this)
|
|
573
|
-
queryBuilder.setLimit(limit)
|
|
574
|
-
return this
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
public offset(offset: number): this {
|
|
578
|
-
const { queryBuilder } = queryPropertiesStore.get(this)
|
|
579
|
-
queryBuilder.setOffset(offset)
|
|
580
|
-
return this
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
public async count(): Promise<number> {
|
|
584
|
-
const { apiName, appCtx, queryBuilder, queryV2 } = queryPropertiesStore.get(this)
|
|
585
|
-
|
|
586
|
-
if (appCtx) {
|
|
587
|
-
const param: Request.OpenSDKGetRecordsReq = {
|
|
588
|
-
limit: 1,
|
|
589
|
-
offset: queryV2._offset,
|
|
590
|
-
fields: queryV2.fields,
|
|
591
|
-
sort: queryV2._order,
|
|
592
|
-
count: true,
|
|
593
|
-
filter: buildCriterionV2(queryV2.filter),
|
|
594
|
-
};
|
|
595
|
-
param.count = true;
|
|
596
|
-
return await runCtxForOpenSDK(appCtx, async () => {
|
|
597
|
-
return await Request.GetInstance().openSDKGetRecords(apiName, param);
|
|
598
|
-
});
|
|
599
|
-
} else {
|
|
600
|
-
let criterion: Criterion = buildCriterion(queryBuilder.getLogic(), apiName) as Criterion;
|
|
601
|
-
return await Request.GetInstance().getRecordsOrCountByCriterion(
|
|
602
|
-
apiName,
|
|
603
|
-
await handleCriterion(criterion),
|
|
604
|
-
queryBuilder.getOrder(),
|
|
605
|
-
false,
|
|
606
|
-
queryBuilder.getSelect(),
|
|
607
|
-
queryBuilder.getOffset(),
|
|
608
|
-
queryBuilder.getLimit(),
|
|
609
|
-
true) as number;
|
|
610
|
-
}
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
function applyMixins(derivedCtor: any, constructors: any[]) {
|
|
615
|
-
constructors.forEach((baseCtor) => {
|
|
616
|
-
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
617
|
-
Object.defineProperty(
|
|
618
|
-
derivedCtor.prototype,
|
|
619
|
-
name,
|
|
620
|
-
Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||
|
|
621
|
-
Object.create(null)
|
|
622
|
-
);
|
|
623
|
-
});
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
applyMixins(_KObject, [_KObjectSync, _KObjectAsync, _KObjectQuery]);
|
|
628
|
-
applyMixins(_KApplicationObject, [_KObjectSync, _KObjectQuery]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ioql.js","sourceRoot":"","sources":["ioql.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oql.js","sourceRoot":"","sources":["oql.ts"],"names":[],"mappings":";;;AACA,yDAAyD;AAEzD,MAAa,GAAG;IAKZ,YAAY,GAAW;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,OAAO;QACT,IAAI,OAAO,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QACtF,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACnC,OAAO,OAAO,CAAC;SAClB;QACD,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AAlBD,kBAkBC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {IOql} from "./ioql";
|
|
2
|
-
import * as Request from "../../../../request/interface";
|
|
3
|
-
|
|
4
|
-
export class Oql implements IOql {
|
|
5
|
-
oql: string;
|
|
6
|
-
params: any[];
|
|
7
|
-
namedParams: Record<string, any>;
|
|
8
|
-
|
|
9
|
-
constructor(oql: string) {
|
|
10
|
-
this.oql = oql;
|
|
11
|
-
this.params = [];
|
|
12
|
-
this.namedParams = {};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async execute(): Promise<any[]> {
|
|
16
|
-
let records = await Request.GetInstance().oql(this.oql, this.params, this.namedParams)
|
|
17
|
-
if (records && Array.isArray(records)) {
|
|
18
|
-
return records;
|
|
19
|
-
}
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["order.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,KAAK,CAAC;AACZ,QAAA,IAAI,GAAG,MAAM,CAAC;AAI3B,MAAa,KAAK;IAKd,YAAY,YAAoB,EAAE,SAAoB;QAClD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;QACd,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC9B,CAAC;CACJ;AAVD,sBAUC"}
|
package/context/db/impl/order.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const ASC = 'asc';
|
|
2
|
-
export const DESC = 'desc';
|
|
3
|
-
|
|
4
|
-
export type OrderType = 'asc' | 'desc';
|
|
5
|
-
|
|
6
|
-
export class Order {
|
|
7
|
-
field: string
|
|
8
|
-
type: string
|
|
9
|
-
direction: OrderType
|
|
10
|
-
|
|
11
|
-
constructor(fieldApiName: string, direction: OrderType) {
|
|
12
|
-
this.field = fieldApiName
|
|
13
|
-
this.type = ""
|
|
14
|
-
this.direction = direction
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"propertiesStore.js","sourceRoot":"","sources":["propertiesStore.ts"],"names":[],"mappings":";;AAAA,MAAqB,eAAe;IAApC;QACY,QAAG,GAAG,IAAI,OAAO,EAAsB,CAAC;IAyBlD,CAAC;IAvBC,UAAU,CAAC,GAAW;QACpB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;SACzC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAiB;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF;AA1BH,kCA0BG"}
|