@budibase/shared-core 2.32.12 → 2.32.14
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/filters.d.ts +1 -1
- package/dist/helpers/views.d.ts +1 -0
- package/dist/index.js +14 -2
- package/dist/index.js.map +2 -2
- package/dist/index.js.meta.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/filters.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export declare const buildQueryLegacy: (filter?: LegacyFilter[] | SearchFilters)
|
|
|
74
74
|
*/
|
|
75
75
|
export declare const buildQuery: (filter?: SearchFilterGroup | LegacyFilter[]) => SearchFilters | undefined;
|
|
76
76
|
export declare function fixupFilterArrays(filters: SearchFilters): SearchFilters;
|
|
77
|
-
export declare function search<T
|
|
77
|
+
export declare function search<T extends Record<string, any>>(docs: T[], query: Omit<RowSearchParams, "tableId">): SearchResponse<T>;
|
|
78
78
|
/**
|
|
79
79
|
* Performs a client-side search on an array of data
|
|
80
80
|
* @param docs the data
|
package/dist/helpers/views.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare function isCalculationField(field: ViewFieldMetadata): field is V
|
|
|
3
3
|
export declare function isBasicViewField(field: ViewFieldMetadata): field is BasicViewFieldMetadata;
|
|
4
4
|
type UnsavedViewV2 = Omit<ViewV2, "id" | "version">;
|
|
5
5
|
export declare function isCalculationView(view: UnsavedViewV2): boolean;
|
|
6
|
+
export declare function hasCalculationFields(view: UnsavedViewV2): boolean;
|
|
6
7
|
export declare function calculationFields(view: UnsavedViewV2): import("lodash").Dictionary<ViewCalculationFieldMetadata>;
|
|
7
8
|
export declare function basicFields(view: UnsavedViewV2): import("lodash").Dictionary<ViewFieldMetadata>;
|
|
8
9
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -17554,10 +17554,18 @@ function isSupportedUserSearch(query) {
|
|
|
17554
17554
|
{ op: "equal" /* EQUAL */, key: "_id" },
|
|
17555
17555
|
{ op: "oneOf" /* ONE_OF */, key: "_id" }
|
|
17556
17556
|
];
|
|
17557
|
-
for (
|
|
17557
|
+
for (const [key, operation] of Object.entries(query)) {
|
|
17558
17558
|
if (typeof operation !== "object") {
|
|
17559
17559
|
return false;
|
|
17560
17560
|
}
|
|
17561
|
+
if (isLogicalSearchOperator(key)) {
|
|
17562
|
+
for (const condition of query[key].conditions) {
|
|
17563
|
+
if (!isSupportedUserSearch(condition)) {
|
|
17564
|
+
return false;
|
|
17565
|
+
}
|
|
17566
|
+
}
|
|
17567
|
+
return true;
|
|
17568
|
+
}
|
|
17561
17569
|
const fields = Object.keys(operation || {});
|
|
17562
17570
|
if (fields.length === 0) {
|
|
17563
17571
|
continue;
|
|
@@ -17840,6 +17848,7 @@ var views_exports = {};
|
|
|
17840
17848
|
__export(views_exports, {
|
|
17841
17849
|
basicFields: () => basicFields,
|
|
17842
17850
|
calculationFields: () => calculationFields,
|
|
17851
|
+
hasCalculationFields: () => hasCalculationFields,
|
|
17843
17852
|
isBasicViewField: () => isBasicViewField,
|
|
17844
17853
|
isCalculationField: () => isCalculationField,
|
|
17845
17854
|
isCalculationView: () => isCalculationView
|
|
@@ -17852,6 +17861,9 @@ function isBasicViewField(field) {
|
|
|
17852
17861
|
return !isCalculationField(field);
|
|
17853
17862
|
}
|
|
17854
17863
|
function isCalculationView(view) {
|
|
17864
|
+
return view.type === "calculation" /* CALCULATION */;
|
|
17865
|
+
}
|
|
17866
|
+
function hasCalculationFields(view) {
|
|
17855
17867
|
return Object.values(view.schema || {}).some(isCalculationField);
|
|
17856
17868
|
}
|
|
17857
17869
|
function calculationFields(view) {
|
|
@@ -18285,7 +18297,7 @@ function search(docs, query) {
|
|
|
18285
18297
|
if (query.sort) {
|
|
18286
18298
|
result = sort(result, query.sort, query.sortOrder || "ascending" /* ASCENDING */);
|
|
18287
18299
|
}
|
|
18288
|
-
|
|
18300
|
+
const totalRows = result.length;
|
|
18289
18301
|
if (query.limit) {
|
|
18290
18302
|
result = limit(result, query.limit.toString());
|
|
18291
18303
|
}
|