next-data-kit 7.0.0 → 7.1.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/dist/{action-F0-8vFtS.d.cts → action-C-MJOe6-.d.cts} +1 -1
- package/dist/{action-F0-8vFtS.d.ts → action-C-MJOe6-.d.ts} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +6 -6
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +6 -6
- package/dist/server.js.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/server/action.d.ts +1 -1
- package/dist/types/server/action.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -164,7 +164,7 @@ type TBaseOptions<TDoc, R> = {
|
|
|
164
164
|
type TMongooseOptions<M, TDoc, R> = TBaseOptions<TDoc, R> & {
|
|
165
165
|
model: M;
|
|
166
166
|
adapter?: never;
|
|
167
|
-
filter?: (filterInput?: Record<string, unknown>) => TMongoFilterQuery<TDoc>;
|
|
167
|
+
filter?: ((filterInput?: Record<string, unknown>) => TMongoFilterQuery<TDoc>) | TMongoFilterQuery<TDoc>;
|
|
168
168
|
filterCustom?: TFilterCustomConfigWithFilter<TDoc, TMongoFilterQuery<TDoc>>;
|
|
169
169
|
defaultSort?: TSortOptions<TDoc>;
|
|
170
170
|
};
|
|
@@ -164,7 +164,7 @@ type TBaseOptions<TDoc, R> = {
|
|
|
164
164
|
type TMongooseOptions<M, TDoc, R> = TBaseOptions<TDoc, R> & {
|
|
165
165
|
model: M;
|
|
166
166
|
adapter?: never;
|
|
167
|
-
filter?: (filterInput?: Record<string, unknown>) => TMongoFilterQuery<TDoc>;
|
|
167
|
+
filter?: ((filterInput?: Record<string, unknown>) => TMongoFilterQuery<TDoc>) | TMongoFilterQuery<TDoc>;
|
|
168
168
|
filterCustom?: TFilterCustomConfigWithFilter<TDoc, TMongoFilterQuery<TDoc>>;
|
|
169
169
|
defaultSort?: TSortOptions<TDoc>;
|
|
170
170
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -106,7 +106,7 @@ var calculatePagination = (page, limit, total) => ({
|
|
|
106
106
|
|
|
107
107
|
// src/server/adapters/mongoose.ts
|
|
108
108
|
var mongooseAdapter = (model, options = {}) => {
|
|
109
|
-
const { filter:
|
|
109
|
+
const { filter: customFilter, filterCustom, defaultSort = { _id: -1 } } = options;
|
|
110
110
|
return async ({ filter, sorts, limit, skip, input }) => {
|
|
111
111
|
let sortOption;
|
|
112
112
|
if (input.sort && Object.keys(input.sort).length > 0) {
|
|
@@ -129,11 +129,11 @@ var mongooseAdapter = (model, options = {}) => {
|
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
if (
|
|
133
|
-
const customQuery =
|
|
132
|
+
if (customFilter) {
|
|
133
|
+
const customQuery = typeof customFilter === "function" ? customFilter(filter) : customFilter;
|
|
134
134
|
filterQuery = { ...filterQuery, ...customQuery };
|
|
135
135
|
}
|
|
136
|
-
if (filter && !
|
|
136
|
+
if (filter && !customFilter) {
|
|
137
137
|
if (input.filterConfig) {
|
|
138
138
|
Object.entries(filter).forEach(([key, value]) => {
|
|
139
139
|
if (isProvided(value) && isSafeKey(key) && input.filterConfig?.[key]) {
|
|
@@ -167,8 +167,8 @@ var mongooseAdapter = (model, options = {}) => {
|
|
|
167
167
|
if (filterCustom && filter) {
|
|
168
168
|
Object.entries(filter).forEach(([key, value]) => {
|
|
169
169
|
if (isProvided(value) && isSafeKey(key) && filterCustom[key]) {
|
|
170
|
-
const
|
|
171
|
-
filterQuery = { ...filterQuery, ...
|
|
170
|
+
const customFilter2 = filterCustom[key](value);
|
|
171
|
+
filterQuery = { ...filterQuery, ...customFilter2 };
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
}
|