@cloudbase/js-sdk 3.6.4-alpha.1 → 3.6.5-alpha.0
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/CHANGELOG.md +4 -0
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.js +1 -1
- package/app/dist/index.node.esm.js +1 -1
- package/app/dist/index.node.esm.js.map +1 -1
- package/app/dist/index.node.js +1 -1
- package/app/dist/index.node.js.map +1 -1
- package/database/dist/index.d.ts +3 -0
- package/database/dist/index.esm.js +2 -0
- package/database/dist/index.esm.js.map +1 -0
- package/database/dist/index.js +2 -0
- package/database/dist/index.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +1 -1
- package/dist/index.node.esm.js.map +1 -1
- package/miniprogram_dist/app/index.js +1 -1
- package/miniprogram_dist/auth/index.d.ts +12 -27
- package/miniprogram_dist/auth/index.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/mysql/index.js +1 -1
- package/miniprogram_dist/oauth/index.d.ts +1 -1
- package/miniprogram_dist/oauth/index.js +1 -1
- package/package.json +17 -17
- package/types/auth.d.ts +77 -10
- package/types/error.d.ts +40 -0
- package/types/functions.d.ts +13 -4
- package/types/index.d.ts +63 -5
- package/types/package.json +5 -1
- package/types/result.d.ts +48 -0
- package/types/storage.d.ts +21 -3
- package/utilities/package.json +2 -2
- package/database/dist/commonjs/aggregate.d.ts +0 -29
- package/database/dist/commonjs/aggregate.js +0 -156
- package/database/dist/commonjs/collection.d.ts +0 -9
- package/database/dist/commonjs/collection.js +0 -49
- package/database/dist/commonjs/command.d.ts +0 -175
- package/database/dist/commonjs/command.js +0 -299
- package/database/dist/commonjs/commands/logic.d.ts +0 -24
- package/database/dist/commonjs/commands/logic.js +0 -89
- package/database/dist/commonjs/commands/query.d.ts +0 -68
- package/database/dist/commonjs/commands/query.js +0 -160
- package/database/dist/commonjs/commands/update.d.ts +0 -29
- package/database/dist/commonjs/commands/update.js +0 -51
- package/database/dist/commonjs/config/app.config.d.ts +0 -6
- package/database/dist/commonjs/config/app.config.js +0 -7
- package/database/dist/commonjs/config/error.config.d.ts +0 -3
- package/database/dist/commonjs/config/error.config.js +0 -16
- package/database/dist/commonjs/const/code.d.ts +0 -30
- package/database/dist/commonjs/const/code.js +0 -33
- package/database/dist/commonjs/constant.d.ts +0 -51
- package/database/dist/commonjs/constant.js +0 -75
- package/database/dist/commonjs/document.d.ts +0 -11
- package/database/dist/commonjs/document.js +0 -260
- package/database/dist/commonjs/geo/index.d.ts +0 -6
- package/database/dist/commonjs/geo/index.js +0 -22
- package/database/dist/commonjs/geo/interface.d.ts +0 -24
- package/database/dist/commonjs/geo/interface.js +0 -2
- package/database/dist/commonjs/geo/lineString.d.ts +0 -19
- package/database/dist/commonjs/geo/lineString.js +0 -86
- package/database/dist/commonjs/geo/multiLineString.d.ts +0 -18
- package/database/dist/commonjs/geo/multiLineString.js +0 -95
- package/database/dist/commonjs/geo/multiPoint.d.ts +0 -18
- package/database/dist/commonjs/geo/multiPoint.js +0 -79
- package/database/dist/commonjs/geo/multiPolygon.d.ts +0 -18
- package/database/dist/commonjs/geo/multiPolygon.js +0 -122
- package/database/dist/commonjs/geo/point.d.ts +0 -19
- package/database/dist/commonjs/geo/point.js +0 -50
- package/database/dist/commonjs/geo/polygon.d.ts +0 -19
- package/database/dist/commonjs/geo/polygon.js +0 -109
- package/database/dist/commonjs/helper/symbol.d.ts +0 -14
- package/database/dist/commonjs/helper/symbol.js +0 -31
- package/database/dist/commonjs/index.d.ts +0 -40
- package/database/dist/commonjs/index.js +0 -61
- package/database/dist/commonjs/lib/util.d.ts +0 -1
- package/database/dist/commonjs/lib/util.js +0 -26
- package/database/dist/commonjs/operator-map.d.ts +0 -4
- package/database/dist/commonjs/operator-map.js +0 -24
- package/database/dist/commonjs/query.d.ts +0 -22
- package/database/dist/commonjs/query.js +0 -252
- package/database/dist/commonjs/regexp/index.d.ts +0 -14
- package/database/dist/commonjs/regexp/index.js +0 -33
- package/database/dist/commonjs/serializer/common.d.ts +0 -11
- package/database/dist/commonjs/serializer/common.js +0 -127
- package/database/dist/commonjs/serializer/datatype.d.ts +0 -7
- package/database/dist/commonjs/serializer/datatype.js +0 -132
- package/database/dist/commonjs/serializer/query.d.ts +0 -7
- package/database/dist/commonjs/serializer/query.js +0 -232
- package/database/dist/commonjs/serializer/update.d.ts +0 -15
- package/database/dist/commonjs/serializer/update.js +0 -142
- package/database/dist/commonjs/serverDate/index.d.ts +0 -13
- package/database/dist/commonjs/serverDate/index.js +0 -30
- package/database/dist/commonjs/transaction/collection.d.ts +0 -7
- package/database/dist/commonjs/transaction/collection.js +0 -49
- package/database/dist/commonjs/transaction/document.d.ts +0 -27
- package/database/dist/commonjs/transaction/document.js +0 -205
- package/database/dist/commonjs/transaction/index.d.ts +0 -30
- package/database/dist/commonjs/transaction/index.js +0 -215
- package/database/dist/commonjs/transaction/query.d.ts +0 -43
- package/database/dist/commonjs/transaction/query.js +0 -261
- package/database/dist/commonjs/typings/index.d.ts +0 -40
- package/database/dist/commonjs/typings/index.js +0 -2
- package/database/dist/commonjs/typings/realtime.d.ts +0 -219
- package/database/dist/commonjs/typings/realtime.js +0 -2
- package/database/dist/commonjs/util.d.ts +0 -9
- package/database/dist/commonjs/util.js +0 -145
- package/database/dist/commonjs/utils/error.d.ts +0 -38
- package/database/dist/commonjs/utils/error.js +0 -91
- package/database/dist/commonjs/utils/msg.d.ts +0 -0
- package/database/dist/commonjs/utils/msg.js +0 -0
- package/database/dist/commonjs/utils/symbol.d.ts +0 -8
- package/database/dist/commonjs/utils/symbol.js +0 -58
- package/database/dist/commonjs/utils/type.d.ts +0 -13
- package/database/dist/commonjs/utils/type.js +0 -34
- package/database/dist/commonjs/utils/utils.d.ts +0 -4
- package/database/dist/commonjs/utils/utils.js +0 -39
- package/database/dist/commonjs/validate.d.ts +0 -1
- package/database/dist/commonjs/validate.js +0 -60
- package/database/dist/esm/aggregate.d.ts +0 -29
- package/database/dist/esm/aggregate.js +0 -154
- package/database/dist/esm/collection.d.ts +0 -9
- package/database/dist/esm/collection.js +0 -46
- package/database/dist/esm/command.d.ts +0 -175
- package/database/dist/esm/command.js +0 -296
- package/database/dist/esm/commands/logic.d.ts +0 -24
- package/database/dist/esm/commands/logic.js +0 -84
- package/database/dist/esm/commands/query.d.ts +0 -68
- package/database/dist/esm/commands/query.js +0 -154
- package/database/dist/esm/commands/update.d.ts +0 -29
- package/database/dist/esm/commands/update.js +0 -46
- package/database/dist/esm/config/app.config.d.ts +0 -6
- package/database/dist/esm/config/app.config.js +0 -5
- package/database/dist/esm/config/error.config.d.ts +0 -3
- package/database/dist/esm/config/error.config.js +0 -13
- package/database/dist/esm/const/code.d.ts +0 -30
- package/database/dist/esm/const/code.js +0 -30
- package/database/dist/esm/constant.d.ts +0 -51
- package/database/dist/esm/constant.js +0 -65
- package/database/dist/esm/document.d.ts +0 -11
- package/database/dist/esm/document.js +0 -257
- package/database/dist/esm/geo/index.d.ts +0 -6
- package/database/dist/esm/geo/index.js +0 -6
- package/database/dist/esm/geo/interface.d.ts +0 -24
- package/database/dist/esm/geo/interface.js +0 -1
- package/database/dist/esm/geo/lineString.d.ts +0 -19
- package/database/dist/esm/geo/lineString.js +0 -83
- package/database/dist/esm/geo/multiLineString.d.ts +0 -18
- package/database/dist/esm/geo/multiLineString.js +0 -92
- package/database/dist/esm/geo/multiPoint.d.ts +0 -18
- package/database/dist/esm/geo/multiPoint.js +0 -76
- package/database/dist/esm/geo/multiPolygon.d.ts +0 -18
- package/database/dist/esm/geo/multiPolygon.js +0 -119
- package/database/dist/esm/geo/point.d.ts +0 -19
- package/database/dist/esm/geo/point.js +0 -47
- package/database/dist/esm/geo/polygon.d.ts +0 -19
- package/database/dist/esm/geo/polygon.js +0 -106
- package/database/dist/esm/helper/symbol.d.ts +0 -14
- package/database/dist/esm/helper/symbol.js +0 -14
- package/database/dist/esm/index.d.ts +0 -40
- package/database/dist/esm/index.js +0 -55
- package/database/dist/esm/lib/util.d.ts +0 -1
- package/database/dist/esm/lib/util.js +0 -22
- package/database/dist/esm/operator-map.d.ts +0 -4
- package/database/dist/esm/operator-map.js +0 -20
- package/database/dist/esm/query.d.ts +0 -22
- package/database/dist/esm/query.js +0 -249
- package/database/dist/esm/regexp/index.d.ts +0 -14
- package/database/dist/esm/regexp/index.js +0 -29
- package/database/dist/esm/serializer/common.d.ts +0 -11
- package/database/dist/esm/serializer/common.js +0 -118
- package/database/dist/esm/serializer/datatype.d.ts +0 -7
- package/database/dist/esm/serializer/datatype.js +0 -127
- package/database/dist/esm/serializer/query.d.ts +0 -7
- package/database/dist/esm/serializer/query.js +0 -229
- package/database/dist/esm/serializer/update.d.ts +0 -15
- package/database/dist/esm/serializer/update.js +0 -139
- package/database/dist/esm/serverDate/index.d.ts +0 -13
- package/database/dist/esm/serverDate/index.js +0 -26
- package/database/dist/esm/transaction/collection.d.ts +0 -7
- package/database/dist/esm/transaction/collection.js +0 -46
- package/database/dist/esm/transaction/document.d.ts +0 -27
- package/database/dist/esm/transaction/document.js +0 -202
- package/database/dist/esm/transaction/index.d.ts +0 -30
- package/database/dist/esm/transaction/index.js +0 -210
- package/database/dist/esm/transaction/query.d.ts +0 -43
- package/database/dist/esm/transaction/query.js +0 -258
- package/database/dist/esm/typings/index.d.ts +0 -40
- package/database/dist/esm/typings/index.js +0 -1
- package/database/dist/esm/typings/realtime.d.ts +0 -219
- package/database/dist/esm/typings/realtime.js +0 -1
- package/database/dist/esm/util.d.ts +0 -9
- package/database/dist/esm/util.js +0 -142
- package/database/dist/esm/utils/error.d.ts +0 -38
- package/database/dist/esm/utils/error.js +0 -84
- package/database/dist/esm/utils/msg.d.ts +0 -0
- package/database/dist/esm/utils/msg.js +0 -0
- package/database/dist/esm/utils/symbol.d.ts +0 -8
- package/database/dist/esm/utils/symbol.js +0 -55
- package/database/dist/esm/utils/type.d.ts +0 -13
- package/database/dist/esm/utils/type.js +0 -20
- package/database/dist/esm/utils/utils.d.ts +0 -4
- package/database/dist/esm/utils/utils.js +0 -33
- package/database/dist/esm/validate.d.ts +0 -1
- package/database/dist/esm/validate.js +0 -57
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.CollectionReference = void 0;
|
|
19
|
-
var document_1 = require("./document");
|
|
20
|
-
var query_1 = require("./query");
|
|
21
|
-
var aggregate_1 = require("./aggregate");
|
|
22
|
-
var CollectionReference = (function (_super) {
|
|
23
|
-
__extends(CollectionReference, _super);
|
|
24
|
-
function CollectionReference(db, coll) {
|
|
25
|
-
return _super.call(this, db, coll) || this;
|
|
26
|
-
}
|
|
27
|
-
Object.defineProperty(CollectionReference.prototype, "name", {
|
|
28
|
-
get: function () {
|
|
29
|
-
return this._coll;
|
|
30
|
-
},
|
|
31
|
-
enumerable: false,
|
|
32
|
-
configurable: true
|
|
33
|
-
});
|
|
34
|
-
CollectionReference.prototype.doc = function (docID) {
|
|
35
|
-
if (typeof docID !== 'string' && typeof docID !== 'number') {
|
|
36
|
-
throw new Error('docId必须为字符串或数字');
|
|
37
|
-
}
|
|
38
|
-
return new document_1.DocumentReference(this._db, this._coll, docID);
|
|
39
|
-
};
|
|
40
|
-
CollectionReference.prototype.add = function (data, callback) {
|
|
41
|
-
var docRef = new document_1.DocumentReference(this._db, this._coll, undefined);
|
|
42
|
-
return docRef.create(data, callback);
|
|
43
|
-
};
|
|
44
|
-
CollectionReference.prototype.aggregate = function () {
|
|
45
|
-
return new aggregate_1.default(this._db, this._coll);
|
|
46
|
-
};
|
|
47
|
-
return CollectionReference;
|
|
48
|
-
}(query_1.Query));
|
|
49
|
-
exports.CollectionReference = CollectionReference;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { QueryCommand } from './commands/query';
|
|
2
|
-
import { LogicCommand } from './commands/logic';
|
|
3
|
-
import { UpdateCommand } from './commands/update';
|
|
4
|
-
import Aggregation from './aggregate';
|
|
5
|
-
export type IQueryCondition = Record<string, any> | LogicCommand;
|
|
6
|
-
export declare const Command: {
|
|
7
|
-
eq(val: any): QueryCommand;
|
|
8
|
-
neq(val: any): QueryCommand;
|
|
9
|
-
lt(val: any): QueryCommand;
|
|
10
|
-
lte(val: any): QueryCommand;
|
|
11
|
-
gt(val: any): QueryCommand;
|
|
12
|
-
gte(val: any): QueryCommand;
|
|
13
|
-
in(val: any): QueryCommand;
|
|
14
|
-
nin(val: any): QueryCommand;
|
|
15
|
-
all(val: any): QueryCommand;
|
|
16
|
-
elemMatch(val: any): QueryCommand;
|
|
17
|
-
exists(val: boolean): QueryCommand;
|
|
18
|
-
size(val: number): QueryCommand;
|
|
19
|
-
mod(val: number[]): QueryCommand;
|
|
20
|
-
geoNear(val: any): QueryCommand;
|
|
21
|
-
geoWithin(val: any): QueryCommand;
|
|
22
|
-
geoIntersects(val: any): QueryCommand;
|
|
23
|
-
and(...__expressions__: IQueryCondition[]): LogicCommand;
|
|
24
|
-
nor(...__expressions__: IQueryCondition[]): LogicCommand;
|
|
25
|
-
or(...__expressions__: IQueryCondition[]): LogicCommand;
|
|
26
|
-
not(...__expressions__: IQueryCondition[]): LogicCommand;
|
|
27
|
-
set(val: any): UpdateCommand;
|
|
28
|
-
remove(): UpdateCommand;
|
|
29
|
-
inc(val: number): UpdateCommand;
|
|
30
|
-
mul(val: number): UpdateCommand;
|
|
31
|
-
push(...args: any[]): UpdateCommand;
|
|
32
|
-
pull(values: any): UpdateCommand;
|
|
33
|
-
pullAll(values: any): UpdateCommand;
|
|
34
|
-
pop(): UpdateCommand;
|
|
35
|
-
shift(): UpdateCommand;
|
|
36
|
-
unshift(...__values__: any[]): UpdateCommand;
|
|
37
|
-
addToSet(values: any): UpdateCommand;
|
|
38
|
-
rename(values: any): UpdateCommand;
|
|
39
|
-
bit(values: any): UpdateCommand;
|
|
40
|
-
max(values: any): UpdateCommand;
|
|
41
|
-
min(values: any): UpdateCommand;
|
|
42
|
-
expr(values: AggregationOperator): {
|
|
43
|
-
$expr: AggregationOperator;
|
|
44
|
-
};
|
|
45
|
-
jsonSchema(schema: any): {
|
|
46
|
-
$jsonSchema: any;
|
|
47
|
-
};
|
|
48
|
-
text(values: string | {
|
|
49
|
-
search: string;
|
|
50
|
-
language?: string;
|
|
51
|
-
caseSensitive?: boolean;
|
|
52
|
-
diacriticSensitive: boolean;
|
|
53
|
-
}): {
|
|
54
|
-
$search: {
|
|
55
|
-
(regexp: string | RegExp): number;
|
|
56
|
-
(searcher: {
|
|
57
|
-
[Symbol.search](string: string): number;
|
|
58
|
-
}): number;
|
|
59
|
-
};
|
|
60
|
-
$language?: undefined;
|
|
61
|
-
$caseSensitive?: undefined;
|
|
62
|
-
$diacriticSensitive?: undefined;
|
|
63
|
-
} | {
|
|
64
|
-
$search: string;
|
|
65
|
-
$language: string;
|
|
66
|
-
$caseSensitive: boolean;
|
|
67
|
-
$diacriticSensitive: boolean;
|
|
68
|
-
};
|
|
69
|
-
aggregate: {
|
|
70
|
-
pipeline(): Aggregation;
|
|
71
|
-
abs: (param: any) => AggregationOperator;
|
|
72
|
-
add: (param: any) => AggregationOperator;
|
|
73
|
-
ceil: (param: any) => AggregationOperator;
|
|
74
|
-
divide: (param: any) => AggregationOperator;
|
|
75
|
-
exp: (param: any) => AggregationOperator;
|
|
76
|
-
floor: (param: any) => AggregationOperator;
|
|
77
|
-
ln: (param: any) => AggregationOperator;
|
|
78
|
-
log: (param: any) => AggregationOperator;
|
|
79
|
-
log10: (param: any) => AggregationOperator;
|
|
80
|
-
mod: (param: any) => AggregationOperator;
|
|
81
|
-
multiply: (param: any) => AggregationOperator;
|
|
82
|
-
pow: (param: any) => AggregationOperator;
|
|
83
|
-
sqrt: (param: any) => AggregationOperator;
|
|
84
|
-
subtract: (param: any) => AggregationOperator;
|
|
85
|
-
trunc: (param: any) => AggregationOperator;
|
|
86
|
-
arrayElemAt: (param: any) => AggregationOperator;
|
|
87
|
-
arrayToObject: (param: any) => AggregationOperator;
|
|
88
|
-
concatArrays: (param: any) => AggregationOperator;
|
|
89
|
-
filter: (param: any) => AggregationOperator;
|
|
90
|
-
in: (param: any) => AggregationOperator;
|
|
91
|
-
indexOfArray: (param: any) => AggregationOperator;
|
|
92
|
-
isArray: (param: any) => AggregationOperator;
|
|
93
|
-
map: (param: any) => AggregationOperator;
|
|
94
|
-
range: (param: any) => AggregationOperator;
|
|
95
|
-
reduce: (param: any) => AggregationOperator;
|
|
96
|
-
reverseArray: (param: any) => AggregationOperator;
|
|
97
|
-
size: (param: any) => AggregationOperator;
|
|
98
|
-
slice: (param: any) => AggregationOperator;
|
|
99
|
-
zip: (param: any) => AggregationOperator;
|
|
100
|
-
and: (param: any) => AggregationOperator;
|
|
101
|
-
not: (param: any) => AggregationOperator;
|
|
102
|
-
or: (param: any) => AggregationOperator;
|
|
103
|
-
cmp: (param: any) => AggregationOperator;
|
|
104
|
-
eq: (param: any) => AggregationOperator;
|
|
105
|
-
gt: (param: any) => AggregationOperator;
|
|
106
|
-
gte: (param: any) => AggregationOperator;
|
|
107
|
-
lt: (param: any) => AggregationOperator;
|
|
108
|
-
lte: (param: any) => AggregationOperator;
|
|
109
|
-
neq: (param: any) => AggregationOperator;
|
|
110
|
-
cond: (param: any) => AggregationOperator;
|
|
111
|
-
ifNull: (param: any) => AggregationOperator;
|
|
112
|
-
switch: (param: any) => AggregationOperator;
|
|
113
|
-
dateFromParts: (param: any) => AggregationOperator;
|
|
114
|
-
dateFromString: (param: any) => AggregationOperator;
|
|
115
|
-
dayOfMonth: (param: any) => AggregationOperator;
|
|
116
|
-
dayOfWeek: (param: any) => AggregationOperator;
|
|
117
|
-
dayOfYear: (param: any) => AggregationOperator;
|
|
118
|
-
isoDayOfWeek: (param: any) => AggregationOperator;
|
|
119
|
-
isoWeek: (param: any) => AggregationOperator;
|
|
120
|
-
isoWeekYear: (param: any) => AggregationOperator;
|
|
121
|
-
millisecond: (param: any) => AggregationOperator;
|
|
122
|
-
minute: (param: any) => AggregationOperator;
|
|
123
|
-
month: (param: any) => AggregationOperator;
|
|
124
|
-
second: (param: any) => AggregationOperator;
|
|
125
|
-
hour: (param: any) => AggregationOperator;
|
|
126
|
-
week: (param: any) => AggregationOperator;
|
|
127
|
-
year: (param: any) => AggregationOperator;
|
|
128
|
-
literal: (param: any) => AggregationOperator;
|
|
129
|
-
mergeObjects: (param: any) => AggregationOperator;
|
|
130
|
-
objectToArray: (param: any) => AggregationOperator;
|
|
131
|
-
allElementsTrue: (param: any) => AggregationOperator;
|
|
132
|
-
anyElementTrue: (param: any) => AggregationOperator;
|
|
133
|
-
setDifference: (param: any) => AggregationOperator;
|
|
134
|
-
setEquals: (param: any) => AggregationOperator;
|
|
135
|
-
setIntersection: (param: any) => AggregationOperator;
|
|
136
|
-
setIsSubset: (param: any) => AggregationOperator;
|
|
137
|
-
setUnion: (param: any) => AggregationOperator;
|
|
138
|
-
concat: (param: any) => AggregationOperator;
|
|
139
|
-
dateToString: (param: any) => AggregationOperator;
|
|
140
|
-
indexOfBytes: (param: any) => AggregationOperator;
|
|
141
|
-
indexOfCP: (param: any) => AggregationOperator;
|
|
142
|
-
split: (param: any) => AggregationOperator;
|
|
143
|
-
strLenBytes: (param: any) => AggregationOperator;
|
|
144
|
-
strLenCP: (param: any) => AggregationOperator;
|
|
145
|
-
strcasecmp: (param: any) => AggregationOperator;
|
|
146
|
-
substr: (param: any) => AggregationOperator;
|
|
147
|
-
substrBytes: (param: any) => AggregationOperator;
|
|
148
|
-
substrCP: (param: any) => AggregationOperator;
|
|
149
|
-
toLower: (param: any) => AggregationOperator;
|
|
150
|
-
toUpper: (param: any) => AggregationOperator;
|
|
151
|
-
meta: (param: any) => AggregationOperator;
|
|
152
|
-
addToSet: (param: any) => AggregationOperator;
|
|
153
|
-
avg: (param: any) => AggregationOperator;
|
|
154
|
-
first: (param: any) => AggregationOperator;
|
|
155
|
-
last: (param: any) => AggregationOperator;
|
|
156
|
-
max: (param: any) => AggregationOperator;
|
|
157
|
-
min: (param: any) => AggregationOperator;
|
|
158
|
-
push: (param: any) => AggregationOperator;
|
|
159
|
-
stdDevPop: (param: any) => AggregationOperator;
|
|
160
|
-
stdDevSamp: (param: any) => AggregationOperator;
|
|
161
|
-
sum: (param: any) => AggregationOperator;
|
|
162
|
-
let: (param: any) => AggregationOperator;
|
|
163
|
-
};
|
|
164
|
-
project: {
|
|
165
|
-
slice: (param: any) => ProjectionOperator;
|
|
166
|
-
elemMatch: (param: any) => ProjectionOperator;
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
declare class AggregationOperator {
|
|
170
|
-
constructor(name: any, param: any);
|
|
171
|
-
}
|
|
172
|
-
declare class ProjectionOperator {
|
|
173
|
-
constructor(name: any, param: any);
|
|
174
|
-
}
|
|
175
|
-
export default Command;
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Command = void 0;
|
|
4
|
-
var query_1 = require("./commands/query");
|
|
5
|
-
var logic_1 = require("./commands/logic");
|
|
6
|
-
var update_1 = require("./commands/update");
|
|
7
|
-
var type_1 = require("./utils/type");
|
|
8
|
-
var aggregate_1 = require("./aggregate");
|
|
9
|
-
exports.Command = {
|
|
10
|
-
eq: function (val) {
|
|
11
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.EQ, [val]);
|
|
12
|
-
},
|
|
13
|
-
neq: function (val) {
|
|
14
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.NEQ, [val]);
|
|
15
|
-
},
|
|
16
|
-
lt: function (val) {
|
|
17
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.LT, [val]);
|
|
18
|
-
},
|
|
19
|
-
lte: function (val) {
|
|
20
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.LTE, [val]);
|
|
21
|
-
},
|
|
22
|
-
gt: function (val) {
|
|
23
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.GT, [val]);
|
|
24
|
-
},
|
|
25
|
-
gte: function (val) {
|
|
26
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.GTE, [val]);
|
|
27
|
-
},
|
|
28
|
-
in: function (val) {
|
|
29
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.IN, val);
|
|
30
|
-
},
|
|
31
|
-
nin: function (val) {
|
|
32
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.NIN, val);
|
|
33
|
-
},
|
|
34
|
-
all: function (val) {
|
|
35
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.ALL, val);
|
|
36
|
-
},
|
|
37
|
-
elemMatch: function (val) {
|
|
38
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.ELEM_MATCH, [val]);
|
|
39
|
-
},
|
|
40
|
-
exists: function (val) {
|
|
41
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.EXISTS, [val]);
|
|
42
|
-
},
|
|
43
|
-
size: function (val) {
|
|
44
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.SIZE, [val]);
|
|
45
|
-
},
|
|
46
|
-
mod: function (val) {
|
|
47
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.MOD, [val]);
|
|
48
|
-
},
|
|
49
|
-
geoNear: function (val) {
|
|
50
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.GEO_NEAR, [val]);
|
|
51
|
-
},
|
|
52
|
-
geoWithin: function (val) {
|
|
53
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.GEO_WITHIN, [val]);
|
|
54
|
-
},
|
|
55
|
-
geoIntersects: function (val) {
|
|
56
|
-
return new query_1.QueryCommand(query_1.QUERY_COMMANDS_LITERAL.GEO_INTERSECTS, [val]);
|
|
57
|
-
},
|
|
58
|
-
and: function () {
|
|
59
|
-
var __expressions__ = [];
|
|
60
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
61
|
-
__expressions__[_i] = arguments[_i];
|
|
62
|
-
}
|
|
63
|
-
var expressions = (0, type_1.isArray)(arguments[0]) ? arguments[0] : Array.from(arguments);
|
|
64
|
-
return new logic_1.LogicCommand(logic_1.LOGIC_COMMANDS_LITERAL.AND, expressions);
|
|
65
|
-
},
|
|
66
|
-
nor: function () {
|
|
67
|
-
var __expressions__ = [];
|
|
68
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
69
|
-
__expressions__[_i] = arguments[_i];
|
|
70
|
-
}
|
|
71
|
-
var expressions = (0, type_1.isArray)(arguments[0]) ? arguments[0] : Array.from(arguments);
|
|
72
|
-
return new logic_1.LogicCommand(logic_1.LOGIC_COMMANDS_LITERAL.NOR, expressions);
|
|
73
|
-
},
|
|
74
|
-
or: function () {
|
|
75
|
-
var __expressions__ = [];
|
|
76
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
77
|
-
__expressions__[_i] = arguments[_i];
|
|
78
|
-
}
|
|
79
|
-
var expressions = (0, type_1.isArray)(arguments[0]) ? arguments[0] : Array.from(arguments);
|
|
80
|
-
return new logic_1.LogicCommand(logic_1.LOGIC_COMMANDS_LITERAL.OR, expressions);
|
|
81
|
-
},
|
|
82
|
-
not: function () {
|
|
83
|
-
var __expressions__ = [];
|
|
84
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
85
|
-
__expressions__[_i] = arguments[_i];
|
|
86
|
-
}
|
|
87
|
-
var expressions = (0, type_1.isArray)(arguments[0]) ? arguments[0] : Array.from(arguments);
|
|
88
|
-
return new logic_1.LogicCommand(logic_1.LOGIC_COMMANDS_LITERAL.NOT, expressions);
|
|
89
|
-
},
|
|
90
|
-
set: function (val) {
|
|
91
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.SET, [val]);
|
|
92
|
-
},
|
|
93
|
-
remove: function () {
|
|
94
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.REMOVE, []);
|
|
95
|
-
},
|
|
96
|
-
inc: function (val) {
|
|
97
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.INC, [val]);
|
|
98
|
-
},
|
|
99
|
-
mul: function (val) {
|
|
100
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.MUL, [val]);
|
|
101
|
-
},
|
|
102
|
-
push: function () {
|
|
103
|
-
var args = [];
|
|
104
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
105
|
-
args[_i] = arguments[_i];
|
|
106
|
-
}
|
|
107
|
-
var values;
|
|
108
|
-
if ((0, type_1.isObject)(args[0]) && args[0].hasOwnProperty('each')) {
|
|
109
|
-
var options = args[0];
|
|
110
|
-
values = {
|
|
111
|
-
$each: options.each,
|
|
112
|
-
$position: options.position,
|
|
113
|
-
$sort: options.sort,
|
|
114
|
-
$slice: options.slice
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
else if ((0, type_1.isArray)(args[0])) {
|
|
118
|
-
values = args[0];
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
values = Array.from(args);
|
|
122
|
-
}
|
|
123
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.PUSH, values);
|
|
124
|
-
},
|
|
125
|
-
pull: function (values) {
|
|
126
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.PULL, values);
|
|
127
|
-
},
|
|
128
|
-
pullAll: function (values) {
|
|
129
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.PULL_ALL, values);
|
|
130
|
-
},
|
|
131
|
-
pop: function () {
|
|
132
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.POP, []);
|
|
133
|
-
},
|
|
134
|
-
shift: function () {
|
|
135
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.SHIFT, []);
|
|
136
|
-
},
|
|
137
|
-
unshift: function () {
|
|
138
|
-
var __values__ = [];
|
|
139
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
140
|
-
__values__[_i] = arguments[_i];
|
|
141
|
-
}
|
|
142
|
-
var values = (0, type_1.isArray)(arguments[0]) ? arguments[0] : Array.from(arguments);
|
|
143
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.UNSHIFT, values);
|
|
144
|
-
},
|
|
145
|
-
addToSet: function (values) {
|
|
146
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.ADD_TO_SET, values);
|
|
147
|
-
},
|
|
148
|
-
rename: function (values) {
|
|
149
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.RENAME, [values]);
|
|
150
|
-
},
|
|
151
|
-
bit: function (values) {
|
|
152
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.BIT, [values]);
|
|
153
|
-
},
|
|
154
|
-
max: function (values) {
|
|
155
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.MAX, [values]);
|
|
156
|
-
},
|
|
157
|
-
min: function (values) {
|
|
158
|
-
return new update_1.UpdateCommand(update_1.UPDATE_COMMANDS_LITERAL.MIN, [values]);
|
|
159
|
-
},
|
|
160
|
-
expr: function (values) {
|
|
161
|
-
return {
|
|
162
|
-
$expr: values
|
|
163
|
-
};
|
|
164
|
-
},
|
|
165
|
-
jsonSchema: function (schema) {
|
|
166
|
-
return {
|
|
167
|
-
$jsonSchema: schema
|
|
168
|
-
};
|
|
169
|
-
},
|
|
170
|
-
text: function (values) {
|
|
171
|
-
if ((0, type_1.isString)(values)) {
|
|
172
|
-
return {
|
|
173
|
-
$search: values.search
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
return {
|
|
178
|
-
$search: values.search,
|
|
179
|
-
$language: values.language,
|
|
180
|
-
$caseSensitive: values.caseSensitive,
|
|
181
|
-
$diacriticSensitive: values.diacriticSensitive
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
aggregate: {
|
|
186
|
-
pipeline: function () {
|
|
187
|
-
return new aggregate_1.default();
|
|
188
|
-
},
|
|
189
|
-
abs: function (param) { return new AggregationOperator('abs', param); },
|
|
190
|
-
add: function (param) { return new AggregationOperator('add', param); },
|
|
191
|
-
ceil: function (param) { return new AggregationOperator('ceil', param); },
|
|
192
|
-
divide: function (param) { return new AggregationOperator('divide', param); },
|
|
193
|
-
exp: function (param) { return new AggregationOperator('exp', param); },
|
|
194
|
-
floor: function (param) { return new AggregationOperator('floor', param); },
|
|
195
|
-
ln: function (param) { return new AggregationOperator('ln', param); },
|
|
196
|
-
log: function (param) { return new AggregationOperator('log', param); },
|
|
197
|
-
log10: function (param) { return new AggregationOperator('log10', param); },
|
|
198
|
-
mod: function (param) { return new AggregationOperator('mod', param); },
|
|
199
|
-
multiply: function (param) { return new AggregationOperator('multiply', param); },
|
|
200
|
-
pow: function (param) { return new AggregationOperator('pow', param); },
|
|
201
|
-
sqrt: function (param) { return new AggregationOperator('sqrt', param); },
|
|
202
|
-
subtract: function (param) { return new AggregationOperator('subtract', param); },
|
|
203
|
-
trunc: function (param) { return new AggregationOperator('trunc', param); },
|
|
204
|
-
arrayElemAt: function (param) { return new AggregationOperator('arrayElemAt', param); },
|
|
205
|
-
arrayToObject: function (param) { return new AggregationOperator('arrayToObject', param); },
|
|
206
|
-
concatArrays: function (param) { return new AggregationOperator('concatArrays', param); },
|
|
207
|
-
filter: function (param) { return new AggregationOperator('filter', param); },
|
|
208
|
-
in: function (param) { return new AggregationOperator('in', param); },
|
|
209
|
-
indexOfArray: function (param) { return new AggregationOperator('indexOfArray', param); },
|
|
210
|
-
isArray: function (param) { return new AggregationOperator('isArray', param); },
|
|
211
|
-
map: function (param) { return new AggregationOperator('map', param); },
|
|
212
|
-
range: function (param) { return new AggregationOperator('range', param); },
|
|
213
|
-
reduce: function (param) { return new AggregationOperator('reduce', param); },
|
|
214
|
-
reverseArray: function (param) { return new AggregationOperator('reverseArray', param); },
|
|
215
|
-
size: function (param) { return new AggregationOperator('size', param); },
|
|
216
|
-
slice: function (param) { return new AggregationOperator('slice', param); },
|
|
217
|
-
zip: function (param) { return new AggregationOperator('zip', param); },
|
|
218
|
-
and: function (param) { return new AggregationOperator('and', param); },
|
|
219
|
-
not: function (param) { return new AggregationOperator('not', param); },
|
|
220
|
-
or: function (param) { return new AggregationOperator('or', param); },
|
|
221
|
-
cmp: function (param) { return new AggregationOperator('cmp', param); },
|
|
222
|
-
eq: function (param) { return new AggregationOperator('eq', param); },
|
|
223
|
-
gt: function (param) { return new AggregationOperator('gt', param); },
|
|
224
|
-
gte: function (param) { return new AggregationOperator('gte', param); },
|
|
225
|
-
lt: function (param) { return new AggregationOperator('lt', param); },
|
|
226
|
-
lte: function (param) { return new AggregationOperator('lte', param); },
|
|
227
|
-
neq: function (param) { return new AggregationOperator('ne', param); },
|
|
228
|
-
cond: function (param) { return new AggregationOperator('cond', param); },
|
|
229
|
-
ifNull: function (param) { return new AggregationOperator('ifNull', param); },
|
|
230
|
-
switch: function (param) { return new AggregationOperator('switch', param); },
|
|
231
|
-
dateFromParts: function (param) { return new AggregationOperator('dateFromParts', param); },
|
|
232
|
-
dateFromString: function (param) { return new AggregationOperator('dateFromString', param); },
|
|
233
|
-
dayOfMonth: function (param) { return new AggregationOperator('dayOfMonth', param); },
|
|
234
|
-
dayOfWeek: function (param) { return new AggregationOperator('dayOfWeek', param); },
|
|
235
|
-
dayOfYear: function (param) { return new AggregationOperator('dayOfYear', param); },
|
|
236
|
-
isoDayOfWeek: function (param) { return new AggregationOperator('isoDayOfWeek', param); },
|
|
237
|
-
isoWeek: function (param) { return new AggregationOperator('isoWeek', param); },
|
|
238
|
-
isoWeekYear: function (param) { return new AggregationOperator('isoWeekYear', param); },
|
|
239
|
-
millisecond: function (param) { return new AggregationOperator('millisecond', param); },
|
|
240
|
-
minute: function (param) { return new AggregationOperator('minute', param); },
|
|
241
|
-
month: function (param) { return new AggregationOperator('month', param); },
|
|
242
|
-
second: function (param) { return new AggregationOperator('second', param); },
|
|
243
|
-
hour: function (param) { return new AggregationOperator('hour', param); },
|
|
244
|
-
week: function (param) { return new AggregationOperator('week', param); },
|
|
245
|
-
year: function (param) { return new AggregationOperator('year', param); },
|
|
246
|
-
literal: function (param) { return new AggregationOperator('literal', param); },
|
|
247
|
-
mergeObjects: function (param) { return new AggregationOperator('mergeObjects', param); },
|
|
248
|
-
objectToArray: function (param) { return new AggregationOperator('objectToArray', param); },
|
|
249
|
-
allElementsTrue: function (param) { return new AggregationOperator('allElementsTrue', param); },
|
|
250
|
-
anyElementTrue: function (param) { return new AggregationOperator('anyElementTrue', param); },
|
|
251
|
-
setDifference: function (param) { return new AggregationOperator('setDifference', param); },
|
|
252
|
-
setEquals: function (param) { return new AggregationOperator('setEquals', param); },
|
|
253
|
-
setIntersection: function (param) { return new AggregationOperator('setIntersection', param); },
|
|
254
|
-
setIsSubset: function (param) { return new AggregationOperator('setIsSubset', param); },
|
|
255
|
-
setUnion: function (param) { return new AggregationOperator('setUnion', param); },
|
|
256
|
-
concat: function (param) { return new AggregationOperator('concat', param); },
|
|
257
|
-
dateToString: function (param) { return new AggregationOperator('dateToString', param); },
|
|
258
|
-
indexOfBytes: function (param) { return new AggregationOperator('indexOfBytes', param); },
|
|
259
|
-
indexOfCP: function (param) { return new AggregationOperator('indexOfCP', param); },
|
|
260
|
-
split: function (param) { return new AggregationOperator('split', param); },
|
|
261
|
-
strLenBytes: function (param) { return new AggregationOperator('strLenBytes', param); },
|
|
262
|
-
strLenCP: function (param) { return new AggregationOperator('strLenCP', param); },
|
|
263
|
-
strcasecmp: function (param) { return new AggregationOperator('strcasecmp', param); },
|
|
264
|
-
substr: function (param) { return new AggregationOperator('substr', param); },
|
|
265
|
-
substrBytes: function (param) { return new AggregationOperator('substrBytes', param); },
|
|
266
|
-
substrCP: function (param) { return new AggregationOperator('substrCP', param); },
|
|
267
|
-
toLower: function (param) { return new AggregationOperator('toLower', param); },
|
|
268
|
-
toUpper: function (param) { return new AggregationOperator('toUpper', param); },
|
|
269
|
-
meta: function (param) { return new AggregationOperator('meta', param); },
|
|
270
|
-
addToSet: function (param) { return new AggregationOperator('addToSet', param); },
|
|
271
|
-
avg: function (param) { return new AggregationOperator('avg', param); },
|
|
272
|
-
first: function (param) { return new AggregationOperator('first', param); },
|
|
273
|
-
last: function (param) { return new AggregationOperator('last', param); },
|
|
274
|
-
max: function (param) { return new AggregationOperator('max', param); },
|
|
275
|
-
min: function (param) { return new AggregationOperator('min', param); },
|
|
276
|
-
push: function (param) { return new AggregationOperator('push', param); },
|
|
277
|
-
stdDevPop: function (param) { return new AggregationOperator('stdDevPop', param); },
|
|
278
|
-
stdDevSamp: function (param) { return new AggregationOperator('stdDevSamp', param); },
|
|
279
|
-
sum: function (param) { return new AggregationOperator('sum', param); },
|
|
280
|
-
let: function (param) { return new AggregationOperator('let', param); }
|
|
281
|
-
},
|
|
282
|
-
project: {
|
|
283
|
-
slice: function (param) { return new ProjectionOperator('slice', param); },
|
|
284
|
-
elemMatch: function (param) { return new ProjectionOperator('elemMatch', param); }
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var AggregationOperator = (function () {
|
|
288
|
-
function AggregationOperator(name, param) {
|
|
289
|
-
this['$' + name] = param;
|
|
290
|
-
}
|
|
291
|
-
return AggregationOperator;
|
|
292
|
-
}());
|
|
293
|
-
var ProjectionOperator = (function () {
|
|
294
|
-
function ProjectionOperator(name, param) {
|
|
295
|
-
this['$' + name] = param;
|
|
296
|
-
}
|
|
297
|
-
return ProjectionOperator;
|
|
298
|
-
}());
|
|
299
|
-
exports.default = exports.Command;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { InternalSymbol } from '../helper/symbol';
|
|
2
|
-
export declare const AND = "and";
|
|
3
|
-
export declare const OR = "or";
|
|
4
|
-
export declare const NOT = "not";
|
|
5
|
-
export declare const NOR = "nor";
|
|
6
|
-
export declare enum LOGIC_COMMANDS_LITERAL {
|
|
7
|
-
AND = "and",
|
|
8
|
-
OR = "or",
|
|
9
|
-
NOT = "not",
|
|
10
|
-
NOR = "nor"
|
|
11
|
-
}
|
|
12
|
-
export declare class LogicCommand {
|
|
13
|
-
fieldName: string | InternalSymbol;
|
|
14
|
-
operator: LOGIC_COMMANDS_LITERAL | string;
|
|
15
|
-
operands: any[];
|
|
16
|
-
_internalType: InternalSymbol;
|
|
17
|
-
constructor(operator: LOGIC_COMMANDS_LITERAL | string, operands: any, fieldName?: string | InternalSymbol);
|
|
18
|
-
_setFieldName(fieldName: string): LogicCommand;
|
|
19
|
-
and(...__expressions__: LogicCommand[]): LogicCommand;
|
|
20
|
-
or(...__expressions__: LogicCommand[]): LogicCommand;
|
|
21
|
-
}
|
|
22
|
-
export declare function isLogicCommand(object: any): object is LogicCommand;
|
|
23
|
-
export declare function isKnownLogicCommand(object: any): object is LogicCommand;
|
|
24
|
-
export default LogicCommand;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isKnownLogicCommand = exports.isLogicCommand = exports.LogicCommand = exports.LOGIC_COMMANDS_LITERAL = exports.NOR = exports.NOT = exports.OR = exports.AND = void 0;
|
|
4
|
-
var symbol_1 = require("../helper/symbol");
|
|
5
|
-
var query_1 = require("./query");
|
|
6
|
-
exports.AND = 'and';
|
|
7
|
-
exports.OR = 'or';
|
|
8
|
-
exports.NOT = 'not';
|
|
9
|
-
exports.NOR = 'nor';
|
|
10
|
-
var LOGIC_COMMANDS_LITERAL;
|
|
11
|
-
(function (LOGIC_COMMANDS_LITERAL) {
|
|
12
|
-
LOGIC_COMMANDS_LITERAL["AND"] = "and";
|
|
13
|
-
LOGIC_COMMANDS_LITERAL["OR"] = "or";
|
|
14
|
-
LOGIC_COMMANDS_LITERAL["NOT"] = "not";
|
|
15
|
-
LOGIC_COMMANDS_LITERAL["NOR"] = "nor";
|
|
16
|
-
})(LOGIC_COMMANDS_LITERAL = exports.LOGIC_COMMANDS_LITERAL || (exports.LOGIC_COMMANDS_LITERAL = {}));
|
|
17
|
-
var LogicCommand = (function () {
|
|
18
|
-
function LogicCommand(operator, operands, fieldName) {
|
|
19
|
-
this._internalType = symbol_1.SYMBOL_LOGIC_COMMAND;
|
|
20
|
-
Object.defineProperties(this, {
|
|
21
|
-
_internalType: {
|
|
22
|
-
enumerable: false,
|
|
23
|
-
configurable: false,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
this.operator = operator;
|
|
27
|
-
this.operands = operands;
|
|
28
|
-
this.fieldName = fieldName || symbol_1.SYMBOL_UNSET_FIELD_NAME;
|
|
29
|
-
if (this.fieldName !== symbol_1.SYMBOL_UNSET_FIELD_NAME) {
|
|
30
|
-
if (Array.isArray(operands)) {
|
|
31
|
-
operands = operands.slice();
|
|
32
|
-
this.operands = operands;
|
|
33
|
-
for (var i = 0, len = operands.length; i < len; i++) {
|
|
34
|
-
var query = operands[i];
|
|
35
|
-
if (isLogicCommand(query) || (0, query_1.isQueryCommand)(query)) {
|
|
36
|
-
operands[i] = query._setFieldName(this.fieldName);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
var query = operands;
|
|
42
|
-
if (isLogicCommand(query) || (0, query_1.isQueryCommand)(query)) {
|
|
43
|
-
operands = query._setFieldName(this.fieldName);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
LogicCommand.prototype._setFieldName = function (fieldName) {
|
|
49
|
-
var operands = this.operands.map(function (operand) {
|
|
50
|
-
if (operand instanceof LogicCommand) {
|
|
51
|
-
return operand._setFieldName(fieldName);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return operand;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
var command = new LogicCommand(this.operator, operands, fieldName);
|
|
58
|
-
return command;
|
|
59
|
-
};
|
|
60
|
-
LogicCommand.prototype.and = function () {
|
|
61
|
-
var __expressions__ = [];
|
|
62
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
63
|
-
__expressions__[_i] = arguments[_i];
|
|
64
|
-
}
|
|
65
|
-
var expressions = Array.isArray(arguments[0]) ? arguments[0] : Array.from(arguments);
|
|
66
|
-
expressions.unshift(this);
|
|
67
|
-
return new LogicCommand(LOGIC_COMMANDS_LITERAL.AND, expressions, this.fieldName);
|
|
68
|
-
};
|
|
69
|
-
LogicCommand.prototype.or = function () {
|
|
70
|
-
var __expressions__ = [];
|
|
71
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
72
|
-
__expressions__[_i] = arguments[_i];
|
|
73
|
-
}
|
|
74
|
-
var expressions = Array.isArray(arguments[0]) ? arguments[0] : Array.from(arguments);
|
|
75
|
-
expressions.unshift(this);
|
|
76
|
-
return new LogicCommand(LOGIC_COMMANDS_LITERAL.OR, expressions, this.fieldName);
|
|
77
|
-
};
|
|
78
|
-
return LogicCommand;
|
|
79
|
-
}());
|
|
80
|
-
exports.LogicCommand = LogicCommand;
|
|
81
|
-
function isLogicCommand(object) {
|
|
82
|
-
return object && (object instanceof LogicCommand) && (object._internalType === symbol_1.SYMBOL_LOGIC_COMMAND);
|
|
83
|
-
}
|
|
84
|
-
exports.isLogicCommand = isLogicCommand;
|
|
85
|
-
function isKnownLogicCommand(object) {
|
|
86
|
-
return isLogicCommand && (object.operator.toUpperCase() in LOGIC_COMMANDS_LITERAL);
|
|
87
|
-
}
|
|
88
|
-
exports.isKnownLogicCommand = isKnownLogicCommand;
|
|
89
|
-
exports.default = LogicCommand;
|