@cloudbase/js-sdk 3.6.7 → 3.6.8-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 (207) hide show
  1. package/app/dist/index.esm.js +1 -1
  2. package/app/dist/index.esm.js.map +1 -1
  3. package/app/dist/index.js +1 -1
  4. package/app/dist/index.js.map +1 -1
  5. package/app/dist/index.node.esm.js +1 -1
  6. package/app/dist/index.node.esm.js.map +1 -1
  7. package/app/dist/index.node.js +1 -1
  8. package/app/dist/index.node.js.map +1 -1
  9. package/auth/dist/index.esm.js +1 -1
  10. package/auth/dist/index.esm.js.map +1 -1
  11. package/auth/dist/index.js +1 -1
  12. package/auth/dist/index.js.map +1 -1
  13. package/database/dist/index.d.ts +3 -0
  14. package/database/dist/index.esm.js +2 -0
  15. package/database/dist/index.esm.js.map +1 -0
  16. package/database/dist/index.js +2 -0
  17. package/database/dist/index.js.map +1 -0
  18. package/dist/index.cjs.js +1 -1
  19. package/dist/index.cjs.js.map +1 -1
  20. package/dist/index.esm.js +1 -1
  21. package/dist/index.esm.js.map +1 -1
  22. package/dist/index.node.cjs.js +1 -1
  23. package/dist/index.node.cjs.js.map +1 -1
  24. package/dist/index.node.esm.js +1 -1
  25. package/dist/index.node.esm.js.map +1 -1
  26. package/miniprogram_dist/auth/index.js +1 -1
  27. package/miniprogram_dist/index.js +1 -1
  28. package/miniprogram_dist/oauth/index.js +1 -1
  29. package/oauth/dist/index.esm.js +1 -1
  30. package/oauth/dist/index.esm.js.map +1 -1
  31. package/oauth/dist/index.js +1 -1
  32. package/oauth/dist/index.js.map +1 -1
  33. package/package.json +2 -2
  34. package/types/package.json +1 -1
  35. package/utilities/package.json +2 -2
  36. package/database/dist/commonjs/aggregate.d.ts +0 -29
  37. package/database/dist/commonjs/aggregate.js +0 -156
  38. package/database/dist/commonjs/collection.d.ts +0 -9
  39. package/database/dist/commonjs/collection.js +0 -49
  40. package/database/dist/commonjs/command.d.ts +0 -175
  41. package/database/dist/commonjs/command.js +0 -299
  42. package/database/dist/commonjs/commands/logic.d.ts +0 -24
  43. package/database/dist/commonjs/commands/logic.js +0 -89
  44. package/database/dist/commonjs/commands/query.d.ts +0 -68
  45. package/database/dist/commonjs/commands/query.js +0 -160
  46. package/database/dist/commonjs/commands/update.d.ts +0 -29
  47. package/database/dist/commonjs/commands/update.js +0 -51
  48. package/database/dist/commonjs/config/app.config.d.ts +0 -6
  49. package/database/dist/commonjs/config/app.config.js +0 -7
  50. package/database/dist/commonjs/config/error.config.d.ts +0 -3
  51. package/database/dist/commonjs/config/error.config.js +0 -16
  52. package/database/dist/commonjs/const/code.d.ts +0 -30
  53. package/database/dist/commonjs/const/code.js +0 -33
  54. package/database/dist/commonjs/constant.d.ts +0 -51
  55. package/database/dist/commonjs/constant.js +0 -75
  56. package/database/dist/commonjs/document.d.ts +0 -11
  57. package/database/dist/commonjs/document.js +0 -260
  58. package/database/dist/commonjs/geo/index.d.ts +0 -6
  59. package/database/dist/commonjs/geo/index.js +0 -22
  60. package/database/dist/commonjs/geo/interface.d.ts +0 -24
  61. package/database/dist/commonjs/geo/interface.js +0 -2
  62. package/database/dist/commonjs/geo/lineString.d.ts +0 -19
  63. package/database/dist/commonjs/geo/lineString.js +0 -86
  64. package/database/dist/commonjs/geo/multiLineString.d.ts +0 -18
  65. package/database/dist/commonjs/geo/multiLineString.js +0 -95
  66. package/database/dist/commonjs/geo/multiPoint.d.ts +0 -18
  67. package/database/dist/commonjs/geo/multiPoint.js +0 -79
  68. package/database/dist/commonjs/geo/multiPolygon.d.ts +0 -18
  69. package/database/dist/commonjs/geo/multiPolygon.js +0 -122
  70. package/database/dist/commonjs/geo/point.d.ts +0 -19
  71. package/database/dist/commonjs/geo/point.js +0 -50
  72. package/database/dist/commonjs/geo/polygon.d.ts +0 -19
  73. package/database/dist/commonjs/geo/polygon.js +0 -109
  74. package/database/dist/commonjs/helper/symbol.d.ts +0 -14
  75. package/database/dist/commonjs/helper/symbol.js +0 -31
  76. package/database/dist/commonjs/index.d.ts +0 -40
  77. package/database/dist/commonjs/index.js +0 -61
  78. package/database/dist/commonjs/lib/util.d.ts +0 -1
  79. package/database/dist/commonjs/lib/util.js +0 -26
  80. package/database/dist/commonjs/operator-map.d.ts +0 -4
  81. package/database/dist/commonjs/operator-map.js +0 -24
  82. package/database/dist/commonjs/query.d.ts +0 -22
  83. package/database/dist/commonjs/query.js +0 -252
  84. package/database/dist/commonjs/regexp/index.d.ts +0 -14
  85. package/database/dist/commonjs/regexp/index.js +0 -33
  86. package/database/dist/commonjs/serializer/common.d.ts +0 -11
  87. package/database/dist/commonjs/serializer/common.js +0 -127
  88. package/database/dist/commonjs/serializer/datatype.d.ts +0 -7
  89. package/database/dist/commonjs/serializer/datatype.js +0 -132
  90. package/database/dist/commonjs/serializer/query.d.ts +0 -7
  91. package/database/dist/commonjs/serializer/query.js +0 -232
  92. package/database/dist/commonjs/serializer/update.d.ts +0 -15
  93. package/database/dist/commonjs/serializer/update.js +0 -142
  94. package/database/dist/commonjs/serverDate/index.d.ts +0 -13
  95. package/database/dist/commonjs/serverDate/index.js +0 -30
  96. package/database/dist/commonjs/transaction/collection.d.ts +0 -7
  97. package/database/dist/commonjs/transaction/collection.js +0 -49
  98. package/database/dist/commonjs/transaction/document.d.ts +0 -27
  99. package/database/dist/commonjs/transaction/document.js +0 -205
  100. package/database/dist/commonjs/transaction/index.d.ts +0 -30
  101. package/database/dist/commonjs/transaction/index.js +0 -215
  102. package/database/dist/commonjs/transaction/query.d.ts +0 -43
  103. package/database/dist/commonjs/transaction/query.js +0 -261
  104. package/database/dist/commonjs/typings/index.d.ts +0 -40
  105. package/database/dist/commonjs/typings/index.js +0 -2
  106. package/database/dist/commonjs/typings/realtime.d.ts +0 -219
  107. package/database/dist/commonjs/typings/realtime.js +0 -2
  108. package/database/dist/commonjs/util.d.ts +0 -9
  109. package/database/dist/commonjs/util.js +0 -145
  110. package/database/dist/commonjs/utils/error.d.ts +0 -38
  111. package/database/dist/commonjs/utils/error.js +0 -91
  112. package/database/dist/commonjs/utils/msg.d.ts +0 -0
  113. package/database/dist/commonjs/utils/msg.js +0 -0
  114. package/database/dist/commonjs/utils/symbol.d.ts +0 -8
  115. package/database/dist/commonjs/utils/symbol.js +0 -58
  116. package/database/dist/commonjs/utils/type.d.ts +0 -13
  117. package/database/dist/commonjs/utils/type.js +0 -34
  118. package/database/dist/commonjs/utils/utils.d.ts +0 -4
  119. package/database/dist/commonjs/utils/utils.js +0 -39
  120. package/database/dist/commonjs/validate.d.ts +0 -1
  121. package/database/dist/commonjs/validate.js +0 -60
  122. package/database/dist/esm/aggregate.d.ts +0 -29
  123. package/database/dist/esm/aggregate.js +0 -154
  124. package/database/dist/esm/collection.d.ts +0 -9
  125. package/database/dist/esm/collection.js +0 -46
  126. package/database/dist/esm/command.d.ts +0 -175
  127. package/database/dist/esm/command.js +0 -296
  128. package/database/dist/esm/commands/logic.d.ts +0 -24
  129. package/database/dist/esm/commands/logic.js +0 -84
  130. package/database/dist/esm/commands/query.d.ts +0 -68
  131. package/database/dist/esm/commands/query.js +0 -154
  132. package/database/dist/esm/commands/update.d.ts +0 -29
  133. package/database/dist/esm/commands/update.js +0 -46
  134. package/database/dist/esm/config/app.config.d.ts +0 -6
  135. package/database/dist/esm/config/app.config.js +0 -5
  136. package/database/dist/esm/config/error.config.d.ts +0 -3
  137. package/database/dist/esm/config/error.config.js +0 -13
  138. package/database/dist/esm/const/code.d.ts +0 -30
  139. package/database/dist/esm/const/code.js +0 -30
  140. package/database/dist/esm/constant.d.ts +0 -51
  141. package/database/dist/esm/constant.js +0 -65
  142. package/database/dist/esm/document.d.ts +0 -11
  143. package/database/dist/esm/document.js +0 -257
  144. package/database/dist/esm/geo/index.d.ts +0 -6
  145. package/database/dist/esm/geo/index.js +0 -6
  146. package/database/dist/esm/geo/interface.d.ts +0 -24
  147. package/database/dist/esm/geo/interface.js +0 -1
  148. package/database/dist/esm/geo/lineString.d.ts +0 -19
  149. package/database/dist/esm/geo/lineString.js +0 -83
  150. package/database/dist/esm/geo/multiLineString.d.ts +0 -18
  151. package/database/dist/esm/geo/multiLineString.js +0 -92
  152. package/database/dist/esm/geo/multiPoint.d.ts +0 -18
  153. package/database/dist/esm/geo/multiPoint.js +0 -76
  154. package/database/dist/esm/geo/multiPolygon.d.ts +0 -18
  155. package/database/dist/esm/geo/multiPolygon.js +0 -119
  156. package/database/dist/esm/geo/point.d.ts +0 -19
  157. package/database/dist/esm/geo/point.js +0 -47
  158. package/database/dist/esm/geo/polygon.d.ts +0 -19
  159. package/database/dist/esm/geo/polygon.js +0 -106
  160. package/database/dist/esm/helper/symbol.d.ts +0 -14
  161. package/database/dist/esm/helper/symbol.js +0 -14
  162. package/database/dist/esm/index.d.ts +0 -40
  163. package/database/dist/esm/index.js +0 -55
  164. package/database/dist/esm/lib/util.d.ts +0 -1
  165. package/database/dist/esm/lib/util.js +0 -22
  166. package/database/dist/esm/operator-map.d.ts +0 -4
  167. package/database/dist/esm/operator-map.js +0 -20
  168. package/database/dist/esm/query.d.ts +0 -22
  169. package/database/dist/esm/query.js +0 -249
  170. package/database/dist/esm/regexp/index.d.ts +0 -14
  171. package/database/dist/esm/regexp/index.js +0 -29
  172. package/database/dist/esm/serializer/common.d.ts +0 -11
  173. package/database/dist/esm/serializer/common.js +0 -118
  174. package/database/dist/esm/serializer/datatype.d.ts +0 -7
  175. package/database/dist/esm/serializer/datatype.js +0 -127
  176. package/database/dist/esm/serializer/query.d.ts +0 -7
  177. package/database/dist/esm/serializer/query.js +0 -229
  178. package/database/dist/esm/serializer/update.d.ts +0 -15
  179. package/database/dist/esm/serializer/update.js +0 -139
  180. package/database/dist/esm/serverDate/index.d.ts +0 -13
  181. package/database/dist/esm/serverDate/index.js +0 -26
  182. package/database/dist/esm/transaction/collection.d.ts +0 -7
  183. package/database/dist/esm/transaction/collection.js +0 -46
  184. package/database/dist/esm/transaction/document.d.ts +0 -27
  185. package/database/dist/esm/transaction/document.js +0 -202
  186. package/database/dist/esm/transaction/index.d.ts +0 -30
  187. package/database/dist/esm/transaction/index.js +0 -210
  188. package/database/dist/esm/transaction/query.d.ts +0 -43
  189. package/database/dist/esm/transaction/query.js +0 -258
  190. package/database/dist/esm/typings/index.d.ts +0 -40
  191. package/database/dist/esm/typings/index.js +0 -1
  192. package/database/dist/esm/typings/realtime.d.ts +0 -219
  193. package/database/dist/esm/typings/realtime.js +0 -1
  194. package/database/dist/esm/util.d.ts +0 -9
  195. package/database/dist/esm/util.js +0 -142
  196. package/database/dist/esm/utils/error.d.ts +0 -38
  197. package/database/dist/esm/utils/error.js +0 -84
  198. package/database/dist/esm/utils/msg.d.ts +0 -0
  199. package/database/dist/esm/utils/msg.js +0 -0
  200. package/database/dist/esm/utils/symbol.d.ts +0 -8
  201. package/database/dist/esm/utils/symbol.js +0 -55
  202. package/database/dist/esm/utils/type.d.ts +0 -13
  203. package/database/dist/esm/utils/type.js +0 -20
  204. package/database/dist/esm/utils/utils.d.ts +0 -4
  205. package/database/dist/esm/utils/utils.js +0 -33
  206. package/database/dist/esm/validate.d.ts +0 -1
  207. package/database/dist/esm/validate.js +0 -57
@@ -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;
@@ -1,68 +0,0 @@
1
- import { LogicCommand } from './logic';
2
- import { InternalSymbol } from '../helper/symbol';
3
- import { Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon } from '../geo/index';
4
- export declare const EQ = "eq";
5
- export declare const NEQ = "neq";
6
- export declare const GT = "gt";
7
- export declare const GTE = "gte";
8
- export declare const LT = "lt";
9
- export declare const LTE = "lte";
10
- export declare const IN = "in";
11
- export declare const NIN = "nin";
12
- export declare const ALL = "all";
13
- export declare const ELEM_MATCH = "elemMatch";
14
- export declare const EXISTS = "exists";
15
- export declare const SIZE = "size";
16
- export declare const MOD = "mod";
17
- export declare enum QUERY_COMMANDS_LITERAL {
18
- EQ = "eq",
19
- NEQ = "neq",
20
- GT = "gt",
21
- GTE = "gte",
22
- LT = "lt",
23
- LTE = "lte",
24
- IN = "in",
25
- NIN = "nin",
26
- ALL = "all",
27
- ELEM_MATCH = "elemMatch",
28
- EXISTS = "exists",
29
- SIZE = "size",
30
- MOD = "mod",
31
- GEO_NEAR = "geoNear",
32
- GEO_WITHIN = "geoWithin",
33
- GEO_INTERSECTS = "geoIntersects"
34
- }
35
- export declare class QueryCommand extends LogicCommand {
36
- operator: QUERY_COMMANDS_LITERAL;
37
- constructor(operator: QUERY_COMMANDS_LITERAL, operands: any, fieldName?: string | InternalSymbol);
38
- toJSON(): {
39
- [x: string]: any;
40
- };
41
- _setFieldName(fieldName: string): QueryCommand;
42
- eq(val: any): LogicCommand;
43
- neq(val: any): LogicCommand;
44
- gt(val: any): LogicCommand;
45
- gte(val: any): LogicCommand;
46
- lt(val: any): LogicCommand;
47
- lte(val: any): LogicCommand;
48
- in(list: any[]): LogicCommand;
49
- nin(list: any[]): LogicCommand;
50
- geoNear(val: IGeoNearOptions): LogicCommand;
51
- geoWithin(val: IGeoWithinOptions): LogicCommand;
52
- geoIntersects(val: IGeoIntersectsOptions): LogicCommand;
53
- }
54
- export declare function isQueryCommand(object: any): object is QueryCommand;
55
- export declare function isKnownQueryCommand(object: any): object is QueryCommand;
56
- export declare function isComparisonCommand(object: any): object is QueryCommand;
57
- export default QueryCommand;
58
- export interface IGeoNearOptions {
59
- geometry: Point;
60
- maxDistance?: number;
61
- minDistance?: number;
62
- }
63
- export interface IGeoWithinOptions {
64
- geometry: Polygon | MultiPolygon;
65
- }
66
- export interface IGeoIntersectsOptions {
67
- geometry: Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon;
68
- }
@@ -1,160 +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.isComparisonCommand = exports.isKnownQueryCommand = exports.isQueryCommand = exports.QueryCommand = exports.QUERY_COMMANDS_LITERAL = exports.MOD = exports.SIZE = exports.EXISTS = exports.ELEM_MATCH = exports.ALL = exports.NIN = exports.IN = exports.LTE = exports.LT = exports.GTE = exports.GT = exports.NEQ = exports.EQ = void 0;
19
- var logic_1 = require("./logic");
20
- var symbol_1 = require("../helper/symbol");
21
- var index_1 = require("../geo/index");
22
- var type_1 = require("../utils/type");
23
- exports.EQ = 'eq';
24
- exports.NEQ = 'neq';
25
- exports.GT = 'gt';
26
- exports.GTE = 'gte';
27
- exports.LT = 'lt';
28
- exports.LTE = 'lte';
29
- exports.IN = 'in';
30
- exports.NIN = 'nin';
31
- exports.ALL = 'all';
32
- exports.ELEM_MATCH = 'elemMatch';
33
- exports.EXISTS = 'exists';
34
- exports.SIZE = 'size';
35
- exports.MOD = 'mod';
36
- var QUERY_COMMANDS_LITERAL;
37
- (function (QUERY_COMMANDS_LITERAL) {
38
- QUERY_COMMANDS_LITERAL["EQ"] = "eq";
39
- QUERY_COMMANDS_LITERAL["NEQ"] = "neq";
40
- QUERY_COMMANDS_LITERAL["GT"] = "gt";
41
- QUERY_COMMANDS_LITERAL["GTE"] = "gte";
42
- QUERY_COMMANDS_LITERAL["LT"] = "lt";
43
- QUERY_COMMANDS_LITERAL["LTE"] = "lte";
44
- QUERY_COMMANDS_LITERAL["IN"] = "in";
45
- QUERY_COMMANDS_LITERAL["NIN"] = "nin";
46
- QUERY_COMMANDS_LITERAL["ALL"] = "all";
47
- QUERY_COMMANDS_LITERAL["ELEM_MATCH"] = "elemMatch";
48
- QUERY_COMMANDS_LITERAL["EXISTS"] = "exists";
49
- QUERY_COMMANDS_LITERAL["SIZE"] = "size";
50
- QUERY_COMMANDS_LITERAL["MOD"] = "mod";
51
- QUERY_COMMANDS_LITERAL["GEO_NEAR"] = "geoNear";
52
- QUERY_COMMANDS_LITERAL["GEO_WITHIN"] = "geoWithin";
53
- QUERY_COMMANDS_LITERAL["GEO_INTERSECTS"] = "geoIntersects";
54
- })(QUERY_COMMANDS_LITERAL = exports.QUERY_COMMANDS_LITERAL || (exports.QUERY_COMMANDS_LITERAL = {}));
55
- var QueryCommand = (function (_super) {
56
- __extends(QueryCommand, _super);
57
- function QueryCommand(operator, operands, fieldName) {
58
- var _this = _super.call(this, operator, operands, fieldName) || this;
59
- _this.operator = operator;
60
- _this._internalType = symbol_1.SYMBOL_QUERY_COMMAND;
61
- return _this;
62
- }
63
- QueryCommand.prototype.toJSON = function () {
64
- var _a, _b;
65
- switch (this.operator) {
66
- case QUERY_COMMANDS_LITERAL.IN:
67
- case QUERY_COMMANDS_LITERAL.NIN:
68
- return _a = {},
69
- _a['$' + this.operator] = this.operands,
70
- _a;
71
- default:
72
- return _b = {},
73
- _b['$' + this.operator] = this.operands[0],
74
- _b;
75
- }
76
- };
77
- QueryCommand.prototype._setFieldName = function (fieldName) {
78
- var command = new QueryCommand(this.operator, this.operands, fieldName);
79
- return command;
80
- };
81
- QueryCommand.prototype.eq = function (val) {
82
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.EQ, [val], this.fieldName);
83
- return this.and(command);
84
- };
85
- QueryCommand.prototype.neq = function (val) {
86
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.NEQ, [val], this.fieldName);
87
- return this.and(command);
88
- };
89
- QueryCommand.prototype.gt = function (val) {
90
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.GT, [val], this.fieldName);
91
- return this.and(command);
92
- };
93
- QueryCommand.prototype.gte = function (val) {
94
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.GTE, [val], this.fieldName);
95
- return this.and(command);
96
- };
97
- QueryCommand.prototype.lt = function (val) {
98
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.LT, [val], this.fieldName);
99
- return this.and(command);
100
- };
101
- QueryCommand.prototype.lte = function (val) {
102
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.LTE, [val], this.fieldName);
103
- return this.and(command);
104
- };
105
- QueryCommand.prototype.in = function (list) {
106
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.IN, list, this.fieldName);
107
- return this.and(command);
108
- };
109
- QueryCommand.prototype.nin = function (list) {
110
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.NIN, list, this.fieldName);
111
- return this.and(command);
112
- };
113
- QueryCommand.prototype.geoNear = function (val) {
114
- if (!(val.geometry instanceof index_1.Point)) {
115
- throw new TypeError("\"geometry\" must be of type Point. Received type ".concat(typeof val.geometry));
116
- }
117
- if (val.maxDistance !== undefined && !(0, type_1.isNumber)(val.maxDistance)) {
118
- throw new TypeError("\"maxDistance\" must be of type Number. Received type ".concat(typeof val.maxDistance));
119
- }
120
- if (val.minDistance !== undefined && !(0, type_1.isNumber)(val.minDistance)) {
121
- throw new TypeError("\"minDistance\" must be of type Number. Received type ".concat(typeof val.minDistance));
122
- }
123
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.GEO_NEAR, [val], this.fieldName);
124
- return this.and(command);
125
- };
126
- QueryCommand.prototype.geoWithin = function (val) {
127
- if (!(val.geometry instanceof index_1.MultiPolygon) && !(val.geometry instanceof index_1.Polygon)) {
128
- throw new TypeError("\"geometry\" must be of type Polygon or MultiPolygon. Received type ".concat(typeof val.geometry));
129
- }
130
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.GEO_WITHIN, [val], this.fieldName);
131
- return this.and(command);
132
- };
133
- QueryCommand.prototype.geoIntersects = function (val) {
134
- if (!(val.geometry instanceof index_1.Point) &&
135
- !(val.geometry instanceof index_1.LineString) &&
136
- !(val.geometry instanceof index_1.Polygon) &&
137
- !(val.geometry instanceof index_1.MultiPoint) &&
138
- !(val.geometry instanceof index_1.MultiLineString) &&
139
- !(val.geometry instanceof index_1.MultiPolygon)) {
140
- throw new TypeError("\"geometry\" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type ".concat(typeof val.geometry));
141
- }
142
- var command = new QueryCommand(QUERY_COMMANDS_LITERAL.GEO_INTERSECTS, [val], this.fieldName);
143
- return this.and(command);
144
- };
145
- return QueryCommand;
146
- }(logic_1.LogicCommand));
147
- exports.QueryCommand = QueryCommand;
148
- function isQueryCommand(object) {
149
- return object && object instanceof QueryCommand && object._internalType === symbol_1.SYMBOL_QUERY_COMMAND;
150
- }
151
- exports.isQueryCommand = isQueryCommand;
152
- function isKnownQueryCommand(object) {
153
- return isQueryCommand(object) && object.operator.toUpperCase() in QUERY_COMMANDS_LITERAL;
154
- }
155
- exports.isKnownQueryCommand = isKnownQueryCommand;
156
- function isComparisonCommand(object) {
157
- return isQueryCommand(object);
158
- }
159
- exports.isComparisonCommand = isComparisonCommand;
160
- exports.default = QueryCommand;
@@ -1,29 +0,0 @@
1
- import { InternalSymbol } from '../helper/symbol';
2
- export declare enum UPDATE_COMMANDS_LITERAL {
3
- SET = "set",
4
- REMOVE = "remove",
5
- INC = "inc",
6
- MUL = "mul",
7
- PUSH = "push",
8
- PULL = "pull",
9
- PULL_ALL = "pullAll",
10
- POP = "pop",
11
- SHIFT = "shift",
12
- UNSHIFT = "unshift",
13
- ADD_TO_SET = "addToSet",
14
- BIT = "bit",
15
- RENAME = "rename",
16
- MAX = "max",
17
- MIN = "min"
18
- }
19
- export declare class UpdateCommand {
20
- fieldName: string | InternalSymbol;
21
- operator: UPDATE_COMMANDS_LITERAL;
22
- operands: any;
23
- _internalType: InternalSymbol;
24
- constructor(operator: UPDATE_COMMANDS_LITERAL, operands?: any, fieldName?: string | InternalSymbol);
25
- _setFieldName(fieldName: string): UpdateCommand;
26
- }
27
- export declare function isUpdateCommand(object: any): object is UpdateCommand;
28
- export declare function isKnownUpdateCommand(object: any): object is UpdateCommand;
29
- export default UpdateCommand;