proto.io 0.0.172 → 0.0.174
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/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/database.js +2 -2
- package/dist/adapters/file/database.mjs +2 -2
- package/dist/adapters/file/filesystem.d.ts +2 -2
- package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
- package/dist/adapters/storage/progres.d.ts +9 -2
- package/dist/adapters/storage/progres.js +58 -5
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +58 -5
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/client.mjs +3 -3
- package/dist/index.d.ts +75 -3
- package/dist/index.js +242 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +243 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-BYbMU-Ao.mjs → index--ifyu-GL.mjs} +139 -1
- package/dist/internals/index--ifyu-GL.mjs.map +1 -0
- package/dist/internals/{index-B1wqSio6.mjs → index-C3fbOqmn.mjs} +2 -2
- package/dist/internals/{index-B1wqSio6.mjs.map → index-C3fbOqmn.mjs.map} +1 -1
- package/dist/internals/index-CE5tdYK8.d.ts +1816 -0
- package/dist/internals/index-CE5tdYK8.d.ts.map +1 -0
- package/dist/internals/{index-K0jhERvZ.d.ts → index-CGX3qcjQ.d.ts} +2 -2
- package/dist/internals/index-CGX3qcjQ.d.ts.map +1 -0
- package/dist/internals/{index-CVutVPmd.js → index-DXuW8UiB.js} +139 -1
- package/dist/internals/index-DXuW8UiB.js.map +1 -0
- package/dist/internals/{index-CzfsyXvb.js → index-Dc3V_Bzw.js} +2 -2
- package/dist/internals/{index-CzfsyXvb.js.map → index-Dc3V_Bzw.js.map} +1 -1
- package/dist/internals/{index-D0hHgn2P.mjs → index-R0gbIGc-.mjs} +289 -2
- package/dist/internals/index-R0gbIGc-.mjs.map +1 -0
- package/dist/internals/{index-BJP46VGq.js → index-S_gTMQBh.js} +289 -2
- package/dist/internals/index-S_gTMQBh.js.map +1 -0
- package/dist/internals/{index-DchUjNEf.d.ts → index-uwXdnxqN.d.ts} +2 -2
- package/dist/internals/index-uwXdnxqN.d.ts.map +1 -0
- package/dist/internals/{random-BCpwYpyw.mjs → random-DPRG8oW6.mjs} +3 -3
- package/dist/internals/{random-BCpwYpyw.mjs.map → random-DPRG8oW6.mjs.map} +1 -1
- package/dist/internals/{random-Dytum6Nh.js → random-DVOUDDGg.js} +3 -3
- package/dist/internals/{random-Dytum6Nh.js.map → random-DVOUDDGg.js.map} +1 -1
- package/package.json +1 -1
- package/dist/internals/index-BJP46VGq.js.map +0 -1
- package/dist/internals/index-BYbMU-Ao.mjs.map +0 -1
- package/dist/internals/index-BhWRmBiq.d.ts +0 -726
- package/dist/internals/index-BhWRmBiq.d.ts.map +0 -1
- package/dist/internals/index-CVutVPmd.js.map +0 -1
- package/dist/internals/index-D0hHgn2P.mjs.map +0 -1
- package/dist/internals/index-DchUjNEf.d.ts.map +0 -1
- package/dist/internals/index-K0jhERvZ.d.ts.map +0 -1
|
@@ -128,6 +128,9 @@ const decodeUpdateOp = (update) => {
|
|
|
128
128
|
throw Error('Invalid update operation');
|
|
129
129
|
return pairs[0];
|
|
130
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* Class representing a object.
|
|
133
|
+
*/
|
|
131
134
|
class TObject {
|
|
132
135
|
static defaultReadonlyKeys = defaultObjectReadonlyKeys;
|
|
133
136
|
static defaultKeys = defaultObjectKeys;
|
|
@@ -142,52 +145,104 @@ class TObject {
|
|
|
142
145
|
extra: {},
|
|
143
146
|
};
|
|
144
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Gets the class name of the object.
|
|
150
|
+
*/
|
|
145
151
|
get className() {
|
|
146
152
|
return this[PVK].className;
|
|
147
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Gets the attributes of the object.
|
|
156
|
+
*/
|
|
148
157
|
get attributes() {
|
|
149
158
|
return cloneValue(this[PVK].attributes);
|
|
150
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Gets the object ID.
|
|
162
|
+
*/
|
|
151
163
|
get objectId() {
|
|
152
164
|
return this[PVK].attributes._id;
|
|
153
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Gets the creation date of the object.
|
|
168
|
+
*/
|
|
154
169
|
get createdAt() {
|
|
155
170
|
return this[PVK].attributes._created_at;
|
|
156
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Gets the last updated date of the object.
|
|
174
|
+
*/
|
|
157
175
|
get updatedAt() {
|
|
158
176
|
return this[PVK].attributes._updated_at;
|
|
159
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Gets the version number of the object.
|
|
180
|
+
*/
|
|
160
181
|
get __v() {
|
|
161
182
|
return this[PVK].attributes.__v;
|
|
162
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Gets the sequence number of the object.
|
|
186
|
+
*/
|
|
163
187
|
get __i() {
|
|
164
188
|
return this[PVK].attributes.__i;
|
|
165
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Gets the expiration date of the object.
|
|
192
|
+
*/
|
|
166
193
|
get expiredAt() {
|
|
167
194
|
return this.get('_expired_at');
|
|
168
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Sets the expiration date of the object.
|
|
198
|
+
* @param value - The expiration date.
|
|
199
|
+
*/
|
|
169
200
|
set expiredAt(value) {
|
|
170
201
|
this.set('_expired_at', value);
|
|
171
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Gets the access control list (ACL) of the object.
|
|
205
|
+
* @returns The ACL of the object.
|
|
206
|
+
*/
|
|
172
207
|
acl() {
|
|
173
208
|
return {
|
|
174
209
|
read: this.get('_rperm') ?? ['*'],
|
|
175
210
|
update: this.get('_wperm') ?? ['*'],
|
|
176
211
|
};
|
|
177
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Sets the access control list (ACL) of the object.
|
|
215
|
+
* @param value - The ACL to set.
|
|
216
|
+
*/
|
|
178
217
|
setAcl(value) {
|
|
179
218
|
this.set('_rperm', value.read ?? ['*']);
|
|
180
219
|
this.set('_wperm', value.update ?? ['*']);
|
|
181
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Sets the read access control list (ACL) of the object.
|
|
223
|
+
* @param value - The read ACL to set.
|
|
224
|
+
*/
|
|
182
225
|
setReadAcl(value) {
|
|
183
226
|
this.set('_rperm', value);
|
|
184
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Sets the write access control list (ACL) of the object.
|
|
230
|
+
* @param value - The write ACL to set.
|
|
231
|
+
*/
|
|
185
232
|
setWriteAcl(value) {
|
|
186
233
|
this.set('_wperm', value);
|
|
187
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Gets the keys of the object's attributes and mutated attributes.
|
|
237
|
+
* @returns An array of keys.
|
|
238
|
+
*/
|
|
188
239
|
keys() {
|
|
189
240
|
return _.uniq([..._.keys(this[PVK].attributes), ..._.compact(_.map(_.keys(this[PVK].mutated), x => _.first(_.toPath(x))))]);
|
|
190
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Gets an iterator for the entries of the object's attributes.
|
|
244
|
+
* @returns An iterator for the entries.
|
|
245
|
+
*/
|
|
191
246
|
*entries() {
|
|
192
247
|
for (const key of this.keys()) {
|
|
193
248
|
yield [key, this.get(key)];
|
|
@@ -202,6 +257,10 @@ class TObject {
|
|
|
202
257
|
}
|
|
203
258
|
}
|
|
204
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Converts the object to a plain object.
|
|
262
|
+
* @returns The plain object representation of the object.
|
|
263
|
+
*/
|
|
205
264
|
toObject() {
|
|
206
265
|
const toObject = (value) => {
|
|
207
266
|
if (isPrimitiveValue(value))
|
|
@@ -228,6 +287,11 @@ class TObject {
|
|
|
228
287
|
}
|
|
229
288
|
return cloneValue(value);
|
|
230
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Get the value of the attribute.
|
|
292
|
+
* @param key - The key of the attribute.
|
|
293
|
+
* @returns The value of the attribute.
|
|
294
|
+
*/
|
|
231
295
|
get(key) {
|
|
232
296
|
if (_.isEmpty(key))
|
|
233
297
|
throw Error('Invalid key');
|
|
@@ -236,6 +300,11 @@ class TObject {
|
|
|
236
300
|
const [op, value] = decodeUpdateOp(this[PVK].mutated[key]);
|
|
237
301
|
return op === '$set' ? value : this._value(key);
|
|
238
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Set the value of the attribute.
|
|
305
|
+
* @param key - The key of the attribute.
|
|
306
|
+
* @param value - The value to set.
|
|
307
|
+
*/
|
|
239
308
|
set(key, value) {
|
|
240
309
|
if (_.isEmpty(key))
|
|
241
310
|
throw Error('Invalid key');
|
|
@@ -243,9 +312,17 @@ class TObject {
|
|
|
243
312
|
return;
|
|
244
313
|
this[PVK].mutated[key] = { $set: value ?? null };
|
|
245
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Is the object dirty.
|
|
317
|
+
*/
|
|
246
318
|
get isDirty() {
|
|
247
319
|
return !_.isEmpty(this[PVK].mutated);
|
|
248
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Increment the value of the attribute.
|
|
323
|
+
* @param key - The key to increment.
|
|
324
|
+
* @param value - The value to increment by.
|
|
325
|
+
*/
|
|
249
326
|
increment(key, value) {
|
|
250
327
|
if (_.isEmpty(key))
|
|
251
328
|
throw Error('Invalid key');
|
|
@@ -253,6 +330,11 @@ class TObject {
|
|
|
253
330
|
return;
|
|
254
331
|
this[PVK].mutated[key] = { $inc: value };
|
|
255
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Decrement the value of the attribute.
|
|
335
|
+
* @param key - The key to decrement.
|
|
336
|
+
* @param value - The value to decrement by.
|
|
337
|
+
*/
|
|
256
338
|
decrement(key, value) {
|
|
257
339
|
if (_.isEmpty(key))
|
|
258
340
|
throw Error('Invalid key');
|
|
@@ -260,6 +342,11 @@ class TObject {
|
|
|
260
342
|
return;
|
|
261
343
|
this[PVK].mutated[key] = { $dec: value };
|
|
262
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Multiplies the value of the specified attribute.
|
|
347
|
+
* @param key - The key of the attribute to multiply.
|
|
348
|
+
* @param value - The multiplier value.
|
|
349
|
+
*/
|
|
263
350
|
multiply(key, value) {
|
|
264
351
|
if (_.isEmpty(key))
|
|
265
352
|
throw Error('Invalid key');
|
|
@@ -267,6 +354,11 @@ class TObject {
|
|
|
267
354
|
return;
|
|
268
355
|
this[PVK].mutated[key] = { $mul: value };
|
|
269
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Divides the value of the specified attribute.
|
|
359
|
+
* @param key - The key of the attribute to divide.
|
|
360
|
+
* @param value - The divisor value.
|
|
361
|
+
*/
|
|
270
362
|
divide(key, value) {
|
|
271
363
|
if (_.isEmpty(key))
|
|
272
364
|
throw Error('Invalid key');
|
|
@@ -274,6 +366,11 @@ class TObject {
|
|
|
274
366
|
return;
|
|
275
367
|
this[PVK].mutated[key] = { $div: value };
|
|
276
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Sets the value of the specified attribute to the maximum of the current value and the provided value.
|
|
371
|
+
* @param key - The key of the attribute to compare.
|
|
372
|
+
* @param value - The value to compare against.
|
|
373
|
+
*/
|
|
277
374
|
max(key, value) {
|
|
278
375
|
if (_.isEmpty(key))
|
|
279
376
|
throw Error('Invalid key');
|
|
@@ -281,6 +378,11 @@ class TObject {
|
|
|
281
378
|
return;
|
|
282
379
|
this[PVK].mutated[key] = { $max: value };
|
|
283
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Sets the value of the specified attribute to the minimum of the current value and the provided value.
|
|
383
|
+
* @param key - The key of the attribute to compare.
|
|
384
|
+
* @param value - The value to compare against.
|
|
385
|
+
*/
|
|
284
386
|
min(key, value) {
|
|
285
387
|
if (_.isEmpty(key))
|
|
286
388
|
throw Error('Invalid key');
|
|
@@ -288,6 +390,11 @@ class TObject {
|
|
|
288
390
|
return;
|
|
289
391
|
this[PVK].mutated[key] = { $min: value };
|
|
290
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Adds the specified values to the set of the specified attribute.
|
|
395
|
+
* @param key - The key of the attribute.
|
|
396
|
+
* @param values - The values to add to the set.
|
|
397
|
+
*/
|
|
291
398
|
addToSet(key, values) {
|
|
292
399
|
if (_.isEmpty(key))
|
|
293
400
|
throw Error('Invalid key');
|
|
@@ -295,6 +402,11 @@ class TObject {
|
|
|
295
402
|
return;
|
|
296
403
|
this[PVK].mutated[key] = { $addToSet: values };
|
|
297
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* Adds the values to the array of the attribute.
|
|
407
|
+
* @param key - The key of the attribute.
|
|
408
|
+
* @param values - The values to add.
|
|
409
|
+
*/
|
|
298
410
|
push(key, values) {
|
|
299
411
|
if (_.isEmpty(key))
|
|
300
412
|
throw Error('Invalid key');
|
|
@@ -302,6 +414,11 @@ class TObject {
|
|
|
302
414
|
return;
|
|
303
415
|
this[PVK].mutated[key] = { $push: values };
|
|
304
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Removes the values from the array of the attribute.
|
|
419
|
+
* @param key - The key of the attribute.
|
|
420
|
+
* @param values - The values to remove.
|
|
421
|
+
*/
|
|
305
422
|
removeAll(key, values) {
|
|
306
423
|
if (_.isEmpty(key))
|
|
307
424
|
throw Error('Invalid key');
|
|
@@ -309,6 +426,11 @@ class TObject {
|
|
|
309
426
|
return;
|
|
310
427
|
this[PVK].mutated[key] = { $removeAll: values };
|
|
311
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* Removes the first elements from the array of the attribute.
|
|
431
|
+
* @param key - The key of the attribute.
|
|
432
|
+
* @param count - The number of elements to remove. Defaults to 1.
|
|
433
|
+
*/
|
|
312
434
|
popFirst(key, count = 1) {
|
|
313
435
|
if (_.isEmpty(key))
|
|
314
436
|
throw Error('Invalid key');
|
|
@@ -316,6 +438,11 @@ class TObject {
|
|
|
316
438
|
return;
|
|
317
439
|
this[PVK].mutated[key] = { $popFirst: count };
|
|
318
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Removes the last elements from the array of the attribute.
|
|
443
|
+
* @param key - The key of the attribute.
|
|
444
|
+
* @param count - The number of elements to remove. Defaults to 1.
|
|
445
|
+
*/
|
|
319
446
|
popLast(key, count = 1) {
|
|
320
447
|
if (_.isEmpty(key))
|
|
321
448
|
throw Error('Invalid key');
|
|
@@ -323,9 +450,20 @@ class TObject {
|
|
|
323
450
|
return;
|
|
324
451
|
this[PVK].mutated[key] = { $popLast: count };
|
|
325
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Fetches the object data.
|
|
455
|
+
* @param options - Additional options for the fetch operation.
|
|
456
|
+
* @returns A promise that resolves to the fetched object.
|
|
457
|
+
*/
|
|
326
458
|
async fetch(options) {
|
|
327
459
|
return this.fetchWithInclude(_.keys(this[PVK].attributes), options);
|
|
328
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* Fetches the object data if needed.
|
|
463
|
+
* @param keys - The keys of the attributes to fetch.
|
|
464
|
+
* @param options - Additional options for the fetch operation.
|
|
465
|
+
* @returns A promise that resolves to the fetched object.
|
|
466
|
+
*/
|
|
329
467
|
async fetchIfNeeded(keys, options) {
|
|
330
468
|
const current = _.keys(this[PVK].attributes);
|
|
331
469
|
if (_.every(keys, k => _.includes(current, k)))
|
|
@@ -335,4 +473,4 @@ class TObject {
|
|
|
335
473
|
}
|
|
336
474
|
|
|
337
475
|
export { TObject as T, _encodeValue as _, isRelation as a, isShape as b, defaultObjectKeyTypes as c, decodeUpdateOp as d, isPrimitive as e, isVector as f, _decodeValue as g, dimensionOf as h, isPointer as i, _typeof as j, isPrimitiveValue as k, isValue as l, shapePaths as s };
|
|
338
|
-
//# sourceMappingURL=index-
|
|
476
|
+
//# sourceMappingURL=index--ifyu-GL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index--ifyu-GL.mjs","sources":["../../../src/internals/schema.ts","../../../src/internals/object/index.ts"],"sourcesContent":["//\n// schema.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _TValue } from './types';\n\nexport namespace TSchema {\n /**\n * Access Control List represented as an array of strings.\n */\n export type ACL = string[];\n\n /**\n * Access Control Lists for read and update operations.\n */\n export type ACLs = { \n /**\n * ACL for read operation.\n */\n read: TSchema.ACL; \n\n /**\n * ACL for update operation.\n */\n update: TSchema.ACL; \n };\n\n /**\n * Primitive data types.\n */\n export type Primitive = 'boolean' | 'number' | 'decimal' | 'string' | 'date' | 'object' | 'array';\n\n /**\n * Primitive type with an optional default value.\n */\n export type PrimitiveType = Primitive | { \n /**\n * The type of the primitive.\n */\n type: Primitive; \n\n /**\n * Optional default value.\n */\n default?: _TValue; \n };\n\n /**\n * Vector type with a specified dimension and an optional default value.\n */\n export type VectorType = { \n /**\n * The type of the vector.\n */\n type: 'vector'; \n\n /**\n * The dimension of the vector.\n */\n dimension: number; \n\n /**\n * Optional default value.\n */\n default?: number[]; \n };\n\n /**\n * Shape type with a specified shape.\n */\n export type ShapeType = { \n /**\n * The type of the shape.\n */\n type: 'shape'; \n\n /**\n * The shape definition.\n */\n shape: Record<string, DataType>; \n };\n\n /**\n * Pointer type with a target.\n */\n export type PointerType = { \n /**\n * The type of the pointer.\n */\n type: 'pointer'; \n\n /**\n * The target class of the pointer.\n */\n target: string; \n };\n\n /**\n * Relation type with a target and an optional foreign field.\n */\n export type RelationType = { \n /**\n * The type of the relation.\n */\n type: 'relation'; \n\n /**\n * The target class of the relation.\n */\n target: string; \n\n /**\n * Optional foreign field.\n */\n foreignField?: string; \n };\n\n /**\n * Data type which can be a primitive, vector, shape, pointer, or relation type.\n */\n export type DataType = PrimitiveType | VectorType | ShapeType | PointerType | RelationType;\n\n /**\n * Class Level Permissions.\n */\n export type CLPs = {\n /**\n * ACL for get operation.\n */\n get?: TSchema.ACL;\n\n /**\n * ACL for find operation.\n */\n find?: TSchema.ACL;\n\n /**\n * ACL for count operation.\n */\n count?: TSchema.ACL;\n\n /**\n * ACL for create operation.\n */\n create?: TSchema.ACL;\n\n /**\n * ACL for update operation.\n */\n update?: TSchema.ACL;\n\n /**\n * ACL for delete operation.\n */\n delete?: TSchema.ACL;\n };\n\n /**\n * Field Level Permissions.\n */\n export type FLPs = {\n /**\n * ACL for read operation.\n */\n read?: TSchema.ACL;\n\n /**\n * ACL for create operation.\n */\n create?: TSchema.ACL;\n\n /**\n * ACL for update operation.\n */\n update?: TSchema.ACL;\n };\n\n /**\n * Indexes for the schema.\n */\n export type Indexes = {\n /**\n * Type of the index, default is 'basic'.\n */\n type?: 'basic';\n\n /**\n * Keys for the index.\n */\n keys: Record<string, 1 | -1>;\n\n /**\n * Whether the index is unique.\n */\n unique?: boolean;\n } | {\n /**\n * Type of the index, must be 'vector'.\n */\n type: 'vector';\n\n /**\n * Keys for the vector index.\n */\n keys: string | string[];\n\n /**\n * Method for the vector index.\n */\n method?: 'hnsw' | 'ivfflat';\n };\n}\n\nexport const isPrimitive = (x: TSchema.DataType): x is TSchema.PrimitiveType => _.isString(x) || (x.type !== 'pointer' && x.type !== 'relation' && x.type !== 'shape');\nexport const isVector = (x: TSchema.DataType): x is TSchema.VectorType => !_.isString(x) && x.type === 'vector';\nexport const dimensionOf = (x: TSchema.DataType) => isVector(x) ? x.dimension : 0;\nexport const isShape = (x: TSchema.DataType): x is TSchema.ShapeType => !_.isString(x) && x.type === 'shape';\nexport const isPointer = (x: TSchema.DataType): x is TSchema.PointerType => !_.isString(x) && x.type === 'pointer';\nexport const isRelation = (x: TSchema.DataType): x is TSchema.RelationType => !_.isString(x) && x.type === 'relation';\nexport const _typeof = (x: TSchema.DataType) => _.isString(x) ? x : x.type !== 'pointer' && x.type !== 'relation' ? x.type : x.target;\n\nexport const shapePaths = (x: TSchema.ShapeType): {\n path: string,\n type: Exclude<TSchema.DataType, TSchema.ShapeType>,\n}[] => _.flatMap(x.shape, (v, k) => (\n isShape(v) ? _.map(shapePaths(v), x => ({ path: `${k}.${x.path}`, type: x.type })) : { path: k, type: v }\n));\n\nexport interface TSchema {\n /**\n * Fields of the schema, where each field is a data type.\n */\n fields: Record<string, TSchema.DataType>;\n\n /**\n * Class level permissions for the schema.\n */\n classLevelPermissions?: TSchema.CLPs;\n\n /**\n * Additional object permissions for the schema.\n */\n additionalObjectPermissions?: TSchema.ACLs;\n\n /**\n * Field level permissions for the schema, where each field can have its own permissions.\n */\n fieldLevelPermissions?: Record<string, TSchema.FLPs>;\n\n /**\n * Secure fields in the schema.\n */\n secureFields?: string[];\n\n /**\n * Indexes for the schema.\n */\n indexes?: TSchema.Indexes[];\n}\n\nexport const defaultObjectKeyTypes: Record<string, TSchema.DataType> = {\n _id: 'string',\n __v: 'number',\n __i: 'number',\n _created_at: 'date',\n _updated_at: 'date',\n _expired_at: 'date',\n _rperm: 'array',\n _wperm: 'array',\n};\n\nexport const defaultObjectReadonlyKeys = ['_id', '__v', '__i', '_created_at', '_updated_at'];\nexport const defaultObjectKeys = [...defaultObjectReadonlyKeys, '_expired_at', '_rperm', '_wperm'];\n","//\n// object.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { PVK } from '../private';\nimport { ExtraOptions } from '../options';\nimport { Decimal } from 'decimal.js';\nimport { TPrimitiveValue, TValue, _TValue } from '../types';\nimport { TSchema, defaultObjectKeys, defaultObjectReadonlyKeys } from '../schema';\nimport { PathName } from '../query/types';\nimport { TUpdateOp, TUpdateOpKeys } from './types';\nimport { ProtoType } from '../proto';\nimport { TQuery } from '../query';\n\nexport const isPrimitiveValue = (x: any): x is TPrimitiveValue => {\n if (_.isNil(x) || _.isNumber(x) || _.isBoolean(x) || _.isString(x) || _.isDate(x)) return true;\n if (x instanceof Decimal) return true;\n return false;\n}\n\nexport const isValue = (x: any): x is TValue => {\n if (isPrimitiveValue(x) || x instanceof TObject) return true;\n if (_.isArray(x)) return _.every(x, v => isValue(v));\n if (_.isPlainObject(x)) return _.every(x, v => isValue(v));\n return false;\n}\n\nexport const cloneValue = <T extends TValue>(x: T): T => {\n if (isPrimitiveValue(x) || x instanceof TObject) return x;\n if (_.isArray(x)) return x.map(v => cloneValue(v)) as T;\n return _.mapValues(x, v => cloneValue(v)) as T;\n}\n\nexport const _decodeValue = (value: _TValue): _TValue => {\n if (isPrimitiveValue(value)) return value;\n if (_.isArray(value)) return _.map(value, x => _decodeValue(x));\n if (_.isString(value.$date)) return new Date(value.$date);\n if (_.isString(value.$decimal)) return new Decimal(value.$decimal);\n return _.transform(value, (r, v, k) => {\n r[k.startsWith('$') ? k.substring(1) : k] = _decodeValue(v);\n }, {} as any);\n};\n\nexport const _encodeValue = (value: TValue): _TValue => {\n if (value instanceof TObject) throw Error('Invalid data type');\n if (_.isDate(value)) return { $date: value.toISOString() };\n if (value instanceof Decimal) return { $decimal: value.toString() };\n if (isPrimitiveValue(value)) return value;\n if (_.isArray(value)) return _.map(value, x => _encodeValue(x));\n return _.transform(value, (r, v, k) => {\n r[k.startsWith('$') ? `$${k}` : k] = _encodeValue(v);\n }, {} as any);\n};\n\nexport const decodeUpdateOp = (update: TUpdateOp) => {\n const pairs = _.toPairs(update);\n if (pairs.length !== 1) throw Error('Invalid update operation');\n return pairs[0] as [typeof TUpdateOpKeys[number], TValue];\n}\n\n/**\n * Interface representing a object.\n */\nexport interface TObject {\n /**\n * Clones the object.\n * @returns A clone of the object.\n */\n clone(): TObject;\n\n /**\n * Gets a relation query for the specified key.\n * @param key - The key of the relation.\n * @returns A query object for the relation.\n */\n relation<T extends string>(key: PathName<T>): TQuery<string, any, boolean>;\n\n /**\n * Fetches the object with the specified keys included.\n * @param keys - The keys to include.\n * @param options - Additional options for the fetch operation.\n * @returns A promise that resolves to the fetched object.\n */\n fetchWithInclude(keys: string[], options?: ExtraOptions<boolean>): PromiseLike<this>;\n\n /**\n * Saves the object.\n * @param options - Additional options for the save operation.\n * @returns A promise that resolves to the saved object.\n */\n save(options?: ExtraOptions<boolean> & { cascadeSave?: boolean }): PromiseLike<this>;\n\n /**\n * Destroys the object.\n * @param options - Additional options for the destroy operation.\n * @returns A promise that resolves to the destroyed object.\n */\n destroy(options?: ExtraOptions<boolean>): PromiseLike<this>;\n}\n\n/**\n * Class representing a object.\n */\nexport class TObject {\n\n static defaultReadonlyKeys = defaultObjectReadonlyKeys;\n static defaultKeys = defaultObjectKeys;\n\n /** @internal */\n [PVK]: {\n className: string;\n attributes: Record<string, TValue>;\n mutated: Record<string, TUpdateOp>;\n extra: Record<string, any>;\n };\n\n constructor(\n className: string,\n attributes?: Record<string, TValue> | ((self: TObject) => Record<string, TValue>),\n ) {\n const _attributes = _.isFunction(attributes) ? attributes(this) : attributes ?? {};\n this[PVK] = {\n className,\n attributes: cloneValue(_attributes),\n mutated: {},\n extra: {},\n }\n }\n\n /**\n * Gets the class name of the object.\n */\n get className(): string {\n return this[PVK].className;\n }\n\n /**\n * Gets the attributes of the object.\n */\n get attributes(): Record<string, TValue> {\n return cloneValue(this[PVK].attributes);\n }\n\n /**\n * Gets the object ID.\n */\n get objectId(): string | undefined {\n return this[PVK].attributes._id as string;\n }\n\n /**\n * Gets the creation date of the object.\n */\n get createdAt(): Date | undefined {\n return this[PVK].attributes._created_at as Date;\n }\n\n /**\n * Gets the last updated date of the object.\n */\n get updatedAt(): Date | undefined {\n return this[PVK].attributes._updated_at as Date;\n }\n\n /**\n * Gets the version number of the object.\n */\n get __v(): number {\n return this[PVK].attributes.__v as number;\n }\n\n /**\n * Gets the sequence number of the object.\n */\n get __i(): number {\n return this[PVK].attributes.__i as number;\n }\n\n /**\n * Gets the expiration date of the object.\n */\n get expiredAt(): Date | undefined {\n return this.get('_expired_at');\n }\n\n /**\n * Sets the expiration date of the object.\n * @param value - The expiration date.\n */\n set expiredAt(value: Date | undefined) {\n this.set('_expired_at', value);\n }\n\n /**\n * Gets the access control list (ACL) of the object.\n * @returns The ACL of the object.\n */\n acl(): TSchema.ACLs {\n return {\n read: this.get('_rperm') ?? ['*'],\n update: this.get('_wperm') ?? ['*'],\n };\n }\n\n /**\n * Sets the access control list (ACL) of the object.\n * @param value - The ACL to set.\n */\n setAcl(value: Partial<TSchema.ACLs>) {\n this.set('_rperm', value.read ?? ['*']);\n this.set('_wperm', value.update ?? ['*']);\n }\n\n /**\n * Sets the read access control list (ACL) of the object.\n * @param value - The read ACL to set.\n */\n setReadAcl(value: TSchema.ACL) {\n this.set('_rperm', value);\n }\n\n /**\n * Sets the write access control list (ACL) of the object.\n * @param value - The write ACL to set.\n */\n setWriteAcl(value: TSchema.ACL) {\n this.set('_wperm', value);\n }\n\n /**\n * Gets the keys of the object's attributes and mutated attributes.\n * @returns An array of keys.\n */\n keys(): string[] {\n return _.uniq([..._.keys(this[PVK].attributes), ..._.compact(_.map(_.keys(this[PVK].mutated), x => _.first(_.toPath(x))))]);\n }\n\n /**\n * Gets an iterator for the entries of the object's attributes.\n * @returns An iterator for the entries.\n */\n *entries() {\n for (const key of this.keys()) {\n yield [key, this.get(key)] as [string, any];\n }\n }\n\n /** @internal */\n *_set_entries() {\n for (const [key, op] of _.entries(this[PVK].mutated)) {\n for (const [_op, value] of _.entries(op)) {\n if (_op === '$set') yield [key, value] as [string, any];\n }\n }\n }\n\n /**\n * Converts the object to a plain object.\n * @returns The plain object representation of the object.\n */\n toObject() {\n const toObject = (value: TValue): _TValue => {\n if (isPrimitiveValue(value)) return value;\n if (value instanceof TObject) return value.toObject();\n if (_.isArray(value)) return _.map(value, toObject);\n return _.mapValues(value, toObject);\n }\n return _.fromPairs(_.map(this.keys(), k => [k, toObject(this.get(k))]));\n }\n\n private _value(key: string): TValue {\n let value: TValue = this[PVK].attributes;\n for (const k of _.toPath(key)) {\n if (isPrimitiveValue(value)) return null;\n if (value instanceof TObject) {\n value = value.get(k);\n } else {\n value = _.get(value, k);\n }\n }\n return cloneValue(value);\n }\n\n /**\n * Get the value of the attribute.\n * @param key - The key of the attribute.\n * @returns The value of the attribute.\n */\n get<T extends string>(key: PathName<T>): any {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (_.isNil(this[PVK].mutated[key])) return this._value(key);\n const [op, value] = decodeUpdateOp(this[PVK].mutated[key]);\n return op === '$set' ? value : this._value(key);\n }\n\n /**\n * Set the value of the attribute.\n * @param key - The key of the attribute.\n * @param value - The value to set.\n */\n set<T extends string>(key: PathName<T>, value: TValue | undefined) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $set: value ?? null };\n }\n\n /**\n * Is the object dirty.\n */\n get isDirty(): boolean {\n return !_.isEmpty(this[PVK].mutated);\n }\n\n /**\n * Increment the value of the attribute.\n * @param key - The key to increment.\n * @param value - The value to increment by.\n */\n increment<T extends string>(key: PathName<T>, value: number) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $inc: value };\n }\n\n /**\n * Decrement the value of the attribute.\n * @param key - The key to decrement.\n * @param value - The value to decrement by.\n */\n decrement<T extends string>(key: PathName<T>, value: number) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $dec: value };\n }\n\n /**\n * Multiplies the value of the specified attribute.\n * @param key - The key of the attribute to multiply.\n * @param value - The multiplier value.\n */\n multiply<T extends string>(key: PathName<T>, value: number) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $mul: value };\n }\n\n /**\n * Divides the value of the specified attribute.\n * @param key - The key of the attribute to divide.\n * @param value - The divisor value.\n */\n divide<T extends string>(key: PathName<T>, value: number) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $div: value };\n }\n\n /**\n * Sets the value of the specified attribute to the maximum of the current value and the provided value.\n * @param key - The key of the attribute to compare.\n * @param value - The value to compare against.\n */\n max<T extends string>(key: PathName<T>, value: TValue) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $max: value };\n }\n\n /**\n * Sets the value of the specified attribute to the minimum of the current value and the provided value.\n * @param key - The key of the attribute to compare.\n * @param value - The value to compare against.\n */\n min<T extends string>(key: PathName<T>, value: TValue) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $min: value };\n }\n\n /**\n * Adds the specified values to the set of the specified attribute.\n * @param key - The key of the attribute.\n * @param values - The values to add to the set.\n */\n addToSet<T extends string>(key: PathName<T>, values: TValue[]) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $addToSet: values };\n }\n\n /**\n * Adds the values to the array of the attribute.\n * @param key - The key of the attribute.\n * @param values - The values to add.\n */\n push<T extends string>(key: PathName<T>, values: TValue[]) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $push: values };\n }\n\n /**\n * Removes the values from the array of the attribute.\n * @param key - The key of the attribute.\n * @param values - The values to remove.\n */\n removeAll<T extends string>(key: PathName<T>, values: TValue[]) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $removeAll: values };\n }\n\n /**\n * Removes the first elements from the array of the attribute.\n * @param key - The key of the attribute.\n * @param count - The number of elements to remove. Defaults to 1.\n */\n popFirst<T extends string>(key: PathName<T>, count = 1) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $popFirst: count };\n }\n\n /**\n * Removes the last elements from the array of the attribute.\n * @param key - The key of the attribute.\n * @param count - The number of elements to remove. Defaults to 1.\n */\n popLast<T extends string>(key: PathName<T>, count = 1) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $popLast: count };\n }\n\n /**\n * Fetches the object data.\n * @param options - Additional options for the fetch operation.\n * @returns A promise that resolves to the fetched object.\n */\n async fetch(options?: ExtraOptions<boolean>) {\n return this.fetchWithInclude(_.keys(this[PVK].attributes), options);\n }\n\n /**\n * Fetches the object data if needed.\n * @param keys - The keys of the attributes to fetch.\n * @param options - Additional options for the fetch operation.\n * @returns A promise that resolves to the fetched object.\n */\n async fetchIfNeeded(keys: string[], options?: ExtraOptions<boolean>) {\n const current = _.keys(this[PVK].attributes);\n if (_.every(keys, k => _.includes(current, k))) return this;\n return this.fetchWithInclude(_.uniq([...current, ...keys]), options);\n }\n\n}\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAoNO,MAAM,WAAW,GAAG,CAAC,CAAmB,KAAiC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO;MACxJ,QAAQ,GAAG,CAAC,CAAmB,KAA8B,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAA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AC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { l as isValue } from './index-
|
|
2
|
+
import { l as isValue } from './index--ifyu-GL.mjs';
|
|
3
3
|
|
|
4
4
|
//
|
|
5
5
|
// keys.ts
|
|
@@ -487,4 +487,4 @@ class QueryExpressionSelector extends QuerySelector {
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
export { FieldSelectorExpression as F, QuerySelector as Q, QueryCoditionalSelector as a, QueryFieldSelector as b, QueryExpressionSelector as c, QueryDistanceExpression as d, QueryCoditionalExpression as e, QueryComparisonExpression as f, QueryNotExpression as g, QueryArrayExpression as h, QueryValueExpression as i, QueryKeyExpression as j, QueryExpression as k };
|
|
490
|
-
//# sourceMappingURL=index-
|
|
490
|
+
//# sourceMappingURL=index-C3fbOqmn.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-B1wqSio6.mjs","sources":["../../../src/internals/query/types/keys.ts","../../../src/server/query/dispatcher/parser/expressions.ts","../../../src/internals/query/types/selectors.ts","../../../src/server/query/dispatcher/parser/index.ts"],"sourcesContent":["//\n// keys.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nexport const TComparisonKeys = [\n '$eq',\n '$gt',\n '$gte',\n '$lt',\n '$lte',\n '$ne',\n] as const;\n\nexport const TValueListKeys = [\n '$in',\n '$nin',\n] as const;\n\nexport const TValueSetKeys = [\n '$subset',\n '$superset',\n '$intersect',\n] as const;\n\nexport const TConditionalKeys = [\n '$and',\n '$nor',\n '$or',\n] as const;\n\nexport const TDistanceKeys = [\n '$distance',\n '$innerProduct',\n '$negInnerProduct',\n '$cosineDistance',\n '$rectilinearDistance',\n] as const;\n","//\n// expressions.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TExpression } from '../../../../internals/query/types/expressions';\nimport { TComparisonKeys, TConditionalKeys, TDistanceKeys } from '../../../../internals/query/types/keys';\nimport { isValue } from '../../../../internals/object';\nimport { TValue } from '../../../../internals/types';\n\nexport class QueryExpression {\n\n static decode(expr: _.Many<TExpression>, dollerSign: boolean): QueryExpression {\n const exprs: QueryExpression[] = [];\n for (const selector of _.castArray(expr)) {\n for (const [key, query] of _.toPairs(selector)) {\n if (_.includes(TConditionalKeys, key) && _.isArray(query)) {\n exprs.push(new QueryCoditionalExpression(key as any, _.map(query, x => QueryExpression.decode(x as any, dollerSign))));\n } else if (_.includes(TComparisonKeys, key) && _.isArray(query) && query.length === 2) {\n const [left, right] = query;\n exprs.push(new QueryComparisonExpression(key as any, QueryExpression.decode(left as any, dollerSign), QueryExpression.decode(right as any, dollerSign)));\n } else if (_.includes(TDistanceKeys, key) && _.isArray(query) && query.length === 2) {\n const [left, right] = query;\n const _left = _.isArray(left) ? _.map(left, x => QueryExpression.decode(x as any, dollerSign)) : QueryExpression.decode(left as any, dollerSign);\n const _right = _.isArray(right) ? _.map(right, x => QueryExpression.decode(x as any, dollerSign)) : QueryExpression.decode(right as any, dollerSign);\n exprs.push(new QueryDistanceExpression(key as any, _.castArray(_left), _.castArray(_right)));\n } else if (key === '$not') {\n exprs.push(new QueryNotExpression(QueryExpression.decode(query as any, dollerSign)));\n } else if (key === '$array' && _.isArray(query)) {\n exprs.push(new QueryArrayExpression(_.map(query, x => QueryExpression.decode(x as any, dollerSign))));\n } else if (key === '$key' && _.isString(query)) {\n if (dollerSign && query === '$') {\n exprs.push(new QueryKeyExpression(query));\n } else if (!query.startsWith('$')) {\n exprs.push(new QueryKeyExpression(query));\n } else {\n throw Error('Invalid expression');\n }\n } else if (key === '$value' && isValue(query)) {\n exprs.push(new QueryValueExpression(query));\n } else {\n throw Error('Invalid expression');\n }\n }\n }\n if (_.isEmpty(exprs)) return new QueryExpression;\n return (exprs.length === 1 ? exprs[0] : new QueryCoditionalExpression('$and', exprs)).simplify();\n }\n\n simplify(): QueryExpression {\n return this;\n }\n\n keyPaths(): string[] {\n return [];\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return this;\n }\n}\n\nexport class QueryCoditionalExpression extends QueryExpression {\n\n type: typeof TConditionalKeys[number];\n exprs: QueryExpression[];\n\n constructor(type: typeof TConditionalKeys[number], exprs: QueryExpression[]) {\n super();\n this.type = type;\n this.exprs = exprs;\n }\n\n simplify() {\n if (_.isEmpty(this.exprs)) return new QueryExpression;\n if (this.exprs.length === 1 && this.type !== '$nor') return this.exprs[0];\n switch (this.type) {\n case '$and':\n return new QueryCoditionalExpression(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalExpression && x.type === '$and' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QueryExpression;\n case '$nor':\n case '$or':\n return new QueryCoditionalExpression(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalExpression && x.type === '$or' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QueryExpression;\n }\n }\n\n keyPaths(): string[] {\n return _.uniq(_.flatMap(this.exprs, x => x.keyPaths()));\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryCoditionalExpression(this.type, _.map(this.exprs, x => x.mapKey(callback)));\n }\n}\n\nexport class QueryComparisonExpression extends QueryExpression {\n\n type: typeof TComparisonKeys[number];\n left: QueryExpression;\n right: QueryExpression;\n\n constructor(type: typeof TComparisonKeys[number], left: QueryExpression, right: QueryExpression) {\n super();\n this.type = type;\n this.left = left;\n this.right = right;\n }\n\n simplify() {\n return new QueryComparisonExpression(this.type, this.left.simplify(), this.right.simplify());\n }\n\n keyPaths(): string[] {\n return _.uniq([\n ...this.left.keyPaths(),\n ...this.right.keyPaths(),\n ]);\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryComparisonExpression(this.type, this.left.mapKey(callback), this.right.mapKey(callback));\n }\n}\n\nexport class QueryNotExpression extends QueryExpression {\n\n expr: QueryExpression;\n\n constructor(expr: QueryExpression) {\n super();\n this.expr = expr;\n }\n\n simplify() {\n return new QueryNotExpression(this.expr.simplify());\n }\n\n keyPaths(): string[] {\n return this.expr.keyPaths();\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryNotExpression(this.expr.mapKey(callback));\n }\n}\n\nexport class QueryArrayExpression extends QueryExpression {\n\n exprs: QueryExpression[];\n\n constructor(exprs: QueryExpression[]) {\n super();\n this.exprs = exprs;\n }\n\n simplify() {\n return new QueryArrayExpression(_.map(this.exprs, x => x.simplify())) as QueryExpression;\n }\n\n keyPaths(): string[] {\n return _.uniq(_.flatMap(this.exprs, x => x.keyPaths()));\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryArrayExpression(_.map(this.exprs, x => x.mapKey(callback)));\n }\n}\n\nexport class QueryDistanceExpression extends QueryExpression {\n\n type: typeof TDistanceKeys[number];\n left: QueryExpression[];\n right: QueryExpression[];\n\n constructor(type: typeof TDistanceKeys[number], left: QueryExpression[], right: QueryExpression[]) {\n super();\n this.type = type;\n this.left = left;\n this.right = right;\n }\n\n simplify() {\n return new QueryDistanceExpression(this.type, _.map(this.left, x => x.simplify()), _.map(this.right, x => x.simplify()));\n }\n\n keyPaths(): string[] {\n return _.uniq([\n ..._.flatMap(this.left, x => x.keyPaths()),\n ..._.flatMap(this.right, x => x.keyPaths()),\n ]);\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryDistanceExpression(this.type, _.map(this.left, x => x.mapKey(callback)), _.map(this.right, x => x.mapKey(callback)));\n }\n}\n\nexport class QueryKeyExpression extends QueryExpression {\n\n key: string;\n\n constructor(key: string) {\n super();\n this.key = key;\n }\n\n keyPaths(): string[] {\n return this.key === '$' ? [] : [this.key];\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryKeyExpression(callback(this.key));\n }\n}\n\nexport class QueryValueExpression extends QueryExpression {\n\n value: TValue;\n\n constructor(value: TValue) {\n super();\n this.value = value;\n }\n}\n","//\n// selectors.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { TValue } from '../../types';\nimport { TBooleanExpression } from './expressions';\nimport { TConditionalKeys, TValueListKeys, TValueSetKeys, TComparisonKeys } from './keys';\n\nexport const allFieldQueryKeys = [\n '$not', '$pattern', '$starts', '$ends', '$size', '$empty', '$every', '$some',\n ...TConditionalKeys,\n ...TValueListKeys,\n ...TValueSetKeys\n];\n\ntype TThisQuerySelector = { $?: TFieldQuerySelector; };\n\nexport type TFieldQuerySelector = {\n $not?: TFieldQuerySelector;\n $starts?: string;\n $ends?: string;\n $pattern?: RegExp | string;\n $size?: number;\n $empty?: boolean;\n $every?: TQuerySelector | TThisQuerySelector;\n $some?: TQuerySelector | TThisQuerySelector;\n} & {\n [x in (typeof TComparisonKeys)[number]]?: TValue;\n } & {\n [x in (typeof TValueListKeys)[number]]?: TValue[];\n } & {\n [x in (typeof TValueSetKeys)[number]]?: TValue[];\n };\n\nexport type TCoditionalQuerySelector = {\n [x in (typeof TConditionalKeys)[number]]?: TQuerySelector[];\n};\n\nexport type TQuerySelector = TCoditionalQuerySelector & {\n $expr?: TBooleanExpression\n} | {\n [x: string]: TFieldQuerySelector;\n};\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { QueryExpression } from './expressions';\nimport { TFieldQuerySelector, TQuerySelector, allFieldQueryKeys } from '../../../../internals/query/types/selectors';\nimport { TComparisonKeys, TConditionalKeys, TValueListKeys, TValueSetKeys } from '../../../../internals/query/types/keys';\nimport { isValue } from '../../../../internals/object';\nimport { TValue } from '../../../../internals/types';\n\nexport class QuerySelector {\n\n static decode(selectors: _.Many<TQuerySelector>, dollerSign: boolean = false): QuerySelector {\n const exprs: QuerySelector[] = [];\n for (const selector of _.castArray(selectors)) {\n for (const [key, query] of _.toPairs(selector)) {\n if (_.includes(TConditionalKeys, key) && _.isArray(query)) {\n exprs.push(new QueryCoditionalSelector(key as any, _.map(query, x => QuerySelector.decode(x, dollerSign))));\n } else if (key === '$expr') {\n exprs.push(new QueryExpressionSelector(QueryExpression.decode(query as any, dollerSign)));\n } else if (dollerSign && key === '$' && !_.isArray(query)) {\n exprs.push(new QueryFieldSelector(key, FieldSelectorExpression.decode(query)));\n } else if (!key.startsWith('$') && !_.isArray(query)) {\n exprs.push(new QueryFieldSelector(key, FieldSelectorExpression.decode(query)));\n } else {\n throw Error('Invalid expression');\n }\n }\n }\n if (_.isEmpty(exprs)) return new QuerySelector;\n return (exprs.length === 1 ? exprs[0] : new QueryCoditionalSelector('$and', exprs)).simplify();\n }\n\n simplify(): QuerySelector {\n return this;\n }\n\n keyPaths(): string[] {\n return [];\n }\n}\n\nexport class QueryCoditionalSelector extends QuerySelector {\n\n type: typeof TConditionalKeys[number];\n exprs: QuerySelector[];\n\n constructor(type: typeof TConditionalKeys[number], exprs: QuerySelector[]) {\n super();\n this.type = type;\n this.exprs = exprs;\n }\n\n simplify() {\n if (_.isEmpty(this.exprs)) return new QuerySelector;\n if (this.exprs.length === 1 && this.type !== '$nor') return this.exprs[0];\n switch (this.type) {\n case '$and':\n return new QueryCoditionalSelector(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalSelector && x.type === '$and' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QuerySelector;\n case '$nor':\n case '$or':\n return new QueryCoditionalSelector(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalSelector && x.type === '$or' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QuerySelector;\n }\n }\n\n keyPaths(): string[] {\n return _.uniq(_.flatMap(this.exprs, x => x.keyPaths()));\n }\n}\n\nexport class FieldSelectorExpression {\n\n type: keyof TFieldQuerySelector;\n value: QuerySelector | FieldSelectorExpression | RegExp | TValue;\n\n constructor(type: keyof TFieldQuerySelector, value: QuerySelector | FieldSelectorExpression | RegExp | TValue) {\n this.type = type;\n this.value = value;\n }\n\n static decode(selector: TFieldQuerySelector): FieldSelectorExpression {\n for (const [type, expr] of _.toPairs(selector)) {\n if (_.includes(TComparisonKeys, type)) {\n if (!isValue(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type as any, expr);\n } else if (_.includes(TValueListKeys, type) || _.includes(TValueSetKeys, type)) {\n if (!isValue(expr) || !_.isArray(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type as any, expr);\n } else {\n switch (type) {\n case '$not':\n {\n const _expr = expr ? { ...expr as any } : {};\n const keys = _.keys(_expr);\n if (keys.length !== 1 && !allFieldQueryKeys.includes(keys[0])) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, FieldSelectorExpression.decode(_expr));\n }\n case '$pattern':\n if (!_.isString(expr) && !_.isRegExp(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$starts':\n case '$ends':\n if (!_.isString(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$size':\n if (!_.isNumber(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$empty':\n if (!_.isBoolean(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$every':\n case '$some':\n return new FieldSelectorExpression(type, QuerySelector.decode(expr ? { ...expr as any } : {}, true));\n default: throw Error('Invalid expression');\n }\n }\n }\n throw Error('Invalid expression');\n }\n\n simplify(): FieldSelectorExpression {\n if (this.value instanceof QuerySelector) {\n return new FieldSelectorExpression(this.type, this.value.simplify());\n }\n if (this.value instanceof FieldSelectorExpression) {\n return new FieldSelectorExpression(this.type, this.value.simplify());\n }\n return this;\n }\n\n keyPaths(field?: string): string[] {\n let result: string[] = [];\n if (this.value instanceof QuerySelector) {\n result = this.value.keyPaths();\n } else if (this.value instanceof FieldSelectorExpression) {\n switch (this.type) {\n case '$every':\n case '$some':\n result = this.value.keyPaths();\n default:\n result = this.value.keyPaths();\n }\n }\n return field ? result.map(x => `${field}.${x}`) : result;\n }\n}\n\nexport class QueryFieldSelector extends QuerySelector {\n\n field: string;\n expr: FieldSelectorExpression;\n\n constructor(field: string, expr: FieldSelectorExpression) {\n super();\n this.field = field;\n this.expr = expr;\n }\n\n simplify() {\n return new QueryFieldSelector(this.field, this.expr.simplify());\n }\n\n keyPaths(): string[] {\n return this.field === '$' ? this.expr.keyPaths() : [this.field, ...this.expr.keyPaths(this.field)];\n }\n}\n\nexport class QueryExpressionSelector extends QuerySelector {\n\n expr: QueryExpression;\n\n constructor(expr: QueryExpression) {\n super();\n this.expr = expr;\n }\n\n simplify() {\n return new QueryExpressionSelector(this.expr.simplify());\n }\n\n keyPaths(): string[] {\n return this.expr.keyPaths();\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;CACG;AAEH,MAAM,cAAc,GAAG;IAC5B,KAAK;IACL,MAAM;CACE;AAEH,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,WAAW;IACX,YAAY;CACJ;AAEH,MAAM,gBAAgB,GAAG;IAC9B,MAAM;IACN,MAAM;IACN,KAAK;CACG;AAEH,MAAM,aAAa,GAAG;IAC3B,WAAW;IACX,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,sBAAsB;CACd;;ACzDV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MA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AC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;AAErG;AAEK,MAAO,uBAAwB,SAAQ,aAAa,CAAA;AAExD,IAAA,IAAI;AAEJ,IAAA,WAAA,CAAY,IAAqB,EAAA;AAC/B,QAAA,KAAK,EAAE;AACP,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;;IAGlB,QAAQ,GAAA;QACN,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;;IAG1D,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;;AAE9B;;;;"}
|
|
1
|
+
{"version":3,"file":"index-C3fbOqmn.mjs","sources":["../../../src/internals/query/types/keys.ts","../../../src/server/query/dispatcher/parser/expressions.ts","../../../src/internals/query/types/selectors.ts","../../../src/server/query/dispatcher/parser/index.ts"],"sourcesContent":["//\n// keys.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nexport const TComparisonKeys = [\n '$eq',\n '$gt',\n '$gte',\n '$lt',\n '$lte',\n '$ne',\n] as const;\n\nexport const TValueListKeys = [\n '$in',\n '$nin',\n] as const;\n\nexport const TValueSetKeys = [\n '$subset',\n '$superset',\n '$intersect',\n] as const;\n\nexport const TConditionalKeys = [\n '$and',\n '$nor',\n '$or',\n] as const;\n\nexport const TDistanceKeys = [\n '$distance',\n '$innerProduct',\n '$negInnerProduct',\n '$cosineDistance',\n '$rectilinearDistance',\n] as const;\n","//\n// expressions.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TExpression } from '../../../../internals/query/types/expressions';\nimport { TComparisonKeys, TConditionalKeys, TDistanceKeys } from '../../../../internals/query/types/keys';\nimport { isValue } from '../../../../internals/object';\nimport { TValue } from '../../../../internals/types';\n\nexport class QueryExpression {\n\n static decode(expr: _.Many<TExpression>, dollerSign: boolean): QueryExpression {\n const exprs: QueryExpression[] = [];\n for (const selector of _.castArray(expr)) {\n for (const [key, query] of _.toPairs(selector)) {\n if (_.includes(TConditionalKeys, key) && _.isArray(query)) {\n exprs.push(new QueryCoditionalExpression(key as any, _.map(query, x => QueryExpression.decode(x as any, dollerSign))));\n } else if (_.includes(TComparisonKeys, key) && _.isArray(query) && query.length === 2) {\n const [left, right] = query;\n exprs.push(new QueryComparisonExpression(key as any, QueryExpression.decode(left as any, dollerSign), QueryExpression.decode(right as any, dollerSign)));\n } else if (_.includes(TDistanceKeys, key) && _.isArray(query) && query.length === 2) {\n const [left, right] = query;\n const _left = _.isArray(left) ? _.map(left, x => QueryExpression.decode(x as any, dollerSign)) : QueryExpression.decode(left as any, dollerSign);\n const _right = _.isArray(right) ? _.map(right, x => QueryExpression.decode(x as any, dollerSign)) : QueryExpression.decode(right as any, dollerSign);\n exprs.push(new QueryDistanceExpression(key as any, _.castArray(_left), _.castArray(_right)));\n } else if (key === '$not') {\n exprs.push(new QueryNotExpression(QueryExpression.decode(query as any, dollerSign)));\n } else if (key === '$array' && _.isArray(query)) {\n exprs.push(new QueryArrayExpression(_.map(query, x => QueryExpression.decode(x as any, dollerSign))));\n } else if (key === '$key' && _.isString(query)) {\n if (dollerSign && query === '$') {\n exprs.push(new QueryKeyExpression(query));\n } else if (!query.startsWith('$')) {\n exprs.push(new QueryKeyExpression(query));\n } else {\n throw Error('Invalid expression');\n }\n } else if (key === '$value' && isValue(query)) {\n exprs.push(new QueryValueExpression(query));\n } else {\n throw Error('Invalid expression');\n }\n }\n }\n if (_.isEmpty(exprs)) return new QueryExpression;\n return (exprs.length === 1 ? exprs[0] : new QueryCoditionalExpression('$and', exprs)).simplify();\n }\n\n simplify(): QueryExpression {\n return this;\n }\n\n keyPaths(): string[] {\n return [];\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return this;\n }\n}\n\nexport class QueryCoditionalExpression extends QueryExpression {\n\n type: typeof TConditionalKeys[number];\n exprs: QueryExpression[];\n\n constructor(type: typeof TConditionalKeys[number], exprs: QueryExpression[]) {\n super();\n this.type = type;\n this.exprs = exprs;\n }\n\n simplify() {\n if (_.isEmpty(this.exprs)) return new QueryExpression;\n if (this.exprs.length === 1 && this.type !== '$nor') return this.exprs[0];\n switch (this.type) {\n case '$and':\n return new QueryCoditionalExpression(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalExpression && x.type === '$and' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QueryExpression;\n case '$nor':\n case '$or':\n return new QueryCoditionalExpression(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalExpression && x.type === '$or' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QueryExpression;\n }\n }\n\n keyPaths(): string[] {\n return _.uniq(_.flatMap(this.exprs, x => x.keyPaths()));\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryCoditionalExpression(this.type, _.map(this.exprs, x => x.mapKey(callback)));\n }\n}\n\nexport class QueryComparisonExpression extends QueryExpression {\n\n type: typeof TComparisonKeys[number];\n left: QueryExpression;\n right: QueryExpression;\n\n constructor(type: typeof TComparisonKeys[number], left: QueryExpression, right: QueryExpression) {\n super();\n this.type = type;\n this.left = left;\n this.right = right;\n }\n\n simplify() {\n return new QueryComparisonExpression(this.type, this.left.simplify(), this.right.simplify());\n }\n\n keyPaths(): string[] {\n return _.uniq([\n ...this.left.keyPaths(),\n ...this.right.keyPaths(),\n ]);\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryComparisonExpression(this.type, this.left.mapKey(callback), this.right.mapKey(callback));\n }\n}\n\nexport class QueryNotExpression extends QueryExpression {\n\n expr: QueryExpression;\n\n constructor(expr: QueryExpression) {\n super();\n this.expr = expr;\n }\n\n simplify() {\n return new QueryNotExpression(this.expr.simplify());\n }\n\n keyPaths(): string[] {\n return this.expr.keyPaths();\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryNotExpression(this.expr.mapKey(callback));\n }\n}\n\nexport class QueryArrayExpression extends QueryExpression {\n\n exprs: QueryExpression[];\n\n constructor(exprs: QueryExpression[]) {\n super();\n this.exprs = exprs;\n }\n\n simplify() {\n return new QueryArrayExpression(_.map(this.exprs, x => x.simplify())) as QueryExpression;\n }\n\n keyPaths(): string[] {\n return _.uniq(_.flatMap(this.exprs, x => x.keyPaths()));\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryArrayExpression(_.map(this.exprs, x => x.mapKey(callback)));\n }\n}\n\nexport class QueryDistanceExpression extends QueryExpression {\n\n type: typeof TDistanceKeys[number];\n left: QueryExpression[];\n right: QueryExpression[];\n\n constructor(type: typeof TDistanceKeys[number], left: QueryExpression[], right: QueryExpression[]) {\n super();\n this.type = type;\n this.left = left;\n this.right = right;\n }\n\n simplify() {\n return new QueryDistanceExpression(this.type, _.map(this.left, x => x.simplify()), _.map(this.right, x => x.simplify()));\n }\n\n keyPaths(): string[] {\n return _.uniq([\n ..._.flatMap(this.left, x => x.keyPaths()),\n ..._.flatMap(this.right, x => x.keyPaths()),\n ]);\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryDistanceExpression(this.type, _.map(this.left, x => x.mapKey(callback)), _.map(this.right, x => x.mapKey(callback)));\n }\n}\n\nexport class QueryKeyExpression extends QueryExpression {\n\n key: string;\n\n constructor(key: string) {\n super();\n this.key = key;\n }\n\n keyPaths(): string[] {\n return this.key === '$' ? [] : [this.key];\n }\n\n mapKey(callback: (key: string) => string): QueryExpression {\n return new QueryKeyExpression(callback(this.key));\n }\n}\n\nexport class QueryValueExpression extends QueryExpression {\n\n value: TValue;\n\n constructor(value: TValue) {\n super();\n this.value = value;\n }\n}\n","//\n// selectors.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { TValue } from '../../types';\nimport { TBooleanExpression } from './expressions';\nimport { TConditionalKeys, TValueListKeys, TValueSetKeys, TComparisonKeys } from './keys';\n\nexport const allFieldQueryKeys = [\n '$not', '$pattern', '$starts', '$ends', '$size', '$empty', '$every', '$some',\n ...TConditionalKeys,\n ...TValueListKeys,\n ...TValueSetKeys\n];\n\ntype TThisQuerySelector = { $?: TFieldQuerySelector; };\n\nexport type TFieldQuerySelector = {\n $not?: TFieldQuerySelector;\n $starts?: string;\n $ends?: string;\n $pattern?: RegExp | string;\n $size?: number;\n $empty?: boolean;\n $every?: TQuerySelector | TThisQuerySelector;\n $some?: TQuerySelector | TThisQuerySelector;\n} & {\n [x in (typeof TComparisonKeys)[number]]?: TValue;\n } & {\n [x in (typeof TValueListKeys)[number]]?: TValue[];\n } & {\n [x in (typeof TValueSetKeys)[number]]?: TValue[];\n };\n\nexport type TCoditionalQuerySelector = {\n [x in (typeof TConditionalKeys)[number]]?: TQuerySelector[];\n};\n\nexport type TQuerySelector = TCoditionalQuerySelector & {\n $expr?: TBooleanExpression\n} | {\n [x: string]: TFieldQuerySelector;\n};\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { QueryExpression } from './expressions';\nimport { TFieldQuerySelector, TQuerySelector, allFieldQueryKeys } from '../../../../internals/query/types/selectors';\nimport { TComparisonKeys, TConditionalKeys, TValueListKeys, TValueSetKeys } from '../../../../internals/query/types/keys';\nimport { isValue } from '../../../../internals/object';\nimport { TValue } from '../../../../internals/types';\n\nexport class QuerySelector {\n\n static decode(selectors: _.Many<TQuerySelector>, dollerSign: boolean = false): QuerySelector {\n const exprs: QuerySelector[] = [];\n for (const selector of _.castArray(selectors)) {\n for (const [key, query] of _.toPairs(selector)) {\n if (_.includes(TConditionalKeys, key) && _.isArray(query)) {\n exprs.push(new QueryCoditionalSelector(key as any, _.map(query, x => QuerySelector.decode(x, dollerSign))));\n } else if (key === '$expr') {\n exprs.push(new QueryExpressionSelector(QueryExpression.decode(query as any, dollerSign)));\n } else if (dollerSign && key === '$' && !_.isArray(query)) {\n exprs.push(new QueryFieldSelector(key, FieldSelectorExpression.decode(query)));\n } else if (!key.startsWith('$') && !_.isArray(query)) {\n exprs.push(new QueryFieldSelector(key, FieldSelectorExpression.decode(query)));\n } else {\n throw Error('Invalid expression');\n }\n }\n }\n if (_.isEmpty(exprs)) return new QuerySelector;\n return (exprs.length === 1 ? exprs[0] : new QueryCoditionalSelector('$and', exprs)).simplify();\n }\n\n simplify(): QuerySelector {\n return this;\n }\n\n keyPaths(): string[] {\n return [];\n }\n}\n\nexport class QueryCoditionalSelector extends QuerySelector {\n\n type: typeof TConditionalKeys[number];\n exprs: QuerySelector[];\n\n constructor(type: typeof TConditionalKeys[number], exprs: QuerySelector[]) {\n super();\n this.type = type;\n this.exprs = exprs;\n }\n\n simplify() {\n if (_.isEmpty(this.exprs)) return new QuerySelector;\n if (this.exprs.length === 1 && this.type !== '$nor') return this.exprs[0];\n switch (this.type) {\n case '$and':\n return new QueryCoditionalSelector(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalSelector && x.type === '$and' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QuerySelector;\n case '$nor':\n case '$or':\n return new QueryCoditionalSelector(this.type, _.flatMap(\n this.exprs, x => x instanceof QueryCoditionalSelector && x.type === '$or' ? _.map(x.exprs, y => y.simplify()) : [x.simplify()]\n )) as QuerySelector;\n }\n }\n\n keyPaths(): string[] {\n return _.uniq(_.flatMap(this.exprs, x => x.keyPaths()));\n }\n}\n\nexport class FieldSelectorExpression {\n\n type: keyof TFieldQuerySelector;\n value: QuerySelector | FieldSelectorExpression | RegExp | TValue;\n\n constructor(type: keyof TFieldQuerySelector, value: QuerySelector | FieldSelectorExpression | RegExp | TValue) {\n this.type = type;\n this.value = value;\n }\n\n static decode(selector: TFieldQuerySelector): FieldSelectorExpression {\n for (const [type, expr] of _.toPairs(selector)) {\n if (_.includes(TComparisonKeys, type)) {\n if (!isValue(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type as any, expr);\n } else if (_.includes(TValueListKeys, type) || _.includes(TValueSetKeys, type)) {\n if (!isValue(expr) || !_.isArray(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type as any, expr);\n } else {\n switch (type) {\n case '$not':\n {\n const _expr = expr ? { ...expr as any } : {};\n const keys = _.keys(_expr);\n if (keys.length !== 1 && !allFieldQueryKeys.includes(keys[0])) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, FieldSelectorExpression.decode(_expr));\n }\n case '$pattern':\n if (!_.isString(expr) && !_.isRegExp(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$starts':\n case '$ends':\n if (!_.isString(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$size':\n if (!_.isNumber(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$empty':\n if (!_.isBoolean(expr)) throw Error('Invalid expression');\n return new FieldSelectorExpression(type, expr);\n case '$every':\n case '$some':\n return new FieldSelectorExpression(type, QuerySelector.decode(expr ? { ...expr as any } : {}, true));\n default: throw Error('Invalid expression');\n }\n }\n }\n throw Error('Invalid expression');\n }\n\n simplify(): FieldSelectorExpression {\n if (this.value instanceof QuerySelector) {\n return new FieldSelectorExpression(this.type, this.value.simplify());\n }\n if (this.value instanceof FieldSelectorExpression) {\n return new FieldSelectorExpression(this.type, this.value.simplify());\n }\n return this;\n }\n\n keyPaths(field?: string): string[] {\n let result: string[] = [];\n if (this.value instanceof QuerySelector) {\n result = this.value.keyPaths();\n } else if (this.value instanceof FieldSelectorExpression) {\n switch (this.type) {\n case '$every':\n case '$some':\n result = this.value.keyPaths();\n default:\n result = this.value.keyPaths();\n }\n }\n return field ? result.map(x => `${field}.${x}`) : result;\n }\n}\n\nexport class QueryFieldSelector extends QuerySelector {\n\n field: string;\n expr: FieldSelectorExpression;\n\n constructor(field: string, expr: FieldSelectorExpression) {\n super();\n this.field = field;\n this.expr = expr;\n }\n\n simplify() {\n return new QueryFieldSelector(this.field, this.expr.simplify());\n }\n\n keyPaths(): string[] {\n return this.field === '$' ? this.expr.keyPaths() : [this.field, ...this.expr.keyPaths(this.field)];\n }\n}\n\nexport class QueryExpressionSelector extends QuerySelector {\n\n expr: QueryExpression;\n\n constructor(expr: QueryExpression) {\n super();\n this.expr = expr;\n }\n\n simplify() {\n return new QueryExpressionSelector(this.expr.simplify());\n }\n\n keyPaths(): string[] {\n return this.expr.keyPaths();\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;CACG;AAEH,MAAM,cAAc,GAAG;IAC5B,KAAK;IACL,MAAM;CACE;AAEH,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,WAAW;IACX,YAAY;CACJ;AAEH,MAAM,gBAAgB,GAAG;IAC9B,MAAM;IACN,MAAM;IACN,KAAK;CACG;AAEH,MAAM,aAAa,GAAG;IAC3B,WAAW;IACX,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,sBAAsB;CACd;;ACzDV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAQa,eAAe,CAAA;AAE1B,IAAA,OAAO,MAAM,CAAC,IAAyB,EAAE,UAAmB,EAAA;QAC1D,MAAM,KAAK,GAAsB,EAAE;QACnC,KAAK,MAAM,QAAQ,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;AACxC,YAAA,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