@taruvi/refine-providers 1.3.4-beta.1 → 1.3.4-beta.2
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.cjs +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var DataLoader__default = /*#__PURE__*/_interopDefault(DataLoader);
|
|
|
11
11
|
|
|
12
12
|
// package.json
|
|
13
13
|
var package_default = {
|
|
14
|
-
version: "1.3.4-beta.
|
|
14
|
+
version: "1.3.4-beta.2"};
|
|
15
15
|
|
|
16
16
|
// src/utils.ts
|
|
17
17
|
var REFINE_OPERATOR_MAP = {
|
|
@@ -464,6 +464,16 @@ function applyAllowedActions(query, meta) {
|
|
|
464
464
|
if (!meta?.allowedActions?.length) return query;
|
|
465
465
|
return query.allowedActions(meta.allowedActions);
|
|
466
466
|
}
|
|
467
|
+
function applySearchAndFields(query, meta) {
|
|
468
|
+
if (!meta) return query;
|
|
469
|
+
let result = query;
|
|
470
|
+
const search = meta.search?.trim();
|
|
471
|
+
if (search) result = result.search(search);
|
|
472
|
+
const select = meta.select;
|
|
473
|
+
const fields = typeof select === "string" ? select.trim() : Array.isArray(select) ? select.map(String).join(",") : "";
|
|
474
|
+
if (fields) result = result.fields(fields);
|
|
475
|
+
return result;
|
|
476
|
+
}
|
|
467
477
|
function isGraphQuery(meta) {
|
|
468
478
|
return !!(meta?.format || meta?.graph_types || meta?.include || meta?.depth);
|
|
469
479
|
}
|
|
@@ -501,6 +511,7 @@ function dataProvider(client) {
|
|
|
501
511
|
query = applyPagination(query, pagination);
|
|
502
512
|
query = applyPopulate(query, taruviMeta);
|
|
503
513
|
query = applyAggregations(query, taruviMeta);
|
|
514
|
+
query = applySearchAndFields(query, taruviMeta);
|
|
504
515
|
query = applyAllowedActions(query, taruviMeta);
|
|
505
516
|
const response = await query.execute();
|
|
506
517
|
return { data: response.data, total: response.total };
|