@ewb/mongoose-query 1.0.2 → 1.0.3

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/lib/Query.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import mongoose from 'mongoose';
2
- import { IQueryPopulate } from './QueryModel';
3
- import { IMongooseQueryOptions } from './utils/Query.utils';
4
- import { IQueryOptions, MongooseSortSelectValue, QueryType } from './utils/types';
2
+ import { IQueryPopulate } from './QueryModel.js';
3
+ import { IMongooseQueryOptions } from './utils/Query.utils.js';
4
+ import { IQueryOptions, MongooseSortSelectValue, QueryType } from './utils/types.js';
5
5
  export declare class Query<R extends object, T extends object = object, Q extends IMongooseQueryOptions = IMongooseQueryOptions> {
6
6
  private _root;
7
7
  private _rootNext;
package/lib/Query.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import mongoSanitize from 'express-mongo-sanitize';
2
- import { mongooseQueryOptions, mongooseQueryWithOperation, } from './utils/Query.utils';
2
+ import { mongooseQueryOptions, mongooseQueryWithOperation, } from './utils/Query.utils.js';
3
3
  export class Query {
4
4
  constructor(queries) {
5
5
  this._root = null;
@@ -1,6 +1,6 @@
1
1
  import mongoose from 'mongoose';
2
- import { Query } from './Query';
3
- import { ModelSearchPopulate, QueryModel } from './QueryModel';
2
+ import { Query } from './Query.js';
3
+ import { ModelSearchPopulate, QueryModel } from './QueryModel.js';
4
4
  export interface QueryFindOpts {
5
5
  populate?: boolean;
6
6
  select?: boolean;
@@ -1,5 +1,5 @@
1
1
  import mongoose from 'mongoose';
2
- import { toValidTextRegexp, } from './QueryModel';
2
+ import { toValidTextRegexp, } from './QueryModel.js';
3
3
  export class QueryHandler {
4
4
  constructor(_model, queryModel) {
5
5
  this._model = _model;
@@ -1,5 +1,5 @@
1
1
  import mongoose from 'mongoose';
2
- import { Query } from './Query';
2
+ import { Query } from './Query.js';
3
3
  export interface ModelSearchPopulate<T extends any, K extends keyof T> {
4
4
  path: K;
5
5
  select: (T[K] extends object ? keyof T[K] : string)[];
package/lib/QueryModel.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import mongoose from 'mongoose';
2
- import { DEFAULT_LIMIT } from './utils/constants';
2
+ import { DEFAULT_LIMIT } from './utils/constants.js';
3
3
  export const toValidSelectRegexp = (select) => new RegExp(`^${String(select)}(\..|$)`);
4
4
  export const toValidSortRegexp = (sort) => new RegExp(`^(\\+|-)?(${String(sort)}|text)$`);
5
5
  export const toValidTextRegexp = (str) => typeof str === 'string'
package/lib/index.d.ts CHANGED
@@ -1,11 +1,6 @@
1
- export * from './QueryError';
2
- export * from './Query';
3
- export * from './QueryHandler';
4
- export * from './QueryHistory';
5
- export * from './QueryModel';
6
- export * from './utils/Query.utils';
7
- export * from './utils/types';
8
- export { toValidNumber } from './utils/Query.utils';
9
- export { ISearchPaginate } from './utils/utils';
10
- export { IQueryAddToModelQuery } from './utils/types';
11
- export { IQueryOptions } from './utils/types';
1
+ export * from './utils/index.js';
2
+ export * from './QueryError.js';
3
+ export * from './Query.js';
4
+ export * from './QueryHandler.js';
5
+ export * from './QueryHistory.js';
6
+ export * from './QueryModel.js';
package/lib/index.js CHANGED
@@ -1,8 +1,6 @@
1
- export * from './QueryError';
2
- export * from './Query';
3
- export * from './QueryHandler';
4
- export * from './QueryHistory';
5
- export * from './QueryModel';
6
- export * from './utils/Query.utils';
7
- export * from './utils/types';
8
- export { toValidNumber } from './utils/Query.utils';
1
+ export * from './utils/index.js';
2
+ export * from './QueryError.js';
3
+ export * from './Query.js';
4
+ export * from './QueryHandler.js';
5
+ export * from './QueryHistory.js';
6
+ export * from './QueryModel.js';
@@ -1,4 +1,4 @@
1
- import { toValidTextRegexp } from '../QueryModel';
1
+ import { toValidTextRegexp } from '../QueryModel.js';
2
2
  const VALUE_SPLIT = /,|\s/;
3
3
  const POPULATE_SPLIT = ';';
4
4
  const POPULATE_PATH_SPLIT = ':';
@@ -0,0 +1,3 @@
1
+ export * from './Query.utils.js';
2
+ export * from './types.js';
3
+ export * from './utils.js';
@@ -0,0 +1,3 @@
1
+ export * from './Query.utils.js';
2
+ export * from './types.js';
3
+ export * from './utils.js';
@@ -1,4 +1,4 @@
1
- import { Query } from '../Query';
1
+ import type { Query } from '../Query.js';
2
2
  export interface ISearchPaginate<T> {
3
3
  data: T[];
4
4
  count: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ewb/mongoose-query",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "Parse queries and params to mongoose search. Strips dangerous keys and set corrects options with help of query values.",
6
6
  "main": "./lib/index.js",