mormati-mongoose 0.1.23 → 0.1.26
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/helper/model/index.d.ts +1 -1
- package/dist/helper/model/index.js +3 -1
- package/dist/helper/model/index.js.map +1 -1
- package/dist/helper/model/model.schema.d.ts +17 -0
- package/dist/helper/model/model.schema.js +39 -1
- package/dist/helper/model/model.schema.js.map +1 -1
- package/dist/helper/query/engine/engine.type.d.ts +22 -0
- package/dist/helper/query/engine/engine.type.js +3 -0
- package/dist/helper/query/engine/engine.type.js.map +1 -0
- package/dist/helper/query/engine/group/index.d.ts +92 -0
- package/dist/helper/query/engine/group/index.js +14 -0
- package/dist/helper/query/engine/group/index.js.map +1 -0
- package/dist/helper/query/{query.engine.d.ts → engine/index.d.ts} +1 -1
- package/dist/helper/query/engine/index.js +53 -0
- package/dist/helper/query/engine/index.js.map +1 -0
- package/dist/helper/query/engine/limit/index.d.ts +8 -0
- package/dist/helper/query/engine/limit/index.js +9 -0
- package/dist/helper/query/engine/limit/index.js.map +1 -0
- package/dist/helper/query/engine/lookup/index.d.ts +6 -0
- package/dist/helper/query/engine/lookup/index.js +46 -0
- package/dist/helper/query/engine/lookup/index.js.map +1 -0
- package/dist/helper/query/engine/lookup/lookup.pipe.d.ts +8 -0
- package/dist/helper/query/engine/lookup/lookup.pipe.js +123 -0
- package/dist/helper/query/engine/lookup/lookup.pipe.js.map +1 -0
- package/dist/helper/query/engine/match/index.d.ts +56 -0
- package/dist/helper/query/engine/match/index.js +77 -0
- package/dist/helper/query/engine/match/index.js.map +1 -0
- package/dist/helper/query/engine/match/match.search.d.ts +7 -0
- package/dist/helper/query/engine/match/match.search.js +37 -0
- package/dist/helper/query/engine/match/match.search.js.map +1 -0
- package/dist/helper/query/engine/project/index.d.ts +8 -0
- package/dist/helper/query/engine/project/index.js +15 -0
- package/dist/helper/query/engine/project/index.js.map +1 -0
- package/dist/helper/query/engine/skip/index.d.ts +8 -0
- package/dist/helper/query/engine/skip/index.js +9 -0
- package/dist/helper/query/engine/skip/index.js.map +1 -0
- package/dist/helper/query/engine/sort/index.d.ts +8 -0
- package/dist/helper/query/engine/sort/index.js +10 -0
- package/dist/helper/query/engine/sort/index.js.map +1 -0
- package/dist/helper/query/engine/unset/index.d.ts +8 -0
- package/dist/helper/query/engine/unset/index.js +10 -0
- package/dist/helper/query/engine/unset/index.js.map +1 -0
- package/dist/helper/query/engine/unwind/index.d.ts +6 -0
- package/dist/helper/query/engine/unwind/index.js +26 -0
- package/dist/helper/query/engine/unwind/index.js.map +1 -0
- package/dist/helper/query/index.d.ts +3 -3
- package/dist/helper/query/index.js +3 -5
- package/dist/helper/query/index.js.map +1 -1
- package/dist/helper/query/query.dto.d.ts +2 -3
- package/dist/helper/query/query.dto.js +1 -0
- package/dist/helper/query/query.dto.js.map +1 -1
- package/dist/helper/query/query.expression.d.ts +1 -0
- package/dist/helper/query/query.expression.js +1 -0
- package/dist/helper/query/query.expression.js.map +1 -1
- package/dist/helper/query/query.method.d.ts +1 -3
- package/dist/helper/query/query.method.js +1 -34
- package/dist/helper/query/query.method.js.map +1 -1
- package/dist/helper/query/{quer.type.js → query.type.js} +1 -1
- package/dist/helper/query/query.type.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/helper/query/quer.type.js.map +0 -1
- package/dist/helper/query/query.engine.js +0 -296
- package/dist/helper/query/query.engine.js.map +0 -1
- /package/dist/helper/query/{quer.type.d.ts → query.type.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createGenericDto, createGenericWithApproveDto, GenericSubAssetDto, GenericSubVisibilityDto, } from "./model.dto";
|
|
2
|
-
export { GenericSchema, GenericWithApproveSchema, GenericSubAssetSchema, GenericSubVisibilitySchema, } from "./model.schema";
|
|
2
|
+
export { GenericSchema, GenericWithApproveSchema, GenericSubAssetSchema, GenericSubVisibilitySchema, GenericSubCatalog, getGenericSubCatalogSchema, } from "./model.schema";
|
|
3
3
|
export { dateTransform, createIndex, createSearchIndex, } from "./model.method";
|
|
4
4
|
export { TAssetType, assetType, assetTypeEntity, } from './model.option';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assetTypeEntity = exports.assetType = exports.createSearchIndex = exports.createIndex = exports.dateTransform = exports.GenericSubVisibilitySchema = exports.GenericSubAssetSchema = exports.GenericWithApproveSchema = exports.GenericSchema = exports.GenericSubVisibilityDto = exports.GenericSubAssetDto = exports.createGenericWithApproveDto = exports.createGenericDto = void 0;
|
|
3
|
+
exports.assetTypeEntity = exports.assetType = exports.createSearchIndex = exports.createIndex = exports.dateTransform = exports.getGenericSubCatalogSchema = exports.GenericSubCatalog = exports.GenericSubVisibilitySchema = exports.GenericSubAssetSchema = exports.GenericWithApproveSchema = exports.GenericSchema = exports.GenericSubVisibilityDto = exports.GenericSubAssetDto = exports.createGenericWithApproveDto = exports.createGenericDto = void 0;
|
|
4
4
|
var model_dto_1 = require("./model.dto");
|
|
5
5
|
Object.defineProperty(exports, "createGenericDto", { enumerable: true, get: function () { return model_dto_1.createGenericDto; } });
|
|
6
6
|
Object.defineProperty(exports, "createGenericWithApproveDto", { enumerable: true, get: function () { return model_dto_1.createGenericWithApproveDto; } });
|
|
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "GenericSchema", { enumerable: true, get: functio
|
|
|
11
11
|
Object.defineProperty(exports, "GenericWithApproveSchema", { enumerable: true, get: function () { return model_schema_1.GenericWithApproveSchema; } });
|
|
12
12
|
Object.defineProperty(exports, "GenericSubAssetSchema", { enumerable: true, get: function () { return model_schema_1.GenericSubAssetSchema; } });
|
|
13
13
|
Object.defineProperty(exports, "GenericSubVisibilitySchema", { enumerable: true, get: function () { return model_schema_1.GenericSubVisibilitySchema; } });
|
|
14
|
+
Object.defineProperty(exports, "GenericSubCatalog", { enumerable: true, get: function () { return model_schema_1.GenericSubCatalog; } });
|
|
15
|
+
Object.defineProperty(exports, "getGenericSubCatalogSchema", { enumerable: true, get: function () { return model_schema_1.getGenericSubCatalogSchema; } });
|
|
14
16
|
var model_method_1 = require("./model.method");
|
|
15
17
|
Object.defineProperty(exports, "dateTransform", { enumerable: true, get: function () { return model_method_1.dateTransform; } });
|
|
16
18
|
Object.defineProperty(exports, "createIndex", { enumerable: true, get: function () { return model_method_1.createIndex; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/mongoose/src/helper/model/index.ts"],"names":[],"mappings":";;;AAAA,yCAKqB;AAJjB,6GAAA,gBAAgB,OAAA;AAChB,wHAAA,2BAA2B,OAAA;AAC3B,+GAAA,kBAAkB,OAAA;AAClB,oHAAA,uBAAuB,OAAA;AAE3B,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/mongoose/src/helper/model/index.ts"],"names":[],"mappings":";;;AAAA,yCAKqB;AAJjB,6GAAA,gBAAgB,OAAA;AAChB,wHAAA,2BAA2B,OAAA;AAC3B,+GAAA,kBAAkB,OAAA;AAClB,oHAAA,uBAAuB,OAAA;AAE3B,+CAOwB;AANpB,6GAAA,aAAa,OAAA;AACb,wHAAA,wBAAwB,OAAA;AACxB,qHAAA,qBAAqB,OAAA;AACrB,0HAAA,0BAA0B,OAAA;AAC1B,iHAAA,iBAAiB,OAAA;AACjB,0HAAA,0BAA0B,OAAA;AAE9B,+CAIwB;AAHpB,6GAAA,aAAa,OAAA;AACb,2GAAA,WAAW,OAAA;AACX,iHAAA,iBAAiB,OAAA;AAErB,+CAIwB;AAFpB,yGAAA,SAAS,OAAA;AACT,+GAAA,eAAe,OAAA"}
|
|
@@ -27,3 +27,20 @@ export declare class GenericSubVisibilitySchema {
|
|
|
27
27
|
from: Date;
|
|
28
28
|
to: Date;
|
|
29
29
|
}
|
|
30
|
+
export declare class GenericSubCatalog {
|
|
31
|
+
is_visible: boolean;
|
|
32
|
+
sequence: number;
|
|
33
|
+
created_at: Date;
|
|
34
|
+
updated_at: Date;
|
|
35
|
+
}
|
|
36
|
+
export declare const getGenericSubCatalogSchema: (GenericSubCatalog: any) => import("mongoose").Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
|
|
37
|
+
[x: string]: unknown;
|
|
38
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
}>> & import("mongoose").FlatRecord<{
|
|
41
|
+
[x: string]: unknown;
|
|
42
|
+
}> & Required<{
|
|
43
|
+
_id: unknown;
|
|
44
|
+
}> & {
|
|
45
|
+
__v?: number;
|
|
46
|
+
}>;
|
|
@@ -9,9 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GenericSubVisibilitySchema = exports.GenericSubAssetSchema = exports.GenericWithApproveSchema = exports.GenericSchema = void 0;
|
|
12
|
+
exports.getGenericSubCatalogSchema = exports.GenericSubCatalog = exports.GenericSubVisibilitySchema = exports.GenericSubAssetSchema = exports.GenericWithApproveSchema = exports.GenericSchema = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const model_option_1 = require("./model.option");
|
|
15
|
+
const moment_1 = require("moment");
|
|
15
16
|
let GenericSchema = class GenericSchema {
|
|
16
17
|
};
|
|
17
18
|
exports.GenericSchema = GenericSchema;
|
|
@@ -120,4 +121,41 @@ exports.GenericSubVisibilitySchema = GenericSubVisibilitySchema = __decorate([
|
|
|
120
121
|
(0, mongoose_1.Schema)({ _id: false })
|
|
121
122
|
], GenericSubVisibilitySchema);
|
|
122
123
|
;
|
|
124
|
+
let GenericSubCatalog = class GenericSubCatalog {
|
|
125
|
+
};
|
|
126
|
+
exports.GenericSubCatalog = GenericSubCatalog;
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: false, default: true }),
|
|
129
|
+
__metadata("design:type", Boolean)
|
|
130
|
+
], GenericSubCatalog.prototype, "is_visible", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: 0 }),
|
|
133
|
+
__metadata("design:type", Number)
|
|
134
|
+
], GenericSubCatalog.prototype, "sequence", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, mongoose_1.Prop)({ type: Date, required: false, default: Date.now }),
|
|
137
|
+
__metadata("design:type", Date)
|
|
138
|
+
], GenericSubCatalog.prototype, "created_at", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, mongoose_1.Prop)({ type: Date, required: false, default: Date.now }),
|
|
141
|
+
__metadata("design:type", Date)
|
|
142
|
+
], GenericSubCatalog.prototype, "updated_at", void 0);
|
|
143
|
+
exports.GenericSubCatalog = GenericSubCatalog = __decorate([
|
|
144
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
145
|
+
], GenericSubCatalog);
|
|
146
|
+
;
|
|
147
|
+
const getGenericSubCatalogSchema = (GenericSubCatalog) => {
|
|
148
|
+
const GenericSubCatalogSchema = mongoose_1.SchemaFactory.createForClass(GenericSubCatalog);
|
|
149
|
+
GenericSubCatalogSchema.pre('validate', function (next) {
|
|
150
|
+
next();
|
|
151
|
+
});
|
|
152
|
+
GenericSubCatalogSchema.pre('updateOne', async function (next) {
|
|
153
|
+
const self = this;
|
|
154
|
+
const data = self.getUpdate();
|
|
155
|
+
data.updated_at = (0, moment_1.default)().toDate();
|
|
156
|
+
next();
|
|
157
|
+
});
|
|
158
|
+
return GenericSubCatalogSchema;
|
|
159
|
+
};
|
|
160
|
+
exports.getGenericSubCatalogSchema = getGenericSubCatalogSchema;
|
|
123
161
|
//# sourceMappingURL=model.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.schema.js","sourceRoot":"","sources":["../../../../../libs/mongoose/src/helper/model/model.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"model.schema.js","sourceRoot":"","sources":["../../../../../libs/mongoose/src/helper/model/model.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,iDAAuD;AACvD,mCAA4B;AAGrB,IAAM,aAAa,GAAnB,MAAM,aAAa;CAqBzB,CAAA;AArBY,sCAAa;AAEf;IADN,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDAC9B;AAGnB;IADN,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDAC7B;AAGpB;IADN,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;iDAC9B;AAGpB;IADN,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;8BACrC,IAAI;iDAAC;AAGjB;IADN,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;8BACrC,IAAI;iDAAC;AAGjB;IADN,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACf;AAGjB;IADN,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,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
|
+
_rawUpdate?: boolean;
|
|
4
|
+
_updateType?: string;
|
|
5
|
+
_hardDelete?: boolean;
|
|
6
|
+
_search?: {
|
|
7
|
+
_searchWord?: string;
|
|
8
|
+
_searchChar?: string;
|
|
9
|
+
_searchCharFields?: string[];
|
|
10
|
+
};
|
|
11
|
+
_skip?: number;
|
|
12
|
+
_limit?: number;
|
|
13
|
+
_lookup?: object;
|
|
14
|
+
_unwind?: {
|
|
15
|
+
unwind: string;
|
|
16
|
+
unwindPreserve: boolean;
|
|
17
|
+
}[];
|
|
18
|
+
_sort?: object;
|
|
19
|
+
_group?: object[];
|
|
20
|
+
_unset?: string[];
|
|
21
|
+
_project?: string[];
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.type.js","sourceRoot":"","sources":["../../../../../../libs/mongoose/src/helper/query/engine/engine.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ICriteria } from '../engine.type';
|
|
2
|
+
interface IQueryGroup {
|
|
3
|
+
criteria: ICriteria;
|
|
4
|
+
}
|
|
5
|
+
export declare const queryGroup: ({ criteria }: IQueryGroup) => {
|
|
6
|
+
[x: string]: {
|
|
7
|
+
length: number;
|
|
8
|
+
toString(): string;
|
|
9
|
+
toLocaleString(): string;
|
|
10
|
+
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
11
|
+
pop(): object;
|
|
12
|
+
push(...items: object[]): number;
|
|
13
|
+
concat(...items: ConcatArray<object>[]): object[];
|
|
14
|
+
concat(...items: (object | ConcatArray<object>)[]): object[];
|
|
15
|
+
join(separator?: string): string;
|
|
16
|
+
reverse(): object[];
|
|
17
|
+
shift(): object;
|
|
18
|
+
slice(start?: number, end?: number): object[];
|
|
19
|
+
sort(compareFn?: (a: object, b: object) => number): object[];
|
|
20
|
+
splice(start: number, deleteCount?: number): object[];
|
|
21
|
+
splice(start: number, deleteCount: number, ...items: object[]): object[];
|
|
22
|
+
unshift(...items: object[]): number;
|
|
23
|
+
indexOf(searchElement: object, fromIndex?: number): number;
|
|
24
|
+
lastIndexOf(searchElement: object, fromIndex?: number): number;
|
|
25
|
+
every<S extends object>(predicate: (value: object, index: number, array: object[]) => value is S, thisArg?: any): this is S[];
|
|
26
|
+
every(predicate: (value: object, index: number, array: object[]) => unknown, thisArg?: any): boolean;
|
|
27
|
+
some(predicate: (value: object, index: number, array: object[]) => unknown, thisArg?: any): boolean;
|
|
28
|
+
forEach(callbackfn: (value: object, index: number, array: object[]) => void, thisArg?: any): void;
|
|
29
|
+
map<U>(callbackfn: (value: object, index: number, array: object[]) => U, thisArg?: any): U[];
|
|
30
|
+
filter<S extends object>(predicate: (value: object, index: number, array: object[]) => value is S, thisArg?: any): S[];
|
|
31
|
+
filter(predicate: (value: object, index: number, array: object[]) => unknown, thisArg?: any): object[];
|
|
32
|
+
reduce(callbackfn: (previousValue: object, currentValue: object, currentIndex: number, array: object[]) => object): object;
|
|
33
|
+
reduce(callbackfn: (previousValue: object, currentValue: object, currentIndex: number, array: object[]) => object, initialValue: object): object;
|
|
34
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: object, currentIndex: number, array: object[]) => U, initialValue: U): U;
|
|
35
|
+
reduceRight(callbackfn: (previousValue: object, currentValue: object, currentIndex: number, array: object[]) => object): object;
|
|
36
|
+
reduceRight(callbackfn: (previousValue: object, currentValue: object, currentIndex: number, array: object[]) => object, initialValue: object): object;
|
|
37
|
+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: object, currentIndex: number, array: object[]) => U, initialValue: U): U;
|
|
38
|
+
find<S extends object>(predicate: (value: object, index: number, obj: object[]) => value is S, thisArg?: any): S;
|
|
39
|
+
find(predicate: (value: object, index: number, obj: object[]) => unknown, thisArg?: any): object;
|
|
40
|
+
findIndex(predicate: (value: object, index: number, obj: object[]) => unknown, thisArg?: any): number;
|
|
41
|
+
fill(value: object, start?: number, end?: number): object[];
|
|
42
|
+
copyWithin(target: number, start: number, end?: number): object[];
|
|
43
|
+
entries(): ArrayIterator<[number, object]>;
|
|
44
|
+
keys(): ArrayIterator<number>;
|
|
45
|
+
values(): ArrayIterator<object>;
|
|
46
|
+
includes(searchElement: object, fromIndex?: number): boolean;
|
|
47
|
+
flatMap<U, This = undefined>(callback: (this: This, value: object, index: number, array: object[]) => U | readonly U[], thisArg?: This): U[];
|
|
48
|
+
flat<A, D extends number = 1>(this: A, depth?: D): FlatArray<A, D>[];
|
|
49
|
+
[Symbol.iterator](): ArrayIterator<object>;
|
|
50
|
+
[Symbol.unscopables]: {
|
|
51
|
+
[x: number]: boolean;
|
|
52
|
+
length?: boolean;
|
|
53
|
+
toString?: boolean;
|
|
54
|
+
toLocaleString?: boolean;
|
|
55
|
+
pop?: boolean;
|
|
56
|
+
push?: boolean;
|
|
57
|
+
concat?: boolean;
|
|
58
|
+
join?: boolean;
|
|
59
|
+
reverse?: boolean;
|
|
60
|
+
shift?: boolean;
|
|
61
|
+
slice?: boolean;
|
|
62
|
+
sort?: boolean;
|
|
63
|
+
splice?: boolean;
|
|
64
|
+
unshift?: boolean;
|
|
65
|
+
indexOf?: boolean;
|
|
66
|
+
lastIndexOf?: boolean;
|
|
67
|
+
every?: boolean;
|
|
68
|
+
some?: boolean;
|
|
69
|
+
forEach?: boolean;
|
|
70
|
+
map?: boolean;
|
|
71
|
+
filter?: boolean;
|
|
72
|
+
reduce?: boolean;
|
|
73
|
+
reduceRight?: boolean;
|
|
74
|
+
find?: boolean;
|
|
75
|
+
findIndex?: boolean;
|
|
76
|
+
fill?: boolean;
|
|
77
|
+
copyWithin?: boolean;
|
|
78
|
+
entries?: boolean;
|
|
79
|
+
keys?: boolean;
|
|
80
|
+
values?: boolean;
|
|
81
|
+
includes?: boolean;
|
|
82
|
+
flatMap?: boolean;
|
|
83
|
+
flat?: boolean;
|
|
84
|
+
[Symbol.iterator]?: boolean;
|
|
85
|
+
readonly [Symbol.unscopables]?: boolean;
|
|
86
|
+
at?: boolean;
|
|
87
|
+
};
|
|
88
|
+
at(index: number): object;
|
|
89
|
+
_id: string;
|
|
90
|
+
};
|
|
91
|
+
}[];
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryGroup = void 0;
|
|
4
|
+
const query_expression_1 = require("../../query.expression");
|
|
5
|
+
const query_method_1 = require("../../query.method");
|
|
6
|
+
;
|
|
7
|
+
const queryGroup = ({ criteria }) => {
|
|
8
|
+
if (!(0, query_method_1.objKeyLengthCheck)(criteria?._group))
|
|
9
|
+
return [];
|
|
10
|
+
const group = { _id: "$_id", ...criteria._group };
|
|
11
|
+
return [{ [query_expression_1.default.STAGE_GROUP]: group }];
|
|
12
|
+
};
|
|
13
|
+
exports.queryGroup = queryGroup;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/mongoose/src/helper/query/engine/group/index.ts"],"names":[],"mappings":";;;AAAA,6DAAuC;AAEvC,qDAAuD;AAItD,CAAC;AAEK,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAe,EAAE,EAAE;IACpD,IAAI,CAAC,IAAA,gCAAiB,EAAC,QAAQ,EAAE,MAAM,CAAC;QACpC,OAAO,EAAE,CAAC;IAEd,MAAM,KAAK,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;IAClD,OAAO,CAAC,EAAE,CAAC,0BAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB"}
|
|
@@ -4,5 +4,5 @@ export declare const QueryEngine: ({ ConfigSystem, CollectionRef, GroupRef }: {
|
|
|
4
4
|
GroupRef: any;
|
|
5
5
|
}) => {
|
|
6
6
|
queryAggregate: (props: any) => any[];
|
|
7
|
-
queryUpdate: (props: any) => import("
|
|
7
|
+
queryUpdate: (props: any) => import("..").TRemoveUndefinedObject;
|
|
8
8
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryEngine = void 0;
|
|
4
|
+
const query_expression_1 = require("../query.expression");
|
|
5
|
+
const group_1 = require("./group");
|
|
6
|
+
const match_1 = require("./match");
|
|
7
|
+
const skip_1 = require("./skip");
|
|
8
|
+
const limit_1 = require("./limit");
|
|
9
|
+
const lookup_1 = require("./lookup");
|
|
10
|
+
const unwind_1 = require("./unwind");
|
|
11
|
+
const unset_1 = require("./unset");
|
|
12
|
+
const project_1 = require("./project");
|
|
13
|
+
const sort_1 = require("./sort");
|
|
14
|
+
const query_method_1 = require("../query.method");
|
|
15
|
+
const QueryEngine = ({ ConfigSystem, CollectionRef, GroupRef }) => {
|
|
16
|
+
const _defaultLang = ConfigSystem.LANG_DEFAULT;
|
|
17
|
+
const _collectionRef = (0, query_method_1.getFlattenCollectionRef)(CollectionRef);
|
|
18
|
+
const _groupRef = GroupRef;
|
|
19
|
+
const queryAggregate = (props) => {
|
|
20
|
+
const { condAnd = [], condByField = {}, condByQuery = [], criteria = {}, } = props;
|
|
21
|
+
const match = (0, match_1.queryMatch)({ _defaultLang, condAnd, condByField, condByQuery, criteria });
|
|
22
|
+
const skip = (0, skip_1.querySkip)({ criteria });
|
|
23
|
+
const limit = (0, limit_1.queryLimit)({ criteria });
|
|
24
|
+
const lookup = (0, lookup_1.queryLookup)({ _collectionRef, _groupRef, condAnd, criteria });
|
|
25
|
+
const unwind = (0, unwind_1.queryUnwind)({ criteria });
|
|
26
|
+
const group = (0, group_1.queryGroup)({ criteria });
|
|
27
|
+
const unset = (0, unset_1.queryUnset)({ criteria });
|
|
28
|
+
const project = (0, project_1.queryProject)({ criteria });
|
|
29
|
+
const sort = (0, sort_1.querySort)({ criteria });
|
|
30
|
+
return [].concat(match, skip, limit, lookup, unwind, unset, group, project, sort);
|
|
31
|
+
};
|
|
32
|
+
const queryUpdate = (props) => {
|
|
33
|
+
const { condAnd = [], condByField, criteria } = props;
|
|
34
|
+
return (0, query_method_1.removeUndefined)(condByField, {
|
|
35
|
+
ifEmpty: "500 -> Condition required",
|
|
36
|
+
isCallBackRequired: !criteria?._rawUpdate,
|
|
37
|
+
callback: (condByField) => {
|
|
38
|
+
return (0, match_1.queryMatch)({
|
|
39
|
+
_defaultLang,
|
|
40
|
+
condAnd,
|
|
41
|
+
condByField,
|
|
42
|
+
criteria,
|
|
43
|
+
})[0][query_expression_1.default.STAGE_FACET]["AL"][0][query_expression_1.default.STAGE_MATCH];
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
queryAggregate,
|
|
49
|
+
queryUpdate,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.QueryEngine = QueryEngine;
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/mongoose/src/helper/query/engine/index.ts"],"names":[],"mappings":";;;AAAA,0DAAoC;AACpC,mCAAsC;AACtC,mCAAsC;AACtC,iCAAoC;AACpC,mCAAsC;AACtC,qCAAwC;AACxC,qCAAwC;AACxC,mCAAsC;AACtC,uCAA0C;AAC1C,iCAAoC;AACpC,kDAGyB;AAElB,MAAM,WAAW,GAAG,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAE;IACrE,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC;IAC/C,MAAM,cAAc,GAAG,IAAA,sCAAuB,EAAC,aAAa,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,QAAQ,CAAC;IAO3B,MAAM,cAAc,GAAG,CAAC,KAAK,EAA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,EAAC,WAAW,EAAE;YAChC,OAAO,EAAE,2BAA2B;YACpC,kBAAkB,EAAE,CAAC,QAAQ,EAAE,UAAU;YACzC,QAAQ,EAAE,CAAC,WAAW,EAAE,EAAE;gBACtB,OAAO,IAAA,kBAAU,EAAC;oBACd,YAAY;oBACZ,OAAO;oBACP,WAAW;oBACX,QAAQ;iBACX,CAAC,CAAC,CAAC,CAAC,CAAC,0BAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,0BAAC,CAAC,WAAW,CAAC,CAAC;YACjD,CAAC;SACJ,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO;QACH,cAAc;QACd,WAAW;KACd,CAAC;AACN,CAAC,CAAC;AA/DW,QAAA,WAAW,eA+DtB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryLimit = void 0;
|
|
4
|
+
const query_expression_1 = require("../../query.expression");
|
|
5
|
+
;
|
|
6
|
+
const queryLimit = ({ criteria }) => criteria?._limit > 0 ?
|
|
7
|
+
[{ [query_expression_1.default.STAGE_LIMIT]: criteria._limit }] : [];
|
|
8
|
+
exports.queryLimit = queryLimit;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/mongoose/src/helper/query/engine/limit/index.ts"],"names":[],"mappings":";;;AAAA,6DAAuC;AAKtC,CAAC;AAEK,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAe,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3E,CAAC,EAAE,CAAC,0BAAC,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AADnC,QAAA,UAAU,cACyB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryLookup = void 0;
|
|
4
|
+
const query_expression_1 = require("../../query.expression");
|
|
5
|
+
const match_1 = require("../match");
|
|
6
|
+
const sort_1 = require("../sort");
|
|
7
|
+
const lookup_pipe_1 = require("./lookup.pipe");
|
|
8
|
+
const queryLookup = ({ _collectionRef, _groupRef, condAnd, criteria }) => {
|
|
9
|
+
const { _lookup } = criteria ?? {};
|
|
10
|
+
const lookupQuery = [];
|
|
11
|
+
if (_lookup?.length > 0) {
|
|
12
|
+
_lookup.map(field => {
|
|
13
|
+
const { _lookupRef } = _collectionRef;
|
|
14
|
+
const lookupRef = _lookupRef[field];
|
|
15
|
+
if (!lookupRef)
|
|
16
|
+
return null;
|
|
17
|
+
const { collection, as, constraint } = lookupRef;
|
|
18
|
+
const { preUnwind, pipelineConditions, pipelineSort, postUnwind, merge, group, sort, } = constraint ?? {};
|
|
19
|
+
lookupQuery.push(...(0, lookup_pipe_1.queryLookup_unwind)(preUnwind));
|
|
20
|
+
const { localVaribales, matchConditions, } = (0, lookup_pipe_1.queryLookup_getValues)(pipelineConditions);
|
|
21
|
+
const matchQuery = (0, match_1.queryMatch)({
|
|
22
|
+
condAnd: [condAnd.find(e => e.key == "language")],
|
|
23
|
+
condByQuery: matchConditions,
|
|
24
|
+
});
|
|
25
|
+
lookupQuery.push({
|
|
26
|
+
[query_expression_1.default.STAGE_LOOKUP]: {
|
|
27
|
+
from: collection,
|
|
28
|
+
let: localVaribales,
|
|
29
|
+
pipeline: [
|
|
30
|
+
...matchQuery,
|
|
31
|
+
...(0, sort_1.querySort)({ criteria: { _sort: pipelineSort } }),
|
|
32
|
+
],
|
|
33
|
+
as: as
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
lookupQuery.push(...(0, lookup_pipe_1.queryLookup_unwind)(postUnwind));
|
|
37
|
+
lookupQuery.push(...(0, lookup_pipe_1.queryLookup_merge)(merge));
|
|
38
|
+
lookupQuery.push(...(0, lookup_pipe_1.queryLookup_group)(_groupRef, group));
|
|
39
|
+
lookupQuery.push(...(0, sort_1.querySort)({ criteria: { _sort: sort } }));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
;
|
|
43
|
+
return lookupQuery;
|
|
44
|
+
};
|
|
45
|
+
exports.queryLookup = queryLookup;
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/mongoose/src/helper/query/engine/lookup/index.ts"],"names":[],"mappings":";;;AAAA,6DAAuC;AACvC,oCAAsC;AACtC,kCAAoC;AACpC,+CAKuB;AAGhB,MAAM,WAAW,GAAG,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC5E,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAC;IACnC,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAChB,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC;YACtC,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC;YAE5B,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;YACjD,MAAM,EACF,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,KAAK,EACL,KAAK,EACL,IAAI,GACP,GAAG,UAAU,IAAI,EAAE,CAAC;YAGrB,WAAW,CAAC,IAAI,CAAC,GAAG,IAAA,gCAAkB,EAAC,SAAS,CAAC,CAAC,CAAC;YAEnD,MAAM,EAAE,cAAc,EAAE,eAAe,GAAG,GAAG,IAAA,mCAAqB,EAAC,kBAAkB,CAAC,CAAC;YACvF,MAAM,UAAU,GAAG,IAAA,kBAAU,EAAC;gBAC1B,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;gBACjD,WAAW,EAAE,eAAe;aAC/B,CAAC,CAAC;YAEH,WAAW,CAAC,IAAI,CAAC;gBACb,CAAC,0BAAC,CAAC,YAAY,CAAC,EAAE;oBACd,IAAI,EAAE,UAAU;oBAChB,GAAG,EAAE,cAAc;oBACnB,QAAQ,EAAE;wBACN,GAAG,UAAU;wBACb,GAAG,IAAA,gBAAS,EAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CAAC;qBACtD;oBACD,EAAE,EAAE,EAAE;iBACT;aACJ,CAAC,CAAC;YAEH,WAAW,CAAC,IAAI,CAAC,GAAG,IAAA,gCAAkB,EAAC,UAAU,CAAC,CAAC,CAAC;YAEpD,WAAW,CAAC,IAAI,CAAC,GAAG,IAAA,+BAAiB,EAAC,KAAK,CAAC,CAAC,CAAC;YAE9C,WAAW,CAAC,IAAI,CAAC,GAAG,IAAA,+BAAiB,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;YAEzD,WAAW,CAAC,IAAI,CAAC,GAAG,IAAA,gBAAS,EAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IACF,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAnDW,QAAA,WAAW,eAmDtB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const queryLookup_unwind: (unwind: any[]) => any[];
|
|
2
|
+
export declare const queryLookup_merge: (mergeObject: any[]) => any[];
|
|
3
|
+
export declare const queryLookup_group: (_groupRef: any, group: any[]) => any[];
|
|
4
|
+
export declare const queryLoopup_matchCondition: (localFieldRefPath: any, foreignFieldPath: any, condition: any) => any;
|
|
5
|
+
export declare const queryLookup_getValues: (conditions: any) => {
|
|
6
|
+
localVaribales: Record<string, string>;
|
|
7
|
+
matchConditions: any;
|
|
8
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryLookup_getValues = exports.queryLoopup_matchCondition = exports.queryLookup_group = exports.queryLookup_merge = exports.queryLookup_unwind = void 0;
|
|
4
|
+
const query_expression_1 = require("../../query.expression");
|
|
5
|
+
const query_method_1 = require("../../query.method");
|
|
6
|
+
const queryLookup_unwind = (unwind) => {
|
|
7
|
+
const query = [];
|
|
8
|
+
if (unwind?.length > 0) {
|
|
9
|
+
unwind.forEach(e => {
|
|
10
|
+
if (e.unwind)
|
|
11
|
+
query.push({
|
|
12
|
+
[query_expression_1.default.STAGE_UNWIND]: {
|
|
13
|
+
"path": `$${e.unwind}`,
|
|
14
|
+
"preserveNullAndEmptyArrays": e.unwindPreserve ?? false
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
if (e.sort)
|
|
18
|
+
query.push({ [query_expression_1.default.STAGE_SORT]: e.sort });
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
return query;
|
|
23
|
+
};
|
|
24
|
+
exports.queryLookup_unwind = queryLookup_unwind;
|
|
25
|
+
const queryLookup_merge = (mergeObject) => {
|
|
26
|
+
const query = [];
|
|
27
|
+
if (mergeObject?.length > 0) {
|
|
28
|
+
mergeObject.forEach(e => {
|
|
29
|
+
query.push({
|
|
30
|
+
[query_expression_1.default.ADDFIELD]: {
|
|
31
|
+
[e.as]: {
|
|
32
|
+
[query_expression_1.default.MERGEOBJECTS]: e.paths,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
;
|
|
39
|
+
return query;
|
|
40
|
+
};
|
|
41
|
+
exports.queryLookup_merge = queryLookup_merge;
|
|
42
|
+
const queryLookup_group = (_groupRef, group) => {
|
|
43
|
+
const query = [];
|
|
44
|
+
if (group?.length > 0) {
|
|
45
|
+
group.forEach(e => {
|
|
46
|
+
const { id, groupKey, key, value, move } = e ?? {};
|
|
47
|
+
if (!groupKey || !key)
|
|
48
|
+
return;
|
|
49
|
+
const _id = id ?? "$_id";
|
|
50
|
+
const queryGroup = {
|
|
51
|
+
[query_expression_1.default.STAGE_GROUP]: {
|
|
52
|
+
..._groupRef[groupKey],
|
|
53
|
+
[key]: {
|
|
54
|
+
[query_expression_1.default.EXPR_PUSH]: {
|
|
55
|
+
[query_expression_1.default.EXPR_COND]: [
|
|
56
|
+
{ $ne: [`$${value}`, {}] },
|
|
57
|
+
`$${value}`,
|
|
58
|
+
"$$REMOVE"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
_id: _id,
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
query.push(queryGroup);
|
|
66
|
+
if (!move)
|
|
67
|
+
return;
|
|
68
|
+
move.forEach(e => {
|
|
69
|
+
const { from, to } = e ?? {};
|
|
70
|
+
if (!from || !from)
|
|
71
|
+
return;
|
|
72
|
+
const moveQuery = {
|
|
73
|
+
$addFields: { [to]: `$${from}` },
|
|
74
|
+
};
|
|
75
|
+
query.push(moveQuery);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
;
|
|
80
|
+
return query;
|
|
81
|
+
};
|
|
82
|
+
exports.queryLookup_group = queryLookup_group;
|
|
83
|
+
const queryLoopup_matchCondition = (localFieldRefPath, foreignFieldPath, condition) => {
|
|
84
|
+
const localField = `$$${localFieldRefPath}`;
|
|
85
|
+
const foreignField = `$${foreignFieldPath}`;
|
|
86
|
+
const sizeIntersection = (a, b) => ({ [query_expression_1.default.EXPR_SIZE]: { [query_expression_1.default.EXPR_SET_INTERSECTION]: [a, b] } });
|
|
87
|
+
const CONDITIONS = {
|
|
88
|
+
EQ: { [query_expression_1.default.EXPR_EQ]: [foreignField, localField] },
|
|
89
|
+
ARRAY_LT: { [query_expression_1.default.EXPR_IN]: [foreignField, localField] },
|
|
90
|
+
ARRAY_RT: { [query_expression_1.default.EXPR_IN]: [localField, foreignField] },
|
|
91
|
+
ARRAY_BO_ONE_EQ_BO: {
|
|
92
|
+
[query_expression_1.default.EXPR_GT]: [sizeIntersection(foreignField, localField), 0]
|
|
93
|
+
},
|
|
94
|
+
ARRAY_BO_ALL_EQ_LT: {
|
|
95
|
+
[query_expression_1.default.EXPR_EQ]: [sizeIntersection(foreignField, localField), { $size: foreignField }]
|
|
96
|
+
},
|
|
97
|
+
ARRAY_BO_ALL_EQ_RT: {
|
|
98
|
+
[query_expression_1.default.EXPR_EQ]: [sizeIntersection(foreignField, localField), { $size: localField }]
|
|
99
|
+
},
|
|
100
|
+
ARRAY_LT_WITH_CHECK: {
|
|
101
|
+
[query_expression_1.default.EXPR_IN]: [foreignField, (0, query_method_1.returnArray)(localField)]
|
|
102
|
+
},
|
|
103
|
+
ARRAY_RT_WITH_CHECK: {
|
|
104
|
+
[query_expression_1.default.EXPR_IN]: [foreignField, (0, query_method_1.returnArray)(foreignField)]
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
const __MAP_COND__ = CONDITIONS[condition] ?? { [query_expression_1.default.EXPR_EQ]: [foreignField, localField] };
|
|
108
|
+
return __MAP_COND__;
|
|
109
|
+
};
|
|
110
|
+
exports.queryLoopup_matchCondition = queryLoopup_matchCondition;
|
|
111
|
+
const queryLookup_getValues = (conditions) => {
|
|
112
|
+
const localVaribales = {};
|
|
113
|
+
const matchConditions = conditions.map((condition) => {
|
|
114
|
+
localVaribales[condition.localFieldRefPath] = `$${condition.localFieldPath}`;
|
|
115
|
+
return (0, exports.queryLoopup_matchCondition)(condition.localFieldRefPath, condition.foreignFieldPath, condition.type);
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
localVaribales,
|
|
119
|
+
matchConditions,
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
exports.queryLookup_getValues = queryLookup_getValues;
|
|
123
|
+
//# sourceMappingURL=lookup.pipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.pipe.js","sourceRoot":"","sources":["../../../../../../../libs/mongoose/src/helper/query/engine/lookup/lookup.pipe.ts"],"names":[],"mappings":";;;AAAA,6DAAuC;AACvC,qDAAiD;AAE1C,MAAM,kBAAkB,GAAG,CAAC,MAAa,EAAE,EAAE;IAChD,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,IAAI,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACf,IAAI,CAAC,CAAC,MAAM;gBACR,KAAK,CAAC,IAAI,CAAC;oBACP,CAAC,0BAAC,CAAC,YAAY,CAAC,EAAE;wBACd,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE;wBACtB,4BAA4B,EAAE,CAAC,CAAC,cAAc,IAAI,KAAK;qBAC1D;iBACJ,CAAC,CAAC;YACP,IAAI,CAAC,CAAC,IAAI;gBACN,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,0BAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IACF,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAhBW,QAAA,kBAAkB,sBAgB7B;AAEK,MAAM,iBAAiB,GAAG,CAAC,WAAkB,EAAE,EAAE;IACpD,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,IAAI,WAAW,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,WAAW,CAAC,OAAO,CAAC,CAAC,CA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AAC,IAAI,CACjB,CAAC;IACN,CAAC,CAAC,CAAC;IACH,OAAO;QACH,cAAc;QACd,eAAe;KAClB,CAAA;AACL,CAAC,CAAC;AAhBW,QAAA,qBAAqB,yBAgBhC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const queryMatch: (props: any) => ({
|
|
2
|
+
[x: string]: {
|
|
3
|
+
$or: any[];
|
|
4
|
+
};
|
|
5
|
+
} | {
|
|
6
|
+
[x: string]: {
|
|
7
|
+
[x: string]: {
|
|
8
|
+
[x: string]: any[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
})[] | ({
|
|
12
|
+
[x: string]: {
|
|
13
|
+
$or: any[];
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
[x: string]: {
|
|
17
|
+
DL: {
|
|
18
|
+
[x: string]: {
|
|
19
|
+
[x: string]: {
|
|
20
|
+
[x: string]: any[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
AL: {
|
|
25
|
+
[x: string]: {
|
|
26
|
+
[x: string]: {
|
|
27
|
+
[x: string]: any[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
[x: string]: {
|
|
34
|
+
doc: {
|
|
35
|
+
[x: string]: {
|
|
36
|
+
[x: string]: string | {
|
|
37
|
+
[x: string]: (string | {
|
|
38
|
+
[x: string]: (number | {
|
|
39
|
+
[x: string]: {
|
|
40
|
+
[x: string]: string | {
|
|
41
|
+
[x: string]: string[];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
})[];
|
|
45
|
+
})[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
[x: string]: string;
|
|
52
|
+
} | {
|
|
53
|
+
[x: string]: {
|
|
54
|
+
[x: string]: string;
|
|
55
|
+
};
|
|
56
|
+
})[];
|