@ptc-org/nestjs-query-mongoose 2.0.0-alpha.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +6 -7
- package/src/mongoose-types.helper.d.ts +5 -5
- package/src/providers.d.ts +1 -1
- package/src/query/aggregate.builder.d.ts +3 -3
- package/src/query/comparison.builder.d.ts +1 -1
- package/src/query/comparison.builder.js +1 -1
- package/src/query/comparison.builder.js.map +1 -1
- package/src/query/filter-query.builder.d.ts +3 -3
- package/src/query/index.js +4 -4
- package/src/query/index.js.map +1 -1
- package/src/services/index.js +1 -1
- package/src/services/index.js.map +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.org/package/@nestjs-query/query-mongoose)
|
|
6
6
|
[](https://github.com/tripss/nestjs-query/actions?query=workflow%3ATest+and+branch%3Amaster+)
|
|
7
|
-
[](https://codecov.io/gh/TriPSs/nestjs-query)
|
|
8
8
|
[](https://snyk.io/test/github/tripss/nestjs-query?targetFile=packages/query-mongoose/package.json)
|
|
9
9
|
|
|
10
10
|
# `@nestjs-query/query-mongoose`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ptc-org/nestjs-query-mongoose",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Mongoose adapter for @ptc-org/nestjs-query-core",
|
|
5
5
|
"author": "doug-martin <doug@dougamartin.com>",
|
|
6
6
|
"homepage": "https://github.com/tripss/nestjs-query#readme",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"tslib": "^2.4.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@nestjs/common": "^8.0.
|
|
27
|
+
"@nestjs/common": "^8.0.0 || ^9.0.0",
|
|
28
28
|
"@nestjs/mongoose": "^8.0.0 || ^9.0.0",
|
|
29
|
-
"mongoose": "^5.
|
|
30
|
-
"@ptc-org/nestjs-query-core": "2.0.0
|
|
31
|
-
"reflect-metadata": "
|
|
29
|
+
"mongoose": "^6.5.0",
|
|
30
|
+
"@ptc-org/nestjs-query-core": "2.0.0",
|
|
31
|
+
"reflect-metadata": "0.1.13"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
@@ -37,6 +37,5 @@
|
|
|
37
37
|
},
|
|
38
38
|
"bugs": {
|
|
39
39
|
"url": "https://github.com/tripss/nestjs-query/issues"
|
|
40
|
-
}
|
|
41
|
-
"typings": "./src/index.d.ts"
|
|
40
|
+
}
|
|
42
41
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { SchemaType } from 'mongoose';
|
|
2
|
-
export
|
|
2
|
+
export type ReferenceOptions = {
|
|
3
3
|
type: SchemaType;
|
|
4
4
|
ref: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function isReferenceOptions(options: unknown): options is ReferenceOptions;
|
|
7
|
-
export
|
|
7
|
+
export type SchemaTypeWithReferenceOptions = {
|
|
8
8
|
options: ReferenceOptions;
|
|
9
9
|
};
|
|
10
10
|
export declare function isSchemaTypeWithReferenceOptions(type: unknown): type is SchemaTypeWithReferenceOptions;
|
|
11
|
-
export
|
|
11
|
+
export type EmbeddedSchemaTypeOptions = {
|
|
12
12
|
$embeddedSchemaType: {
|
|
13
13
|
options: ReferenceOptions;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
export declare function isEmbeddedSchemaTypeOptions(options: unknown): options is EmbeddedSchemaTypeOptions;
|
|
17
|
-
export
|
|
17
|
+
export type VirtualReferenceOptions = {
|
|
18
18
|
ref: string;
|
|
19
19
|
localField: string;
|
|
20
20
|
foreignField: string;
|
|
21
21
|
};
|
|
22
22
|
export declare function isVirtualReferenceOptions(options: unknown): options is VirtualReferenceOptions;
|
|
23
|
-
export
|
|
23
|
+
export type VirtualTypeWithOptions = {
|
|
24
24
|
options: VirtualReferenceOptions;
|
|
25
25
|
};
|
|
26
26
|
export declare function isVirtualTypeWithReferenceOptions(virtualType: unknown): virtualType is VirtualTypeWithOptions;
|
package/src/providers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FactoryProvider } from '@nestjs/common';
|
|
|
2
2
|
import { ModelDefinition } from '@nestjs/mongoose';
|
|
3
3
|
import { Class } from '@ptc-org/nestjs-query-core';
|
|
4
4
|
import { Document } from 'mongoose';
|
|
5
|
-
export
|
|
5
|
+
export type NestjsQueryModelDefinition<Entity extends Document> = {
|
|
6
6
|
document: Class<Entity>;
|
|
7
7
|
} & ModelDefinition;
|
|
8
8
|
export declare const createMongooseQueryServiceProviders: (models: NestjsQueryModelDefinition<Document>[]) => FactoryProvider[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AggregateQuery, AggregateResponse } from '@ptc-org/nestjs-query-core';
|
|
2
2
|
import { Document } from 'mongoose';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Aggregate = Record<string, Record<string, unknown>>;
|
|
4
|
+
type Group = {
|
|
5
5
|
_id: Record<string, string> | null;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type MongooseGroupAndAggregate = Aggregate & Group;
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
* Builds a WHERE clause from a Filter.
|
|
@@ -3,7 +3,7 @@ import { Document, FilterQuery, Model as MongooseModel } from 'mongoose';
|
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type EntityComparisonField<Entity, F extends keyof Entity> = Entity[F] | Entity[F][] | CommonFieldComparisonBetweenType<Entity[F]> | true | false | null;
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
* Builder to create SQL Comparisons. (=, !=, \>, etc...)
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ComparisonBuilder = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
|
-
const lodash_escaperegexp_1 =
|
|
6
|
+
const lodash_escaperegexp_1 = tslib_1.__importDefault(require("lodash.escaperegexp"));
|
|
7
7
|
const mongoose_1 = require("mongoose");
|
|
8
8
|
const helpers_1 = require("./helpers");
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparison.builder.js","sourceRoot":"","sources":["../../../../../packages/query-mongoose/src/query/comparison.builder.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AAEpD,
|
|
1
|
+
{"version":3,"file":"comparison.builder.js","sourceRoot":"","sources":["../../../../../packages/query-mongoose/src/query/comparison.builder.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AAEpD,sFAA8C;AAC9C,uCAAuF;AAEvF,uCAAwC;AAaxC;;;GAGG;AACH,MAAa,iBAAiB;IAc5B,YACW,KAA4B,EAC5B,gBAAwC,iBAAiB,CAAC,sBAAsB;QADhF,UAAK,GAAL,KAAK,CAAuB;QAC5B,kBAAa,GAAb,aAAa,CAAmE;IACxF,CAAC;IAEJ;;;;;;OAMG;IACH,KAAK,CACH,KAAQ,EACR,GAAyC,EACzC,GAAqC;QAErC,MAAM,SAAS,GAAG,IAAA,sBAAY,EAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAClD,MAAM,aAAa,GAAI,GAAc,CAAC,WAAW,EAAE,CAAA;QACnD,IAAI,aAAiD,CAAA;QACrD,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE;YACrC,yCAAyC;YACzC,aAAa,GAAG;gBACd,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAgB,CAAC;aAC3D,CAAA;SAC5B;QAED,IAAI,aAAa,CAAC,QA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GAAG,KAAK,QAAQ,EAAE;YACtD,IAAI,gBAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBAC/B,OAAO,IAAI,gBAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;aAC/B;SACF;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;;AA5GH,8CA6GC;AA5GQ,wCAAsB,GAA2B;IACtD,EAAE,EAAE,KAAK;IACT,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,KAAK;IACT,GAAG,EAAE,MAAM;IACX,EAAE,EAAE,KAAK;IACT,GAAG,EAAE,MAAM;IACX,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,MAAM;IACb,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,KAAK;CACb,CAAA"}
|
|
@@ -2,8 +2,8 @@ import { AggregateQuery, Filter, Query, SortField } from '@ptc-org/nestjs-query-
|
|
|
2
2
|
import { Document, FilterQuery, Model as MongooseModel } from 'mongoose';
|
|
3
3
|
import { AggregateBuilder, MongooseGroupAndAggregate } from './aggregate.builder';
|
|
4
4
|
import { WhereBuilder } from './where.builder';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type MongooseSort = Record<string, 1 | -1>;
|
|
6
|
+
type MongooseQuery<Entity extends Document> = {
|
|
7
7
|
filterQuery: FilterQuery<Entity>;
|
|
8
8
|
options: {
|
|
9
9
|
limit?: number;
|
|
@@ -11,7 +11,7 @@ declare type MongooseQuery<Entity extends Document> = {
|
|
|
11
11
|
sort?: MongooseSort;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type MongooseAggregateQuery<Entity extends Document> = MongooseQuery<Entity> & {
|
|
15
15
|
aggregate: MongooseGroupAndAggregate;
|
|
16
16
|
};
|
|
17
17
|
/**
|
package/src/query/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./aggregate.builder"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./comparison.builder"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./filter-query.builder"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./where.builder"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/src/query/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/query-mongoose/src/query/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/query-mongoose/src/query/index.ts"],"names":[],"mappings":";;;AAAA,8DAAmC;AACnC,+DAAoC;AACpC,iEAAsC;AACtC,0DAA+B"}
|
package/src/services/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./mongoose-query.service"), exports);
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/query-mongoose/src/services/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/query-mongoose/src/services/index.ts"],"names":[],"mappings":";;;AAAA,mEAAwC"}
|