@cloudbase/js-sdk 3.6.8 → 3.6.9-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 (202) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/app/dist/index.esm.js +1 -1
  3. package/app/dist/index.esm.js.map +1 -1
  4. package/app/dist/index.js +1 -1
  5. package/app/dist/index.js.map +1 -1
  6. package/app/dist/index.node.esm.js +1 -1
  7. package/app/dist/index.node.esm.js.map +1 -1
  8. package/app/dist/index.node.js +1 -1
  9. package/app/dist/index.node.js.map +1 -1
  10. package/auth/dist/index.esm.js.map +1 -1
  11. package/auth/dist/index.js.map +1 -1
  12. package/database/dist/index.d.ts +3 -0
  13. package/database/dist/index.esm.js +2 -0
  14. package/database/dist/index.esm.js.map +1 -0
  15. package/database/dist/index.js +2 -0
  16. package/database/dist/index.js.map +1 -0
  17. package/dist/index.cjs.js +1 -1
  18. package/dist/index.cjs.js.map +1 -1
  19. package/dist/index.esm.js +1 -1
  20. package/dist/index.esm.js.map +1 -1
  21. package/dist/index.node.cjs.js +1 -1
  22. package/dist/index.node.cjs.js.map +1 -1
  23. package/dist/index.node.esm.js +1 -1
  24. package/dist/index.node.esm.js.map +1 -1
  25. package/miniprogram_dist/index.js +1 -1
  26. package/oauth/dist/index.esm.js.map +1 -1
  27. package/oauth/dist/index.js.map +1 -1
  28. package/package.json +2 -2
  29. package/types/package.json +1 -1
  30. package/utilities/package.json +2 -2
  31. package/database/dist/commonjs/aggregate.d.ts +0 -29
  32. package/database/dist/commonjs/aggregate.js +0 -156
  33. package/database/dist/commonjs/collection.d.ts +0 -9
  34. package/database/dist/commonjs/collection.js +0 -49
  35. package/database/dist/commonjs/command.d.ts +0 -175
  36. package/database/dist/commonjs/command.js +0 -299
  37. package/database/dist/commonjs/commands/logic.d.ts +0 -24
  38. package/database/dist/commonjs/commands/logic.js +0 -89
  39. package/database/dist/commonjs/commands/query.d.ts +0 -68
  40. package/database/dist/commonjs/commands/query.js +0 -160
  41. package/database/dist/commonjs/commands/update.d.ts +0 -29
  42. package/database/dist/commonjs/commands/update.js +0 -51
  43. package/database/dist/commonjs/config/app.config.d.ts +0 -6
  44. package/database/dist/commonjs/config/app.config.js +0 -7
  45. package/database/dist/commonjs/config/error.config.d.ts +0 -3
  46. package/database/dist/commonjs/config/error.config.js +0 -16
  47. package/database/dist/commonjs/const/code.d.ts +0 -30
  48. package/database/dist/commonjs/const/code.js +0 -33
  49. package/database/dist/commonjs/constant.d.ts +0 -51
  50. package/database/dist/commonjs/constant.js +0 -75
  51. package/database/dist/commonjs/document.d.ts +0 -11
  52. package/database/dist/commonjs/document.js +0 -260
  53. package/database/dist/commonjs/geo/index.d.ts +0 -6
  54. package/database/dist/commonjs/geo/index.js +0 -22
  55. package/database/dist/commonjs/geo/interface.d.ts +0 -24
  56. package/database/dist/commonjs/geo/interface.js +0 -2
  57. package/database/dist/commonjs/geo/lineString.d.ts +0 -19
  58. package/database/dist/commonjs/geo/lineString.js +0 -86
  59. package/database/dist/commonjs/geo/multiLineString.d.ts +0 -18
  60. package/database/dist/commonjs/geo/multiLineString.js +0 -95
  61. package/database/dist/commonjs/geo/multiPoint.d.ts +0 -18
  62. package/database/dist/commonjs/geo/multiPoint.js +0 -79
  63. package/database/dist/commonjs/geo/multiPolygon.d.ts +0 -18
  64. package/database/dist/commonjs/geo/multiPolygon.js +0 -122
  65. package/database/dist/commonjs/geo/point.d.ts +0 -19
  66. package/database/dist/commonjs/geo/point.js +0 -50
  67. package/database/dist/commonjs/geo/polygon.d.ts +0 -19
  68. package/database/dist/commonjs/geo/polygon.js +0 -109
  69. package/database/dist/commonjs/helper/symbol.d.ts +0 -14
  70. package/database/dist/commonjs/helper/symbol.js +0 -31
  71. package/database/dist/commonjs/index.d.ts +0 -40
  72. package/database/dist/commonjs/index.js +0 -61
  73. package/database/dist/commonjs/lib/util.d.ts +0 -1
  74. package/database/dist/commonjs/lib/util.js +0 -26
  75. package/database/dist/commonjs/operator-map.d.ts +0 -4
  76. package/database/dist/commonjs/operator-map.js +0 -24
  77. package/database/dist/commonjs/query.d.ts +0 -22
  78. package/database/dist/commonjs/query.js +0 -252
  79. package/database/dist/commonjs/regexp/index.d.ts +0 -14
  80. package/database/dist/commonjs/regexp/index.js +0 -33
  81. package/database/dist/commonjs/serializer/common.d.ts +0 -11
  82. package/database/dist/commonjs/serializer/common.js +0 -127
  83. package/database/dist/commonjs/serializer/datatype.d.ts +0 -7
  84. package/database/dist/commonjs/serializer/datatype.js +0 -132
  85. package/database/dist/commonjs/serializer/query.d.ts +0 -7
  86. package/database/dist/commonjs/serializer/query.js +0 -232
  87. package/database/dist/commonjs/serializer/update.d.ts +0 -15
  88. package/database/dist/commonjs/serializer/update.js +0 -142
  89. package/database/dist/commonjs/serverDate/index.d.ts +0 -13
  90. package/database/dist/commonjs/serverDate/index.js +0 -30
  91. package/database/dist/commonjs/transaction/collection.d.ts +0 -7
  92. package/database/dist/commonjs/transaction/collection.js +0 -49
  93. package/database/dist/commonjs/transaction/document.d.ts +0 -27
  94. package/database/dist/commonjs/transaction/document.js +0 -205
  95. package/database/dist/commonjs/transaction/index.d.ts +0 -30
  96. package/database/dist/commonjs/transaction/index.js +0 -215
  97. package/database/dist/commonjs/transaction/query.d.ts +0 -43
  98. package/database/dist/commonjs/transaction/query.js +0 -261
  99. package/database/dist/commonjs/typings/index.d.ts +0 -40
  100. package/database/dist/commonjs/typings/index.js +0 -2
  101. package/database/dist/commonjs/typings/realtime.d.ts +0 -219
  102. package/database/dist/commonjs/typings/realtime.js +0 -2
  103. package/database/dist/commonjs/util.d.ts +0 -9
  104. package/database/dist/commonjs/util.js +0 -145
  105. package/database/dist/commonjs/utils/error.d.ts +0 -38
  106. package/database/dist/commonjs/utils/error.js +0 -91
  107. package/database/dist/commonjs/utils/msg.d.ts +0 -0
  108. package/database/dist/commonjs/utils/msg.js +0 -0
  109. package/database/dist/commonjs/utils/symbol.d.ts +0 -8
  110. package/database/dist/commonjs/utils/symbol.js +0 -58
  111. package/database/dist/commonjs/utils/type.d.ts +0 -13
  112. package/database/dist/commonjs/utils/type.js +0 -34
  113. package/database/dist/commonjs/utils/utils.d.ts +0 -4
  114. package/database/dist/commonjs/utils/utils.js +0 -39
  115. package/database/dist/commonjs/validate.d.ts +0 -1
  116. package/database/dist/commonjs/validate.js +0 -60
  117. package/database/dist/esm/aggregate.d.ts +0 -29
  118. package/database/dist/esm/aggregate.js +0 -154
  119. package/database/dist/esm/collection.d.ts +0 -9
  120. package/database/dist/esm/collection.js +0 -46
  121. package/database/dist/esm/command.d.ts +0 -175
  122. package/database/dist/esm/command.js +0 -296
  123. package/database/dist/esm/commands/logic.d.ts +0 -24
  124. package/database/dist/esm/commands/logic.js +0 -84
  125. package/database/dist/esm/commands/query.d.ts +0 -68
  126. package/database/dist/esm/commands/query.js +0 -154
  127. package/database/dist/esm/commands/update.d.ts +0 -29
  128. package/database/dist/esm/commands/update.js +0 -46
  129. package/database/dist/esm/config/app.config.d.ts +0 -6
  130. package/database/dist/esm/config/app.config.js +0 -5
  131. package/database/dist/esm/config/error.config.d.ts +0 -3
  132. package/database/dist/esm/config/error.config.js +0 -13
  133. package/database/dist/esm/const/code.d.ts +0 -30
  134. package/database/dist/esm/const/code.js +0 -30
  135. package/database/dist/esm/constant.d.ts +0 -51
  136. package/database/dist/esm/constant.js +0 -65
  137. package/database/dist/esm/document.d.ts +0 -11
  138. package/database/dist/esm/document.js +0 -257
  139. package/database/dist/esm/geo/index.d.ts +0 -6
  140. package/database/dist/esm/geo/index.js +0 -6
  141. package/database/dist/esm/geo/interface.d.ts +0 -24
  142. package/database/dist/esm/geo/interface.js +0 -1
  143. package/database/dist/esm/geo/lineString.d.ts +0 -19
  144. package/database/dist/esm/geo/lineString.js +0 -83
  145. package/database/dist/esm/geo/multiLineString.d.ts +0 -18
  146. package/database/dist/esm/geo/multiLineString.js +0 -92
  147. package/database/dist/esm/geo/multiPoint.d.ts +0 -18
  148. package/database/dist/esm/geo/multiPoint.js +0 -76
  149. package/database/dist/esm/geo/multiPolygon.d.ts +0 -18
  150. package/database/dist/esm/geo/multiPolygon.js +0 -119
  151. package/database/dist/esm/geo/point.d.ts +0 -19
  152. package/database/dist/esm/geo/point.js +0 -47
  153. package/database/dist/esm/geo/polygon.d.ts +0 -19
  154. package/database/dist/esm/geo/polygon.js +0 -106
  155. package/database/dist/esm/helper/symbol.d.ts +0 -14
  156. package/database/dist/esm/helper/symbol.js +0 -14
  157. package/database/dist/esm/index.d.ts +0 -40
  158. package/database/dist/esm/index.js +0 -55
  159. package/database/dist/esm/lib/util.d.ts +0 -1
  160. package/database/dist/esm/lib/util.js +0 -22
  161. package/database/dist/esm/operator-map.d.ts +0 -4
  162. package/database/dist/esm/operator-map.js +0 -20
  163. package/database/dist/esm/query.d.ts +0 -22
  164. package/database/dist/esm/query.js +0 -249
  165. package/database/dist/esm/regexp/index.d.ts +0 -14
  166. package/database/dist/esm/regexp/index.js +0 -29
  167. package/database/dist/esm/serializer/common.d.ts +0 -11
  168. package/database/dist/esm/serializer/common.js +0 -118
  169. package/database/dist/esm/serializer/datatype.d.ts +0 -7
  170. package/database/dist/esm/serializer/datatype.js +0 -127
  171. package/database/dist/esm/serializer/query.d.ts +0 -7
  172. package/database/dist/esm/serializer/query.js +0 -229
  173. package/database/dist/esm/serializer/update.d.ts +0 -15
  174. package/database/dist/esm/serializer/update.js +0 -139
  175. package/database/dist/esm/serverDate/index.d.ts +0 -13
  176. package/database/dist/esm/serverDate/index.js +0 -26
  177. package/database/dist/esm/transaction/collection.d.ts +0 -7
  178. package/database/dist/esm/transaction/collection.js +0 -46
  179. package/database/dist/esm/transaction/document.d.ts +0 -27
  180. package/database/dist/esm/transaction/document.js +0 -202
  181. package/database/dist/esm/transaction/index.d.ts +0 -30
  182. package/database/dist/esm/transaction/index.js +0 -210
  183. package/database/dist/esm/transaction/query.d.ts +0 -43
  184. package/database/dist/esm/transaction/query.js +0 -258
  185. package/database/dist/esm/typings/index.d.ts +0 -40
  186. package/database/dist/esm/typings/index.js +0 -1
  187. package/database/dist/esm/typings/realtime.d.ts +0 -219
  188. package/database/dist/esm/typings/realtime.js +0 -1
  189. package/database/dist/esm/util.d.ts +0 -9
  190. package/database/dist/esm/util.js +0 -142
  191. package/database/dist/esm/utils/error.d.ts +0 -38
  192. package/database/dist/esm/utils/error.js +0 -84
  193. package/database/dist/esm/utils/msg.d.ts +0 -0
  194. package/database/dist/esm/utils/msg.js +0 -0
  195. package/database/dist/esm/utils/symbol.d.ts +0 -8
  196. package/database/dist/esm/utils/symbol.js +0 -55
  197. package/database/dist/esm/utils/type.d.ts +0 -13
  198. package/database/dist/esm/utils/type.js +0 -20
  199. package/database/dist/esm/utils/utils.d.ts +0 -4
  200. package/database/dist/esm/utils/utils.js +0 -33
  201. package/database/dist/esm/validate.d.ts +0 -1
  202. package/database/dist/esm/validate.js +0 -57
@@ -1,38 +0,0 @@
1
- export interface ICloudSDKError extends Error {
2
- errCode: number;
3
- errMsg: string;
4
- }
5
- export declare class CloudSDKError extends Error {
6
- errCode: string;
7
- errMsg: string;
8
- requestID?: string;
9
- constructor(options: IErrorConstructorOptions);
10
- get message(): string;
11
- set message(msg: string);
12
- }
13
- interface IErrorConstructorOptions {
14
- errCode?: string;
15
- errMsg: string;
16
- }
17
- export declare function isSDKError(error: any): error is CloudSDKError;
18
- export interface IGenericError<T extends string, P = any> extends Error {
19
- type: T;
20
- payload: P;
21
- generic: boolean;
22
- }
23
- export declare const isGenericError: <T extends string, P>(e: any) => e is IGenericError<T, P>;
24
- export declare class TimeoutError extends Error implements IGenericError<'timeout', null> {
25
- type: "timeout";
26
- payload: any;
27
- generic: boolean;
28
- constructor(message: string);
29
- }
30
- export declare const isTimeoutError: (e: any) => e is TimeoutError;
31
- export declare class CancelledError extends Error implements IGenericError<'cancelled', null> {
32
- type: "cancelled";
33
- payload: any;
34
- generic: boolean;
35
- constructor(message: string);
36
- }
37
- export declare const isCancelledError: (e: any) => e is CancelledError;
38
- export {};
@@ -1,84 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { isString } from './type';
17
- import { ERR_CODE } from '../config/error.config';
18
- var CloudSDKError = (function (_super) {
19
- __extends(CloudSDKError, _super);
20
- function CloudSDKError(options) {
21
- var _this = _super.call(this, options.errMsg) || this;
22
- _this.errCode = 'UNKNOWN_ERROR';
23
- Object.defineProperties(_this, {
24
- message: {
25
- get: function () {
26
- return ("errCode: ".concat(this.errCode, " ").concat(ERR_CODE[this.errCode] ||
27
- '', " | errMsg: ") + this.errMsg);
28
- },
29
- set: function (msg) {
30
- this.errMsg = msg;
31
- }
32
- }
33
- });
34
- _this.errCode = options.errCode || 'UNKNOWN_ERROR';
35
- _this.errMsg = options.errMsg;
36
- return _this;
37
- }
38
- Object.defineProperty(CloudSDKError.prototype, "message", {
39
- get: function () {
40
- return "errCode: ".concat(this.errCode, " | errMsg: ") + this.errMsg;
41
- },
42
- set: function (msg) {
43
- this.errMsg = msg;
44
- },
45
- enumerable: false,
46
- configurable: true
47
- });
48
- return CloudSDKError;
49
- }(Error));
50
- export { CloudSDKError };
51
- export function isSDKError(error) {
52
- return (error && error instanceof Error && isString(error.errMsg));
53
- }
54
- export var isGenericError = function (e) { return e.generic; };
55
- var TimeoutError = (function (_super) {
56
- __extends(TimeoutError, _super);
57
- function TimeoutError(message) {
58
- var _this = _super.call(this, message) || this;
59
- _this.type = 'timeout';
60
- _this.payload = null;
61
- _this.generic = true;
62
- return _this;
63
- }
64
- return TimeoutError;
65
- }(Error));
66
- export { TimeoutError };
67
- export var isTimeoutError = function (e) {
68
- return e.type === 'timeout';
69
- };
70
- var CancelledError = (function (_super) {
71
- __extends(CancelledError, _super);
72
- function CancelledError(message) {
73
- var _this = _super.call(this, message) || this;
74
- _this.type = 'cancelled';
75
- _this.payload = null;
76
- _this.generic = true;
77
- return _this;
78
- }
79
- return CancelledError;
80
- }(Error));
81
- export { CancelledError };
82
- export var isCancelledError = function (e) {
83
- return e.type === 'cancelled';
84
- };
File without changes
File without changes
@@ -1,8 +0,0 @@
1
- declare class HiddenSymbol {
2
- constructor(target: any);
3
- }
4
- export declare class InternalSymbol extends HiddenSymbol {
5
- constructor(target: any, __mark__: any);
6
- static for(target: any): InternalSymbol;
7
- }
8
- export default InternalSymbol;
@@ -1,55 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var _symbols = [];
17
- var __internalMark__ = {};
18
- var HiddenSymbol = (function () {
19
- function HiddenSymbol(target) {
20
- Object.defineProperties(this, {
21
- target: {
22
- enumerable: false,
23
- writable: false,
24
- configurable: false,
25
- value: target,
26
- },
27
- });
28
- }
29
- return HiddenSymbol;
30
- }());
31
- var InternalSymbol = (function (_super) {
32
- __extends(InternalSymbol, _super);
33
- function InternalSymbol(target, __mark__) {
34
- if (__mark__ !== __internalMark__) {
35
- throw new TypeError('InternalSymbol cannot be constructed with new operator');
36
- }
37
- return _super.call(this, target) || this;
38
- }
39
- InternalSymbol.for = function (target) {
40
- for (var i = 0, len = _symbols.length; i < len; i++) {
41
- if (_symbols[i].target === target) {
42
- return _symbols[i].instance;
43
- }
44
- }
45
- var symbol = new InternalSymbol(target, __internalMark__);
46
- _symbols.push({
47
- target: target,
48
- instance: symbol,
49
- });
50
- return symbol;
51
- };
52
- return InternalSymbol;
53
- }(HiddenSymbol));
54
- export { InternalSymbol };
55
- export default InternalSymbol;
@@ -1,13 +0,0 @@
1
- export declare const getType: (x: any) => string;
2
- export declare const isObject: <T extends object>(x: any) => x is T;
3
- export declare const isString: (x: any) => x is string;
4
- export declare const isNumber: (x: any) => x is number;
5
- export declare const isPromise: <T extends Promise<any> = Promise<any>>(x: any) => x is T;
6
- type AnyFn = (...args: any[]) => any;
7
- export declare const isFunction: <T extends AnyFn = AnyFn>(x: any) => x is T;
8
- export declare const isArray: <T extends any[] = any[]>(x: any) => x is T;
9
- export declare const isDate: (x: any) => x is Date;
10
- export declare const isRegExp: (x: any) => x is RegExp;
11
- export declare const isInternalObject: (x: any) => boolean;
12
- export declare const isPlainObject: (obj: any) => obj is object;
13
- export {};
@@ -1,20 +0,0 @@
1
- import { InternalSymbol } from './symbol';
2
- export var getType = function (x) { return Object.prototype.toString.call(x).slice(8, -1).toLowerCase(); };
3
- export var isObject = function (x) { return getType(x) === 'object'; };
4
- export var isString = function (x) { return getType(x) === 'string'; };
5
- export var isNumber = function (x) { return getType(x) === 'number'; };
6
- export var isPromise = function (x) { return getType(x) === 'promise'; };
7
- export var isFunction = function (x) { return typeof x === 'function'; };
8
- export var isArray = function (x) { return Array.isArray(x); };
9
- export var isDate = function (x) { return getType(x) === 'date'; };
10
- export var isRegExp = function (x) { return getType(x) === 'regexp'; };
11
- export var isInternalObject = function (x) { return x && (x._internalType instanceof InternalSymbol); };
12
- export var isPlainObject = function (obj) {
13
- if (typeof obj !== 'object' || obj === null)
14
- return false;
15
- var proto = obj;
16
- while (Object.getPrototypeOf(proto) !== null) {
17
- proto = Object.getPrototypeOf(proto);
18
- }
19
- return Object.getPrototypeOf(obj) === proto;
20
- };
@@ -1,4 +0,0 @@
1
- import { Db } from '../';
2
- export declare const sleep: (ms?: number) => Promise<unknown>;
3
- export declare const autoCount: (domain?: string) => number;
4
- export declare function getWsInstance(db: Db): any;
@@ -1,33 +0,0 @@
1
- import { Db } from '../';
2
- export var sleep = function (ms) {
3
- if (ms === void 0) { ms = 0; }
4
- return new Promise(function (r) { return setTimeout(r, ms); });
5
- };
6
- var counters = {};
7
- export var autoCount = function (domain) {
8
- if (domain === void 0) { domain = 'any'; }
9
- if (!counters[domain]) {
10
- counters[domain] = 0;
11
- }
12
- return counters[domain]++;
13
- };
14
- var wsList = {};
15
- export function getWsInstance(db) {
16
- if (!Db.wsClientClass) {
17
- throw new Error('to use realtime you must import realtime module first');
18
- }
19
- var env = db.config.env;
20
- if (!wsList[env]) {
21
- wsList[env] = new Db.wsClientClass({
22
- context: {
23
- appConfig: {
24
- docSizeLimit: 1000,
25
- realtimePingInterval: 10000,
26
- realtimePongWaitTimeout: 5000,
27
- request: Db.createRequest(db.config)
28
- }
29
- }
30
- });
31
- }
32
- return wsList[env];
33
- }
@@ -1 +0,0 @@
1
- export {};
@@ -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 };