@budibase/shared-core 2.30.2 → 2.30.4
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 +4 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +2 -2
- package/dist/index.js.meta.json +1 -1
- package/dist/table.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/filters.d.ts
CHANGED
|
@@ -69,8 +69,11 @@ export declare const search: (docs: Record<string, any>[], query: RowSearchParam
|
|
|
69
69
|
* Performs a client-side search on an array of data
|
|
70
70
|
* @param docs the data
|
|
71
71
|
* @param query the JSON query
|
|
72
|
+
* @param findInDoc optional fn when trying to extract a value
|
|
73
|
+
* from custom doc type e.g. Google Sheets
|
|
74
|
+
*
|
|
72
75
|
*/
|
|
73
|
-
export declare const runQuery: (docs: Record<string, any>[], query: SearchFilters) => Record<string, any>[];
|
|
76
|
+
export declare const runQuery: (docs: Record<string, any>[], query: SearchFilters, findInDoc?: Function) => Record<string, any>[];
|
|
74
77
|
/**
|
|
75
78
|
* Performs a client-side sort from the equivalent server-side lucene sort
|
|
76
79
|
* parameters.
|
package/dist/index.js
CHANGED
|
@@ -10030,6 +10030,7 @@ __export(src_exports, {
|
|
|
10030
10030
|
ValidSnippetNameRegex: () => ValidSnippetNameRegex,
|
|
10031
10031
|
canBeDisplayColumn: () => canBeDisplayColumn,
|
|
10032
10032
|
canBeSortColumn: () => canBeSortColumn,
|
|
10033
|
+
canHaveDefaultColumn: () => canHaveDefaultColumn,
|
|
10033
10034
|
dataFilters: () => filters_exports,
|
|
10034
10035
|
findDuplicateInternalColumns: () => findDuplicateInternalColumns,
|
|
10035
10036
|
helpers: () => helpers_exports,
|
|
@@ -10128,6 +10129,7 @@ var AutomationActionStepId = /* @__PURE__ */ ((AutomationActionStepId2) => {
|
|
|
10128
10129
|
AutomationActionStepId2["COLLECT"] = "COLLECT";
|
|
10129
10130
|
AutomationActionStepId2["OPENAI"] = "OPENAI";
|
|
10130
10131
|
AutomationActionStepId2["TRIGGER_AUTOMATION_RUN"] = "TRIGGER_AUTOMATION_RUN";
|
|
10132
|
+
AutomationActionStepId2["BRANCH"] = "BRANCH";
|
|
10131
10133
|
AutomationActionStepId2["discord"] = "discord";
|
|
10132
10134
|
AutomationActionStepId2["slack"] = "slack";
|
|
10133
10135
|
AutomationActionStepId2["zapier"] = "zapier";
|
|
@@ -10850,7 +10852,7 @@ var search = (docs, query) => {
|
|
|
10850
10852
|
}
|
|
10851
10853
|
return response;
|
|
10852
10854
|
};
|
|
10853
|
-
var runQuery = (docs, query) => {
|
|
10855
|
+
var runQuery = (docs, query, findInDoc = deepGet) => {
|
|
10854
10856
|
if (!docs || !Array.isArray(docs)) {
|
|
10855
10857
|
return [];
|
|
10856
10858
|
}
|
|
@@ -10864,7 +10866,7 @@ var runQuery = (docs, query) => {
|
|
|
10864
10866
|
}
|
|
10865
10867
|
const match = (type, test) => (doc) => {
|
|
10866
10868
|
for (const [key, testValue] of Object.entries(query[type] || {})) {
|
|
10867
|
-
const valueToCheck = isLogicalSearchOperator(type) ? doc :
|
|
10869
|
+
const valueToCheck = isLogicalSearchOperator(type) ? doc : findInDoc(doc, removeKeyNumbering(key));
|
|
10868
10870
|
const result = test(valueToCheck, testValue);
|
|
10869
10871
|
if (query.allOr && result) {
|
|
10870
10872
|
return true;
|
|
@@ -11403,12 +11405,36 @@ var allowSortColumnByType = {
|
|
|
11403
11405
|
["bb_reference" /* BB_REFERENCE */]: false,
|
|
11404
11406
|
["bb_reference_single" /* BB_REFERENCE_SINGLE */]: false
|
|
11405
11407
|
};
|
|
11408
|
+
var allowDefaultColumnByType = {
|
|
11409
|
+
["number" /* NUMBER */]: true,
|
|
11410
|
+
["json" /* JSON */]: true,
|
|
11411
|
+
["datetime" /* DATETIME */]: true,
|
|
11412
|
+
["longform" /* LONGFORM */]: true,
|
|
11413
|
+
["string" /* STRING */]: true,
|
|
11414
|
+
["options" /* OPTIONS */]: false,
|
|
11415
|
+
["auto" /* AUTO */]: false,
|
|
11416
|
+
["internal" /* INTERNAL */]: false,
|
|
11417
|
+
["barcodeqr" /* BARCODEQR */]: false,
|
|
11418
|
+
["bigint" /* BIGINT */]: false,
|
|
11419
|
+
["boolean" /* BOOLEAN */]: false,
|
|
11420
|
+
["formula" /* FORMULA */]: false,
|
|
11421
|
+
["attachment" /* ATTACHMENTS */]: false,
|
|
11422
|
+
["attachment_single" /* ATTACHMENT_SINGLE */]: false,
|
|
11423
|
+
["signature_single" /* SIGNATURE_SINGLE */]: false,
|
|
11424
|
+
["array" /* ARRAY */]: false,
|
|
11425
|
+
["link" /* LINK */]: false,
|
|
11426
|
+
["bb_reference" /* BB_REFERENCE */]: false,
|
|
11427
|
+
["bb_reference_single" /* BB_REFERENCE_SINGLE */]: false
|
|
11428
|
+
};
|
|
11406
11429
|
function canBeDisplayColumn(type) {
|
|
11407
11430
|
return !!allowDisplayColumnByType[type];
|
|
11408
11431
|
}
|
|
11409
11432
|
function canBeSortColumn(type) {
|
|
11410
11433
|
return !!allowSortColumnByType[type];
|
|
11411
11434
|
}
|
|
11435
|
+
function canHaveDefaultColumn(type) {
|
|
11436
|
+
return !!allowDefaultColumnByType[type];
|
|
11437
|
+
}
|
|
11412
11438
|
function findDuplicateInternalColumns(table) {
|
|
11413
11439
|
const casedKeys = Object.keys(table.schema);
|
|
11414
11440
|
const uncasedKeys = casedKeys.map((colName) => colName.toLowerCase());
|
|
@@ -11453,6 +11479,7 @@ function findDuplicateInternalColumns(table) {
|
|
|
11453
11479
|
ValidSnippetNameRegex,
|
|
11454
11480
|
canBeDisplayColumn,
|
|
11455
11481
|
canBeSortColumn,
|
|
11482
|
+
canHaveDefaultColumn,
|
|
11456
11483
|
dataFilters,
|
|
11457
11484
|
findDuplicateInternalColumns,
|
|
11458
11485
|
helpers,
|