@budibase/shared-core 2.29.3 → 2.29.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.
@@ -1,5 +1,6 @@
1
1
  export * from "./api";
2
2
  export * from "./fields";
3
+ export * from "./rows";
3
4
  export declare const OperatorOptions: {
4
5
  Equals: {
5
6
  value: string;
@@ -0,0 +1,3 @@
1
+ export declare const CONSTANT_INTERNAL_ROW_COLS: readonly ["_id", "_rev", "type", "createdAt", "updatedAt", "tableId"];
2
+ export declare const CONSTANT_EXTERNAL_ROW_COLS: readonly ["_id", "_rev", "tableId"];
3
+ export declare function isInternalColumnName(name: string): boolean;
package/dist/filters.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Datasource, BBReferenceFieldSubType, FieldType, FormulaType, SearchFilter, SearchFilters, SearchFilterOperator, SortType, FieldConstraints, SortOrder, RowSearchParams, SearchResponse } from "@budibase/types";
1
+ import { Datasource, BBReferenceFieldSubType, FieldType, FormulaType, SearchFilter, SearchFilters, SearchQueryFields, SortType, FieldConstraints, SortOrder, RowSearchParams, SearchResponse } from "@budibase/types";
2
2
  /**
3
3
  * Returns the valid operator options for a certain data type
4
4
  */
@@ -16,7 +16,7 @@ export declare const getValidOperatorsForType: (fieldType: {
16
16
  /**
17
17
  * Operators which do not support empty strings as values
18
18
  */
19
- export declare const NoEmptyFilterStrings: (SearchFilterOperator | "fuzzyOr" | "documentType")[];
19
+ export declare const NoEmptyFilterStrings: (keyof SearchQueryFields)[];
20
20
  /**
21
21
  * Removes a numeric prefix on field names designed to give fields uniqueness
22
22
  */
@@ -1,3 +1,3 @@
1
1
  import { Datasource, SourceName } from "@budibase/types";
2
- export declare function isGoogleSheets(type: SourceName): boolean;
2
+ export declare function isGoogleSheets(type: SourceName): type is SourceName.GOOGLE_SHEETS;
3
3
  export declare function isSQL(datasource: Datasource): boolean;
package/dist/index.js CHANGED
@@ -1044,10 +1044,10 @@ var require_lodash = __commonJS({
1044
1044
  }();
1045
1045
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
1046
1046
  var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
1047
- var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
1047
+ var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
1048
1048
  var metaMap = WeakMap && new WeakMap();
1049
1049
  var realNames = {};
1050
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
1050
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
1051
1051
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
1052
1052
  function lodash(value) {
1053
1053
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -2801,8 +2801,8 @@ var require_lodash = __commonJS({
2801
2801
  return func(number);
2802
2802
  };
2803
2803
  }
2804
- var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values3) {
2805
- return new Set(values3);
2804
+ var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values3) {
2805
+ return new Set2(values3);
2806
2806
  };
2807
2807
  function createToPairs(keysFunc) {
2808
2808
  return function(object) {
@@ -3101,7 +3101,7 @@ var require_lodash = __commonJS({
3101
3101
  return result2;
3102
3102
  };
3103
3103
  var getTag = baseGetTag;
3104
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
3104
+ if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
3105
3105
  getTag = function(value) {
3106
3106
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
3107
3107
  if (ctorString) {
@@ -10013,6 +10013,8 @@ __export(src_exports, {
10013
10013
  BpmStatusKey: () => BpmStatusKey,
10014
10014
  BpmStatusValue: () => BpmStatusValue,
10015
10015
  BuilderSocketEvent: () => BuilderSocketEvent,
10016
+ CONSTANT_EXTERNAL_ROW_COLS: () => CONSTANT_EXTERNAL_ROW_COLS,
10017
+ CONSTANT_INTERNAL_ROW_COLS: () => CONSTANT_INTERNAL_ROW_COLS,
10016
10018
  DEFAULT_BB_DATASOURCE_ID: () => DEFAULT_BB_DATASOURCE_ID,
10017
10019
  GridSocketEvent: () => GridSocketEvent,
10018
10020
  Header: () => Header,
@@ -10029,7 +10031,9 @@ __export(src_exports, {
10029
10031
  canBeDisplayColumn: () => canBeDisplayColumn,
10030
10032
  canBeSortColumn: () => canBeSortColumn,
10031
10033
  dataFilters: () => filters_exports,
10034
+ findDuplicateInternalColumns: () => findDuplicateInternalColumns,
10032
10035
  helpers: () => helpers_exports,
10036
+ isInternalColumnName: () => isInternalColumnName,
10033
10037
  sdk: () => sdk_exports,
10034
10038
  utils: () => utils_exports
10035
10039
  });
@@ -10176,6 +10180,20 @@ var SWITCHABLE_TYPES = {
10176
10180
  ["number" /* NUMBER */]: ["number" /* NUMBER */, "boolean" /* BOOLEAN */]
10177
10181
  };
10178
10182
 
10183
+ // src/constants/rows.ts
10184
+ var CONSTANT_INTERNAL_ROW_COLS = [
10185
+ "_id",
10186
+ "_rev",
10187
+ "type",
10188
+ "createdAt",
10189
+ "updatedAt",
10190
+ "tableId"
10191
+ ];
10192
+ var CONSTANT_EXTERNAL_ROW_COLS = ["_id", "_rev", "tableId"];
10193
+ function isInternalColumnName(name) {
10194
+ return CONSTANT_INTERNAL_ROW_COLS.includes(name);
10195
+ }
10196
+
10179
10197
  // src/constants/index.ts
10180
10198
  var OperatorOptions = {
10181
10199
  Equals: {
@@ -10682,12 +10700,16 @@ var buildQuery = (filter) => {
10682
10700
  query.equal = query.equal || {};
10683
10701
  query.equal[field] = true;
10684
10702
  } else {
10685
- query[queryOperator] = query[queryOperator] || {};
10686
- query[queryOperator][field] = value;
10703
+ query[queryOperator] = {
10704
+ ...query[queryOperator],
10705
+ [field]: value
10706
+ };
10687
10707
  }
10688
10708
  } else {
10689
- query[queryOperator] = query[queryOperator] || {};
10690
- query[queryOperator][field] = value;
10709
+ query[queryOperator] = {
10710
+ ...query[queryOperator],
10711
+ [field]: value
10712
+ };
10691
10713
  }
10692
10714
  }
10693
10715
  });
@@ -11215,6 +11237,26 @@ function canBeDisplayColumn(type) {
11215
11237
  function canBeSortColumn(type) {
11216
11238
  return !!allowSortColumnByType[type];
11217
11239
  }
11240
+ function findDuplicateInternalColumns(table) {
11241
+ const casedKeys = Object.keys(table.schema);
11242
+ const uncasedKeys = casedKeys.map((colName) => colName.toLowerCase());
11243
+ const set = new Set(uncasedKeys);
11244
+ let duplicates = [];
11245
+ if (set.size !== uncasedKeys.length) {
11246
+ for (let key of set.keys()) {
11247
+ const count = uncasedKeys.filter((name) => name === key).length;
11248
+ if (count > 1) {
11249
+ duplicates.push(key);
11250
+ }
11251
+ }
11252
+ }
11253
+ for (let internalColumn of CONSTANT_INTERNAL_ROW_COLS) {
11254
+ if (casedKeys.find((key) => key === internalColumn)) {
11255
+ duplicates.push(internalColumn);
11256
+ }
11257
+ }
11258
+ return duplicates;
11259
+ }
11218
11260
  // Annotate the CommonJS export names for ESM import in node:
11219
11261
  0 && (module.exports = {
11220
11262
  BpmCorrelationKey,
@@ -11222,6 +11264,8 @@ function canBeSortColumn(type) {
11222
11264
  BpmStatusKey,
11223
11265
  BpmStatusValue,
11224
11266
  BuilderSocketEvent,
11267
+ CONSTANT_EXTERNAL_ROW_COLS,
11268
+ CONSTANT_INTERNAL_ROW_COLS,
11225
11269
  DEFAULT_BB_DATASOURCE_ID,
11226
11270
  GridSocketEvent,
11227
11271
  Header,
@@ -11238,7 +11282,9 @@ function canBeSortColumn(type) {
11238
11282
  canBeDisplayColumn,
11239
11283
  canBeSortColumn,
11240
11284
  dataFilters,
11285
+ findDuplicateInternalColumns,
11241
11286
  helpers,
11287
+ isInternalColumnName,
11242
11288
  sdk,
11243
11289
  utils
11244
11290
  });