next-data-kit 9.9.0 → 9.9.1
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/{chunk-MZXOHY2F.cjs → chunk-MTJATM72.cjs} +14 -16
- package/dist/chunk-MTJATM72.cjs.map +1 -0
- package/dist/{chunk-C2PPVHBY.js → chunk-O377UO7C.js} +14 -16
- package/dist/chunk-O377UO7C.js.map +1 -0
- package/dist/client.cjs +11 -11
- package/dist/client.js +1 -1
- package/dist/index.cjs +29 -29
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-C2PPVHBY.js.map +0 -1
- package/dist/chunk-MZXOHY2F.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMTJATM72_cjs = require('./chunk-MTJATM72.cjs');
|
|
4
4
|
var chunk5TIEIY7M_cjs = require('./chunk-5TIEIY7M.cjs');
|
|
5
5
|
|
|
6
6
|
// src/server/adapters/mongoose.ts
|
|
@@ -23,7 +23,7 @@ var mongooseAdapter = (model, options = {}) => {
|
|
|
23
23
|
let filterQuery = {};
|
|
24
24
|
if (input.query) {
|
|
25
25
|
Object.entries(input.query).forEach(([key, value]) => {
|
|
26
|
-
if (
|
|
26
|
+
if (chunkMTJATM72_cjs.isProvided(value) && chunkMTJATM72_cjs.isSafeKey(key)) {
|
|
27
27
|
filterQuery[key] = value;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -36,12 +36,12 @@ var mongooseAdapter = (model, options = {}) => {
|
|
|
36
36
|
if (input.filterConfig) {
|
|
37
37
|
Object.entries(filter).forEach(([key, value]) => {
|
|
38
38
|
if (filterCustom && filterCustom[key]) return;
|
|
39
|
-
if (
|
|
39
|
+
if (chunkMTJATM72_cjs.isProvided(value) && chunkMTJATM72_cjs.isSafeKey(key) && input.filterConfig?.[key]) {
|
|
40
40
|
const config = input.filterConfig[key];
|
|
41
41
|
const fieldName = config?.field ?? key;
|
|
42
42
|
if (config?.type === "REGEX") {
|
|
43
43
|
filterQuery[fieldName] = {
|
|
44
|
-
$regex:
|
|
44
|
+
$regex: chunkMTJATM72_cjs.escapeRegex(String(value)),
|
|
45
45
|
$options: "i"
|
|
46
46
|
};
|
|
47
47
|
} else if (config?.type === "EXACT") {
|
|
@@ -52,10 +52,10 @@ var mongooseAdapter = (model, options = {}) => {
|
|
|
52
52
|
} else {
|
|
53
53
|
Object.entries(filter).forEach(([key, value]) => {
|
|
54
54
|
if (filterCustom && filterCustom[key]) return;
|
|
55
|
-
if (
|
|
55
|
+
if (chunkMTJATM72_cjs.isProvided(value) && chunkMTJATM72_cjs.isSafeKey(key)) {
|
|
56
56
|
if (typeof value === "string") {
|
|
57
57
|
filterQuery[key] = {
|
|
58
|
-
$regex:
|
|
58
|
+
$regex: chunkMTJATM72_cjs.escapeRegex(value),
|
|
59
59
|
$options: "i"
|
|
60
60
|
};
|
|
61
61
|
} else if (typeof value === "number" || typeof value === "boolean") {
|
|
@@ -67,7 +67,7 @@ var mongooseAdapter = (model, options = {}) => {
|
|
|
67
67
|
}
|
|
68
68
|
if (filterCustom && filter) {
|
|
69
69
|
Object.entries(filter).forEach(([key, value]) => {
|
|
70
|
-
if (
|
|
70
|
+
if (chunkMTJATM72_cjs.isProvided(value) && chunkMTJATM72_cjs.isSafeKey(key) && filterCustom[key]) {
|
|
71
71
|
const customFilter2 = filterCustom[key](value);
|
|
72
72
|
filterQuery = { ...filterQuery, ...customFilter2 };
|
|
73
73
|
}
|
|
@@ -173,35 +173,35 @@ var adapterMemory = (dataset, options = {}) => {
|
|
|
173
173
|
const query = input.query ?? {};
|
|
174
174
|
let rows = dataset.filter((row) => {
|
|
175
175
|
for (const [key, value] of Object.entries(query)) {
|
|
176
|
-
if (!
|
|
177
|
-
const rowValue =
|
|
178
|
-
if (!
|
|
176
|
+
if (!chunkMTJATM72_cjs.isProvided(value)) continue;
|
|
177
|
+
const rowValue = chunkMTJATM72_cjs.getValueByPath(row, key);
|
|
178
|
+
if (!chunkMTJATM72_cjs.matchesExact(rowValue, value)) return false;
|
|
179
179
|
}
|
|
180
180
|
return true;
|
|
181
181
|
});
|
|
182
182
|
const effectiveFilter = filter ?? {};
|
|
183
183
|
rows = rows.filter((row) => {
|
|
184
184
|
for (const [key, value] of Object.entries(effectiveFilter)) {
|
|
185
|
-
if (!
|
|
185
|
+
if (!chunkMTJATM72_cjs.isProvided(value)) continue;
|
|
186
186
|
const config = filterConfig?.[key];
|
|
187
187
|
const field = config?.field ?? key;
|
|
188
|
-
const rowValue =
|
|
188
|
+
const rowValue = chunkMTJATM72_cjs.getValueByPath(row, field);
|
|
189
189
|
const type = config?.type ?? defaultFilterType;
|
|
190
190
|
if (type === "regex") {
|
|
191
|
-
if (!
|
|
191
|
+
if (!chunkMTJATM72_cjs.matchesRegexLike(rowValue, value)) return false;
|
|
192
192
|
} else {
|
|
193
|
-
if (!
|
|
193
|
+
if (!chunkMTJATM72_cjs.matchesExact(rowValue, value)) return false;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
return true;
|
|
197
197
|
});
|
|
198
|
-
const normalizedSorts =
|
|
198
|
+
const normalizedSorts = chunkMTJATM72_cjs.normalizeSorts(sorts);
|
|
199
199
|
if (normalizedSorts.length > 0) {
|
|
200
200
|
rows = [...rows].sort((ra, rb) => {
|
|
201
201
|
for (const s of normalizedSorts) {
|
|
202
|
-
const av =
|
|
203
|
-
const bv =
|
|
204
|
-
const cmp =
|
|
202
|
+
const av = chunkMTJATM72_cjs.getValueByPath(ra, s.path);
|
|
203
|
+
const bv = chunkMTJATM72_cjs.getValueByPath(rb, s.path);
|
|
204
|
+
const cmp = chunkMTJATM72_cjs.compareValues(av, bv);
|
|
205
205
|
if (cmp !== 0) return s.value === 1 ? cmp : -cmp;
|
|
206
206
|
}
|
|
207
207
|
return 0;
|
|
@@ -215,47 +215,47 @@ var adapterMemory = (dataset, options = {}) => {
|
|
|
215
215
|
|
|
216
216
|
Object.defineProperty(exports, "DataKit", {
|
|
217
217
|
enumerable: true,
|
|
218
|
-
get: function () { return
|
|
218
|
+
get: function () { return chunkMTJATM72_cjs.DataKit; }
|
|
219
219
|
});
|
|
220
220
|
Object.defineProperty(exports, "DataKitContext", {
|
|
221
221
|
enumerable: true,
|
|
222
|
-
get: function () { return
|
|
222
|
+
get: function () { return chunkMTJATM72_cjs.DefaultDataKitContext; }
|
|
223
223
|
});
|
|
224
224
|
Object.defineProperty(exports, "DataKitProvider", {
|
|
225
225
|
enumerable: true,
|
|
226
|
-
get: function () { return
|
|
226
|
+
get: function () { return chunkMTJATM72_cjs.DefaultDataKitProvider; }
|
|
227
227
|
});
|
|
228
228
|
Object.defineProperty(exports, "calculatePagination", {
|
|
229
229
|
enumerable: true,
|
|
230
|
-
get: function () { return
|
|
230
|
+
get: function () { return chunkMTJATM72_cjs.calculatePagination; }
|
|
231
231
|
});
|
|
232
232
|
Object.defineProperty(exports, "createDataKitContext", {
|
|
233
233
|
enumerable: true,
|
|
234
|
-
get: function () { return
|
|
234
|
+
get: function () { return chunkMTJATM72_cjs.createDataKitContext; }
|
|
235
235
|
});
|
|
236
236
|
Object.defineProperty(exports, "createSearchFilter", {
|
|
237
237
|
enumerable: true,
|
|
238
|
-
get: function () { return
|
|
238
|
+
get: function () { return chunkMTJATM72_cjs.createSearchFilter; }
|
|
239
239
|
});
|
|
240
240
|
Object.defineProperty(exports, "escapeRegex", {
|
|
241
241
|
enumerable: true,
|
|
242
|
-
get: function () { return
|
|
242
|
+
get: function () { return chunkMTJATM72_cjs.escapeRegex; }
|
|
243
243
|
});
|
|
244
244
|
Object.defineProperty(exports, "useDataKitContext", {
|
|
245
245
|
enumerable: true,
|
|
246
|
-
get: function () { return
|
|
246
|
+
get: function () { return chunkMTJATM72_cjs.useDefaultDataKitContext; }
|
|
247
247
|
});
|
|
248
248
|
Object.defineProperty(exports, "usePagination", {
|
|
249
249
|
enumerable: true,
|
|
250
|
-
get: function () { return
|
|
250
|
+
get: function () { return chunkMTJATM72_cjs.usePagination; }
|
|
251
251
|
});
|
|
252
252
|
Object.defineProperty(exports, "useSelection", {
|
|
253
253
|
enumerable: true,
|
|
254
|
-
get: function () { return
|
|
254
|
+
get: function () { return chunkMTJATM72_cjs.useSelection; }
|
|
255
255
|
});
|
|
256
256
|
Object.defineProperty(exports, "useSelectionWithTotal", {
|
|
257
257
|
enumerable: true,
|
|
258
|
-
get: function () { return
|
|
258
|
+
get: function () { return chunkMTJATM72_cjs.useSelectionWithTotal; }
|
|
259
259
|
});
|
|
260
260
|
Object.defineProperty(exports, "debounce", {
|
|
261
261
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isProvided, isSafeKey, escapeRegex, getValueByPath, matchesExact, matchesRegexLike, normalizeSorts, compareValues } from './chunk-
|
|
2
|
-
export { DataKit, DefaultDataKitContext as DataKitContext, DefaultDataKitProvider as DataKitProvider, calculatePagination, createDataKitContext, createSearchFilter, escapeRegex, useDefaultDataKitContext as useDataKitContext, usePagination, useSelection, useSelectionWithTotal } from './chunk-
|
|
1
|
+
import { isProvided, isSafeKey, escapeRegex, getValueByPath, matchesExact, matchesRegexLike, normalizeSorts, compareValues } from './chunk-O377UO7C.js';
|
|
2
|
+
export { DataKit, DefaultDataKitContext as DataKitContext, DefaultDataKitProvider as DataKitProvider, calculatePagination, createDataKitContext, createSearchFilter, escapeRegex, useDefaultDataKitContext as useDataKitContext, usePagination, useSelection, useSelectionWithTotal } from './chunk-O377UO7C.js';
|
|
3
3
|
export { debounce, formatNumber, getColumnValue, getNextSortValue, getSortValue, keyToSortEntries, sortEntriesToKey, throttle, useDataKit } from './chunk-VFSNUXOW.js';
|
|
4
4
|
|
|
5
5
|
// src/server/adapters/mongoose.ts
|
package/package.json
CHANGED