@classytic/mongokit 3.1.5 → 3.1.6
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/index.d.ts +5 -1
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -777,6 +777,7 @@ declare class Repository<TDoc = AnyDocument> {
|
|
|
777
777
|
getById(id: string | ObjectId, options?: {
|
|
778
778
|
select?: SelectSpec;
|
|
779
779
|
populate?: PopulateSpec;
|
|
780
|
+
populateOptions?: PopulateOptions[];
|
|
780
781
|
lean?: boolean;
|
|
781
782
|
session?: ClientSession;
|
|
782
783
|
throwOnNotFound?: boolean;
|
|
@@ -789,6 +790,7 @@ declare class Repository<TDoc = AnyDocument> {
|
|
|
789
790
|
getByQuery(query: Record<string, unknown>, options?: {
|
|
790
791
|
select?: SelectSpec;
|
|
791
792
|
populate?: PopulateSpec;
|
|
793
|
+
populateOptions?: PopulateOptions[];
|
|
792
794
|
lean?: boolean;
|
|
793
795
|
session?: ClientSession;
|
|
794
796
|
throwOnNotFound?: boolean;
|
|
@@ -830,6 +832,8 @@ declare class Repository<TDoc = AnyDocument> {
|
|
|
830
832
|
};
|
|
831
833
|
limit?: number;
|
|
832
834
|
search?: string;
|
|
835
|
+
/** Advanced populate options (from QueryParser or Arc's BaseController) */
|
|
836
|
+
populateOptions?: PopulateOptions[];
|
|
833
837
|
}, options?: {
|
|
834
838
|
select?: SelectSpec;
|
|
835
839
|
populate?: PopulateSpec;
|
|
@@ -1310,4 +1314,4 @@ declare class QueryParser {
|
|
|
1310
1314
|
*/
|
|
1311
1315
|
declare function createRepository<TDoc>(Model: mongoose.Model<TDoc, any, any, any>, plugins?: PluginType[], paginationConfig?: PaginationConfig, options?: RepositoryOptions): Repository<TDoc>;
|
|
1312
1316
|
|
|
1313
|
-
export { AggregatePaginationResult, AggregationBuilder, AnyDocument, type FilterQuery, HttpError, type IController, type IControllerResponse, type IRequestContext, type IResponseFormatter, KeysetPaginationResult, LookupBuilder, LookupOptions, ObjectId, OffsetPaginationResult, PaginationConfig, PaginationEngine, PaginationResult, type ParsedQuery, PluginType, PopulateSpec, QueryParser, type QueryParserOptions, Repository, RepositoryContext, RepositoryOptions, type SearchMode, SelectSpec, SortSpec$2 as SortSpec, UpdateOptions, WithTransactionOptions, createRepository, Repository as default };
|
|
1317
|
+
export { AggregatePaginationResult, AggregationBuilder, AnyDocument, type FilterQuery, HttpError, type IController, type IControllerResponse, type IRequestContext, type IResponseFormatter, KeysetPaginationResult, LookupBuilder, LookupOptions, ObjectId, OffsetPaginationResult, PaginationConfig, PaginationEngine, PaginationResult, type ParsedQuery, PluginType, type PopulateOption, PopulateSpec, QueryParser, type QueryParserOptions, Repository, RepositoryContext, RepositoryOptions, type SearchMode, SelectSpec, SortSpec$2 as SortSpec, UpdateOptions, WithTransactionOptions, createRepository, Repository as default };
|
package/dist/index.js
CHANGED
|
@@ -756,7 +756,8 @@ var Repository = class {
|
|
|
756
756
|
* Get document by ID
|
|
757
757
|
*/
|
|
758
758
|
async getById(id, options = {}) {
|
|
759
|
-
const
|
|
759
|
+
const populateSpec = options.populateOptions || options.populate;
|
|
760
|
+
const context = await this._buildContext("getById", { id, ...options, populate: populateSpec });
|
|
760
761
|
if (context._cacheHit) {
|
|
761
762
|
return context._cachedResult;
|
|
762
763
|
}
|
|
@@ -768,7 +769,8 @@ var Repository = class {
|
|
|
768
769
|
* Get single document by query
|
|
769
770
|
*/
|
|
770
771
|
async getByQuery(query, options = {}) {
|
|
771
|
-
const
|
|
772
|
+
const populateSpec = options.populateOptions || options.populate;
|
|
773
|
+
const context = await this._buildContext("getByQuery", { query, ...options, populate: populateSpec });
|
|
772
774
|
if (context._cacheHit) {
|
|
773
775
|
return context._cachedResult;
|
|
774
776
|
}
|
|
@@ -815,7 +817,7 @@ var Repository = class {
|
|
|
815
817
|
const limit = params.limit || params.pagination?.limit || this._pagination.config.defaultLimit;
|
|
816
818
|
let query = { ...filters };
|
|
817
819
|
if (search) query.$text = { $search: search };
|
|
818
|
-
const populateSpec = options.populateOptions || context.populate || options.populate;
|
|
820
|
+
const populateSpec = options.populateOptions || params.populateOptions || context.populate || options.populate;
|
|
819
821
|
const paginationOptions = {
|
|
820
822
|
filters: query,
|
|
821
823
|
sort: this._parseSort(sort),
|
package/package.json
CHANGED