@cloudbase/database 0.9.18-next → 0.9.20
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/.trunk/configs/.markdownlint.yaml +10 -0
- package/.trunk/trunk.yaml +26 -0
- package/README.md +32 -10
- package/dist/commonjs/aggregate.js +10 -0
- package/dist/commonjs/document.js +1 -4
- package/dist/commonjs/query.js +6 -6
- package/package.json +2 -3
- package/src/aggregate.ts +11 -0
- package/src/document.ts +1 -4
- package/src/query.ts +3 -3
- package/dist/esm/aggregate.d.ts +0 -29
- package/dist/esm/aggregate.js +0 -144
- package/dist/esm/collection.d.ts +0 -9
- package/dist/esm/collection.js +0 -44
- package/dist/esm/command.d.ts +0 -175
- package/dist/esm/command.js +0 -296
- package/dist/esm/commands/logic.d.ts +0 -24
- package/dist/esm/commands/logic.js +0 -84
- package/dist/esm/commands/query.d.ts +0 -68
- package/dist/esm/commands/query.js +0 -152
- package/dist/esm/commands/update.d.ts +0 -29
- package/dist/esm/commands/update.js +0 -46
- package/dist/esm/config/app.config.d.ts +0 -6
- package/dist/esm/config/app.config.js +0 -5
- package/dist/esm/config/error.config.d.ts +0 -3
- package/dist/esm/config/error.config.js +0 -13
- package/dist/esm/const/code.d.ts +0 -30
- package/dist/esm/const/code.js +0 -30
- package/dist/esm/constant.d.ts +0 -51
- package/dist/esm/constant.js +0 -65
- package/dist/esm/document.d.ts +0 -11
- package/dist/esm/document.js +0 -250
- package/dist/esm/geo/index.d.ts +0 -6
- package/dist/esm/geo/index.js +0 -6
- package/dist/esm/geo/interface.d.ts +0 -24
- package/dist/esm/geo/interface.js +0 -0
- package/dist/esm/geo/lineString.d.ts +0 -19
- package/dist/esm/geo/lineString.js +0 -83
- package/dist/esm/geo/multiLineString.d.ts +0 -18
- package/dist/esm/geo/multiLineString.js +0 -92
- package/dist/esm/geo/multiPoint.d.ts +0 -18
- package/dist/esm/geo/multiPoint.js +0 -76
- package/dist/esm/geo/multiPolygon.d.ts +0 -18
- package/dist/esm/geo/multiPolygon.js +0 -119
- package/dist/esm/geo/point.d.ts +0 -19
- package/dist/esm/geo/point.js +0 -47
- package/dist/esm/geo/polygon.d.ts +0 -19
- package/dist/esm/geo/polygon.js +0 -106
- package/dist/esm/helper/symbol.d.ts +0 -14
- package/dist/esm/helper/symbol.js +0 -14
- package/dist/esm/index.d.ts +0 -33
- package/dist/esm/index.js +0 -41
- package/dist/esm/lib/util.d.ts +0 -1
- package/dist/esm/lib/util.js +0 -23
- package/dist/esm/operator-map.d.ts +0 -4
- package/dist/esm/operator-map.js +0 -20
- package/dist/esm/query.d.ts +0 -22
- package/dist/esm/query.js +0 -249
- package/dist/esm/regexp/index.d.ts +0 -14
- package/dist/esm/regexp/index.js +0 -29
- package/dist/esm/serializer/common.d.ts +0 -11
- package/dist/esm/serializer/common.js +0 -113
- package/dist/esm/serializer/datatype.d.ts +0 -7
- package/dist/esm/serializer/datatype.js +0 -122
- package/dist/esm/serializer/query.d.ts +0 -7
- package/dist/esm/serializer/query.js +0 -229
- package/dist/esm/serializer/update.d.ts +0 -15
- package/dist/esm/serializer/update.js +0 -139
- package/dist/esm/serverDate/index.d.ts +0 -13
- package/dist/esm/serverDate/index.js +0 -26
- package/dist/esm/transaction/collection.d.ts +0 -7
- package/dist/esm/transaction/collection.js +0 -44
- package/dist/esm/transaction/document.d.ts +0 -27
- package/dist/esm/transaction/document.js +0 -203
- package/dist/esm/transaction/index.d.ts +0 -30
- package/dist/esm/transaction/index.js +0 -210
- package/dist/esm/transaction/query.d.ts +0 -5
- package/dist/esm/transaction/query.js +0 -8
- package/dist/esm/typings/index.d.ts +0 -40
- package/dist/esm/typings/index.js +0 -0
- package/dist/esm/typings/realtime.d.ts +0 -219
- package/dist/esm/typings/realtime.js +0 -0
- package/dist/esm/util.d.ts +0 -9
- package/dist/esm/util.js +0 -142
- package/dist/esm/utils/error.d.ts +0 -37
- package/dist/esm/utils/error.js +0 -82
- package/dist/esm/utils/msg.d.ts +0 -0
- package/dist/esm/utils/msg.js +0 -0
- package/dist/esm/utils/symbol.d.ts +0 -8
- package/dist/esm/utils/symbol.js +0 -55
- package/dist/esm/utils/type.d.ts +0 -13
- package/dist/esm/utils/type.js +0 -20
- package/dist/esm/utils/utils.d.ts +0 -4
- package/dist/esm/utils/utils.js +0 -33
- package/dist/esm/validate.d.ts +0 -1
- package/dist/esm/validate.js +0 -57
package/dist/esm/validate.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ErrorCode, WhereFilterOpList, OrderDirectionList, FieldType } from './constant';
|
|
2
|
-
import { Util } from './util';
|
|
3
|
-
var Validate = (function () {
|
|
4
|
-
function Validate() {
|
|
5
|
-
}
|
|
6
|
-
Validate.isGeopoint = function (point, degree) {
|
|
7
|
-
if (Util.whichType(degree) !== FieldType.Number) {
|
|
8
|
-
throw new Error('Geo Point must be number type');
|
|
9
|
-
}
|
|
10
|
-
var degreeAbs = Math.abs(degree);
|
|
11
|
-
if (point === 'latitude' && degreeAbs > 90) {
|
|
12
|
-
throw new Error('latitude should be a number ranges from -90 to 90');
|
|
13
|
-
}
|
|
14
|
-
else if (point === 'longitude' && degreeAbs > 180) {
|
|
15
|
-
throw new Error('longitude should be a number ranges from -180 to 180');
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
18
|
-
};
|
|
19
|
-
Validate.isInteger = function (param, num) {
|
|
20
|
-
if (!Number.isInteger(num)) {
|
|
21
|
-
throw new Error(param + ErrorCode.IntergerError);
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
Validate.isFieldOrder = function (direction) {
|
|
26
|
-
if (OrderDirectionList.indexOf(direction) === -1) {
|
|
27
|
-
throw new Error(ErrorCode.DirectionError);
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
};
|
|
31
|
-
Validate.isFieldPath = function (path) {
|
|
32
|
-
if (!/^[a-zA-Z0-9-_\.]/.test(path)) {
|
|
33
|
-
throw new Error();
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
};
|
|
37
|
-
Validate.isOperator = function (op) {
|
|
38
|
-
if (WhereFilterOpList.indexOf(op) === -1) {
|
|
39
|
-
throw new Error(ErrorCode.OpStrError);
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
};
|
|
43
|
-
Validate.isCollName = function (name) {
|
|
44
|
-
if (!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(name)) {
|
|
45
|
-
throw new Error(ErrorCode.CollNameError);
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
};
|
|
49
|
-
Validate.isDocID = function (docId) {
|
|
50
|
-
if (!/^([a-fA-F0-9]){24}$/.test(docId)) {
|
|
51
|
-
throw new Error(ErrorCode.DocIDError);
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
};
|
|
55
|
-
return Validate;
|
|
56
|
-
}());
|
|
57
|
-
export { Validate };
|